1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- import{I as Ot,K as px,E as Ca}from"./index.c787b0a9.js";function Wa(e,t){var i=t||new Path2D,a=e.calculative.borderRadius||0,r=a,n=e.calculative.worldRect,o=n.x,s=n.y,h=n.width,l=n.height,c=n.ex,f=n.ey;a<1&&(a=h*a,r=l*r);var v=a<r?a:r;if(h<2*v&&(v=h/2),l<2*v&&(v=l/2),i.moveTo(o+v,s),i.arcTo(c,s,c,f,v),i.arcTo(c,f,o,f,v),i.arcTo(o,f,o,s,v),i.arcTo(o,s,c,s,v),i instanceof Path2D)return i}var bx=Wa;function _x(e,t){var i=t||new Path2D,a=e.calculative.worldRect,r=a.x,n=a.y,o=a.width,s=a.height;if(i.ellipse(r+o/2,n+s/2,o/2,s/2,0,0,Math.PI*2),i instanceof Path2D)return i}var Ye;(function(e){e[e.Node=0]="Node",e[e.Line=1]="Line"})(Ye||(Ye={}));var ze;(function(e){e[e.None=0]="None",e[e.DisableEdit=1]="DisableEdit",e[e.DisableMove=2]="DisableMove",e[e.DisableScale=3]="DisableScale",e[e.DisableMoveScale=4]="DisableMoveScale",e[e.Disable=10]="Disable"})(ze||(ze={}));var Jf;(function(e){e[e.Default=0]="Default",e[e.In=1]="In",e[e.Out=2]="Out"})(Jf||(Jf={}));var qa;(function(e){e[e.None=0]="None",e[e.Linear=1]="Linear",e[e.Radial=2]="Radial"})(qa||(qa={}));var Ne;(function(e){e[e.CanvasTemplate=1]="CanvasTemplate",e[e.CanvasImageBottom=2]="CanvasImageBottom",e[e.CanvasMain=3]="CanvasMain",e[e.CanvasImage=4]="CanvasImage"})(Ne||(Ne={}));var xx=["text","textWidth","textHeight","textLeft","textTop","fontFamily","fontSize","lineHeight","fontStyle","fontWeight","textAlign","textBaseline","whiteSpace","ellipsis","keepDecimal"],Ex=["x","y","width","height","flipX","flipY"],kx=["paddingTop","paddingRight","paddingBottom","paddingLeft","flipX","flipY","visible","showChild"],Cx=["iconLeft","iconTop","iconRotate"],ai;(function(e){e[e.Normal=0]="Normal",e[e.Beads=1]="Beads",e[e.Dot=2]="Dot",e[e.Arrow=3]="Arrow",e[e.WaterDrop=4]="WaterDrop"})(ai||(ai={}));var Ax=["gif","iframe","video","echarts","highcharts","lightningCharts"],hn=new Set(["borderRadius","paddingLeft","paddingRight","paddingTop","paddingBottom","progress","progressColor","verticalProgress","reverseProgress","flipX","flipY","input","lineDash","lineCap","lineJoin","strokeType","lineGradientFromColor","lineGradientToColor","lineGradientAngle","color","hoverColor","activeColor","lineWidth","bkType","gradientFromColor","gradientToColor","gradientAngle","gradientRadius","hoverBackground","activeBackground","globalAlpha","anchorColor","anchorRadius","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY","textHasShadow","fontFamily","fontSize","textColor","hoverTextColor","activeTextColor","textBackground","fontStyle","fontWeight","textAlign","textBaseline","lineHeight","whiteSpace","textWidth","textHeight","textLeft","textTop","ellipsis","hiddenText","keepDecimal","borderWidth","borderColor","animateLineWidth","lineAnimateType","frames","animateColor","animateType","animateReverse","background","gradientColors","lineGradientColors","animateLineWidth","gradientSmooth","lineSmooth"]);function Sx(e){e.onAdd=void 0,e.onValue=void 0,e.onBeforeValue=void 0,e.onDestroy=void 0,e.onMove=void 0,e.onResize=void 0,e.onRotate=void 0,e.onClick=void 0,e.onMouseEnter=void 0,e.onMouseLeave=void 0,e.onMouseDown=void 0,e.onMouseMove=void 0,e.onMouseUp=void 0,e.onShowInput=void 0,e.onInput=void 0,e.onChangeId=void 0,e.onBinds=void 0,e.onStartVideo=void 0,e.onPauseVideo=void 0,e.onStopVideo=void 0,e.onRenderPenRaw=void 0,e.onKeyDown=void 0,e.onContextmenu=void 0,e.onScale=void 0,e.onWheel=void 0,e.onConnectLine=void 0}var be;(function(e){e[e.None=0]="None",e[e.LineAnchor=1]="LineAnchor",e[e.NodeAnchor=2]="NodeAnchor",e[e.Line=3]="Line",e[e.Node=4]="Node",e[e.Resize=5]="Resize",e[e.Rotate=6]="Rotate",e[e.LineAnchorPrev=7]="LineAnchorPrev",e[e.LineAnchorNext=8]="LineAnchorNext"})(be||(be={}));var Ke;(function(e){e[e.None=0]="None",e[e.Translate=1]="Translate",e[e.Select=2]="Select",e[e.Resize=3]="Resize",e[e.AddAnchor=4]="AddAnchor"})(Ke||(Ke={}));var tr;(function(e){e[e.None=0]="None",e[e.Down=1]="Down",e[e.Translate=2]="Translate"})(tr||(tr={}));var Pe;(function(e){e[e.None=-1]="None",e[e.Up=0]="Up",e[e.Right=1]="Right",e[e.Bottom=2]="Bottom",e[e.Left=3]="Left"})(Pe||(Pe={}));var ed=["nw-resize","ne-resize","se-resize","sw-resize"],td=["n-resize","e-resize","s-resize","w-resize"],Tx=["curve","polyline","line"],$v=["dash","lineWidth","lineCap","lineJoin","strokeType","color","lineGradientFromColor","lineGradientToColor","lineGradientAngle","globalAlpha","bkType","background","gradientFromColor","gradientToColor","gradientAngle","gradientRadius","fontFamily","fontSize","textColor","hoverTextColor","activeTextColor","textBackground","fontStyle","fontWeight","textAlign","textBaseline","lineHeight","whiteSpace","textLeft","textTop","flipX","flipY","lineDash"],Zr;(function(e){e[e.Mirror=0]="Mirror",e[e.Bilateral=1]="Bilateral",e[e.Free=2]="Free"})(Zr||(Zr={}));var At;(function(e){e[e.Default=0]="Default",e[e.In=1]="In",e[e.Out=2]="Out",e[e.DisableConnected=3]="DisableConnected",e[e.DisableConnectTo=4]="DisableConnectTo",e[e.Disable=10]="Disable"})(At||(At={}));var ir;(function(e){e[e.Default=0]="Default",e[e.Line=1]="Line"})(ir||(ir={}));function Ge(e,t,i){if(!(!t||t%360===0)){var a=t*Math.PI/180,r=(e.x-i.x)*Math.cos(a)-(e.y-i.y)*Math.sin(a)+i.x,n=(e.x-i.x)*Math.sin(a)+(e.y-i.y)*Math.cos(a)+i.y;e.x=r,e.y=n,e.prev&&Ge(e.prev,t,i),e.next&&Ge(e.next,t,i)}}function Ia(e,t,i,a){if(i===void 0&&(i=5),t.type===ir.Line){var r=a.rotate;a.flipX&&(r*=-1),a.flipY&&(r*=-1);var n=t.rotate+r;return a.flipX&&(n*=-1),a.flipY&&(n*=-1),Da(e,{x:t.x-t.length*a.calculative.canvas.store.data.scale/2,y:t.y-i,width:t.length*a.calculative.canvas.store.data.scale,height:i*2,rotate:n})}else return e.x>t.x-i&&e.x<t.x+i&&e.y>t.y-i&&e.y<t.y+i}function os(e,t,i){e.x=i.x-(i.x-e.x)*t,e.y=i.y-(i.y-e.y)*t}function gi(e,t){if(e.x===t.x)return e.y<=t.y?0:180;if(e.y===t.y)return e.x<t.x?270:90;var i=e.x-t.x,a=e.y-t.y,r=Math.atan(Math.abs(i/a))/(2*Math.PI)*360;return i>0&&a>0?r=180-r:i<0&&a>0?r+=180:i<0&&a<0&&(r=360-r),r}function ws(e,t){var i=e.x-t.x,a=e.y-t.y;return Math.sqrt(i*i+a*a)}function Rx(e,t){var i=Pe.None;if(!t)return i;var a=e.x-t.x,r=e.y-t.y;return Math.abs(a)>Math.abs(r)?a>0?i=Pe.Right:i=Pe.Left:r>0?i=Pe.Bottom:i=Pe.Up,i}function wn(e,t,i){!e||(e.x+=t,e.y+=i,e.next&&(e.next.x+=t,e.next.y+=i),e.prev&&(e.prev.x+=t,e.prev.y+=i))}function id(e,t){return e.anchorId===t.anchorId&&e.connectTo===t.connectTo}function Do(e,t,i){var a=Math.sqrt((e.x-t.x)*(e.x-t.x)+(e.y-t.y)*(e.y-t.y))/i.data.scale;t.rotate===0?e.x<t.x?i.pens[t.penId].flipX||(a*=-1):i.pens[t.penId].flipX&&(a*=-1):e.y<t.y?i.pens[t.penId].flipY||(a*=-1):i.pens[t.penId].flipY&&(a*=-1),e.distance=a}const Px="@meta2d/core",Ix="1.0.48",Lx="@meta2d/core: Powerful, Beautiful, Simple, Open - Web-Based 2D At Its Best .",Dx="index.js",Mx="index.d.ts",Bx={copy:"shx cp package.build.json ../../dist/core/package.json",build:"tsc && npm run copy"},Ox=["meta2d","diagram","2D","canvas"],Nx="alsmile123@qq.com",Fx="MIT",zx={type:"git",url:"git+https://github.com/le5le-com/meta2d.js.git"},Hx={url:"https://github.com/le5le-com/meta2d.js/issues"},Ux="https://github.com/le5le-com/meta2d.js#readme",Wx={"@types/marked":"^4.0.3","@types/offscreencanvas":"latest"},qx={mitt:"^2.1.0",mqtt:"^4.2.6"},jx={access:"public"},Kx="78f2a53ca1839c89b56e2e498d17ba4eb987ad14",Yv={name:Px,version:Ix,description:Lx,main:Dx,types:Mx,scripts:Bx,keywords:Ox,author:Nx,license:Fx,repository:zx,bugs:Hx,homepage:Ux,devDependencies:Wx,dependencies:qx,publishConfig:jx,gitHead:Kx};var ke={version:Yv.version,path2dDraws:{},canvasDraws:{},anchors:{},htmlElements:{}};function Vx(e){Object.assign(ke.path2dDraws,e)}function $x(e){Object.assign(ke.canvasDraws,e)}function Yx(e){Object.assign(ke.anchors,e)}function Gx(e){return{all:e=e||new Map,on:function(t,i){var a=e.get(t);a&&a.push(i)||e.set(t,[i])},off:function(t,i){var a=e.get(t);a&&a.splice(a.indexOf(i)>>>0,1)},emit:function(t,i){(e.get(t)||[]).slice().map(function(a){a(i)}),(e.get("*")||[]).slice().map(function(a){a(t,i)})}}}var $r;(function(e){e[e.None=-1]="None",e[e.Document=0]="Document",e[e.Canvas=1]="Canvas"})($r||($r={}));var Xx={fontFamily:'"Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial',fontSize:12,lineHeight:1.5,textAlign:"center",textBaseline:"middle",color:"#222222",activeColor:"#278df8",hoverColor:"rgba(39,141,248,0.50)",anchorColor:"#278DF8",hoverAnchorColor:"#FF4101",anchorRadius:4,anchorBackground:"#fff",dockColor:"rgba(39,141,248,0.50)",dockPenColor:"#1890FF",dragColor:"#1890ff",rotateCursor:"rotate.cur",rightCursor:"right.cur",downCursor:"down.cur",hoverCursor:"pointer",minScale:.1,maxScale:10,keydown:$r.Document,gridSize:20,gridColor:"#e2e2e2",ruleColor:"#888888",drawingLineName:"curve",interval:30,animateInterval:30,autoPolyline:!0,autoAnchor:!0,autoAlignGrid:!1,animateColor:"#30EEDC",ruleLineColor:"#FF4101",shadowOffsetX:0,shadowOffsetY:0,shadowBlur:64,shadowColor:"#00000014",globalAlpha:1,defaultAnchors:[{x:.5,y:0},{x:1,y:.5},{x:.5,y:1},{x:0,y:.5}],measureTextWidth:!0,moveConnectedLine:!0,mouseRightActive:!0,disableClipboard:!1,drawingLineLength:0,disableTouchPadScale:!1,cdn:"",polylineSpace:10,domShapes:[],containerShapes:["table"],textFlip:!0,textRotate:!0,unavailableKeys:[],diagramOptions:{},svgPathStroke:!0},Zx={dark:{color:"#bdc7db",background:"#1e2430",parentBackground:"#080b0f",ruleColor:"#222E47",ruleOptions:{background:"#121924",textColor:"#6E7B91"}},light:{color:"#222222",background:"#FFFFFF",parentBackground:"#F0F1F2",ruleColor:"#C8D0E1",ruleOptions:{background:"#F7F8FA",textColor:"#C8D0E1"}}},ss=globalThis&&globalThis.__assign||function(){return ss=Object.assign||function(e){for(var t,i=1,a=arguments.length;i<a;i++){t=arguments[i];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},ss.apply(this,arguments)},Qx=globalThis&&globalThis.__values||function(e){var t=typeof Symbol=="function"&&Symbol.iterator,i=t&&e[t],a=0;if(i)return i.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},we;(function(e){e[e.Add=0]="Add",e[e.Update=1]="Update",e[e.Delete=2]="Delete",e[e.Replace=3]="Replace"})(we||(we={}));var Jx=function(){return{data:{x:0,y:0,scale:1,pens:[],origin:{x:0,y:0},center:{x:0,y:0},paths:{},theme:"light"},histories:[],pens:{},path2dMap:new WeakMap,animateMap:new WeakMap,active:[],animates:new Set,options:ss({},Xx),theme:ss({},Zx),emitter:Gx(),bindDatas:{},bind:{},pensNetwork:{},cacheDatas:[],messageEvents:{},templatePens:{},globalTriggers:{}}},e2=function(e){return e===void 0&&(e="default"),ke[e]||(ke[e]=Jx(),ke[e].id=e),ke[e]},t2=function(e,t){var i,a,r=e.data.template===t;if(r)try{for(var n=Qx(e.data.pens),o=n.next();!o.done;o=n.next()){var s=o.value;s.canvasLayer===Ne.CanvasTemplate&&(e.templatePens[s.id]=s)}}catch(h){i={error:h}}finally{try{o&&!o.done&&(a=n.return)&&a.call(n)}finally{if(i)throw i.error}}e.lastScale=e.data.scale,e.data={x:0,y:0,scale:1,pens:[],origin:{x:0,y:0},center:{x:0,y:0},paths:{},template:r?t:null},e.sameTemplate=r,e.pens={},e.histories=[],e.historyIndex=null,e.path2dMap=new WeakMap,e.animateMap=new WeakMap,e.bindDatas={},e.bind={},e.pensNetwork={},e.active=[],e.hover=void 0,e.lastHover=void 0,e.animates.clear()},rd=globalThis&&globalThis.__values||function(e){var t=typeof Symbol=="function"&&Symbol.iterator,i=t&&e[t],a=0;if(i)return i.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},i2=globalThis&&globalThis.__read||function(e,t){var i=typeof Symbol=="function"&&e[Symbol.iterator];if(!i)return e;var a=i.call(e),r,n=[],o;try{for(;(t===void 0||t-- >0)&&!(r=a.next()).done;)n.push(r.value)}catch(s){o={error:s}}finally{try{r&&!r.done&&(i=a.return)&&i.call(a)}finally{if(o)throw o.error}}return n},r2=globalThis&&globalThis.__spreadArray||function(e,t,i){if(i||arguments.length===2)for(var a=0,r=t.length,n;a<r;a++)(n||!(a in t))&&(n||(n=Array.prototype.slice.call(t,0,a)),n[a]=t[a]);return e.concat(n||Array.prototype.slice.call(t))};function Ni(e){var t=e.calculative,i=t.paddingTop,a=t.paddingBottom,r=t.paddingLeft,n=t.paddingRight,o=t.worldRect,s=t.canvas,h=e.calculative,l=h.textLeft,c=h.textTop,f=h.textWidth,v=h.textHeight,g=r,y=i;l&&Math.abs(l)<1&&(l*=o.width),c&&Math.abs(c)<1&&(c*=o.height);var p=o.width-r-n-((e.textAlign==="right"?-l:l)||0),m=o.height-i-a-((e.textBaseline==="bottom"?-c:c)||0);f&&f<1&&(f*=o.width),v&&v<1&&(v*=o.height),f<e.calculative.fontSize&&(f=e.calculative.fontSize),g+=(l||0)+o.x,y+=(c||0)+o.y;var b=e.textAlign||s.store.options.textAlign,x=e.textBaseline||s.store.options.textBaseline;switch(b){case"center":g+=(p-(f||p))/2;break;case"right":g+=p-(f||p);break}switch(x){case"middle":y+=(m-(v||m))/2;break;case"bottom":y+=m-(v||m);break}var _={x:g,y,width:f||p,height:v||m};ot(_),e.calculative.worldTextRect=_,Nn(e),e.calculative.textDrawRect=void 0}function Gv(e,t){var i=t.calculative.fontSize*t.calculative.lineHeight,a=t.calculative.textLines.length*i,r=a2(e,t),n=t.calculative.worldTextRect,o=n.x+(n.width-r)/2,s=n.y+(n.height-a)/2,h=t.calculative.canvas.store.options,l=t.textAlign||h.textAlign;switch(l){case"left":o=n.x;break;case"right":o=n.x+n.width-r;break}var c=t.textBaseline||h.textBaseline;switch(c){case"top":s=n.y;break;case"bottom":s=n.ey-a;break}t.calculative.textDrawRect={x:o,y:s,width:r,height:a},ot(t.calculative.textDrawRect)}function Nn(e,t){var i,a,r,n;if(t===void 0&&(t=e.calculative.text),t==null){e.calculative.textLines=[];return}t=t.toString();var o=[],s=e.calculative.fontSize*e.calculative.lineHeight,h=e.calculative.worldTextRect.height,l=Math.floor(h/s),c=l>1?l:1;switch(e.whiteSpace){case"nowrap":if(e.ellipsis!==!1){var f=ad(t.split(""),e);f[0]&&(o.push(f[0]),f.length>1&&Gl(o))}else o.push(t);break;case"pre-line":o=t.split(/[\n]/g),e.ellipsis!==!1&&o.length>c&&(o=o.slice(0,c),Gl(o));break;case"break-all":default:var v=t.split(/[\n]/g),g=0;try{e:for(var y=rd(v),p=y.next();!p.done;p=y.next()){var m=p.value,b=e.whiteSpace==="break-all"?m.split(""):Xv(m),x=ad(b,e);if(x.length===0&&(x=[""]),e.ellipsis!=!1)try{for(var _=(r=void 0,rd(x)),k=_.next();!k.done;k=_.next()){var I=k.value;if(g++,g>c){Gl(o);break e}else o.push(I)}}catch(M){r={error:M}}finally{try{k&&!k.done&&(n=_.return)&&n.call(_)}finally{if(r)throw r.error}}else o.push.apply(o,r2([],i2(x),!1))}}catch(M){i={error:M}}finally{try{p&&!p.done&&(a=y.return)&&a.call(y)}finally{if(i)throw i.error}}break}var P=e.calculative.keepDecimal;return P!=null&&o.forEach(function(M,L){var U=Number(M);isNaN(U)||(o[L]=U.toFixed(P))}),e.calculative.textLines=o,o}function Xv(e){e===void 0&&(e="");for(var t=[],i="",a=0;a<e.length;++a){var r=e.charCodeAt(a);r<33||r>126?(i&&(t.push(i),i=""),t.push(e[a])):i+=e[a]}return i&&t.push(i),t}function ad(e,t){var i=t.calculative.canvas,a=i.offscreen.getContext("2d"),r=t.calculative,n=r.fontStyle,o=r.fontWeight,s=r.fontSize,h=r.fontFamily,l=r.lineHeight;a.save();for(var c=[],f=e[0]||"",v=1;v<e.length;++v){var g=e[v]||"",y=f+g,p=0;if(i.store.options.measureTextWidth)a.font=Lr({fontStyle:n,fontWeight:o,fontFamily:h||i.store.options.fontFamily,fontSize:s,lineHeight:l}),p=a.measureText(y).width;else{var m=y.match(/[^\x00-\xff]/g)||"",b=m.length*s,x=y.match(/\s/g)||"",_=x.length*s*.3,k=(y.length-m.length-x.length)*s*.6;p=b+_+k}var I=t.calculative.worldTextRect.width;p<=I+.1?f+=g:(f.length&&c.push(f),f=g)}return f.length&&c.push(f),a.restore(),c}function a2(e,t){var i=0;return t.calculative.textLineWidths=[],t.calculative.textLines.forEach(function(a){var r=e.measureText(a).width;t.calculative.textLineWidths.push(r),i<r&&(i=r)}),i}function Gl(e){e[e.length-1]=e[e.length-1].slice(0,-3)+"..."}function n2(e){var t=e.text.split(`
- `),i=e.calculative.canvas,a=i.offscreen.getContext("2d"),r=e.calculative,n=r.fontStyle,o=r.fontWeight,s=r.fontSize,h=r.fontFamily,l=r.lineHeight,c=0,f=0;a.save();for(var v=0;v<t.length;v++){if(i.store.options.measureTextWidth)a.font=Lr({fontStyle:n,fontWeight:o,fontFamily:h||i.store.options.fontFamily,fontSize:s,lineHeight:l}),f=a.measureText(t[v]).width;else{var g=t[v].match(/[^\x00-\xff]/g)||"",y=g.length*s,p=t[v].match(/\s/g)||"",m=p.length*s*.3,b=(t[v].length-g.length-p.length)*s*.6;f=y+m+b}f>c&&(c=f)}a.restore();var x=t.length*s*l;e.textAlign==="left"||(e.textAlign==="right"?e.x=e.x-(c-e.width):e.x=e.x-(c-e.width)/2),e.textBaseline==="top"||(e.textBaseline==="bottom"?e.y=e.y-(x-e.height):e.y=e.y-(x-e.height)/2),e.height=x+2,e.width=c+2,e.calculative.canvas.updatePenRect(e),e.calculative.canvas.calcActiveRect()}function ce(e,t){if(t===void 0&&(t=!1),Array.isArray(e)){var i=[];return e.forEach(function(n){i.push(ce(n,t))}),i}else if(typeof e=="object"){if(e===null)return null;if(e.constructor===RegExp)return e;var a={};for(var r in e)if(!(["canvas","lastFrame"].includes(r)||e[r]instanceof HTMLImageElement||e[r]instanceof HTMLMediaElement)){{if(r==="calculative"&&!t)continue;if(r==="singleton"){t?a[r]={}:a[r]=e[r];continue}}a[r]=ce(e[r],t)}return a}return e}var oi={};function Zv(e,t,i){if(!!oi[t.fromArrow]){var a=lt(t),r=a.x,n=a.y,o={x:r,y:n};if(o.step=(t.fromArrowSize||10)*i.data.scale,a.next)o.rotate=gi(a.next,a)+90;else{var s=t.calculative.worldAnchors[1];if(!s)return;s.prev?o.rotate=gi(s.prev,a)+90:o.rotate=gi(s,a)+90}e.save(),e.beginPath(),e.setLineDash([]);var h=t.fromArrowColor||t.calculative.color;h&&(e.strokeStyle=h),oi[t.fromArrow](e,t,i,o),e.restore()}}function Qv(e,t,i){if(!(!oi[t.toArrow]||t.calculative.worldAnchors.length<2)){e.save();var a=We(t),r=a.x,n=a.y,o={x:r,y:n};if(o.step=(t.toArrowSize||10)*i.data.scale,a.prev)o.rotate=gi(a.prev,a)+90;else{var s=t.calculative.worldAnchors[t.calculative.worldAnchors.length-2];s.next?o.rotate=gi(s.next,a)+90:o.rotate=gi(s,a)+90}e.beginPath(),e.setLineDash([]);var h=t.toArrowColor||t.calculative.color;h&&(e.strokeStyle=h),oi[t.toArrow](e,t,i,o),e.restore()}}oi.triangleSolid=function(e,t,i,a){e.save(),e.translate(a.x,a.y),e.rotate(a.rotate*Math.PI/180),e.translate(-a.x,-a.y);var r=a.x-a.step;e.moveTo(r,a.y-a.step/4),e.lineTo(a.x,a.y),e.lineTo(r,a.y+a.step/4),e.closePath(),e.stroke(),e.fillStyle=e.strokeStyle,e.fill(),e.restore()};oi.triangle=function(e,t,i,a){e.save(),e.lineWidth<2&&(e.lineWidth=2),e.translate(a.x,a.y),e.rotate(a.rotate*Math.PI/180),e.translate(-a.x,-a.y);var r=a.x-a.step;e.moveTo(r,a.y-a.step/4),e.lineTo(a.x,a.y),e.lineTo(r,a.y+a.step/4),e.closePath(),e.stroke(),e.fillStyle=i.data.background||"#ffffff",e.fill(),e.restore()};oi.circleSolid=function(e,t,i,a){e.save(),e.translate(a.x,a.y),e.rotate(a.rotate*Math.PI/180),e.translate(-a.x,-a.y);var r=a.step/2;e.arc(a.x-r,a.y,r,0,2*Math.PI),e.stroke(),e.fillStyle=e.strokeStyle,e.fill(),e.restore()};oi.circle=function(e,t,i,a){e.save(),e.translate(a.x,a.y),e.rotate(a.rotate*Math.PI/180),e.translate(-a.x,-a.y);var r=a.step/2;e.arc(a.x-r,a.y,r,0,2*Math.PI),e.stroke(),e.fillStyle=i.data.background||"#ffffff",e.fill(),e.restore()};oi.diamondSolid=function(e,t,i,a){e.save(),e.translate(a.x,a.y),e.rotate(a.rotate*Math.PI/180),e.translate(-a.x,-a.y);var r=a.x-a.step,n=a.step/2;e.moveTo(r,a.y),e.lineTo(r+n,a.y-n/2),e.lineTo(a.x,a.y),e.lineTo(r+n,a.y+n/2),e.closePath(),e.stroke(),e.fillStyle=e.strokeStyle,e.fill(),e.restore()};oi.diamond=function(e,t,i,a){e.save(),e.translate(a.x,a.y),e.rotate(a.rotate*Math.PI/180),e.translate(-a.x,-a.y);var r=a.x-a.step,n=a.step/2;e.moveTo(r,a.y),e.lineTo(r+n,a.y-n/2),e.lineTo(a.x,a.y),e.lineTo(r+n,a.y+n/2),e.closePath(),e.stroke(),e.fillStyle=i.data.background||"#ffffff",e.fill(),e.restore()};oi.line=function(e,t,i,a){e.save(),e.translate(a.x,a.y),e.rotate(a.rotate*Math.PI/180),e.translate(-a.x,-a.y);var r=a.x-a.step;e.moveTo(r,a.y-a.step/3),e.lineTo(a.x,a.y),e.lineTo(r,a.y+a.step/3),e.stroke(),e.restore()};oi.lineUp=function(e,t,i,a){e.save(),e.translate(a.x,a.y),e.rotate(a.rotate*Math.PI/180),e.translate(-a.x,-a.y);var r=a.x-a.step;e.moveTo(r,a.y-a.step/3),e.lineTo(a.x,a.y),e.stroke(),e.restore()};oi.lineDown=function(e,t,i,a){e.save(),e.translate(a.x,a.y),e.rotate(a.rotate*Math.PI/180),e.translate(-a.x,-a.y);var r=a.x-a.step;e.moveTo(r,a.y+a.step/3),e.lineTo(a.x,a.y),e.stroke(),e.restore()};var o2=globalThis&&globalThis.__read||function(e,t){var i=typeof Symbol=="function"&&e[Symbol.iterator];if(!i)return e;var a=i.call(e),r,n=[],o;try{for(;(t===void 0||t-- >0)&&!(r=a.next()).done;)n.push(r.value)}catch(s){o={error:s}}finally{try{r&&!r.done&&(i=a.return)&&i.call(a)}finally{if(o)throw o.error}}return n};function Dc(e){var t=parseInt,i=Math.round,a=e.length,r={};if(a>9){var n=o2(e=e.split(","),4),o=n[0],s=n[1],h=n[2],l=n[3];if(a=e.length,a<3||a>4)return null;r.r=t(o[3]=="a"?o.slice(5):o.slice(4)),r.g=t(s),r.b=t(h),r.a=l?parseFloat(l):-1}else{if(a==8||a==6||a<4)return null;a<6&&(e="#"+e[1]+e[1]+e[2]+e[2]+e[3]+e[3]+(a>4?e[4]+e[4]:"")),e=t(e.slice(1),16),a==9||a==5?(r.r=e>>24&255,r.g=e>>16&255,r.b=e>>8&255,r.a=i((e&255)/.255)/1e3):(r.r=e>>16,r.g=e>>8&255,r.b=e&255,r.a=-1)}return r}function Ft(e,t,i,a){var r,n,o,s,h,l,c,f=Math.round,v=typeof i=="string";return typeof e!="number"||e<-1||e>1||typeof t!="string"||t[0]!="r"&&t[0]!="#"||i&&!v||(c=t.length>9,c=v?i.length>9?!0:i=="c"?!c:!1:c,h=Dc(t),s=e<0,l=i&&i!="c"?Dc(i):s?{r:0,g:0,b:0,a:-1}:{r:255,g:255,b:255,a:-1},e=s?e*-1:e,s=1-e,!h||!l)?null:(a?(r=f(s*h.r+e*l.r),n=f(s*h.g+e*l.g),o=f(s*h.b+e*l.b)):(r=f(Math.pow(s*Math.pow(h.r,2)+e*Math.pow(l.r,2),.5)),n=f(Math.pow(s*Math.pow(h.g,2)+e*Math.pow(l.g,2),.5)),o=f(Math.pow(s*Math.pow(h.b,2)+e*Math.pow(l.b,2),.5))),v=h.a,l=l.a,h=v>=0||l>=0,v=h?v<0?l:l<0?v:v*s+l*e:0,c?"rgb"+(h?"a(":"(")+r+","+n+","+o+(h?","+f(v*1e3)/1e3:"")+")":"#"+(4294967296+r*16777216+n*65536+o*256+(h?f(v*255):0)).toString(16).slice(1,h?void 0:-2))}globalThis.pSBC=Ft;function ls(e,t){var i=Dc(e)||{r:0,g:0,b:0};return i.a<0?"rgba("+i.r+","+i.g+","+i.b+","+t+")":"rgba("+i.r+","+i.g+","+i.b+","+(t+i.a)+")"}var bn=globalThis&&globalThis.__read||function(e,t){var i=typeof Symbol=="function"&&e[Symbol.iterator];if(!i)return e;var a=i.call(e),r,n=[],o;try{for(;(t===void 0||t-- >0)&&!(r=a.next()).done;)n.push(r.value)}catch(s){o={error:s}}finally{try{r&&!r.done&&(i=a.return)&&i.call(a)}finally{if(o)throw o.error}}return n},s2=globalThis&&globalThis.__values||function(e){var t=typeof Symbol=="function"&&Symbol.iterator,i=t&&e[t],a=0;if(i)return i.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};function Mo(e,t){if(isNaN(e)){console.warn("realValue not number");return}if(typeof t!="string"){console.warn("collection must be string");return}var i=bn([t[0],t[t.length-1]],2),a=i[0],r=i[1];if(!["[","("].includes(a)){console.warn('collection must start with "[" or "("');return}if(!["]",")"].includes(r)){console.warn('collection must end with "]" or ")"');return}var n=t.substring(1,t.length-1).split(",");if(n.length!==2){console.warn("collection must have 2 numbers");return}var o=bn([+n[0],+n[1]],2),s=o[0],h=o[1];if(s>=h){console.warn("startNum must less than endNum");return}var l=e>s||a==="["&&e===s;if(!l)return!1;var c=e<h||r==="]"&&e===h;return c}function Bo(e,t){var i,a;if(typeof t!="string"){console.warn("collection must be string");return}var r=bn([t[0],t[t.length-1]],2),n=r[0],o=r[1];if(n!=="["||o!=="]"){console.warn('collection must start with "[" and end with "]"');return}var s=t.substring(1,t.length-1).split(",");try{for(var h=s2(s),l=h.next();!l.done;l=h.next()){var c=l.value;if(c.includes("..")){var f=bn(c.split(".."),2),v=f[0],g=f[1],y=bn([+v,+g],2),p=y[0],m=y[1];if(p>=m){console.warn("startNum must less than endNum");return}if(e>=p&&e<=m)return!0}else if(e==c)return!0}}catch(b){i={error:b}}finally{try{l&&!l.done&&(a=h.return)&&a.call(h)}finally{if(i)throw i.error}}return!1}function Me(){return((1+Math.random())*4294967296|0).toString(16).substring(1)}var ar=function(e){var t=0,i=0,a=0,r=0;if(typeof e=="number")t=i=a=r=e;else if(typeof e=="string"){var n=parseInt(e,10);t=i=a=r=n}else Array.isArray(e)&&(t=e[0],a=Xl(e[1])?e[0]:e[1],r=Xl(e[2])?e[0]:e[2],i=Xl(e[3])?a:e[3]);return[t,a,r,i]};function Xl(e){return e==null}var Jv=globalThis&&globalThis.__awaiter||function(e,t,i,a){function r(n){return n instanceof i?n:new i(function(o){o(n)})}return new(i||(i=Promise))(function(n,o){function s(c){try{l(a.next(c))}catch(f){o(f)}}function h(c){try{l(a.throw(c))}catch(f){o(f)}}function l(c){c.done?n(c.value):r(c.value).then(s,h)}l((a=a.apply(e,t||[])).next())})},eg=globalThis&&globalThis.__generator||function(e,t){var i={label:0,sent:function(){if(n[0]&1)throw n[1];return n[1]},trys:[],ops:[]},a,r,n,o;return o={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function s(l){return function(c){return h([l,c])}}function h(l){if(a)throw new TypeError("Generator is already executing.");for(;i;)try{if(a=1,r&&(n=l[0]&2?r.return:l[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,l[1])).done)return n;switch(r=0,n&&(l=[l[0]&2,n.value]),l[0]){case 0:case 1:n=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,r=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(n=i.trys,!(n=n.length>0&&n[n.length-1])&&(l[0]===6||l[0]===2)){i=0;continue}if(l[0]===3&&(!n||l[1]>n[0]&&l[1]<n[3])){i.label=l[1];break}if(l[0]===6&&i.label<n[1]){i.label=n[1],n=l;break}if(n&&i.label<n[2]){i.label=n[2],i.ops.push(l);break}n[2]&&i.ops.pop(),i.trys.pop();continue}l=t.call(e,i)}catch(c){l=[6,c],r=0}finally{a=n=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}};function l2(e){return Jv(this,void 0,void 0,function(){return eg(this,function(t){return[2,new Promise(function(i,a){var r=new FileReader;r.onload=function(n){i(n.target.result)},r.onerror=function(n){a(n)},r.readAsDataURL(e)})]})})}function c2(e,t,i,a){return Jv(this,void 0,void 0,function(){var r,n,o;return eg(this,function(s){switch(s.label){case 0:if(r=new FormData,r.append("file",e),i)for(n in i)i.hasOwnProperty(n)&&r.append(n,i[n]);return[4,fetch(t,{method:"POST",headers:a,body:r})];case 1:return o=s.sent(),[4,o.json()];case 2:return[2,s.sent().url]}})})}function u2(e,t,i){var a=document.createElement("link");a.href=e,a.rel="stylesheet",t&&(a.onload=t),i&&(a.onerror=i),document.head.appendChild(a)}function nd(e){var t=e||window.location.href.split("?")[1],i=new URLSearchParams(t),a=Object.fromEntries(i.entries());return a}function h2(e,t){if(t==null)return e;for(var i=t.split(".");i.length&&(e=e[i.shift()]););return e}function f2(e,t,i){t!=null&&t.split(".").reduce(function(a,r,n){return a[r]=t.split(".").length===++n?i:a[r]||{}},e)}var Mc=globalThis&&globalThis.__assign||function(){return Mc=Object.assign||function(e){for(var t,i=1,a=arguments.length;i<a;i++){t=arguments[i];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},Mc.apply(this,arguments)},d2=globalThis&&globalThis.__read||function(e,t){var i=typeof Symbol=="function"&&e[Symbol.iterator];if(!i)return e;var a=i.call(e),r,n=[],o;try{for(;(t===void 0||t-- >0)&&!(r=a.next()).done;)n.push(r.value)}catch(s){o={error:s}}finally{try{r&&!r.done&&(i=a.return)&&i.call(a)}finally{if(o)throw o.error}}return n},v2=globalThis&&globalThis.__spreadArray||function(e,t,i){if(i||arguments.length===2)for(var a=0,r=t.length,n;a<r;a++)(n||!(a in t))&&(n||(n=Array.prototype.slice.call(t,0,a)),n[a]=t[a]);return e.concat(n||Array.prototype.slice.call(t))},Tn=globalThis&&globalThis.__values||function(e){var t=typeof Symbol=="function"&&Symbol.iterator,i=t&&e[t],a=0;if(i)return i.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};function g2(e,t){if(!e||!t)return!1;for(var i=ri(e);i;){if(i.id===t.id)return!0;i=ri(i)}return!1}function ri(e,t){if(!(!e||!e.parentId||!e.calculative)){var i=e.calculative.canvas.store,a=i.pens[e.parentId];return t&&ri(a,t)||a}}function Er(e,t){if(!e||!e.children)return[];var i=[];return e.children.forEach(function(a){var r=t.pens[a];r&&(i.push(r),i.push.apply(i,v2([],d2(Er(r,t)),!1)))}),i}function y2(e,t){var i=t.calculative,a=i.worldRect,r=i.gradientFromColor,n=i.gradientToColor,o=i.gradientAngle;return tg(e,a,r,n,o)}function m2(e,t){var i=t.calculative,a=i.worldRect,r=i.gradientFromColor,n=i.gradientToColor,o=i.gradientRadius;if(!(!r||!n)){var s=a.width,h=a.height,l=a.center,c=l.x,f=l.y,v=s;v<h&&(v=h),v*=.5;var g=e.createRadialGradient(c,f,v*(o||0),c,f,v);return g.addColorStop(0,r),g.addColorStop(1,n),g}}function p2(e,t,i,a,r){var n=0;n=Math.PI/2-Math.atan2(a-t,i-e);var o=(e+i)/2,s=(t+a)/2,h=o+r*Math.sin(90*Math.PI/180-n),l=s+r*-Math.cos(90*Math.PI/180-n),c=o+r*Math.sin(270*Math.PI/180-n),f=s+r*-Math.cos(270*Math.PI/180-n);return[h,l,c,f]}function w2(e,t){var i=t.calculative,a=i.worldRect,r=i.gradientColors,n=i.gradientRadius;if(!!r){var o=a.width,s=a.height,h=a.center,l=h.x,c=h.y,f=o;f<s&&(f=s),f*=.5;var v=sa(r).colors,g=e.createRadialGradient(l,c,f*(n||0),l,c,f);return v.forEach(function(y){g.addColorStop(y.i,y.color)}),g}}function b2(e,t){var i=t.calculative.worldRect,a=i.x,r=i.y,n=i.ex,o=i.width,s=i.height,h=i.center,l=[{x:n,y:r+s/2},{x:a,y:r+s/2}],c=sa(t.calculative.gradientColors),f=c.angle,v=c.colors,g=ru(f,o,s);return l.forEach(function(y){Ge(y,f,h)}),bs(e,l,v,g)}function _2(e,t){var i=t.calculative,a=i.worldRect,r=i.textGradientColors;if(!!r){var n=a.width,o=a.height,s=a.center,h=s.x,l=s.y,c=n;c<o&&(c=o),c*=.5;var f=sa(r).colors,v=e.createRadialGradient(h,l,0,h,l,c);return f.forEach(function(g){v.addColorStop(g.i,g.color)}),v}}function x2(e,t){var i=t.calculative.worldRect,a=i.x,r=i.y,n=i.ex,o=i.width,s=i.height,h=i.center,l=[{x:n,y:r+s/2},{x:a,y:r+s/2}],c=sa(t.calculative.textGradientColors),f=c.angle,v=c.colors,g=ru(f,o,s);return l.forEach(function(y){Ge(y,f,h)}),bs(e,l,v,g)}function ru(e,t,i){var a=Math.atan(i/t)/Math.PI*180,r=(e-90)%360,n=0;return r>a&&r<180-a||r>180+a&&r<360-a||r<0?(r>270?r=360-r:r>180?r=r-180:r>90&&(r=180-r),n=Math.abs(i/Math.sin(r/180*Math.PI)/2)):(r>270?r=360-r:r>180?r=r-180:r>90&&(r=180-r),n=Math.abs(t/Math.cos(r/180*Math.PI)/2)),n}function sa(e){if(typeof e=="string"&&e.startsWith("linear-gradient")){var t=e.slice(16,-2).split("deg,");if(t.length>1){var i=t[1].split("%,"),a=[];return i.forEach(function(r){if(/rgba?/.test(r)){var n=r.split(") ");a.push({color:E2(n[0]+")"),i:parseFloat(n[1])/100})}else{var o=r.split(" ");o.length>2?a.push({color:o[1],i:parseFloat(o[2])/100}):a.push({color:o[0],i:parseFloat(o[1])/100})}}),{angle:parseFloat(t[0]),colors:a}}else return{angle:parseFloat(t[0]),colors:[]}}else return{angle:0,colors:[]}}function E2(e){if(/rgba?/.test(e)){var t=e.split(",");if(t.length<3)return"";e="#";for(var i=0,a=void 0;a=t[i++];)if(i<4)a=parseInt(a.replace(/[^\d]/gi,""),10).toString(16),e+=a.length==1?"0"+a:a;else{a=a.replace(")","");var r=parseInt(a*255+""),n=r.toString(16);n=n.length===2?n:"0"+n,e+=n}e=e.toUpperCase()}return e}function k2(e,t){var i=t.calculative.worldRect,a=i.x,r=i.y,n=i.ex,o=i.width,s=i.height,h=i.center,l=[{x:n,y:r+s/2},{x:a,y:r+s/2}],c=sa(t.calculative.lineGradientColors),f=c.angle,v=c.colors,g=ru(f,o,s);return l.forEach(function(y){Ge(y,f,h)}),bs(e,l,v,g)}function bs(e,t,i,a){var r=p2(t[0].x,t[0].y,t[1].x,t[1].y,a),n=e.createLinearGradient(r[0],r[1],r[2],r[3]);return i.forEach(function(o){n.addColorStop(o.i,o.color)}),n}function qr(e,t,i){var a=[];t.calculative.gradientColorStop?a=t.calculative.gradientColorStop:(a=sa(t.calculative.lineGradientColors).colors,t.calculative.gradientColorStop=a),e.strokeStyle=bs(e,i,a,t.calculative.lineWidth/2),e.beginPath(),e.moveTo(i[0].x,i[0].y),e.lineTo(i[1].x,i[1].y),e.stroke()}function C2(e,t){for(var i=t.calculative.worldAnchors,a=t.calculative.lineWidth*(t.calculative.gradientSmooth||t.calculative.lineSmooth||0),r=0;r<i.length-1;r++)if((t.lineName==="curve"||t.lineName==="mind")&&i[r].curvePoints){if(r>0){var n=i[r-1].curvePoints;n?Oo(e,t,a,n[n.length-1],i[r],i[r].curvePoints[0]):Oo(e,t,a,i[r-1],i[r],i[r].curvePoints[0]);var o=nr(a,i[r],i[r].curvePoints[0]);qr(e,t,[o,i[r].curvePoints[1]])}else qr(e,t,[i[r],i[r].curvePoints[0]]),qr(e,t,[i[r].curvePoints[0],i[r].curvePoints[1]]);for(var s=i[r].curvePoints.length-1,h=1;h<s;h++)qr(e,t,[i[r].curvePoints[h],i[r].curvePoints[h+1]]);var l=nr(a,i[r+1],i[r].curvePoints[s]);qr(e,t,[i[r].curvePoints[s],l])}else{var c=i[r],f=i[r+1];if(r>0&&r<i.length-1){var n=i[r-1].curvePoints;n?Oo(e,t,a,n[n.length-1],i[r],i[r+1]):Oo(e,t,a,i[r-1],i[r],i[r+1])}r>0&&r<i.length-1&&(c=nr(a,i[r],i[r+1])),r<i.length-2&&(f=nr(a,i[r+1],i[r])),qr(e,t,[c,f])}}function nr(e,t,i){var a=Math.sqrt((i.x-t.x)*(i.x-t.x)+(i.y-t.y)*(i.y-t.y));return a===0?{x:t.x,y:t.y}:e<a?{x:t.x+(i.x-t.x)*e/a,y:t.y+(i.y-t.y)*e/a}:{x:t.x+(i.x-t.x)/a/2,y:t.y+(i.y-t.y)/a/2}}function Oo(e,t,i,a,r,n){for(var o=nr(i,r,a),s=nr(i,r,n),h={x:r.x,y:r.y},l=A2(t.calculative.canvas.store.data.smoothNum||20,o,h,s),c=0;c<l.length-1;c++)qr(e,t,[{x:l[c].x,y:l[c].y},{x:l[c+1].x,y:l[c+1].y}])}function od(e,t,i,a){var r=nr(t,i,a),n={x:i.x,y:i.y};e.quadraticCurveTo(n.x,n.y,r.x,r.y)}function au(e){for(var t=e.calculative.worldAnchors,i=e.calculative.lineWidth*(e.calculative.gradientSmooth||e.calculative.lineSmooth||0),a=new Path2D,r=0;r<t.length-1;r++){t[r];var n=t[r+1];if(r==0&&a.moveTo(t[r].x,t[r].y),r>0&&r<t.length-1){var o=t[r-1].curvePoints;od(a,i,t[r],t[r+1])}r>0&&r<t.length-1&&nr(i,t[r],t[r+1]),r<t.length-2&&(n=nr(i,t[r+1],t[r])),a.lineTo(n.x,n.y)}return a}function A2(e,t,i,a,r){e===void 0&&(e=100);var n=null,o=[];!a&&!r?n=S2:a&&!r?n=T2:a&&r&&(n=R2);for(var s=0;s<e;s++)o.push(n(s/e,t,i,a,r));return r?o.push(r):a&&o.push(a),o}function S2(e,t,i){var a=t.x,r=t.y,n=i.x,o=i.y,s=a+(n-a)*e,h=r+(o-r)*e;return{x:s,y:h}}function T2(e,t,i,a){var r=t.x,n=t.y,o=i.x,s=i.y,h=a.x,l=a.y,c=(1-e)*(1-e)*r+2*e*(1-e)*o+e*e*h,f=(1-e)*(1-e)*n+2*e*(1-e)*s+e*e*l;return{x:c,y:f}}function R2(e,t,i,a,r){var n=t.x,o=t.y,s=r.x,h=r.y,l=i.x,c=i.y,f=a.x,v=a.y,g=n*(1-e)*(1-e)*(1-e)+3*l*e*(1-e)*(1-e)+3*f*e*e*(1-e)+s*e*e*e,y=o*(1-e)*(1-e)*(1-e)+3*c*e*(1-e)*(1-e)+3*v*e*e*(1-e)+h*e*e*e;return{x:g,y}}function P2(e,t){var i=t.calculative,a=i.worldRect,r=i.lineGradientFromColor,n=i.lineGradientToColor,o=i.lineGradientAngle;return tg(e,a,r,n,o)}function tg(e,t,i,a,r){if(!(!i||!a)){var n=t.x,o=t.y,s=t.center,h=t.ex,l=t.ey,c={x:n,y:s.y},f={x:h,y:s.y};r%90===0&&r%180?(c.x=s.x,f.x=s.x,r%270?(c.y=o,f.y=l):(c.y=l,f.y=o)):r&&(Ge(c,r,t.center),Ge(f,r,t.center));var v=e.createLinearGradient(c.x,c.y,f.x,f.y);return v.addColorStop(0,i),v.addColorStop(1,a),v}}function I2(e){var t=e.calculative,i=t.worldIconRect,a=t.iconWidth,r=t.iconHeight,n=t.imgNaturalWidth,o=t.imgNaturalHeight,s=i.x,h=i.y,l=i.width,c=i.height;if(a&&(l=a),r&&(c=r),n&&o&&e.imageRatio){var f=i.width/n,v=i.height/o,g=Math.min(f,v),y=n/o;a?c=a/y:r?l=r*y:(l=g*n,c=g*o)}switch(s+=(i.width-l)/2,h+=(i.height-c)/2,e.iconAlign){case"top":h=i.y;break;case"bottom":h=i.ey-c;break;case"left":s=i.x;break;case"right":s=i.ex-l;break;case"left-top":s=i.x,h=i.y;break;case"right-top":s=i.ex-l,h=i.y;break;case"left-bottom":s=i.x,h=i.ey-c;break;case"right-bottom":s=i.ex-l,h=i.ey-c;break}return{x:s,y:h,width:l,height:c}}function Fa(e,t){var i=I2(t),a=i.x,r=i.y,n=i.width,o=i.height,s=t.calculative,h=s.worldIconRect,l=s.iconRotate,c=s.img;if(l){var f=h.center,v=f.x,g=f.y;e.translate(v,g),e.rotate(l*Math.PI/180),e.translate(-v,-g)}if(t.imageRadius){e.save();var y=t.calculative.imageRadius||0,p=y,m=t.calculative.worldRect,b=m.x,x=m.y,_=m.width,k=m.height,I=m.ex,P=m.ey;y<1&&(y=_*y,p=k*p);var M=y<p?y:p;_<2*M&&(M=_/2),k<2*M&&(M=k/2),e.beginPath(),e.moveTo(b+M,x),e.arcTo(I,x,I,P,M),e.arcTo(I,P,b,P,M),e.arcTo(b,P,b,x,M),e.arcTo(b,x,I,x,M),e.clip(),e.drawImage(c,a,r,n,o),e.restore()}else e.drawImage(c,a,r,n,o)}function Ir(e,t){var i=e.calculative,a=i.textColor,r=i.color,n=t.data,o=t.options;return a||r||n.textColor||n.color||o.textColor||o.color}function ig(e,t){var i=t.calculative,a=i.fontStyle,r=i.fontWeight,n=i.fontSize,o=i.fontFamily,s=i.lineHeight,h=i.text,l=i.hiddenText,c=i.canvas,f=i.textHasShadow,v=i.textBackground,g=i.textType;if(!(h==null||l)){var y=c.store;e.save(),f||(e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0);var p=void 0;t.calculative.disabled?p=t.disabledTextColor||t.disabledColor||Ft(.4,Ir(t,y)):t.calculative.hover?p=t.hoverTextColor||t.hoverColor||y.options.hoverColor:t.calculative.active&&(p=t.activeTextColor||t.activeColor||y.options.activeColor);var m=void 0;g===qa.Linear?m=x2(e,t):g===qa.Radial&&(m=_2(e,t)),e.fillStyle=p||m||Ir(t,y),e.font=Lr({fontStyle:a,fontWeight:r,fontFamily:o||y.options.fontFamily,fontSize:n,lineHeight:s}),!t.calculative.textDrawRect&&Gv(e,t);var b=t.calculative.textDrawRect,x=b.x,_=b.y,k=b.width,I=b.height;v&&(e.save(),e.fillStyle=v,e.fillRect(x,_,k,I),e.restore());var P=.55,M=t.textAlign||y.options.textAlign,L=n*s;t.calculative.textLines.forEach(function(U,$){var S=t.calculative.textLineWidths[$],T=0;M==="center"?T=(k-S)/2:M==="right"&&(T=k-S),e.fillText(U,x+T,_+($+P)*L);var R=t.textDecorationColor,O=t.textDecorationDash,K=t.textDecoration;K&&L2(e,{x:x+T,y:_+($+P)*L,width:S},{textDecorationColor:R,textDecorationDash:O,fontSize:n});var G=t.textStrickoutColor,ae=t.textStrickoutDash,V=t.textStrickout;V&&D2(e,{x:x+T,y:_+($+P)*L,width:S},{textStrickoutColor:G,textStrickoutDash:ae,fontSize:n})}),e.restore()}}function L2(e,t,i){var a=i.textDecorationColor,r=i.textDecorationDash,n=i.fontSize,o=t.x,s=t.y,h=t.width;switch(e.textBaseline){case"top":s+=n;break;case"middle":s+=n/2;break}e.save(),e.beginPath(),e.strokeStyle=a||e.fillStyle,e.lineWidth=1,e.moveTo(o,s),e.setLineDash(r||[]),e.lineTo(o+h,s),e.stroke(),e.restore()}function D2(e,t,i){var a=i.textStrickoutColor,r=i.textStrickoutDash,n=i.fontSize,o=t.x,s=t.y,h=t.width;switch(e.textBaseline){case"top":s+=n/2;break;case"bottom":s-=n/2;break}e.save(),e.beginPath(),e.strokeStyle=a||e.fillStyle,e.lineWidth=1,e.moveTo(o,s),e.setLineDash(r||[]),e.lineTo(o+h,s),e.stroke(),e.restore()}function rg(e,t,i){var a,r;if(i!=null){var n=t.calculative,o=n.fontStyle,s=n.fontWeight,h=n.fontSize,l=n.fontFamily,c=n.lineHeight,f=n.canvas,v=f.store;e.save();var g=void 0;t.calculative.hover?g=t.hoverTextColor||t.hoverColor||v.options.hoverColor:t.calculative.active&&(g=t.activeTextColor||t.activeColor||v.options.activeColor),e.fillStyle=g||Ir(t,v),e.font=Lr({fontStyle:o,fontWeight:s,fontFamily:l||v.options.fontFamily,fontSize:h,lineHeight:c});var y=e.measureText(i).width,p,m;try{for(var b=Tn(t.calculative.worldAnchors),x=b.next();!x.done;x=b.next()){var _=x.value;if(!m){m=_;continue}var k=ws(m,_),I=Math.floor(k/y);p="";for(var P=0;P<I;P++)p+=i;var M=gi(m,_)-270;if(e.save(),M%360!==0){var L=m.x,U=m.y;e.translate(L,U);var $=M*Math.PI/180;e.rotate($),e.translate(-L,-U)}e.fillText(p,m.x,m.y+c/2),e.restore(),m=_}}catch(S){a={error:S}}finally{try{x&&!x.done&&(r=b.return)&&r.call(b)}finally{if(a)throw a.error}}e.restore()}}function ag(e,t){var i=t.calculative.canvas.store;e.save(),e.shadowColor="",e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0,e.textAlign="center",e.textBaseline="middle";var a=t.calculative.worldIconRect,r=a.x+a.width/2,n=a.y+a.height/2;switch(t.iconAlign){case"top":n=a.y,e.textBaseline="top";break;case"bottom":n=a.ey,e.textBaseline="bottom";break;case"left":r=a.x,e.textAlign="left";break;case"right":r=a.ex,e.textAlign="right";break;case"left-top":r=a.x,n=a.y,e.textAlign="left",e.textBaseline="top";break;case"right-top":r=a.ex,n=a.y,e.textAlign="right",e.textBaseline="top";break;case"left-bottom":r=a.x,n=a.ey,e.textAlign="left",e.textBaseline="bottom";break;case"right-bottom":r=a.ex,n=a.ey,e.textAlign="right",e.textBaseline="bottom";break}var o=t.calculative.iconWeight,s=void 0,h=t.calculative.iconFamily;t.calculative.iconSize>0?s=t.calculative.iconSize:a.width>a.height?s=a.height:s=a.width,e.font=Lr({fontSize:s,fontWeight:o,fontFamily:h}),e.fillStyle=t.calculative.iconColor||Ir(t,i),t.calculative.iconRotate&&(e.translate(a.center.x,a.center.y),e.rotate(t.calculative.iconRotate*Math.PI/180),e.translate(-a.center.x,-a.center.y)),e.beginPath(),e.fillText(t.calculative.icon,r,n),e.restore()}function Lr(e){var t=e===void 0?{}:e,i=t.fontStyle,a=i===void 0?"normal":i,r=t.textDecoration,n=r===void 0?"normal":r,o=t.fontWeight,s=o===void 0?"normal":o,h=t.fontSize,l=h===void 0?12:h,c=t.fontFamily,f=c===void 0?"Arial":c,v=t.lineHeight,g=v===void 0?1:v;return a+" "+n+" "+s+" "+l+"px/"+g+" "+f}function Qr(e,t){var i=t.calculative.worldRect||{},a=i.x,r=i.ex,n=i.y,o=i.ey;t.calculative.flipX&&(e.translate(a+r+.5,.5),e.scale(-1,1)),t.calculative.flipY&&(e.translate(.5,n+o+.5),e.scale(1,-1))}function or(e,t,i){i===void 0&&(i=!1);var a=t.calculative.worldRect.center,r=a.x,n=a.y;e.translate(r,n);var o=t.calculative.rotate*Math.PI/180;i||(t.calculative.flipX&&(o*=-1),t.calculative.flipY&&(o*=-1)),e.rotate(o),e.translate(-r,-n)}function jr(e,t,i){var a,r;e.save(),e.translate(.5,.5),e.beginPath();var n=t.calculative.canvas.store,o=t.textFlip||n.options.textFlip,s=t.textRotate||n.options.textRotate;(!o||!s)&&e.save(),Qr(e,t),t.calculative.rotate&&t.name!=="line"&&or(e,t),(t.calculative.lineWidth>1||i)&&(e.lineWidth=t.calculative.lineWidth),j2(e,n,t);var h,l=!1,c=void 0;t.calculative.disabled?(c=t.disabledColor||n.options.disabledColor||Ft(.4,t.calculative.color||us(n)),h=t.disabledBackground||n.options.disabledBackground||Ft(.4,t.calculative.background||n.data.penBackground)):t.calculative.hover?(c=t.hoverColor||n.options.hoverColor,h=t.hoverBackground||n.options.hoverBackground):t.calculative.active?(c=t.activeColor||n.options.activeColor,h=t.activeBackground||n.options.activeBackground):t.calculative.isDock&&(t.type===Ye.Line?c=n.options.dockPenColor:h=ls(n.options.dockPenColor,.2));var f=t.calculative.strokeImg;if(t.calculative.strokeImage&&f)e.strokeStyle=c||e.createPattern(f,"repeat");else{var v=void 0;t.calculative.strokeType?t.calculative.lineGradientColors?t.name==="line"?l=!0:t.calculative.lineGradient?v=t.calculative.lineGradient:(v=k2(e,t),t.calculative.lineGradient=v):v=P2(e,t):v=t.calculative.color||us(n),e.strokeStyle=c||v}var g=t.calculative.backgroundImg;if(t.calculative.backgroundImage&&g)e.fillStyle=h||e.createPattern(g,"repeat"),h=!0;else{var y=void 0;t.calculative.bkType===qa.Linear?t.calculative.gradientColors?t.calculative.gradient?y=t.calculative.gradient:(y=b2(e,t),t.calculative.gradient=y):y=y2(e,t):t.calculative.bkType===qa.Radial?t.calculative.gradientColors?t.calculative.radialGradient?y=t.calculative.radialGradient:(y=w2(e,t),t.calculative.radialGradient=y):y=m2(e,t):y=t.calculative.background||n.data.penBackground,e.fillStyle=h||y,h=!!y}if(ng(e,t),og(e,t),Jr(e,t),t.calculative.lineDash&&e.setLineDash(t.calculative.lineDash.map(function(x){return x*t.calculative.canvas.store.data.scale})),t.calculative.lineDashOffset&&(e.lineDashOffset=t.calculative.lineDashOffset),t.calculative.shadowColor&&(e.shadowColor=t.calculative.shadowColor,e.shadowOffsetX=t.calculative.shadowOffsetX,e.shadowOffsetY=t.calculative.shadowOffsetY,e.shadowBlur=t.calculative.shadowBlur),l?(C2(e,t),M2(!0,e,t,n)):(sg(!0,e,t,n,h),fg(e,t)),!(t.image&&t.calculative.img)&&t.calculative.icon&&ag(e,t),(!o||!s)&&e.restore(),o&&!s&&Qr(e,t),!o&&s&&t.calculative.rotate&&t.name!=="line"&&or(e,t,!0),ig(e,t),t.type===Ye.Line&&t.fillTexts)try{for(var p=Tn(t.fillTexts),m=p.next();!m.done;m=p.next()){var b=m.value;rg(e,t,b)}}catch(x){a={error:x}}finally{try{m&&!m.done&&(r=p.return)&&r.call(p)}finally{if(a)throw a.error}}e.restore()}function ng(e,t){var i=t.lineCap||(t.type?"round":"square");i?e.lineCap=i:t.type&&(e.lineCap="round")}function og(e,t){var i=t.lineJoin;i?e.lineJoin=i:t.type&&(e.lineJoin="round")}function cs(e,t,i,a){var r,n,o,s;e.save(),i&&e.translate(-i.x,-i.y),(s=(o=e).setAttrs)===null||s===void 0||s.call(o,t);var h=t.calculative.canvas.store,l=t.textFlip||h.options.textFlip,c=t.textRotate||h.options.textRotate;e.beginPath(),(!l||!c)&&e.save(),t.calculative.flipX&&(e.translate(t.calculative.worldRect.x+t.calculative.worldRect.ex,0),e.scale(-1,1)),t.calculative.flipY&&(e.translate(0,t.calculative.worldRect.y+t.calculative.worldRect.ey),e.scale(1,-1)),t.calculative.rotate&&t.name!=="line"&&or(e,t),(t.calculative.lineWidth>1||a)&&(e.lineWidth=t.calculative.lineWidth);var f;if(t.calculative.hover?(e.strokeStyle=t.hoverColor||h.options.hoverColor,e.fillStyle=t.hoverBackground||h.options.hoverBackground,f=t.hoverBackground||h.options.hoverBackground):t.calculative.active?(e.strokeStyle=t.activeColor||h.options.activeColor,e.fillStyle=t.activeBackground||h.options.activeBackground,f=t.activeBackground||h.options.activeBackground):(t.strokeImage?t.calculative.strokeImg&&(e.strokeStyle=e.createPattern(t.calculative.strokeImg,"repeat"),f=!0):e.strokeStyle=t.calculative.color||us(h),t.backgroundImage?t.calculative.backgroundImg&&(e.fillStyle=e.createPattern(t.calculative.backgroundImg,"repeat"),f=!0):(e.fillStyle=t.background,f=!!t.background)),ng(e,t),og(e,t),Jr(e,t),t.calculative.lineDash&&e.setLineDash(t.calculative.lineDash),t.calculative.lineDashOffset&&(e.lineDashOffset=t.calculative.lineDashOffset),t.calculative.shadowColor&&(e.shadowColor=t.calculative.shadowColor,e.shadowOffsetX=t.calculative.shadowOffsetX,e.shadowOffsetY=t.calculative.shadowOffsetY,e.shadowBlur=t.calculative.shadowBlur),sg(!1,e,t,h,f),fg(e,t),t.calculative.img?(e.save(),e.shadowColor="",e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0,Fa(e,t),e.restore()):t.calculative.icon&&ag(e,t),(!l||!c)&&e.restore(),l&&!c&&(t.calculative.flipX&&(e.translate(t.calculative.worldRect.x+t.calculative.worldRect.ex,0),e.scale(-1,1)),t.calculative.flipY&&(e.translate(0,t.calculative.worldRect.y+t.calculative.worldRect.ey),e.scale(1,-1))),!l&&c&&t.calculative.rotate&&t.name!=="line"&&or(e,t,!0),ig(e,t),t.type===Ye.Line&&t.fillTexts)try{for(var v=Tn(t.fillTexts),g=v.next();!g.done;g=v.next()){var y=g.value;rg(e,t,y)}}catch(p){r={error:p}}finally{try{g&&!g.done&&(n=v.return)&&n.call(v)}finally{if(r)throw r.error}}e.restore()}function sg(e,t,i,a,r){e===void 0&&(e=!0);var n=e?a.path2dMap.get(i):ke.path2dDraws[i.name];if(n){if(i.type===Ye.Line&&i.borderWidth){t.save(),t.beginPath();var o=i.calculative.lineWidth+i.calculative.borderWidth;t.lineWidth=o,t.strokeStyle=i.borderColor,n instanceof Path2D?(r&&t.fill(n),o&&t.stroke(n)):(n(i,t),r&&t.fill(),o&&t.stroke()),t.restore()}n instanceof Path2D?i.type?i.close&&r&&t.fill(n):r&&t.fill(n):(t.save(),n(i,t),r&&t.fill(),t.restore());var s=i.calculative.progress;if(s!=null){t.save();var h=i.calculative.worldRect,l=h.ex,c=h.x,f=h.y,v=h.width,g=h.height,y=h.ey,p=null;if(i.verticalProgress?p=i.reverseProgress?t.createLinearGradient(c,f,c,f+g*s):t.createLinearGradient(c,y,c,f+g*(1-s)):p=i.reverseProgress?t.createLinearGradient(l,f,c+v*(1-s),f):t.createLinearGradient(c,f,c+v*s,f),i.calculative.progressGradientColors){var m=sa(i.calculative.progressGradientColors).colors;m.forEach(function(_){p.addColorStop(_.i,_.color)})}else{var b=i.calculative.progressColor||i.calculative.color||a.options.activeColor;p.addColorStop(0,b),p.addColorStop(1,b)}p.addColorStop(1,"transparent"),t.fillStyle=p,n instanceof Path2D?t.fill(n):(n(i,t),t.fill()),t.restore()}if(i.calculative.lineWidth&&(n instanceof Path2D?(a.options.svgPathStroke||i.name!=="svgPath")&&t.stroke(n):(n(i,t),t.stroke())),i.type){if(i.calculative.animatePos){if(t.save(),lg(t,i,a),i.lineAnimateType===ai.Arrow||i.lineAnimateType===ai.WaterDrop){var x=_g(i,t);x instanceof Path2D?(t.stroke(x),t.fill(x)):(t.stroke(),t.fill())}else n instanceof Path2D?t.stroke(n):(n(i,t),t.stroke());t.restore()}i.fromArrow&&Zv(t,i,a),i.toArrow&&Qv(t,i,a),i.calculative.active&&!i.calculative.pencil&&!a.options.disableAnchor&&!a.data.locked&&cg(t,i)}}}function M2(e,t,i,a){e===void 0&&(e=!0);var r=e?a.path2dMap.get(i):ke.path2dDraws[i.name];if(r&&i.type){if(i.calculative.animatePos){if(t.save(),lg(t,i,a),t.beginPath(),r instanceof Path2D)if(i.lineName==="polyline"||i.lineName==="line")if(i.lineAnimateType===ai.Arrow||i.lineAnimateType===ai.WaterDrop){var n=_g(i);t.stroke(n),t.fill(n)}else i.calculative.gradientSmooth||i.calculative.lineSmooth?(i.calculative.gradientAnimatePath||(i.calculative.gradientAnimatePath=au(i)),i.calculative.gradientAnimatePath instanceof Path2D&&t.stroke(i.calculative.gradientAnimatePath)):t.stroke(r);else t.stroke(r);else r(i,t),t.stroke();t.restore()}i.fromArrow&&Zv(t,i,a),i.toArrow&&Qv(t,i,a),i.calculative.active&&!i.calculative.pencil&&!a.options.disableAnchor&&!a.data.locked&&cg(t,i)}}function lg(e,t,i){e.strokeStyle=t.animateColor||i.options.animateColor,t.animateShadow&&(e.shadowBlur=t.animateShadowBlur||t.animateLineWidth||6,e.shadowColor=t.animateShadowColor||t.animateColor||i.options.animateColor),t.calculative.animateLineWidth&&(e.lineWidth=t.calculative.animateLineWidth*i.data.scale);var a=0;switch(t.lineAnimateType){case ai.Beads:t.animateReverse?e.lineDashOffset=t.calculative.animatePos:e.lineDashOffset=t.length-t.calculative.animatePos,a=t.calculative.lineWidth||5,a<5&&(a=5);var r=t.animateLineDash&&t.animateLineDash.map(function(n){return n*a/5});e.setLineDash(r||[a,a*2]);break;case ai.Dot:t.animateReverse?e.lineDashOffset=t.calculative.animatePos:e.lineDashOffset=t.length-t.calculative.animatePos,a=t.calculative.animateDotSize||t.calculative.lineWidth*2||6,a<6&&(a=6),a>40&&(a=40),e.lineWidth=(t.calculative.animateLineWidth||a)*i.data.scale,e.setLineDash([.1,t.length]);break;case ai.Arrow:e.fillStyle=t.animateColor||i.options.animateColor,e.lineWidth=1;break;case ai.WaterDrop:e.fillStyle=t.animateColor||i.options.animateColor,e.lineWidth=1;break;default:t.animateReverse?(e.lineDashOffset=Number.EPSILON,e.setLineDash([0,t.length-t.calculative.animatePos+1,t.calculative.animatePos])):e.setLineDash([t.calculative.animatePos,t.length+.01-t.calculative.animatePos]);break}}function us(e){var t=e.data,i=e.options;return t.color||i.color}function cg(e,t){var i=t.calculative.canvas.store;e.save(),e.lineWidth=1,e.fillStyle=t.activeColor||i.options.activeColor,t.calculative.worldAnchors.forEach(function(a){!a.hidden&&!a.isTemp&&B2(e,a,t)}),e.restore()}function B2(e,t,i){if(!!t){var a=i.calculative.canvas.store.activeAnchor===i.calculative.activeAnchor&&i.calculative.activeAnchor===t,r=3;i.calculative.lineWidth>3&&(r=i.calculative.lineWidth),i.anchorRadius&&(r=i.anchorRadius),t.radius&&(r=t.radius),a?(t.prev&&(e.save(),e.strokeStyle="#4dffff",e.beginPath(),e.moveTo(t.prev.x,t.prev.y),e.lineTo(t.x,t.y),e.stroke(),e.restore(),e.save(),e.fillStyle="#ffffff",e.beginPath(),e.arc(t.prev.x,t.prev.y,r,0,Math.PI*2),e.fill(),e.stroke(),e.restore()),t.next&&(e.save(),e.strokeStyle="#4dffff",e.beginPath(),e.moveTo(t.x,t.y),e.lineTo(t.next.x,t.next.y),e.stroke(),e.restore(),e.save(),e.fillStyle="#ffffff",e.beginPath(),e.arc(t.next.x,t.next.y,r,0,Math.PI*2),e.fill(),e.stroke(),e.restore(),e.beginPath(),e.arc(t.x,t.y,r,0,Math.PI*2),e.fill(),e.stroke()),e.beginPath(),e.arc(t.x,t.y,r,0,Math.PI*2),e.fill(),e.stroke()):(e.save(),e.fillStyle="#ffffff",e.beginPath(),e.arc(t.x,t.y,r,0,Math.PI*2),e.fill(),e.stroke(),e.restore())}}function ug(e){var t=e.calculative.canvas.store,i={x:e.x,y:e.y};if(!e.parentId||e.parentId&&!t.pens[e.parentId])e.parentId=void 0,i.width=e.width,i.height=e.height,i.rotate=e.rotate,ot(i),tt(i);else{var a=t.pens[e.parentId],r=a.calculative.worldRect;r||(r=ug(a)),i.x=r.x+r.width*e.x,i.y=r.y+r.height*e.y,i.width=r.width*e.width,i.height=r.height*e.height,a.flipX&&(i.x=r.width-(i.x-r.x+i.width)+r.x),a.flipY&&(i.y=r.height-(i.y-r.y+i.height)+r.y),ot(i),i.rotate=r.rotate+e.rotate,tt(i)}return e.calculative.worldRect=i,nu(e,i),i}function nu(e,t){!e.paddingTop&&(e.calculative.paddingTop=0),!e.paddingBottom&&(e.calculative.paddingBottom=0),!e.paddingLeft&&(e.calculative.paddingLeft=0),!e.paddingRight&&(e.calculative.paddingRight=0),Math.abs(e.calculative.paddingTop)<1&&(e.calculative.paddingTop*=t.height),Math.abs(e.calculative.paddingBottom)<1&&(e.calculative.paddingBottom*=t.height),Math.abs(e.calculative.paddingLeft)<1&&(e.calculative.paddingLeft*=t.width),Math.abs(e.calculative.paddingRight)<1&&(e.calculative.paddingRight*=t.width)}function Yo(e){var t=e.calculative.worldRect;if(!e.parentId){Object.assign(e,t);return}var i=e.calculative.canvas.store,a=i.pens[e.parentId].calculative.worldRect;Object.assign(e,Xo(t,a))}function _n(e){var t=e.calculative.canvas.store,i=[];if(e.anchors){var a=ce(e.anchors);e.flipX&&a.forEach(function(l){l.x=.5-(l.x-.5)}),e.flipY&&a.forEach(function(l){l.y=.5-(l.y-.5)}),a.forEach(function(l){i.push(O2(e,l))})}if(!i.length&&!e.type&&!e.calculative.canvas.parent.isCombine(e)){var r=e.calculative.worldRect,n=r.x,o=r.y,s=r.width,h=r.height;i=t.options.defaultAnchors.map(function(l,c){return{id:""+c,penId:e.id,x:n+s*l.x,y:o+h*l.y}})}e.calculative.rotate&&i.forEach(function(l){Ge(l,e.calculative.rotate,e.calculative.worldRect.center)}),(!e.type||e.anchors)&&(e.calculative.worldAnchors=i),e.calculative.activeAnchor&&i.length&&(e.calculative.activeAnchor=i.find(function(l){l.id,e.calculative.activeAnchor.id})),e.calculative.gradientAnimatePath=void 0}function O2(e,t){var i=Mc({},t),a=e.calculative.worldRect,r=a.x,n=a.y,o=a.width,s=a.height;return i.x=r+o*t.x,i.y=n+s*t.y,t.prev&&(i.prev={penId:e.id,connectTo:t.prev.connectTo,x:r+o*t.prev.x,y:n+s*t.prev.y}),t.next&&(i.next={penId:e.id,connectTo:t.next.connectTo,x:r+o*t.next.x,y:n+s*t.next.y}),i}function sd(e,t){var i=t.calculative,a=i.paddingTop,r=i.paddingBottom,n=i.paddingLeft,o=i.paddingRight,s=n,h=a,l=t.calculative.worldRect.width-n-o,c=t.calculative.worldRect.height-a-r,f=t.calculative.iconLeft,v=t.calculative.iconTop;f&&Math.abs(f)<1&&(f=t.calculative.worldRect.width*f),v&&Math.abs(v)<1&&(v=t.calculative.worldRect.height*v),s+=f||0,h+=v||0,l-=f||0,c-=v||0;var g=t.calculative.iconRotate||0;if(t.parentId){var y=e[t.parentId].calculative;y&&(g+=y.rotate,g%=360)}s=t.calculative.worldRect.x+s,h=t.calculative.worldRect.y+h,t.calculative.worldIconRect={x:s,y:h,width:l,height:c,rotate:g},ot(t.calculative.worldIconRect),tt(t.calculative.worldIconRect)}function Aa(e,t,i){ds(e.calculative.worldRect,t,i),e.calculative.initRect&&ds(e.calculative.initRect,t,i),e.calculative.x&&os(e.calculative,t,i),e.type&&_n(e)}function N2(e,t){e.anchors||(e.anchors=[]),e.calculative.worldAnchors||(e.calculative.worldAnchors=[]);var i={id:t.id,penId:e.id,x:t.x,y:t.y};if(e.calculative.worldAnchors.push(i),e.calculative.worldRect){e.rotate%360&&Ge(t,-e.rotate,e.calculative.worldRect.center);var a={id:t.id,penId:e.id,x:(t.x-e.calculative.worldRect.x)/e.calculative.worldRect.width,y:(t.y-e.calculative.worldRect.y)/e.calculative.worldRect.height};e.anchors.push(a)}return i}function F2(e,t,i){e.anchors||(e.anchors=[]),e.calculative.worldAnchors||(e.calculative.worldAnchors=[]);var a=FE(e,t,i);return e.calculative.worldAnchors.splice(i+1,0,a),e.anchors.splice(i+1,0,xn(a,e.calculative.worldRect)),e.calculative.activeAnchor=a,a}function z2(e,t){if(!(!e||!e.calculative.worldAnchors)){var i=e.calculative.worldAnchors.findIndex(function(a){return a.id===t.id});i>-1&&e.calculative.worldAnchors.splice(i,1),i=e.anchors.findIndex(function(a){return a.id===t.id}),i>-1&&e.anchors.splice(i,1)}}function ja(e,t){if(!t||!t.calculative||!t.calculative.worldRect.center)return Pe.None;if(e.anchorId){var i=t.anchors.filter(function(a){return a.id===e.anchorId});if(i.length&&i[0].direction>-1)return i[0].direction}return Rx(e,t.calculative.worldRect.center)}function Ma(e,t){var i=1/0,a;return e.calculative.worldAnchors.forEach(function(r){var n=ws(t,r);i>n&&(i=n,a=r)}),a}function ld(e,t,i){e.x+=t,e.y+=i,e.anchors&&e.anchors.forEach(function(a){wn(a,t,i)}),e.calculative.worldAnchors&&e.calculative.worldAnchors.forEach(function(a){wn(a,t,i)})}function ou(e){if(e&&e.calculative&&e.calculative.worldAnchors.length){var t=We(e);if(!e.anchors||!e.anchors.length)for(;e.calculative.worldAnchors.length&&t!==e.calculative.activeAnchor;)e.calculative.worldAnchors.pop(),t=We(e);else t===e.calculative.activeAnchor?e.calculative.worldAnchors=[e.calculative.worldAnchors[0]]:e.calculative.worldAnchors[0]===e.calculative.activeAnchor&&(e.calculative.worldAnchors=[e.calculative.worldAnchors[e.calculative.worldAnchors.length-1]])}}function _t(e,t,i,a){var r,n,o,s,h,l;if(!(!e||!t||!i||!a||t.twoWay===At.DisableConnected||t.twoWay===At.Disable||a.twoWay===At.DisableConnectTo||a.twoWay===At.Disable)){if(t.twoWay===At.In){if(i.calculative.worldAnchors.length===1)return;var c=We(i);if(a.id!==c.id)return}if(t.twoWay===At.Out){var f=lt(i);if(a.id!==f.id)return}if(!(a.connectTo===e.id&&a.anchorId===t.id)){if(a.connectTo){var v=e.calculative.canvas.store.pens[a.connectTo];Ba(v,Kr(v,a.anchorId),i,a)}e.connectedLines||(e.connectedLines=[]);var g=e.connectedLines.findIndex(function(m){return m.lineId===i.id&&m.lineAnchor===a.id&&m.anchor===t.id});g<0&&e.connectedLines.push({lineId:i.id,lineAnchor:a.id,anchor:t.id}),a.connectTo=e.id,a.anchorId=t.id,e.type&&_t(i,a,e,t),e.calculative.canvas.store.emitter.emit("connectLine",{line:i,lineAnchor:a,pen:e,anchor:t});var y=((r=i.calculative.worldAnchors)===null||r===void 0?void 0:r.length)>=2?(n=i.calculative.worldAnchors)===null||n===void 0?void 0:n[0].connectTo:void 0,p=((o=i.calculative.worldAnchors)===null||o===void 0?void 0:o.length)>=2?(h=i.calculative.canvas.store.pens[(s=i.calculative.worldAnchors)===null||s===void 0?void 0:s[0].connectTo])===null||h===void 0?void 0:h.anchors.find(function(m){var b;return m.id===((b=i.calculative.worldAnchors)===null||b===void 0?void 0:b[0].anchorId)}):void 0;return(l=e.onConnectLine)===null||l===void 0||l.call(e,e,{line:i,lineAnchor:a,pen:e,anchor:t,fromPen:y,fromAnchor:p}),!0}}}function Ba(e,t,i,a){if(!(!e||!t||!i||!a)&&!(!e.connectedLines||!e.connectedLines.length))return i.lastConnected||(i.lastConnected={}),i.lastConnected[e.id]||(i.lastConnected[e.id]=ce(e.connectedLines)),e.connectedLines.forEach(function(r,n,o){(r.lineId===i.id||r.lineId===i.id)&&r.lineAnchor===a.id&&r.anchor===t.id&&o.splice(n,1)}),a.connectTo=void 0,a.anchorId=void 0,e.type&&t.connectTo===i.id&&t.anchorId===a.id&&Ba(i,a,e,t),e.calculative.canvas.store.emitter.emit("disconnectLine",{line:i,lineAnchor:a,pen:e,anchor:t}),!0}function Kr(e,t){var i;if(!(!e||!t))return(i=e.calculative.worldAnchors)===null||i===void 0?void 0:i.find(function(a){return a.id===t})}function lt(e){if(!(!e||!e.calculative.worldAnchors))return e.calculative.worldAnchors[0]}function We(e){if(!(!e||!e.calculative.worldAnchors))return e.calculative.worldAnchors[e.calculative.worldAnchors.length-1]}function H2(e,t){var i,a,r,n,o;if(e.calculative.start===0||!e.frames||!e.frames.length)return e.calculative.start=void 0,0;if(!e.calculative.duration){e.calculative.duration=0;try{for(var s=Tn(e.frames),h=s.next();!h.done;h=s.next()){var l=h.value;e.calculative.duration+=l.duration;for(var c in l)c!=="duration"&&!e[c]&&c==="scale"&&(e[c]=1)}}catch(P){i={error:P}}finally{try{h&&!h.done&&(a=s.return)&&a.call(s)}finally{if(i)throw i.error}}}if(e.animateCycle||(e.animateCycle=1/0),!e.calculative.start)e.calculative.start=t,e.calculative.frameIndex=0,e.calculative.frameStart=e.calculative.start,e.calculative.frameDuration=e.frames[0].duration,e.calculative.frameEnd=e.calculative.frameStart+e.calculative.frameDuration,e.calculative.cycleIndex=1,e.calculative.x=e.calculative.worldRect.x,e.calculative.y=e.calculative.worldRect.y,e.calculative.initRect=ce(e.calculative.worldRect),e.calculative.initRect.rotate=e.calculative.rotate||0,cd(e);else{var f=0,v=Math.ceil((t-e.calculative.start)/e.calculative.duration);if(v>e.animateCycle)return e.currentAnimation=void 0,e.calculative.start=void 0,ud(e,1),0;var g=(t-e.calculative.start)%e.calculative.duration,y=0;try{for(var p=Tn(e.frames),m=p.next();!m.done;m=p.next()){var b=m.value;if(y+=b.duration,g>y)++f;else break}}catch(P){r={error:P}}finally{try{m&&!m.done&&(n=p.return)&&n.call(p)}finally{if(r)throw r.error}}if(!e.frames[f])return!0;e.calculative.frameDuration=e.frames[f].duration,e.calculative.frameStart=e.calculative.start+e.calculative.duration*(v-1),e.calculative.frameEnd=e.calculative.frameStart+e.calculative.frameDuration;var x=f!==e.calculative.frameIndex,_=v>e.calculative.cycleIndex;if(x&&(e.calculative.frameIndex=f),_&&(e.calculative.cycleIndex=v),x||_)if(e.calculative.x=e.calculative.initRect.x,e.calculative.y=e.calculative.initRect.y,!((o=e.children)===null||o===void 0)&&o.length?e.calculative.canvas.rotatePen(e,(e.calculative.initRect.rotate||0)-e.calculative.rotate,e.calculative.initRect):e.calculative.rotate=e.calculative.initRect.rotate||0,f>0){e.prevFrame={};var k=e.frames[f-1];for(var c in k)e.prevFrame[c]=k[c];Object.assign(e.prevFrame,{rotate:k.rotate||0,x:k.x||0,y:k.y||0,scale:k.scale||1})}else cd(e)}var I=(t-e.calculative.frameStart)/e.calculative.frameDuration%1;return ud(e,I),!0}function cd(e){e.prevFrame={};for(var t in e)(typeof e[t]!="object"||t==="lineDash")&&(e.prevFrame[t]=e[t]);e.prevFrame.rotate=0,e.prevFrame.x=0,e.prevFrame.y=0,e.prevFrame.scale=1}function ud(e,t){var i;if(!(t<0)){t>1&&(t=1);var a=e.frames[e.calculative.frameIndex];for(var r in a)if(r!=="duration"){if(r==="scale"){e.calculative.worldRect=ce(e.calculative.initRect),ds(e.calculative.worldRect,e.prevFrame.scale,e.calculative.worldRect.center);var n=e.prevFrame.scale+(a[r]-e.prevFrame.scale)*t;ds(e.calculative.worldRect,n/e.prevFrame.scale,e.calculative.worldRect.center),e.calculative.patchFlags=!0}else if(r==="x"){var o=Ql(e,r,e.calculative.frameIndex);e.calculative.worldRect.x=e.calculative.initRect.x+o,e.calculative.worldRect.ex=e.calculative.initRect.ex+o,Yr(e.calculative.worldRect,a[r]*t*e.calculative.canvas.store.data.scale,0),e.calculative.patchFlags=!0}else if(r==="y"){var o=Ql(e,r,e.calculative.frameIndex);e.calculative.worldRect.y=e.calculative.initRect.y+o,e.calculative.worldRect.ey=e.calculative.initRect.ey+o,Yr(e.calculative.worldRect,0,a[r]*t*e.calculative.canvas.store.data.scale),e.calculative.patchFlags=!0}else if(r==="rotate"){e.prevFrame[r]>=360&&(e.prevFrame[r]%=360);var o=Ql(e,r,e.calculative.frameIndex),s=(e.calculative.initRect.rotate+o+a[r]*t)%360-(e.calculative.rotate||0);!((i=e.children)===null||i===void 0)&&i.length?e.calculative.canvas.rotatePen(e,s,e.calculative.initRect):e.calculative.rotate=(e.calculative.initRect.rotate+o+a[r]*t)%360,e.calculative.patchFlags=!0}else if(r==="image")e.image=a.image,e.calculative.image=void 0,e.calculative.canvas.loadImage(e),e.canvasLayer===Ne.CanvasImageBottom?e.calculative.canvas.canvasImageBottom.init():e.canvasLayer===Ne.CanvasImage&&e.calculative.canvas.canvasImage.init();else if(U2(a[r],r,e)){e.prevFrame[r]==null&&(r==="globalAlpha"?e.prevFrame[r]=1:e.prevFrame[r]=0);var h=e.prevFrame[r]+(a[r]-e.prevFrame[r])*t;e.calculative[r]=Math.round(h*100)/100}else{r==="visible"&&e.calculative.image&&(e.canvasLayer===Ne.CanvasImageBottom?e.calculative.canvas.canvasImageBottom.init():e.canvasLayer===Ne.CanvasImage&&e.calculative.canvas.canvasImage.init()),e.calculative[r]=a[r];var l={};l[r]=a[r],su(e,l)}r==="text"&&Nn(e)}}}function U2(e,t,i){var a=["strokeType","bkType","showChild"];return typeof e=="number"&&i.linear!==!1&&!a.includes(t)}function W2(e,t){if(e.calculative.start===0)return e.calculative.start=void 0,0;if(e.animateCycle||(e.animateCycle=1/0),e.animateSpan||(e.animateSpan=1),e.calculative.animatePos+=e.animateSpan*(e.calculative.canvas.store.data.scale||1),!e.calculative.start)e.calculative.start=Date.now(),e.calculative.animatePos=e.animateSpan*(e.calculative.canvas.store.data.scale||1),e.calculative.cycleIndex=1;else if(e.calculative.animatePos>e.length){if(++e.calculative.cycleIndex,e.calculative.cycleIndex>e.animateCycle)return e.currentAnimation=void 0,e.calculative.start=void 0,0;e.calculative.animatePos=e.animateSpan}return!0}function La(e,t){if(t===void 0&&(t=!0),!!e.children){var i=e.calculative.canvas.store;e.children.forEach(function(a){var r=i.pens[a];r&&(r.calculative.active=t,La(r,t))})}}function yn(e,t){if(t===void 0&&(t=!0),!!e){var i=e.calculative.canvas.store;e.calculative.hover=t,e.children&&e.children.forEach(function(a){var r,n;((r=i.pens[a])===null||r===void 0?void 0:r.hoverColor)==null&&((n=i.pens[a])===null||n===void 0?void 0:n.hoverBackground)==null&&yn(i.pens[a],t)})}}function Ai(e,t){if(!!t){var i=e.calculative.canvas.store,a=e.calculative.worldRect;t.style.opacity=e.globalAlpha+"",t.style.position="absolute",t.style.outline="none",t.style.left=a.x+i.data.x+"px",t.style.top=a.y+i.data.y+"px",t.style.width=a.width+"px",t.style.height=a.height+"px",t.style.display=e.calculative.inView!=!1?e.calculative.cssDisplay||"inline":"none",!e.calculative.rotate&&(e.calculative.rotate=0),t.style.transform="rotate("+e.calculative.rotate+"deg)",e.calculative.rotate||(e.calculative.flipX&&(t.style.transform="rotateY(180deg)"),e.calculative.flipY&&(t.style.transform="rotateX(180deg)"),e.calculative.flipX&&e.calculative.flipY&&(t.style.transform="rotateZ(180deg)")),t.style.zIndex=e.calculative.zIndex!==void 0?e.calculative.zIndex+"":"5",e.calculative.zIndex>e.calculative.canvas.maxZindex&&(e.calculative.canvas.maxZindex=e.calculative.zIndex),e.locked===ze.DisableEdit||e.locked===ze.DisableMove||i.data.locked?(t.style.userSelect="initial",t.style.pointerEvents="initial",e.name==="gif"&&(t.style.userSelect="none",t.style.pointerEvents="none")):(t.style.userSelect="none",t.style.pointerEvents="none")}}function Zl(e){return e.every(function(t){return t.locked})}function hd(e){return e.every(function(t){return t.disableRotate})}function hg(e,t,i){var a;e.type?(e.calculative.worldAnchors.forEach(function(r){Ge(r,t,i.center)}),q2(e),Yo(e)):(e.calculative.rotate?e.calculative.rotate+=t:e.calculative.rotate=t,Ge(e.calculative.worldRect.center,t,i.center),e.parentId&&(e.calculative.worldRect.x=e.calculative.worldRect.center.x-e.calculative.worldRect.width/2,e.calculative.worldRect.y=e.calculative.worldRect.center.y-e.calculative.worldRect.height/2,e.x=(e.calculative.worldRect.x-i.x)/i.width,e.y=(e.calculative.worldRect.y-i.y)/i.height)),(a=e.children)===null||a===void 0||a.forEach(function(r){var n=e.calculative.canvas.store.pens[r];hg(n,t,i)})}function q2(e){var t;if(!!(!((t=e.calculative.worldAnchors)===null||t===void 0)&&t.length)&&!(!isFinite(e.x)||!isFinite(e.x))&&!(e.x==null||e.y==null)){var i=Hc(e);e.parentId||Object.assign(e,i);var a=e.calculative.canvas.store.options,r=a.fontSize,n=a.lineHeight;e.fontSize||(e.fontSize=r,e.calculative.fontSize=e.fontSize*e.calculative.canvas.store.data.scale),e.lineHeight||(e.lineHeight=n,e.calculative.lineHeight=e.lineHeight),tt(i),e.calculative.worldRect=i,nu(e,i),Ni(e),e.calculative.worldAnchors&&(e.anchors=e.calculative.worldAnchors.map(function(o){return xn(o,e.calculative.worldRect)}))}}function fd(e){return e.every(function(t){return t.disableSize})}function Ql(e,t,i){if(!e.frames||!t)return 0;for(var a=0,r=0;r<i;r++)e.frames[r]&&(a+=e.frames[r][t]||0);return a}function hs(e,t){for(var i,a=e;a&&a.parentId;){var r=a;a=t.pens[a.parentId];var n=(i=a==null?void 0:a.calculative)===null||i===void 0?void 0:i.showChild;if(n!=null){var o=a.children[n];if(o!==r.id)return!1}}return!0}function Cr(e,t){var i,a;t===void 0&&(t=!1);var r=e.calculative.canvas,n=r.store,o=r.canvasRect;if(t&&((i=e.children)===null||i===void 0||i.forEach(function(y){var p=n.pens[y];p&&Cr(p,!0)})),e.calculative.inView=!0,!hs(e,n)||e.visible==!1||e.calculative.visible==!1)e.calculative.inView=!1;else{var s=e.calculative.worldRect,h=s.x,l=s.y,c=s.width,f=s.height,v=s.rotate,g={x:h+n.data.x,y:l+n.data.y,width:c,height:f,rotate:v};ot(g),fs(g,o)||(e.calculative.inView=!1)}(a=e.onMove)===null||a===void 0||a.call(e,e)}function j2(e,t,i){if(t.fillWorldTextRect){e.save(),e.fillStyle="#c3deb7";var a=i.calculative.worldTextRect,r=a.x,n=a.y,o=a.width,s=a.height;e.fillRect(r,n,o,s),e.restore()}}function Jr(e,t){var i=t.calculative.globalAlpha;typeof i=="number"&&i<1&&!isNaN(i)&&(e.globalAlpha=i)}function fg(e,t){var i=ke.canvasDraws[t.name];i&&(e.save(),i(e,t),e.restore())}function su(e,t){for(var i in t)$v.includes(i)&&(e[i]=t[i],["fontSize","lineWidth"].includes(i)?(e.calculative[i]=t[i]*e.calculative.canvas.store.data.scale,Ni(e)):e.calculative[i]=t[i]);if(e.calculative.canvas.parent.isCombine(e)&&e.showChild===void 0){var a=e.children;a==null||a.forEach(function(r){var n=e.calculative.canvas.store.pens[r];n&&su(n,t)})}}var Rn=globalThis&&globalThis.__values||function(e){var t=typeof Symbol=="function"&&Symbol.iterator,i=t&&e[t],a=0;if(i)return i.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Bc=globalThis&&globalThis.__read||function(e,t){var i=typeof Symbol=="function"&&e[Symbol.iterator];if(!i)return e;var a=i.call(e),r,n=[],o;try{for(;(t===void 0||t-- >0)&&!(r=a.next()).done;)n.push(r.value)}catch(s){o={error:s}}finally{try{r&&!r.done&&(i=a.return)&&i.call(a)}finally{if(o)throw o.error}}return n},Go=globalThis&&globalThis.__spreadArray||function(e,t,i){if(i||arguments.length===2)for(var a=0,r=t.length,n;a<r;a++)(n||!(a in t))&&(n||(n=Array.prototype.slice.call(t,0,a)),n[a]=t[a]);return e.concat(n||Array.prototype.slice.call(t))};function dd(e,t,i){var a,r,n,o,s=1/0,h=1/0,l=8,c=function(y){if(y.calculative.inView===!1)return"continue";var p=lu(y);p.forEach(function(m){if(!(m===t||m===i)){var b=(y.calculative.worldRect.center.x-t.x)*(y.calculative.worldRect.center.x-t.x)+(y.calculative.worldRect.center.y-t.y)*(y.calculative.worldRect.center.y-t.y),x=Math.abs(m.x-t.x);x>0&&x<l&&b<s&&(n={x:Math.round(m.x)+.5,y:Math.round(m.y)+.5,prev:{x:Math.round(t.x)+.5,y:Math.round(t.y)+.5},step:m.x-t.x},s=b);var _=Math.abs(m.y-t.y);_>0&&_<l&&b<h&&(o={x:Math.round(m.x)+.5,y:Math.round(m.y)+.5,prev:{x:Math.round(t.x)+.5,y:Math.round(t.y)+.5},step:m.y-t.y},h=b)}})};try{for(var f=Rn(e.data.pens),v=f.next();!v.done;v=f.next()){var g=v.value;c(g)}}catch(y){a={error:y}}finally{try{v&&!v.done&&(r=f.return)&&r.call(f)}finally{if(a)throw a.error}}return{xDock:n,yDock:o}}function K2(e,t,i,a){var r=[];return i.length===1?(r=ce(lu(i[0])),r.forEach(function(n){n.x+=a.x,n.y+=a.y})):(tt(t),r=Go([t.center],Bc(sr(t)),!1)),dg(e,r,t,!0)}function lu(e){if(e.type){if(e.type===Ye.Line)return e.calculative.worldAnchors}else{var t=sr(e.calculative.worldRect);return tt(e.calculative.worldRect),Go(Go(Go([],Bc(e.calculative.worldAnchors),!1),Bc(t),!1),[e.calculative.worldRect.center],!1)}}function V2(e,t,i,a){var r=sr(t);return dg(e,r,t)}function dg(e,t,i,a){a===void 0&&(a=!1);var r,n,o=1/0,s=1/0,h=10,l=tE(i,h);return e.data.pens.forEach(function(c){var f,v,g,y,p=c.calculative,m=p.inView,b=p.worldRect,x=p.active;if(!(m===!1||!a&&x||eE(l,b)||c.type&&e.active.some(function(O){return vg(e,O,c)}))){var _=lu(c);if(!!_)try{for(var k=Rn(_),I=k.next();!I.done;I=k.next()){var P=I.value;try{for(var M=(g=void 0,Rn(t)),L=M.next();!L.done;L=M.next()){var U=L.value,$=P.x-U.x,S=P.y-U.y,T=Math.abs($),R=Math.abs(S);i.center||(i.center={x:i.x+i.width/2,y:i.y+i.height/2}),T<h&&T<o&&(r={x:Math.round(P.x)+.5,y:Math.round(P.y)+.5,step:$,prev:{x:Math.round(U.x)+.5,y:Math.round(U.y)+.5},penId:c.id,anchorId:U.id,dockAnchorId:P.id},o=T),R<h&&R<s&&(n={x:Math.round(P.x)+.5,y:Math.round(P.y)+.5,step:S,prev:{x:Math.round(U.x)+.5,y:Math.round(U.y)+.5},penId:c.id,anchorId:U.id,dockAnchorId:P.id},s=R)}}catch(O){g={error:O}}finally{try{L&&!L.done&&(y=M.return)&&y.call(M)}finally{if(g)throw g.error}}}}catch(O){f={error:O}}finally{try{I&&!I.done&&(v=k.return)&&v.call(k)}finally{if(f)throw f.error}}}}),{xDock:r,yDock:n}}function vg(e,t,i){var a,r,n,o;if(!i.type)return!1;if(Array.isArray(t==null?void 0:t.connectedLines))try{for(var s=Rn(t==null?void 0:t.connectedLines),h=s.next();!h.done;h=s.next()){var l=h.value;if(l.lineId===i.id)return!0}}catch(y){a={error:y}}finally{try{h&&!h.done&&(r=s.return)&&r.call(s)}finally{if(a)throw a.error}}if(Array.isArray(t==null?void 0:t.children))try{for(var c=Rn(t.children),f=c.next();!f.done;f=c.next()){var v=f.value,g=e.pens[v];if(vg(e,g,i))return!0}}catch(y){n={error:y}}finally{try{f&&!f.done&&(o=c.return)&&o.call(c)}finally{if(n)throw n.error}}return!1}function Oc(e,t){return e.toFixed(12)==t}var $2=globalThis&&globalThis.__values||function(e){var t=typeof Symbol=="function"&&Symbol.iterator,i=t&&e[t],a=0;if(i)return i.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};function vd(e){var t,i;if(e.id=Me(),Array.isArray(e.anchors))try{for(var a=$2(e.anchors),r=a.next();!r.done;r=a.next()){var n=r.value;e.type&&(n.id=Me()),n.penId=e.id,n.prev&&(e.type&&(n.prev.id=Me()),n.prev.penId=e.id),n.next&&(e.type&&(n.next.id=Me()),n.next.penId=e.id)}}catch(o){t={error:o}}finally{try{r&&!r.done&&(i=a.return)&&i.call(a)}finally{if(t)throw t.error}}}var gd=globalThis&&globalThis.__read||function(e,t){var i=typeof Symbol=="function"&&e[Symbol.iterator];if(!i)return e;var a=i.call(e),r,n=[],o;try{for(;(t===void 0||t-- >0)&&!(r=a.next()).done;)n.push(r.value)}catch(s){o={error:s}}finally{try{r&&!r.done&&(i=a.return)&&i.call(a)}finally{if(o)throw o.error}}return n},yd=globalThis&&globalThis.__spreadArray||function(e,t,i){if(i||arguments.length===2)for(var a=0,r=t.length,n;a<r;a++)(n||!(a in t))&&(n||(n=Array.prototype.slice.call(t,0,a)),n[a]=t[a]);return e.concat(n||Array.prototype.slice.call(t))};function Y2(){var e=null,t=new Map;return function(i,a,r,n){if(n===void 0&&(n=!1),t.has(i)&&t.get(i)?e=t.get(i):t.set(i,e=new Map),typeof r!="function")return function(){console.warn("[rewritePenLifeCycle] warn: not a function ")};var o=new Set,s=new Map;e.has(a)&&e.get(a)?o=e.get(a):(s.set(a,i[a]),e.set(a,o)),n?o.delete(r):o.add(r);var h=s.get(a),l=function(){for(var c=[],f=0;f<arguments.length;f++)c[f]=arguments[f];h==null||h.apply(void 0,yd([],gd(c),!1)),o.forEach(function(v){v.apply(void 0,yd([],gd(c),!1))})};i[a]=l}}var G2=Y2();function X2(e){return!e.name&&!e.install?(console.error("installPenPlugin Error: Validation Failed"),!1):!0}var gg=globalThis&&globalThis.__values||function(e){var t=typeof Symbol=="function"&&Symbol.iterator,i=t&&e[t],a=0;if(i)return i.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Z2=globalThis&&globalThis.__read||function(e,t){var i=typeof Symbol=="function"&&e[Symbol.iterator];if(!i)return e;var a=i.call(e),r,n=[],o;try{for(;(t===void 0||t-- >0)&&!(r=a.next()).done;)n.push(r.value)}catch(s){o={error:s}}finally{try{r&&!r.done&&(i=a.return)&&i.call(a)}finally{if(o)throw o.error}}return n},Q2=globalThis&&globalThis.__spreadArray||function(e,t,i){if(i||arguments.length===2)for(var a=0,r=t.length,n;a<r;a++)(n||!(a in t))&&(n||(n=Array.prototype.slice.call(t,0,a)),n[a]=t[a]);return e.concat(n||Array.prototype.slice.call(t))};function Da(e,t){if(!!t){if(t.ex==null&&ot(t),!t.rotate||t.rotate%360===0)return e.x>t.x&&e.x<t.ex&&e.y>t.y&&e.y<t.ey;t.center||tt(t);var i=[{x:t.x,y:t.y},{x:t.ex,y:t.y},{x:t.ex,y:t.ey},{x:t.x,y:t.ey}];return i.forEach(function(a){Ge(a,t.rotate,t.center)}),J2(e,i)}}function ea(e,t,i){i===void 0&&(i=0);var a=t.x,r=t.y,n=t.ex,o=t.ey;return e.x>=a-i&&e.x<=n+i&&e.y>=r-i&&e.y<=o+i}function tt(e){e.center||(e.center={}),e.center.x=e.x+e.width/2,e.center.y=e.y+e.height/2}function ot(e){e.ex=e.x+e.width,e.ey=e.y+e.height}function J2(e,t){var i,a;if(t.length<3)return!1;var r=!1,n=t[t.length-1];try{for(var o=gg(t),s=o.next();!s.done;s=o.next()){var h=s.value;n.y>e.y!=h.y>e.y&&h.x+(e.y-h.y)*(n.x-h.x)/(n.y-h.y)>e.x&&(r=!r),n=h}}catch(l){i={error:l}}finally{try{s&&!s.done&&(a=o.return)&&a.call(o)}finally{if(i)throw i.error}}return r}function Hi(e){var t=[];e.forEach(function(a){if(!a.isRuleLine){var r=a.calculative.worldRect;if(r){var n=sr(r);t.push.apply(t,Q2([],Z2(n),!1))}}});var i=Fn(t);return tt(i),i}function sr(e){var t=[{x:e.x,y:e.y},{x:e.ex,y:e.y},{x:e.ex,y:e.ey},{x:e.x,y:e.ey}];return e.rotate&&(e.center||tt(e),t.forEach(function(i){Ge(i,e.rotate,e.center)})),t}function Fn(e){var t=1/0,i=1/0,a=-1/0,r=-1/0;return e==null||e.forEach(function(n){!isFinite(n.x)||!isFinite(n.y)||(t=Math.min(t,n.x),i=Math.min(i,n.y),a=Math.max(a,n.x),r=Math.max(r,n.y))}),{x:t,y:i,ex:a,ey:r,width:a-t,height:r-i}}function fs(e,t,i){return e.rotate&&(e=Fn(sr(e))),i?e.x>t.x&&e.ex<t.ex&&e.y>t.y&&e.ey<t.ey:!(e.x>t.ex||e.ex<t.x||e.ey<t.y||e.y>t.ey)}function eE(e,t){return(t.x>e.ex||t.ex<e.x)&&(t.y>e.ey||t.ey<e.y)}function tE(e,t){var i=ar(t),a={x:e.x-i[3],y:e.y-i[0],width:e.width+i[1]+i[3],height:e.height+i[0]+i[2]};return ot(a),a}function Yr(e,t,i){e.x+=t,e.y+=i,e.ex+=t,e.ey+=i,e.center&&(e.center.x+=t,e.center.y+=i)}function iE(e,t){var i=(e.to.y-e.from.y)/(e.to.x-e.from.x),a=(t.to.y-t.from.y)/(t.to.x-t.from.x);return Nc({k:i,point:e.from},{k:a,point:t.from})}function Nc(e,t){if(Oc(e.k,0))return{x:t.point.x,y:e.point.y};if(Oc(t.k,0))return{x:e.point.x,y:t.point.y};var i=e.point.y-e.k*e.point.x,a=t.point.y-t.k*t.point.x,r=(a-i)/(e.k-t.k),n=e.k*r+i;return{x:r,y:n}}function rE(e,t){var i,a,r=iE({from:e[0],to:e[2]},{from:e[1],to:e[3]});try{for(var n=gg(e),o=n.next();!o.done;o=n.next()){var s=o.value;Ge(s,-t,r)}}catch(h){i={error:h}}finally{try{o&&!o.done&&(a=n.return)&&a.call(n)}finally{if(i)throw i.error}}return Fn(e)}function md(e,t,i,a){var r=e.rotate?e.rotate%360:0;if(r){var n=sr(e),o=(n[0].y-n[1].y)/(n[0].x-n[1].x),s=(n[1].y-n[2].y)/(n[1].x-n[2].x);if(a<4){if(n[a].x+=t,e.ratio)if(a===0||a===2){var h=t*Math.tan((90-(360-r)-Math.atan(e.width/e.height)/Math.PI*180)/180*Math.PI);n[a].y+=h}else{var h=t*Math.tan((90-(360-r)+Math.atan(e.width/e.height)/Math.PI*180)/180*Math.PI);n[a].y+=h}else n[a].y+=i;var l=n[(a+2)%4];n[(a+1)%4]=Nc({k:a%2?s:o,point:n[a]},{k:a%2?o:s,point:l}),n[(a+4-1)%4]=Nc({k:a%2?o:s,point:n[a]},{k:a%2?s:o,point:l})}else{var c=[4,6].includes(a)?s:o;Oc(c,0)?(n[a%4].x+=t,n[(a+1)%4].x+=t):(n[a%4].y+=i,n[a%4].x+=i/c,n[(a+1)%4].y+=i,n[(a+1)%4].x+=i/c)}if(Math.pow(n[0].x-n[1].x,2)+Math.pow(n[0].y-n[1].y,2)<25||Math.pow(n[1].x-n[2].x,2)+Math.pow(n[1].y-n[2].y,2)<25)return;var f=rE(n,e.rotate);tt(f),Object.assign(e,f);return}switch(a){case 0:if(e.width-t<5||e.height-i<5)break;e.x+=t,e.y+=i,e.width-=t,e.height-=i;break;case 1:if(e.width+t<5||e.height-i<5)break;e.ex+=t,e.y+=i,e.width+=t,e.height-=i;break;case 2:if(e.width+t<5||e.height+i<5)break;e.ex+=t,e.ey+=i,e.width+=t,e.height+=i;break;case 3:if(e.width-t<5||e.height+i<5)break;e.x+=t,e.ey+=i,e.width-=t,e.height+=i;break;case 4:if(e.height-i<5)break;e.y+=i,e.height-=i;break;case 5:if(e.width+t<5)break;e.ex+=t,e.width+=t;break;case 6:if(e.height+i<5)break;e.ey+=i,e.height+=i;break;case 7:if(e.width-t<5)break;e.x+=t,e.width-=t;break}}function ds(e,t,i){!e||(e.width*=t,e.height*=t,os(e,t,i),ot(e),tt(e))}function Xo(e,t){var i={x:(e.x-t.x)/t.width,y:(e.y-t.y)/t.height,width:e.width/t.width,height:e.height/t.height};return ot(i),i}function xn(e,t){var i=t.x,a=t.y,r=t.width,n=t.height,o=e.penId,s=e.connectTo,h=Object.assign({},e,{x:r?(e.x-i)/r:0,y:n?(e.y-a)/n:0});return e.prev&&(h.prev={penId:o,connectTo:s,x:r?(e.prev.x-i)/r:0,y:n?(e.prev.y-a)/n:0}),e.next&&(h.next={penId:o,connectTo:s,x:r?(e.next.x-i)/r:0,y:n?(e.next.y-a)/n:0}),h}function aE(e,t){for(var i=!1,a=0,r=t.length-1;a<t.length;r=a++){var n=t[a].x,o=t[a].y,s=t[r].x,h=t[r].y,l=o>e.y!=h>e.y&&e.x<(s-n)*(e.y-o)/(h-o)+n;l&&(i=!i)}return i}var nE=globalThis&&globalThis.__read||function(e,t){var i=typeof Symbol=="function"&&e[Symbol.iterator];if(!i)return e;var a=i.call(e),r,n=[],o;try{for(;(t===void 0||t-- >0)&&!(r=a.next()).done;)n.push(r.value)}catch(s){o={error:s}}finally{try{r&&!r.done&&(i=a.return)&&i.call(a)}finally{if(o)throw o.error}}return n},oE=globalThis&&globalThis.__spreadArray||function(e,t,i){if(i||arguments.length===2)for(var a=0,r=t.length,n;a<r;a++)(n||!(a in t))&&(n||(n=Array.prototype.slice.call(t,0,a)),n[a]=t[a]);return e.concat(n||Array.prototype.slice.call(t))},sE=globalThis&&globalThis.__values||function(e){var t=typeof Symbol=="function"&&Symbol.iterator,i=t&&e[t],a=0;if(i)return i.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},lE=/^[\t\n\f\r ]*([MLHVZCSQTAmlhvzcsqta])[\t\n\f\r ]*/,pd=/^[01]/,Ze=/^[+-]?(([0-9]*\.[0-9]+)|([0-9]+\.)|([0-9]+))([eE][+-]?[0-9]+)?/,cE=/^(([\t\n\f\r ]+,?[\t\n\f\r ]*)|(,[\t\n\f\r ]*))/,uE={M:[Ze,Ze],L:[Ze,Ze],H:[Ze],V:[Ze],Z:[],C:[Ze,Ze,Ze,Ze,Ze,Ze],S:[Ze,Ze,Ze,Ze],Q:[Ze,Ze,Ze,Ze],T:[Ze,Ze],A:[Ze,Ze,Ze,pd,pd,Ze,Ze]};function hE(e){for(var t=0,i=[];t<e.length;){var a=e.slice(t).match(lE);if(a!==null){var r=a[1];t+=a[0].length;var n=gE(r,e,t);t=n.cursor,i.push.apply(i,oE([],nE(n.commands),!1))}else throw new Error("malformed path (first error at "+t+")")}return{commands:i}}function wd(e){var t=1/0,i=1/0,a=-1/0,r=-1/0;return mE(e),e.commands.forEach(function(n){n.worldPoints.forEach(function(o,s){s%2===0?(o<t&&(t=o),o>a&&(a=o)):(o<i&&(i=o),o>r&&(r=o))})}),--t,--i,{x:t,y:i,ex:a,ey:r,width:a-t+1,height:r-i+1}}function fE(e,t,i){i==null&&(i=t),e.commands.forEach(function(a,r){if(!(a.relative&&r))switch(a.key){case"A":case"a":a.values[5]+=t,a.values[6]+=i;break;case"V":case"v":a.values[0]+=i;break;default:a.values.forEach(function(n,o){a.values[o]=n+(o%2===0?t:i)});break}})}function dE(e,t,i){i==null&&(i=t),e.commands.forEach(function(a){switch(a.key){case"A":case"a":var r=a.values[0],n=a.values[1],o=Math.PI*a.values[2]/180,s=Math.cos(o),h=Math.sin(o),l=n*n*i*i*s*s+r*r*i*i*h*h,c=2*t*i*s*h*(n*n-r*r),f=r*r*t*t*s*s+n*n*t*t*h*h,v=-(r*r*n*n*t*t*i*i),g=c*c-4*l*f,y=Math.sqrt((l-f)*(l-f)+c*c);a.values[2]=c!==0?Math.atan((f-l-y)/c)*180/Math.PI:l<f?0:90,a.values[0]=-Math.sqrt(2*g*v*(l+f+y))/g,a.values[1]=-Math.sqrt(2*g*v*(l+f-y))/g,a.values[5]*=t,a.values[6]*=i,a.values[4]=t*i>=0?a.values[4]:1-a.values[4];break;case"V":case"v":a.values[0]*=i;break;default:a.values.forEach(function(p,m){a.values[m]=p*(m%2===0?t:i)});break}})}function vE(e){var t="";return e.commands.forEach(function(i){t+=i.key+" ",i.values.forEach(function(a){t+=a+" "})}),t}function gE(e,t,i){for(var a,r,n=uE[e.toUpperCase()],o=[];i<=t.length;){var s={key:e,values:[]};try{for(var h=(a=void 0,sE(n)),l=h.next();!l.done;l=h.next()){var c=l.value,f=t.slice(i).match(c);if(f!==null){s.values.push(+f[0]),i+=f[0].length;var v=t.slice(i).match(cE);v!==null&&(i+=v[0].length)}else{if(s.values.length===0)return{cursor:i,commands:o};throw new Error("malformed path (first error at "+i+")")}}}catch(g){a={error:g}}finally{try{l&&!l.done&&(r=h.return)&&r.call(h)}finally{if(a)throw a.error}}if(s.relative=s.key.toUpperCase()!==s.key,o.push(s),n.length===0)return{cursor:i,commands:o};e==="m"&&(e="l"),e==="M"&&(e="L")}throw new Error("malformed path (first error at "+i+")")}function yE(e,t){for(var i=[],a=e.relative&&t?{x:t.worldPoints[t.worldPoints.length-2],y:t.worldPoints[t.worldPoints.length-1]}:{x:0,y:0},r=0;r<e.values.length-1;r+=2)i.push(a.x+e.values[r]),i.push(a.y+e.values[r+1]);e.worldPoints=i}function mE(e){var t,i=0,a=0;e.commands.forEach(function(r){switch(r.key){case"Z":case"z":r.worldPoints=[i,a];break;case"H":r.worldPoints=[r.values[0],t.worldPoints[t.worldPoints.length-1]];break;case"h":r.worldPoints=[r.values[0]+t.worldPoints[t.worldPoints.length-2],t.worldPoints[t.worldPoints.length-1]];break;case"V":r.worldPoints=[t.worldPoints[t.worldPoints.length-2],r.values[0]];break;case"v":r.worldPoints=[t.worldPoints[t.worldPoints.length-2],r.values[0]+t.worldPoints[t.worldPoints.length-1]];break;case"A":r.worldPoints=[t.worldPoints[t.worldPoints.length-2],r.values[0]+t.worldPoints[t.worldPoints.length-1]];break;default:yE(r,t);break}(r.key==="M"||r.key==="m"||r.key==="Z"||r.key==="z")&&(i=r.worldPoints[r.worldPoints.length-2],a=r.worldPoints[r.worldPoints.length-1]),t=r})}function pE(e,t){var i,a,r=e.calculative.canvas.store,n=r.data.paths[e.pathId];if(!n)return new Path2D;var o=hE(n);e.calculative.svgRect=wd(o),tt(e.calculative.svgRect),(e.calculative.svgRect.width!==e.calculative.worldRect.width||e.calculative.svgRect.height!==e.calculative.worldRect.height)&&dE(o,e.calculative.worldRect.width/e.calculative.svgRect.width,e.calculative.worldRect.height/e.calculative.svgRect.height);var s=wd(o);tt(s),fE(o,e.calculative.worldRect.x-s.x,e.calculative.worldRect.y-s.y);var h=vE(o);if(t){(a=(i=t).svgPath)===null||a===void 0||a.call(i,h);return}var l=new Path2D(h);return l}function wE(e,t){var i=t||new Path2D,a=e.calculative.worldRect,r=a.x,n=a.y,o=a.width,s=a.height;if(i.moveTo(r+o/2,n),i.lineTo(r+o,n+s/2),i.lineTo(r+o/2,n+s),i.lineTo(r,n+s/2),i.lineTo(r+o/2,n),i.closePath(),i instanceof Path2D)return i}function bE(e,t){var i=t||new Path2D,a=e.calculative.worldRect,r=a.x,n=a.y,o=a.width,s=a.height;if(i.moveTo(r+o/2,n),i.lineTo(r+o,n+s),i.lineTo(r,n+s),i.lineTo(r+o/2,n),i.closePath(),i instanceof Path2D)return i}function _E(e){var t=[{x:.5,y:0},{x:.75,y:.5},{x:.5,y:1},{x:.25,y:.5}];e.anchors=t.map(function(i,a){var r=i.x,n=i.y;return{id:""+a,penId:e.id,x:r,y:n}})}function xE(e,t){var i=t||new Path2D,a=e.calculative.worldRect,r=a.x,n=a.y,o=a.width,s=a.height;if(i.moveTo(r+o/2,n),i.lineTo(r+o,n+s*2/5),i.lineTo(r+o*4/5,n+s),i.lineTo(r+o/5,n+s),i.lineTo(r,n+s*2/5),i.closePath(),i instanceof Path2D)return i}function EE(e){var t=[{x:.5,y:0},{x:1,y:.4},{x:.8,y:1},{x:.2,y:1},{x:0,y:.4}];e.anchors=t.map(function(i,a){var r=i.x,n=i.y;return{id:""+a,penId:e.id,x:r,y:n}})}var kE=globalThis&&globalThis.__read||function(e,t){var i=typeof Symbol=="function"&&e[Symbol.iterator];if(!i)return e;var a=i.call(e),r,n=[],o;try{for(;(t===void 0||t-- >0)&&!(r=a.next()).done;)n.push(r.value)}catch(s){o={error:s}}finally{try{r&&!r.done&&(i=a.return)&&i.call(a)}finally{if(o)throw o.error}}return n},CE=globalThis&&globalThis.__spreadArray||function(e,t,i){if(i||arguments.length===2)for(var a=0,r=t.length,n;a<r;a++)(n||!(a in t))&&(n||(n=Array.prototype.slice.call(t,0,a)),n[a]=t[a]);return e.concat(n||Array.prototype.slice.call(t))};function AE(e,t){e.onResize||(e.onResize=SE);var i=t||new Path2D,a=e.calculative.worldRect,r=a.width,n=a.height,o=a.center,s=r>n?n:r,h=o.x,l=o.y,c=l-s/2,f=l-s/4,v=-(f-l)*Math.sin(Math.PI/180*324)+h,g=(f-l)*Math.cos(Math.PI/180*324)+l;i.moveTo(v,g);for(var y=0;y<5;++y)i.lineTo(-(c-l)*Math.sin(Math.PI/180*72*y)+h,(c-l)*Math.cos(Math.PI/180*72*y)+l),i.lineTo((v-h)*Math.cos(Math.PI/180*72*(y+1))-(g-l)*Math.sin(Math.PI/180*72*(y+1))+h,(v-h)*Math.sin(Math.PI/180*72*(y+1))+(g-l)*Math.cos(Math.PI/180*72*(y+1))+l);if(i.closePath(),i instanceof Path2D)return i}function yg(e){for(var t=e.width,i=e.height,a=t>i?i:t,r=[],n=0;n<5;++n)r.push({flag:1,id:String(n),penId:e.id,x:.5+a/2*Math.sin(Math.PI/180*72*n)/t,y:-a/2*Math.cos(Math.PI/180*72*n)/i+.5});e.anchors=r}function SE(e){var t,i=e.anchors.filter(function(a){return a.flag!==1});yg(e),e.anchors=(t=e.anchors).concat.apply(t,CE([],kE(i),!1))}function TE(e,t){var i=t||new Path2D,a=e.calculative.worldRect,r=a.x,n=a.y,o=a.width,s=a.height;if(i.moveTo(r+o/4,n),i.lineTo(r+o*3/4,n),i.lineTo(r+o,n+s/2),i.lineTo(r+o*3/4,n+s),i.lineTo(r+o*1/4,n+s),i.lineTo(r,n+s/2),i.lineTo(r+o/4,n),i.closePath(),i instanceof Path2D)return i}function RE(e,t){var i=t||new Path2D,a=e.calculative.worldRect,r=a.x,n=a.y,o=a.width,s=a.height;if(i.moveTo(r,n+s/2),i.lineTo(r+s/2,n),i.lineTo(r+s/2,n+s/3),i.lineTo(r+o,n+s/3),i.lineTo(r+o,n+s*2/3),i.lineTo(r+s/2,n+s*2/3),i.lineTo(r+s/2,n+s*2/3),i.lineTo(r+s/2,n+s),i.closePath(),i instanceof Path2D)return i}function PE(e,t){var i=t||new Path2D,a=e.calculative.worldRect,r=a.x,n=a.y,o=a.width,s=a.height;if(i.moveTo(r,n+s/3),i.lineTo(r+(o-s/2),n+s/3),i.lineTo(r+(o-s/2),n),i.lineTo(r+o,n+s/2),i.lineTo(r+(o-s/2),n+s),i.lineTo(r+(o-s/2),n+s*2/3),i.lineTo(r,n+s*2/3),i.closePath(),i instanceof Path2D)return i}function IE(e,t){var i=t||new Path2D,a=e.calculative.worldRect,r=a.x,n=a.y,o=a.width,s=a.height;if(i.moveTo(r,n+s/2),i.lineTo(r+s/2,n),i.lineTo(r+s/2,n+s/3),i.lineTo(r+(o-s/2),n+s/3),i.lineTo(r+(o-s/2),n),i.lineTo(r+o,n+s/2),i.lineTo(r+(o-s/2),n+s),i.lineTo(r+(o-s/2),n+s*2/3),i.lineTo(r+s/2,n+s*2/3),i.lineTo(r+s/2,n+s),i.closePath(),i instanceof Path2D)return i}function LE(e,t){var i=t||new Path2D,a=e.calculative.worldRect,r=a.x,n=a.y,o=a.width,s=a.height,h=a.ey;if(i.moveTo(r,n),i.lineTo(r+o,n),i.lineTo(r+o,n+s*3/4),i.lineTo(r+o*8/16,n+s*3/4),i.lineTo(r+o/4,h),i.lineTo(r+o*5/16,n+s*3/4),i.lineTo(r,n+s*3/4),i.closePath(),i instanceof Path2D)return i}function DE(e,t){var i=t||new Path2D,a=e.calculative.worldRect,r=a.x,n=a.y,o=a.width,s=a.height;if(i.moveTo(r+o/5,n+s*13/16),i.bezierCurveTo(r-o/15,n+s*13/16,r-o/15,n+s*7/16,r+o/5,n+s*7/16),i.bezierCurveTo(r+o/5,n,r+o*4/5,n,r+o*4/5,n+s*7/16),i.bezierCurveTo(r+o*16/15,n+s*7/16,r+o*16/15,n+s*13/16,r+o*4/5,n+s*13/16),i.closePath(),i instanceof Path2D)return i}function ME(e,t){var i=t||new Path2D,a=e.calculative.worldRect,r=a.x,n=a.y,o=a.width,s=a.ex,h=a.ey,l=o/6;if(i.moveTo(r,n),i.lineTo(s-l,n),i.lineTo(s,n+l),i.lineTo(s,h),i.lineTo(r,h),i.closePath(),i.moveTo(s-l,n),i.lineTo(s-l,n+l),i.lineTo(s,n+l),i.closePath(),i instanceof Path2D)return i}function BE(e,t){var i=t.calculative.worldRect,a=i.x,r=i.y,n=i.width,o=i.ex,s=i.ey,h=n*.25,l=t.z;l>1?h=l:l>0&&(h=n*l);var c={x:a,y:r+h},f={x:o-h,y:r+h},v={x:o-h,y:s},g={x:a,y:s};Jl(e,[c,f,v,g],t.backgroundFront||t.background,t.color),Jl(e,[c,{x:a+h,y:r},{x:o,y:r},f],t.backgroundUp||t.background,t.color),Jl(e,[f,{x:o,y:r},{x:o,y:s-h},v],t.backgroundRight||t.background,t.color)}function Jl(e,t,i,a){i===void 0&&(i=""),a===void 0&&(a=""),e.save(),i&&(e.fillStyle=i),a&&(e.strokeStyle=a),e.beginPath();for(var r=0;r<t.length;++r)r?e.lineTo(t[r].x,t[r].y):e.moveTo(t[r].x,t[r].y);e.closePath(),i&&e.fill(),e.stroke(),e.restore()}function OE(e,t){var i=t||new Path2D,a=e.calculative.worldRect,r=a.x,n=a.y,o=a.width,s=a.ex,h=a.ey,l=o/4,c=r+o/2;if(i.arc(c,n+l,l,0,Math.PI*2),i.moveTo(r,n+l*3),i.lineTo(s,n+l*3),i.moveTo(c,n+l*2),i.lineTo(c,n+l*4),i.moveTo(c,n+l*4),i.lineTo(r,h),i.moveTo(c,n+l*4),i.lineTo(s,h),i.closePath(),i instanceof Path2D)return i}var Fc=globalThis&&globalThis.__assign||function(){return Fc=Object.assign||function(e){for(var t,i=1,a=arguments.length;i<a;i++){t=arguments[i];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},Fc.apply(this,arguments)};function NE(e,t,i){if(t.calculative.worldAnchors||(t.calculative.worldAnchors=[]),i)t.calculative.activeAnchor&&(t.calculative.activeAnchor.next={penId:t.id,x:i.x,y:i.y},ws(t.calculative.activeAnchor.next,t.calculative.activeAnchor)<5?t.calculative.activeAnchor.next=void 0:(t.calculative.activeAnchor.prev=Fc({},t.calculative.activeAnchor.next),Ge(t.calculative.activeAnchor.prev,180,t.calculative.activeAnchor)));else{var a=t.calculative.worldAnchors[0];if(!a.next){var r=ja(a,e.pens[a.connectTo]);bd(a,r,50),a.prev=void 0}var n=t.calculative.worldAnchors[t.calculative.worldAnchors.length-1];if(n&&n!==a&&!n.prev){var o=ja(n,e.pens[n.connectTo]);bd(n,o,-50),n.next=void 0}}}function bd(e,t,i){switch(t){case Pe.Up:e.prev={penId:e.penId,x:e.x,y:e.y+i},e.next={penId:e.penId,x:e.x,y:e.y-i};break;case Pe.Right:e.prev={penId:e.penId,x:e.x-i,y:e.y},e.next={penId:e.penId,x:e.x+i,y:e.y};break;case Pe.Bottom:e.prev={penId:e.penId,x:e.x,y:e.y-i},e.next={penId:e.penId,x:e.x,y:e.y+i};break;case Pe.Left:e.prev={penId:e.penId,x:e.x+i,y:e.y},e.next={penId:e.penId,x:e.x-i,y:e.y};break}}function zc(e,t,i,a){var r=1-e,n=r*r*t.x+2*r*e*i.x+e*e*a.x,o=r*r*t.y+2*r*e*i.y+e*e*a.y;return{x:n,y:o,step:e}}function mg(e,t,i,a,r){var n=t.x,o=t.y,s=r.x,h=r.y,l=i.x,c=i.y,f=a.x,v=a.y,g=1-e,y=n*g*g*g+3*l*e*g*g+3*f*e*e*g+s*e*e*e,p=o*g*g*g+3*c*e*g*g+3*v*e*e*g+h*e*e*e;return{x:y,y:p,step:e}}function wr(e,t,i){return{x:e.x+i*(t.x-e.x),y:e.y+i*(t.y-e.y)}}function FE(e,t,i){var a=e.calculative.worldAnchors[i],r=e.calculative.worldAnchors[i+1];!r&&e.close&&(r=e.calculative.worldAnchors[0]);var n=t.step,o;if(a.next&&r.prev){var s=a,h=a.next,l=r.prev,c=r,f=wr(s,h,n),v=wr(h,l,n),g=wr(l,c,n),y=wr(f,v,n),p=wr(v,g,n);o=wr(y,p,n),y.penId=e.id,o.prev=y,p.penId=e.id,o.next=p,a.next.x=f.x,a.next.y=f.y,r.prev.x=g.x,r.prev.y=g.y}else if(a.next||r.prev){var s=a,h=a.next||r.prev,l=r,c=wr(s,h,n),f=wr(h,l,n);o=t,c.penId=e.id,f.penId=e.id,o.prev=c,o.next=f,a.next=void 0,r.prev=void 0}else o=t;return o.penId=e.id,o.id=Me(),o.prevNextType=Zr.Bilateral,o}function zE(e,t,i){if(t.calculative.worldAnchors||(t.calculative.worldAnchors=[]),!(t.calculative.worldAnchors.length<2)){var a=t.calculative.activeAnchor,r=i||We(t);if(!(!a||!r)){var n=20,o=e.pens[a.connectTo],s=ja(a,o);switch(s===Pe.None&&(r.x>a.x?s=Pe.Right:s=Pe.Left),a.next={id:Me(),penId:t.id,x:a.x,y:a.y,prevNextType:2},r.prev={id:Me(),penId:t.id,x:r.x,y:r.y,prevNextType:2},s){case Pe.Up:a.next.y-=n,r.prev.y=a.y;break;case Pe.Bottom:a.next.y+=n,r.prev.y=a.y;break;case Pe.Left:a.next.x-=n,r.prev.x=a.x;break;default:a.next.x+=n,r.prev.x=a.x;break}}}}var _d=globalThis&&globalThis.__read||function(e,t){var i=typeof Symbol=="function"&&e[Symbol.iterator];if(!i)return e;var a=i.call(e),r,n=[],o;try{for(;(t===void 0||t-- >0)&&!(r=a.next()).done;)n.push(r.value)}catch(s){o={error:s}}finally{try{r&&!r.done&&(i=a.return)&&i.call(a)}finally{if(o)throw o.error}}return n},xd=globalThis&&globalThis.__spreadArray||function(e,t,i){if(i||arguments.length===2)for(var a=0,r=t.length,n;a<r;a++)(n||!(a in t))&&(n||(n=Array.prototype.slice.call(t,0,a)),n[a]=t[a]);return e.concat(n||Array.prototype.slice.call(t))},pg=globalThis&&globalThis.__values||function(e){var t=typeof Symbol=="function"&&Symbol.iterator,i=t&&e[t],a=0;if(i)return i.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};function HE(e,t){var i=t||new Path2D;if((e.lineName==="line"||e.lineName==="polyline")&&e.calculative.lineSmooth){var a=au(e);if(i.addPath(a),i instanceof Path2D)return i}var r=e.calculative.worldAnchors;if(r.length>1){var n;r.forEach(function(o){n?Ed(i,n,o):o.start=!0,n=o}),e.close&&Ed(i,n,r[0])}if(i instanceof Path2D)return i}function UE(e,t,i){var a;if(t.calculative.worldAnchors||(t.calculative.worldAnchors=[]),!(t.calculative.worldAnchors.length<2||((a=t.anchors)===null||a===void 0?void 0:a.length)>1)){var r=lt(t),n=We(t);!r||!n||!n.id||r===n||(r.next=void 0,ou(t),n.prev=void 0,t.calculative.worldAnchors.push(n))}}function Ed(e,t,i){!i||i.isTemp||(t.start&&e.moveTo(t.x,t.y),t.next?i.prev?e.bezierCurveTo(t.next.x,t.next.y,i.prev.x,i.prev.y,i.x,i.y):e.quadraticCurveTo(t.next.x,t.next.y,i.x,i.y):i.prev?e.quadraticCurveTo(i.prev.x,i.prev.y,i.x,i.y):e.lineTo(i.x,i.y))}function Hc(e){return Uc(e),Fn(wg(e))}function wg(e){var t=[],i;return e.calculative.worldAnchors.forEach(function(a){t.push(a),i&&t.push.apply(t,xd([],_d(kd(i,a,e)),!1)),i=a}),e.close&&e.calculative.worldAnchors.length>1&&t.push.apply(t,xd([],_d(kd(i,e.calculative.worldAnchors[0],e)),!1)),t}function vs(e){return e!=null&&e.lineWidth?e.lineWidth/2+4:4}function kd(e,t,i){var a=[];if(!t)return a;var r=.02;if(e.lineLength){var n=vs(i);r=n/e.lineLength}if(e.next)if(t.prev)for(var o=r;o<1;o+=r)a.push(mg(o,e,e.next,t.prev,t));else for(var o=r;o<1;o+=r)a.push(zc(o,e,e.next,t));else if(t.prev)for(var o=r;o<1;o+=r)a.push(zc(o,e,t.prev,t));else a.push({x:t.x,y:t.y});return a.length>1&&(e.curvePoints=a),a}function WE(e,t){var i,a,r=vs(t),n=0,o,s;try{for(var h=pg(t.calculative.worldAnchors),l=h.next();!l.done;l=h.next()){var c=l.value;if(o){if(s=Cd(e,o,c,r),s)return{i:n,point:s};++n}o=c}}catch(f){i={error:f}}finally{try{l&&!l.done&&(a=h.return)&&a.call(h)}finally{if(i)throw i.error}}if(t.close&&t.calculative.worldAnchors.length>1&&(s=Cd(e,o,t.calculative.worldAnchors[0],r)))return{i:n,point:s}}function Cd(e,t,i,a){var r,n;if(a===void 0&&(a=4),!t.next&&!i.prev){var o=t.x,s=t.y,h=i.x,l=i.y,c=Math.min(o,h),f=Math.max(o,h),v=Math.min(s,l),g=Math.max(s,l);return e.x>=c-a&&e.x<=f+a&&e.y>=v-a&&e.y<=g+a?qE(e,t,i,a):void 0}else if(t.curvePoints)try{for(var y=pg(t.curvePoints),p=y.next();!p.done;p=y.next()){var m=p.value;if(Ia(e,m,a))return m}}catch(b){r={error:b}}finally{try{p&&!p.done&&(n=y.return)&&n.call(y)}finally{if(r)throw r.error}}}function qE(e,t,i,a){if(a===void 0&&(a=4),t.x===i.x){var r=Math.abs(e.x-t.x);if(r<=a)return{x:t.x,y:e.y}}else{var n=(t.y-i.y)/(t.x-i.x),o=t.y-n*t.x,r=Math.abs((n*e.x+o-e.y)/Math.sqrt(n*n+1));if(r<=a){var s=e.x+n*e.y,h=(s-n*o)/(n*n+1);return{x:h,y:n*h+o}}}}function Ad(e,t,i,a){if(!t&&!i)return Math.sqrt(Math.pow(Math.abs(e.x-a.x),2)+Math.pow(Math.abs(e.y-a.y),2))||0;var r=document.createElementNS("http://www.w3.org/2000/svg","path");return t&&i?r.setAttribute("d","M"+e.x+" "+e.y+" C"+t.x+" "+t.y+" "+i.x+" "+i.y+" "+a.x+" "+a.y):t?r.setAttribute("d","M"+e.x+" "+e.y+" Q"+t.x+" "+t.y+" "+a.x+" "+a.y):r.setAttribute("d","M"+e.x+" "+e.y+" Q"+i.x+" "+i.y+" "+a.x+" "+a.y),r.getTotalLength()||0}function Uc(e){if(e.calculative.worldAnchors.length<2)return 0;var t=0,i;if(e.calculative.worldAnchors.forEach(function(r){i&&(i.lineLength=Ad(i,i.next,r.prev,r),t+=i.lineLength),i=r}),e.close){var a=lt(e);i.lineLength=Ad(i,i.next,a.prev,a),t+=i.lineLength}return e.calculative.animatePos&&(e.calculative.animatePos=t/e.length*e.calculative.animatePos),e.length=t,t}function jE(e,t){for(var i=e.calculative.worldAnchors,a=0;a<i.length-1;a++){var r=i[a],n=i[a+1];if(!r.next&&!n.prev){if(bg(r,n,t))return!0}else if(KE(r,n,t))return!0}return!1}function bg(e,t,i){if(ea(e,i)||ea(t,i))return!0;var a=e.x,r=e.y,n=t.x,o=t.y,s=i.x,h=i.y,l=i.ex,c=i.ey,f=r-o,v=n-a,g=a*o-n*r;if(f*s+v*h+g>=0&&f*l+v*c+g<=0||f*s+v*h+g<=0&&f*l+v*c+g>=0||f*s+v*c+g>=0&&f*l+v*h+g<=0||f*s+v*c+g<=0&&f*l+v*h+g>=0){if(s>l){var y=s;s=l,l=y}if(h<c){var p=h;h=c,c=p}return!(a<s&&n<s||a>l&&n>l||r>h&&o>h||r<c&&o<c)}else return!1}function KE(e,t,i){var a=.02;if(!e.next&&!t.prev)return bg(e,t,i);if(e.next&&t.prev)for(var r=a;r<1;r+=a){var n=mg(r,e,e.next,t.prev,t);if(ea(n,i))return!0}else if(e.next||t.prev)for(var r=a;r<1;r+=a){var n=zc(r,e,e.next||t.prev,t);if(ea(n,i))return!0}return!1}var fn=globalThis&&globalThis.__read||function(e,t){var i=typeof Symbol=="function"&&e[Symbol.iterator];if(!i)return e;var a=i.call(e),r,n=[],o;try{for(;(t===void 0||t-- >0)&&!(r=a.next()).done;)n.push(r.value)}catch(s){o={error:s}}finally{try{r&&!r.done&&(i=a.return)&&i.call(a)}finally{if(o)throw o.error}}return n},dn=globalThis&&globalThis.__spreadArray||function(e,t,i){if(i||arguments.length===2)for(var a=0,r=t.length,n;a<r;a++)(n||!(a in t))&&(n||(n=Array.prototype.slice.call(t,0,a)),n[a]=t[a]);return e.concat(n||Array.prototype.slice.call(t))},Vt=10;function VE(e,t,i){var a;if(t.calculative.worldAnchors||(t.calculative.worldAnchors=[]),Vt=e.options.polylineSpace||10,!(t.calculative.worldAnchors.length<2)){var r=lt(t),n=We(t);if(!(!r||!n)){var o;if(((a=t.anchors)===null||a===void 0?void 0:a.length)&&r===t.calculative.activeAnchor?(o=!0,r=n,n=lt(t)):(!t.anchors||!t.anchors.length)&&r!==t.calculative.activeAnchor&&(r=t.calculative.activeAnchor),!(!r||!n)){r.next=void 0,n.prev=void 0;var s=n.connectTo;ou(t);var h=[],l=e.pens[r.connectTo],c=e.pens[n.connectTo],f=ja(r,l),v=ja(n,c),g=Sd(r,f,Vt);g&&(r=g,h.push(g)),g=Sd(n,v,Vt);var y=n,p=void 0;if(g&&(n=g,y.connectTo&&(g.y>y.y&&r.y<y.y||g.y<y.y&&r.y>y.y))){p=g;var m=Vt;r.x<g.x&&(m=-m),Math.abs(r.x-g.x)<m&&(m=-m);var b={x:g.x+m,y:g.y,id:Me()};n=b}switch(f){case Pe.Up:h.push.apply(h,dn([],fn($E(r,n,v)),!1));break;case Pe.Right:h.push.apply(h,dn([],fn(YE(r,n,v)),!1));break;case Pe.Bottom:h.push.apply(h,dn([],fn(GE(r,n,v)),!1));break;case Pe.Left:h.push.apply(h,dn([],fn(XE(r,n,v)),!1));break;default:h.push.apply(h,dn([],fn(ZE(t,r,n)),!1));break}if(h.forEach(function(_){_.id=Me(),_.penId=t.id,t.calculative.worldAnchors.push(_)}),t.calculative.worldAnchors.push(n),p&&t.calculative.worldAnchors.push(p),g&&t.calculative.worldAnchors.push(y),o&&t.calculative.worldAnchors.reverse(),s){var x=t.calculative.worldAnchors.length-2;t.calculative.worldAnchors[x].isTemp=!1,t.calculative.worldAnchors[1].isTemp=!1}}}}}function Sd(e,t,i){var a={x:e.x,y:e.y,id:Me()};switch(t){case Pe.Up:a.y-=i;break;case Pe.Right:a.x+=i;break;case Pe.Bottom:a.y+=i;break;case Pe.Left:a.x-=i;break;default:return}return a}function $E(e,t,i){if(e.x===t.x||e.y===t.y)return[];var a=[],r,n;switch(i){case Pe.Up:e.y<t.y?(r=t.x,n=e.y):(r=e.x,n=t.y),a.push({x:r,y:n});break;case Pe.Bottom:if(r=t.x,n=e.y,t.y>e.y)r=e.x+(t.x-e.x)/2,a.push({x:r,y:e.y},{x:r,y:t.y});else{var o=(e.y+t.y)/2;a.push({x:e.x,y:o},{x:t.x,y:o})}break;case Pe.Right:r=t.x,n=e.y,t.x<e.x&&t.y<e.y&&(r=e.x,n=t.y),a.push({x:r,y:n});break;case Pe.Left:r=t.x,n=e.y,t.x>e.x&&t.y<e.y&&(r=e.x,n=t.y),a.push({x:r,y:n});break;default:if(t.y>e.y-Vt)r=e.x+(t.x-e.x)/2,a.push({x:r,y:e.y},{x:r,y:t.y});else{var o=(e.y+t.y+Vt)/2;a.push({x:e.x,y:o},{x:t.x,y:o})}break}return a}function YE(e,t,i){if(e.x===t.x||e.y===t.y)return[];var a=[],r,n;switch(i){case Pe.Up:r=e.x,n=t.y,t.x>e.x&&t.y>e.y&&(r=t.x,n=e.y),a.push({x:r,y:n});break;case Pe.Bottom:r=e.x,n=t.y,t.x>e.x&&t.y<e.y&&(r=t.x,n=e.y),a.push({x:r,y:n});break;case Pe.Left:if(r=t.x,n=e.y,t.x<e.x)n=e.y+(t.y-e.y)/2,a.push({x:e.x,y:n},{x:t.x,y:n});else{var o=(e.x+t.x)/2;a.push({x:o,y:n},{x:o,y:t.y})}break;case Pe.Right:t.x<e.x?a.push({x:e.x,y:t.y}):a.push({x:t.x,y:e.y});break;default:if(r=t.x,n=t.y,t.x<e.x+Vt)a.push({x:e.x,y:n});else{var o=(e.x+t.x-Vt)/2;a.push({x:o,y:e.y},{x:o,y:n})}break}return a}function GE(e,t,i){if(e.x===t.x||e.y===t.y)return[];var a=[],r,n;switch(i){case Pe.Up:if(r=e.x,n=t.y,t.y<e.y)r=e.x+(t.x-e.x)/2,a.push({x:r,y:e.y},{x:r,y:t.y});else{var o=(e.y+t.y)/2;a.push({x:r,y:o},{x:t.x,y:o})}break;case Pe.Right:r=t.x,n=e.y,t.x<e.x&&t.y>e.y&&(r=e.x,n=t.y),a.push({x:r,y:n});break;case Pe.Bottom:e.y>t.y?(r=t.x,n=e.y):(r=e.x,n=t.y),a.push({x:r,y:n});break;case Pe.Left:r=t.x,n=e.y,t.x>e.x&&t.y>e.y&&(r=e.x,n=t.y),a.push({x:r,y:n});break;default:if(r=e.x,t.y<e.y+Vt)r=e.x+(t.x-e.x)/2,a.push({x:r,y:e.y},{x:r,y:t.y});else{var o=(e.y+t.y-Vt)/2;a.push({x:r,y:o},{x:t.x,y:o})}break}return a}function XE(e,t,i){if(e.x===t.x||e.y===t.y)return[];var a=[],r,n;switch(i){case Pe.Up:r=e.x,n=t.y,t.x<e.x&&t.y>e.y&&(r=t.x,n=e.y),a.push({x:r,y:n});break;case Pe.Bottom:r=e.x,n=t.y,t.x<e.x&&t.y<e.y&&(r=t.x,n=e.y),a.push({x:r,y:n});break;case Pe.Right:if(r=e.x,n=t.y,t.x>e.x)r=t.x,n=e.y+(t.y-e.y)/2,a.push({x:e.x,y:n},{x:t.x,y:n});else{var o=(e.x+t.x)/2;a.push({x:o,y:e.y},{x:o,y:t.y})}break;case Pe.Left:t.x>e.x?a.push({x:e.x,y:t.y}):a.push({x:t.x,y:e.y});break;default:if(r=e.x,n=t.y,t.x<e.x-Vt){var o=(e.x+t.x+Vt)/2;a.push({x:o,y:e.y},{x:o,y:n})}else a.push({x:e.x,y:n});break}return a}function ZE(e,t,i){var a=[];e.calculative.drawlineH==null&&(e.calculative.drawlineH=Math.abs(i.x-t.x)>Math.abs(i.y-t.y));var r=e.calculative.worldAnchors.findIndex(function(o){return o.id==t.id});if(r>1){var n=e.calculative.worldAnchors[r-1];if(n.x===t.x&&n.y!==t.y)return a.push({x:i.x,y:t.y}),a;if(n.y===t.y&&n.x!==t.x)return a.push({x:t.x,y:i.y}),a}return e.calculative.worldAnchors.length&&(i.isTemp=void 0,e.calculative.drawlineH?(a.push({x:i.x,y:t.y}),Math.abs(i.y-t.y)<Vt&&(i.isTemp=!0)):(a.push({x:t.x,y:i.y}),Math.abs(i.x-t.x)<Vt&&(i.isTemp=!0))),a}function No(e,t,i){var a,r;i===void 0&&(i=!0);var n=e.calculative.worldAnchors;i||(n=[],e.calculative.worldAnchors.forEach(function(s){n.unshift(s)}));for(var o=0;o<n.length&&n[o].id!==t.id;o++)if(n[o].y!==t.y||n[o].x===((a=n[o+1])===null||a===void 0?void 0:a.x)&&n[o].y!==((r=n[o+1])===null||r===void 0?void 0:r.y))return!1;return!0}function Fo(e,t,i){var a,r;i===void 0&&(i=!0);var n=e.calculative.worldAnchors;i||(n=[],e.calculative.worldAnchors.forEach(function(s){n.unshift(s)}));for(var o=0;o<n.length&&n[o].id!==t.id;o++)if(n[o].x!==t.x||n[o].y===((a=n[o+1])===null||a===void 0?void 0:a.y)&&n[o].x!==((r=n[o+1])===null||r===void 0?void 0:r.x))return!1;return!0}function QE(e,t,i){if(!!e.calculative.worldAnchors){var a=e.calculative.worldAnchors.findIndex(function(f){return f.id===t.id}),r=lt(e),n=We(e),o=e.calculative.worldAnchors[a-1],s=e.calculative.worldAnchors[a+1];if(e.calculative.h==null&&(r.connectTo&&(No(e,t,!0)?e.calculative.h=!0:Fo(e,t,!0)&&(e.calculative.h=!1)),e.calculative.h==null&&n.connectTo&&(No(e,t,!1)?e.calculative.h=!0:Fo(e,t,!1)&&(e.calculative.h=!1)),e.calculative.h==null&&(o?e.calculative.h=o.y===t.y:s&&(e.calculative.h=s.y===t.y))),e.calculative.h){if(t.x=i.x,r.connectTo&&No(e,t,!0)){s&&s.y!==t.y&&(s.x=t.x);return}if(n.connectTo&&No(e,t,!1)){o&&o.y!==t.y&&(o.x=t.x);return}for(var h=e.anchors[a],l=void 0,c=a-1;c>-1;c--)if(o=e.anchors[c],l==null&&(l=o.y===h.y),l===!0)if(o.y===h.y)e.calculative.worldAnchors[c].y=i.y;else break;else if(o.x===h.x)e.calculative.worldAnchors[c].x=i.x;else break;l=void 0;for(var c=a+1;c<e.calculative.worldAnchors.length&&(s=e.anchors[c],s);c++)if(l==null&&(l=s.y===h.y),l===!0)if(s.y===h.y)e.calculative.worldAnchors[c].y=i.y;else break;else if(s.x===h.x)e.calculative.worldAnchors[c].x=i.x;else break;t.y=i.y}else{if(t.y=i.y,r.connectTo&&Fo(e,t,!0)){s&&s.x!==t.x&&(s.y=t.y);return}if(n.connectTo&&Fo(e,t,!1)){o&&o.x!==t.x&&(o.y=t.y);return}for(var h=e.anchors[a],l=void 0,c=a-1;c>-1;c--)if(o=e.anchors[c],l==null&&(l=o.x===h.x),l===!0)if(o.x===h.x)e.calculative.worldAnchors[c].x=i.x;else break;else if(o.y===h.y)e.calculative.worldAnchors[c].y=i.y;else break;l=void 0;for(var c=a+1;c<e.calculative.worldAnchors.length&&(s=e.anchors[c],s);c++)if(l==null&&(l=s.x===h.x),l===!0)if(s.x===h.x)e.calculative.worldAnchors[c].x=i.x;else break;else if(s.y===h.y)e.calculative.worldAnchors[c].y=i.y;else break;t.x=i.x}}}var Vr=globalThis&&globalThis.__assign||function(){return Vr=Object.assign||function(e){for(var t,i=1,a=arguments.length;i<a;i++){t=arguments[i];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},Vr.apply(this,arguments)},Td=globalThis&&globalThis.__read||function(e,t){var i=typeof Symbol=="function"&&e[Symbol.iterator];if(!i)return e;var a=i.call(e),r,n=[],o;try{for(;(t===void 0||t-- >0)&&!(r=a.next()).done;)n.push(r.value)}catch(s){o={error:s}}finally{try{r&&!r.done&&(i=a.return)&&i.call(a)}finally{if(o)throw o.error}}return n},Rd=globalThis&&globalThis.__spreadArray||function(e,t,i){if(i||arguments.length===2)for(var a=0,r=t.length,n;a<r;a++)(n||!(a in t))&&(n||(n=Array.prototype.slice.call(t,0,a)),n[a]=t[a]);return e.concat(n||Array.prototype.slice.call(t))};function Wc(e,t,i,a){var r=[],n,o,s,h,l,c,f,v,g,y,p,m,b,x;g=e[i],y=e[a],s=g.x,h=g.y,f=y.x-s,v=y.y-h,x=f*f+v*v,n=t;for(var _=i+1;_<a;_++)p=e[_],f!==0||v!==0?(m=((p.x-s)*f+(p.y-h)*v)/x,m>1?(l=p.x-y.x,c=p.y-y.y):m>0?(l=p.x-(s+f*m),c=p.y-(h+v*m)):(l=p.x-s,c=p.y-h)):(l=p.x-s,c=p.y-h),b=l*l+c*c,b>n&&(o=_,n=b);return n>t&&(o-i>1&&r.push.apply(r,Rd([],Td(Wc(e,t,i,o)),!1)),r.push({id:e[o].id,penId:e[o].penId,x:e[o].x,y:e[o].y}),a-o>1&&r.push.apply(r,Rd([],Td(Wc(e,t,o,a)),!1))),r}function JE(e,t,i){if(t===void 0&&(t=.8),i===void 0&&(i=!1),e.length<3)return e;var a,r,n,o,s,h,l,c,f,v,g,y,p,m,b,x=function(I,P,M,L){return o=Math.sqrt(I*I+P*P),o>0?(y=I/o,m=P/o):(y=1,m=0),s=Math.sqrt(M*M+L*L),s>0?(p=M/s,b=L/s):(p=1,b=0),Math.acos(y*p+m*b)};v=[],g=e.length,a=e[0],e[g-1],v.push(Vr({},e[0]));for(var _=0;_<g-1;_++){if(r=e[_],n=e[_+1],f=Math.abs(x(r.x-a.x,r.y-a.y,n.x-r.x,n.y-r.y)),o)if(f<t*3.14)if(i&&(o=Math.min(o,s),s=o),h=(y+p)/2,l=(m+b)/2,c=Math.sqrt(h*h+l*l),c===0)v.push(Vr({},r));else{h/=c,l/=c;var k=Vr({},r);k.prevNextType=Zr.Bilateral,k.prev={penId:k.penId,x:r.x-h*o*.25,y:r.y-l*o*.25},k.next={penId:k.penId,x:r.x+h*s*.25,y:r.y+l*s*.25},v.push(k)}else v.push(Vr({},r));a=r}return v.push(Vr({},e[e.length-1])),v}function _g(e,t){var i=t||new Path2D,a=e.calculative.worldAnchors,r=e.calculative.canvas.store.data.scale,n=(e.calculative.animateLineWidth||6)*r,o=(e.animateLineWidth*2||12)*r;e.lineAnimateType===ai.WaterDrop&&(o=(e.animateLineWidth*4||24)*r);var s=(e.animateInterval||100)*r,h=e.calculative.lineWidth*(e.calculative.lineSmooth||0),l=(e.calculative.animateLineWidth/2||3)*r;if(e.animateReverse&&(o=-o,n=-n),a.length>1)for(var c=void 0,f=0,v=0;v<a.length;v++){var g=a[v];if(c){var y=ek(c,g),p={x:c.x+(e.calculative.animatePos-f)%s*Math.cos(y*Math.PI/180),y:c.y-(e.calculative.animatePos-f)%s*Math.sin(y*Math.PI/180)};e.animateReverse&&(p={x:c.x+(e.length-(e.calculative.animatePos+f))%s*Math.cos(y*Math.PI/180),y:c.y-(e.length-(e.calculative.animatePos+f))%s*Math.sin(y*Math.PI/180)});for(var m=Math.sqrt(Math.pow(p.x-c.x,2)+Math.pow(p.y-c.y,2)),b=Math.sqrt(Math.pow(g.x-c.x,2)+Math.pow(g.y-c.y,2));m<b;)(e.animateReverse&&m-o<b||!e.animateReverse&&m>o)&&m>h+o&&b-m>h&&(e.lineAnimateType===ai.Arrow?tk(i,p,n,y,l,o):e.lineAnimateType===ai.WaterDrop&&ik(i,p,e.animateReverse,y,l,o)),p.x+=s*Math.cos(y*Math.PI/180),p.y-=s*Math.sin(y*Math.PI/180),m=Math.sqrt(Math.pow(p.x-c.x,2)+Math.pow(p.y-c.y,2))}c=g}if(i instanceof Path2D)return i}function ek(e,t){var i=t.x-e.x,a=t.y-e.y,r=Math.atan(a/i)*180/Math.PI;return t.x>=e.x?r=-r:r=180-r,r}function kr(e,t,i){var a=(180-i)*Math.PI/180;return{x:(e.x-t.x)*Math.cos(a)-(e.y-t.y)*Math.sin(a)+t.x,y:(e.x-t.x)*Math.sin(a)+(e.y-t.y)*Math.cos(a)+t.y}}function tk(e,t,i,a,r,n){var o=kr({x:t.x+i,y:t.y+.57*i},{x:t.x,y:t.y},a),s=kr({x:t.x+i,y:t.y-.57*i},{x:t.x,y:t.y},a),h=kr({x:t.x+i,y:t.y+r/2},{x:t.x,y:t.y},a),l=kr({x:t.x+n,y:t.y+r/2},{x:t.x,y:t.y},a),c=kr({x:t.x+i,y:t.y-r/2},{x:t.x,y:t.y},a),f=kr({x:t.x+n,y:t.y-r/2},{x:t.x,y:t.y},a);e.moveTo(o.x,o.y),e.lineTo(t.x,t.y),e.lineTo(s.x,s.y),e.lineTo(c.x,c.y),e.lineTo(f.x,f.y),e.lineTo(l.x,l.y),e.lineTo(h.x,h.y),e.lineTo(o.x,o.y)}function ik(e,t,i,a,r,n){var o=r/2;i&&(o=-r/2);var s=kr({x:t.x,y:t.y+o},{x:t.x,y:t.y},a),h=kr({x:t.x+n,y:t.y},{x:t.x,y:t.y},a),l=Math.PI/2;i&&(l=-Math.PI/2),e.moveTo(t.x,t.y),e.arc(t.x,t.y,r/2,-l-a/180*Math.PI,l-a/180*Math.PI,!1),e.lineTo(h.x,h.y),e.lineTo(s.x,s.y)}globalThis&&globalThis.__awaiter;globalThis&&globalThis.__generator;function rk(e){var t;e.onDestroy||(e.onDestroy=ak,e.onMove=zo,e.onResize=zo,e.onRotate=zo,e.onValue=zo,e.onMouseMove=ok,e.onBeforeValue=nk,e.onRenderPenRaw=lk),e.calculative.singleton||(e.calculative.singleton={});var i=e.calculative.worldRect;if(!e.calculative.singleton.div){var a=document.createElement("div");a.style.position="absolute",a.style.outline="none",a.style.left="-9999px",a.style.top="-9999px",a.style.width=i.width+"px",a.style.height=i.height+"px",document.body.appendChild(a),(t=e.calculative.canvas.externalElements)===null||t===void 0||t.parentElement.appendChild(a),Ai(e,a),e.calculative.singleton.div=a;var r=document.createElement("iframe");r.style.width="100%",r.style.height="100%",r.scrolling=e.scrolling||"no",r.frameBorder="0",r.src=e.iframe,e.calculative.iframe=e.iframe,a.appendChild(r),Eg(e),r.onload=function(){r.setAttribute("document.domain","")}}return e.calculative.patchFlags&&Ai(e,e.calculative.singleton.div),e.onRenderPenRaw(e),new Path2D}function ak(e){e.calculative.singleton&&e.calculative.singleton.div&&(e.calculative.singleton.div.remove(),delete e.calculative.singleton.div)}function zo(e){e.calculative.singleton.div&&Ai(e,e.calculative.singleton.div)}function nk(e,t){if(t.iframe&&e.calculative.singleton.div&&(e.calculative.singleton.div.children[0].src=t.iframe,e.calculative.iframe=t.iframe),t.operationalRect||t["operationalRect.x"]!==void 0||t["operationalRect.y"]!==void 0||t["operationalRect.width"]!==void 0||t["operationalRect.height"]!==void 0){e.operationalRect||(e.operationalRect={});var i=ce(t);if(i.operationalRect||(i.operationalRect={}),i["operationalRect.x"]!==void 0&&(i.operationalRect.x=i["operationalRect.x"]),i["operationalRect.y"]!==void 0&&(i.operationalRect.y=i["operationalRect.y"]),i["operationalRect.width"]!==void 0&&(i.operationalRect.width=i["operationalRect.width"]),i["operationalRect.height"]!==void 0&&(i.operationalRect.height=i["operationalRect.height"]),Object.assign(e.operationalRect,i.operationalRect),e.calculative.singleton.div){var a=e.calculative.singleton.div.children.length;a===1?Eg(e):(e.calculative.singleton.div.children[1].style.height=e.operationalRect.y*100+"%",e.calculative.singleton.div.children[1].style.left=e.operationalRect.x*100+"%",e.calculative.singleton.div.children[1].style.width=e.operationalRect.width*100+"%",e.calculative.singleton.div.children[2].style.width=(1-e.operationalRect.x-e.operationalRect.width)*100+"%",e.calculative.singleton.div.children[3].style.height=(1-e.operationalRect.y-e.operationalRect.height)*100+"%",e.calculative.singleton.div.children[3].style.left=e.operationalRect.x*100+"%",e.calculative.singleton.div.children[3].style.width=e.operationalRect.width*100+"%",e.calculative.singleton.div.children[4].style.width=e.operationalRect.x*100+"%")}}if(t.blur!==void 0)for(var r=1;r<5;r++)e.calculative.singleton.div.children[r].style["backdrop-filter"]="blur("+(t.blur||2)+"px)";if(t.blurBackground!==void 0)for(var r=1;r<5;r++)e.calculative.singleton.div.children[r].style.backgroundColor=t.blurBackground;return t}function ok(e,t){if(!(!e.calculative.canvas.store.data.locked&&!e.locked)&&xg(e.operationalRect)&&e.calculative.zIndex<5&&t.x>e.x+e.width*e.operationalRect.x&&t.x<e.x+e.width*(e.operationalRect.x+e.operationalRect.width)&&t.y>e.y+e.height*e.operationalRect.y&&t.y<e.y+e.height*(e.operationalRect.y+e.operationalRect.height)&&e.calculative.singleton.div)for(var i=e.calculative.singleton.div.parentNode.children,a=0;a<6;a++)i[a].style.pointerEvents="none"}function xg(e){return e?!e.width||!e.height?!1:(e.x===void 0&&(e.x=(1-e.width)/2),e.y===void 0&&(e.y=(1-e.height)/2),!0):!1}function Eg(e){if(!!xg(e.operationalRect)){var t=e.calculative.singleton.div;if(!!t){var i=document.createElement("div");i.style.position="absolute",i.style.left=e.operationalRect.x*100+"%",i.style.top="0px",i.style.width=e.operationalRect.width*100+"%",i.style.height=e.operationalRect.y*100+"%",i.style["backdrop-filter"]="blur("+(e.blur||2)+"px)",i.style.backgroundColor=e.blurBackground,t.appendChild(i);var a=document.createElement("div");a.style.position="absolute",a.style.right="0px",a.style.top="0px",a.style.width=(1-e.operationalRect.x-e.operationalRect.width)*100+"%",a.style.height="100%",a.style["backdrop-filter"]="blur("+(e.blur||2)+"px)",a.style.backgroundColor=e.blurBackground,t.appendChild(a);var r=document.createElement("div");r.style.position="absolute",r.style.left=e.operationalRect.x*100+"%",r.style.bottom="0px",r.style.width=e.operationalRect.width*100+"%",r.style.height=(1-e.operationalRect.y-e.operationalRect.height)*100+"%",r.style["backdrop-filter"]="blur("+(e.blur||2)+"px)",r.style.backgroundColor=e.blurBackground,t.appendChild(r);var n=document.createElement("div");n.style.position="absolute",n.style.left="0px",n.style.top="0px",n.style.width=e.operationalRect.x*100+"%",n.style.height="100%",n.style["backdrop-filter"]="blur("+(e.blur||2)+"px)",n.style.backgroundColor=e.blurBackground,t.appendChild(n);var o=function(){sk(e)};i.onmouseenter=o,r.onmouseenter=o,a.onmouseenter=o,n.onmouseenter=o,t.onmouseleave=o}}}function sk(e){if(!(!e.calculative.canvas.store.data.locked&&!e.locked)&&e.calculative.zIndex<5)for(var t=e.calculative.singleton.div.parentNode.children,i=1;i<6;i++)t[i].style.pointerEvents="initial"}function lk(e){if(e.thumbImg&&!e.calculative.img){var t=new Image;t.crossOrigin=e.crossOrigin==="undefined"?void 0:e.crossOrigin||"anonymous",e.calculative.canvas.store.options.cdn&&!(e.thumbImg.startsWith("http")||e.thumbImg.startsWith("//")||e.thumbImg.startsWith("data:image"))?t.src=e.calculative.canvas.store.options.cdn+e.thumbImg:t.src=e.thumbImg,t.onerror=function(i){t.remove(),e.calculative.img=void 0},e.calculative.img=t}}var $t={},Zo=['<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="M473.088 125.44L256 256H52.224C23.552 256 0 279.552 0 308.224V716.8c0 28.16 23.04 51.2 51.2 51.2h204.8l217.088 130.56c16.896 10.24 38.912-2.048 38.912-22.016V147.456c0-19.968-21.504-32.256-38.912-22.016zM699.904 320.512c-20.992-18.944-53.248-17.408-72.192 3.584-18.944 20.992-17.408 53.248 3.584 72.192 0.512 0.512 58.368 54.784 58.368 121.344 0 37.888-19.456 74.752-58.368 110.08-20.992 18.944-22.528 51.2-3.584 72.192 10.24 11.264 24.064 16.896 37.888 16.896 12.288 0 24.576-4.608 34.304-13.312 61.44-55.296 92.16-117.76 92.16-185.856 0-112.64-88.576-193.536-92.16-197.12z" fill="" p-id="2434"></path><path d="M853.504 166.4c-20.992-18.944-53.248-16.896-72.192 4.096-18.944 20.992-16.896 53.248 4.096 72.192 1.536 1.024 135.68 122.88 135.68 280.576 0 90.624-45.568 177.152-135.68 257.536-20.992 18.944-23.04 51.2-4.096 72.192 10.24 11.264 24.064 16.896 38.4 16.896 12.288 0 24.576-4.096 34.304-12.8 112.64-100.864 169.984-212.992 169.984-333.824-1.024-202.752-163.84-350.208-170.496-356.864z"></path></svg>','<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" ><path d="M256 768H51.2c-28.16 0-51.2-23.04-51.2-51.2V308.224C0 279.552 23.552 256 52.224 256H256v512zM512 147.456v728.576c0 19.968-21.504 32.256-38.912 22.016L256 768V256l217.088-130.56c17.408-10.24 38.912 2.048 38.912 22.016zM623.104 656.896c-19.968-19.968-19.968-52.224 0-72.192l217.088-217.088c19.968-19.968 52.224-19.968 72.192 0 19.968 19.968 19.968 52.224 0 72.192l-217.088 217.088c-19.456 19.968-52.224 19.968-72.192 0z" fill="" p-id="2582"></path><path d="M623.104 367.104c19.968-19.968 52.224-19.968 72.192 0l217.088 217.088c19.968 19.968 19.968 52.224 0 72.192-19.968 19.968-52.224 19.968-72.192 0l-217.088-217.088c-19.968-19.456-19.968-52.224 0-72.192z"></path></svg>'];function ck(e){var t;if(e.onDestroy||(e.onDestroy=uk,e.onMove=ec,e.onResize=ec,e.onRotate=ec,e.onClick=Pd,e.onValue=fk,e.onChangeId=hk),$t[e.id])e.video&&e.calculative.media&&e.video!==e.calculative.video?(console.warn("video \u66F4\u6539, \u6B64\u5904\u662F\u5426\u6267\u884C\uFF1F"),e.calculative.media.src=e.video,e.autoPlay&&(e.calculative.media.muted=!0,e.calculative.media.autoplay=!0),e.calculative.media.loop=e.playLoop,e.calculative.video=e.video):e.audio&&e.calculative.media&&e.audio!==e.calculative.audio&&(e.calculative.media.src=e.audio,e.autoPlay&&(e.calculative.media.muted=!0,e.calculative.media.autoplay=!0),e.calculative.media.loop=e.playLoop,e.calculative.audio=e.audio);else{var i=document.createElement("div"),a=document.createElement("div");a.style.position="absolute",a.style.outline="none",a.style.left="0",a.style.bottom="0",a.style.width="0",a.style.height="2px",a.style.background="#52c41a",a.style.zIndex="1",e.hideProgress&&(a.style.display="none");var r=document.createElement("div");r.innerHTML=Zo[1],r.style.position="absolute",r.style.right="0",r.style.bottom="0",r.style.width="20px",r.style.height="20px",r.style.fill="hsla(0, 0%, 100%, .8)",r.style.zIndex="1",r.style.display="none",i.appendChild(a),i.appendChild(r),r.onclick=function(o){o.stopPropagation(),e.calculative.media.muted?(r.innerHTML=Zo[0],e.calculative.media.muted=!1):(r.innerHTML=Zo[1],e.calculative.media.muted=!0)},e.calculative.singleton||(e.calculative.singleton={}),e.calculative.singleton.muted=r,i.onmouseenter=function(o){r.style.display="block"},i.onmouseleave=function(o){r.style.display="none"},i.onclick=function(o){o.stopPropagation(),Pd(e)};var n;e.video?(n=document.createElement("video"),n.src=e.video):e.audio&&(n=document.createElement("audio"),n.src=e.audio),n.loop=e.playLoop,n.ontimeupdate=function(){kg(a,n,e.calculative.worldRect.width)},n.onended=function(){e.calculative.onended&&e.calculative.onended(e)},e.calculative.media=n,n.style.position="absolute",n.style.outline="none",n.style.left="0",n.style.top="0",n.style.width="100%",n.style.height="100%",i.appendChild(n),$t[e.id]=i,(t=e.calculative.canvas.externalElements)===null||t===void 0||t.parentElement.appendChild(i),Ai(e,i),e.autoPlay&&(n.autoplay=!0,n.muted=!0)}return e.calculative.patchFlags&&Ai(e,$t[e.id]),new Path2D}function uk(e){$t[e.id].onclick=null,$t[e.id].remove(),$t[e.id]=void 0}function ec(e){Ai(e,$t[e.id]);var t=$t[e.id].children[0],i=$t[e.id].children[1];kg(t,i,e.calculative.worldRect.width)}function Pd(e){e.calculative.media&&(e.calculative.media.muted=!1,e.calculative.singleton.muted.innerHTML=Zo[0],e.calculative.media.paused?e.calculative.media.play():e.calculative.media.pause())}function kg(e,t,i){e.style.width=t.currentTime/t.duration*i+"px"}function hk(e,t,i){!$t[t]||($t[i]=$t[t],delete $t[t])}function fk(e){var t=$t[e.id];if(!!t){Ai(e,t);var i=e.calculative.media.getAttribute("src");e.video?i!==e.video&&(e.calculative.media.src=e.video):e.audio&&i!==e.audio&&(e.calculative.media.src=e.audio),e.autoPlay&&(e.calculative.media.muted=!0,e.calculative.media.autoplay=!0),e.calculative.media.loop=e.playLoop}}var vt={};function dk(e){e.onDestroy||(e.onDestroy=vk,e.onMove=Id,e.onResize=gk,e.onRotate=Id,e.onValue=yk,e.onChangeId=mk);var t=new Path2D;if(!!e.image){if(!vt[e.id]){var i=new Image;i.crossOrigin="anonymous",i.src=e.image,e.calculative.canvas.parent.store.options.cdn&&!(e.image.startsWith("http")||e.image.startsWith("//")||e.image.startsWith("data:image"))&&(i.src=e.calculative.canvas.parent.store.options.cdn+e.image),vt[e.id]=i,i.onload=function(){var a;vt[e.id]===i&&(e.calculative.img=i,e.calculative.imgNaturalWidth=i.naturalWidth||e.iconWidth,e.calculative.imgNaturalHeight=i.naturalHeight||e.iconHeight,(a=e.calculative.canvas.externalElements)===null||a===void 0||a.parentElement.appendChild(i),Pn(e,i))}}return e.calculative.patchFlags&&vt[e.id]&&Pn(e,vt[e.id]),t}}function vk(e){vt[e.id]&&(vt[e.id].remove(),vt[e.id]=void 0)}function Id(e){!vt[e.id]||Pn(e,vt[e.id])}function gk(e){!vt[e.id]||Pn(e,vt[e.id])}function yk(e){!vt[e.id]||(Pn(e,vt[e.id]),vt[e.id].getAttribute("src")!==e.image&&(vt[e.id].src=e.image))}function mk(e,t,i){!vt[t]||(vt[i]=vt[t],delete vt[t])}function Pn(e,t){t.style.objectFit=e.imageRatio?"contain":"fill",Ai(e,t)}var pk=globalThis&&globalThis.__read||function(e,t){var i=typeof Symbol=="function"&&e[Symbol.iterator];if(!i)return e;var a=i.call(e),r,n=[],o;try{for(;(t===void 0||t-- >0)&&!(r=a.next()).done;)n.push(r.value)}catch(s){o={error:s}}finally{try{r&&!r.done&&(i=a.return)&&i.call(a)}finally{if(o)throw o.error}}return n},wk=globalThis&&globalThis.__spreadArray||function(e,t,i){if(i||arguments.length===2)for(var a=0,r=t.length,n;a<r;a++)(n||!(a in t))&&(n||(n=Array.prototype.slice.call(t,0,a)),n[a]=t[a]);return e.concat(n||Array.prototype.slice.call(t))};function bk(e,t){return e.onResize||(e.onResize=Cg,e.onValue=_k),Wa(e,t)}function Cg(e){var t,i=e.anchors.filter(function(a){return a.flag!==1});Ag(e),e.anchors=(t=e.anchors).concat.apply(t,wk([],pk(i),!1))}function _k(e){Cg(e),_n(e)}function Ag(e){for(var t=[],i=e.x,a=e.y,r=e.width,n=e.height,o=xk(e),s=5,h=0;h<s;h++)if(h!==2){var l=i+r*(h+1)/(s+1),c=a;l<i+o?c=Uo(i+o,c+o,l,o,-1):l>i+r-o&&(c=Uo(i+r-o,c+o,l,o,-1)),t.push({id:String(t.length),flag:1,penId:e.id,x:(l-i)/r,y:(c-a)/n})}for(var f=3,h=0;h<f;h++){var c=a+n*(h+1)/(f+1),l=i+r;c<a+o?l=Ho(l-o,a+o,c,o):c>a+n-o&&(l=Ho(l-o,a+n-o,c,o)),t.push({id:String(t.length),flag:1,penId:e.id,x:(l-i)/r,y:(c-a)/n})}for(var v=5,h=0;h<v;h++)if(h!==2){var l=i+r*(h+1)/(v+1),c=a+n;l<i+o?c=Uo(i+o,c-o,l,o):l>i+r-o&&(c=Uo(i+r-o,c-o,l,o)),t.push({id:String(t.length),flag:1,penId:e.id,x:(l-i)/r,y:(c-a)/n})}for(var g=3,h=0;h<g;h++){var c=a+n*(h+1)/(g+1),l=i;c<a+o?l=Ho(l+o,a+o,c,o,-1):c>a+n-o&&(l=Ho(l+o,a+n-o,c,o,-1)),t.push({id:String(t.length),flag:1,penId:e.id,x:(l-i)/r,y:(c-a)/n})}e.anchors=t}function xk(e){var t=e.calculative.borderRadius||0,i=e.calculative.borderRadius||0,a=e.width,r=e.height;e.calculative.borderRadius<1&&(t=a*e.calculative.borderRadius,i=r*e.calculative.borderRadius);var n=t<i?t:i;return a<2*n&&(n=a/2),r<2*n&&(n=r/2),n}function Ho(e,t,i,a,r){return r===void 0&&(r=1),r*Math.sqrt(Math.pow(a,2)-Math.pow(i-t,2))+e}function Uo(e,t,i,a,r){return r===void 0&&(r=1),r*Math.sqrt(Math.pow(a,2)-Math.pow(i-e,2))+t}function Ek(e,t){var i=t||new Path2D,a=e.calculative.worldRect,r=a.x,n=a.y,o=a.width,s=a.height;if(i.moveTo(r,n+s),i.lineTo(r+o,n+s),i.closePath(),i instanceof Path2D)return i}function kk(e){var t=[{x:0,y:1},{x:1,y:1}];e.anchors=t.map(function(i,a){var r=i.x,n=i.y;return{id:a+"",x:r,y:n,penId:e.id}})}function Ck(){return{rectangle:Wa,square:bx,circle:_x,svgPath:pE,diamond:wE,triangle:bE,pentagon:xE,pentagram:AE,hexagon:TE,leftArrow:RE,rightArrow:PE,twowayArrow:IE,message:LE,cloud:DE,file:ME,people:OE,line:HE,iframe:rk,video:ck,gif:dk,mindNode:bk,mindLine:Ek,mindNode2:Wa}}function Ak(){return{triangle:_E,pentagon:EE,pentagram:yg,mindNode:Ag,mindLine:kk}}function Rr(){try{var e=new OffscreenCanvas(0,0),t=e.getContext("2d");return t&&t.arc?e:document.createElement("canvas")}catch{return document.createElement("canvas")}}var Sk=function(){function e(t,i){var a=this;this.parentElement=t,this.store=i,this.box=document.createElement("div"),this.text=document.createElement("div"),this.arrowUp=document.createElement("div"),this.arrowDown=document.createElement("div"),this.box.className="meta2d-tooltip",this.text.className="text",this.arrowUp.className="arrow",this.arrowDown.className="arrow down",this.box.appendChild(this.text),this.box.appendChild(this.arrowUp),this.box.appendChild(this.arrowDown),t.appendChild(this.box),this.box.onmouseleave=function(){a.hide(),a.store.lastHover=void 0};for(var r,n=0;n<document.styleSheets.length;n++)document.styleSheets[n].title==="le5le.com/tooltip"&&(r=document.styleSheets[n]);if(!r){var o=document.createElement("style");o.type="text/css",o.title="le5le.com/tooltip",document.head.appendChild(o),o=document.createElement("style"),o.type="text/css",document.head.appendChild(o),r=o.sheet,r.insertRule(".meta2d-tooltip{position:absolute;padding:8px 0;z-index:10;left: -9999px;top: -9999px;}"),r.insertRule(".meta2d-tooltip .text{max-width:320px;min-height:30px;max-height:400px;outline:none;padding:8px 16px;border-radius:4px;background:#777777;color:#ffffff;line-height:1.8;overflow-y:auto;}"),r.insertRule(".meta2d-tooltip .arrow{position:absolute;border:10px solid transparent;background:transparent;top:-5px;left:50%;transform:translateX(-50%)}"),r.insertRule(".meta2d-tooltip .arrow.down{top:initial;bottom: -1px;}")}}return e.getTitle=function(t){if(t.titleFnJs&&!t.titleFn)try{t.titleFn=new Function("pen",t.titleFnJs)}catch(i){console.log("titleFnJs",i)}return t.titleFn?t.titleFn(t):String(t.title)},e.prototype.setText=function(t){var i=this.box.getBoundingClientRect(),a=globalThis.marked,r=e.getTitle(t);if(a){this.text.innerHTML=a(r);for(var n=this.text.getElementsByTagName("A"),o=0;o<n.length;++o)n[o].setAttribute("target","_blank")}else this.text.innerHTML=r;return i},e.prototype.updateText=function(t){var i;if(((i=this.currentPen)===null||i===void 0?void 0:i.id)===t.id&&!e.titleEmpty(t)){var a=this.setText(t),r=this.box.getBoundingClientRect();this.changePositionByText(a,r)}},e.prototype.changePositionByText=function(t,i){this.x-=(i.width-t.width)/2,this.y-=i.height-t.height,this.box.style.left=this.x+"px",this.box.style.top=this.y+"px"},e.titleEmpty=function(t){return!t.title&&!t.titleFn&&!t.titleFnJs},e.prototype.show=function(t,i){if(this.currentPen=t,e.titleEmpty(t)){var a=ri(t,!0);a&&this.show(a,i);return}this.setText(t);var r=this.box.getBoundingClientRect(),n=t.calculative.worldRect,o=t.calculative.canvas.store.data.x+i.x-r.width/2,s=t.calculative.canvas.store.data.y+i.y-r.height;t.type||(o=t.calculative.canvas.store.data.x+n.x-(r.width-n.width)/2,s=t.calculative.canvas.store.data.y+n.ey-r.height-n.height),s>0?(this.arrowUp.style.borderBottomColor="transparent",this.arrowDown.style.borderTopColor="#777777"):(s+=r.height+n.height+5,this.arrowUp.style.borderBottomColor="#777777",this.arrowDown.style.borderTopColor="transparent"),this.x=o,this.y=s,this.box.style.left=this.x+"px",this.box.style.top=this.y+"px"},e.prototype.hide=function(){this.currentPen=null,this.x=-9999,this.box.style.left="-9999px"},e.prototype.translate=function(t,i){this.x<-1e3||(this.x+=t,this.y+=i,this.box.style.left=this.x+"px",this.box.style.top=this.y+"px")},e.prototype.destroy=function(){this.box.onmouseleave=null},e}(),Sg=function(){function e(t){var i=this;this.parent=t,this.onMouseDownH=function(o){o.preventDefault(),o.stopPropagation(),i.isDownH=o.x,i.x=i.parent.store.data.x||0,i.lastScrollX=i.scrollX},this.onMouseDownV=function(o){o.preventDefault(),o.stopPropagation(),i.isDownV=o.y,i.y=i.parent.store.data.y||0,i.lastScrollY=i.scrollY},this.onMouseMove=function(o){if(i.isDownH){var s=o.x-i.isDownH;i.scrollX=i.lastScrollX+s,i.h.style.left=i.scrollX+"px",i.parent.store.data.x=i.x-s*i.rect.width/i.parent.parentElement.clientWidth}if(i.isDownV){var h=o.y-i.isDownV;if(i.pageMode&&i.canMouseMove(h))return;i.scrollY=i.lastScrollY+h,i.v.style.top=i.scrollY+"px",i.parent.store.data.y=i.y-h*i.rect.height/i.parent.parentElement.clientHeight}(i.isDownH||i.isDownV)&&(i.parent.onMovePens(),i.parent.canvasTemplate.init(),i.parent.canvasImage.init(),i.parent.canvasImageBottom.init(),i.parent.render())},this.onMouseUp=function(o){!i.isDownH&&!i.isDownV||(i.isDownH=void 0,i.isDownV=void 0,i.scrollX<20?(i.scrollX=20,i.h.style.left=i.scrollX+"px"):i.scrollX>i.parent.parentElement.clientWidth-i.hSize-20&&(i.scrollX=i.parent.parentElement.clientWidth-i.hSize-20,i.h.style.left=i.scrollX+"px"),i.scrollY<20?(i.scrollY=20,i.v.style.top=i.scrollY+"px"):i.scrollY>i.parent.parentElement.clientHeight-i.vSize-20&&(i.scrollY=i.parent.parentElement.clientHeight-i.vSize-20,i.v.style.top=i.scrollY+"px"),i.resize())},this.h=document.createElement("div"),this.v=document.createElement("div"),this.parent.externalElements.appendChild(this.h),this.parent.externalElements.appendChild(this.v),this.h.className="meta2d-scroll h",this.h.onmousedown=this.onMouseDownH,this.v.className="meta2d-scroll v",this.v.onmousedown=this.onMouseDownV,document.addEventListener("mousemove",this.onMouseMove),document.addEventListener("mouseup",this.onMouseUp);for(var a,r=0;r<document.styleSheets.length;r++)document.styleSheets[r].title==="le5le/scroll"&&(a=document.styleSheets[r]);if(!a){var n=document.createElement("style");n.type="text/css",n.title="le5le.com/scroll",document.head.appendChild(n),n=document.createElement("style"),n.type="text/css",document.head.appendChild(n),a=n.sheet,a.insertRule(".meta2d-scroll{position:absolute;width:8px;height:200px;background:#dddddd;border-radius:10px;z-index:20;cursor:default;}"),a.insertRule(".meta2d-scroll:hover{background:#cccccc;cursor:pointer}"),a.insertRule(".meta2d-scroll.v{right:0;top:calc(50% - 100px);}"),a.insertRule(".meta2d-scroll.h{bottom:2px;left:calc(50% - 100px);width:200px;height:8px;}")}this.init()}return e.prototype.init=function(){this.isShow=!0,this.resize(),this.initPos()},e.prototype.canMouseMove=function(t){var i=this.parent.parent.getRect();return t<0&&i.y+this.parent.store.data.y>=0||t>0&&i.ey-this.parent.height+this.parent.store.data.y<=0},e.prototype.changeMode=function(){this.pageMode=!0,this.h.style.display="none";var t=this.parent.parent.getRect();t.height<this.parent.height&&(this.v.style.display="none")},e.prototype.initPos=function(){this.scrollX=(this.parent.parentElement.clientWidth-this.hSize)/2,this.scrollY=(this.parent.parentElement.clientHeight-this.vSize)/2,this.h.style.left=this.scrollX+"px",this.v.style.top=this.scrollY+"px"},e.prototype.resize=function(){this.rect=Hi(this.parent.store.data.pens),this.rect.width<1400&&(this.rect.width=1400),this.rect.height<900&&(this.rect.height=900),this.parent.store.data.x>0?this.rect.width+=this.parent.store.data.x+(this.rect.x>0?0:this.rect.x):this.rect.width-=this.parent.store.data.x+(this.rect.x>0?0:this.rect.x),this.parent.store.data.y>0?this.rect.height+=this.parent.store.data.y+(this.rect.y>0?0:this.rect.y):this.rect.height-=this.parent.store.data.y+(this.rect.y>0?0:this.rect.y),this.rect.width<1400&&(this.rect.width=1400),this.rect.height<900&&(this.rect.height=900),this.hSize=1e3*this.parent.parentElement.clientWidth/this.rect.width/3,this.vSize=1e3*this.parent.parentElement.clientHeight/this.rect.height/3,this.h.style.width=this.hSize+"px",this.v.style.height=this.vSize+"px"},e.prototype.show=function(){this.isShow=!0,this.h.style.display="block",this.v.style.display="block",document.addEventListener("mousemove",this.onMouseMove),document.addEventListener("mouseup",this.onMouseUp)},e.prototype.hide=function(){this.isShow=!1,this.h.style.display="none",this.v.style.display="none",this.destroy()},e.prototype.translate=function(t,i){t&&(this.scrollX-=t*this.parent.parentElement.clientWidth/this.rect.width,this.h.style.left=this.scrollX+"px"),i&&(this.scrollY-=i*this.parent.parentElement.clientHeight/this.rect.height,this.v.style.top=this.scrollY+"px")},e.prototype.wheel=function(t){var i=10;t&&(i=-10),!(this.pageMode&&this.canMouseMove(i))&&(this.scrollY+=i,this.v.style.top=this.scrollY+"px",this.parent.store.data.y-=i*this.rect.height/this.parent.parentElement.clientHeight,this.parent.onMovePens(),this.parent.canvasTemplate.init(),this.parent.canvasImage.init(),this.parent.canvasImageBottom.init(),this.parent.render())},e.prototype.destroy=function(){document.removeEventListener("mousemove",this.onMouseMove),document.removeEventListener("mouseup",this.onMouseUp)},e}(),vn=globalThis&&globalThis.__values||function(e){var t=typeof Symbol=="function"&&Symbol.iterator,i=t&&e[t],a=0;if(i)return i.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Ld=function(){function e(t,i,a){this.parentElement=t,this.store=i,this.isBottom=a,this.canvas=document.createElement("canvas"),this.otherOffsreen=Rr(),this.offscreen=Rr(),this.animateOffsScreen=Rr(),t.appendChild(this.canvas),this.canvas.style.backgroundRepeat="no-repeat",this.canvas.style.backgroundSize="100% 100%",this.canvas.style.position="absolute",this.canvas.style.top="0",this.canvas.style.left="0"}return e.prototype.resize=function(t,i){this.canvas.style.width=t+"px",this.canvas.style.height=i+"px",t=t*this.store.dpiRatio|0,i=i*this.store.dpiRatio|0,this.canvas.width=t,this.canvas.height=i,this.otherOffsreen.width=t,this.otherOffsreen.height=i,this.offscreen.width=t,this.offscreen.height=i,this.animateOffsScreen.width=t,this.animateOffsScreen.height=i,this.otherOffsreen.getContext("2d").scale(this.store.dpiRatio,this.store.dpiRatio),this.otherOffsreen.getContext("2d").textBaseline="middle",this.offscreen.getContext("2d").scale(this.store.dpiRatio,this.store.dpiRatio),this.offscreen.getContext("2d").textBaseline="middle",this.animateOffsScreen.getContext("2d").scale(this.store.dpiRatio,this.store.dpiRatio),this.animateOffsScreen.getContext("2d").textBaseline="middle",this.init()},e.prototype.init=function(){var t,i;this.offscreen.getContext("2d").clearRect(0,0,this.canvas.width,this.canvas.height),this.animateOffsScreen.getContext("2d").clearRect(0,0,this.canvas.width,this.canvas.height);try{for(var a=vn(this.store.data.pens),r=a.next();!r.done;r=a.next()){var n=r.value;this.hasImage(n)&&(n.calculative.imageDrawed=!1)}}catch(o){t={error:o}}finally{try{r&&!r.done&&(i=a.return)&&i.call(a)}finally{if(t)throw t.error}}this.isBottom?this.store.patchFlagsBackground=!0:this.store.patchFlagsTop=!0},e.prototype.clear=function(){this.otherOffsreen.getContext("2d").clearRect(0,0,this.otherOffsreen.width,this.otherOffsreen.height),this.offscreen.getContext("2d").clearRect(0,0,this.canvas.width,this.canvas.height),this.animateOffsScreen.getContext("2d").clearRect(0,0,this.canvas.width,this.canvas.height),this.canvas.getContext("2d").clearRect(0,0,this.canvas.width,this.canvas.height)},e.prototype.hasImage=function(t){return t.calculative.hasImage=t.calculative&&t.calculative.inView&&(this.isBottom&&t.canvasLayer===Ne.CanvasImageBottom||!this.isBottom&&t.canvasLayer===Ne.CanvasImage)&&t.image&&t.calculative.img&&t.name!=="gif",t.calculative.hasImage},e.prototype.render=function(){var t,i,a,r,n,o,s,h,l=!1,c=!1;try{for(var f=vn(this.store.data.pens),v=f.next();!v.done;v=f.next()){var g=v.value;this.hasImage(g)&&(this.store.animates.has(g)?c=!0:g.calculative.imageDrawed||(l=!0),g.parentId&&this.store.animates.has(ri(g,!0))&&(c=!0))}}catch(U){t={error:U}}finally{try{v&&!v.done&&(i=f.return)&&i.call(f)}finally{if(t)throw t.error}}var y=this.store.patchFlagsBackground,p=this.store.patchFlagsTop;if(p&&!this.isBottom){var m=this.otherOffsreen.getContext("2d");m.clearRect(0,0,this.canvas.width,this.canvas.height),this.renderRule(m)}var b=this.store.patchFlagsLast;if(b){var m=this.offscreen.getContext("2d");m.clearRect(0,0,this.canvas.width,this.canvas.height)}if(l){var m=this.offscreen.getContext("2d");m.save(),m.clearRect(0,0,this.canvas.width,this.canvas.height),m.translate(this.store.data.x,this.store.data.y);try{for(var x=vn(this.store.data.pens),_=x.next();!_.done;_=x.next()){var g=_.value;!g.calculative.hasImage||this.store.animates.has(g)||this.store.animates.has(ri(g,!0))||g.canvasLayer!==Ne.CanvasTemplate&&(g.calculative.imageDrawed=!0,m.save(),Qr(m,g),g.calculative.rotate&&or(m,g),Jr(m,g),Fa(m,g),m.restore())}}catch($){a={error:$}}finally{try{_&&!_.done&&(r=x.return)&&r.call(x)}finally{if(a)throw a.error}}m.restore()}if(c){var m=this.animateOffsScreen.getContext("2d");m.save(),m.clearRect(0,0,this.canvas.width,this.canvas.height),m.translate(this.store.data.x,this.store.data.y);try{for(var k=vn(this.store.animates),I=k.next();!I.done;I=k.next()){var g=I.value;!g.calculative.hasImage||g.canvasLayer!==Ne.CanvasTemplate&&(g.calculative.imageDrawed=!0,m.save(),Qr(m,g),g.calculative.rotate&&or(m,g),Jr(m,g),Fa(m,g),m.restore())}}catch($){n={error:$}}finally{try{I&&!I.done&&(o=k.return)&&o.call(k)}finally{if(n)throw n.error}}try{for(var P=vn(this.store.data.pens),M=P.next();!M.done;M=P.next()){var g=M.value;!g.calculative.hasImage||!g.parentId||g.canvasLayer!==Ne.CanvasTemplate&&this.store.animates.has(ri(g,!0))&&(g.calculative.imageDrawed=!0,m.save(),Qr(m,g),g.calculative.rotate&&or(m,g),Jr(m,g),Fa(m,g),m.restore())}}catch($){s={error:$}}finally{try{M&&!M.done&&(h=P.return)&&h.call(P)}finally{if(s)throw s.error}}m.restore()}if(l||c||y&&this.isBottom||p&&!this.isBottom){var L=this.canvas.getContext("2d");L.clearRect(0,0,this.canvas.width,this.canvas.height),this.isBottom&&(this.store.patchFlagsBackground=!1),L.drawImage(this.offscreen,0,0,this.canvas.width,this.canvas.height),L.drawImage(this.animateOffsScreen,0,0,this.canvas.width,this.canvas.height),this.isBottom||(L.drawImage(this.otherOffsreen,0,0,this.canvas.width,this.canvas.height),this.store.patchFlagsTop=!1)}},e.prototype.renderRule=function(t){var i,a,r,n,o,s,h,l,c=this.store,f=c.data,v=c.options,g=f.rule,y=f.ruleColor,p=f.scale,m=f.origin;if(!!(g!=null?g:v.rule)){var b=p*10;t.save();var x=y||v.ruleColor;t.strokeStyle=ls(x,.7);var _=m.x+f.x,k=m.y+f.y,I=this.canvas,P=I.width,M=I.height,L=((i=v.ruleOptions)===null||i===void 0?void 0:i.height)||20;!((a=v.ruleOptions)===null||a===void 0)&&a.background&&(t.beginPath(),t.fillStyle=(r=v.ruleOptions)===null||r===void 0?void 0:r.background,t.rect(0,0,P,L),t.fill(),t.rect(0,0,L,M),t.fill()),!((n=v.ruleOptions)===null||n===void 0)&&n.underline&&(t.beginPath(),t.fillStyle=ls(x,.7),t.moveTo(0,L),t.lineTo(P,L),t.stroke(),t.moveTo(L,0),t.lineTo(L,M),t.stroke());var U=L/4;((o=v.ruleOptions)===null||o===void 0?void 0:o.baseline)==="bottom"&&(U=L*3/4),t.beginPath(),t.lineWidth=L/2,t.lineDashOffset=-_%b,t.setLineDash([1,b-1]),t.moveTo(0,U),t.lineTo(P,U),t.stroke(),t.beginPath(),t.lineDashOffset=-k%b,t.moveTo(U,0),t.lineTo(U,M),t.stroke(),t.strokeStyle=x,t.beginPath(),t.lineWidth=L,t.lineDashOffset=-_%(b*10),t.setLineDash([1,b*10-1]),t.moveTo(0,L/2),t.lineTo(P,L/2),t.stroke(),t.beginPath(),t.lineDashOffset=-k%(b*10),t.moveTo(L/2,0),t.lineTo(L/2,M),t.stroke(),t.beginPath(),t.fillStyle=((s=v.ruleOptions)===null||s===void 0?void 0:s.textColor)||t.strokeStyle;var $=0-Math.floor(_/b/10)*100,S=((h=v.ruleOptions)===null||h===void 0?void 0:h.textTop)||16,T=((l=v.ruleOptions)===null||l===void 0?void 0:l.textLeft)||4;_<0&&($-=100);for(var R=_%(b*10);R<P;R+=10*b,$+=100)b<3&&$%500||t.fillText($.toString(),R+T,S);$=0-Math.floor(k/b/10)*100,k<0&&($-=100);for(var R=k%(b*10);R<M;R+=10*b,$+=100)b<3&&$%500||(t.save(),t.beginPath(),t.translate(S,R-T),t.rotate(270*Math.PI/180),t.fillText($.toString(),0,0),t.restore());t.restore()}},e}(),Tk=function(){function e(t,i,a){this.parentCanvas=t,this.parentElement=i,this.store=a,this.canvas=document.createElement("canvas"),this.magnifierScreen=Rr(),this.offscreen=Rr(),this.magnifierSize=300,i.appendChild(this.canvas),this.canvas.style.backgroundRepeat="no-repeat",this.canvas.style.backgroundSize="100% 100%",this.canvas.style.position="absolute",this.canvas.style.top="0",this.canvas.style.left="0"}return e.prototype.resize=function(t,i){this.canvas.style.width=t+"px",this.canvas.style.height=i+"px",t=t*this.store.dpiRatio|0,i=i*this.store.dpiRatio|0,this.canvas.width=t,this.canvas.height=i,this.offscreen.width=t,this.offscreen.height=i,this.offscreen.getContext("2d").scale(this.store.dpiRatio,this.store.dpiRatio),this.offscreen.getContext("2d").textBaseline="middle",this.magnifierScreen.width=this.magnifierSize+5,this.magnifierScreen.height=this.magnifierSize+5},e.prototype.renderMagnifier=function(){var t=this;if(!!this.magnifier){var i=this.magnifierSize/2,a=this.magnifierSize+5,r=this.magnifierScreen.getContext("2d");r.clearRect(0,0,a,a),r.lineWidth=5,r.save(),r.translate(2.5,2.5),r.save(),r.arc(i,i,i,0,Math.PI*2,!1),r.clip(),r.fillStyle=this.store.data.background||this.store.options.background||"#f4f4f4",r.fillRect(0,0,a,a),r.translate(-i,-i),r.scale(2,2);var n={x:(this.parentCanvas.mousePos.x+this.store.data.x)*this.store.dpiRatio,y:(this.parentCanvas.mousePos.y+this.store.data.y)*this.store.dpiRatio},o=[this.parentCanvas.canvasImageBottom.offscreen,this.parentCanvas.canvasImageBottom.animateOffsScreen,this.parentCanvas.offscreen,this.parentCanvas.canvasImage.offscreen,this.parentCanvas.canvasImage.animateOffsScreen];o.forEach(function(l){r.drawImage(l,n.x-i,n.y-i,t.magnifierSize,t.magnifierSize,0,0,t.magnifierSize,t.magnifierSize)}),r.restore(),r.beginPath();var s=r.createRadialGradient(i,i,i-5,i,i,i);s.addColorStop(0,"rgba(0,0,0,0.2)"),s.addColorStop(.8,"rgb(200,200,200)"),s.addColorStop(.9,"rgb(200,200,200)"),s.addColorStop(1,"rgba(200,200,200,0.9)"),r.strokeStyle=s,r.arc(i,i,i,0,Math.PI*2,!1),r.stroke(),r.restore();var h=this.offscreen.getContext("2d");h.drawImage(this.magnifierScreen,0,0,this.magnifierSize+5,this.magnifierSize+5,(n.x-i-2.5)/this.store.dpiRatio,(n.y-i-2.5)/this.store.dpiRatio,(this.magnifierSize+5)/this.store.dpiRatio,(this.magnifierSize+5)/this.store.dpiRatio)}},e.prototype.render=function(){this.offscreen.getContext("2d").clearRect(0,0,this.canvas.width,this.canvas.height),this.renderMagnifier();var t=this.canvas.getContext("2d");t.clearRect(0,0,this.canvas.width,this.canvas.height),t.drawImage(this.offscreen,0,0,this.canvas.width,this.canvas.height)},e}();function Tg(e){if(e.data.locked)throw new Error("canvas is locked")}var Rk=function(){function e(t){var i=this;this.parentElement=t,this.box=document.createElement("div"),this.dialog=document.createElement("div");var a=document.createElement("div");this.title=document.createElement("div"),this.close=document.createElement("span"),this.close.innerHTML=`
- <svg fill="none" viewBox="0 0 16 16" width="1em" height="1em">
- <path
- fill="currentColor"
- d="M8 8.92L11.08 12l.92-.92L8.92 8 12 4.92 11.08 4 8 7.08 4.92 4 4 4.92 7.08 8 4 11.08l.92.92L8 8.92z"
- fill-opacity="0.9"
- ></path>
- </svg>`;var r=document.createElement("div");this.iframe=document.createElement("iframe"),this.iframe.setAttribute("frameborder","0"),this.box.className="meta2d-dialog_mask",this.dialog.className="meta2d-dialog",r.className="meta2d-dialog_body",a.className="meta2d-dialog_header",this.title.className="meta2d-dialog-content",this.close.className="meta2d-dialog-close",a.appendChild(this.title),a.appendChild(this.close),r.appendChild(this.iframe),this.dialog.appendChild(a),this.dialog.appendChild(r),this.box.appendChild(this.dialog),t.appendChild(this.box),this.dialog.onclick=function(h){h.stopPropagation()},this.box.onclick=function(){i.hide()},this.close.onclick=function(){i.hide()};for(var n,o=0;o<document.styleSheets.length;o++)document.styleSheets[o].title==="le5le.com/dialog"&&(n=document.styleSheets[o]);if(!n){var s=document.createElement("style");s.type="text/css",s.title="le5le.com/dialog",document.head.appendChild(s),s=document.createElement("style"),s.type="text/css",document.head.appendChild(s),n=s.sheet,n.insertRule(`.meta2d-dialog_mask {
- display: none;
- position: absolute;
- top: 0%;
- left: 0%;
- width: 100%;
- height: 100%;
- background-color: #0000006f;
- z-index: 9999;`),n.insertRule(`.meta2d-dialog_mask .meta2d-dialog {
- position: absolute;
- top: 15vh;
- left: 10%;
- width: 80%;
- padding: 16px 20px;
- border-radius: 9px;
- background-color: #1e2430;
- z-index: 19999;
- overflow: auto;
- }`),n.insertRule(`.meta2d-dialog_header {
- display: flex;
- }`),n.insertRule(`.meta2d-dialog-content {
- width: calc(100% - 20px);
- font-weight: 600;
- font-size: 14px;
- color: #bdc7db;
- }`),n.insertRule(`.meta2d-dialog-close {
- width: 20px;
- height: 20px;
- line-height: 20px;
- text-align: center;
- color: #617b91;
- }`),n.insertRule(`.meta2d-dialog-close :hover{
- cursor: pointer;
- }`),n.insertRule(`.meta2d-dialog_body{
- margin-top: 4px;
- } `),n.insertRule(`.meta2d-dialog_body iframe{
- width: 100%;
- height: 400px;
- }`)}}return e.prototype.show=function(t,i){this.box.style.display="block",i&&this.iframe.setAttribute("src",i),t&&(this.title.innerText=t)},e.prototype.hide=function(){this.box.style.display="none"},e.prototype.destroy=function(){this.dialog.onclick=void 0,this.box.onclick=void 0,this.close.onclick=void 0},e}(),Pk=function(){function e(t){this.parentElement=t,this.box=document.createElement("div"),this.box.className="meta2d-title",t.appendChild(this.box);for(var i,a=0;a<document.styleSheets.length;a++)document.styleSheets[a].title==="le5le.com/title"&&(i=document.styleSheets[a]);if(!i){var r=document.createElement("style");r.type="text/css",r.title="le5le.com/title",document.head.appendChild(r),r=document.createElement("style"),r.type="text/css",document.head.appendChild(r),i=r.sheet,i.insertRule(".meta2d-title{position:absolute;padding:0;z-index:10;left: -9999px;top: -9999px;background:#fff;color:#000; cursor: crosshair;border: 1px solid black;}")}}return e.getTitle=function(t){},e.prototype.setText=function(t){this.box.innerText=t.title},e.prototype.updateText=function(t){var i;((i=this.currentAnchor)===null||i===void 0?void 0:i.id)===t.id&&(e.titleEmpty(t)||(this.setText(t),this.changePositionByAnchor(t)))},e.prototype.changePositionByAnchor=function(t){this.box.style.left=t.x+10+"px",this.box.style.top=t.y+10+"px"},e.titleEmpty=function(t){return!t.title},e.prototype.show=function(t,i){if(!e.titleEmpty(t)){this.currentAnchor=t,this.setText(t);var a={x:i.calculative.canvas.store.data.x+t.x,y:i.calculative.canvas.store.data.y+t.y};this.changePositionByAnchor(a)}},e.prototype.hide=function(){this.box.style.left="-9999px",this.box.innerText="",this.currentAnchor=null},e.prototype.destroy=function(){this.box.onmouseleave=null},e}(),Ik=globalThis&&globalThis.__values||function(e){var t=typeof Symbol=="function"&&Symbol.iterator,i=t&&e[t],a=0;if(i)return i.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Lk=function(){function e(t,i){this.parentElement=t,this.store=i,this.canvas=document.createElement("canvas"),this.offscreen=Rr(),this.bgOffscreen=Rr(),t.appendChild(this.canvas),this.canvas.style.backgroundRepeat="no-repeat",this.canvas.style.backgroundSize="100% 100%",this.canvas.style.position="absolute",this.canvas.style.top="0",this.canvas.style.left="0"}return e.prototype.resize=function(t,i){this.canvas.style.width=t+"px",this.canvas.style.height=i+"px",t=t*this.store.dpiRatio|0,i=i*this.store.dpiRatio|0,this.canvas.width=t,this.canvas.height=i,this.bgOffscreen.width=t,this.bgOffscreen.height=i,this.offscreen.width=t,this.offscreen.height=i,this.bgOffscreen.getContext("2d").scale(this.store.dpiRatio,this.store.dpiRatio),this.bgOffscreen.getContext("2d").textBaseline="middle",this.offscreen.getContext("2d").scale(this.store.dpiRatio,this.store.dpiRatio),this.offscreen.getContext("2d").textBaseline="middle",this.init()},e.prototype.init=function(){this.bgOffscreen.getContext("2d").clearRect(0,0,this.canvas.width,this.canvas.height),this.offscreen.getContext("2d").clearRect(0,0,this.canvas.width,this.canvas.height),this.patchFlags=!0,this.bgPatchFlags=!0},e.prototype.hidden=function(){this.canvas.style.display="none"},e.prototype.show=function(){this.canvas.style.display="block"},e.prototype.clear=function(){this.bgOffscreen.getContext("2d").clearRect(0,0,this.canvas.width,this.canvas.height),this.offscreen.getContext("2d").clearRect(0,0,this.canvas.width,this.canvas.height),this.canvas.getContext("2d").clearRect(0,0,this.canvas.width,this.canvas.height),this.bgPatchFlags=!0,this.patchFlags=!0},e.prototype.render=function(){var t,i,a;if(this.bgPatchFlags){var r=this.bgOffscreen.getContext("2d");r.clearRect(0,0,this.canvas.width,this.canvas.height);var n=this.store.data.width||this.store.options.width,o=this.store.data.height||this.store.options.height,s=this.store.data.x||this.store.options.x||0,h=this.store.data.y||this.store.options.y||0,l=this.store.data.background||this.store.options.background;l&&(r.save(),r.fillStyle=l,n&&o?(r.globalAlpha=(a=this.store.data.globalAlpha)!==null&&a!==void 0?a:this.store.options.globalAlpha,r.shadowOffsetX=this.store.options.shadowOffsetX,r.shadowOffsetY=this.store.options.shadowOffsetY,r.shadowBlur=this.store.options.shadowBlur,r.shadowColor=this.store.options.shadowColor,r.fillRect(this.store.data.origin.x+s,this.store.data.origin.y+h,n*this.store.data.scale,o*this.store.data.scale)):r.fillRect(0,0,this.canvas.width,this.canvas.height),r.restore()),n&&o&&this.store.bkImg&&(r.save(),r.drawImage(this.store.bkImg,this.store.data.origin.x+s,this.store.data.origin.y+h,n*this.store.data.scale,o*this.store.data.scale),r.restore()),this.renderGrid(r)}if(this.patchFlags){var r=this.offscreen.getContext("2d");r.save(),r.clearRect(0,0,this.canvas.width,this.canvas.height),r.translate(this.store.data.x,this.store.data.y);try{for(var c=Ik(this.store.data.pens),f=c.next();!f.done;f=c.next()){var v=f.value;!isFinite(v.x)||v.canvasLayer===Ne.CanvasTemplate&&v.calculative.inView&&(jr(r,v),v.image&&v.name!=="gif"&&v.calculative.img&&(r.save(),Qr(r,v),v.calculative.rotate&&or(r,v),Jr(r,v),Fa(r,v),r.restore()))}}catch(p){t={error:p}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(t)throw t.error}}r.restore()}if(this.patchFlags||this.bgPatchFlags){var g=this.canvas.getContext("2d");g.clearRect(0,0,this.canvas.width,this.canvas.height),g.drawImage(this.bgOffscreen,0,0,this.canvas.width,this.canvas.height),g.drawImage(this.offscreen,0,0,this.canvas.width,this.canvas.height),this.patchFlags=!1,this.bgPatchFlags=!1}},e.prototype.renderGrid=function(t){var i=this.store,a=i.data,r=i.options,n=a.grid,o=a.gridRotate,s=a.gridColor,h=a.gridSize,l=a.scale,c=a.origin;if(!!(n!=null?n:r.grid)){t.save();var f=(a.width||r.width)*l,v=(a.height||r.height)*l,g=(a.x||r.x||0)+c.x,y=(a.y||r.y||0)+c.y;o&&(t.translate(f/2,v/2),t.rotate(o*Math.PI/180),t.translate(-f/2,-v/2)),t.lineWidth=1,t.strokeStyle=s||r.gridColor,t.beginPath();var p=(h||r.gridSize)*l;if(!f||!v){for(var m=this.store.dpiRatio,b=this.canvas.width/m,x=this.canvas.height/m,_=g/p,k=y/p,I=p*10,P=g-Math.ceil(_)*p,M=y-Math.ceil(k)*p,L=b+P+I,U=x+M+I,$=P;$<=L;$+=p)t.moveTo($,M),t.lineTo($,x+M+I);for(var $=M;$<=U;$+=p)t.moveTo(P,$),t.lineTo(b+P+I,$)}else{for(var L=f+g,U=v+y,$=g;$<=L;$+=p)t.moveTo($,y),t.lineTo($,v+y);for(var $=y;$<=U;$+=p)t.moveTo(g,$),t.lineTo(f+g,$)}t.stroke(),t.restore()}},e}(),Lt=globalThis&&globalThis.__assign||function(){return Lt=Object.assign||function(e){for(var t,i=1,a=arguments.length;i<a;i++){t=arguments[i];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},Lt.apply(this,arguments)},Ei=globalThis&&globalThis.__awaiter||function(e,t,i,a){function r(n){return n instanceof i?n:new i(function(o){o(n)})}return new(i||(i=Promise))(function(n,o){function s(c){try{l(a.next(c))}catch(f){o(f)}}function h(c){try{l(a.throw(c))}catch(f){o(f)}}function l(c){c.done?n(c.value):r(c.value).then(s,h)}l((a=a.apply(e,t||[])).next())})},ki=globalThis&&globalThis.__generator||function(e,t){var i={label:0,sent:function(){if(n[0]&1)throw n[1];return n[1]},trys:[],ops:[]},a,r,n,o;return o={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function s(l){return function(c){return h([l,c])}}function h(l){if(a)throw new TypeError("Generator is already executing.");for(;i;)try{if(a=1,r&&(n=l[0]&2?r.return:l[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,l[1])).done)return n;switch(r=0,n&&(l=[l[0]&2,n.value]),l[0]){case 0:case 1:n=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,r=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(n=i.trys,!(n=n.length>0&&n[n.length-1])&&(l[0]===6||l[0]===2)){i=0;continue}if(l[0]===3&&(!n||l[1]>n[0]&&l[1]<n[3])){i.label=l[1];break}if(l[0]===6&&i.label<n[1]){i.label=n[1],n=l;break}if(n&&i.label<n[2]){i.label=n[2],i.ops.push(l);break}n[2]&&i.ops.pop(),i.trys.pop();continue}l=t.call(e,i)}catch(c){l=[6,c],r=0}finally{a=n=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}},Li=globalThis&&globalThis.__read||function(e,t){var i=typeof Symbol=="function"&&e[Symbol.iterator];if(!i)return e;var a=i.call(e),r,n=[],o;try{for(;(t===void 0||t-- >0)&&!(r=a.next()).done;)n.push(r.value)}catch(s){o={error:s}}finally{try{r&&!r.done&&(i=a.return)&&i.call(a)}finally{if(o)throw o.error}}return n},Di=globalThis&&globalThis.__spreadArray||function(e,t,i){if(i||arguments.length===2)for(var a=0,r=t.length,n;a<r;a++)(n||!(a in t))&&(n||(n=Array.prototype.slice.call(t,0,a)),n[a]=t[a]);return e.concat(n||Array.prototype.slice.call(t))},at=globalThis&&globalThis.__values||function(e){var t=typeof Symbol=="function"&&Symbol.iterator,i=t&&e[t],a=0;if(i)return i.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Mi="-moving",Dd=function(){function e(t,i,a){var r=this;this.parent=t,this.parentElement=i,this.store=a,this.canvas=document.createElement("canvas"),this.offscreen=Rr(),this.externalElements=document.createElement("div"),this.lastRotate=0,this.hoverType=be.None,this.resizeIndex=0,this.lastOffsetX=0,this.lastOffsetY=0,this.drawLineFns=Di([],Li(Tx),!1),this.patchFlagsLines=new Set,this.lastMouseTime=0,this.hoverTimer=0,this.patchFlags=!1,this.lastRender=0,this.touchStart=0,this.lastAnimateRender=0,this.animateRendering=!1,this.pointSize=8,this.pasteOffset=!0,this.opening=!1,this.maxZindex=5,this.canMoveLine=!1,this.inputParent=document.createElement("div"),this.inputDiv=document.createElement("div"),this.inputRight=document.createElement("div"),this.dropdown=document.createElement("ul"),this.mousePos={x:0,y:0},this.autoPolylineFlag=!1,this.stopPropagation=function(n){n.stopPropagation()},this.curve=NE,this.polyline=VE,this.mind=zE,this.line=UE,this.onCopy=function(n){r.store.options.disableClipboard||n.target!==r.externalElements&&n.target!==document.body&&n.target.offsetParent!==r.externalElements||r.copy()},this.onCut=function(n){r.store.options.disableClipboard||n.target!==r.externalElements&&n.target!==document.body&&n.target.offsetParent!==r.externalElements||r.cut()},this.onPaste=function(n){if(!(r.store.data.locked||r.store.options.disableClipboard)&&!(n.target!==r.externalElements&&n.target!==document.body&&n.target.offsetParent!==r.externalElements)){var o;if(navigator.clipboard&&n.clipboardData){var s=n.clipboardData.items;if(s){for(var h=0;h<s.length;h++)if(s[h].type.indexOf("image")!==-1&&s[h].getAsFile()){o=!0;break}}}if(o){var s=n.clipboardData.items;if(s)for(var l=function(f){if(s[f].type.indexOf("image")!==-1&&s[f].getAsFile()){var v=r.mousePos,g=v.x,y=v.y,p=s[f].getAsFile(),m=s[f].type.slice(6)==="gif"?"gif":"image";if(p!==null){var b,x=new FileReader;x.onload=function(_){b=_.target.result;var k=new Image;k.src=b,k.onload=function(){var I=k.width,P=k.height,M={name:m,x:g-50/2,y:y-P/I*50,externElement:m==="gif",width:100,height:P/I*100,image:b};r.addPens([M]),r.active([M]),r.copy([M])}},x.readAsDataURL(p)}}},h=0;h<s.length;h++)l(h)}else r.paste()}},this.onwheel=function(n){if(r.inputDiv.contentEditable!=="true"&&!r.drawingLine&&!r.pencil){if(r.store.hover&&r.store.hover.onWheel){r.store.hover.onWheel(r.store.hover,n);return}if(!r.store.options.disableScale&&(n.preventDefault(),n.stopPropagation(),!(r.mouseDown&&(r.hoverType===be.Node||r.hoverType===be.Line))&&r.store.data.locked!==ze.Disable&&r.store.data.locked!==ze.DisableScale&&r.store.data.locked!==ze.DisableMoveScale)){if(!n.ctrlKey&&Math.abs(n.wheelDelta)<100&&n.deltaY.toString().indexOf(".")===-1){if(r.store.options.scroll&&!n.metaKey&&r.scroll){r.scroll.wheel(n.deltaY<0);return}var o=r.store.data.scale||1;r.translate(-n.deltaX/o,-n.deltaY/o);return}if(Math.abs(n.wheelDelta)>100&&r.store.options.scroll&&r.scroll){r.scroll.wheel(n.deltaY<0);return}if(!r.store.options.disableTouchPadScale){var s=.015,h=/mac os /i.test(navigator.userAgent);if(h)n.ctrlKey?n.deltaY>0&&(s*=-1):s*=n.wheelDeltaY/240;else{var l=.2;n.deltaY.toString().indexOf(".")!==-1&&(l=.01),n.deltaY>0?s=-l:s=l}var c=n.offsetX,f=n.offsetY;r.scale(r.store.data.scale+s,{x:c,y:f}),r.externalElements.focus()}}}},this.onkeydown=function(n){var o,s,h;if(r.store.data.locked>=ze.DisableEdit&&n.target.tagName!=="INPUT"&&n.target.tagName!=="TEXTAREA"&&!n.target.dataset.meta2dIgnore&&r.store.active.forEach(function(m){var b;(b=m.onKeyDown)===null||b===void 0||b.call(m,m,n.key)}),!(r.store.data.locked>=ze.DisableEdit||n.target.tagName==="INPUT"||n.target.tagName==="TEXTAREA"||n.target.dataset.meta2dIgnore)&&!r.store.options.unavailableKeys.includes(n.key)){r.keyOptions||(r.keyOptions={}),r.keyOptions.altKey=n.altKey,r.keyOptions.shiftKey=n.shiftKey,r.keyOptions.ctrlKey=n.ctrlKey,r.keyOptions.metaKey=n.metaKey;var l=10,c=10,f=null;if(r.store.options.strictScope){var v=r.store.data.width||r.store.options.width,g=r.store.data.height||r.store.options.height;v&&g&&(f={x:r.store.data.origin.x,y:r.store.data.origin.y,width:v*r.store.data.scale,height:g*r.store.data.scale})}switch(n.key){case" ":r.hotkeyType=Ke.Translate;break;case"Control":r.drawingLine?r.drawingLine.calculative.drawlineH=!r.drawingLine.calculative.drawlineH:r.hotkeyType||(r.patchFlags=!0,r.hotkeyType=Ke.Select);break;case"Meta":break;case"Shift":r.store.active.length===1&&r.store.active[0].type&&r.store.activeAnchor?r.toggleAnchorHand():r.hotkeyType||(r.patchFlags=!0,r.store.options.resizeMode||(r.hotkeyType=Ke.Resize));break;case"Alt":if(!n.ctrlKey&&!n.shiftKey&&r.drawingLine){var y=We(r.drawingLine);y!==r.drawingLine.calculative.activeAnchor?(ou(r.drawingLine),r.drawingLine.calculative.worldAnchors.push(y)):r.drawingLine.calculative.worldAnchors.push({x:y.x,y:y.y});var p=r.drawLineFns.indexOf(r.drawingLineName);r.drawingLineName=r.drawLineFns[(p+1)%r.drawLineFns.length],r.drawingLine.lineName=r.drawingLineName,r.drawline(),r.patchFlags=!0}n.preventDefault();break;case"a":case"A":n.ctrlKey||n.metaKey?(r.active(r.store.data.pens.filter(function(m){return!m.parentId&&m.locked!==ze.Disable})),n.preventDefault()):r.toggleAnchorMode();break;case"Delete":case"Backspace":!r.store.data.locked&&r.delete();break;case"ArrowLeft":if(r.movingAnchor){r.translateAnchor(-1,0);break}if(l=-1,n.shiftKey&&(l=-5),(n.ctrlKey||n.metaKey)&&(l=-10),l=l*r.store.data.scale,r.store.activeAnchor&&r.store.active&&r.store.active.length===1&&r.store.active[0].type){r.moveLineAnchor({x:r.store.activeAnchor.x+l,y:r.store.activeAnchor.y},{});break}f&&r.activeRect.x+l<f.x&&(l=f.x-r.activeRect.x),r.translatePens(r.store.active,l,0);break;case"ArrowUp":if(r.movingAnchor){r.translateAnchor(0,-1);break}if(c=-1,n.shiftKey&&(c=-5),(n.ctrlKey||n.metaKey)&&(c=-10),c=c*r.store.data.scale,f&&r.activeRect.y+c<f.y&&(c=f.y-r.activeRect.y),r.store.activeAnchor&&r.store.active&&r.store.active.length===1&&r.store.active[0].type){r.moveLineAnchor({x:r.store.activeAnchor.x,y:r.store.activeAnchor.y+c},{});break}r.translatePens(r.store.active,0,c);break;case"ArrowRight":if(r.movingAnchor){r.translateAnchor(1,0);break}if(l=1,n.shiftKey&&(l=5),(n.ctrlKey||n.metaKey)&&(l=10),l=l*r.store.data.scale,r.store.activeAnchor&&r.store.active&&r.store.active.length===1&&r.store.active[0].type){r.moveLineAnchor({x:r.store.activeAnchor.x+l,y:r.store.activeAnchor.y},{});break}f&&r.activeRect.x+r.activeRect.width+l>f.x+f.width&&(l=f.x+f.width-(r.activeRect.x+r.activeRect.width)),r.translatePens(r.store.active,l,0);break;case"ArrowDown":if(r.movingAnchor){r.translateAnchor(0,1);break}if(c=1,n.shiftKey&&(c=5),(n.ctrlKey||n.metaKey)&&(c=10),c=c*r.store.data.scale,f&&r.activeRect.y+r.activeRect.height+c>f.y+f.height&&(c=f.y+f.height-(r.activeRect.y+r.activeRect.height)),r.store.activeAnchor&&r.store.active&&r.store.active.length===1&&r.store.active[0].type){r.moveLineAnchor({x:r.store.activeAnchor.x,y:r.store.activeAnchor.y+c},{});break}r.translatePens(r.store.active,0,c);break;case"d":case"D":!((o=r.store.active[0])===null||o===void 0)&&o.locked||r.removeAnchorHand();break;case"h":case"H":!((s=r.store.active[0])===null||s===void 0)&&s.locked||r.addAnchorHand();break;case"m":case"M":r.toggleMagnifier();break;case"g":case"G":r.hoverType===be.NodeAnchor&&(r.movingAnchor=r.store.hoverAnchor,r.externalElements.style.cursor="move");break;case"s":case"S":!r.store.data.locked&&r.hoverType===be.LineAnchor&&r.store.hover===r.store.active[0]&&r.splitLine(r.store.active[0],r.store.hoverAnchor),(n.ctrlKey||n.metaKey)&&r.store.emitter.emit("save",{event:n});break;case"c":case"C":(n.ctrlKey||n.metaKey)&&r.store.options.disableClipboard&&r.copy();break;case"x":case"X":(n.ctrlKey||n.metaKey)&&r.store.options.disableClipboard&&r.cut();break;case"\u221A":case"v":case"V":!n.ctrlKey&&!n.metaKey&&(r.pencil&&r.stopPencil(),r.drawingLineName?(r.finishDrawline(),r.drawingLineName=""):r.drawingLineName=r.store.options.drawingLineName),!r.store.data.locked&&(n.ctrlKey||n.metaKey)&&(r.store.options.disableClipboard||!r.store.options.disableClipboard&&n.altKey)&&r.paste();break;case"b":case"B":r.drawingLineName&&(r.finishDrawline(),r.drawingLineName=""),r.pencil?r.stopPencil():r.drawingPencil();break;case"y":case"Y":(n.ctrlKey||n.metaKey)&&r.redo();break;case"z":case"Z":n.ctrlKey||n.metaKey?r.undo():n.shiftKey&&r.redo();break;case"Enter":r.drawingLineName&&(r.finishDrawline(!0),r.store.active[0].anchors[0].connectTo?r.drawingLineName="":r.drawingLineName=r.store.options.drawingLineName),r.store.active&&(r.store.active.forEach(function(m){m.type?(m.close=!m.close,m.close&&wg(m),r.store.path2dMap.set(m,ke.path2dDraws.line(m)),Uc(m)):m.calculative.focus=!m.calculative.focus}),r.render());break;case"Escape":r.drawingLineName&&r.finishDrawline(),r.drawingLineName=void 0,r.stopPencil(),r.movingPens&&(r.getAllByPens(r.movingPens).forEach(function(m){r.store.pens[m.id]=void 0}),r.movingPens=void 0,r.mouseDown=void 0,r.clearDock(),(h=r.store.active)===null||h===void 0||h.forEach(function(m){r.updateLines(m)}),r.calcActiveRect(),r.patchFlags=!0),r.hotkeyType=Ke.None,r.movingAnchor=void 0,r.magnifierCanvas.magnifier&&(r.magnifierCanvas.magnifier=!1,r.patchFlags=!0);break;case"E":case"e":r.store.options.disableAnchor=!r.store.options.disableAnchor,r.store.emitter.emit("disableAnchor",r.store.options.disableAnchor);break;case"=":(n.ctrlKey||n.metaKey)&&(r.scale(r.store.data.scale+.1),n.preventDefault(),n.stopPropagation());break;case"-":(n.ctrlKey||n.metaKey)&&(r.scale(r.store.data.scale-.1),n.preventDefault(),n.stopPropagation());break;case"l":case"L":r.canMoveLine=!0;break;case"[":r.parent.down();break;case"]":r.parent.up();break;case"{":r.parent.bottom();break;case"}":r.parent.top();break}r.render(!1)}},this.onkeyup=function(n){switch(n.key){case"l":case"L":r.canMoveLine=!1;break}r.hotkeyType&&r.render(),r.hotkeyType<Ke.AddAnchor&&(r.hotkeyType=Ke.None)},this.ondrop=function(n){return Ei(r,void 0,void 0,function(){var o,s,h,l,c;return ki(this,function(f){switch(f.label){case 0:if(this.store.data.locked)return console.warn("canvas is locked, can not drop"),[2];n.preventDefault(),n.stopPropagation(),o=n.dataTransfer.getData("Meta2d")||n.dataTransfer.getData("Text"),s=null;try{o&&(s=JSON.parse(o))}catch{}return s?[3,3]:(h=n.dataTransfer.files,h.length&&h[0].type.match("image.*")&&!(this.addCaches&&this.addCaches.length)?(l=h[0].type==="image/gif",[4,this.fileToPen(h[0],l)]):[3,2]);case 1:return s=f.sent(),[3,3];case 2:if(this.addCaches&&this.addCaches.length)s=this.addCaches,this.addCaches=[];else return this.store.emitter.emit("drop",void 0),[2];f.label=3;case 3:return s=Array.isArray(s)?s:[s],s[0]&&s[0].draggable!==!1&&(c={x:n.offsetX,y:n.offsetY},this.calibrateMouse(c),this.dropPens(s,c),this.addCaches=[]),this.store.emitter.emit("drop",s||o),[2]}})})},this.ontouchstart=function(n){r.store.data.locked!==ze.Disable&&(r.touchStartTimer&&clearTimeout(r.touchStartTimer),r.touchStartTimer=setTimeout(function(){r.touchStart=performance.now();var o=n.touches[0].pageX-r.clientRect.x,s=n.touches[0].pageY-r.clientRect.y,h={x:o,y:s};if(r.calibrateMouse(h),r.getHover(h),r.onMouseDown({x:o,y:s,clientX:n.touches[0].clientX,clientY:n.touches[0].clientY,pageX:n.touches[0].pageX,pageY:n.touches[0].pageY,ctrlKey:n.ctrlKey||n.metaKey,shiftKey:n.shiftKey,altKey:n.altKey,buttons:1}),n.touches.length===2){r.initTouchDis=Math.hypot(n.touches[0].pageX-n.touches[1].pageX,n.touches[0].pageY-n.touches[1].pageY),r.initScale=r.store.data.scale,r.startTouches=n.touches,r.touchCenter={x:n.touches[0].pageX+(n.touches[1].pageX-n.touches[0].pageX)/2-r.clientRect.x,y:n.touches[0].pageY+(n.touches[1].pageY-n.touches[0].pageY)/2-r.clientRect.y};return}else n.touches.length===3&&(r.store.emitter.emit("contextmenu",{e:{x:o,y:s,clientX:n.touches[0].clientX,clientY:n.touches[0].clientY,pageX:n.touches[0].pageX,pageY:n.touches[0].pageY},clientRect:r.clientRect}),n.preventDefault(),n.stopPropagation());r.touchStartTimer=void 0},50))},this.ontouchmove=function(n){var o;if(r.store.data.locked!==ze.Disable){n.stopPropagation(),n.preventDefault();var s=performance.now();if(!(s-r.touchStart<50)){r.touchStart=s;var h=n.touches,l=h.length,c=n.touches[0].pageX-r.clientRect.x,f=n.touches[0].pageY-r.clientRect.y;if(l===1)r.onMouseMove({x:c,y:f,clientX:n.changedTouches[0].clientX,clientY:n.changedTouches[0].clientY,pageX:n.changedTouches[0].pageX,pageY:n.changedTouches[0].pageY,ctrlKey:n.ctrlKey||n.metaKey,shiftKey:n.shiftKey,altKey:n.altKey,buttons:1});else if(l===2&&((o=r.startTouches)===null||o===void 0?void 0:o.length)===2){if(!r.touchMoving&&!r.touchScaling){var v=r.startTouches[0].pageX-h[0].pageX,g=r.startTouches[1].pageX-h[1].pageX,y=r.startTouches[0].pageY-h[0].pageY,p=r.startTouches[1].pageY-h[1].pageY;(v>=0&&g<0||v<=0&&g>0)&&(y>=0&&p<0||y<=0&&p>0)?r.touchScaling=!0:r.touchMoving=!0}if(r.touchScaling){if(r.store.options.disableScale)return;var m=Math.hypot(h[0].pageX-h[1].pageX,h[0].pageY-h[1].pageY)/r.initTouchDis;r.scale(r.initScale*m,ce(r.touchCenter))}if(r.touchMoving){if(r.store.data.locked>=ze.DisableMove&&r.store.data.locked!==ze.DisableScale||r.store.options.disableScale)return;if(r.lastOffsetX){var m=r.store.data.scale;r.translate((c-r.lastOffsetX)/m,(f-r.lastOffsetY)/m)}r.lastOffsetX=c,r.lastOffsetY=f}}}}},this.ontouchend=function(n){if(r.store.data.locked!==ze.Disable){r.touchCenter=void 0,r.touchScaling=void 0,r.touchMoving=void 0,r.startTouches=void 0,r.lastOffsetX=0,r.lastOffsetY=0;var o=n.changedTouches[0].pageX-r.clientRect.x,s=n.changedTouches[0].pageY-r.clientRect.y;r.onMouseUp({x:o,y:s,clientX:n.changedTouches[0].clientX,clientY:n.changedTouches[0].clientY,pageX:n.changedTouches[0].pageX,pageY:n.changedTouches[0].pageY,ctrlKey:n.ctrlKey||n.metaKey,shiftKey:n.shiftKey,altKey:n.altKey,buttons:1}),setTimeout(function(){r.render()},20)}},this.onGesturestart=function(n){n.preventDefault()},this.onMouseDown=function(n){var o,s,h;if(n.buttons===2&&!r.drawingLine&&(r.mouseRight=tr.Down),r.hideInput(),r.store.data.locked===ze.Disable||n.buttons!==1&&n.buttons!==2){r.hoverType=be.None;return}if(!r.magnifierCanvas.magnifier){if(r.calibrateMouse(n),r.mousePos.x=n.x,r.mousePos.y=n.y,r.mouseDown=n,r.lastMouseTime=performance.now(),r.hotkeyType===Ke.AddAnchor){r.setAnchor(r.store.pointAt);return}if(!r.store.options.autoAnchor&&!r.drawingLine&&n.shiftKey&&n.ctrlKey&&n.altKey){r.setAnchor(r.store.pointAt),r.drawingLineName=r.store.options.drawingLineName;var l=r.store.activeAnchor;if(!l)return;var c={id:Me(),x:l.x,y:l.y};r.drawingLine=r.createDrawingLine(c);var f=lt(r.drawingLine);r.drawingLine.calculative.activeAnchor=f,_t(r.store.hover,l,r.drawingLine,c),r.drawline();return}if(!(r.hotkeyType===Ke.Translate||r.mouseRight===tr.Down&&!r.store.options.mouseRightActive)){if(r.drawingLine){if(r.store.hoverAnchor){var v=We(r.drawingLine);r.store.hoverAnchor.type===ir.Line?Do(v,r.store.hoverAnchor,r.store):(v.x=r.store.hoverAnchor.x,v.y=r.store.hoverAnchor.y),_t(r.store.hover,r.store.hoverAnchor,r.drawingLine,v),r.drawline(),r.finishDrawline(!0);return}if(!r.store.options.autoAnchor&&n.shiftKey&&n.altKey&&n.ctrlKey){r.setAnchor(r.store.pointAt);var g=We(r.drawingLine),l=r.store.activeAnchor;if(!l)return;g.x=l.x,g.y=l.y,_t(r.store.hover,l,r.drawingLine,g),r.drawline(),r.finishDrawline(!0);return}if(n.buttons===2||r.drawingLineName==="mind"&&((o=r.drawingLine)===null||o===void 0?void 0:o.calculative.worldAnchors.length)>1||r.store.options.drawingLineLength&&((s=r.drawingLine)===null||s===void 0?void 0:s.calculative.worldAnchors.length)>r.store.options.drawingLineLength){r.finishDrawline(!0),((h=r.store.active[0])===null||h===void 0?void 0:h.anchors[0].connectTo)||r.store.active.length==0?r.drawingLineName="":r.drawingLineName=r.store.options.drawingLineName;return}if(r.store.options.autoAnchor&&r.hoverType===be.Node){var y=We(r.drawingLine),l=Ma(r.store.hover,n);y.x=l.x,y.y=l.y,r.drawingLine.autoTo=!0,_t(r.store.hover,l,r.drawingLine,y),r.drawline(),r.finishDrawline(!0);return}var p=We(r.drawingLine);p.isTemp?(r.drawingLine.calculative.activeAnchor=r.drawingLine.calculative.worldAnchors[r.drawingLine.calculative.worldAnchors.length-2],p.isTemp=void 0):(r.drawingLine.calculative.activeAnchor=p,r.drawingLine.calculative.worldAnchors.push({x:p.x,y:p.y,penId:p.penId})),r.drawingLine.calculative.drawlineH=void 0,r.drawingLineName!=="polyline"&&r.drawline()}if(r.drawingLineName){if(r.hoverType===be.Node)if(r.store.options.autoAnchor){r.inactive(!0);var l=Ma(r.store.hover,n);r.store.hoverAnchor=l;var c={id:Me(),x:l.x,y:l.y};r.drawingLine=r.createDrawingLine(c),r.drawingLine.autoFrom=!0,_t(r.store.hover,l,r.drawingLine,c)}else r.inactive(),r.hoverType=be.None;else if(r.hoverType===be.NodeAnchor){r.drawingLineName=r.store.options.drawingLineName;var c={id:Me(),x:r.store.hoverAnchor.x,y:r.store.hoverAnchor.y};r.drawingLine=r.createDrawingLine(c),r.drawingLine.calculative.activeAnchor=c,_t(r.store.hover,r.store.hoverAnchor,r.drawingLine,c)}else if(!r.drawingLine&&r.drawingLineName!=="curve"){r.inactive(!0);var c={id:Me(),x:n.x,y:n.y};r.drawingLine=r.createDrawingLine(c),r.drawingLine.calculative.activeAnchor=c}}else if(r.pencil){r.inactive(!0);var m=Me(),c={x:n.x,y:n.y,id:Me(),penId:m};r.pencilLine=r.getInitPencilLine(c)}else{switch(r.hoverType){case be.None:(r.store.data.rule||r.store.options.rule)&&!r.store.options.disableRuleLine&&r.addRuleLine(n),r.store.options.resizeMode&&(r.hotkeyType=Ke.None),r.inactive();break;case be.Node:case be.Line:if(r.store.hover){var b=ri(r.store.hover,!0)||r.store.hover;n.ctrlKey&&!n.shiftKey?(b.calculative.active?r.willInactivePen=b:(b.calculative.active=!0,La(b),r.store.active.push(b),r.store.emitter.emit("active",r.store.active)),r.patchFlags=!0):n.ctrlKey&&n.shiftKey&&r.store.hover.parentId?r.active([r.store.hover]):b.calculative.active||(r.active([b]),r.store.options.resizeMode&&(r.hotkeyType=Ke.Resize)),r.calcActiveRect()}break;case be.LineAnchor:r.store.activeAnchor=r.store.hoverAnchor,r.store.hover.calculative.activeAnchor=r.store.hoverAnchor,r.active([r.store.hover]);break;case be.LineAnchorPrev:case be.LineAnchorNext:r.store.activeAnchor&&(r.prevAnchor=Lt({},r.store.activeAnchor.prev),r.nextAnchor=Lt({},r.store.activeAnchor.next));break;case be.Resize:r.activeInitPos=[],r.store.active.forEach(function(x){r.activeInitPos.push({x:(x.calculative.worldRect.x-r.activeRect.x)/r.activeRect.width,y:(x.calculative.worldRect.y-r.activeRect.y)/r.activeRect.height})});break}r.store.emitter.emit("mousedown",{x:n.x,y:n.y,pen:r.store.hover})}r.render()}}},this.onMouseMove=function(n){var o,s,h,l,c,f,v;if(r.store.data.locked===ze.Disable){r.hoverType=be.None;return}if(r.mouseDown&&!r.mouseDown.restore&&n.buttons!==1&&n.buttons!==2){r.onMouseUp(n);return}if(r.lastMouseTime){var g=performance.now();if(g-r.lastMouseTime<50){r.lastMouseTime=0;return}r.lastMouseTime=0}if(r.calibrateMouse(n),r.mousePos.x=n.x,r.mousePos.y=n.y,r.magnifierCanvas.magnifier){r.render();return}if(r.mouseDown&&!r.store.options.disableTranslate){if(r.mouseRight===tr.Down&&(r.mouseRight=tr.Translate),r.store.data.locked===ze.DisableEdit||r.store.data.locked===ze.DisableScale||r.hotkeyType===Ke.Translate||r.mouseRight===tr.Translate){var y=r.store.data.scale,p=(n.x-r.mouseDown.x)/y,m=(n.y-r.mouseDown.y)/y;n.shiftKey&&!n.ctrlKey&&(m=0),n.ctrlKey&&(p=0),r.translate(p,m);return}if(r.store.data.locked)return;if(!r.drawingLine&&!r.pencil){if(!r.drawingLineName&&!r.movingAnchor){if(r.hoverType===be.NodeAnchor){if(!r.store.hoverAnchor)return;r.drawingLineName=r.store.options.drawingLineName;var b={id:Me(),x:r.store.hoverAnchor.x,y:r.store.hoverAnchor.y};r.drawingLine=r.createDrawingLine(b),r.drawingLine.calculative.activeAnchor=b,_t(r.store.hover,r.store.hoverAnchor,r.drawingLine,b),r.drawline();return}}else if(r.drawingLineName&&r.hoverType===be.None){var b={id:Me(),x:n.x,y:n.y};r.drawingLine=r.createDrawingLine(b),r.drawingLine.calculative.activeAnchor=b,r.drawline();return}if(n.buttons===1&&!r.hoverType&&!r.hotkeyType){r.dragRect={x:Math.min(r.mouseDown.x,n.x),y:Math.min(r.mouseDown.y,n.y),ex:Math.max(r.mouseDown.x,n.x),ey:Math.max(r.mouseDown.y,n.y),width:Math.abs(n.x-r.mouseDown.x),height:Math.abs(n.y-r.mouseDown.y)},r.render();return}if(r.movingAnchor){var p=n.x-r.movingAnchor.x,m=n.y-r.movingAnchor.y;r.translateAnchor(p,m),r.render();return}else if(!(!((o=r.store.active[0])===null||o===void 0)&&o.locked)){var b={x:n.x,y:n.y};if(r.hoverType===be.LineAnchor){(r.dockInAnchor(n)||((s=r.store.active[0])===null||s===void 0?void 0:s.lineName)==="line")&&!r.store.options.disableDock&&!r.store.options.disableLineDock&&(r.clearDock(),r.dock=dd(r.store,b,r.store.activeAnchor),!((h=r.dock)===null||h===void 0)&&h.xDock&&(b.x+=r.dock.xDock.step),!((l=r.dock)===null||l===void 0)&&l.yDock&&(b.y+=r.dock.yDock.step)),r.moveLineAnchor(b,n);return}if(r.hoverType===be.LineAnchorPrev){r.moveLineAnchorPrev(n);return}if(r.hoverType===be.LineAnchorNext){r.moveLineAnchorNext(n);return}}if(r.hoverType===be.Rotate){r.rotatePens({x:n.x,y:n.y});return}if(r.hoverType===be.Resize){r.resizePens(n);return}if(r.hoverType===be.Node||r.hoverType===be.Line){var p=n.x-r.mouseDown.x,m=n.y-r.mouseDown.y,x=20;if(n.ctrlKey&&!n.shiftKey&&(Math.abs(p)>=x||Math.abs(m)>=x)&&(r.willInactivePen=void 0),r.store.active.length===1){var _=r.store.active[0];if((_.locked===void 0||_.locked<ze.DisableMove)&&((c=_==null?void 0:_.onMouseMove)===null||c===void 0||c.call(_,_,r.mousePos)),_.calculative.focus)return}r.movePens(n),r.getContainerHover(n);return}}else if(r.pencil){var b=Lt({},n);b.id=Me(),b.penId=r.pencilLine.id,r.pencilLine.calculative.worldAnchors.push(b),r.store.path2dMap.set(r.pencilLine,ke.path2dDraws[r.pencilLine.name](r.pencilLine)),r.patchFlags=!0}}if(r.drawingLine){var b=Lt({},n);if(b.id=Me(),b.penId=r.drawingLine.id,!r.store.options.disableDock&&!r.store.options.disableLineDock&&(r.clearDock(),r.dock=dd(r.store,b),!((f=r.dock)===null||f===void 0)&&f.xDock&&(b.x+=r.dock.xDock.step),!((v=r.dock)===null||v===void 0)&&v.yDock&&(b.y+=r.dock.yDock.step)),r.mouseDown&&r.drawingLineName==="curve"&&!r.drawingLine.calculative.worldAnchors[0].connectTo)r.drawline(b);else{var k=void 0;if(r.drawingLine.calculative.worldAnchors.length>1&&(k=We(r.drawingLine)),k?(k.prev=void 0,k.next=void 0,k.id||(k.id=Me()),k.x=b.x,k.y=b.y,k.connectTo=void 0):(k=Lt({},b),r.drawingLine.calculative.worldAnchors.push(k)),(r.hoverType===be.NodeAnchor||r.hoverType===be.LineAnchor)&&(r.store.hoverAnchor.type!==ir.Line&&(k.x=r.store.hoverAnchor.x,k.y=r.store.hoverAnchor.y),k.connectTo=r.store.hoverAnchor.penId,r.drawingLineName==="polyline"&&(k.isTemp=!1)),r.drawingLineName==="line"){if(n.ctrlKey&&!n.shiftKey)k.x=r.drawingLine.calculative.worldAnchors[r.drawingLine.calculative.worldAnchors.length-2].x;else if(n.shiftKey&&!n.ctrlKey)k.y=r.drawingLine.calculative.worldAnchors[r.drawingLine.calculative.worldAnchors.length-2].y;else if(n.shiftKey&&n.ctrlKey){var I=r.drawingLine.calculative.worldAnchors[r.drawingLine.calculative.worldAnchors.length-2];r.getSpecialAngle(k,I)}}r.drawline()}}globalThis.debug&&console.time("hover");var P=performance.now();P-r.hoverTimer>50&&(r.hoverTimer=P,r.getHover(n)),globalThis.debug&&console.timeEnd("hover"),r.hotkeyType===Ke.AddAnchor&&(r.patchFlags=!0),r.render(!1)},this.onMouseUp=function(n){var o,s;if(r.store.data.locked===ze.Disable){r.hoverType=be.None;return}if(!!r.mouseDown){if(r.mouseRight===tr.Down&&(r.store.hover&&r.store.hover.calculative.focus?r.store.hover.onContextmenu&&r.store.hover.onContextmenu(r.store.hover,n):r.store.emitter.emit("contextmenu",{e:n,clientRect:r.clientRect,pen:r.store.hover})),r.mouseRight=tr.None,r.calibrateMouse(n),r.mousePos.x=n.x,r.mousePos.y=n.y,r.pencil&&r.finishPencil(),r.drawingLine){if(r.store.hoverAnchor){var h=We(r.drawingLine);r.store.hoverAnchor.type===ir.Line?Do(h,r.store.hoverAnchor,r.store):(h.x=r.store.hoverAnchor.x,h.y=r.store.hoverAnchor.y),_t(r.store.hover,r.store.hoverAnchor,r.drawingLine,h),r.drawline(),r.finishDrawline(!0);return}if(r.store.options.autoAnchor&&r.hoverType===be.Node){var h=We(r.drawingLine),l=Ma(r.store.hover,n);h.x=l.x,h.y=l.y,r.drawingLine.autoTo=!0,_t(r.store.hover,l,r.drawingLine,h),r.drawline(),r.finishDrawline(!0);return}}if(r.hoverType===be.LineAnchor&&r.store.hover&&r.store.active[0]&&r.store.active[0].name==="line"&&r.store.active[0]!==r.store.hover){var c=r.store.active[0],f=lt(c),h=We(c);if(r.store.hoverAnchor){var v=r.store.hover,g=lt(v)===r.store.hoverAnchor,y=We(v)===r.store.hoverAnchor,p=f===r.store.activeAnchor,m=h===r.store.activeAnchor;if((n.ctrlKey||n.altKey)&&v.type===Ye.Line&&(g||y)&&(p||m)){var b=v.calculative.worldAnchors.map(function(I){return Lt(Lt({},I),{penId:c.id})});g?b.shift():y&&b.pop(),(g&&p||y&&m)&&b.reverse(),p?(c.calculative.worldAnchors[0].connectTo=void 0,(o=c.calculative.worldAnchors).unshift.apply(o,Di([],Li(b),!1))):m&&(c.calculative.worldAnchors[c.calculative.worldAnchors.length-1].connectTo=void 0,(s=c.calculative.worldAnchors).push.apply(s,Di([],Li(b),!1))),r.delete([v]),r.render()}else r.store.activeAnchor&&(r.store.hoverAnchor.type===ir.Line?Do(r.store.activeAnchor,r.store.hoverAnchor,r.store):(r.store.activeAnchor.x=r.store.hoverAnchor.x,r.store.activeAnchor.y=r.store.hoverAnchor.y),_t(r.store.hover,r.store.hoverAnchor,c,r.store.activeAnchor));r[c.lineName]&&c.lineName!=="polyline"&&r[c.lineName](r.store,c),r.store.path2dMap.set(c,ke.path2dDraws.line(c)),r.initLineRect(c)}else f===r.store.activeAnchor&&c.autoFrom?r.calcAutoAnchor(c,f,r.store.hover):h===r.store.activeAnchor&&c.autoTo&&r.calcAutoAnchor(c,h,r.store.hover)}if(r.addCaches&&r.addCaches.length){if(!r.store.data.locked){if(r.dragRect&&r.addCaches.length===1){var x=r.addCaches[0];x.width=r.dragRect.width/r.store.data.scale,x.height=r.dragRect.height/r.store.data.scale,n.x=(r.dragRect.x+r.dragRect.ex)/2,n.y=(r.dragRect.y+r.dragRect.ey)/2}r.dropPens(r.addCaches,n)}r.addCaches=void 0}if(r.hoverType===be.Rotate&&(r.getSizeCPs(),r.store.active.forEach(function(k){k.rotate=k.calculative.rotate})),r.patchFlagsLines.forEach(function(k){k.type&&r.initLineRect(k)}),r.patchFlagsLines.clear(),r.dragRect){var _=r.store.data.pens.filter(function(k){if(k.visible===!1||k.locked>=ze.DisableMove||k.parentId||k.isRuleLine)return!1;if(fs(k.calculative.worldRect,r.dragRect,r.store.options.dragAllIn))return k.type===Ye.Line&&!r.store.options.dragAllIn?jE(k,r.dragRect):!0});r.active(_)}n.button!==2&&(ws(r.mouseDown,n)<2&&(r.store.hover&&r.store.hover.input&&r.showInput(r.store.hover),r.store.emitter.emit("click",{x:n.x,y:n.y,pen:r.store.hover})),r.store.emitter.emit("mouseup",{x:n.x,y:n.y,pen:r.store.hover})),r.willInactivePen&&(r.willInactivePen.calculative.active=void 0,La(r.willInactivePen,!1),r.store.active.splice(r.store.active.findIndex(function(k){return k===r.willInactivePen}),1),r.calcActiveRect(),r.willInactivePen=void 0,r.store.emitter.emit("inactive",[r.willInactivePen]),r.render()),r.movingPens&&(n.altKey&&!n.shiftKey?r.copyMovedPens():r.movedActivePens(n.ctrlKey&&n.shiftKey),r.getAllByPens(r.movingPens).forEach(function(k){r.store.pens[k.id]=void 0}),r.movingPens=void 0),r.store.active&&r.store.active[0]&&(r.store.active[0].calculative.h=void 0),r.mouseDown=void 0,r.lastOffsetX=0,r.lastOffsetY=0,r.clearDock(),r.dragRect=void 0,r.initActiveRect=void 0,r.render()}},this.clearDock=function(){var n,o,s,h,l=(o=(n=r.dock)===null||n===void 0?void 0:n.xDock)===null||o===void 0?void 0:o.penId,c=(h=(s=r.dock)===null||s===void 0?void 0:s.yDock)===null||h===void 0?void 0:h.penId,f=r.store.pens[l];f&&(f.calculative.isDock=!1);var v=r.store.pens[c];v&&(v.calculative.isDock=!1),r.dock=void 0},this.onResize=function(){r.timer&&clearTimeout(r.timer),r.timer=setTimeout(function(){r.resize(),r.timer=void 0},100)},this.onScroll=function(){r.timer&&clearTimeout(r.timer),r.timer=setTimeout(function(){r.clientRect=r.canvas.getBoundingClientRect(),r.timer=void 0},100)},this.calibrateMouse=function(n){return n.x-=r.store.data.x,n.y-=r.store.data.y,n},this.getContainerHover=function(n){var o;if(!r.dragRect){var s=r.store.data.pens.filter(function(c){var f;return c.container||((f=r.store.options.containerShapes)===null||f===void 0?void 0:f.includes(c.name))});if(s.length)for(var h=s.length-1;h>=0;--h){var l=s[h];l.visible==!1||l.calculative.inView==!1||l.locked===ze.Disable||l.calculative.active||Da(n,l.calculative.worldRect)&&((o=l==null?void 0:l.onMouseMove)===null||o===void 0||o.call(l,l,n))}}},this.getHover=function(n){var o,s;if(!r.dragRect){var h=be.None;r.store.hover=void 0,r.store.hoverAnchor=void 0,r.title.hide(),r.store.pointAt=void 0,r.store.pointAtIndex=void 0;var l=r.store.active.length===1&&r.store.active[0].type;if(!r.drawingLineName&&r.hotkeyType!==Ke.AddAnchor&&r.activeRect&&!l&&!r.store.data.locked){var c=Zl(r.store.active),f=hd(r.store.active)||r.store.options.disableRotate,v=fd(r.store.active)||r.store.options.disableSize;if(!c&&!f){var g={x:r.activeRect.center.x,y:r.activeRect.y-30};r.activeRect.rotate&&Ge(g,r.activeRect.rotate,r.activeRect.center),!r.hotkeyType&&Ia(n,g,r.pointSize)&&(h=be.Rotate,r.externalElements.style.cursor='url("'+r.store.options.rotateCursor+'"), auto')}if(!c&&!v)for(var y=0;y<8;y++){var p=y<4,m=r.hotkeyType===Ke.Resize||p&&!r.hotkeyType;if(m&&Ia(n,r.sizeCPs[y],r.pointSize)){var b=p?ed:td,x=0;Math.abs(r.activeRect.rotate%90-45)<25?(b=p?td:ed,x=Math.round((r.activeRect.rotate-45)/90)+(p?0:1)):x=Math.round(r.activeRect.rotate/90),h=be.Resize,r.resizeIndex=y,r.externalElements.style.cursor=b[(y+x)%4];break}}}h===be.None&&(h=r.inPens(n,r.store.data.pens)),!h&&!l&&Da(n,r.activeRect)&&(h=be.Node,r.externalElements.style.cursor="move"),r.hoverType=h,h===be.None&&(r.drawingLineName||r.pencil?r.externalElements.style.cursor="crosshair":r.mouseDown||(r.externalElements.style.cursor="default"),r.store.hover=void 0),r.store.lastHover!==r.store.hover&&(r.patchFlags=!0,r.store.lastHover&&(r.store.lastHover.calculative.hover=!1,yn(ri(r.store.lastHover,!0)||r.store.lastHover,!1),r.store.emitter.emit("leave",r.store.lastHover),r.tooltip.hide()),r.store.hover&&(r.store.hover.calculative.hover=!0,yn(ri(r.store.hover,!0)||r.store.hover),r.store.emitter.emit("enter",r.store.hover),r.tooltip.show(r.store.hover,n)),r.store.lastHover=r.store.hover),(s=(o=r.store.hover)===null||o===void 0?void 0:o.onMouseMove)===null||s===void 0||s.call(o,r.store.hover,r.mousePos)}},this.inPens=function(n,o){var s,h=be.None,l=function(v){var g,y,p,m,b=o[v];if(b.visible==!1||b.calculative.inView==!1||b.locked===ze.Disable)return"continue";var x=vs(b);if(!b.calculative.active&&!ea(n,b.calculative.worldRect,x)&&!Da(n,b.calculative.worldRect))return"continue";if(!r.store.data.locked&&r.hotkeyType!==Ke.Resize&&b.calculative.worldAnchors)try{for(var _=(g=void 0,at(b.calculative.worldAnchors)),k=_.next();!k.done;k=_.next()){var I=k.value;if(h=r.inAnchor(n,b,I),h){var P=ce(I);return Object.assign(P,n),r.title.show(P,b),"break-outer"}}}catch(ee){g={error:ee}}finally{try{k&&!k.done&&(y=_.return)&&y.call(_)}finally{if(g)throw g.error}}if(b.type){if(b.isRuleLine){var M=((s=r.store.options.ruleOptions)===null||s===void 0?void 0:s.height)||20;if(n.x+r.store.data.x>M&&n.y+r.store.data.y>M)return"break"}var L=WE(n,b);if(L)return!r.store.data.locked&&!b.locked?r.hotkeyType===Ke.AddAnchor?r.externalElements.style.cursor="pointer":r.externalElements.style.cursor="move":r.externalElements.style.cursor=r.store.options.hoverCursor,b.calculative.disabled&&(r.externalElements.style.cursor="not-allowed"),r.store.hover=b,r.store.pointAt=L.point,r.store.pointAtIndex=L.i,r.initTemplateCanvas([r.store.hover]),h=be.Line,"break"}else{if(b.children){var U=[];if(b.children.forEach(function(ee){r.store.pens[ee]&&U.push(r.store.pens[ee])}),h=r.inPens(n,U),h)return"break"}var $=!1;if(b.name==="line"?$=ea(n,b.calculative.worldRect,b.lineWidth):$=Da(n,b.calculative.worldRect),$){if(b.type===Ye.Node&&b.name==="line"){var S=aE(n,b.calculative.worldAnchors);if(!S)return"continue"}if(!r.store.data.locked&&!b.locked?r.hotkeyType===Ke.AddAnchor?r.externalElements.style.cursor="pointer":r.externalElements.style.cursor="move":r.externalElements.style.cursor=r.store.options.hoverCursor,b.calculative.disabled&&(r.externalElements.style.cursor="not-allowed"),r.store.hover=b,r.initTemplateCanvas([r.store.hover]),h=be.Node,r.store.pointAt=n,!n.ctrlKey){var T=r.store.hover.calculative.worldRect,R=T.x,O=T.y,K=T.ex,G=T.ey,ae=T.rotate,V=T.center;if(ae){var F=[{x:R,y:O},{x:K,y:O},{x:K,y:G},{x:R,y:G}];F.forEach(function(ee){Ge(ee,ae,V)});var q=F[F.length-1];try{for(var Y=(p=void 0,at(F)),W=Y.next();!W.done;W=Y.next()){var J=W.value;if(q.y>n.y!=J.y>n.y){var re=J.x+(n.y-J.y)*(q.x-J.x)/(q.y-J.y);Math.abs(re-r.store.pointAt.x)<10&&(r.store.pointAt.x=re)}q=J}}catch(ee){p={error:ee}}finally{try{W&&!W.done&&(m=Y.return)&&m.call(Y)}finally{if(p)throw p.error}}}else r.store.pointAt.x-10<R?r.store.pointAt.x=R:r.store.pointAt.x+10>K&&(r.store.pointAt.x=K),r.store.pointAt.y-10<O?r.store.pointAt.y=O:r.store.pointAt.y+10>G&&(r.store.pointAt.y=G)}return"break"}}};e:for(var c=o.length-1;c>=0;--c){var f=l(c);if(f==="break")break;switch(f){case"break-outer":break e}}return h},this.dockInAnchor=function(n){var o,s,h,l;r.store.hover=void 0;for(var c=r.store.data.pens.length-1;c>=0;--c){var f=r.store.data.pens[c];if(!(f.visible==!1||f.locked===ze.Disable||f===r.store.active[0])){var v=vs(f);if(v+=2*r.store.options.anchorRadius,!!ea(n,f.calculative.worldRect,v)&&(r.store.hover=f,r.hotkeyType!==Ke.Resize&&f.calculative.worldAnchors))try{for(var g=(o=void 0,at(f.calculative.worldAnchors)),y=g.next();!y.done;y=g.next()){var p=y.value;if(p.twoWay===At.In){var m=We(r.store.active[0]);if(r.store.activeAnchor.id!==m.id)continue}if(p.twoWay===At.Out){var b=lt(r.store.active[0]);if(r.store.activeAnchor.id!==b.id)continue}if(!(p.twoWay===At.DisableConnected||p.twoWay===At.Disable||((h=r.store.activeAnchor)===null||h===void 0?void 0:h.twoWay)===At.DisableConnectTo||((l=r.store.activeAnchor)===null||l===void 0?void 0:l.twoWay)===At.Disable)&&(r.title.hide(),r.inAnchor(n,f,p))){var x=ce(p);return Object.assign(x,n),r.title.show(x,f),!0}}}catch(_){o={error:_}}finally{try{y&&!y.done&&(s=g.return)&&s.call(g)}finally{if(o)throw o.error}}}}},this.render=function(n){if(n&&(r.opening=!1),!r.opening){var o;if(n==null||n===!0||n===1/0?(o=performance.now(),r.patchFlags=!0):n>1?o=n:o=performance.now(),!!r.patchFlags){if(o-r.lastRender<r.store.options.interval){r.renderTimer&&cancelAnimationFrame(r.renderTimer),r.renderTimer=requestAnimationFrame(r.render);return}r.renderTimer=void 0,r.lastRender=o;var s=r.offscreen.getContext("2d");s.clearRect(0,0,r.offscreen.width,r.offscreen.height),s.save(),s.translate(r.store.data.x,r.store.data.y),globalThis.debugRender&&console.time("renderPens"),r.renderPens(),globalThis.debugRender&&console.timeEnd("renderPens"),r.renderBorder(),r.renderHoverPoint(),s.restore(),r.magnifierCanvas.render();var h=r.canvas.getContext("2d");h.clearRect(0,0,r.canvas.width,r.canvas.height),h.drawImage(r.offscreen,0,0,r.width,r.height),r.canvasTemplate.render(),r.canvasImageBottom.render(),r.canvasImage.render(),r.patchFlags=!1}}},this.renderPens=function(){var n,o,s=r.offscreen.getContext("2d");s.strokeStyle=us(r.store);try{for(var h=at(r.store.data.pens),l=h.next();!l.done;l=h.next()){var c=l.value;!isFinite(c.x)||c.canvasLayer!==Ne.CanvasTemplate&&c.calculative.inView&&(c.canvasLayer===Ne.CanvasMain&&c.name!=="gif"&&c.image&&c.calculative.img&&(s.save(),Qr(s,c),c.calculative.rotate&&or(s,c),Jr(s,c),Fa(s,c),s.restore()),jr(s,c))}}catch(f){n={error:f}}finally{try{l&&!l.done&&(o=h.return)&&o.call(h)}finally{if(n)throw n.error}}r.drawingLine&&jr(s,r.drawingLine),r.pencilLine&&jr(s,r.pencilLine),r.movingPens&&r.movingPens.forEach(function(f){r.renderPenContainChild(s,f)})},this.renderPenContainChild=function(n,o){var s;o.calculative.inView&&jr(n,o),(s=o.children)===null||s===void 0||s.forEach(function(h){var l=r.store.pens[h];l&&r.renderPenContainChild(n,l)})},this.renderBorder=function(){if(!r.store.data.locked&&r.activeRect&&!(r.store.active.length===1&&r.store.active[0].type)&&!r.movingPens){var n=r.offscreen.getContext("2d");if(n.save(),n.translate(.5,.5),r.activeRect.rotate&&(n.translate(r.activeRect.center.x,r.activeRect.center.y),n.rotate(r.activeRect.rotate*Math.PI/180),n.translate(-r.activeRect.center.x,-r.activeRect.center.y)),n.strokeStyle=r.store.options.activeColor,n.globalAlpha=r.store.options.activeGlobalAlpha===void 0?.3:r.store.options.activeGlobalAlpha,n.beginPath(),n.lineWidth=r.store.options.activeLineWidth||1,n.setLineDash(r.store.options.activeLineDash||[]),n.strokeRect(r.activeRect.x,r.activeRect.y,r.activeRect.width,r.activeRect.height),n.setLineDash([]),n.lineWidth=1,n.globalAlpha=1,Zl(r.store.active)||hd(r.store.active)||r.store.options.disableRotate){n.restore();return}n.beginPath(),n.moveTo(r.activeRect.center.x,r.activeRect.y),n.lineTo(r.activeRect.center.x,r.activeRect.y-30),n.stroke(),n.beginPath(),n.strokeStyle=r.store.options.activeColor,n.fillStyle="#ffffff",n.arc(r.activeRect.center.x,r.activeRect.y-30,5,0,Math.PI*2),n.fill(),n.stroke(),n.restore()}},this.renderHoverPoint=function(){if(!r.store.data.locked){var n=r.offscreen.getContext("2d");if(n.save(),n.translate(.5,.5),!r.store.options.disableAnchor&&r.store.hover&&!r.store.hover.disableAnchor&&(r.hotkeyType!==Ke.Resize||r.store.active.length!==1||r.store.active[0]!==r.store.hover)){var o=Di([],Li(r.store.hover.calculative.worldAnchors),!1);r.store.pointAt&&r.hotkeyType===Ke.AddAnchor&&o.push(r.store.pointAt),o&&(n.strokeStyle=r.store.hover.anchorColor||r.store.options.anchorColor,n.fillStyle=r.store.hover.anchorBackground||r.store.options.anchorBackground,o.forEach(function(s){if(!(s.hidden&&s.locked>ze.DisableEdit)){if(s===r.store.hoverAnchor){n.save();var h=r.store.hover.hoverAnchorColor||r.store.options.hoverAnchorColor;n.strokeStyle=h,n.fillStyle=h}n.beginPath();var l=s.radius||r.store.hover.anchorRadius||r.store.options.anchorRadius;if(r.store.hover.type&&!s.radius&&!r.store.hover.anchorRadius&&(l=3,r.store.hover.calculative.lineWidth>3&&(l=r.store.hover.calculative.lineWidth)),s.type===ir.Line){var c=r.store.pens[s.penId].rotate||0;r.store.pens[s.penId].calculative.flipX&&(c*=-1),r.store.pens[s.penId].calculative.flipY&&(c*=-1);var f=s.rotate+c;r.store.pens[s.penId].calculative.flipX&&(f*=-1),r.store.pens[s.penId].calculative.flipY&&(f*=-1),n.save(),n.translate(s.x,s.y),n.rotate(f*Math.PI/180),n.translate(-s.x,-s.y),n.rect(s.x-s.length*r.store.data.scale/2,s.y-l,s.length*r.store.data.scale,l*2),n.restore()}else n.arc(s.x,s.y,l,0,Math.PI*2);if(r.store.hover.type&&r.store.hoverAnchor===s?(n.save(),n.strokeStyle=r.store.hover.activeColor||r.store.options.activeColor,n.fillStyle=n.strokeStyle):(s.color||s.background)&&(n.save(),n.strokeStyle=s.color,n.fillStyle=s.background),n.fill(),n.stroke(),s===r.store.hoverAnchor&&n.restore(),(r.store.hover.type&&r.store.hoverAnchor===s||s.color||s.background)&&n.restore(),!r.store.hover.parentId&&r.store.hover.children&&r.store.hover.children.length>0&&s===r.store.hoverAnchor){n.save(),n.beginPath(),n.lineWidth=3;var h=r.store.hover.hoverAnchorColor||r.store.options.hoverAnchorColor;globalThis.pSBC&&(n.strokeStyle=globalThis.pSBC(.5,h)),n.arc(s.x,s.y,l+1.5,0,Math.PI*2),n.stroke(),n.restore()}}}))}r.hotkeyType!==Ke.AddAnchor&&!r.movingPens&&r.activeRect&&!(r.store.active.length===1&&r.store.active[0].type)&&!Zl(r.store.active)&&!fd(r.store.active)&&!r.store.options.disableSize&&(n.strokeStyle=r.store.options.activeColor,n.fillStyle="#ffffff",r.sizeCPs.forEach(function(s,h){r.activeRect.rotate&&(n.save(),n.translate(s.x,s.y),n.rotate(r.activeRect.rotate*Math.PI/180),n.translate(-s.x,-s.y)),(h<4||r.hotkeyType===Ke.Resize)&&(n.beginPath(),n.fillRect(s.x-4.5,s.y-4.5,8,8),n.strokeRect(s.x-5.5,s.y-5.5,10,10)),r.activeRect.rotate&&n.restore()})),!r.store.data.locked&&r.dragRect&&(n.save(),n.fillStyle=ls(r.store.options.dragColor,.2),n.strokeStyle=r.store.options.dragColor,n.beginPath(),n.strokeRect(r.dragRect.x,r.dragRect.y,r.dragRect.width,r.dragRect.height),n.fillRect(r.dragRect.x,r.dragRect.y,r.dragRect.width,r.dragRect.height),n.restore()),r.dock&&(n.strokeStyle=r.store.options.dockColor,r.dock.xDock&&(n.beginPath(),n.moveTo(r.dock.xDock.x,r.dock.xDock.y),n.lineTo(r.dock.xDock.x,r.dock.xDock.prev.y),n.stroke()),r.dock.yDock&&(n.beginPath(),n.moveTo(r.dock.yDock.x,r.dock.yDock.y),n.lineTo(r.dock.yDock.prev.x,r.dock.yDock.y),n.stroke())),n.restore()}},this.pastePen=function(n,o){var s,h,l=n.id;if(vd(n),n.parentId=o,n.type===Ye.Line?r.changeNodeConnectedLine(l,n,r.store.clipboard.pens):r.changeLineAnchors(l,n,r.store.clipboard.pens),!n.parentId){var c=r.getPenRect(n,r.store.clipboard.origin,r.store.clipboard.scale),f=r.getPenRect(r.store.clipboard.initRect,r.store.clipboard.origin,r.store.clipboard.scale),v=r.store.data,g=v.origin,y=v.scale;n.x=g.x+c.x*y,n.y=g.y+c.y*y,n.width=c.width*y,n.height=c.height*y,f.x=g.x+f.x*y,f.y=g.y+f.y*y,tt(f),r.store.clipboard.pos&&(n.x-=f.center.x-r.store.clipboard.pos.x,n.y-=f.center.y-r.store.clipboard.pos.y),r.keyOptions&&r.keyOptions.altKey&&(r.keyOptions.ctrlKey||r.keyOptions.metaKey)?(n.x=-r.store.data.x+r.width/2-n.width/2,n.y=-r.store.data.y+r.height/2-n.height/2):r.keyOptions&&r.keyOptions.shiftKey&&(r.keyOptions.ctrlKey||r.keyOptions.metaKey)||(n.x+=r.store.clipboard.offset*r.store.data.scale,n.y+=r.store.clipboard.offset*r.store.data.scale)}r.makePen(n);var p=[];if(Array.isArray(n.children)){var m=function(k){var I=r.store.clipboard.pens.find(function(P){return P.id===k});I&&p.push(r.pastePen(I,n.id).id)};try{for(var b=at(n.children),x=b.next();!x.done;x=b.next()){var _=x.value;m(_)}}catch(k){s={error:k}}finally{try{x&&!x.done&&(h=b.return)&&h.call(b)}finally{if(s)throw s.error}}}return n.children=p,Cr(n,!0),n},this.ondblclick=function(n){r.store.hover&&(!r.store.data.locked||r.store.hover.dbInput)&&!r.store.options.disableInput&&(r.store.hover.onShowInput?r.store.hover.onShowInput(r.store.hover,n):r.showInput(r.store.hover)),r.store.emitter.emit("dblclick",{x:n.x,y:n.y,pen:r.store.hover})},this.showInput=function(n,o,s){if(s===void 0&&(s="transparent"),!(!window||!r.store.hover||r.store.hover.locked||r.store.hover.externElement||r.store.hover.disableInput||r.store.hover.disabled)){if(r.inputDiv.dataset.penId===n.id){r.inputDiv.dataset.isInput="true",r.inputDiv.contentEditable="true",r.inputDiv.focus();var h=window.getSelection();h.selectAllChildren(r.inputDiv),h.collapseToEnd(),r.inputDiv.scrollTop=r.inputDiv.scrollHeight,r.inputDiv.scrollLeft=r.inputDiv.scrollWidth;return}!o&&!n.dbInput?r.setInputStyle(n):(r.inputDiv.style.width="100%",r.inputDiv.style.height="100%");var l=o||n.calculative.worldTextRect,c=n.calculative.tempText===void 0?n.text+""||"":n.calculative.tempText,f=c.replace(/\x20/g," ").split(/[\s\n]/),v=(f.join("</div><div>")+"</div>").replace("</div>","").replace(/\<div\>\<\/div\>/g,"<div><br></div>");r.inputDiv.innerHTML=v,r.inputParent.style.left=l.x+r.store.data.x-(n.textLeft||0)+"px",r.inputParent.style.top=l.y+r.store.data.y-(n.textTop||0)+"px";var g=l.width+(n.textLeft||0);r.inputParent.style.width=(g<0?12:g)+"px",r.inputParent.style.height=l.height+(n.textTop||0)+"px",r.inputParent.style.zIndex="9999",r.inputParent.style.background=s,n.rotate%360?r.inputParent.style.transform="rotate("+n.rotate+"deg)":r.inputParent.style.transform=null,r.inputParent.style.display="flex",r.inputDiv.dataset.penId=n.id,r.inputDiv.contentEditable=n.disableInput==null?"true":n.disableInput.toString(),n.dropdownList&&r.dropdown.style.display!=="block"?(r.store.data.locked||(r.inputRight.style.display="none"),r.setDropdownList()):r.inputRight.style.display="none",r.inputDiv.contentEditable="true",r.inputDiv.focus();var y=window.getSelection();y.selectAllChildren(r.inputDiv),y.collapseToEnd(),r.inputDiv.scrollTop=r.inputDiv.scrollHeight,r.inputDiv.scrollLeft=r.inputDiv.scrollWidth,n.calculative.text=void 0,r.initTemplateCanvas([n]),r.render()}},this.setInputStyle=function(n){n.text||(n.text="");for(var o,s=0;s<document.styleSheets.length;s++)document.styleSheets[s].title==="le5le.com"&&(o=document.styleSheets[s]);var h="overflow: scroll;",l="",c=1,f=r.store.data.scale;if(n.fontSize<12&&(c=12/n.fontSize),n.textAlign?h+="text-align: "+n.textAlign+";":h+="text-align: center;",n.textAlign&&n.whiteSpace==="pre-line"){var v={left:"start",center:"center",right:"end"};h+="align-items: "+v[n.textAlign]+";"}if(n.textBaseline){var g={top:"start",middle:"center",bottom:"end"};h+="justify-content: "+g[n.textBaseline]+";"}else h+="justify-content: center;";if(n.fontFamily&&(h+="font-family: "+n.fontFamily+";"),n.fontSize&&(n.fontSize*f<12?(h+="font-size:"+n.fontSize+"px;",h+="zoom:"+n.fontSize/12*f+";"):h+="font-size:"+n.fontSize*f+"px;"),h+="color:"+Ir(n,r.store)+";",n.fontStyle&&(h+="font-style: "+n.fontStyle+";"),n.fontWeight&&(h+="font-weight: "+n.fontWeight+";"),n.textLeft&&(h+="margin-left:"+(f>1?n.textLeft*c:n.textLeft*c/f)+"px;"),n.textTop&&(h+="margin-top:"+(f>1?n.textTop*c:n.textTop*c/f)+"px;"),n.lineHeight&&(h+="line-height:"+(f>1?n.fontSize*n.lineHeight*f:n.fontSize*n.lineHeight*c)+"px;"),n.textHeight)h+="height:"+(f>1?n.textHeight*c*f:n.textHeight*c)+"px;";else{var y=n.calculative.worldRect.height/f-(n.textTop||0);y<0&&(y=0);var p=n.fontSize*f<12?y*c:y*f*c;p<n.fontSize*n.lineHeight*f&&(p=n.fontSize*n.lineHeight*f,h+="top:-"+p/2+"px;"),h+="height:"+p+"px;"}var m=null;if(n.textWidth)m=n.textWidth<1&&n.textWidth>-1?n.textWidth*n.calculative.worldRect.width:n.textWidth,n.whiteSpace!=="pre-line"&&(m<n.fontSize?h+="width:"+n.fontSize*1.2*c+"px;":h+="width:"+(f>1?m*c*f:m*c)+"px;");else if(n.whiteSpace===void 0||n.whiteSpace==="break-all"){var y=(n.calculative.worldTextRect.width||12)/f;y<0&&(y=0),h+="width:"+(n.fontSize*f<12?y*c:y*f)+"px;"}if(n.whiteSpace&&(n.whiteSpace==="pre-line"?h+="white-space:pre;":(h+="white-space:"+n.whiteSpace+";",n.whiteSpace==="nowrap"&&(l+="display:contents;"))),n.whiteSpace!=="nowrap"){var b=n.fontSize*1.2*n.text.length,x=(m||n.calculative.worldRect.width/f)*Math.floor(n.calculative.worldRect.height/f/(n.lineHeight*n.fontSize));b>x&&(h+="justify-content: start;")}o.deleteRule(0),o.deleteRule(0),o.insertRule(`.meta2d-input
- .input-div{
- resize:none;border:none;outline:none;background:transparent;position:absolute;flex-grow:1;height:100%;width: 100%;position:absolute;left:0;top:0;display:flex;flex-direction: column;cursor: text;`+h+"}"),o.insertRule(".input-div div{"+l+"}")},this.hideInput=function(){if(r.inputParent.style.display==="flex"){r.inputParent.style.display="none";var n=r.store.pens[r.inputDiv.dataset.penId];if(!n)return;if(n.calculative.text=n.text,r.inputDiv.dataset.value=r.inputDiv.innerHTML.replace(/\<div\>/g,`
- `).replace(/\<\/div\>/g,"").replace(/\<br\>/g,"").replace(/ /g," ").replace(/(<([^>]+)>)/gi,""),r.inputDiv.dataset.value=r.convertSpecialCharacter(r.inputDiv.dataset.value),n.onInput)n.onInput(n,r.inputDiv.dataset.value);else if(n.text!==r.inputDiv.dataset.value){var o=[ce(n,!0)];n.text=r.inputDiv.dataset.value,n.calculative.text=n.text,r.inputDiv.dataset.penId=void 0,n.name==="text"&&n.textAutoAdjust&&n2(n),Ni(n),r.patchFlags=!0,r.pushHistory({type:we.Update,pens:[ce(n,!0)],initPens:o}),r.store.emitter.emit("valueUpdate",n)}else n.text===r.inputDiv.dataset.value&&n.calculative.textLines.length==0&&Ni(n);r.initTemplateCanvas([n])}r.inputDiv.dataset.penId=void 0,r.dropdown.style.display="none",r.inputDiv.dataset.isInput="false",r.inputDiv.contentEditable="false",r.render()},this.setDropdownList=function(n){var o,s;r.clearDropdownList();var h=r.store.pens[r.inputDiv.dataset.penId];if(!(!r.store.data.locked&&!["table"].includes(h.name))){if(r.dropdown.style.display="block",r.inputRight.style.display="block",setTimeout(function(){r.inputRight.style.transform="rotate(315deg)",r.inputRight.style.zoom=r.store.data.scale}),!h||!h.dropdownList){r.dropdown.style.display="none",r.inputRight.style.display="none",r.inputRight.style.transform="rotate(135deg)";return}if(!h.dropdownList.length){var l=document.createElement("div");l.innerText="None",l.style.padding="5px 12px",l.style.color="#ddd",r.dropdown.appendChild(l);return}var c=r.inputDiv.innerHTML.replace(/\<div\>/g,`
- `).replace(/\<\/div\>/g,"").replace(/\<br\>/g,""),f=0;try{for(var v=at(h.dropdownList),g=v.next();!g.done;g=v.next()){var y=g.value,p=typeof y=="string"?y:y.text;n&&c?p.includes(c)&&r.dropdownAppendOption(p,f):r.dropdownAppendOption(p,f),++f}}catch(m){o={error:m}}finally{try{g&&!g.done&&(s=v.return)&&s.call(v)}finally{if(o)throw o.error}}if(!r.dropdown.hasChildNodes()){var l=document.createElement("div");l.innerText="None",l.style.padding="5px 12px",l.style.color="#ddd",r.dropdown.appendChild(l)}}},this.selectDropdown=function(n){var o=n.target,s=r.store.pens[r.inputDiv.dataset.penId];if(!(!o||!s||!s.dropdownList)){var h=+o.dataset.i,l=s.dropdownList[h];if(!!l){var c=[ce(s,!0)];typeof l=="object"?(r.updateValue(s,Lt({},l)),s.calculative.text=void 0,r.calcActiveRect()):s.text=l+"",r.inputDiv.innerText=s.text,r.hideInput(),r.pushHistory({type:we.Update,pens:[ce(s,!0)],initPens:c}),r.render(),r.store.emitter.emit("valueUpdate",s)}}},this.canvasTemplate=new Lk(i,a),this.canvasTemplate.canvas.style.zIndex="1",this.canvasImageBottom=new Ld(i,a,!0),this.canvasImageBottom.canvas.style.zIndex="2",i.appendChild(this.canvas),this.canvas.style.position="absolute",this.canvas.style.backgroundRepeat="no-repeat",this.canvas.style.backgroundSize="100% 100%",this.canvas.style.zIndex="3",this.canvasImage=new Ld(i,a),this.canvasImage.canvas.style.zIndex="4",this.magnifierCanvas=new Tk(this,i,a),this.magnifierCanvas.canvas.style.zIndex="5",this.externalElements.style.position="absolute",this.externalElements.style.left="0",this.externalElements.style.top="0",this.externalElements.style.outline="none",this.externalElements.style.background="transparent",this.externalElements.style.zIndex="5",i.style.position="relative",i.appendChild(this.externalElements),this.createInput(),this.tooltip=new Sk(i,a),this.tooltip.box.onmouseleave=function(n){r.patchFlags=!0,r.store.lastHover&&(r.store.lastHover.calculative.hover=!1);var o=r.store.data.pens.find(function(s){return s.calculative.hover===!0});yn(o,!1)},this.dialog=new Rk(i),this.title=new Pk(i),this.store.options.scroll&&(this.scroll=new Sg(this)),this.store.dpiRatio=globalThis.devicePixelRatio||1,this.store.dpiRatio<1?this.store.dpiRatio=1:this.store.dpiRatio>1&&this.store.dpiRatio<1.5&&(this.store.dpiRatio=1.5),this.clientRect=this.externalElements.getBoundingClientRect(),this.listen(),window==null||window.addEventListener("resize",this.onResize),window==null||window.addEventListener("scroll",this.onScroll)}return e.prototype.listen=function(){var t=this;switch(this.externalElements.addEventListener("gesturestart",this.onGesturestart),this.externalElements.ondragover=function(i){return i.preventDefault()},this.externalElements.ondrop=this.ondrop,this.externalElements.oncontextmenu=function(i){return i.preventDefault()},this.store.options.interval=50,this.externalElements.ontouchstart=this.ontouchstart,this.externalElements.ontouchmove=this.ontouchmove,this.externalElements.ontouchend=this.ontouchend,this.externalElements.onmousedown=function(i){t.onMouseDown({x:i.offsetX,y:i.offsetY,clientX:i.clientX,clientY:i.clientY,pageX:i.pageX,pageY:i.pageY,ctrlKey:i.ctrlKey||i.metaKey,shiftKey:i.shiftKey,altKey:i.altKey,buttons:i.buttons})},this.externalElements.onmousemove=function(i){i.target===t.externalElements&&t.onMouseMove({x:i.offsetX,y:i.offsetY,clientX:i.clientX,clientY:i.clientY,pageX:i.pageX,pageY:i.pageY,ctrlKey:i.ctrlKey||i.metaKey,shiftKey:i.shiftKey,altKey:i.altKey,buttons:i.buttons})},this.externalElements.onmouseup=function(i){t.onMouseUp({x:i.offsetX,y:i.offsetY,clientX:i.clientX,clientY:i.clientY,pageX:i.pageX,pageY:i.pageY,ctrlKey:i.ctrlKey||i.metaKey,shiftKey:i.shiftKey,altKey:i.altKey,buttons:i.buttons,button:i.button})},this.externalElements.onmouseleave=function(i){t.store.data.pens.forEach(function(a){a.calculative.hover&&(a.calculative.hover=!1)}),t.store.hover&&(t.store.hover.calculative.hover=!1,t.store.hover=void 0),t.render(),i.toElement!==t.tooltip.box&&i.toElement!==t.tooltip.arrowUp&&i.toElement!==t.tooltip.arrowDown&&(t.tooltip.hide(),t.store.lastHover=void 0)},this.externalElements.ondblclick=this.ondblclick,this.externalElements.tabIndex=0,this.externalElements.onblur=function(){t.mouseDown=void 0},this.externalElements.onwheel=this.onwheel,document.addEventListener("copy",this.onCopy),document.addEventListener("cut",this.onCut),document.addEventListener("paste",this.onPaste),this.store.options.keydown){case $r.Document:document.addEventListener("keydown",this.onkeydown),document.addEventListener("keyup",this.onkeyup);break;case $r.Canvas:this.externalElements.addEventListener("keydown",this.onkeydown),this.externalElements.addEventListener("keyup",this.onkeyup);break}},e.prototype.splitLine=function(t,i){var a=t.calculative.worldAnchors,r=a.findIndex(function(c){return c===i});if(![-1,0,a.length-1].includes(r)){var n=ce(t,!0),o=ce(t,!0),s=Me();o.id=s,o.calculative.canvas=this,o.calculative.active=!1,o.calculative.hover=!1;var h=ce(a.slice(0,r+1)),l=ce(a.slice(r)).map(function(c){return c.penId=s,c});t.calculative.worldAnchors=h,o.calculative.worldAnchors=l,this.initLineRect(t),this.initLineRect(o),this.store.data.pens.push(o),this.store.pens[s]=o,this.pushHistory({type:we.Add,pens:[ce(o,!0)],step:2}),this.pushHistory({type:we.Update,initPens:[n],pens:[ce(t,!0)],step:2})}},e.prototype.translateAnchor=function(t,i){var a=this;this.movingAnchor.x+=t,this.movingAnchor.y+=i;var r=this.movingAnchor.penId;if(r){var n=this.store.pens[r],o=n.calculative.worldRect;this.movingAnchor.x<o.x?this.movingAnchor.x=o.x:this.movingAnchor.x>o.ex&&(this.movingAnchor.x=o.ex),this.movingAnchor.y<o.y?this.movingAnchor.y=o.y:this.movingAnchor.y>o.ey&&(this.movingAnchor.y=o.ey);var s=xn(this.movingAnchor,o),h=n.anchors.findIndex(function(l){return l.id===a.movingAnchor.id});n.anchors[h]=s,this.patchFlags=!0}},e.prototype.fileToPen=function(t,i){return Ei(this,void 0,void 0,function(){var a;return ki(this,function(r){switch(r.label){case 0:return a="",this.store.options.uploadFn?[4,this.store.options.uploadFn(t)]:[3,2];case 1:return a=r.sent(),[3,6];case 2:return this.store.options.uploadUrl?[4,c2(t,this.store.options.uploadUrl,this.store.options.uploadParams,this.store.options.uploadHeaders)]:[3,4];case 3:return a=r.sent(),[3,6];case 4:return[4,l2(t)];case 5:a=r.sent(),r.label=6;case 6:return[2,new Promise(function(n,o){var s=new Image;s.onload=function(){ke.htmlElements[a]=s,n({width:s.width,height:s.height,name:i?"gif":"image",image:a})},s.onerror=function(h){o(h)},s.crossOrigin="anonymous",s.src=a})]}})})},e.prototype.dropPens=function(t,i){var a;return Ei(this,void 0,void 0,function(){var r,n,x,o,s,x,h,l,x,c,f,x,v,g,y,p,m,b,x,_,k,I,P,M,L,U,$,S,T,R,O=this;return ki(this,function(K){switch(K.label){case 0:this.randomIdObj={};try{for(r=at(t),n=r.next();!n.done;n=r.next())x=n.value,!x.parentId&&this.randomCombineId(x,t)}catch(G){k={error:G}}finally{try{n&&!n.done&&(I=r.return)&&I.call(r)}finally{if(k)throw k.error}}if(Object.keys(this.randomIdObj).length!==0)try{for(o=at(t),s=o.next();!s.done;s=o.next())x=s.value,x.type?(x.anchors[0].connectTo=this.randomIdObj[x.anchors[0].connectTo],x.anchors[x.anchors.length-1].connectTo=this.randomIdObj[x.anchors[x.anchors.length-1].connectTo]):(a=x.connectedLines)===null||a===void 0||a.forEach(function(G){G.lineAnchor=O.randomIdObj[G.lineAnchor],G.lineId=O.randomIdObj[G.lineId]})}catch(G){P={error:G}}finally{try{s&&!s.done&&(M=o.return)&&M.call(o)}finally{if(P)throw P.error}}try{for(h=at(t),l=h.next();!l.done;l=h.next())x=l.value,x.id||(x.id=Me()),!x.calculative&&(x.calculative={canvas:this}),this.store.pens[x.id]=x}catch(G){L={error:G}}finally{try{l&&!l.done&&(U=h.return)&&U.call(h)}finally{if(L)throw L.error}}try{for(c=at(t),f=c.next();!f.done;f=c.next())x=f.value,x.parentId||(x.width*=this.store.data.scale,x.height*=this.store.data.scale,x.x=i.x-x.width/2,x.y=i.y-x.height/2,x.tags&&x.tags.includes("meta3d")&&(x.x=this.store.data.origin.x,x.y=this.store.data.origin.y))}catch(G){$={error:G}}finally{try{f&&!f.done&&(S=c.return)&&S.call(c)}finally{if($)throw $.error}}if(v=this.store.data.width||this.store.options.width,g=this.store.data.height||this.store.options.height,v&&g){y={x:this.store.data.origin.x,y:this.store.data.origin.y,width:v*this.store.data.scale,height:g*this.store.data.scale},p=!0;try{for(m=at(t),b=m.next();!b.done;b=m.next())if(x=b.value,!x.parentId&&(_=[{x:x.x,y:x.y},{x:x.x+x.width,y:x.y},{x:x.x,y:x.y+x.height},{x:x.x+x.width,y:x.y+x.height},{x:x.x+x.width/2,y:x.y+x.height/2}],x.x===y.x&&x.y===y.y&&x.width===y.width&&x.height===y.height||_.some(function(G){return Da(G,y)}))){p=!1,this.store.options.strictScope&&(x.x<y.x&&(x.x=y.x),x.y<y.y&&(x.y=y.y),x.x+x.width>y.x+y.width&&(x.x=y.x+y.width-x.width),x.y+x.height>y.y+y.height&&(x.y=y.y+y.height-x.height));break}}catch(G){T={error:G}}finally{try{b&&!b.done&&(R=m.return)&&R.call(m)}finally{if(T)throw T.error}}if(p)return console.info("\u753B\u7B14\u5728\u5927\u5C4F\u8303\u56F4\u5916"),[2]}return[4,this.addPens(t,!0)];case 1:return K.sent(),this.active(t.filter(function(G){return!G.parentId})),this.render(),this.externalElements.focus(),[2]}})})},e.prototype.randomCombineId=function(t,i,a){var r,n,o=null;t.type?(t.anchors[0].connectTo||t.anchors[t.anchors.length-1].connectTo)&&(o=[t.id,t.anchors[0].id,t.anchors[t.anchors.length-1].id]):t.connectedLines&&t.connectedLines.length&&(o=[t.id]),vd(t),o&&(o.length===1?this.randomIdObj[o[0]]=t.id:(this.randomIdObj[o[0]]=t.id,this.randomIdObj[o[1]]=t.anchors[0].id,this.randomIdObj[o[2]]=t.anchors[t.anchors.length-1].id)),t.parentId=a;var s=[];if(Array.isArray(t.children)){var h=function(g){var y=i.find(function(p){return p.id===g});y&&s.push(l.randomCombineId(y,i,t.id).id)},l=this;try{for(var c=at(t.children),f=c.next();!f.done;f=c.next()){var v=f.value;h(v)}}catch(g){r={error:g}}finally{try{f&&!f.done&&(n=c.return)&&n.call(c)}finally{if(r)throw r.error}}}return t.children=s,t},e.prototype.addPens=function(t,i){return Ei(this,void 0,void 0,function(){var a,r,n,o,s,h,l;return ki(this,function(c){switch(c.label){case 0:return a=this.beforeAddPens,a?[4,this.beforeAddPens(t)]:[3,2];case 1:a=c.sent()!=!0,c.label=2;case 2:if(a)return[2,[]];r=[];try{for(n=at(t),o=n.next();!o.done;o=n.next())s=o.value,!(this.beforeAddPen&&this.beforeAddPen(s)!=!0)&&(this.makePen(s),r.push(s))}catch(f){h={error:f}}finally{try{o&&!o.done&&(l=n.return)&&l.call(n)}finally{if(h)throw h.error}}return this.render(),this.store.emitter.emit("add",r),i&&this.pushHistory({type:we.Add,pens:ce(r,!0)}),[2,r]}})})},e.prototype.getInitPencilLine=function(t){var i=this.store,a=i.data,r=i.options,n=a.scale,o=a.lineWidth||1;return{id:t.penId,name:"line",x:t.x,y:t.y,type:Ye.Line,calculative:{canvas:this,pencil:!0,active:!0,worldAnchors:[t],lineWidth:o*n},fromArrow:a.fromArrow||r.fromArrow,toArrow:a.toArrow||r.toArrow,lineWidth:o}},e.prototype.createDrawingLine=function(t){this.inactive();var i=this.store,a=i.data,r=i.options,n=a.scale,o=a.lineWidth||1;return t.penId=Me(),{id:t.penId,name:"line",lineName:this.drawingLineName,x:t.x,y:t.y,type:Ye.Line,calculative:{canvas:this,active:!0,worldAnchors:[t],lineWidth:o*n},fromArrow:a.fromArrow||r.fromArrow,toArrow:a.toArrow||r.toArrow,lineWidth:o}},e.prototype.addRuleLine=function(t){var i=this.store.data,a=i.x,r=i.y,n=i.scale,o=i.origin,s=t.x+a,h=t.y+r,l=t.x,c=t.y,f=0,v=0,g=0,y=0;if(s<=h&&s<20)l=-a,f=this.width,g=1,t.ctrlKey||(c=Math.round((c-o.y)/(n*10))*(n*10)+o.y);else if(h<s&&h<20)c=-r,v=this.height,y=1,t.ctrlKey||(l=Math.round((l-o.x)/(n*10))*(n*10)+o.x);else return;this.addPen({isRuleLine:!0,type:Ye.Line,name:"line",lineName:"line",x:l,y:c,width:f,height:v,color:this.store.options.ruleLineColor,anchors:[{x:0,y:0},{x:g,y}]})},e.prototype.clearRuleLines=function(){this.delete(this.ruleLines)},Object.defineProperty(e.prototype,"ruleLines",{get:function(){return this.store.data.pens.filter(function(t){return t.isRuleLine})},enumerable:!1,configurable:!0}),e.prototype.alignPenToGrid=function(t){var i,a=this.store.options.autoAlignGrid&&this.store.data.grid;if(a&&!t.type){var r=this.store.data.gridSize||this.store.options.gridSize,n=this.store.data,o=n.origin,s=n.scale,h=t.x,l=t.y,c={x:h,y:l},f=this.getPenRect(t),v=parseInt((f.x/r).toFixed()),g=parseInt((f.y/r).toFixed()),y=v*r,p=g*r;c.x=o.x+y*s,c.y=o.y+p*s,Object.assign(t,c),(i=t.onMove)===null||i===void 0||i.call(t,t),this.updatePenRect(t),this.calcActiveRect(),this.getSizeCPs()}},e.prototype.movedActivePens=function(t){var i=this,a=ce(this.store.active,!0),r=this.store.data.gridSize||this.store.options.gridSize,n=this.store.data,o=n.origin,s=n.scale,h=this.store.options.autoAlignGrid&&this.store.data.grid;if(this.store.active.forEach(function(b,x){var _,k=i.movingPens[x],I=k.x,P=k.y,M={x:I,y:P};if(h&&!i.movingPens[x].type){var L=i.getPenRect(i.movingPens[x]),U=parseInt((L.x/r).toFixed()),$=parseInt((L.y/r).toFixed()),S=U*r,T=$*r;M.x=o.x+S*s,M.y=o.y+T*s}Object.assign(b,M),(_=b.onMove)===null||_===void 0||_.call(b,b),i.updatePenRect(b),i.updateLines(b),i.store.emitter.emit("updateLines",b),i.patchFlagsLines.forEach(function(R){R.type&&i.initLineRect(R)}),i.patchFlagsLines.clear(),b.calculative.x=b.x,b.calculative.y=b.y,b.calculative.initRect&&(b.calculative.initRect.x=b.calculative.x,b.calculative.initRect.y=b.calculative.y,b.calculative.initRect.ex=b.calculative.x+b.calculative.width,b.calculative.initRect.ey=b.calculative.y+b.calculative.height)}),this.initImageCanvas(this.store.active),this.initTemplateCanvas(this.store.active),!!this.dock){var l=this.dock,c=l.xDock,f=l.yDock,v;c&&(v=this.store.pens[c.penId]),!v&&f&&(v=this.store.pens[f.penId]);var g=ce(this.store.active,!0);if(t&&this.store.active.length===1&&(v==null?void 0:v.type)===1&&((c==null?void 0:c.anchorId)||(f==null?void 0:f.anchorId))){var y=lt(v),p=We(v);if(c!=null&&c.anchorId){var m=this.store.pens[this.store.active[0].id+Mi].calculative.worldAnchors.find(function(b){return b.id===c.anchorId});m.x===y.x&&m.y===y.y?(a.push(ce(v,!0)),_t(this.store.active[0],m,v,y),g.push(ce(v,!0))):m.x===p.x&&m.y===p.y&&(a.push(ce(v,!0)),_t(this.store.active[0],m,v,p),g.push(ce(v,!0)))}else if(f!=null&&f.anchorId){var m=this.store.pens[this.store.active[0].id+Mi].calculative.worldAnchors.find(function(x){return x.id===f.anchorId});m.x===y.x&&m.y===y.y?(a.push(ce(v,!0)),_t(this.store.active[0],m,v,y),g.push(ce(v,!0))):m.x===p.x&&m.y===p.y&&(a.push(ce(v,!0)),_t(this.store.active[0],m,v,p),g.push(ce(v,!0)))}}h&&(this.calcActiveRect(),this.getSizeCPs()),this.pushHistory({type:we.Update,pens:g,initPens:a}),this.store.emitter.emit("translatePens",g)}},e.prototype.copyMovedPens=function(){var t=this;this.copy(this.store.active.map(function(i,a){var r=t.movingPens[a],n=r.x,o=r.y;return t.updateLines(i),Lt(Lt({},i),{x:n,y:o})})),this.pasteOffset=!1,this.paste()},e.prototype.initImageCanvas=function(t){var i=this;t.some(function(a){return i.hasImage(a,!1)})&&this.canvasImage.init(),t.some(function(a){return i.hasImage(a,!0)})&&this.canvasImageBottom.init()},e.prototype.initTemplateCanvas=function(t){t.some(function(i){return i.canvasLayer===Ne.CanvasTemplate})&&this.canvasTemplate.init()},e.prototype.hasImage=function(t,i){var a=this,r;return t.image&&t.name!=="gif"?i?t.canvasLayer===Ne.CanvasImageBottom:t.canvasLayer===Ne.CanvasImage:(r=t.children)===null||r===void 0?void 0:r.some(function(n){var o=a.store.pens[n];return o&&a.hasImage(o,i)})},e.prototype.inactive=function(t){!this.store.active.length||(this.initTemplateCanvas(this.store.active),this.store.active.forEach(function(i){i.calculative.active=void 0,i.calculative.activeAnchor=void 0,i.calculative.hover=!1,La(i,!1)}),!t&&this.store.emitter.emit("inactive",this.store.active),this.store.active=[],this.activeRect=void 0,this.sizeCPs=void 0,this.store.activeAnchor=void 0,this.patchFlags=!0)},e.prototype.active=function(t,i){var a,r,n;if(i===void 0&&(i=!0),this.store.active){i&&this.store.emitter.emit("inactive",this.store.active);try{for(var o=at(this.store.active),s=o.next();!s.done;s=o.next()){var h=s.value;h.calculative.active=void 0,h.calculative.hover=!1,La(h,!1)}}catch(l){a={error:l}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(a)throw a.error}}}this.store.active=[],t.forEach(function(l){l.calculative.active=!0,La(l)}),(n=this.store.active).push.apply(n,Di([],Li(t),!1)),this.activeRect=void 0,this.calcActiveRect(),this.initTemplateCanvas(t),this.patchFlags=!0,i&&this.store.emitter.emit("active",this.store.active)},e.prototype.getSizeCPs=function(){var t=this;this.sizeCPs=sr(this.activeRect);var i=[{x:.5,y:0},{x:1,y:.5},{x:.5,y:1},{x:0,y:.5}],a=this.activeRect,r=a.x,n=a.y,o=a.width,s=a.height,h=a.rotate,l=a.center;i.forEach(function(c){var f={x:c.x*o+r,y:c.y*s+n};Ge(f,h,l),t.sizeCPs.push(f)})},e.prototype.getSpecialAngle=function(t,i){var a=0;t.x-i.x!==0?(a=Math.atan((i.y-t.y)/(t.x-i.x))*180/Math.PI,t.x<i.x&&(a>0?a-=180:a+=180)):i.y>t.y?a=90:i.y<t.y&&(a=-90),a=Math.round(a/15)*15;var r=Math.sqrt((i.x-t.x)*(i.x-t.x)+(i.y-t.y)*(i.y-t.y));t.x=i.x+Math.cos(a/180*Math.PI)*r,t.y=i.y-Math.sin(a/180*Math.PI)*r},e.prototype.clearHover=function(){this.hoverType=be.None,this.store.hover=null,this.store.hoverAnchor=null},e.prototype.inAnchor=function(t,i,a){var r;if(this.store.hoverAnchor=void 0,this.movingAnchor=void 0,!a||a.locked>ze.DisableEdit||!(i.type&&i.calculative.active)&&this.store.options.disableAnchor||i.disableAnchor)return be.None;if((this.mouseDown||this.drawingLine)&&i.name==="line"&&a.connectTo){var n=this.findOne(a.connectTo);if((n==null?void 0:n.calculative)&&!(n!=null&&n.calculative.active)){i=n;var o=n.calculative.worldAnchors.find(function(h){return h.id===a.anchorId});o&&(a=o)}}if(a.twoWay===At.Disable&&i.name!=="line")return be.None;if(i.name==="line"&&a.connectTo){var s=(r=this.findOne(a.connectTo))===null||r===void 0?void 0:r.anchors.find(function(h){return h.id===a.anchorId});if(s&&s.twoWay)return be.None}if(this.drawingLine){if(a.twoWay===At.Out)return be.None}else if(!(this.mouseDown&&this.hoverType===be.LineAnchor)){if(a.twoWay===At.In)return be.None}if(Ia(t,a,this.pointSize,a.penId?this.store.pens[a.penId]:void 0))return a!==this.store.hoverAnchor&&(this.patchFlags=!0),this.store.hoverAnchor=a,this.store.hover=i,i.type?a.connectTo&&!i.calculative.active&&(this.store.hover=this.store.pens[a.connectTo],this.store.hover)?(this.store.hoverAnchor=this.store.hover.calculative.worldAnchors.find(function(h){return h.id===a.anchorId}),this.store.hoverAnchor?(this.externalElements.style.cursor="crosshair",be.NodeAnchor):be.None):(this.hotkeyType===Ke.AddAnchor?this.externalElements.style.cursor="vertical-text":this.externalElements.style.cursor="pointer",be.LineAnchor):(this.hotkeyType===Ke.AddAnchor?this.externalElements.style.cursor="vertical-text":this.externalElements.style.cursor="crosshair",be.NodeAnchor);if(!this.mouseDown&&i.type){if(i.calculative.active&&a.prev&&Ia(t,a.prev,this.pointSize))return this.store.hoverAnchor=a,this.store.hover=i,this.externalElements.style.cursor="pointer",be.LineAnchorPrev;if(i.calculative.active&&a.next&&Ia(t,a.next,this.pointSize))return this.store.hoverAnchor=a,this.store.hover=i,this.externalElements.style.cursor="pointer",be.LineAnchorNext}return be.None},e.prototype.resize=function(t,i){var a,r;t=t||this.parentElement.clientWidth,i=i||this.parentElement.clientHeight,this.width=t,this.height=i,this.canvasRect={x:0,y:0,width:t,height:i},ot(this.canvasRect),this.canvas.style.width=t+"px",this.canvas.style.height=i+"px",this.externalElements.style.width=t+"px",this.externalElements.style.height=i+"px",this.canvasTemplate.resize(t,i),this.canvasImage.resize(t,i),this.canvasImageBottom.resize(t,i),this.magnifierCanvas.resize(t,i),t=t*this.store.dpiRatio|0,i=i*this.store.dpiRatio|0,this.canvas.width=t,this.canvas.height=i,this.offscreen.width=t,this.offscreen.height=i,this.clientRect=this.externalElements.getBoundingClientRect(),this.canvas.getContext("2d").scale(this.store.dpiRatio,this.store.dpiRatio),this.offscreen.getContext("2d").scale(this.store.dpiRatio,this.store.dpiRatio),this.offscreen.getContext("2d").textBaseline="middle";try{for(var n=at(this.store.data.pens),o=n.next();!o.done;o=n.next()){var s=o.value;s.isRuleLine&&(s.width?s.height||(s.width=this.width):s.height=this.height),Cr(s)}}catch(h){a={error:h}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}this.render()},e.prototype.clearCanvas=function(){this.activeRect=void 0,this.sizeCPs=void 0,this.canvas.getContext("2d").clearRect(0,0,this.canvas.width,this.canvas.height),this.offscreen.getContext("2d").clearRect(0,0,this.offscreen.width,this.offscreen.height),this.store.data.template||this.canvasTemplate.clear(),this.canvasImage.clear(),this.canvasImageBottom.clear()},e.prototype.addPen=function(t,i,a){return Ei(this,void 0,void 0,function(){var r;return ki(this,function(n){switch(n.label){case 0:return r=this.beforeAddPens,r?[4,this.beforeAddPens([t])]:[3,2];case 1:r=n.sent()!=!0,n.label=2;case 2:return r?[2]:this.beforeAddPen&&this.beforeAddPen(t)!=!0?[2]:(this.makePen(t),this.active([t]),this.render(),a&&this.store.emitter.emit("add",[t]),i&&this.pushHistory({type:we.Add,pens:[t]}),[2,t])}})})},e.prototype.pushHistory=function(t){var i=this,a;if(!this.store.data.locked){var r=this.store.data,n=r.origin,o=r.scale;t.origin=ce(n),t.scale=o,t.type!==we.Update&&t.pens&&t.pens.forEach(function(s){s.calculative&&(s.calculative.layer=i.store.data.pens.findIndex(function(h){return h.id===s.id}))}),this.store.historyIndex<this.store.histories.length-1&&this.store.histories.splice(this.store.historyIndex+1,this.store.histories.length-this.store.historyIndex-1),(a=t.pens)===null||a===void 0||a.forEach(function(s){var h,l,c;if(t.initPens)try{for(var f=at(t.initPens),v=f.next();!v.done;v=f.next()){var g=v.value;g.id===s.id&&(c=g)}}catch(p){h={error:p}}finally{try{v&&!v.done&&(l=f.return)&&l.call(f)}finally{if(h)throw h.error}}if(c)for(var y in s)c[y]==null&&(c[y]=void 0)}),this.store.histories.push(t),this.store.historyIndex=this.store.histories.length-1,this.store.emitter.emit("update",{previous:t.initPens,current:t.pens})}},e.prototype.undo=function(){if(!(this.store.data.locked||this.store.historyIndex==null||this.store.historyIndex<0)){var t=this.store.histories[this.store.historyIndex--];this.doEditAction(t,!0);for(var i=t.step;i>1;){var a=this.store.histories[this.store.historyIndex--];this.doEditAction(a,!0),i--}(t.type==we.Add||t.type==we.Delete||t.type==we.Update)&&this.activeHistory()}},e.prototype.redo=function(){if(!(this.store.data.locked||this.store.historyIndex==null||this.store.historyIndex>this.store.histories.length-2)){var t=this.store.histories[++this.store.historyIndex];this.doEditAction(t,!1);for(var i=t.step;i>1;){var a=this.store.histories[++this.store.historyIndex];this.doEditAction(a,!1),i--}(t.type==we.Add||t.type==we.Delete||t.type==we.Update)&&this.activeHistory()}},e.prototype.activeHistory=function(){var t=this,i=this.store.histories[this.store.historyIndex+1],a=[];if(i&&i.type===we.Update){i.pens.forEach(function(n){a.push(t.store.pens[n.id])}),this.active(a);return}var r=this.store.histories[this.store.historyIndex];r&&(r.type===we.Add||r.type===we.Delete)&&(r.pens.forEach(function(n){a.push(t.store.pens[n.id])}),this.active(a))},e.prototype.doEditAction=function(t,i){var a=this;switch(this.inactive(),this.store.hoverAnchor=void 0,this.store.hover=void 0,t.type){case we.Add:t.pens.forEach(function(h){var l,c=ce(h,!0),f=a.store.data.pens.findIndex(function(v){return v.id===c.id});f>-1&&((l=c.onDestroy)===null||l===void 0||l.call(c,a.store.pens[c.id]),a.store.data.pens.splice(f,1),a.store.pens[c.id]=void 0,c.calculative||(c.calculative={}),c.calculative.canvas=a,a.store.animates.delete(c),a.store.animateMap.delete(c))}),t.type=we.Delete;break;case we.Update:var r=i?t.initPens:t.pens,n=i?t.pens:t.initPens;r.forEach(function(h){var l=ce(h,!0),c=a.store.data.pens.findIndex(function(p){return p.id===l.id});if(c>-1){if(l.calculative=a.store.data.pens[c].calculative,a.store.data.pens[c].type&&a.store.data.pens[c].lastConnected)for(var f in a.store.data.pens[c].lastConnected)a.store.pens[f].connectedLines=a.store.data.pens[c].lastConnected[f];a.store.data.pens[c]=l,a.store.pens[l.id]=l;for(var v in l)(typeof l[v]!="object"||v==="lineDash")&&(l.calculative[v]=l[v]);l.calculative.image=void 0;var g=a.getPenRect(l,t.origin,t.scale);if(a.setPenRect(l,g,!1),a.updateLines(l,!0),l.calculative.canvas.parent.isCombine(l)){var y=n.find(function(p){return p.id===l.id});$v.forEach(function(p){var m;l[p]!==y[p]&&a.parent.setValue((m={id:l.id},m[p]=l[p],m),{render:!0,doEvent:!1})})}}});break;case we.Delete:t.pens.reverse().forEach(function(h){var l,c,f=ce(h,!0);if(f.calculative||(f.calculative={}),a.store.data.pens.splice(((l=f.calculative)===null||l===void 0?void 0:l.layer)!==-1?(c=f.calculative)===null||c===void 0?void 0:c.layer:a.store.data.pens.length,0,f),a.store.pens[f.id]=f,f.type&&f.lastConnected)for(var v in f.lastConnected)a.store.pens[v].connectedLines=f.lastConnected[v];f.calculative.canvas=a}),t.pens.reverse().forEach(function(h){var l=a.store.pens[h.id],c=a.getPenRect(l,t.origin,t.scale);a.setPenRect(l,c,!1),l.calculative.image=void 0,l.calculative.backgroundImage=void 0,l.calculative.strokeImage=void 0,a.loadImage(l)}),t.type=we.Add;break;case we.Replace:{var o=i?t.initPens:t.pens,s=i?t.pens:t.initPens;s.forEach(function(h){var l,c=ce(h,!0),f=a.store.data.pens.findIndex(function(g){return g.id===c.id});if(f>-1){(l=c.onDestroy)===null||l===void 0||l.call(c,a.store.data.pens.find(function(g){return g.id===c.id}));var v=a.store.data.pens.findIndex(function(g){return g.id===c.id});a.store.data.pens.splice(v,1),a.store.pens[c.id]=void 0,c.calculative||(c.calculative={}),c.calculative.canvas=a,a.store.animates.delete(c),a.store.animateMap.delete(c)}}),o.reverse().forEach(function(h){var l,c,f=ce(h,!0);if(f.calculative||(f.calculative={}),a.store.data.pens.splice(((l=f.calculative)===null||l===void 0?void 0:l.layer)!==-1?(c=f.calculative)===null||c===void 0?void 0:c.layer:a.store.data.pens.length,0,f),a.store.pens[f.id]=f,f.type&&f.lastConnected)for(var v in f.lastConnected)a.store.pens[v].connectedLines=f.lastConnected[v];f.calculative.canvas=a}),o.reverse().forEach(function(h){var l=a.store.data.pens.find(function(f){return f.id===h.id}),c=a.getPenRect(l,t.origin,t.scale);a.setPenRect(l,c,!1),l.calculative.image=void 0,l.calculative.backgroundImage=void 0,l.calculative.strokeImage=void 0,a.loadImage(l)}),t.type=we.Replace;break}}if(t.type===we.Update){var r=Di(Di([],Li(t.pens),!1),Li(t.initPens),!1);this.initImageCanvas(r),this.initTemplateCanvas(r)}else this.initImageCanvas(t.pens),this.initTemplateCanvas(t.pens);this.parent.onSizeUpdate(),this.render(),this.store.emitter.emit(i?"undo":"redo",t)},e.prototype.makePen=function(t){var i=this,a;if(t.id||(t.id=Me()),Math.abs(this.store.lastScale-this.store.data.scale)<1e-4&&this.store.sameTemplate&&this.store.templatePens[t.id]&&t.canvasLayer===Ne.CanvasTemplate){t=this.store.templatePens[t.id],this.store.data.pens.push(t),this.updatePenRect(t);return}if(this.store.data.pens.push(t),this.store.pens[t.id]=t,t.path){!t.pathId&&(t.pathId=Me());var r=this.store.data.paths;!r[t.pathId]&&(r[t.pathId]=t.path),t.path=void 0}t.lineWidth==null&&(t.lineWidth=1);var n=this.store.options,o=n.fontSize,s=n.lineHeight;t.fontSize||(t.fontSize=o),t.lineHeight||(t.lineHeight=s),t.image&&t.name!=="gif"&&t.canvasLayer===void 0&&(t.isBottom?t.canvasLayer=Ne.CanvasImageBottom:t.canvasLayer=Ne.CanvasImage,delete t.isBottom),t.template&&(t.canvasLayer=Ne.CanvasTemplate),t.calculative={canvas:this,singleton:(a=t.calculative)===null||a===void 0?void 0:a.singleton},(t.video||t.audio)&&(t.calculative.onended=function(l){i.nextAnimate(l)});for(var h in t)(typeof t[h]!="object"||h==="lineDash")&&(t.calculative[h]=t[h]);t.calculative.image=void 0,t.calculative.backgroundImage=void 0,t.calculative.strokeImage=void 0,!t.anchors&&ke.anchors[t.name]&&(t.anchors||(t.anchors=[]),ke.anchors[t.name](t)),this.updatePenRect(t),!t.anchors&&t.calculative.worldAnchors&&(t.anchors=t.calculative.worldAnchors.map(function(l){return xn(l,t.calculative.worldRect)})),!t.rotate&&(t.rotate=0),this.loadImage(t),this.parent.penNetwork(t)},e.prototype.drawline=function(t){var i;!this.drawingLine||((i=this[this.drawingLineName])===null||i===void 0||i.call(this,this.store,this.drawingLine,t),this.store.path2dMap.set(this.drawingLine,ke.path2dDraws.line(this.drawingLine)),this.patchFlags=!0)},e.prototype.initLineRect=function(t){var i;if(!!t){if(!(!((i=t.calculative.worldAnchors)===null||i===void 0)&&i.length)){this._del([t]);return}if(!(!isFinite(t.x)||!isFinite(t.x))&&!(t.x==null||t.y==null)){var a=Hc(t);t.parentId||Object.assign(t,a);var r=this.store.options,n=r.fontSize,o=r.lineHeight;t.fontSize||(t.fontSize=n,t.calculative.fontSize=t.fontSize*this.store.data.scale),t.lineHeight||(t.lineHeight=o,t.calculative.lineHeight=t.lineHeight),tt(a),t.calculative.worldRect=a,nu(t,a),Ni(t),Cr(t),t.calculative&&(t.calculative.gradientAnimatePath=void 0),this.store.path2dMap.set(t,ke.path2dDraws[t.name](t)),t.calculative.worldAnchors&&(t.anchors=t.calculative.worldAnchors.map(function(s){return xn(s,t.calculative.worldRect)}))}}},e.prototype.drawingPencil=function(){Tg(this.store),this.pencil=!0,this.externalElements.style.cursor="crosshair"},e.prototype.stopPencil=function(){this.pencil=!1,this.pencilLine=void 0,this.externalElements.style.cursor="default"},e.prototype.finishDrawline=function(t){return Ei(this,void 0,void 0,function(){var i,a,r,n,o,s,h=this;return ki(this,function(l){switch(l.label){case 0:if(!this.drawingLine)return[2];if(i=lt(this.drawingLine),a=We(this.drawingLine),a.isTemp&&(this.drawingLine.calculative.worldAnchors.pop(),a=We(this.drawingLine)),!t&&(!a.connectTo&&this.drawingLine.calculative.worldAnchors.pop(),lt(this.drawingLine)===this.drawingLine.calculative.activeAnchor))return this.drawingLine=void 0,this.render(),[2];if(!i.connectTo||!a.connectTo){if(this.store.options.disableEmptyLine)return i.connectTo&&(this.store.pens[i.connectTo].connectedLines=this.store.pens[i.connectTo].connectedLines.filter(function(c){return c.lineId!==h.drawingLine.id})),this.drawingLine=void 0,this.render(),[2]}else if(this.store.options.disableRepeatLine&&(r=this.store.data.pens.find(function(c){if(c.type){var f=lt(c),v=We(c);return id(f,i)&&id(v,a)}}),r))return this.drawingLine=void 0,this.render(),[2];return n=Hc(this.drawingLine),Object.assign(this.drawingLine,n),this.drawingLine.calculative.worldRect=n,this.drawingLine.calculative.activeAnchor=We(this.drawingLine),this.store.activeAnchor=this.drawingLine.calculative.activeAnchor,s=!this.beforeAddPens,s?[3,2]:[4,this.beforeAddPens([this.drawingLine])];case 1:s=l.sent(),l.label=2;case 2:return o=s&&(!this.beforeAddPen||this.beforeAddPen(this.drawingLine)),o&&(this.initLineRect(this.drawingLine),this.store.data.pens.push(this.drawingLine),this.store.pens[this.drawingLine.id]=this.drawingLine,this.store.emitter.emit("add",[this.drawingLine]),this.active([this.drawingLine]),this.pushHistory({type:we.Add,pens:ce([this.drawingLine],!0)})),this.store.path2dMap.set(this.drawingLine,ke.path2dDraws[this.drawingLine.name](this.drawingLine)),this.drawingLine=void 0,this.drawingLineName=void 0,this.render(),[2]}})})},e.prototype.finishPencil=function(){return Ei(this,void 0,void 0,function(){var t,i,a,r;return ki(this,function(n){switch(n.label){case 0:return this.pencilLine?(t=Wc(this.pencilLine.calculative.worldAnchors,10,0,this.pencilLine.calculative.worldAnchors.length-1),i=lt(this.pencilLine),t.unshift({id:i.id,penId:i.penId,x:i.x,y:i.y}),i=We(this.pencilLine),t.push({id:i.id,penId:i.penId,x:i.x,y:i.y}),this.pencilLine.calculative.worldAnchors=JE(t),this.pencilLine.calculative.worldAnchors.length>1?(this.pencilLine.calculative.pencil=!1,this.store.path2dMap.set(this.pencilLine,ke.path2dDraws[this.pencilLine.name](this.pencilLine)),r=!this.beforeAddPens,r?[3,2]:[4,this.beforeAddPens([this.pencilLine])]):[3,3]):[3,4];case 1:r=n.sent(),n.label=2;case 2:a=r&&(!this.beforeAddPen||this.beforeAddPen(this.pencilLine)),a&&(this.initLineRect(this.pencilLine),this.store.data.pens.push(this.pencilLine),this.store.pens[this.pencilLine.id]=this.pencilLine,this.store.emitter.emit("add",[this.pencilLine]),this.active([this.pencilLine]),this.pushHistory({type:we.Add,pens:ce([this.pencilLine],!0)})),n.label=3;case 3:this.pencilLine=void 0,this.render(),n.label=4;case 4:return[2]}})})},e.prototype.firefoxLoadSvg=function(t){var i=this,a=new Image,r=new XMLHttpRequest;r.open("GET",t.image,!0),r.onload=function(){var n=new DOMParser,o=n.parseFromString(r.responseText,"text/xml"),s=o.getElementsByTagName("svg")[0],h=t.calculative.worldRect,l=h.width,c=h.height;s.setAttribute("width",l+"px"),s.setAttribute("height",c+"px");var f=btoa(unescape(encodeURIComponent(new XMLSerializer().serializeToString(s)))),v="data:image/svg+xml;base64,"+f;a.src=v,a.onload=function(){t.calculative.img=a,t.calculative.imgNaturalWidth=a.naturalWidth||t.iconWidth,t.calculative.imgNaturalHeight=a.naturalHeight||t.iconHeight,ke.htmlElements[t.image]=a,i.imageLoaded(),t.canvasLayer===Ne.CanvasTemplate&&i.templateImageLoaded()}},r.send()},e.prototype.loadImage=function(t){var i=this;if(t.image!==t.calculative.image||!t.calculative.img){if(t.calculative.img=void 0,t.image)if(ke.htmlElements[t.image]){var a=ke.htmlElements[t.image];t.calculative.img=a,t.calculative.imgNaturalWidth=a.naturalWidth||t.iconWidth,t.calculative.imgNaturalHeight=a.naturalHeight||t.iconHeight,this.imageLoaded(),t.canvasLayer===Ne.CanvasTemplate&&this.templateImageLoaded()}else if(navigator.userAgent.includes("Firefox")&&t.image.endsWith(".svg"))this.firefoxLoadSvg(t);else{var r=new Image;r.crossOrigin=t.crossOrigin==="undefined"?void 0:t.crossOrigin||"anonymous",r.src=t.image,this.store.options.cdn&&!(t.image.startsWith("http")||t.image.startsWith("//")||t.image.startsWith("data:image"))&&(r.src=this.store.options.cdn+t.image),r.onload=function(){t.calculative.img=r,t.calculative.imgNaturalWidth=r.naturalWidth||t.iconWidth,t.calculative.imgNaturalHeight=r.naturalHeight||t.iconHeight,ke.htmlElements[t.image]=r,i.imageLoaded(),t.canvasLayer===Ne.CanvasTemplate&&i.templateImageLoaded()}}t.calculative.image=t.image}if(t.backgroundImage!==t.calculative.backgroundImage){if(t.calculative.backgroundImg=void 0,t.backgroundImage)if(ke.htmlElements[t.backgroundImage]){var a=ke.htmlElements[t.backgroundImage];t.calculative.backgroundImg=a}else{var n=new Image;n.crossOrigin="anonymous",n.src=t.backgroundImage,this.store.options.cdn&&!(t.backgroundImage.startsWith("http")||t.backgroundImage.startsWith("//")||t.backgroundImage.startsWith("data:image"))&&(n.src=this.store.options.cdn+t.backgroundImage),n.onload=function(){t.calculative.backgroundImg=n,ke.htmlElements[t.backgroundImage]=n,i.imageLoaded(),t.canvasLayer===Ne.CanvasTemplate&&i.templateImageLoaded()}}t.calculative.backgroundImage=t.backgroundImage}if(t.strokeImage!==t.calculative.strokeImage){if(t.calculative.strokeImg=void 0,t.strokeImage)if(ke.htmlElements[t.strokeImage]){var a=ke.htmlElements[t.strokeImage];t.calculative.strokeImg=a}else{var o=new Image;o.crossOrigin="anonymous",o.src=t.strokeImage,this.store.options.cdn&&!(t.strokeImage.startsWith("http")||t.strokeImage.startsWith("//")||t.strokeImage.startsWith("data:image"))&&(o.src=this.store.options.cdn+t.strokeImage),o.onload=function(){t.calculative.strokeImg=o,ke.htmlElements[t.strokeImage]=o,i.imageLoaded(),t.canvasLayer===Ne.CanvasTemplate&&t.name!=="gif"&&i.templateImageLoaded()}}t.calculative.strokeImage=t.strokeImage}},e.prototype.imageLoaded=function(){var t=this;this.imageTimer&&clearTimeout(this.imageTimer),this.imageTimer=setTimeout(function(){t.canvasImage.init(),t.canvasImageBottom.init(),t.render()},100)},e.prototype.templateImageLoaded=function(){var t=this;this.templateImageTimer&&clearTimeout(this.templateImageTimer),this.templateImageTimer=setTimeout(function(){t.canvasTemplate.init(),t.render()},100)},e.prototype.setCalculativeByScale=function(t){var i=this.store.data.scale;t.calculative.lineWidth=t.lineWidth*i,t.calculative.fontSize=t.fontSize*i,t.fontSize<1&&(t.calculative.fontSize=t.fontSize*t.calculative.worldRect.height),t.calculative.iconSize=t.iconSize*i,t.calculative.iconWidth=t.iconWidth*i,t.calculative.iconHeight=t.iconHeight*i,t.calculative.iconLeft=t.iconLeft<1&&t.iconLeft>-1?t.iconLeft:t.iconLeft*i,t.calculative.iconTop=t.iconTop<1&&t.iconTop>-1?t.iconTop:t.iconTop*i,t.calculative.textWidth=t.textWidth<1&&t.textWidth>-1?t.textWidth:t.textWidth*i,t.calculative.textHeight=t.textHeight<1&&t.textHeight>-1?t.textHeight:t.textHeight*i,t.calculative.textLeft=t.textLeft<1&&t.textLeft>-1?t.textLeft:t.textLeft*i,t.calculative.textTop=t.textTop<1&&t.textTop>-1?t.textTop:t.textTop*i,t.type===Ye.Line&&t.borderWidth&&(t.calculative.borderWidth=t.borderWidth*i)},e.prototype.updatePenRect=function(t,i){var a=this,r=i===void 0?{}:i,n=r.worldRectIsReady,o=r.playingAnimate;n?Yo(t):ug(t),o||this.setCalculativeByScale(t),_n(t),sd(this.store.pens,t),Ni(t),Cr(t),ke.path2dDraws[t.name]&&this.store.path2dMap.set(t,ke.path2dDraws[t.name](t)),t.calculative.patchFlags=!0,this.patchFlags=!0,t.children&&t.children.forEach(function(s){var h=a.store.pens[s];h&&a.updatePenRect(h,{worldRectIsReady:!1})}),t.type&&this.initLineRect(t),t.calculative.gradientTimer&&clearTimeout(t.calculative.gradientTimer),t.calculative.gradientTimer=setTimeout(function(){t.calculative.lineGradient&&(t.calculative.lineGradient=null),t.calculative.gradient&&(t.calculative.gradient=null),t.calculative.radialGradient&&(t.calculative.radialGradient=null),a.patchFlags=!0,t.calculative.gradientTimer=void 0},50)},e.prototype.translate=function(t,i){if(t===void 0&&(t=0),i===void 0&&(i=0),this.store.data.x+=t*this.store.data.scale,this.store.data.y+=i*this.store.data.scale,this.store.data.x=Math.round(this.store.data.x),this.store.data.y=Math.round(this.store.data.y),this.store.options.padding){var a=ar(this.store.options.padding),r=this.store.data.width||this.store.options.width,n=this.store.data.height||this.store.options.height;this.width<(r+a[1]+a[3])*this.store.data.scale&&(this.store.data.x+this.store.data.origin.x>a[3]*this.store.data.scale&&(this.store.data.x=a[3]*this.store.data.scale-this.store.data.origin.x),this.store.data.x+this.store.data.origin.x+r*this.store.data.scale<this.width-a[1]*this.store.data.scale&&(this.store.data.x=this.width-a[1]*this.store.data.scale-(this.store.data.origin.x+r*this.store.data.scale))),this.height<(n+a[0]+a[2])*this.store.data.scale&&(this.store.data.y+this.store.data.origin.y>a[0]*this.store.data.scale&&(this.store.data.y=a[0]*this.store.data.scale-this.store.data.origin.y),this.store.data.y+this.store.data.origin.y+n*this.store.data.scale<this.height-a[2]*this.store.data.scale&&(this.store.data.y=this.height-a[2]*this.store.data.scale-(this.store.data.origin.y+n*this.store.data.scale)))}this.canvasTemplate.init(),this.canvasImage.init(),this.canvasImageBottom.init(),this.render(),this.store.emitter.emit("translate",{x:this.store.data.x,y:this.store.data.y}),this.tooltip.translate(t,i),this.scroll&&this.scroll.isShow&&this.scroll.translate(t,i),this.onMovePens()},e.prototype.onMovePens=function(){var t,i,a,r=this.parent.map;r&&r.isShow&&r.setView();try{for(var n=at(this.store.data.pens),o=n.next();!o.done;o=n.next()){var s=o.value;Cr(s),(a=s.onMove)===null||a===void 0||a.call(s,s),s.isRuleLine&&(s.width?s.height||(s.x=-this.store.data.x):s.y=-this.store.data.y,this.updatePenRect(s))}}catch(h){t={error:h}}finally{try{o&&!o.done&&(i=n.return)&&i.call(n)}finally{if(t)throw t.error}}},e.prototype.scale=function(t,i){var a=this,r;i===void 0&&(i={x:0,y:0});var n=this.store.data.minScale||this.store.options.minScale,o=this.store.data.maxScale||this.store.options.maxScale;if(t>=n&&t<=o){this.calibrateMouse(i);var s=t/this.store.data.scale;this.store.data.scale=t,this.store.data.center=i,!((r=this.store.clipboard)===null||r===void 0)&&r.pos&&os(this.store.clipboard.pos,s,i),os(this.store.data.origin,s,i),this.store.data.pens.forEach(function(l){if(!l.parentId){if(Aa(l,s,i),l.onScale&&l.onScale(l),l.isRuleLine){var c=1/s,f=l.calculative.worldRect.center;l.width&&l.height||Aa(l,c,f)}a.updatePenRect(l,{worldRectIsReady:!0}),a.execPenResize(l)}}),this.onMovePens(),this.calcActiveRect(),this.canvasTemplate.init(),this.canvasImage.init(),this.canvasImageBottom.init();var h=this.parent.map;h&&h.isShow&&h.setView(),this.render(),this.store.emitter.emit("scale",this.store.data.scale)}},e.prototype.templateScale=function(t,i){var a=this;i===void 0&&(i={x:0,y:0});var r=this.store.options,n=r.minScale,o=r.maxScale;if(t>=n&&t<=o){var s=t/this.store.data.scale;this.store.data.scale=t,this.store.data.center={x:0,y:0},this.store.data.origin={x:0,y:0},this.store.data.pens.forEach(function(h){if(!h.parentId){if(Aa(h,s,i),h.onScale&&h.onScale(h),h.isRuleLine){var l=s>1?1:1/s/s,c=h.calculative.worldRect.center;h.width&&h.height||Aa(h,l,c)}a.execPenResize(h)}}),this.calcActiveRect()}},e.prototype.rotatePens=function(t){var i,a,r=this;this.initPens||(this.initPens=ce(this.getAllByPens(this.store.active))),this.activeRect.rotate=gi(t,this.activeRect.center),this.activeRect.rotate%90<10&&(this.activeRect.rotate-=this.activeRect.rotate%90),this.activeRect.rotate%90>80&&(this.activeRect.rotate+=90-this.activeRect.rotate%90),this.store.active.length===1&&(this.lastRotate=this.store.active[0].rotate||0);var n=this.activeRect.rotate-this.lastRotate;try{for(var o=at(this.store.active),s=o.next();!s.done;s=o.next()){var h=s.value;if(h.parentId)return;this.rotatePen(h,n,this.activeRect),h.onRotate&&h.onRotate(h),this.updateLines(h)}}catch(l){i={error:l}}finally{try{s&&!s.done&&(a=o.return)&&a.call(o)}finally{if(i)throw i.error}}this.lastRotate=this.activeRect.rotate,this.getSizeCPs(),this.initImageCanvas(this.store.active),this.initTemplateCanvas(this.store.active),this.render(),this.store.emitter.emit("rotatePens",this.store.active),this.timer&&clearTimeout(this.timer),this.timer=setTimeout(function(){r.timer=void 0,r.pushHistory({type:we.Update,pens:ce(r.getAllByPens(r.store.active)),initPens:r.initPens}),r.initPens=void 0},200)},e.prototype.resizePens=function(t){var i=this;if(this.initPens||(this.initPens=ce(this.store.active,!0)),!this.initActiveRect){this.initActiveRect=ce(this.activeRect);return}var a={x:this.mouseDown.x,y:this.mouseDown.y},r={x:t.x,y:t.y},n=r.x-a.x,o=r.y-a.y,s=ce(this.initActiveRect);if(md(s,n,o,this.resizeIndex),tt(s),!this.store.options.disableDock){this.clearDock();var h=this.customResizeDock||V2;this.dock=h(this.store,s,this.store.active,this.resizeIndex);var l=this.dock,c=l.xDock,f=l.yDock;if(c){n+=c.step;var v=this.store.pens[c.penId];v.calculative.isDock=!0}if(f){o+=f.step;var v=this.store.pens[f.penId];v.calculative.isDock=!0}}var g=this.activeRect.width,y=this.activeRect.height,p=n-this.lastOffsetX,m=o-this.lastOffsetY;if(this.lastOffsetX=n,this.lastOffsetY=o,t.ctrlKey||this.initPens.length===1&&this.initPens[0].ratio){var b=[1,3].includes(this.resizeIndex)?-1:1;m=b*(p*y)/g}if(this.activeRect.ratio=this.initPens[0].ratio,md(this.activeRect,p,m,this.resizeIndex),this.store.options.strictScope){var x=this.store.data.width||this.store.options.width,_=this.store.data.height||this.store.options.height;if(x&&_){var k={x:this.store.data.origin.x,y:this.store.data.origin.y,width:x*this.store.data.scale,height:_*this.store.data.scale};this.activeRect.x<k.x&&(this.activeRect.width=this.activeRect.width-(k.x-this.activeRect.x),this.activeRect.x=k.x),this.activeRect.y<k.y&&(this.activeRect.height=this.activeRect.height-(k.y-this.activeRect.y),this.activeRect.y=k.y),this.activeRect.x+this.activeRect.width>k.x+k.width&&(this.activeRect.width=this.activeRect.width-(this.activeRect.x+this.activeRect.width-(k.x+k.width)),this.activeRect.x=k.x+k.width-this.activeRect.width,this.activeRect.ex=this.activeRect.x+this.activeRect.width),this.activeRect.y+this.activeRect.height>k.y+k.height&&(this.activeRect.height=this.activeRect.height-(this.activeRect.y+this.activeRect.height-(k.y+k.height)),this.activeRect.y=k.y+k.height-this.activeRect.height,this.activeRect.ey=this.activeRect.y+this.activeRect.height)}}tt(this.activeRect);var I=this.activeRect.width/g,P=this.activeRect.height/y;this.store.active.forEach(function(M,L){M.calculative.worldRect.x=i.activeInitPos[L].x*i.activeRect.width+i.activeRect.x,M.calculative.worldRect.y=i.activeInitPos[L].y*i.activeRect.height+i.activeRect.y,M.calculative.worldRect.width*=I,M.calculative.iconWidth&&(M.calculative.iconWidth*=I),M.calculative.worldRect.height*=P,M.calculative.iconHeight&&(M.calculative.iconHeight*=P),ot(M.calculative.worldRect),tt(M.calculative.worldRect),i.updatePenRect(M,{worldRectIsReady:!0}),i.execPenResize(M),i.updateLines(M)}),this.getSizeCPs(),this.initImageCanvas(this.store.active),this.initTemplateCanvas(this.store.active),this.render(),this.store.emitter.emit("resizePens",this.store.active),this.timer&&clearTimeout(this.timer),this.timer=setTimeout(function(){i.timer=void 0,i.pushHistory({type:we.Update,pens:ce(i.store.active,!0),initPens:i.initPens}),i.initPens=void 0},200)},e.prototype.movePens=function(t){var i,a;if(!(!this.activeRect||this.store.data.locked)){if(!this.initActiveRect){this.initActiveRect=ce(this.activeRect);return}if(!(!this.store.options.moveConnectedLine&&!this.canMoveLine&&this.store.active.length===1&&(((i=this.store.active[0].anchors[0])===null||i===void 0?void 0:i.connectTo)||((a=this.store.active[0].anchors[this.store.active[0].anchors.length-1])===null||a===void 0?void 0:a.connectTo)))&&(this.movingPens||(this.initMovingPens(),this.store.active.forEach(function(b){yn(b,!1)}),this.store.hover=void 0),!!this.mouseDown)){var r=t.x-this.mouseDown.x,n=t.y-this.mouseDown.y;t.shiftKey&&!t.ctrlKey&&(n=0),t.ctrlKey&&(r=0);var o=ce(this.initActiveRect);Yr(o,r,n);var s=!1;if(this.store.options.strictScope){var h=this.store.data.width||this.store.options.width,l=this.store.data.height||this.store.options.height;if(h&&l){var c={x:this.store.data.origin.x,y:this.store.data.origin.y,width:h*this.store.data.scale,height:l*this.store.data.scale};o.x<c.x&&(o.x=c.x,s=!0),o.y<c.y&&(o.y=c.y,s=!0),o.x+o.width>c.x+c.width&&(o.x=c.x+c.width-o.width,s=!0),o.y+o.height>c.y+c.height&&(o.y=c.y+c.height-o.height,s=!0)}}var f={x:o.x-this.activeRect.x,y:o.y-this.activeRect.y};if(!this.store.options.disableDock&&!s){this.clearDock();var v=this.customMoveDock||K2;this.dock=v(this.store,o,this.movingPens,f);var g=this.dock,y=g.xDock,p=g.yDock,m=void 0;y&&(f.x+=y.step,m=this.store.pens[y.penId],m.calculative.isDock=!0),p&&(f.y+=p.step,m=this.store.pens[p.penId],m.calculative.isDock=!0)}this.translatePens(this.movingPens,f.x,f.y,!0)}}},e.prototype.changeIdsByMoving=function(t,i){t.id+=Mi,t.parentId&&i.find(function(a){return a.id===t.parentId})&&(t.parentId+=Mi),t.children&&(t.children=t.children.map(function(a){return a+Mi})),t.connectedLines&&(t.connectedLines=t.connectedLines.map(function(a){return i.find(function(r){return r.id===a.lineId})&&(a.lineId+=Mi),a})),t.type&&t.calculative.worldAnchors&&(t.calculative.worldAnchors=t.calculative.worldAnchors.map(function(a){return a.connectTo&&i.find(function(r){return r.id===a.connectTo})&&(a.connectTo+=Mi),a}))},e.prototype.initMovingPens=function(){var t=this,i,a;if(!this.store.options.moveConnectedLine&&!this.canMoveLine)for(var r=0;r<this.store.active.length;r++){var n=this.store.active[r];(((i=n.anchors[0])===null||i===void 0?void 0:i.connectTo)||((a=n.anchors[n.anchors.length-1])===null||a===void 0?void 0:a.connectTo))&&(this.store.active.splice(r,1),n.calculative.active=void 0,--r)}this.movingPens=ce(this.store.active,!0);var o=this.getAllByPens(this.movingPens),s=ce(o,!0);o.forEach(function(h){t.changeIdsByMoving(h,s),t.store.pens[h.id]=h,h.calculative.canvas=t;var l={globalAlpha:.5};h.lineWidth===0&&(l.lineWidth=1),(h.name.endsWith("Dom")||Ax.includes(h.name)||t.store.options.domShapes.includes(h.name)||h.image)&&(l.name="rectangle",l.onDestroy=void 0),t.updateValue(h,l),h.calculative.image=void 0})},e.prototype.moveLineAnchor=function(t,i){var a=this,r,n,o,s;if(!(!this.activeRect||this.store.data.locked)){if(this.initPens||(this.initPens=ce(this.store.active,!0)),!((r=this.store.activeAnchor)===null||r===void 0)&&r.connectTo){var h=this.store.pens[this.store.activeAnchor.connectTo];Ba(h,Kr(h,this.store.activeAnchor.anchorId),this.store.pens[this.store.activeAnchor.penId],this.store.activeAnchor)}var l=this.store.activeAnchor.id,c=(o=(n=this.store.pens[this.store.activeAnchor.penId])===null||n===void 0?void 0:n.connectedLines)===null||o===void 0?void 0:o.filter(function(x){return x.anchor===l});c&&c.length>0&&c.forEach(function(x){var _=a.store.pens[x.lineId];Ba(a.store.pens[a.store.activeAnchor.penId],a.store.activeAnchor,_,Kr(_,x.lineAnchor))});var f=this.store.active[0];lt(f);var v=We(f);if(f.lineName==="polyline"&&!i.shiftKey)QE(f,this.store.activeAnchor,t);else{var g=0,y=0;if(f.lineName==="line"){var p=f.calculative.worldAnchors.findIndex(function(x){return x.id===a.store.activeAnchor.id});p===0&&(p=2);var m=f.calculative.worldAnchors[p-1];if(i.ctrlKey&&i.shiftKey){var b=ce(t);this.getSpecialAngle(b,m),g=b.x-this.store.activeAnchor.x,y=b.y-this.store.activeAnchor.y}else if(!i.ctrlKey&&i.shiftKey){var b={x:t.x,y:m.y};g=b.x-this.store.activeAnchor.x,y=b.y-this.store.activeAnchor.y}else if(i.ctrlKey&&!i.shiftKey){var b={x:m.x,y:t.y};g=b.x-this.store.activeAnchor.x,y=b.y-this.store.activeAnchor.y}else g=t.x-this.store.activeAnchor.x,y=t.y-this.store.activeAnchor.y}else!i.ctrlKey&&i.shiftKey?(g=t.x-this.store.activeAnchor.x,y=0):i.ctrlKey&&!i.shiftKey?(g=0,y=t.y-this.store.activeAnchor.y):(g=t.x-this.store.activeAnchor.x,y=t.y-this.store.activeAnchor.y);wn(this.store.activeAnchor,g,y),this.store.hover&&this.store.hoverAnchor&&this.store.hoverAnchor.penId!==this.store.activeAnchor.penId&&(this.store.hoverAnchor.type===ir.Line?(g=t.x-this.store.activeAnchor.x,y=t.y-this.store.activeAnchor.y,Do(this.store.activeAnchor,this.store.hoverAnchor,this.store)):(g=this.store.hoverAnchor.x-this.store.activeAnchor.x,y=this.store.hoverAnchor.y-this.store.activeAnchor.y),wn(this.store.activeAnchor,g,y),v.prev=void 0,f.lineName!=="polyline"&&((s=this[f.lineName])===null||s===void 0||s.call(this,this.store,f)))}this.patchFlagsLines.add(f),this.store.path2dMap.set(f,ke.path2dDraws[f.name](f)),this.render(),this.store.active[0].calculative&&(this.store.active[0].calculative.gradientAnimatePath=void 0),this.store.emitter.emit("moveLineAnchor",{pen:this.store.active[0],anchor:this.store.activeAnchor}),this.timer&&clearTimeout(this.timer),this.timer=setTimeout(function(){a.timer=void 0,a.pushHistory({type:we.Update,pens:ce(a.store.active,!0),initPens:a.initPens}),a.initPens=void 0},500)}},e.prototype.moveLineAnchorPrev=function(t){var i=this;if(!(!this.activeRect||this.store.data.locked||!this.store.activeAnchor)){if(this.initPens||(this.initPens=ce(this.store.active,!0)),this.store.activeAnchor.prev.x=t.x,this.store.activeAnchor.prev.y=t.y,this.store.activeAnchor.next){if(!this.store.activeAnchor.prevNextType)this.store.activeAnchor.next.x=t.x,this.store.activeAnchor.next.y=t.y,Ge(this.store.activeAnchor.next,180,this.store.activeAnchor);else if(this.store.activeAnchor.prevNextType===Zr.Bilateral&&this.prevAnchor){var a=gi(t,this.store.activeAnchor),r=gi(this.prevAnchor,this.store.activeAnchor);this.store.activeAnchor.next.x=this.nextAnchor.x,this.store.activeAnchor.next.y=this.nextAnchor.y,Ge(this.store.activeAnchor.next,a-r,this.store.activeAnchor)}}var n=this.store.active[0];this.patchFlagsLines.add(n),this.store.path2dMap.set(n,ke.path2dDraws[n.name](n)),this.render(),this.timer&&clearTimeout(this.timer),this.timer=setTimeout(function(){i.timer=void 0,i.pushHistory({type:we.Update,pens:ce(i.store.active,!0),initPens:i.initPens}),i.initPens=void 0},200)}},e.prototype.moveLineAnchorNext=function(t){var i=this;if(!(!this.activeRect||this.store.data.locked||!this.store.activeAnchor)){if(this.initPens||(this.initPens=ce(this.store.active,!0)),this.store.activeAnchor.next.x=t.x,this.store.activeAnchor.next.y=t.y,this.store.activeAnchor.prev){if(!this.store.activeAnchor.prevNextType)this.store.activeAnchor.prev.x=t.x,this.store.activeAnchor.prev.y=t.y,Ge(this.store.activeAnchor.prev,180,this.store.activeAnchor);else if(this.store.activeAnchor.prevNextType===Zr.Bilateral&&this.nextAnchor){var a=gi(t,this.store.activeAnchor),r=gi(this.nextAnchor,this.store.activeAnchor);this.store.activeAnchor.prev.x=this.prevAnchor.x,this.store.activeAnchor.prev.y=this.prevAnchor.y,Ge(this.store.activeAnchor.prev,a-r,this.store.activeAnchor)}}var n=this.store.active[0];this.patchFlagsLines.add(n),this.store.path2dMap.set(n,ke.path2dDraws[n.name](n)),this.render(),this.timer&&clearTimeout(this.timer),this.timer=setTimeout(function(){i.timer=void 0,i.pushHistory({type:we.Update,pens:ce(i.store.active,!0),initPens:i.initPens}),i.initPens=void 0},200)}},e.prototype.setAnchor=function(t){var i;return Ei(this,void 0,void 0,function(){var a,r,n,o,s,s;return ki(this,function(h){switch(h.label){case 0:return a=[ce(this.store.hover,!0)],r=this.store.hover,this.store.hoverAnchor?(n=this.beforeRemoveAnchor,n?[4,this.beforeRemoveAnchor(r,this.store.hoverAnchor)]:[3,2]):[3,3];case 1:n=!h.sent(),h.label=2;case 2:return n?[2]:(r.type===Ye.Line&&((i=r.calculative.worldAnchors)===null||i===void 0?void 0:i.length)<=2?this.delete([r]):(z2(r,this.store.hoverAnchor),r.type===Ye.Line&&this.initLineRect(r)),this.store.hoverAnchor=void 0,this.store.activeAnchor=void 0,this.externalElements.style.cursor="default",[3,6]);case 3:return r?(o=this.beforeAddAnchor,o?[4,this.beforeAddAnchor(r,this.store.pointAt)]:[3,5]):[3,6];case 4:o=!h.sent(),h.label=5;case 5:if(o)return[2];r.type===Ye.Line?(this.store.activeAnchor=F2(r,this.store.pointAt,this.store.pointAtIndex),this.initLineRect(r),s={x:t.x,y:t.y},this.getHover(s)):(s={id:Me(),x:t.x,y:t.y},this.store.activeAnchor=N2(r,s)),h.label=6;case 6:return this.hotkeyType=Ke.None,this.render(),r&&this.pushHistory({type:we.Update,pens:[ce(r,!0)],initPens:a}),[2]}})})},e.prototype.checkDisconnect=function(t,i){var a=this;if(t.id.indexOf(Mi)>0){var r=t.id;t=this.store.pens[r.replace(Mi,"")]}t.anchors.forEach(function(n){if(n.connectTo&&!i.find(function(s){return s.id===n.connectTo||s.id===n.connectTo+Mi})){var o=a.store.pens[n.connectTo];if(!o||o.type)return;Ba(o,Kr(o,n.anchorId),t,n)}})},e.prototype.translatePens=function(t,i,a,r){var n=this;if(t===void 0&&(t=this.store.active),!(!t||!t.length)){var o=t.some(function(l){if(l.locked>=ze.DisableMove)return!0});if(!o){var s=!r&&ce(t,!0);this.activeRect&&Yr(this.activeRect,i,a);var h=this.getAllByPens(t);t.forEach(function(l){var c,f;if(!(l.locked>=ze.DisableMove)){if(l.type===Ye.Line){if(!n.store.options.moveConnectedLine&&!n.canMoveLine||l.isRuleLine)return;ld(l,i,a),n.checkDisconnect(l,h),n.store.path2dMap.set(l,ke.path2dDraws[l.name](l)),r||(n.initLineRect(l),(c=l.connectedLines)===null||c===void 0||c.forEach(function(v){var g=n.store.pens[v.lineId];n.initLineRect(g)}))}else Yr(l.calculative.worldRect,i,a),n.updatePenRect(l,{worldRectIsReady:!0}),l.calculative.x=l.x,l.calculative.y=l.y,l.calculative.initRect&&(l.calculative.initRect.x=l.calculative.x,l.calculative.initRect.y=l.calculative.y,l.calculative.initRect.ex=l.calculative.x+l.calculative.width,l.calculative.initRect.ey=l.calculative.y+l.calculative.height);n.updateLines(l),(f=l.onMove)===null||f===void 0||f.call(l,l)}}),this.activeRect&&this.getSizeCPs(),this.render(),this.tooltip.translate(i,a),r||(this.pushHistory({type:we.Update,pens:ce(t,!0),initPens:s}),this.initImageCanvas(t),this.initTemplateCanvas(t),this.store.emitter.emit("translatePens",t)),this.store.emitter.emit("translatingPens",t)}}},e.prototype.templateTranslatePens=function(t,i,a){var r=this;if(t===void 0&&(t=this.store.active),!(!t||!t.length)){var n=this.getAllByPens(t);t.forEach(function(o){var s;if(o.type===Ye.Line){if(!r.store.options.moveConnectedLine&&!r.canMoveLine)return;ld(o,i,a),r.checkDisconnect(o,n),r.store.path2dMap.set(o,ke.path2dDraws[o.name](o))}else Yr(o.calculative.worldRect,i,a),r.updatePenRect(o,{worldRectIsReady:!0}),o.calculative.x=o.x,o.calculative.y=o.y,o.calculative.initRect&&(o.calculative.initRect.x=o.calculative.x,o.calculative.initRect.y=o.calculative.y,o.calculative.initRect.ex=o.calculative.x+o.calculative.width,o.calculative.initRect.ey=o.calculative.y+o.calculative.height);(s=o.onMove)===null||s===void 0||s.call(o,o)})}},e.prototype.calcAutoAnchor=function(t,i,a,r){var n=lt(t),o=We(t),s=Ma(a,i===n?o:n);!s||(i.x=s.x,i.y=s.y,i.prev=void 0,i.next=void 0,r?r.anchor=s.id:_t(a,s,t,i),this[t.lineName]&&this[t.lineName](this.store,t),this.store.path2dMap.set(t,ke.path2dDraws.line(t)),this.initLineRect(t))},e.prototype.restoreNodeAnimate=function(t){var i,a;if(t.calculative.initRect){if(t.keepAnimateState)for(var r in t)t.calculative[r]!==void 0&&r!=="x"&&r!=="y"&&r!=="width"&&r!=="height"&&r!=="initRect"&&(typeof t[r]!="object"||r==="lineDash")&&(r==="fontSize"||r==="lineWidth"?t[r]=t.calculative[r]/t.calculative.canvas.store.data.scale:t[r]=t.calculative[r]);else{var n=t.calculative.initRect.rotate-t.calculative.rotate;for(var r in t)r!=="x"&&r!=="y"&&r!=="width"&&r!=="height"&&r!=="initRect"&&r!=="rotate"&&(typeof t[r]!="object"||r==="lineDash")&&(t.calculative[r]=t[r]);!((i=t.children)===null||i===void 0)&&i.length?n&&hg(t,n,t.calculative.worldRect):t.calculative.rotate=t.rotate;var o=ce(this.store.animateMap.get(t));o&&(o.id=t.id,this.parent.setValue(o,{doEvent:!1,render:!0,history:!1})),t.calculative.worldRect=t.calculative.initRect}this.updatePenRect(t,{worldRectIsReady:!0}),this.updateLines(t),t.image&&t.name!=="gif"&&(this.canvasImage.init(),this.canvasImageBottom.init()),t.calculative.text!==t.text&&(t.calculative.text=t.text,Nn(t)),!((a=this.store.active)===null||a===void 0)&&a.length&&this.calcActiveRect(),t.calculative.initRect=void 0}},e.prototype.updateLines=function(t,i){var a=this,r;(r=t.children)===null||r===void 0||r.forEach(function(n){var o=a.store.pens[n];o&&a.updateLines(o,i)}),t.connectedLines&&t.connectedLines.forEach(function(n){var o=a.store.pens[n.lineId];if(!(!o||o.calculative.active)){var s=Kr(o,n.lineAnchor);if(!!s){if(o.autoFrom){var h=lt(o);h.id===s.id&&a.calcAutoAnchor(o,h,t,n)}if(o.autoTo){var l=We(o);l.id===s.id&&a.calcAutoAnchor(o,l,t,n)}var c=Kr(t,n.anchor);if(!!c){var f=t.rotate;t.flipX&&(f*=-1),t.flipY&&(f*=-1);var v=s.distance*a.store.data.scale*Math.cos((f+c.rotate)/180*Math.PI)||0,g=s.distance*a.store.data.scale*Math.sin((f+c.rotate)/180*Math.PI)||0;if(t.flipX&&(v=-v),t.flipY&&(g=-g),wn(s,c.x-s.x+v,c.y-s.y+g),a.store.options.autoPolyline&&!a.autoPolylineFlag&&o.autoPolyline!==!1&&o.lineName==="polyline"){var h=lt(o),l=We(o),y=!1;h.id===s.id?(h=s,y=!0):l.id===s.id&&(l=s,y=!0),y&&(o.calculative.worldAnchors=[h,l],o.calculative.activeAnchor=h,a.polyline(a.store,o,l),a.initLineRect(o))}a.store.path2dMap.set(o,ke.path2dDraws[o.name](o)),a.patchFlagsLines.add(o),o.calculative.gradientSmooth&&(o.calculative.gradientAnimatePath=au(o)),i&&Uc(o)}}}})},e.prototype.calcActiveRect=function(){var t=this.store.active.filter(function(i){return(!i.locked||i.locked<ze.DisableMove)&&i.visible!=!1});if(t.length)t.length===1?(this.activeRect=ce(t[0].calculative.worldRect),this.activeRect.rotate=t[0].calculative.rotate||0,tt(this.activeRect)):(this.activeRect=Hi(t),this.activeRect.rotate=0);else return;this.lastRotate=0,this.getSizeCPs()},e.prototype.rotatePen=function(t,i,a){var r=this;t.type?(t.calculative.worldAnchors.forEach(function(n){Ge(n,i,a.center)}),this.initLineRect(t),Yo(t)):(t.calculative.rotate?t.calculative.rotate+=i:t.calculative.rotate=i,Ge(t.calculative.worldRect.center,i,a.center),t.parentId?(t.calculative.worldRect.x=t.calculative.worldRect.center.x-t.calculative.worldRect.width/2,t.calculative.worldRect.y=t.calculative.worldRect.center.y-t.calculative.worldRect.height/2,t.x=(t.calculative.worldRect.x-a.x)/a.width,t.y=(t.calculative.worldRect.y-a.y)/a.height):(t.x=t.calculative.worldRect.center.x-t.width/2,t.y=t.calculative.worldRect.center.y-t.height/2),t.rotate=t.calculative.rotate,this.updatePenRect(t),t.children&&t.children.forEach(function(n){var o=r.store.pens[n];r.rotatePen(o,i,t.calculative.worldRect)}))},e.prototype.nextAnimate=function(t){var i=this;if(!!t){this.store.emitter.emit("animateEnd",t);var a;t.nextAnimate&&(a=this.store.data.pens.filter(function(r){return r.id===t.nextAnimate||r.tags&&r.tags.indexOf(t.nextAnimate)>-1})),a&&(a.forEach(function(r){var n,o,s,h,l;if(r.calculative.pause){var c=Date.now()-r.calculative.pause;r.calculative.pause=void 0,r.calculative.frameStart+=c,r.calculative.frameEnd+=c}else if(r.name==="video")r.calculative.media.currentTime=0,(n=r.calculative.media)===null||n===void 0||n.play(),(o=r.onStartVideo)===null||o===void 0||o.call(r,r);else if(r.type||((s=r.frames)===null||s===void 0?void 0:s.length)||r.animations&&r.animations.length){if(r.type){if(!((l=r.animations)===null||l===void 0)&&l.length){var g=ce(r.animations[0]);delete g.name,g.currentAnimation=0,i.parent.setValue(Lt({id:r.id},g),{doEvent:!1,history:!1})}}else{if(!r.frames&&r.animations&&r.animations.length){var f=(h=r.animations)===null||h===void 0?void 0:h.findIndex(function(y){return y.autoPlay}),v=f===-1?0:f,g=ce(r.animations[v]);delete g.name,g.currentAnimation=v,!r.type&&g.frames&&(g.showDuration=i.parent.calcAnimateDuration(g)),i.parent.setValue(Lt({id:r.id},g),{doEvent:!1,history:!1})}i.store.animateMap.set(r,i.getFrameProps(r))}i.store.animates.add(r)}}),this.animate())}},e.prototype.getFrameProps=function(t){var i={};return t.frames&&t.frames.forEach(function(a){for(var r in a)!["duration","x","y","width","height","rotate"].includes(r)&&!i[r]&&(i[r]=t[r])}),i},e.prototype.animate=function(){var t=this;this.animateRendering||requestAnimationFrame(function(){var i,a,r=Date.now();if(r-t.lastAnimateRender<t.store.options.animateInterval){t.store.animates.size>0&&t.animate();return}t.lastAnimateRender=r,t.animateRendering=!0;var n=[],o=!1,s=function(f){if(f.calculative.pause)return"continue";if(f.calculative.active&&!f.type&&!t.movingPens&&(o=!0),!f.type)H2(f,r)?f.calculative.patchFlags&&(tt(f.calculative.worldRect),t.updatePenRect(f,{worldRectIsReady:!0,playingAnimate:!0})):(requestAnimationFrame(function(){t.restoreNodeAnimate(f)}),n.push(f),t.nextAnimate(f)),t.updateLines(f,!0);else if(!W2(f)){if(f.keepAnimateState){for(var v in f)f.calculative[v]!==void 0&&v!=="length"&&(typeof f[v]!="object"||v==="lineDash")&&(v==="lineWidth"?f[v]=f.calculative[v]/f.calculative.canvas.store.data.scale:f[v]=f.calculative[v]);Yo(f)}else for(var v in f)(typeof f[v]!="object"||v==="lineDash")&&(v==="lineWidth"?f.calculative[v]=f[v]*f.calculative.canvas.store.data.scale:f.calculative[v]=f[v]);n.push(f),t.nextAnimate(f)}t.patchFlags=!0};try{for(var h=at(t.store.animates),l=h.next();!l.done;l=h.next()){var c=l.value;s(c)}}catch(f){i={error:f}}finally{try{l&&!l.done&&(a=h.return)&&a.call(h)}finally{if(i)throw i.error}}o&&t.calcActiveRect(),n.forEach(function(f){t.store.animates.delete(f)}),t.render(!1),t.animateRendering=!1,t.animate()})},Object.defineProperty(e.prototype,"clipboardName",{get:function(){return"meta2d-clipboard"},enumerable:!1,configurable:!0}),e.prototype.copy=function(t,i){return i===void 0&&(i=!0),Ei(this,void 0,void 0,function(){var a,r,n,o,s,h,l=this;return ki(this,function(c){switch(c.label){case 0:if(a=Me(),r=this.store.data,n=r.origin,o=r.scale,this.store.clipboard=void 0,localStorage.removeItem(this.clipboardName),sessionStorage.setItem("page",a),s=this.getAllByPens(ce(t||this.store.active,!0)),s.forEach(function(f){f.copyIndex=l.store.data.pens.findIndex(function(v){return v.id===f.id}),f.pathId&&(f.path=l.store.data.paths[f.pathId])}),s.sort(function(f,v){return f.copyIndex-v.copyIndex}),s.forEach(function(f){delete f.copyIndex}),h={meta2d:!0,pens:s,origin:ce(n),scale:o,page:a,initRect:ce(this.activeRect),offset:10},!(navigator.clipboard&&!this.store.options.disableClipboard&&!navigator.userAgent.includes("Firefox")))return[3,5];c.label=1;case 1:return c.trys.push([1,3,,4]),[4,navigator.clipboard.writeText(JSON.stringify(h))];case 2:return c.sent(),[3,4];case 3:return c.sent(),localStorage.setItem(this.clipboardName,JSON.stringify(h)),[3,4];case 4:return[3,6];case 5:localStorage.setItem(this.clipboardName,JSON.stringify(h)),c.label=6;case 6:return i&&this.store.emitter.emit("copy",h.pens),[2]}})})},e.prototype.cut=function(t){this.copy(t,!1),this.delete(t),this.store.emitter.emit("cut",t)},e.prototype.paste=function(){var t;return Ei(this,void 0,void 0,function(){var i,a,r,n,o,s,h,l,c,f,v,g;return ki(this,function(y){switch(y.label){case 0:if(!(navigator.clipboard&&!this.store.options.disableClipboard&&!navigator.userAgent.includes("Firefox")))return[3,5];y.label=1;case 1:return y.trys.push([1,3,,4]),[4,(t=navigator.clipboard)===null||t===void 0?void 0:t.readText()];case 2:return i=y.sent(),[3,4];case 3:return y.sent(),i=localStorage.getItem(this.clipboardName),[3,4];case 4:return[3,6];case 5:i=localStorage.getItem(this.clipboardName),y.label=6;case 6:if(i){try{a=JSON.parse(i)}catch(p){return console.warn("\u526A\u5207\u677F\u6570\u636E\u4E0D\u662Fjson",p.message),[2]}if(!a||!a.meta2d)return[2]}else return[2];return r=this.beforeAddPens,r?[4,this.beforeAddPens(a.pens)]:[3,8];case 7:r=y.sent()!=!0,y.label=8;case 8:if(r)return[2];this.store.clipboard&&(n=this.store.clipboard.offset+10,o=this.store.clipboard.pos),this.store.clipboard=ce(a),s=sessionStorage.getItem("page"),s!==a.page?(this.store.clipboard.pos={x:this.mousePos.x,y:this.mousePos.y},this.store.clipboard.offset=0):this.pasteOffset?(n&&(this.store.clipboard.offset=n),o&&(this.store.clipboard.pos=o)):(this.store.clipboard.offset=0,this.pasteOffset=!0),h=this.store.clipboard.pens.filter(function(p){return!p.parentId});try{for(l=at(h),c=l.next();!c.done;c=l.next())f=c.value,this.pastePen(f,void 0)}catch(p){v={error:p}}finally{try{c&&!c.done&&(g=l.return)&&g.call(l)}finally{if(v)throw v.error}}return sessionStorage.setItem("page",a.page),this.active(h),this.pushHistory({type:we.Add,pens:this.store.clipboard.pens}),this.render(),this.store.emitter.emit("add",this.store.clipboard.pens),this.store.emitter.emit("paste",this.store.clipboard.pens),[2]}})})},e.prototype.getAllByPens=function(t){var i,a,r=[];try{for(var n=at(t),o=n.next();!o.done;o=n.next()){var s=o.value;r.push.apply(r,Di([],Li(ce(Er(s,this.store),!0)),!1))}}catch(h){i={error:h}}finally{try{o&&!o.done&&(a=n.return)&&a.call(n)}finally{if(i)throw i.error}}return r.concat(t)},e.prototype.changeLineAnchors=function(t,i,a){if(!!Array.isArray(i.connectedLines))for(var r=function(s){var h=i.connectedLines[s].lineId,l=a.find(function(v){return v.id===h});if(l){var c=l.anchors[0],f=l.anchors[l.anchors.length-1];c.connectTo===t&&(c.connectTo=i.id),f.connectTo===t&&(f.connectTo=i.id)}else i.connectedLines.splice(s,1),s--;n=s},n,o=0;o<i.connectedLines.length;o++)r(o),o=n},e.prototype.changeNodeConnectedLine=function(t,i,a){var r,n,o,s=i.anchors[0],h=i.anchors[i.anchors.length-1],l=[s,h],c=function(y){var p=y.connectTo;if(p){var m=a.find(function(b){return b.id===p});m?(o=m.connectedLines)===null||o===void 0||o.forEach(function(b){b.lineId===t&&(b.lineId=i.id,b.lineAnchor=y.id)}):(y.connectTo=void 0,y.prev&&(y.prev.connectTo=void 0),y.next&&(y.next.connectTo=void 0))}};try{for(var f=at(l),v=f.next();!v.done;v=f.next()){var g=v.value;c(g)}}catch(y){r={error:y}}finally{try{v&&!v.done&&(n=f.return)&&n.call(f)}finally{if(r)throw r.error}}},e.prototype.delete=function(t,i,a){return t===void 0&&(t=this.store.active),i===void 0&&(i=!1),a===void 0&&(a=!0),Ei(this,void 0,void 0,function(){var r,n;return ki(this,function(o){switch(o.label){case 0:return!t||!t.length?[2]:(r=this.beforeRemovePens,r?[4,this.beforeRemovePens(t)]:[3,2]);case 1:r=o.sent()!=!0,o.label=2;case 2:if(r)return[2];if(i||(t=t.filter(function(s){return!s.locked})),!t||!t.length)return[2];if(n=[],this._del(t,n,i),this.initImageCanvas(n),this.initTemplateCanvas(n),this.inactive(),this.clearHover(),this.render(),a){if(n.length===0)return[2];this.pushHistory({type:we.Delete,pens:n})}return this.store.emitter.emit("delete",t),[2]}})})},e.prototype._del=function(t,i,a){var r=this;!t||t.forEach(function(n){if(n.type&&(n.lastConnected={}),n.parentId){var o=r.getLockedParent(n);if(o){console.warn("\u7236\u8282\u70B9\u9501\u5B9A");return}else{var s=ri(n),h=s.children.indexOf(n.id);s.children.splice(h,1),i&&r.getDelPens(n,i),r.delForce(n)}}else{if(!a&&n.locked)return;i&&r.getDelPens(n,i),r.delForce(n)}})},e.prototype.getDelPens=function(t,i){var a=this;if(!!t){var r=this.store.data.pens.findIndex(function(o){return o.id===t.id});if(r>-1){var n=this.store.pens[t.id];n.calculative.active=void 0,i.push(n)}t.children&&t.children.forEach(function(o){a.getDelPens(a.store.pens[o],i)})}},e.prototype.getLockedParent=function(t){if(!t.parentId)return!1;var i=ri(t);if(i.locked)return i;this.getLockedParent(i)},e.prototype.delForce=function(t){var i=this,a;if(!!t){var r=this.store.data.pens.findIndex(function(n){return n.id===t.id});r>-1&&(this.delConnectedLines(this.store.data.pens[r]),this.store.data.pens.splice(r,1),this.store.pens[t.id]=void 0,delete this.store.pens[t.id]),this.store.animates.delete(t),this.store.animateMap.delete(t),t.children&&t.children.forEach(function(n){i.delForce(i.store.pens[n])}),(a=t.onDestroy)===null||a===void 0||a.call(t,t)}},e.prototype.delConnectedLines=function(t){var i=this,a;if(t.connectedLines)for(var r=function(s){var h=t.connectedLines[s],l=h.lineId,c=h.lineAnchor,f=n.store.pens[l];if(f){var v=f.anchors.find(function(g){return g.id===c});(v==null?void 0:v.connectTo)===t.id&&(v.connectTo=void 0,v.anchorId=void 0,v.prev&&(v.prev.connectTo=void 0),v.next&&(v.next.connectTo=void 0)),v=Kr(f,c),v&&(v.connectTo=void 0,v.anchorId=void 0,v.prev&&(v.prev.connectTo=void 0),v.next&&(v.next.connectTo=void 0))}},n=this,o=0;o<t.connectedLines.length;o++)r(o);!t.type||(a=t.calculative.worldAnchors)===null||a===void 0||a.forEach(function(s,h){var l;if(!!s.connectTo){var c=i.store.pens[s.connectTo];c&&((l=c.calculative.worldAnchors)===null||l===void 0||l.forEach(function(f){Ba(c,f,t,s)}))}})},e.prototype.convertSpecialCharacter=function(t){var i={lt:"<",gt:">",nbsp:" ",amp:"&",quot:'"'};return t.replace(/&(lt|gt|nbsp|amp|quot);/gi,function(a,r){return i[r]})},e.prototype.createInput=function(){var t=this;this.inputParent.classList.add("meta2d-input"),this.inputRight.classList.add("right"),this.inputDiv.classList.add("input-div"),this.inputParent.appendChild(this.inputDiv),this.inputParent.appendChild(this.inputRight),this.dropdown.onmouseleave=function(){t.store.hover=null},this.inputParent.appendChild(this.dropdown),this.externalElements.appendChild(this.inputParent),this.inputParent.onmousedown=this.stopPropagation,this.inputDiv.onmousedown=this.stopPropagation,this.inputDiv.contentEditable="false",this.inputRight.onmousedown=this.stopPropagation,this.dropdown.onmousedown=this.stopPropagation,this.inputRight.style.transform="rotate(135deg)";for(var i,a=0;a<document.styleSheets.length;a++)document.styleSheets[a].title==="le5le.com"&&(i=document.styleSheets[a]);if(!i){var r=document.createElement("style");r.title="le5le.com",document.head.appendChild(r),i=r.sheet,i.insertRule(".meta2d-input{display:none;position:absolute;outline:none;align-items: center;}"),i.insertRule(".meta2d-input textarea{resize:none;border:none;outline:none;background:transparent;flex-grow:1;height:100%;left:0;top:0}"),i.insertRule(".meta2d-input .right{width:10px;height:10px;flex-shrink:0;border-top: 1px solid;border-right: 1px solid;margin-right: 5px;transition: all .3s cubic-bezier(.645,.045,.355,1);position:absolute;right:1px;}"),i.insertRule(".meta2d-input ul{position:absolute;top:100%;left:-5px;width:calc(100% + 10px);min-height:30px;border-radius: 2px;box-shadow: 0 2px 8px #00000026;list-style-type: none;background-color: #fff;padding: 4px 0;max-height: 105px;overflow-y: auto;}"),i.insertRule(".meta2d-input ul li{padding: 5px 12px;line-height: 22px;white-space: nowrap;cursor: pointer;}"),i.insertRule(".meta2d-input ul li:hover{background: #eeeeee;}"),i.insertRule(".input-div::-webkit-scrollbar {display:none}"),i.insertRule(".input-div{scrollbar-width: none;}"),i.insertRule(".meta2d-input .input-div{resize:none;border:none;outline:none;background:transparent;flex-grow:1;height:100%;width: 100%;left:0;top:0;display:flex;text-align: center;justify-content: center;flex-direction: column;}"),i.insertRule(".input-div div{}")}this.inputDiv.onfocus=function(n){if(navigator.userAgent.includes("Firefox")){if(!n.target.innerText){var o=t.inputDiv.offsetWidth/2,s=window.getComputedStyle(t.inputDiv,null);s.textAlign!=="center"&&(o=0),t.inputDiv.innerHTML='<br style="margin-left:'+o+'px;margin-top:4px;" />'}}else if(n.target.innerText)t.inputDiv.style.paddingTop="";else{var s=window.getComputedStyle(t.inputDiv,null);s.justifyContent==="center"&&(t.inputDiv.style.paddingTop=" "+(t.inputDiv.offsetHeight/2-parseFloat(s.lineHeight)/2)+"px")}},this.inputDiv.onblur=function(){setTimeout(function(){t.hideInput()},300)},this.inputDiv.oninput=function(n){var o=t.store.pens[t.inputDiv.dataset.penId];if(o.inputType==="number"){var s=n.target.innerText,h=s.replace(/[^0-9]/g,"");s!==h&&(n.preventDefault(),n.target.innerText=h)}if(navigator.userAgent.includes("Firefox")){if(!n.target.innerText.trim()){var l=t.inputDiv.offsetWidth/2,c=window.getComputedStyle(t.inputDiv,null);c.textAlign!=="center"&&(l=0),t.inputDiv.innerHTML='<br style="margin-left:'+l+'px;margin-top:4px;" />'}}else if(n.target.innerText)t.inputDiv.style.paddingTop="";else{var c=window.getComputedStyle(t.inputDiv,null);c.justifyContent==="center"&&(t.inputDiv.style.paddingTop=" "+(t.inputDiv.offsetHeight/2-parseFloat(c.lineHeight)/2)+"px")}},this.inputDiv.onclick=function(n){n.stopPropagation();var o=t.store.pens[t.inputDiv.dataset.penId];t.dropdown.style.display==="block"?(t.dropdown.style.display="none",t.inputRight.style.transform="rotate(135deg)"):(o==null?void 0:o.dropdownList)&&t.store.data.locked&&(t.dropdown.style.display="block",t.inputRight.style.transform="rotate(315deg)"),t.store.emitter.emit("clickInput",o)},this.inputDiv.onkeyup=function(n){t.setDropdownList(!0);var o=t.store.pens[t.inputDiv.dataset.penId];t.store.emitter.emit("input",{pen:o,text:n.key}),n.stopPropagation()},this.inputDiv.onkeydown=function(n){n.stopPropagation()},this.inputDiv.onmousedown=this.stopPropagation,this.inputDiv.onwheel=function(n){n.stopPropagation()},this.inputDiv.onpaste=function(n){n.preventDefault();var o="";n.clipboardData&&n.clipboardData.getData&&(o=n.clipboardData.getData("text/plain")),document.execCommand("insertHTML",!1,o)}},e.prototype.clearDropdownList=function(){if(this.dropdown.hasChildNodes())for(var t=0;t<this.dropdown.childNodes.length;t++)this.dropdown.childNodes[t].remove(),--t},e.prototype.dropdownAppendOption=function(t,i){var a=document.createElement("li");a.onwheel=this.stopPropagation,a.innerText=t,a.style.overflow="hidden",a.style.textOverflow="ellipsis",a.title=t,a.style.zoom=this.store.data.scale,a.onmousedown=this.stopPropagation,a.dataset.i=i+"",a.onclick=this.selectDropdown,this.dropdown.appendChild(a)},e.prototype.find=function(t){return this.store.data.pens.filter(function(i){return i.id==t||i.tags&&i.tags.indexOf(t)>-1})},e.prototype.findOne=function(t){return this.store.data.pens.find(function(i){return i.id==t||i.tags&&i.tags.indexOf(t)>-1})},e.prototype.changePenId=function(t,i){var a=this,r,n,o,s,h;if(t!==i){var l=this.store.pens[t];if(!!l&&!this.store.pens[i]){if(l.id=i,this.store.pens[i]=this.store.pens[t],(r=l.onChangeId)===null||r===void 0||r.call(l,l,t,i),delete this.store.pens[t],l.parentId){var c=this.store.pens[l.parentId],f=(n=c.children)===null||n===void 0?void 0:n.findIndex(function(v){return v===t});f!==-1&&((o=c.children)===null||o===void 0||o.splice(f,1,i))}(s=l.children)===null||s===void 0||s.forEach(function(v){var g=a.store.pens[v];g.parentId=i}),l.type===Ye.Line?this.changeNodeConnectedLine(t,l,this.store.data.pens):(this.changeLineAnchors(t,l,this.store.data.pens),(h=l.connectedLines)===null||h===void 0||h.forEach(function(v){var g=v.lineId,y=a.store.pens[g];_n(y)}))}}},e.prototype.updateValue=function(t,i){var a,r,n,o,s,h,l=this.getPenRect(t),c=t.name;Object.assign(t,i);var f=c!==t.name;i.newId&&this.changePenId(t.id,i.newId);var v=!1,g=!1,y=!1,p=!1,m=!1,b=!1,x=void 0,_=!1;for(var k in i)k.indexOf(".")===-1?(k==="rotate"?x=t.calculative.rotate||0:k==="canvasLayer"||k==="isBottom"||k==="showChild"?b=!0:k==="image"&&(_=!0),(typeof t[k]!="object"||k==="lineDash")&&(t.calculative[k]=i[k]),xx.includes(k)&&(g=!0),["name","borderRadius","lineSmooth"].includes(k)&&(v=!0),Ex.includes(k)&&(m=!0),kx.includes(k)&&(y=!0),Cx.includes(k)&&(p=!0)):(delete t[k],f2(t,k,i[k])),k.split(".")[0]==="anchors"&&_n(t);if(this.setCalculativeByScale(t),f&&((a=t.onDestroy)===null||a===void 0||a.call(t,t),Sx(t)),m){var I={x:(r=i.x)!==null&&r!==void 0?r:l.x,y:(n=i.y)!==null&&n!==void 0?n:l.y,width:(o=i.width)!==null&&o!==void 0?o:l.width,height:(s=i.height)!==null&&s!==void 0?s:l.height};this.setPenRect(t,I,!1),this.updateLines(t,!0),this.store.active&&this.store.active.length&&t.id===this.store.active[0].id&&this.calcActiveRect()}else y?this.updatePenRect(t):(g&&Ni(t),p&&sd(this.store.pens,t),v&&ke.path2dDraws[t.name]&&this.store.path2dMap.set(t,ke.path2dDraws[t.name](t)));if(x!==void 0){var P=t.calculative.rotate;t.calculative.rotate=x,this.rotatePen(t,P-x,t.calculative.worldRect)}(i.image||i.backgroundImage||i.strokeImage)&&(t.calculative.image=void 0,t.calculative.backgroundImage=void 0,t.calculative.strokeImage=void 0,this.loadImage(t)),i.lineGradientColors&&(t.calculative.lineGradient=void 0,t.calculative.gradientColorStop=void 0),i.gradientColors&&(t.calculative.gradient=void 0,t.calculative.radialGradient=void 0),i.gradientRadius&&(t.calculative.gradient=void 0,t.calculative.radialGradient=void 0),i.animateLineWidth&&(t.calculative.gradientAnimatePath=void 0),i.gradientSmooth&&(t.calculative.gradientAnimatePath=void 0),b?(this.canvasImage.init(),this.canvasImageBottom.init()):_&&(t.canvasLayer===void 0&&(t.canvasLayer=Ne.CanvasImageBottom,t.calculative.canvasLayer=Ne.CanvasImageBottom),t.canvasLayer===Ne.CanvasImageBottom?this.canvasImageBottom.init():t.canvasLayer===Ne.CanvasImage&&this.canvasImage.init()),(i.canvasLayer!==void 0||t.canvasLayer===Ne.CanvasTemplate)&&this.initTemplateCanvas([t]),i.zIndex!==void 0&&!((h=t.calculative.singleton)===null||h===void 0)&&h.div&&Ai(t,t.calculative.singleton.div)},e.prototype.execPenResize=function(t){var i=this,a,r;(a=t.onResize)===null||a===void 0||a.call(t,t),(r=t.children)===null||r===void 0||r.forEach(function(n){var o=i.store.pens[n];o&&i.execPenResize(o)})},e.prototype.setPenRect=function(t,i,a){if(a===void 0&&(a=!0),t.parentId)Object.assign(t,i);else{var r=this.store.data,n=r.origin,o=r.scale;t.x=n.x+i.x*o,t.y=n.y+i.y*o,t.width=i.width*o,t.height=i.height*o}this.updatePenRect(t),this.execPenResize(t),a&&this.render()},e.prototype.getPenRect=function(t,i,a){if(i===void 0&&(i=this.store.data.origin),a===void 0&&(a=this.store.data.scale),!!t)return t.parentId?{x:t.x,y:t.y,width:t.width,height:t.height}:{x:(t.x-i.x)/a,y:(t.y-i.y)/a,width:t.width/a,height:t.height/a}},e.prototype.toPng=function(t,i,a,r){var n,o;t===void 0&&(t=2),a===void 0&&(a=!1);var s=Hi(this.store.data.pens),h=this.store.data.scale;if(!isFinite(s.width))throw new Error("can not to png, because width is not finite");var l=ce(s),c=this.store.data,f=a&&!c.background&&this.store.bkImg,v=!1,g=!1;if(f){if(s.x+=c.x,s.y+=c.y,ot(s),fs(s,this.canvasRect,!0))Object.assign(s,this.canvasRect);else{var y=Fn(Di(Di([],Li(sr(s)),!1),Li(sr(this.canvasRect)),!1));Object.assign(s,y)}v=s.x===0,g=s.y===0}var p=this.store.data.width||this.store.options.width,m=this.store.data.height||this.store.options.height,b=!1;p&&m&&!this.store.data.component&&(b=!0),b&&(s.x=this.store.data.origin.x,s.y=this.store.data.origin.y,s.width=p*this.store.data.scale,s.height=m*this.store.data.scale);var x=ce(s),_=ar(t);s.x-=_[3]*h,s.y-=_[0]*h,s.width+=(_[3]+_[1])*h,s.height+=(_[0]+_[2])*h;var k=(r||1920)/s.width;s.width*=k,s.height*=k,ot(s);var I=document.createElement("canvas");if(I.width=s.width,I.height=s.height,I.width>32767||I.height>32767||!navigator.userAgent.includes("Firefox")&&I.height*I.width>268435456||navigator.userAgent.includes("Firefox")&&I.height*I.width>472907776)throw new Error("can not to png, because the size exceeds the browser limit");var P=I.getContext("2d");P.textBaseline="middle",P.scale(k,k);var M=this.store.data.background||this.store.options.background;if(M&&(P.save(),P.fillStyle=M,b?P.fillRect(0,0,x.width+(_[1]+_[3])*h,x.height+(_[0]+_[2])*h):P.fillRect(0,0,l.width+(_[3]+_[1])*h,l.height+(_[0]+_[2])*h),P.restore()),f)if(b)P.drawImage(this.store.bkImg,_[3]*h||0,_[0]*h||0,x.width,x.height);else{var L=s.x<0?-s.x:0,U=s.y<0?-s.y:0;P.drawImage(this.store.bkImg,L,U,this.canvasRect.width,this.canvasRect.height)}f?b?P.translate(-l.x+_[3]*h||0,-l.y+_[0]*h||0):P.translate((v?c.x:-l.x)+_[3]*h||0,(g?c.y:-l.y)+_[0]*h||0):P.translate(-s.x,-s.y);try{for(var $=at(this.store.data.pens),S=$.next();!S.done;S=$.next()){var T=S.value;if(!(!hs(T,this.store)||T.visible==!1)){var R=T.calculative.active;T.calculative.active=!1,T.calculative.img?cs(P,T):jr(P,T,!0),T.calculative.active=R}}}catch(O){n={error:O}}finally{try{S&&!S.done&&(o=$.return)&&o.call($)}finally{if(n)throw n.error}}if(i){I.toBlob(i);return}return I.toDataURL()},e.prototype.activeToPng=function(t){return t===void 0&&(t=2),this.pensToPng(this.store.active,t)},e.prototype.pensToPng=function(t,i){var a,r;if(t===void 0&&(t=this.store.active),i===void 0&&(i=2),t.length!==0){var n=this.getAllByPens(t),o=n.map(function(m){return m.id}),s=Hi(n);if(!isFinite(s.width))throw new Error("can not to png, because width is not finite");var h=ce(s),l=ar(i);s.x-=l[3],s.y-=l[0],s.width+=l[3]+l[1],s.height+=l[0]+l[2],ot(s);var c=document.createElement("canvas");if(c.width=s.width,c.height=s.height,c.width>32767||c.height>32767||!navigator.userAgent.includes("Firefox")&&c.height*c.width>268435456||navigator.userAgent.includes("Firefox")&&c.height*c.width>472907776)throw new Error("can not to png, because the size exceeds the browser limit");var f=c.getContext("2d");f.textBaseline="middle",f.translate(-h.x,-h.y);try{for(var v=at(this.store.data.pens),g=v.next();!g.done;g=v.next()){var y=g.value;if(o.includes(y.id)){if(!hs(y,this.store)||y.visible==!1)continue;var p=y.calculative.active;y.calculative.active=!1,y.calculative.img?cs(f,y):jr(f,y),y.calculative.active=p}}}catch(m){a={error:m}}finally{try{g&&!g.done&&(r=v.return)&&r.call(v)}finally{if(a)throw a.error}}return c.toDataURL()}},e.prototype.toggleAnchorMode=function(){var t;if(this.hotkeyType)this.hotkeyType===Ke.AddAnchor&&(this.hotkeyType=Ke.None,this.store.hoverAnchor?this.externalElements.style.cursor="vertical-text":this.store.hover&&(this.externalElements.style.cursor="move"));else{if(this.store.options.disableAnchor||((t=this.store.hover)===null||t===void 0?void 0:t.disableAnchor))return;this.hotkeyType=Ke.AddAnchor,this.store.hover&&(this.externalElements.style.cursor="pointer")}this.patchFlags=!0},e.prototype.addAnchorHand=function(){if(this.store.activeAnchor&&this.store.active&&this.store.active.length===1&&this.store.active[0].type){var t=[ce(this.store.active[0],!0)];this.store.activeAnchor.prev?this.store.activeAnchor.next||(this.store.activeAnchor.next=Lt({},this.store.activeAnchor.prev),Ge(this.store.activeAnchor.next,180,this.store.activeAnchor),this.initLineRect(this.store.active[0]),this.patchFlags=!0):(this.store.activeAnchor.next||(this.store.activeAnchor.next={penId:this.store.activeAnchor.penId,x:this.store.activeAnchor.x+50,y:this.store.activeAnchor.y}),this.store.activeAnchor.prev=Lt({},this.store.activeAnchor.next),Ge(this.store.activeAnchor.prev,180,this.store.activeAnchor),this.initLineRect(this.store.active[0]),this.patchFlags=!0),this.pushHistory({type:we.Update,pens:[ce(this.store.active[0],!0)],initPens:t})}},e.prototype.removeAnchorHand=function(){if(this.store.activeAnchor&&this.store.active&&this.store.active.length===1&&this.store.active[0].type){var t=[ce(this.store.active[0],!0)];this.hoverType===be.LineAnchorPrev?(this.store.activeAnchor.prev=void 0,this.initLineRect(this.store.active[0]),this.patchFlags=!0):this.hoverType===be.LineAnchorNext?(this.store.activeAnchor.next=void 0,this.initLineRect(this.store.active[0]),this.patchFlags=!0):(this.store.activeAnchor.prev=void 0,this.store.activeAnchor.next=void 0,this.initLineRect(this.store.active[0]),this.patchFlags=!0),this.pushHistory({type:we.Update,pens:[ce(this.store.active[0])],initPens:t})}},e.prototype.toggleAnchorHand=function(){this.store.active.length===1&&this.store.active[0].type&&this.store.activeAnchor&&(this.store.activeAnchor.prevNextType||(this.store.activeAnchor.prevNextType=Zr.Mirror),this.store.activeAnchor.prevNextType=(this.store.activeAnchor.prevNextType+1)%3)},e.prototype.gotoView=function(t,i){var a=Hi(this.store.data.pens);if(!isFinite(a.width))throw new Error("can not move view, because width is not finite");this.store.data.x=this.canvas.clientWidth/2-t*a.width-a.x,this.store.data.y=this.canvas.clientHeight/2-i*a.height-a.y,this.onMovePens(),this.canvasTemplate.init(),this.canvasImage.init(),this.canvasImageBottom.init(),this.render()},e.prototype.showMagnifier=function(){this.magnifierCanvas.magnifier=!0,this.externalElements.style.cursor="default",this.render()},e.prototype.hideMagnifier=function(){this.magnifierCanvas.magnifier=!1,this.externalElements.style.cursor="default",this.render()},e.prototype.toggleMagnifier=function(){this.magnifierCanvas.magnifier=!this.magnifierCanvas.magnifier,this.magnifierCanvas.magnifier&&(this.externalElements.style.cursor="default"),this.render()},e.prototype.destroy=function(){var t,i,a;switch(this.scroll&&this.scroll.destroy(),(t=this.tooltip)===null||t===void 0||t.destroy(),(i=this.dialog)===null||i===void 0||i.destroy(),(a=this.title)===null||a===void 0||a.destroy(),this.externalElements.removeEventListener("gesturestart",this.onGesturestart),this.externalElements.ondragover=function(r){return r.preventDefault()},this.externalElements.ondrop=void 0,this.externalElements.ontouchstart=void 0,this.externalElements.ontouchmove=void 0,this.externalElements.ontouchend=void 0,this.externalElements.onmousedown=void 0,this.externalElements.onmousemove=void 0,this.externalElements.onmouseup=void 0,this.externalElements.onmouseleave=void 0,this.externalElements.ondblclick=void 0,this.store.options.keydown){case $r.Document:document.removeEventListener("keydown",this.onkeydown),document.removeEventListener("keyup",this.onkeyup);break;case $r.Canvas:this.externalElements.removeEventListener("keydown",this.onkeydown),this.externalElements.removeEventListener("keyup",this.onkeyup);break}document.removeEventListener("copy",this.onCopy),document.removeEventListener("cut",this.onCut),document.removeEventListener("paste",this.onPaste),window&&window.removeEventListener("resize",this.onResize),window&&window.removeEventListener("scroll",this.onScroll)},e}(),dt;(function(e){e[e.Link=0]="Link",e[e.SetProps=1]="SetProps",e[e.StartAnimate=2]="StartAnimate",e[e.PauseAnimate=3]="PauseAnimate",e[e.StopAnimate=4]="StopAnimate",e[e.JS=5]="JS",e[e.GlobalFn=6]="GlobalFn",e[e.Emit=7]="Emit",e[e.StartVideo=8]="StartVideo",e[e.PauseVideo=9]="PauseVideo",e[e.StopVideo=10]="StopVideo",e[e.SendPropData=11]="SendPropData",e[e.SendVarData=12]="SendVarData",e[e.Navigator=13]="Navigator",e[e.Dialog=14]="Dialog",e[e.SendData=15]="SendData",e[e.PostMessage=16]="PostMessage",e[e.PostMessageToParent=17]="PostMessageToParent"})(dt||(dt={}));var Dk=function(){function e(t){var i=this;this.parent=t,this.boxWidth=320,this.boxHeight=180,this.ratio=this.boxWidth/this.boxHeight,this.padding=5,this.onMouseDown=function(o){o.preventDefault(),o.stopPropagation(),i.isDown=!0},this.onMouseMove=function(o){if(o.preventDefault(),o.stopPropagation(),i.isDown)try{i.parent.gotoView(o.offsetX/i.box.clientWidth,o.offsetY/i.box.clientHeight)}catch(s){console.warn(s.message),i.isDown=!1}},this.onMouseUp=function(o){o.preventDefault(),o.stopPropagation();try{i.parent.gotoView(o.offsetX/i.box.clientWidth,o.offsetY/i.box.clientHeight)}catch(s){console.warn(s.message)}finally{i.isDown=!1}},this.box=document.createElement("div"),this.img=new Image,this.view=document.createElement("div"),this.box.appendChild(this.img),this.box.appendChild(this.view),this.parent.externalElements.appendChild(this.box),this.box.className="meta2d-map",this.box.onmousedown=this.onMouseDown,this.box.onmousemove=this.onMouseMove,this.box.onmouseup=this.onMouseUp;for(var a,r=0;r<document.styleSheets.length;r++)document.styleSheets[r].title==="le5le/map"&&(a=document.styleSheets[r]);if(!a){var n=document.createElement("style");n.type="text/css",n.title="le5le.com/map",document.head.appendChild(n),n=document.createElement("style"),n.type="text/css",document.head.appendChild(n),a=n.sheet,a.insertRule(".meta2d-map{display:flex;width:"+(this.boxWidth+2*this.padding)+"px;height:"+(this.boxHeight+2*this.padding)+"px;padding:"+this.padding+"px;background:#f4f4f4;border:1px solid #ffffff;box-shadow: 0px 0px 14px 0px rgba(0,10,38,0.30);border-radius:8px;position:absolute;z-index:9999;right:0;bottom:0;justify-content:center;align-items:center;cursor:default;user-select:none;overflow: hidden;}"),a.insertRule(".meta2d-map img{max-width:100%;max-height:100%;pointer-events: none;}"),a.insertRule(".meta2d-map div{pointer-events: none;border:1px solid #1890ff;position:absolute}")}}return e.prototype.show=function(){this.box.style.display="flex";var t=this.parent.store.data;t.pens.length?(this.img.style.display="block",this.img.src=this.parent.toPng(),this.setView()):this.img.style.display="none",this.isShow=!0},e.prototype.hide=function(){this.box.style.display="none",this.isShow=!1},e.prototype.setView=function(){var t=this.parent.store.data;if(t.pens.length){var i=Hi(t.pens);Yr(i,t.x,t.y);var a=i.width/i.height;if(a>this.ratio){var r=i.width/this.ratio;i.y-=(r-i.height)/2,i.height=r,ot(i)}else{var n=i.height*this.ratio;i.x-=(n-i.width)/2,i.width=n,ot(i)}var o=this.parent.canvasRect,s=0,h=0;if(i.x<0)s=-i.x/i.width;else if(i.x+i.width>o.width){var l=0;o.width>i.width&&(l=o.width-i.width),s=(-i.x+l)/i.width}if(i.y<0)h=-i.y/i.height;else if(i.y+i.height>o.height){var l=0;o.height>i.height&&(l=o.height-i.height),h=(-i.y+l)/i.height}var c=o.width>i.width?1:o.width/i.width,f=o.height>i.height?1:o.height/i.height;this.view.style.left=this.padding+s*this.boxWidth+"px",this.view.style.width=c*this.boxWidth+"px",this.view.style.top=this.padding+h*this.boxHeight+"px",this.view.style.height=f*this.boxHeight+"px"}},e}();function Wo(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Qo={exports:{}};(function(e,t){(function(i){e.exports=i()})(function(){return function(){return function i(a,r,n){function o(l,c){if(!r[l]){if(!a[l]){var f=typeof Wo=="function"&&Wo;if(!c&&f)return f(l,!0);if(s)return s(l,!0);var v=new Error("Cannot find module '"+l+"'");throw v.code="MODULE_NOT_FOUND",v}var g=r[l]={exports:{}};a[l][0].call(g.exports,function(y){return o(a[l][1][y]||y)},g,g.exports,i,a,r,n)}return r[l].exports}for(var s=typeof Wo=="function"&&Wo,h=0;h<n.length;h++)o(n[h]);return o}}()({1:[function(i,a,r){(function(n,o){(function(){const s=i("events").EventEmitter,h=i("./store"),l=i("./topic-alias-recv"),c=i("./topic-alias-send"),f=i("mqtt-packet"),v=i("./default-message-id-provider"),g=i("readable-stream").Writable,y=i("inherits"),p=i("reinterval"),m=i("rfdc/default"),b=i("./validations"),x=i("xtend"),_=i("debug")("mqttjs:client"),k=n?n.nextTick:function(R){setTimeout(R,0)},I=o.setImmediate||function(R){k(R)},P={keepalive:60,reschedulePings:!0,protocolId:"MQTT",protocolVersion:4,reconnectPeriod:1e3,connectTimeout:3e4,clean:!0,resubscribe:!0},M={0:"",1:"Unacceptable protocol version",2:"Identifier rejected",3:"Server unavailable",4:"Bad username or password",5:"Not authorized",16:"No matching subscribers",17:"No subscription existed",128:"Unspecified error",129:"Malformed Packet",130:"Protocol Error",131:"Implementation specific error",132:"Unsupported Protocol Version",133:"Client Identifier not valid",134:"Bad User Name or Password",135:"Not authorized",136:"Server unavailable",137:"Server busy",138:"Banned",139:"Server shutting down",140:"Bad authentication method",141:"Keep Alive timeout",142:"Session taken over",143:"Topic Filter invalid",144:"Topic Name invalid",145:"Packet identifier in use",146:"Packet Identifier not found",147:"Receive Maximum exceeded",148:"Topic Alias invalid",149:"Packet too large",150:"Message rate too high",151:"Quota exceeded",152:"Administrative action",153:"Payload format invalid",154:"Retain not supported",155:"QoS not supported",156:"Use another server",157:"Server moved",158:"Shared Subscriptions not supported",159:"Connection rate exceeded",160:"Maximum connect time",161:"Subscription Identifiers not supported",162:"Wildcard Subscriptions not supported"};function L(R,O){let K;O.properties&&(K=O.properties.topicAlias);let G=O.topic.toString();if(G.length===0){if(K===void 0)return new Error("Unregistered Topic Alias");if((G=R.topicAliasSend.getTopicByAlias(K))===void 0)return new Error("Unregistered Topic Alias");O.topic=G}K&&delete O.properties.topicAlias}function U(R,O,K){_("sendPacket :: packet: %O",O),_("sendPacket :: emitting `packetsend`"),R.emit("packetsend",O),_("sendPacket :: writing to stream");const G=f.writeToStream(O,R.stream,R.options);_("sendPacket :: writeToStream result %s",G),!G&&K&&K!==S?(_("sendPacket :: handle events on `drain` once through callback."),R.stream.once("drain",K)):K&&(_("sendPacket :: invoking cb"),K())}function $(R,O,K,G){_("storeAndSend :: store packet with cmd %s to outgoingStore",O.cmd);let ae,V=O;if(V.cmd==="publish"&&(V=m(O),ae=L(R,V)))return K&&K(ae);R.outgoingStore.put(V,function(F){if(F)return K&&K(F);G(),U(R,O,K)})}function S(R){_("nop ::",R)}function T(R,O){let K;const G=this;if(!(this instanceof T))return new T(R,O);for(K in this.options=O||{},P)this.options[K]===void 0?this.options[K]=P[K]:this.options[K]=O[K];_("MqttClient :: options.protocol",O.protocol),_("MqttClient :: options.protocolVersion",O.protocolVersion),_("MqttClient :: options.username",O.username),_("MqttClient :: options.keepalive",O.keepalive),_("MqttClient :: options.reconnectPeriod",O.reconnectPeriod),_("MqttClient :: options.rejectUnauthorized",O.rejectUnauthorized),_("MqttClient :: options.topicAliasMaximum",O.topicAliasMaximum),this.options.clientId=typeof O.clientId=="string"?O.clientId:"mqttjs_"+Math.random().toString(16).substr(2,8),_("MqttClient :: clientId",this.options.clientId),this.options.customHandleAcks=O.protocolVersion===5&&O.customHandleAcks?O.customHandleAcks:function(){arguments[3](0)},this.streamBuilder=R,this.messageIdProvider=this.options.messageIdProvider===void 0?new v:this.options.messageIdProvider,this.outgoingStore=O.outgoingStore||new h,this.incomingStore=O.incomingStore||new h,this.queueQoSZero=O.queueQoSZero===void 0||O.queueQoSZero,this._resubscribeTopics={},this.messageIdToTopic={},this.pingTimer=null,this.connected=!1,this.disconnecting=!1,this.queue=[],this.connackTimer=null,this.reconnectTimer=null,this._storeProcessing=!1,this._packetIdsDuringStoreProcessing={},this._storeProcessingQueue=[],this.outgoing={},this._firstConnection=!0,O.topicAliasMaximum>0&&(O.topicAliasMaximum>65535?_("MqttClient :: options.topicAliasMaximum is out of range"):this.topicAliasRecv=new l(O.topicAliasMaximum)),this.on("connect",function(){const ae=this.queue;_("connect :: sending queued packets"),function V(){const F=ae.shift();_("deliver :: entry %o",F);let q=null;if(!F)return void G._resubscribe();q=F.packet,_("deliver :: call _sendPacket for %o",q);let Y=!0;q.messageId&&q.messageId!==0&&(G.messageIdProvider.register(q.messageId)||(Y=!1)),Y?G._sendPacket(q,function(W){F.cb&&F.cb(W),V()}):(_("messageId: %d has already used. The message is skipped and removed.",q.messageId),V())}()}),this.on("close",function(){_("close :: connected set to `false`"),this.connected=!1,_("close :: clearing connackTimer"),clearTimeout(this.connackTimer),_("close :: clearing ping timer"),G.pingTimer!==null&&(G.pingTimer.clear(),G.pingTimer=null),this.topicAliasRecv&&this.topicAliasRecv.clear(),_("close :: calling _setupReconnect"),this._setupReconnect()}),s.call(this),_("MqttClient :: setting up stream"),this._setupStream()}y(T,s),T.prototype._setupStream=function(){const R=this,O=new g,K=f.parser(this.options);let G=null;const ae=[];function V(){if(ae.length)k(F);else{const Y=G;G=null,Y()}}function F(){_("work :: getting next packet in queue");const Y=ae.shift();if(Y)_("work :: packet pulled from queue"),R._handlePacket(Y,V);else{_("work :: no packets in queue");const W=G;G=null,_("work :: done flag is %s",!!W),W&&W()}}_("_setupStream :: calling method to clear reconnect"),this._clearReconnect(),_("_setupStream :: using streamBuilder provided to client to create stream"),this.stream=this.streamBuilder(this),K.on("packet",function(Y){_("parser :: on packet push to packets array."),ae.push(Y)}),O._write=function(Y,W,J){G=J,_("writable stream :: parsing buffer"),K.parse(Y),F()},_("_setupStream :: pipe stream to writable stream"),this.stream.pipe(O),this.stream.on("error",function(Y){_("streamErrorHandler :: error",Y.message),Y.code?(_("streamErrorHandler :: emitting error"),R.emit("error",Y)):S(Y)}),this.stream.on("close",function(){var Y;_("(%s)stream :: on close",R.options.clientId),(Y=R.outgoing)&&(_("flushVolatile :: deleting volatile messages from the queue and setting their callbacks as error function"),Object.keys(Y).forEach(function(W){Y[W].volatile&&typeof Y[W].cb=="function"&&(Y[W].cb(new Error("Connection closed")),delete Y[W])})),_("stream: emit close to MqttClient"),R.emit("close")}),_("_setupStream: sending packet `connect`");const q=Object.create(this.options);if(q.cmd="connect",this.topicAliasRecv&&(q.properties||(q.properties={}),this.topicAliasRecv&&(q.properties.topicAliasMaximum=this.topicAliasRecv.max)),U(this,q),K.on("error",this.emit.bind(this,"error")),this.options.properties){if(!this.options.properties.authenticationMethod&&this.options.properties.authenticationData)return R.end(()=>this.emit("error",new Error("Packet has no Authentication Method"))),this;this.options.properties.authenticationMethod&&this.options.authPacket&&typeof this.options.authPacket=="object"&&U(this,x({cmd:"auth",reasonCode:0},this.options.authPacket))}this.stream.setMaxListeners(1e3),clearTimeout(this.connackTimer),this.connackTimer=setTimeout(function(){_("!!connectTimeout hit!! Calling _cleanUp with force `true`"),R._cleanUp(!0)},this.options.connectTimeout)},T.prototype._handlePacket=function(R,O){const K=this.options;if(K.protocolVersion===5&&K.properties&&K.properties.maximumPacketSize&&K.properties.maximumPacketSize<R.length)return this.emit("error",new Error("exceeding packets size "+R.cmd)),this.end({reasonCode:149,properties:{reasonString:"Maximum packet size was exceeded"}}),this;switch(_("_handlePacket :: emitting packetreceive"),this.emit("packetreceive",R),R.cmd){case"publish":this._handlePublish(R,O);break;case"puback":case"pubrec":case"pubcomp":case"suback":case"unsuback":this._handleAck(R),O();break;case"pubrel":this._handlePubrel(R,O);break;case"connack":this._handleConnack(R),O();break;case"auth":this._handleAuth(R),O();break;case"pingresp":this._handlePingresp(R),O();break;case"disconnect":this._handleDisconnect(R),O()}},T.prototype._checkDisconnecting=function(R){return this.disconnecting&&(R&&R!==S?R(new Error("client disconnecting")):this.emit("error",new Error("client disconnecting"))),this.disconnecting},T.prototype.publish=function(R,O,K,G){_("publish :: message `%s` to topic `%s`",O,R);const ae=this.options;if(typeof K=="function"&&(G=K,K=null),K=x({qos:0,retain:!1,dup:!1},K),this._checkDisconnecting(G))return this;const V=this,F=function(){let q=0;if((K.qos===1||K.qos===2)&&(q=V._nextId())===null)return _("No messageId left"),!1;const Y={cmd:"publish",topic:R,payload:O,qos:K.qos,retain:K.retain,messageId:q,dup:K.dup};switch(ae.protocolVersion===5&&(Y.properties=K.properties),_("publish :: qos",K.qos),K.qos){case 1:case 2:V.outgoing[Y.messageId]={volatile:!1,cb:G||S},_("MqttClient:publish: packet cmd: %s",Y.cmd),V._sendPacket(Y,void 0,K.cbStorePut);break;default:_("MqttClient:publish: packet cmd: %s",Y.cmd),V._sendPacket(Y,G,K.cbStorePut)}return!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!F())&&this._storeProcessingQueue.push({invoke:F,cbStorePut:K.cbStorePut,callback:G}),this},T.prototype.subscribe=function(){const R=this,O=new Array(arguments.length);for(let re=0;re<arguments.length;re++)O[re]=arguments[re];const K=[];let G=O.shift();const ae=G.resubscribe;let V=O.pop()||S,F=O.pop();const q=this.options.protocolVersion;delete G.resubscribe,typeof G=="string"&&(G=[G]),typeof V!="function"&&(F=V,V=S);const Y=b.validateTopics(G);if(Y!==null)return I(V,new Error("Invalid topic "+Y)),this;if(this._checkDisconnecting(V))return _("subscribe: discconecting true"),this;const W={qos:0};if(q===5&&(W.nl=!1,W.rap=!1,W.rh=0),F=x(W,F),Array.isArray(G)?G.forEach(function(re){if(_("subscribe: array topic %s",re),!Object.prototype.hasOwnProperty.call(R._resubscribeTopics,re)||R._resubscribeTopics[re].qos<F.qos||ae){const ee={topic:re,qos:F.qos};q===5&&(ee.nl=F.nl,ee.rap=F.rap,ee.rh=F.rh,ee.properties=F.properties),_("subscribe: pushing topic `%s` and qos `%s` to subs list",ee.topic,ee.qos),K.push(ee)}}):Object.keys(G).forEach(function(re){if(_("subscribe: object topic %s",re),!Object.prototype.hasOwnProperty.call(R._resubscribeTopics,re)||R._resubscribeTopics[re].qos<G[re].qos||ae){const ee={topic:re,qos:G[re].qos};q===5&&(ee.nl=G[re].nl,ee.rap=G[re].rap,ee.rh=G[re].rh,ee.properties=F.properties),_("subscribe: pushing `%s` to subs list",ee),K.push(ee)}}),!K.length)return V(null,[]),this;const J=function(){const re=R._nextId();if(re===null)return _("No messageId left"),!1;const ee={cmd:"subscribe",subscriptions:K,qos:1,retain:!1,dup:!1,messageId:re};if(F.properties&&(ee.properties=F.properties),R.options.resubscribe){_("subscribe :: resubscribe true");const he=[];K.forEach(function(le){if(R.options.reconnectPeriod>0){const se={qos:le.qos};q===5&&(se.nl=le.nl||!1,se.rap=le.rap||!1,se.rh=le.rh||0,se.properties=le.properties),R._resubscribeTopics[le.topic]=se,he.push(le.topic)}}),R.messageIdToTopic[ee.messageId]=he}return R.outgoing[ee.messageId]={volatile:!0,cb:function(he,le){if(!he){const se=le.granted;for(let E=0;E<se.length;E+=1)K[E].qos=se[E]}V(he,K)}},_("subscribe :: call _sendPacket"),R._sendPacket(ee),!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!J())&&this._storeProcessingQueue.push({invoke:J,callback:V}),this},T.prototype.unsubscribe=function(){const R=this,O=new Array(arguments.length);for(let q=0;q<arguments.length;q++)O[q]=arguments[q];let K=O.shift(),G=O.pop()||S,ae=O.pop();typeof K=="string"&&(K=[K]),typeof G!="function"&&(ae=G,G=S);const V=b.validateTopics(K);if(V!==null)return I(G,new Error("Invalid topic "+V)),this;if(R._checkDisconnecting(G))return this;const F=function(){const q=R._nextId();if(q===null)return _("No messageId left"),!1;const Y={cmd:"unsubscribe",qos:1,messageId:q};return typeof K=="string"?Y.unsubscriptions=[K]:Array.isArray(K)&&(Y.unsubscriptions=K),R.options.resubscribe&&Y.unsubscriptions.forEach(function(W){delete R._resubscribeTopics[W]}),typeof ae=="object"&&ae.properties&&(Y.properties=ae.properties),R.outgoing[Y.messageId]={volatile:!0,cb:G},_("unsubscribe: call _sendPacket"),R._sendPacket(Y),!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!F())&&this._storeProcessingQueue.push({invoke:F,callback:G}),this},T.prototype.end=function(R,O,K){const G=this;function ae(){_("end :: (%s) :: finish :: calling _cleanUp with force %s",G.options.clientId,R),G._cleanUp(R,()=>{_("end :: finish :: calling process.nextTick on closeStores"),k(function(){_("end :: closeStores: closing incoming and outgoing stores"),G.disconnected=!0,G.incomingStore.close(function(V){G.outgoingStore.close(function(F){if(_("end :: closeStores: emitting end"),G.emit("end"),K){const q=V||F;_("end :: closeStores: invoking callback with args"),K(q)}})}),G._deferredReconnect&&G._deferredReconnect()}.bind(G))},O)}return _("end :: (%s)",this.options.clientId),R!=null&&typeof R=="boolean"||(K=O||S,O=R,R=!1,typeof O!="object"&&(K=O,O=null,typeof K!="function"&&(K=S))),typeof O!="object"&&(K=O,O=null),_("end :: cb? %s",!!K),K=K||S,this.disconnecting?(K(),this):(this._clearReconnect(),this.disconnecting=!0,!R&&Object.keys(this.outgoing).length>0?(_("end :: (%s) :: calling finish in 10ms once outgoing is empty",G.options.clientId),this.once("outgoingEmpty",setTimeout.bind(null,ae,10))):(_("end :: (%s) :: immediately calling finish",G.options.clientId),ae()),this)},T.prototype.removeOutgoingMessage=function(R){const O=this.outgoing[R]?this.outgoing[R].cb:null;return delete this.outgoing[R],this.outgoingStore.del({messageId:R},function(){O(new Error("Message removed"))}),this},T.prototype.reconnect=function(R){_("client reconnect");const O=this,K=function(){R?(O.options.incomingStore=R.incomingStore,O.options.outgoingStore=R.outgoingStore):(O.options.incomingStore=null,O.options.outgoingStore=null),O.incomingStore=O.options.incomingStore||new h,O.outgoingStore=O.options.outgoingStore||new h,O.disconnecting=!1,O.disconnected=!1,O._deferredReconnect=null,O._reconnect()};return this.disconnecting&&!this.disconnected?this._deferredReconnect=K:K(),this},T.prototype._reconnect=function(){_("_reconnect: emitting reconnect to client"),this.emit("reconnect"),this.connected?(this.end(()=>{this._setupStream()}),_("client already connected. disconnecting first.")):(_("_reconnect: calling _setupStream"),this._setupStream())},T.prototype._setupReconnect=function(){const R=this;!R.disconnecting&&!R.reconnectTimer&&R.options.reconnectPeriod>0?(this.reconnecting||(_("_setupReconnect :: emit `offline` state"),this.emit("offline"),_("_setupReconnect :: set `reconnecting` to `true`"),this.reconnecting=!0),_("_setupReconnect :: setting reconnectTimer for %d ms",R.options.reconnectPeriod),R.reconnectTimer=setInterval(function(){_("reconnectTimer :: reconnect triggered!"),R._reconnect()},R.options.reconnectPeriod)):_("_setupReconnect :: doing nothing...")},T.prototype._clearReconnect=function(){_("_clearReconnect : clearing reconnect timer"),this.reconnectTimer&&(clearInterval(this.reconnectTimer),this.reconnectTimer=null)},T.prototype._cleanUp=function(R,O){const K=arguments[2];if(O&&(_("_cleanUp :: done callback provided for on stream close"),this.stream.on("close",O)),_("_cleanUp :: forced? %s",R),R)this.options.reconnectPeriod===0&&this.options.clean&&(G=this.outgoing)&&(_("flush: queue exists? %b",!!G),Object.keys(G).forEach(function(ae){typeof G[ae].cb=="function"&&(G[ae].cb(new Error("Connection closed")),delete G[ae])})),_("_cleanUp :: (%s) :: destroying stream",this.options.clientId),this.stream.destroy();else{const ae=x({cmd:"disconnect"},K);_("_cleanUp :: (%s) :: call _sendPacket with disconnect packet",this.options.clientId),this._sendPacket(ae,I.bind(null,this.stream.end.bind(this.stream)))}var G;this.disconnecting||(_("_cleanUp :: client not disconnecting. Clearing and resetting reconnect."),this._clearReconnect(),this._setupReconnect()),this.pingTimer!==null&&(_("_cleanUp :: clearing pingTimer"),this.pingTimer.clear(),this.pingTimer=null),O&&!this.connected&&(_("_cleanUp :: (%s) :: removing stream `done` callback `close` listener",this.options.clientId),this.stream.removeListener("close",O),O())},T.prototype._sendPacket=function(R,O,K){_("_sendPacket :: (%s) :: start",this.options.clientId),K=K||S,O=O||S;const G=function(ae,V){if(ae.options.protocolVersion===5&&V.cmd==="publish"){let F;V.properties&&(F=V.properties.topicAlias);const q=V.topic.toString();if(ae.topicAliasSend)if(F){if(q.length!==0&&(_("applyTopicAlias :: register topic: %s - alias: %d",q,F),!ae.topicAliasSend.put(q,F)))return _("applyTopicAlias :: error out of range. topic: %s - alias: %d",q,F),new Error("Sending Topic Alias out of range")}else q.length!==0&&(ae.options.autoAssignTopicAlias?(F=ae.topicAliasSend.getAliasByTopic(q))?(V.topic="",V.properties={...V.properties,topicAlias:F},_("applyTopicAlias :: auto assign(use) topic: %s - alias: %d",q,F)):(F=ae.topicAliasSend.getLruAlias(),ae.topicAliasSend.put(q,F),V.properties={...V.properties,topicAlias:F},_("applyTopicAlias :: auto assign topic: %s - alias: %d",q,F)):ae.options.autoUseTopicAlias&&(F=ae.topicAliasSend.getAliasByTopic(q))&&(V.topic="",V.properties={...V.properties,topicAlias:F},_("applyTopicAlias :: auto use topic: %s - alias: %d",q,F)));else if(F)return _("applyTopicAlias :: error out of range. topic: %s - alias: %d",q,F),new Error("Sending Topic Alias out of range")}}(this,R);if(G)O(G);else{if(!this.connected)return R.cmd==="auth"?(this._shiftPingInterval(),void U(this,R,O)):(_("_sendPacket :: client not connected. Storing packet offline."),void this._storePacket(R,O,K));switch(this._shiftPingInterval(),R.cmd){case"publish":break;case"pubrel":return void $(this,R,O,K);default:return void U(this,R,O)}switch(R.qos){case 2:case 1:$(this,R,O,K);break;case 0:default:U(this,R,O)}_("_sendPacket :: (%s) :: end",this.options.clientId)}},T.prototype._storePacket=function(R,O,K){_("_storePacket :: packet: %o",R),_("_storePacket :: cb? %s",!!O),K=K||S;let G=R;if(G.cmd==="publish"){const ae=L(this,G=m(R));if(ae)return O&&O(ae)}(G.qos||0)===0&&this.queueQoSZero||G.cmd!=="publish"?this.queue.push({packet:G,cb:O}):G.qos>0?(O=this.outgoing[G.messageId]?this.outgoing[G.messageId].cb:null,this.outgoingStore.put(G,function(ae){if(ae)return O&&O(ae);K()})):O&&O(new Error("No connection to broker"))},T.prototype._setupPingTimer=function(){_("_setupPingTimer :: keepalive %d (seconds)",this.options.keepalive);const R=this;!this.pingTimer&&this.options.keepalive&&(this.pingResp=!0,this.pingTimer=p(function(){R._checkPing()},1e3*this.options.keepalive))},T.prototype._shiftPingInterval=function(){this.pingTimer&&this.options.keepalive&&this.options.reschedulePings&&this.pingTimer.reschedule(1e3*this.options.keepalive)},T.prototype._checkPing=function(){_("_checkPing :: checking ping..."),this.pingResp?(_("_checkPing :: ping response received. Clearing flag and sending `pingreq`"),this.pingResp=!1,this._sendPacket({cmd:"pingreq"})):(_("_checkPing :: calling _cleanUp with force true"),this._cleanUp(!0))},T.prototype._handlePingresp=function(){this.pingResp=!0},T.prototype._handleConnack=function(R){_("_handleConnack");const O=this.options,K=O.protocolVersion===5?R.reasonCode:R.returnCode;if(clearTimeout(this.connackTimer),delete this.topicAliasSend,R.properties){if(R.properties.topicAliasMaximum){if(R.properties.topicAliasMaximum>65535)return void this.emit("error",new Error("topicAliasMaximum from broker is out of range"));R.properties.topicAliasMaximum>0&&(this.topicAliasSend=new c(R.properties.topicAliasMaximum))}R.properties.serverKeepAlive&&O.keepalive&&(O.keepalive=R.properties.serverKeepAlive,this._shiftPingInterval()),R.properties.maximumPacketSize&&(O.properties||(O.properties={}),O.properties.maximumPacketSize=R.properties.maximumPacketSize)}if(K===0)this.reconnecting=!1,this._onConnect(R);else if(K>0){const G=new Error("Connection refused: "+M[K]);G.code=K,this.emit("error",G)}},T.prototype._handleAuth=function(R){const O=this.options.protocolVersion,K=O===5?R.reasonCode:R.returnCode;if(O!==5){const ae=new Error("Protocol error: Auth packets are only supported in MQTT 5. Your version:"+O);return ae.code=K,void this.emit("error",ae)}const G=this;this.handleAuth(R,function(ae,V){if(ae)G.emit("error",ae);else if(K===24)G.reconnecting=!1,G._sendPacket(V);else{const F=new Error("Connection refused: "+M[K]);ae.code=K,G.emit("error",F)}})},T.prototype.handleAuth=function(R,O){O()},T.prototype._handlePublish=function(R,O){_("_handlePublish: packet %o",R),O=O!==void 0?O:S;let K=R.topic.toString();const G=R.payload,ae=R.qos,V=R.messageId,F=this,q=this.options,Y=[0,16,128,131,135,144,145,151,153];if(this.options.protocolVersion===5){let W;if(R.properties&&(W=R.properties.topicAlias),W!==void 0)if(K.length===0){if(!(W>0&&W<=65535))return _("_handlePublish :: topic alias out of range. alias: %d",W),void this.emit("error",new Error("Received Topic Alias is out of range"));{const J=this.topicAliasRecv.getTopicByAlias(W);if(!J)return _("_handlePublish :: unregistered topic alias. alias: %d",W),void this.emit("error",new Error("Received unregistered Topic Alias"));_("_handlePublish :: topic complemented by alias. topic: %s - alias: %d",K=J,W)}}else{if(!this.topicAliasRecv.put(K,W))return _("_handlePublish :: topic alias out of range. alias: %d",W),void this.emit("error",new Error("Received Topic Alias is out of range"));_("_handlePublish :: registered topic: %s - alias: %d",K,W)}}switch(_("_handlePublish: qos %d",ae),ae){case 2:q.customHandleAcks(K,G,R,function(W,J){return W instanceof Error||(J=W,W=null),W?F.emit("error",W):Y.indexOf(J)===-1?F.emit("error",new Error("Wrong reason code for pubrec")):void(J?F._sendPacket({cmd:"pubrec",messageId:V,reasonCode:J},O):F.incomingStore.put(R,function(){F._sendPacket({cmd:"pubrec",messageId:V},O)}))});break;case 1:q.customHandleAcks(K,G,R,function(W,J){return W instanceof Error||(J=W,W=null),W?F.emit("error",W):Y.indexOf(J)===-1?F.emit("error",new Error("Wrong reason code for puback")):(J||F.emit("message",K,G,R),void F.handleMessage(R,function(re){if(re)return O&&O(re);F._sendPacket({cmd:"puback",messageId:V,reasonCode:J},O)}))});break;case 0:this.emit("message",K,G,R),this.handleMessage(R,O);break;default:_("_handlePublish: unknown QoS. Doing nothing.")}},T.prototype.handleMessage=function(R,O){O()},T.prototype._handleAck=function(R){const O=R.messageId,K=R.cmd;let G=null;const ae=this.outgoing[O]?this.outgoing[O].cb:null,V=this;let F;if(ae){switch(_("_handleAck :: packet type",K),K){case"pubcomp":case"puback":{const q=R.reasonCode;q&&q>0&&q!==16&&((F=new Error("Publish error: "+M[q])).code=q,ae(F,R)),delete this.outgoing[O],this.outgoingStore.del(R,ae),this.messageIdProvider.deallocate(O),this._invokeStoreProcessingQueue();break}case"pubrec":{G={cmd:"pubrel",qos:2,messageId:O};const q=R.reasonCode;q&&q>0&&q!==16?((F=new Error("Publish error: "+M[q])).code=q,ae(F,R)):this._sendPacket(G);break}case"suback":delete this.outgoing[O],this.messageIdProvider.deallocate(O);for(let q=0;q<R.granted.length;q++)if((128&R.granted[q])!=0){const Y=this.messageIdToTopic[O];Y&&Y.forEach(function(W){delete V._resubscribeTopics[W]})}this._invokeStoreProcessingQueue(),ae(null,R);break;case"unsuback":delete this.outgoing[O],this.messageIdProvider.deallocate(O),this._invokeStoreProcessingQueue(),ae(null);break;default:V.emit("error",new Error("unrecognized packet type"))}this.disconnecting&&Object.keys(this.outgoing).length===0&&this.emit("outgoingEmpty")}else _("_handleAck :: Server sent an ack in error. Ignoring.")},T.prototype._handlePubrel=function(R,O){_("handling pubrel packet"),O=O!==void 0?O:S;const K=this,G={cmd:"pubcomp",messageId:R.messageId};K.incomingStore.get(R,function(ae,V){ae?K._sendPacket(G,O):(K.emit("message",V.topic,V.payload,V),K.handleMessage(V,function(F){if(F)return O(F);K.incomingStore.del(V,S),K._sendPacket(G,O)}))})},T.prototype._handleDisconnect=function(R){this.emit("disconnect",R)},T.prototype._nextId=function(){return this.messageIdProvider.allocate()},T.prototype.getLastMessageId=function(){return this.messageIdProvider.getLastAllocated()},T.prototype._resubscribe=function(){_("_resubscribe");const R=Object.keys(this._resubscribeTopics);if(!this._firstConnection&&(this.options.clean||this.options.protocolVersion===5&&!this.connackPacket.sessionPresent)&&R.length>0)if(this.options.resubscribe)if(this.options.protocolVersion===5){_("_resubscribe: protocolVersion 5");for(let O=0;O<R.length;O++){const K={};K[R[O]]=this._resubscribeTopics[R[O]],K.resubscribe=!0,this.subscribe(K,{properties:K[R[O]].properties})}}else this._resubscribeTopics.resubscribe=!0,this.subscribe(this._resubscribeTopics);else this._resubscribeTopics={};this._firstConnection=!1},T.prototype._onConnect=function(R){if(this.disconnected)return void this.emit("connect",R);const O=this;this.connackPacket=R,this.messageIdProvider.clear(),this._setupPingTimer(),this.connected=!0,function K(){let G=O.outgoingStore.createStream();function ae(){O._storeProcessing=!1,O._packetIdsDuringStoreProcessing={}}function V(){G.destroy(),G=null,O._flushStoreProcessingQueue(),ae()}O.once("close",V),G.on("error",function(F){ae(),O._flushStoreProcessingQueue(),O.removeListener("close",V),O.emit("error",F)}),G.on("end",function(){let F=!0;for(const q in O._packetIdsDuringStoreProcessing)if(!O._packetIdsDuringStoreProcessing[q]){F=!1;break}F?(ae(),O.removeListener("close",V),O._invokeAllStoreProcessingQueue(),O.emit("connect",R)):K()}),function F(){if(!G)return;O._storeProcessing=!0;const q=G.read(1);let Y;q?O._packetIdsDuringStoreProcessing[q.messageId]?F():O.disconnecting||O.reconnectTimer?G.destroy&&G.destroy():(Y=O.outgoing[q.messageId]?O.outgoing[q.messageId].cb:null,O.outgoing[q.messageId]={volatile:!1,cb:function(W,J){Y&&Y(W,J),F()}},O._packetIdsDuringStoreProcessing[q.messageId]=!0,O.messageIdProvider.register(q.messageId)?O._sendPacket(q):_("messageId: %d has already used.",q.messageId)):G.once("readable",F)}()}()},T.prototype._invokeStoreProcessingQueue=function(){if(this._storeProcessingQueue.length>0){const R=this._storeProcessingQueue[0];if(R&&R.invoke())return this._storeProcessingQueue.shift(),!0}return!1},T.prototype._invokeAllStoreProcessingQueue=function(){for(;this._invokeStoreProcessingQueue(););},T.prototype._flushStoreProcessingQueue=function(){for(const R of this._storeProcessingQueue)R.cbStorePut&&R.cbStorePut(new Error("Connection closed")),R.callback&&R.callback(new Error("Connection closed"));this._storeProcessingQueue.splice(0)},a.exports=T}).call(this)}).call(this,i("_process"),typeof Ot<"u"?Ot:typeof self<"u"?self:typeof window<"u"?window:{})},{"./default-message-id-provider":7,"./store":8,"./topic-alias-recv":9,"./topic-alias-send":10,"./validations":11,_process:50,debug:18,events:22,inherits:24,"mqtt-packet":40,"readable-stream":69,reinterval:70,"rfdc/default":71,xtend:81}],2:[function(i,a,r){const{Buffer:n}=i("buffer"),o=i("readable-stream").Transform,s=i("duplexify");let h,l,c,f=!1;a.exports=function(v,g){if(g.hostname=g.hostname||g.host,!g.hostname)throw new Error("Could not determine host. Specify host manually.");const y=g.protocolId==="MQIsdp"&&g.protocolVersion===3?"mqttv3.1":"mqtt";(function(m){m.hostname||(m.hostname="localhost"),m.path||(m.path="/"),m.wsOptions||(m.wsOptions={})})(g);const p=function(m,b){const x=m.protocol==="alis"?"wss":"ws";let _=x+"://"+m.hostname+m.path;return m.port&&m.port!==80&&m.port!==443&&(_=x+"://"+m.hostname+":"+m.port+m.path),typeof m.transformWsUrl=="function"&&(_=m.transformWsUrl(_,m,b)),_}(g,v);return(h=g.my).connectSocket({url:p,protocols:y}),l=function(){const m=new o;return m._write=function(b,x,_){h.sendSocketMessage({data:b.buffer,success:function(){_()},fail:function(){_(new Error)}})},m._flush=function(b){h.closeSocket({success:function(){b()}})},m}(),c=s.obj(),f||(f=!0,h.onSocketOpen(function(){c.setReadable(l),c.setWritable(l),c.emit("connect")}),h.onSocketMessage(function(m){if(typeof m.data=="string"){const b=n.from(m.data,"base64");l.push(b)}else{const b=new FileReader;b.addEventListener("load",function(){let x=b.result;x=x instanceof ArrayBuffer?n.from(x):n.from(x,"utf8"),l.push(x)}),b.readAsArrayBuffer(m.data)}}),h.onSocketClose(function(){c.end(),c.destroy()}),h.onSocketError(function(m){c.destroy(m)})),c}},{buffer:17,duplexify:20,"readable-stream":69}],3:[function(i,a,r){const n=i("net"),o=i("debug")("mqttjs:tcp");a.exports=function(s,h){h.port=h.port||1883,h.hostname=h.hostname||h.host||"localhost";const l=h.port,c=h.hostname;return o("port %d and host %s",l,c),n.createConnection(l,c)}},{debug:18,net:16}],4:[function(i,a,r){const n=i("tls"),o=i("net"),s=i("debug")("mqttjs:tls");a.exports=function(h,l){l.port=l.port||8883,l.host=l.hostname||l.host||"localhost",o.isIP(l.host)===0&&(l.servername=l.host),l.rejectUnauthorized=l.rejectUnauthorized!==!1,delete l.path,s("port %d host %s rejectUnauthorized %b",l.port,l.host,l.rejectUnauthorized);const c=n.connect(l);function f(v){l.rejectUnauthorized&&h.emit("error",v),c.end()}return c.on("secureConnect",function(){l.rejectUnauthorized&&!c.authorized?c.emit("error",new Error("TLS not authorized")):c.removeListener("error",f)}),c.on("error",f),c}},{debug:18,net:16,tls:16}],5:[function(i,a,r){(function(n){(function(){const{Buffer:o}=i("buffer"),s=i("ws"),h=i("debug")("mqttjs:ws"),l=i("duplexify"),c=i("readable-stream").Transform,f=["rejectUnauthorized","ca","cert","key","pfx","passphrase"],v=n!==void 0&&n.title==="browser"||typeof __webpack_require__=="function";function g(p,m){let b=p.protocol+"://"+p.hostname+":"+p.port+p.path;return typeof p.transformWsUrl=="function"&&(b=p.transformWsUrl(b,p,m)),b}function y(p){const m=p;return p.hostname||(m.hostname="localhost"),p.port||(p.protocol==="wss"?m.port=443:m.port=80),p.path||(m.path="/"),p.wsOptions||(m.wsOptions={}),v||p.protocol!=="wss"||f.forEach(function(b){Object.prototype.hasOwnProperty.call(p,b)&&!Object.prototype.hasOwnProperty.call(p.wsOptions,b)&&(m.wsOptions[b]=p[b])}),m}a.exports=v?function(p,m){let b;h("browserStreamBuilder");const x=function(R){const O=y(R);if(O.hostname||(O.hostname=O.host),!O.hostname){if(typeof document>"u")throw new Error("Could not determine host. Specify host manually.");const K=new URL(document.URL);O.hostname=K.hostname,O.port||(O.port=K.port)}return O.objectMode===void 0&&(O.objectMode=!(O.binary===!0||O.binary===void 0)),O}(m).browserBufferSize||524288,_=m.browserBufferTimeout||1e3,k=!m.objectMode,I=function(R,O){const K=O.protocolId==="MQIsdp"&&O.protocolVersion===3?"mqttv3.1":"mqtt",G=g(O,R),ae=new WebSocket(G,[K]);return ae.binaryType="arraybuffer",ae}(p,m),P=function(R,O,K){const G=new c({objectModeMode:R.objectMode});return G._write=O,G._flush=K,G}(m,function R(O,K,G){I.bufferedAmount>x&&setTimeout(R,_,O,K,G),k&&typeof O=="string"&&(O=o.from(O,"utf8"));try{I.send(O)}catch(ae){return G(ae)}G()},function(R){I.close(),R()});m.objectMode||(P._writev=T),P.on("close",()=>{I.close()});const M=I.addEventListener!==void 0;function L(){b.setReadable(P),b.setWritable(P),b.emit("connect")}function U(){b.end(),b.destroy()}function $(R){b.destroy(R)}function S(R){let O=R.data;O=O instanceof ArrayBuffer?o.from(O):o.from(O,"utf8"),P.push(O)}function T(R,O){const K=new Array(R.length);for(let G=0;G<R.length;G++)typeof R[G].chunk=="string"?K[G]=o.from(R[G],"utf8"):K[G]=R[G].chunk;this._write(o.concat(K),"binary",O)}return I.readyState===I.OPEN?b=P:(b=b=l(void 0,void 0,m),m.objectMode||(b._writev=T),M?I.addEventListener("open",L):I.onopen=L),b.socket=I,M?(I.addEventListener("close",U),I.addEventListener("error",$),I.addEventListener("message",S)):(I.onclose=U,I.onerror=$,I.onmessage=S),b}:function(p,m){h("streamBuilder");const b=y(m),x=g(b,p),_=function(I,P,M){h("createWebSocket"),h("protocol: "+M.protocolId+" "+M.protocolVersion);const L=M.protocolId==="MQIsdp"&&M.protocolVersion===3?"mqttv3.1":"mqtt";return h("creating new Websocket for url: "+P+" and protocol: "+L),new s(P,[L],M.wsOptions)}(0,x,b),k=s.createWebSocketStream(_,b.wsOptions);return k.url=x,_.on("close",()=>{k.destroy()}),k}}).call(this)}).call(this,i("_process"))},{_process:50,buffer:17,debug:18,duplexify:20,"readable-stream":69,ws:80}],6:[function(i,a,r){const{Buffer:n}=i("buffer"),o=i("readable-stream").Transform,s=i("duplexify");let h,l,c;a.exports=function(f,v){if(v.hostname=v.hostname||v.host,!v.hostname)throw new Error("Could not determine host. Specify host manually.");const g=v.protocolId==="MQIsdp"&&v.protocolVersion===3?"mqttv3.1":"mqtt";(function(m){m.hostname||(m.hostname="localhost"),m.path||(m.path="/"),m.wsOptions||(m.wsOptions={})})(v);const y=function(m,b){const x=m.protocol==="wxs"?"wss":"ws";let _=x+"://"+m.hostname+m.path;return m.port&&m.port!==80&&m.port!==443&&(_=x+"://"+m.hostname+":"+m.port+m.path),typeof m.transformWsUrl=="function"&&(_=m.transformWsUrl(_,m,b)),_}(v,f);h=wx.connectSocket({url:y,protocols:[g]}),l=function(){const m=new o;return m._write=function(b,x,_){h.send({data:b.buffer,success:function(){_()},fail:function(k){_(new Error(k))}})},m._flush=function(b){h.close({success:function(){b()}})},m}(),(c=s.obj())._destroy=function(m,b){h.close({success:function(){b&&b(m)}})};const p=c.destroy;return c.destroy=function(){c.destroy=p;const m=this;setTimeout(function(){h.close({fail:function(){m._destroy(new Error)}})},0)}.bind(c),h.onOpen(function(){c.setReadable(l),c.setWritable(l),c.emit("connect")}),h.onMessage(function(m){let b=m.data;b=b instanceof ArrayBuffer?n.from(b):n.from(b,"utf8"),l.push(b)}),h.onClose(function(){c.end(),c.destroy()}),h.onError(function(m){c.destroy(new Error(m.errMsg))}),c}},{buffer:17,duplexify:20,"readable-stream":69}],7:[function(i,a,r){function n(){if(!(this instanceof n))return new n;this.nextId=Math.max(1,Math.floor(65535*Math.random()))}n.prototype.allocate=function(){const o=this.nextId++;return this.nextId===65536&&(this.nextId=1),o},n.prototype.getLastAllocated=function(){return this.nextId===1?65535:this.nextId-1},n.prototype.register=function(o){return!0},n.prototype.deallocate=function(o){},n.prototype.clear=function(){},a.exports=n},{}],8:[function(i,a,r){const n=i("xtend"),o=i("readable-stream").Readable,s={objectMode:!0},h={clean:!0};function l(c){if(!(this instanceof l))return new l(c);this.options=c||{},this.options=n(h,c),this._inflights=new Map}l.prototype.put=function(c,f){return this._inflights.set(c.messageId,c),f&&f(),this},l.prototype.createStream=function(){const c=new o(s),f=[];let v=!1,g=0;return this._inflights.forEach(function(y,p){f.push(y)}),c._read=function(){!v&&g<f.length?this.push(f[g++]):this.push(null)},c.destroy=function(){if(v)return;const y=this;v=!0,setTimeout(function(){y.emit("close")},0)},c},l.prototype.del=function(c,f){return(c=this._inflights.get(c.messageId))?(this._inflights.delete(c.messageId),f(null,c)):f&&f(new Error("missing packet")),this},l.prototype.get=function(c,f){return(c=this._inflights.get(c.messageId))?f(null,c):f&&f(new Error("missing packet")),this},l.prototype.close=function(c){this.options.clean&&(this._inflights=null),c&&c()},a.exports=l},{"readable-stream":69,xtend:81}],9:[function(i,a,r){function n(o){if(!(this instanceof n))return new n(o);this.aliasToTopic={},this.max=o}n.prototype.put=function(o,s){return!(s===0||s>this.max)&&(this.aliasToTopic[s]=o,this.length=Object.keys(this.aliasToTopic).length,!0)},n.prototype.getTopicByAlias=function(o){return this.aliasToTopic[o]},n.prototype.clear=function(){this.aliasToTopic={}},a.exports=n},{}],10:[function(i,a,r){const n=i("lru-cache"),o=i("number-allocator").NumberAllocator;function s(h){if(!(this instanceof s))return new s(h);h>0&&(this.aliasToTopic=new n({max:h}),this.topicToAlias={},this.numberAllocator=new o(1,h),this.max=h,this.length=0)}s.prototype.put=function(h,l){if(l===0||l>this.max)return!1;const c=this.aliasToTopic.get(l);return c&&delete this.topicToAlias[c],this.aliasToTopic.set(l,h),this.topicToAlias[h]=l,this.numberAllocator.use(l),this.length=this.aliasToTopic.length,!0},s.prototype.getTopicByAlias=function(h){return this.aliasToTopic.get(h)},s.prototype.getAliasByTopic=function(h){const l=this.topicToAlias[h];return l!==void 0&&this.aliasToTopic.get(l),l},s.prototype.clear=function(){this.aliasToTopic.reset(),this.topicToAlias={},this.numberAllocator.clear(),this.length=0},s.prototype.getLruAlias=function(){return this.numberAllocator.firstVacant()||this.aliasToTopic.keys()[this.aliasToTopic.length-1]},a.exports=s},{"lru-cache":37,"number-allocator":46}],11:[function(i,a,r){function n(o){const s=o.split("/");for(let h=0;h<s.length;h++)if(s[h]!=="+"){if(s[h]==="#")return h===s.length-1;if(s[h].indexOf("+")!==-1||s[h].indexOf("#")!==-1)return!1}return!0}a.exports={validateTopics:function(o){if(o.length===0)return"empty_topic_list";for(let s=0;s<o.length;s++)if(!n(o[s]))return o[s];return null}}},{}],12:[function(i,a,r){(function(n){(function(){const o=i("../client"),s=i("../store"),h=i("url"),l=i("xtend"),c=i("debug")("mqttjs"),f={};function v(g,y){if(c("connecting to an MQTT broker..."),typeof g!="object"||y||(y=g,g=null),y=y||{},g){const m=h.parse(g,!0);if(m.port!=null&&(m.port=Number(m.port)),(y=l(m,y)).protocol===null)throw new Error("Missing protocol");y.protocol=y.protocol.replace(/:$/,"")}if(function(m){let b;m.auth&&((b=m.auth.match(/^(.+):(.+)$/))?(m.username=b[1],m.password=b[2]):m.username=m.auth)}(y),y.query&&typeof y.query.clientId=="string"&&(y.clientId=y.query.clientId),y.cert&&y.key){if(!y.protocol)throw new Error("Missing secure protocol key");if(["mqtts","wss","wxs","alis"].indexOf(y.protocol)===-1)switch(y.protocol){case"mqtt":y.protocol="mqtts";break;case"ws":y.protocol="wss";break;case"wx":y.protocol="wxs";break;case"ali":y.protocol="alis";break;default:throw new Error('Unknown protocol for secure connection: "'+y.protocol+'"!')}}if(!f[y.protocol]){const m=["mqtts","wss"].indexOf(y.protocol)!==-1;y.protocol=["mqtt","mqtts","ws","wss","wx","wxs","ali","alis"].filter(function(b,x){return(!m||x%2!=0)&&typeof f[b]=="function"})[0]}if(y.clean===!1&&!y.clientId)throw new Error("Missing clientId for unclean clients");y.protocol&&(y.defaultProtocol=y.protocol);const p=new o(function(m){return y.servers&&(m._reconnectCount&&m._reconnectCount!==y.servers.length||(m._reconnectCount=0),y.host=y.servers[m._reconnectCount].host,y.port=y.servers[m._reconnectCount].port,y.protocol=y.servers[m._reconnectCount].protocol?y.servers[m._reconnectCount].protocol:y.defaultProtocol,y.hostname=y.host,m._reconnectCount++),c("calling streambuilder for",y.protocol),f[y.protocol](m,y)},y);return p.on("error",function(){}),p}n!==void 0&&n.title!=="browser"||typeof __webpack_require__!="function"?(f.mqtt=i("./tcp"),f.tcp=i("./tcp"),f.ssl=i("./tls"),f.tls=i("./tls"),f.mqtts=i("./tls")):(f.wx=i("./wx"),f.wxs=i("./wx"),f.ali=i("./ali"),f.alis=i("./ali")),f.ws=i("./ws"),f.wss=i("./ws"),a.exports=v,a.exports.connect=v,a.exports.MqttClient=o,a.exports.Store=s}).call(this)}).call(this,i("_process"))},{"../client":1,"../store":8,"./ali":2,"./tcp":3,"./tls":4,"./ws":5,"./wx":6,_process:50,debug:18,url:76,xtend:81}],13:[function(i,a,r){r.byteLength=function(g){var y=f(g),p=y[0],m=y[1];return 3*(p+m)/4-m},r.toByteArray=function(g){var y,p,m=f(g),b=m[0],x=m[1],_=new s(function(P,M,L){return 3*(M+L)/4-L}(0,b,x)),k=0,I=x>0?b-4:b;for(p=0;p<I;p+=4)y=o[g.charCodeAt(p)]<<18|o[g.charCodeAt(p+1)]<<12|o[g.charCodeAt(p+2)]<<6|o[g.charCodeAt(p+3)],_[k++]=y>>16&255,_[k++]=y>>8&255,_[k++]=255&y;return x===2&&(y=o[g.charCodeAt(p)]<<2|o[g.charCodeAt(p+1)]>>4,_[k++]=255&y),x===1&&(y=o[g.charCodeAt(p)]<<10|o[g.charCodeAt(p+1)]<<4|o[g.charCodeAt(p+2)]>>2,_[k++]=y>>8&255,_[k++]=255&y),_},r.fromByteArray=function(g){for(var y,p=g.length,m=p%3,b=[],x=0,_=p-m;x<_;x+=16383)b.push(v(g,x,x+16383>_?_:x+16383));return m===1?(y=g[p-1],b.push(n[y>>2]+n[y<<4&63]+"==")):m===2&&(y=(g[p-2]<<8)+g[p-1],b.push(n[y>>10]+n[y>>4&63]+n[y<<2&63]+"=")),b.join("")};for(var n=[],o=[],s=typeof Uint8Array<"u"?Uint8Array:Array,h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",l=0,c=h.length;l<c;++l)n[l]=h[l],o[h.charCodeAt(l)]=l;function f(g){var y=g.length;if(y%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var p=g.indexOf("=");return p===-1&&(p=y),[p,p===y?0:4-p%4]}function v(g,y,p){for(var m,b,x=[],_=y;_<p;_+=3)m=(g[_]<<16&16711680)+(g[_+1]<<8&65280)+(255&g[_+2]),x.push(n[(b=m)>>18&63]+n[b>>12&63]+n[b>>6&63]+n[63&b]);return x.join("")}o["-".charCodeAt(0)]=62,o["_".charCodeAt(0)]=63},{}],14:[function(i,a,r){const{Buffer:n}=i("buffer"),o=Symbol.for("BufferList");function s(h){if(!(this instanceof s))return new s(h);s._init.call(this,h)}s._init=function(h){Object.defineProperty(this,o,{value:!0}),this._bufs=[],this.length=0,h&&this.append(h)},s.prototype._new=function(h){return new s(h)},s.prototype._offset=function(h){if(h===0)return[0,0];let l=0;for(let c=0;c<this._bufs.length;c++){const f=l+this._bufs[c].length;if(h<f||c===this._bufs.length-1)return[c,h-l];l=f}},s.prototype._reverseOffset=function(h){const l=h[0];let c=h[1];for(let f=0;f<l;f++)c+=this._bufs[f].length;return c},s.prototype.get=function(h){if(h>this.length||h<0)return;const l=this._offset(h);return this._bufs[l[0]][l[1]]},s.prototype.slice=function(h,l){return typeof h=="number"&&h<0&&(h+=this.length),typeof l=="number"&&l<0&&(l+=this.length),this.copy(null,0,h,l)},s.prototype.copy=function(h,l,c,f){if((typeof c!="number"||c<0)&&(c=0),(typeof f!="number"||f>this.length)&&(f=this.length),c>=this.length||f<=0)return h||n.alloc(0);const v=!!h,g=this._offset(c),y=f-c;let p=y,m=v&&l||0,b=g[1];if(c===0&&f===this.length){if(!v)return this._bufs.length===1?this._bufs[0]:n.concat(this._bufs,this.length);for(let x=0;x<this._bufs.length;x++)this._bufs[x].copy(h,m),m+=this._bufs[x].length;return h}if(p<=this._bufs[g[0]].length-b)return v?this._bufs[g[0]].copy(h,l,b,b+p):this._bufs[g[0]].slice(b,b+p);v||(h=n.allocUnsafe(y));for(let x=g[0];x<this._bufs.length;x++){const _=this._bufs[x].length-b;if(!(p>_)){this._bufs[x].copy(h,m,b,b+p),m+=_;break}this._bufs[x].copy(h,m,b),m+=_,p-=_,b&&(b=0)}return h.length>m?h.slice(0,m):h},s.prototype.shallowSlice=function(h,l){if(h=h||0,l=typeof l!="number"?this.length:l,h<0&&(h+=this.length),l<0&&(l+=this.length),h===l)return this._new();const c=this._offset(h),f=this._offset(l),v=this._bufs.slice(c[0],f[0]+1);return f[1]===0?v.pop():v[v.length-1]=v[v.length-1].slice(0,f[1]),c[1]!==0&&(v[0]=v[0].slice(c[1])),this._new(v)},s.prototype.toString=function(h,l,c){return this.slice(l,c).toString(h)},s.prototype.consume=function(h){if(h=Math.trunc(h),Number.isNaN(h)||h<=0)return this;for(;this._bufs.length;){if(!(h>=this._bufs[0].length)){this._bufs[0]=this._bufs[0].slice(h),this.length-=h;break}h-=this._bufs[0].length,this.length-=this._bufs[0].length,this._bufs.shift()}return this},s.prototype.duplicate=function(){const h=this._new();for(let l=0;l<this._bufs.length;l++)h.append(this._bufs[l]);return h},s.prototype.append=function(h){if(h==null)return this;if(h.buffer)this._appendBuffer(n.from(h.buffer,h.byteOffset,h.byteLength));else if(Array.isArray(h))for(let l=0;l<h.length;l++)this.append(h[l]);else if(this._isBufferList(h))for(let l=0;l<h._bufs.length;l++)this.append(h._bufs[l]);else typeof h=="number"&&(h=h.toString()),this._appendBuffer(n.from(h));return this},s.prototype._appendBuffer=function(h){this._bufs.push(h),this.length+=h.length},s.prototype.indexOf=function(h,l,c){if(c===void 0&&typeof l=="string"&&(c=l,l=void 0),typeof h=="function"||Array.isArray(h))throw new TypeError('The "value" argument must be one of type string, Buffer, BufferList, or Uint8Array.');if(typeof h=="number"?h=n.from([h]):typeof h=="string"?h=n.from(h,c):this._isBufferList(h)?h=h.slice():Array.isArray(h.buffer)?h=n.from(h.buffer,h.byteOffset,h.byteLength):n.isBuffer(h)||(h=n.from(h)),l=Number(l||0),isNaN(l)&&(l=0),l<0&&(l=this.length+l),l<0&&(l=0),h.length===0)return l>this.length?this.length:l;const f=this._offset(l);let v=f[0],g=f[1];for(;v<this._bufs.length;v++){const y=this._bufs[v];for(;g<y.length;)if(y.length-g>=h.length){const p=y.indexOf(h,g);if(p!==-1)return this._reverseOffset([v,p]);g=y.length-h.length+1}else{const p=this._reverseOffset([v,g]);if(this._match(p,h))return p;g++}g=0}return-1},s.prototype._match=function(h,l){if(this.length-h<l.length)return!1;for(let c=0;c<l.length;c++)if(this.get(h+c)!==l[c])return!1;return!0},function(){const h={readDoubleBE:8,readDoubleLE:8,readFloatBE:4,readFloatLE:4,readInt32BE:4,readInt32LE:4,readUInt32BE:4,readUInt32LE:4,readInt16BE:2,readInt16LE:2,readUInt16BE:2,readUInt16LE:2,readInt8:1,readUInt8:1,readIntBE:null,readIntLE:null,readUIntBE:null,readUIntLE:null};for(const l in h)(function(c){s.prototype[c]=h[c]===null?function(f,v){return this.slice(f,f+v)[c](0,v)}:function(f=0){return this.slice(f,f+h[c])[c](0)}})(l)}(),s.prototype._isBufferList=function(h){return h instanceof s||s.isBufferList(h)},s.isBufferList=function(h){return h!=null&&h[o]},a.exports=s},{buffer:17}],15:[function(i,a,r){const n=i("readable-stream").Duplex,o=i("inherits"),s=i("./BufferList");function h(l){if(!(this instanceof h))return new h(l);if(typeof l=="function"){this._callback=l;const c=function(f){this._callback&&(this._callback(f),this._callback=null)}.bind(this);this.on("pipe",function(f){f.on("error",c)}),this.on("unpipe",function(f){f.removeListener("error",c)}),l=null}s._init.call(this,l),n.call(this)}o(h,n),Object.assign(h.prototype,s.prototype),h.prototype._new=function(l){return new h(l)},h.prototype._write=function(l,c,f){this._appendBuffer(l),typeof f=="function"&&f()},h.prototype._read=function(l){if(!this.length)return this.push(null);l=Math.min(l,this.length),this.push(this.slice(0,l)),this.consume(l)},h.prototype.end=function(l){n.prototype.end.call(this,l),this._callback&&(this._callback(null,this.slice()),this._callback=null)},h.prototype._destroy=function(l,c){this._bufs.length=0,this.length=0,c(l)},h.prototype._isBufferList=function(l){return l instanceof h||l instanceof s||h.isBufferList(l)},h.isBufferList=s.isBufferList,a.exports=h,a.exports.BufferListStream=h,a.exports.BufferList=s},{"./BufferList":14,inherits:24,"readable-stream":69}],16:[function(i,a,r){},{}],17:[function(i,a,r){(function(n){(function(){var o=i("base64-js"),s=i("ieee754");r.Buffer=c,r.SlowBuffer=function(E){return+E!=E&&(E=0),c.alloc(+E)},r.INSPECT_MAX_BYTES=50;var h=2147483647;function l(E){if(E>h)throw new RangeError('The value "'+E+'" is invalid for option "size"');var C=new Uint8Array(E);return C.__proto__=c.prototype,C}function c(E,C,D){if(typeof E=="number"){if(typeof C=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return g(E)}return f(E,C,D)}function f(E,C,D){if(typeof E=="string")return function(Q,ne){if(typeof ne=="string"&&ne!==""||(ne="utf8"),!c.isEncoding(ne))throw new TypeError("Unknown encoding: "+ne);var ye=0|m(Q,ne),ge=l(ye),xe=ge.write(Q,ne);return xe!==ye&&(ge=ge.slice(0,xe)),ge}(E,C);if(ArrayBuffer.isView(E))return y(E);if(E==null)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof E);if(le(E,ArrayBuffer)||E&&le(E.buffer,ArrayBuffer))return function(Q,ne,ye){if(ne<0||Q.byteLength<ne)throw new RangeError('"offset" is outside of buffer bounds');if(Q.byteLength<ne+(ye||0))throw new RangeError('"length" is outside of buffer bounds');var ge;return ge=ne===void 0&&ye===void 0?new Uint8Array(Q):ye===void 0?new Uint8Array(Q,ne):new Uint8Array(Q,ne,ye),ge.__proto__=c.prototype,ge}(E,C,D);if(typeof E=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var H=E.valueOf&&E.valueOf();if(H!=null&&H!==E)return c.from(H,C,D);var X=function(Q){if(c.isBuffer(Q)){var ne=0|p(Q.length),ye=l(ne);return ye.length===0||Q.copy(ye,0,0,ne),ye}if(Q.length!==void 0)return typeof Q.length!="number"||se(Q.length)?l(0):y(Q);if(Q.type==="Buffer"&&Array.isArray(Q.data))return y(Q.data)}(E);if(X)return X;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof E[Symbol.toPrimitive]=="function")return c.from(E[Symbol.toPrimitive]("string"),C,D);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof E)}function v(E){if(typeof E!="number")throw new TypeError('"size" argument must be of type number');if(E<0)throw new RangeError('The value "'+E+'" is invalid for option "size"')}function g(E){return v(E),l(E<0?0:0|p(E))}function y(E){for(var C=E.length<0?0:0|p(E.length),D=l(C),H=0;H<C;H+=1)D[H]=255&E[H];return D}function p(E){if(E>=h)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+h.toString(16)+" bytes");return 0|E}function m(E,C){if(c.isBuffer(E))return E.length;if(ArrayBuffer.isView(E)||le(E,ArrayBuffer))return E.byteLength;if(typeof E!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof E);var D=E.length,H=arguments.length>2&&arguments[2]===!0;if(!H&&D===0)return 0;for(var X=!1;;)switch(C){case"ascii":case"latin1":case"binary":return D;case"utf8":case"utf-8":return re(E).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*D;case"hex":return D>>>1;case"base64":return ee(E).length;default:if(X)return H?-1:re(E).length;C=(""+C).toLowerCase(),X=!0}}function b(E,C,D){var H=E[C];E[C]=E[D],E[D]=H}function x(E,C,D,H,X){if(E.length===0)return-1;if(typeof D=="string"?(H=D,D=0):D>2147483647?D=2147483647:D<-2147483648&&(D=-2147483648),se(D=+D)&&(D=X?0:E.length-1),D<0&&(D=E.length+D),D>=E.length){if(X)return-1;D=E.length-1}else if(D<0){if(!X)return-1;D=0}if(typeof C=="string"&&(C=c.from(C,H)),c.isBuffer(C))return C.length===0?-1:_(E,C,D,H,X);if(typeof C=="number")return C&=255,typeof Uint8Array.prototype.indexOf=="function"?X?Uint8Array.prototype.indexOf.call(E,C,D):Uint8Array.prototype.lastIndexOf.call(E,C,D):_(E,[C],D,H,X);throw new TypeError("val must be string, number or Buffer")}function _(E,C,D,H,X){var Q,ne=1,ye=E.length,ge=C.length;if(H!==void 0&&((H=String(H).toLowerCase())==="ucs2"||H==="ucs-2"||H==="utf16le"||H==="utf-16le")){if(E.length<2||C.length<2)return-1;ne=2,ye/=2,ge/=2,D/=2}function xe(Et,qe){return ne===1?Et[qe]:Et.readUInt16BE(qe*ne)}if(X){var Se=-1;for(Q=D;Q<ye;Q++)if(xe(E,Q)===xe(C,Se===-1?0:Q-Se)){if(Se===-1&&(Se=Q),Q-Se+1===ge)return Se*ne}else Se!==-1&&(Q-=Q-Se),Se=-1}else for(D+ge>ye&&(D=ye-ge),Q=D;Q>=0;Q--){for(var xt=!0,it=0;it<ge;it++)if(xe(E,Q+it)!==xe(C,it)){xt=!1;break}if(xt)return Q}return-1}function k(E,C,D,H){D=Number(D)||0;var X=E.length-D;H?(H=Number(H))>X&&(H=X):H=X;var Q=C.length;H>Q/2&&(H=Q/2);for(var ne=0;ne<H;++ne){var ye=parseInt(C.substr(2*ne,2),16);if(se(ye))return ne;E[D+ne]=ye}return ne}function I(E,C,D,H){return he(re(C,E.length-D),E,D,H)}function P(E,C,D,H){return he(function(X){for(var Q=[],ne=0;ne<X.length;++ne)Q.push(255&X.charCodeAt(ne));return Q}(C),E,D,H)}function M(E,C,D,H){return P(E,C,D,H)}function L(E,C,D,H){return he(ee(C),E,D,H)}function U(E,C,D,H){return he(function(X,Q){for(var ne,ye,ge,xe=[],Se=0;Se<X.length&&!((Q-=2)<0);++Se)ne=X.charCodeAt(Se),ye=ne>>8,ge=ne%256,xe.push(ge),xe.push(ye);return xe}(C,E.length-D),E,D,H)}function $(E,C,D){return C===0&&D===E.length?o.fromByteArray(E):o.fromByteArray(E.slice(C,D))}function S(E,C,D){D=Math.min(E.length,D);for(var H=[],X=C;X<D;){var Q,ne,ye,ge,xe=E[X],Se=null,xt=xe>239?4:xe>223?3:xe>191?2:1;if(X+xt<=D)switch(xt){case 1:xe<128&&(Se=xe);break;case 2:(192&(Q=E[X+1]))==128&&(ge=(31&xe)<<6|63&Q)>127&&(Se=ge);break;case 3:Q=E[X+1],ne=E[X+2],(192&Q)==128&&(192&ne)==128&&(ge=(15&xe)<<12|(63&Q)<<6|63&ne)>2047&&(ge<55296||ge>57343)&&(Se=ge);break;case 4:Q=E[X+1],ne=E[X+2],ye=E[X+3],(192&Q)==128&&(192&ne)==128&&(192&ye)==128&&(ge=(15&xe)<<18|(63&Q)<<12|(63&ne)<<6|63&ye)>65535&&ge<1114112&&(Se=ge)}Se===null?(Se=65533,xt=1):Se>65535&&(Se-=65536,H.push(Se>>>10&1023|55296),Se=56320|1023&Se),H.push(Se),X+=xt}return function(it){var Et=it.length;if(Et<=T)return String.fromCharCode.apply(String,it);for(var qe="",Qe=0;Qe<Et;)qe+=String.fromCharCode.apply(String,it.slice(Qe,Qe+=T));return qe}(H)}r.kMaxLength=h,c.TYPED_ARRAY_SUPPORT=function(){try{var E=new Uint8Array(1);return E.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},E.foo()===42}catch{return!1}}(),c.TYPED_ARRAY_SUPPORT||typeof console>"u"||typeof console.error!="function"||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(c.prototype,"parent",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.buffer}}),Object.defineProperty(c.prototype,"offset",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.byteOffset}}),typeof Symbol<"u"&&Symbol.species!=null&&c[Symbol.species]===c&&Object.defineProperty(c,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),c.poolSize=8192,c.from=function(E,C,D){return f(E,C,D)},c.prototype.__proto__=Uint8Array.prototype,c.__proto__=Uint8Array,c.alloc=function(E,C,D){return function(H,X,Q){return v(H),H<=0?l(H):X!==void 0?typeof Q=="string"?l(H).fill(X,Q):l(H).fill(X):l(H)}(E,C,D)},c.allocUnsafe=function(E){return g(E)},c.allocUnsafeSlow=function(E){return g(E)},c.isBuffer=function(E){return E!=null&&E._isBuffer===!0&&E!==c.prototype},c.compare=function(E,C){if(le(E,Uint8Array)&&(E=c.from(E,E.offset,E.byteLength)),le(C,Uint8Array)&&(C=c.from(C,C.offset,C.byteLength)),!c.isBuffer(E)||!c.isBuffer(C))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(E===C)return 0;for(var D=E.length,H=C.length,X=0,Q=Math.min(D,H);X<Q;++X)if(E[X]!==C[X]){D=E[X],H=C[X];break}return D<H?-1:H<D?1:0},c.isEncoding=function(E){switch(String(E).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},c.concat=function(E,C){if(!Array.isArray(E))throw new TypeError('"list" argument must be an Array of Buffers');if(E.length===0)return c.alloc(0);var D;if(C===void 0)for(C=0,D=0;D<E.length;++D)C+=E[D].length;var H=c.allocUnsafe(C),X=0;for(D=0;D<E.length;++D){var Q=E[D];if(le(Q,Uint8Array)&&(Q=c.from(Q)),!c.isBuffer(Q))throw new TypeError('"list" argument must be an Array of Buffers');Q.copy(H,X),X+=Q.length}return H},c.byteLength=m,c.prototype._isBuffer=!0,c.prototype.swap16=function(){var E=this.length;if(E%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var C=0;C<E;C+=2)b(this,C,C+1);return this},c.prototype.swap32=function(){var E=this.length;if(E%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var C=0;C<E;C+=4)b(this,C,C+3),b(this,C+1,C+2);return this},c.prototype.swap64=function(){var E=this.length;if(E%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var C=0;C<E;C+=8)b(this,C,C+7),b(this,C+1,C+6),b(this,C+2,C+5),b(this,C+3,C+4);return this},c.prototype.toString=function(){var E=this.length;return E===0?"":arguments.length===0?S(this,0,E):function(C,D,H){var X=!1;if((D===void 0||D<0)&&(D=0),D>this.length||((H===void 0||H>this.length)&&(H=this.length),H<=0)||(H>>>=0)<=(D>>>=0))return"";for(C||(C="utf8");;)switch(C){case"hex":return K(this,D,H);case"utf8":case"utf-8":return S(this,D,H);case"ascii":return R(this,D,H);case"latin1":case"binary":return O(this,D,H);case"base64":return $(this,D,H);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return G(this,D,H);default:if(X)throw new TypeError("Unknown encoding: "+C);C=(C+"").toLowerCase(),X=!0}}.apply(this,arguments)},c.prototype.toLocaleString=c.prototype.toString,c.prototype.equals=function(E){if(!c.isBuffer(E))throw new TypeError("Argument must be a Buffer");return this===E||c.compare(this,E)===0},c.prototype.inspect=function(){var E="",C=r.INSPECT_MAX_BYTES;return E=this.toString("hex",0,C).replace(/(.{2})/g,"$1 ").trim(),this.length>C&&(E+=" ... "),"<Buffer "+E+">"},c.prototype.compare=function(E,C,D,H,X){if(le(E,Uint8Array)&&(E=c.from(E,E.offset,E.byteLength)),!c.isBuffer(E))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof E);if(C===void 0&&(C=0),D===void 0&&(D=E?E.length:0),H===void 0&&(H=0),X===void 0&&(X=this.length),C<0||D>E.length||H<0||X>this.length)throw new RangeError("out of range index");if(H>=X&&C>=D)return 0;if(H>=X)return-1;if(C>=D)return 1;if(C>>>=0,D>>>=0,H>>>=0,X>>>=0,this===E)return 0;for(var Q=X-H,ne=D-C,ye=Math.min(Q,ne),ge=this.slice(H,X),xe=E.slice(C,D),Se=0;Se<ye;++Se)if(ge[Se]!==xe[Se]){Q=ge[Se],ne=xe[Se];break}return Q<ne?-1:ne<Q?1:0},c.prototype.includes=function(E,C,D){return this.indexOf(E,C,D)!==-1},c.prototype.indexOf=function(E,C,D){return x(this,E,C,D,!0)},c.prototype.lastIndexOf=function(E,C,D){return x(this,E,C,D,!1)},c.prototype.write=function(E,C,D,H){if(C===void 0)H="utf8",D=this.length,C=0;else if(D===void 0&&typeof C=="string")H=C,D=this.length,C=0;else{if(!isFinite(C))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");C>>>=0,isFinite(D)?(D>>>=0,H===void 0&&(H="utf8")):(H=D,D=void 0)}var X=this.length-C;if((D===void 0||D>X)&&(D=X),E.length>0&&(D<0||C<0)||C>this.length)throw new RangeError("Attempt to write outside buffer bounds");H||(H="utf8");for(var Q=!1;;)switch(H){case"hex":return k(this,E,C,D);case"utf8":case"utf-8":return I(this,E,C,D);case"ascii":return P(this,E,C,D);case"latin1":case"binary":return M(this,E,C,D);case"base64":return L(this,E,C,D);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return U(this,E,C,D);default:if(Q)throw new TypeError("Unknown encoding: "+H);H=(""+H).toLowerCase(),Q=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var T=4096;function R(E,C,D){var H="";D=Math.min(E.length,D);for(var X=C;X<D;++X)H+=String.fromCharCode(127&E[X]);return H}function O(E,C,D){var H="";D=Math.min(E.length,D);for(var X=C;X<D;++X)H+=String.fromCharCode(E[X]);return H}function K(E,C,D){var H=E.length;(!C||C<0)&&(C=0),(!D||D<0||D>H)&&(D=H);for(var X="",Q=C;Q<D;++Q)X+=J(E[Q]);return X}function G(E,C,D){for(var H=E.slice(C,D),X="",Q=0;Q<H.length;Q+=2)X+=String.fromCharCode(H[Q]+256*H[Q+1]);return X}function ae(E,C,D){if(E%1!=0||E<0)throw new RangeError("offset is not uint");if(E+C>D)throw new RangeError("Trying to access beyond buffer length")}function V(E,C,D,H,X,Q){if(!c.isBuffer(E))throw new TypeError('"buffer" argument must be a Buffer instance');if(C>X||C<Q)throw new RangeError('"value" argument is out of bounds');if(D+H>E.length)throw new RangeError("Index out of range")}function F(E,C,D,H,X,Q){if(D+H>E.length)throw new RangeError("Index out of range");if(D<0)throw new RangeError("Index out of range")}function q(E,C,D,H,X){return C=+C,D>>>=0,X||F(E,0,D,4),s.write(E,C,D,H,23,4),D+4}function Y(E,C,D,H,X){return C=+C,D>>>=0,X||F(E,0,D,8),s.write(E,C,D,H,52,8),D+8}c.prototype.slice=function(E,C){var D=this.length;E=~~E,C=C===void 0?D:~~C,E<0?(E+=D)<0&&(E=0):E>D&&(E=D),C<0?(C+=D)<0&&(C=0):C>D&&(C=D),C<E&&(C=E);var H=this.subarray(E,C);return H.__proto__=c.prototype,H},c.prototype.readUIntLE=function(E,C,D){E>>>=0,C>>>=0,D||ae(E,C,this.length);for(var H=this[E],X=1,Q=0;++Q<C&&(X*=256);)H+=this[E+Q]*X;return H},c.prototype.readUIntBE=function(E,C,D){E>>>=0,C>>>=0,D||ae(E,C,this.length);for(var H=this[E+--C],X=1;C>0&&(X*=256);)H+=this[E+--C]*X;return H},c.prototype.readUInt8=function(E,C){return E>>>=0,C||ae(E,1,this.length),this[E]},c.prototype.readUInt16LE=function(E,C){return E>>>=0,C||ae(E,2,this.length),this[E]|this[E+1]<<8},c.prototype.readUInt16BE=function(E,C){return E>>>=0,C||ae(E,2,this.length),this[E]<<8|this[E+1]},c.prototype.readUInt32LE=function(E,C){return E>>>=0,C||ae(E,4,this.length),(this[E]|this[E+1]<<8|this[E+2]<<16)+16777216*this[E+3]},c.prototype.readUInt32BE=function(E,C){return E>>>=0,C||ae(E,4,this.length),16777216*this[E]+(this[E+1]<<16|this[E+2]<<8|this[E+3])},c.prototype.readIntLE=function(E,C,D){E>>>=0,C>>>=0,D||ae(E,C,this.length);for(var H=this[E],X=1,Q=0;++Q<C&&(X*=256);)H+=this[E+Q]*X;return H>=(X*=128)&&(H-=Math.pow(2,8*C)),H},c.prototype.readIntBE=function(E,C,D){E>>>=0,C>>>=0,D||ae(E,C,this.length);for(var H=C,X=1,Q=this[E+--H];H>0&&(X*=256);)Q+=this[E+--H]*X;return Q>=(X*=128)&&(Q-=Math.pow(2,8*C)),Q},c.prototype.readInt8=function(E,C){return E>>>=0,C||ae(E,1,this.length),128&this[E]?-1*(255-this[E]+1):this[E]},c.prototype.readInt16LE=function(E,C){E>>>=0,C||ae(E,2,this.length);var D=this[E]|this[E+1]<<8;return 32768&D?4294901760|D:D},c.prototype.readInt16BE=function(E,C){E>>>=0,C||ae(E,2,this.length);var D=this[E+1]|this[E]<<8;return 32768&D?4294901760|D:D},c.prototype.readInt32LE=function(E,C){return E>>>=0,C||ae(E,4,this.length),this[E]|this[E+1]<<8|this[E+2]<<16|this[E+3]<<24},c.prototype.readInt32BE=function(E,C){return E>>>=0,C||ae(E,4,this.length),this[E]<<24|this[E+1]<<16|this[E+2]<<8|this[E+3]},c.prototype.readFloatLE=function(E,C){return E>>>=0,C||ae(E,4,this.length),s.read(this,E,!0,23,4)},c.prototype.readFloatBE=function(E,C){return E>>>=0,C||ae(E,4,this.length),s.read(this,E,!1,23,4)},c.prototype.readDoubleLE=function(E,C){return E>>>=0,C||ae(E,8,this.length),s.read(this,E,!0,52,8)},c.prototype.readDoubleBE=function(E,C){return E>>>=0,C||ae(E,8,this.length),s.read(this,E,!1,52,8)},c.prototype.writeUIntLE=function(E,C,D,H){E=+E,C>>>=0,D>>>=0,H||V(this,E,C,D,Math.pow(2,8*D)-1,0);var X=1,Q=0;for(this[C]=255&E;++Q<D&&(X*=256);)this[C+Q]=E/X&255;return C+D},c.prototype.writeUIntBE=function(E,C,D,H){E=+E,C>>>=0,D>>>=0,H||V(this,E,C,D,Math.pow(2,8*D)-1,0);var X=D-1,Q=1;for(this[C+X]=255&E;--X>=0&&(Q*=256);)this[C+X]=E/Q&255;return C+D},c.prototype.writeUInt8=function(E,C,D){return E=+E,C>>>=0,D||V(this,E,C,1,255,0),this[C]=255&E,C+1},c.prototype.writeUInt16LE=function(E,C,D){return E=+E,C>>>=0,D||V(this,E,C,2,65535,0),this[C]=255&E,this[C+1]=E>>>8,C+2},c.prototype.writeUInt16BE=function(E,C,D){return E=+E,C>>>=0,D||V(this,E,C,2,65535,0),this[C]=E>>>8,this[C+1]=255&E,C+2},c.prototype.writeUInt32LE=function(E,C,D){return E=+E,C>>>=0,D||V(this,E,C,4,4294967295,0),this[C+3]=E>>>24,this[C+2]=E>>>16,this[C+1]=E>>>8,this[C]=255&E,C+4},c.prototype.writeUInt32BE=function(E,C,D){return E=+E,C>>>=0,D||V(this,E,C,4,4294967295,0),this[C]=E>>>24,this[C+1]=E>>>16,this[C+2]=E>>>8,this[C+3]=255&E,C+4},c.prototype.writeIntLE=function(E,C,D,H){if(E=+E,C>>>=0,!H){var X=Math.pow(2,8*D-1);V(this,E,C,D,X-1,-X)}var Q=0,ne=1,ye=0;for(this[C]=255&E;++Q<D&&(ne*=256);)E<0&&ye===0&&this[C+Q-1]!==0&&(ye=1),this[C+Q]=(E/ne>>0)-ye&255;return C+D},c.prototype.writeIntBE=function(E,C,D,H){if(E=+E,C>>>=0,!H){var X=Math.pow(2,8*D-1);V(this,E,C,D,X-1,-X)}var Q=D-1,ne=1,ye=0;for(this[C+Q]=255&E;--Q>=0&&(ne*=256);)E<0&&ye===0&&this[C+Q+1]!==0&&(ye=1),this[C+Q]=(E/ne>>0)-ye&255;return C+D},c.prototype.writeInt8=function(E,C,D){return E=+E,C>>>=0,D||V(this,E,C,1,127,-128),E<0&&(E=255+E+1),this[C]=255&E,C+1},c.prototype.writeInt16LE=function(E,C,D){return E=+E,C>>>=0,D||V(this,E,C,2,32767,-32768),this[C]=255&E,this[C+1]=E>>>8,C+2},c.prototype.writeInt16BE=function(E,C,D){return E=+E,C>>>=0,D||V(this,E,C,2,32767,-32768),this[C]=E>>>8,this[C+1]=255&E,C+2},c.prototype.writeInt32LE=function(E,C,D){return E=+E,C>>>=0,D||V(this,E,C,4,2147483647,-2147483648),this[C]=255&E,this[C+1]=E>>>8,this[C+2]=E>>>16,this[C+3]=E>>>24,C+4},c.prototype.writeInt32BE=function(E,C,D){return E=+E,C>>>=0,D||V(this,E,C,4,2147483647,-2147483648),E<0&&(E=4294967295+E+1),this[C]=E>>>24,this[C+1]=E>>>16,this[C+2]=E>>>8,this[C+3]=255&E,C+4},c.prototype.writeFloatLE=function(E,C,D){return q(this,E,C,!0,D)},c.prototype.writeFloatBE=function(E,C,D){return q(this,E,C,!1,D)},c.prototype.writeDoubleLE=function(E,C,D){return Y(this,E,C,!0,D)},c.prototype.writeDoubleBE=function(E,C,D){return Y(this,E,C,!1,D)},c.prototype.copy=function(E,C,D,H){if(!c.isBuffer(E))throw new TypeError("argument should be a Buffer");if(D||(D=0),H||H===0||(H=this.length),C>=E.length&&(C=E.length),C||(C=0),H>0&&H<D&&(H=D),H===D||E.length===0||this.length===0)return 0;if(C<0)throw new RangeError("targetStart out of bounds");if(D<0||D>=this.length)throw new RangeError("Index out of range");if(H<0)throw new RangeError("sourceEnd out of bounds");H>this.length&&(H=this.length),E.length-C<H-D&&(H=E.length-C+D);var X=H-D;if(this===E&&typeof Uint8Array.prototype.copyWithin=="function")this.copyWithin(C,D,H);else if(this===E&&D<C&&C<H)for(var Q=X-1;Q>=0;--Q)E[Q+C]=this[Q+D];else Uint8Array.prototype.set.call(E,this.subarray(D,H),C);return X},c.prototype.fill=function(E,C,D,H){if(typeof E=="string"){if(typeof C=="string"?(H=C,C=0,D=this.length):typeof D=="string"&&(H=D,D=this.length),H!==void 0&&typeof H!="string")throw new TypeError("encoding must be a string");if(typeof H=="string"&&!c.isEncoding(H))throw new TypeError("Unknown encoding: "+H);if(E.length===1){var X=E.charCodeAt(0);(H==="utf8"&&X<128||H==="latin1")&&(E=X)}}else typeof E=="number"&&(E&=255);if(C<0||this.length<C||this.length<D)throw new RangeError("Out of range index");if(D<=C)return this;var Q;if(C>>>=0,D=D===void 0?this.length:D>>>0,E||(E=0),typeof E=="number")for(Q=C;Q<D;++Q)this[Q]=E;else{var ne=c.isBuffer(E)?E:c.from(E,H),ye=ne.length;if(ye===0)throw new TypeError('The value "'+E+'" is invalid for argument "value"');for(Q=0;Q<D-C;++Q)this[Q+C]=ne[Q%ye]}return this};var W=/[^+/0-9A-Za-z-_]/g;function J(E){return E<16?"0"+E.toString(16):E.toString(16)}function re(E,C){var D;C=C||1/0;for(var H=E.length,X=null,Q=[],ne=0;ne<H;++ne){if((D=E.charCodeAt(ne))>55295&&D<57344){if(!X){if(D>56319){(C-=3)>-1&&Q.push(239,191,189);continue}if(ne+1===H){(C-=3)>-1&&Q.push(239,191,189);continue}X=D;continue}if(D<56320){(C-=3)>-1&&Q.push(239,191,189),X=D;continue}D=65536+(X-55296<<10|D-56320)}else X&&(C-=3)>-1&&Q.push(239,191,189);if(X=null,D<128){if((C-=1)<0)break;Q.push(D)}else if(D<2048){if((C-=2)<0)break;Q.push(D>>6|192,63&D|128)}else if(D<65536){if((C-=3)<0)break;Q.push(D>>12|224,D>>6&63|128,63&D|128)}else{if(!(D<1114112))throw new Error("Invalid code point");if((C-=4)<0)break;Q.push(D>>18|240,D>>12&63|128,D>>6&63|128,63&D|128)}}return Q}function ee(E){return o.toByteArray(function(C){if((C=(C=C.split("=")[0]).trim().replace(W,"")).length<2)return"";for(;C.length%4!=0;)C+="=";return C}(E))}function he(E,C,D,H){for(var X=0;X<H&&!(X+D>=C.length||X>=E.length);++X)C[X+D]=E[X];return X}function le(E,C){return E instanceof C||E!=null&&E.constructor!=null&&E.constructor.name!=null&&E.constructor.name===C.name}function se(E){return E!=E}}).call(this)}).call(this,i("buffer").Buffer)},{"base64-js":13,buffer:17,ieee754:23}],18:[function(i,a,r){(function(n){(function(){r.formatArgs=function(s){if(s[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+s[0]+(this.useColors?"%c ":" ")+"+"+a.exports.humanize(this.diff),!this.useColors)return;const h="color: "+this.color;s.splice(1,0,h,"color: inherit");let l=0,c=0;s[0].replace(/%[a-zA-Z%]/g,f=>{f!=="%%"&&f==="%c"&&(c=++l)}),s.splice(c,0,h)},r.save=function(s){try{s?r.storage.setItem("debug",s):r.storage.removeItem("debug")}catch{}},r.load=function(){let s;try{s=r.storage.getItem("debug")}catch{}return!s&&n!==void 0&&"env"in n&&(s=n.env.DEBUG),s},r.useColors=function(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},r.storage=function(){try{return localStorage}catch{}}(),r.destroy=(()=>{let s=!1;return()=>{s||(s=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),r.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],r.log=console.debug||console.log||(()=>{}),a.exports=i("./common")(r);const{formatters:o}=a.exports;o.j=function(s){try{return JSON.stringify(s)}catch(h){return"[UnexpectedJSONParseError]: "+h.message}}}).call(this)}).call(this,i("_process"))},{"./common":19,_process:50}],19:[function(i,a,r){a.exports=function(n){function o(l){let c,f,v,g=null;function y(...p){if(!y.enabled)return;const m=y,b=Number(new Date),x=b-(c||b);m.diff=x,m.prev=c,m.curr=b,c=b,p[0]=o.coerce(p[0]),typeof p[0]!="string"&&p.unshift("%O");let _=0;p[0]=p[0].replace(/%([a-zA-Z%])/g,(k,I)=>{if(k==="%%")return"%";_++;const P=o.formatters[I];if(typeof P=="function"){const M=p[_];k=P.call(m,M),p.splice(_,1),_--}return k}),o.formatArgs.call(m,p),(m.log||o.log).apply(m,p)}return y.namespace=l,y.useColors=o.useColors(),y.color=o.selectColor(l),y.extend=s,y.destroy=o.destroy,Object.defineProperty(y,"enabled",{enumerable:!0,configurable:!1,get:()=>g!==null?g:(f!==o.namespaces&&(f=o.namespaces,v=o.enabled(l)),v),set:p=>{g=p}}),typeof o.init=="function"&&o.init(y),y}function s(l,c){const f=o(this.namespace+(c===void 0?":":c)+l);return f.log=this.log,f}function h(l){return l.toString().substring(2,l.toString().length-2).replace(/\.\*\?$/,"*")}return o.debug=o,o.default=o,o.coerce=function(l){return l instanceof Error?l.stack||l.message:l},o.disable=function(){const l=[...o.names.map(h),...o.skips.map(h).map(c=>"-"+c)].join(",");return o.enable(""),l},o.enable=function(l){let c;o.save(l),o.namespaces=l,o.names=[],o.skips=[];const f=(typeof l=="string"?l:"").split(/[\s,]+/),v=f.length;for(c=0;c<v;c++)f[c]&&((l=f[c].replace(/\*/g,".*?"))[0]==="-"?o.skips.push(new RegExp("^"+l.substr(1)+"$")):o.names.push(new RegExp("^"+l+"$")))},o.enabled=function(l){if(l[l.length-1]==="*")return!0;let c,f;for(c=0,f=o.skips.length;c<f;c++)if(o.skips[c].test(l))return!1;for(c=0,f=o.names.length;c<f;c++)if(o.names[c].test(l))return!0;return!1},o.humanize=i("ms"),o.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(n).forEach(l=>{o[l]=n[l]}),o.names=[],o.skips=[],o.formatters={},o.selectColor=function(l){let c=0;for(let f=0;f<l.length;f++)c=(c<<5)-c+l.charCodeAt(f),c|=0;return o.colors[Math.abs(c)%o.colors.length]},o.enable(o.load()),o}},{ms:45}],20:[function(i,a,r){(function(n,o){(function(){var s=i("readable-stream"),h=i("end-of-stream"),l=i("inherits"),c=i("stream-shift"),f=o.from&&o.from!==Uint8Array.from?o.from([0]):new o([0]),v=function(m,b){m._corked?m.once("uncork",b):b()},g=function(m,b){return function(x){x?function(_,k){_._autoDestroy&&_.destroy(k)}(m,x.message==="premature close"?null:x):b&&!m._ended&&m.end()}},y=function(){},p=function(m,b,x){if(!(this instanceof p))return new p(m,b,x);s.Duplex.call(this,x),this._writable=null,this._readable=null,this._readable2=null,this._autoDestroy=!x||x.autoDestroy!==!1,this._forwardDestroy=!x||x.destroy!==!1,this._forwardEnd=!x||x.end!==!1,this._corked=1,this._ondrain=null,this._drained=!1,this._forwarding=!1,this._unwrite=null,this._unread=null,this._ended=!1,this.destroyed=!1,m&&this.setWritable(m),b&&this.setReadable(b)};l(p,s.Duplex),p.obj=function(m,b,x){return x||(x={}),x.objectMode=!0,x.highWaterMark=16,new p(m,b,x)},p.prototype.cork=function(){++this._corked==1&&this.emit("cork")},p.prototype.uncork=function(){this._corked&&--this._corked==0&&this.emit("uncork")},p.prototype.setWritable=function(m){if(this._unwrite&&this._unwrite(),this.destroyed)m&&m.destroy&&m.destroy();else if(m!==null&&m!==!1){var b=this,x=h(m,{writable:!0,readable:!1},g(this,this._forwardEnd)),_=function(){var k=b._ondrain;b._ondrain=null,k&&k()};this._unwrite&&n.nextTick(_),this._writable=m,this._writable.on("drain",_),this._unwrite=function(){b._writable.removeListener("drain",_),x()},this.uncork()}else this.end()},p.prototype.setReadable=function(m){if(this._unread&&this._unread(),this.destroyed)m&&m.destroy&&m.destroy();else{if(m===null||m===!1)return this.push(null),void this.resume();var b,x=this,_=h(m,{writable:!1,readable:!0},g(this)),k=function(){x._forward()},I=function(){x.push(null)};this._drained=!0,this._readable=m,this._readable2=m._readableState?m:(b=m,new s.Readable({objectMode:!0,highWaterMark:16}).wrap(b)),this._readable2.on("readable",k),this._readable2.on("end",I),this._unread=function(){x._readable2.removeListener("readable",k),x._readable2.removeListener("end",I),_()},this._forward()}},p.prototype._read=function(){this._drained=!0,this._forward()},p.prototype._forward=function(){if(!this._forwarding&&this._readable2&&this._drained){var m;for(this._forwarding=!0;this._drained&&(m=c(this._readable2))!==null;)this.destroyed||(this._drained=this.push(m));this._forwarding=!1}},p.prototype.destroy=function(m,b){if(b||(b=y),this.destroyed)return b(null);this.destroyed=!0;var x=this;n.nextTick(function(){x._destroy(m),b(null)})},p.prototype._destroy=function(m){if(m){var b=this._ondrain;this._ondrain=null,b?b(m):this.emit("error",m)}this._forwardDestroy&&(this._readable&&this._readable.destroy&&this._readable.destroy(),this._writable&&this._writable.destroy&&this._writable.destroy()),this.emit("close")},p.prototype._write=function(m,b,x){if(!this.destroyed)return this._corked?v(this,this._write.bind(this,m,b,x)):m===f?this._finish(x):this._writable?void(this._writable.write(m)===!1?this._ondrain=x:this.destroyed||x()):x()},p.prototype._finish=function(m){var b=this;this.emit("preend"),v(this,function(){var x,_;x=b._forwardEnd&&b._writable,_=function(){b._writableState.prefinished===!1&&(b._writableState.prefinished=!0),b.emit("prefinish"),v(b,m)},x?x._writableState&&x._writableState.finished?_():x._writableState?x.end(_):(x.end(),_()):_()})},p.prototype.end=function(m,b,x){return typeof m=="function"?this.end(null,null,m):typeof b=="function"?this.end(m,null,b):(this._ended=!0,m&&this.write(m),this._writableState.ending||this._writableState.destroyed||this.write(f),s.Writable.prototype.end.call(this,x))},a.exports=p}).call(this)}).call(this,i("_process"),i("buffer").Buffer)},{_process:50,buffer:17,"end-of-stream":21,inherits:24,"readable-stream":69,"stream-shift":74}],21:[function(i,a,r){(function(n){(function(){var o=i("once"),s=function(){},h=function(l,c,f){if(typeof c=="function")return h(l,null,c);c||(c={}),f=o(f||s);var v=l._writableState,g=l._readableState,y=c.readable||c.readable!==!1&&l.readable,p=c.writable||c.writable!==!1&&l.writable,m=!1,b=function(){l.writable||x()},x=function(){p=!1,y||f.call(l)},_=function(){y=!1,p||f.call(l)},k=function(U){f.call(l,U?new Error("exited with error code: "+U):null)},I=function(U){f.call(l,U)},P=function(){n.nextTick(M)},M=function(){if(!m)return(!y||g&&g.ended&&!g.destroyed)&&(!p||v&&v.ended&&!v.destroyed)?void 0:f.call(l,new Error("premature close"))},L=function(){l.req.on("finish",x)};return function(U){return U.setHeader&&typeof U.abort=="function"}(l)?(l.on("complete",x),l.on("abort",P),l.req?L():l.on("request",L)):p&&!v&&(l.on("end",b),l.on("close",b)),function(U){return U.stdio&&Array.isArray(U.stdio)&&U.stdio.length===3}(l)&&l.on("exit",k),l.on("end",_),l.on("finish",x),c.error!==!1&&l.on("error",I),l.on("close",P),function(){m=!0,l.removeListener("complete",x),l.removeListener("abort",P),l.removeListener("request",L),l.req&&l.req.removeListener("finish",x),l.removeListener("end",b),l.removeListener("close",b),l.removeListener("finish",x),l.removeListener("exit",k),l.removeListener("end",_),l.removeListener("error",I),l.removeListener("close",P)}};a.exports=h}).call(this)}).call(this,i("_process"))},{_process:50,once:48}],22:[function(i,a,r){var n=Object.create||function(_){var k=function(){};return k.prototype=_,new k},o=Object.keys||function(_){var k=[];for(var I in _)Object.prototype.hasOwnProperty.call(_,I)&&k.push(I);return I},s=Function.prototype.bind||function(_){var k=this;return function(){return k.apply(_,arguments)}};function h(){this._events&&Object.prototype.hasOwnProperty.call(this,"_events")||(this._events=n(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0}a.exports=h,h.EventEmitter=h,h.prototype._events=void 0,h.prototype._maxListeners=void 0;var l,c=10;try{var f={};Object.defineProperty&&Object.defineProperty(f,"x",{value:0}),l=f.x===0}catch{l=!1}function v(_){return _._maxListeners===void 0?h.defaultMaxListeners:_._maxListeners}function g(_,k,I,P){var M,L,U;if(typeof I!="function")throw new TypeError('"listener" argument must be a function');if((L=_._events)?(L.newListener&&(_.emit("newListener",k,I.listener?I.listener:I),L=_._events),U=L[k]):(L=_._events=n(null),_._eventsCount=0),U){if(typeof U=="function"?U=L[k]=P?[I,U]:[U,I]:P?U.unshift(I):U.push(I),!U.warned&&(M=v(_))&&M>0&&U.length>M){U.warned=!0;var $=new Error("Possible EventEmitter memory leak detected. "+U.length+' "'+String(k)+'" listeners added. Use emitter.setMaxListeners() to increase limit.');$.name="MaxListenersExceededWarning",$.emitter=_,$.type=k,$.count=U.length,typeof console=="object"&&console.warn&&console.warn("%s: %s",$.name,$.message)}}else U=L[k]=I,++_._eventsCount;return _}function y(){if(!this.fired)switch(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length){case 0:return this.listener.call(this.target);case 1:return this.listener.call(this.target,arguments[0]);case 2:return this.listener.call(this.target,arguments[0],arguments[1]);case 3:return this.listener.call(this.target,arguments[0],arguments[1],arguments[2]);default:for(var _=new Array(arguments.length),k=0;k<_.length;++k)_[k]=arguments[k];this.listener.apply(this.target,_)}}function p(_,k,I){var P={fired:!1,wrapFn:void 0,target:_,type:k,listener:I},M=s.call(y,P);return M.listener=I,P.wrapFn=M,M}function m(_,k,I){var P=_._events;if(!P)return[];var M=P[k];return M?typeof M=="function"?I?[M.listener||M]:[M]:I?function(L){for(var U=new Array(L.length),$=0;$<U.length;++$)U[$]=L[$].listener||L[$];return U}(M):x(M,M.length):[]}function b(_){var k=this._events;if(k){var I=k[_];if(typeof I=="function")return 1;if(I)return I.length}return 0}function x(_,k){for(var I=new Array(k),P=0;P<k;++P)I[P]=_[P];return I}l?Object.defineProperty(h,"defaultMaxListeners",{enumerable:!0,get:function(){return c},set:function(_){if(typeof _!="number"||_<0||_!=_)throw new TypeError('"defaultMaxListeners" must be a positive number');c=_}}):h.defaultMaxListeners=c,h.prototype.setMaxListeners=function(_){if(typeof _!="number"||_<0||isNaN(_))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=_,this},h.prototype.getMaxListeners=function(){return v(this)},h.prototype.emit=function(_){var k,I,P,M,L,U,$=_==="error";if(U=this._events)$=$&&U.error==null;else if(!$)return!1;if($){if(arguments.length>1&&(k=arguments[1]),k instanceof Error)throw k;var S=new Error('Unhandled "error" event. ('+k+")");throw S.context=k,S}if(!(I=U[_]))return!1;var T=typeof I=="function";switch(P=arguments.length){case 1:(function(R,O,K){if(O)R.call(K);else for(var G=R.length,ae=x(R,G),V=0;V<G;++V)ae[V].call(K)})(I,T,this);break;case 2:(function(R,O,K,G){if(O)R.call(K,G);else for(var ae=R.length,V=x(R,ae),F=0;F<ae;++F)V[F].call(K,G)})(I,T,this,arguments[1]);break;case 3:(function(R,O,K,G,ae){if(O)R.call(K,G,ae);else for(var V=R.length,F=x(R,V),q=0;q<V;++q)F[q].call(K,G,ae)})(I,T,this,arguments[1],arguments[2]);break;case 4:(function(R,O,K,G,ae,V){if(O)R.call(K,G,ae,V);else for(var F=R.length,q=x(R,F),Y=0;Y<F;++Y)q[Y].call(K,G,ae,V)})(I,T,this,arguments[1],arguments[2],arguments[3]);break;default:for(M=new Array(P-1),L=1;L<P;L++)M[L-1]=arguments[L];(function(R,O,K,G){if(O)R.apply(K,G);else for(var ae=R.length,V=x(R,ae),F=0;F<ae;++F)V[F].apply(K,G)})(I,T,this,M)}return!0},h.prototype.addListener=function(_,k){return g(this,_,k,!1)},h.prototype.on=h.prototype.addListener,h.prototype.prependListener=function(_,k){return g(this,_,k,!0)},h.prototype.once=function(_,k){if(typeof k!="function")throw new TypeError('"listener" argument must be a function');return this.on(_,p(this,_,k)),this},h.prototype.prependOnceListener=function(_,k){if(typeof k!="function")throw new TypeError('"listener" argument must be a function');return this.prependListener(_,p(this,_,k)),this},h.prototype.removeListener=function(_,k){var I,P,M,L,U;if(typeof k!="function")throw new TypeError('"listener" argument must be a function');if(!(P=this._events))return this;if(!(I=P[_]))return this;if(I===k||I.listener===k)--this._eventsCount==0?this._events=n(null):(delete P[_],P.removeListener&&this.emit("removeListener",_,I.listener||k));else if(typeof I!="function"){for(M=-1,L=I.length-1;L>=0;L--)if(I[L]===k||I[L].listener===k){U=I[L].listener,M=L;break}if(M<0)return this;M===0?I.shift():function($,S){for(var T=S,R=T+1,O=$.length;R<O;T+=1,R+=1)$[T]=$[R];$.pop()}(I,M),I.length===1&&(P[_]=I[0]),P.removeListener&&this.emit("removeListener",_,U||k)}return this},h.prototype.removeAllListeners=function(_){var k,I,P;if(!(I=this._events))return this;if(!I.removeListener)return arguments.length===0?(this._events=n(null),this._eventsCount=0):I[_]&&(--this._eventsCount==0?this._events=n(null):delete I[_]),this;if(arguments.length===0){var M,L=o(I);for(P=0;P<L.length;++P)(M=L[P])!=="removeListener"&&this.removeAllListeners(M);return this.removeAllListeners("removeListener"),this._events=n(null),this._eventsCount=0,this}if(typeof(k=I[_])=="function")this.removeListener(_,k);else if(k)for(P=k.length-1;P>=0;P--)this.removeListener(_,k[P]);return this},h.prototype.listeners=function(_){return m(this,_,!0)},h.prototype.rawListeners=function(_){return m(this,_,!1)},h.listenerCount=function(_,k){return typeof _.listenerCount=="function"?_.listenerCount(k):b.call(_,k)},h.prototype.listenerCount=b,h.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]}},{}],23:[function(i,a,r){r.read=function(n,o,s,h,l){var c,f,v=8*l-h-1,g=(1<<v)-1,y=g>>1,p=-7,m=s?l-1:0,b=s?-1:1,x=n[o+m];for(m+=b,c=x&(1<<-p)-1,x>>=-p,p+=v;p>0;c=256*c+n[o+m],m+=b,p-=8);for(f=c&(1<<-p)-1,c>>=-p,p+=h;p>0;f=256*f+n[o+m],m+=b,p-=8);if(c===0)c=1-y;else{if(c===g)return f?NaN:1/0*(x?-1:1);f+=Math.pow(2,h),c-=y}return(x?-1:1)*f*Math.pow(2,c-h)},r.write=function(n,o,s,h,l,c){var f,v,g,y=8*c-l-1,p=(1<<y)-1,m=p>>1,b=l===23?Math.pow(2,-24)-Math.pow(2,-77):0,x=h?0:c-1,_=h?1:-1,k=o<0||o===0&&1/o<0?1:0;for(o=Math.abs(o),isNaN(o)||o===1/0?(v=isNaN(o)?1:0,f=p):(f=Math.floor(Math.log(o)/Math.LN2),o*(g=Math.pow(2,-f))<1&&(f--,g*=2),(o+=f+m>=1?b/g:b*Math.pow(2,1-m))*g>=2&&(f++,g/=2),f+m>=p?(v=0,f=p):f+m>=1?(v=(o*g-1)*Math.pow(2,l),f+=m):(v=o*Math.pow(2,m-1)*Math.pow(2,l),f=0));l>=8;n[s+x]=255&v,x+=_,v/=256,l-=8);for(f=f<<l|v,y+=l;y>0;n[s+x]=255&f,x+=_,f/=256,y-=8);n[s+x-_]|=128*k}},{}],24:[function(i,a,r){typeof Object.create=="function"?a.exports=function(n,o){o&&(n.super_=o,n.prototype=Object.create(o.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}))}:a.exports=function(n,o){if(o){n.super_=o;var s=function(){};s.prototype=o.prototype,n.prototype=new s,n.prototype.constructor=n}}},{}],25:[function(i,a,r){Object.defineProperty(r,"__esModule",{value:!0});var n=function(){function o(s,h){this.color=!0,this.key=void 0,this.value=void 0,this.parent=void 0,this.brother=void 0,this.leftChild=void 0,this.rightChild=void 0,this.key=s,this.value=h}return o.prototype.rotateLeft=function(){var s=this.parent,h=this.brother,l=this.leftChild,c=this.rightChild;if(!c)throw new Error("unknown error");var f=c.leftChild,v=c.rightChild;return s&&(s.leftChild===this?s.leftChild=c:s.rightChild===this&&(s.rightChild=c)),c.parent=s,c.brother=h,c.leftChild=this,c.rightChild=v,h&&(h.brother=c),this.parent=c,this.brother=v,this.leftChild=l,this.rightChild=f,v&&(v.parent=c,v.brother=this),l&&(l.parent=this,l.brother=f),f&&(f.parent=this,f.brother=l),c},o.prototype.rotateRight=function(){var s=this.parent,h=this.brother,l=this.leftChild;if(!l)throw new Error("unknown error");var c=this.rightChild,f=l.leftChild,v=l.rightChild;return s&&(s.leftChild===this?s.leftChild=l:s.rightChild===this&&(s.rightChild=l)),l.parent=s,l.brother=h,l.leftChild=f,l.rightChild=this,h&&(h.brother=l),f&&(f.parent=l,f.brother=this),this.parent=l,this.brother=f,this.leftChild=v,this.rightChild=c,v&&(v.parent=this,v.brother=c),c&&(c.parent=this,c.brother=v),l},o.prototype.remove=function(){if(this.leftChild||this.rightChild)throw new Error("can only remove leaf node");this.parent&&(this===this.parent.leftChild?this.parent.leftChild=void 0:this===this.parent.rightChild&&(this.parent.rightChild=void 0)),this.brother&&(this.brother.brother=void 0),this.key=void 0,this.value=void 0,this.parent=void 0,this.brother=void 0},o.TreeNodeColorType={red:!0,black:!1},o}();Object.freeze(n),r.default=n},{}],26:[function(i,a,r){var n=this&&this.__generator||function(s,h){var l,c,f,v,g={label:0,sent:function(){if(1&f[0])throw f[1];return f[1]},trys:[],ops:[]};return v={next:y(0),throw:y(1),return:y(2)},typeof Symbol=="function"&&(v[Symbol.iterator]=function(){return this}),v;function y(p){return function(m){return function(b){if(l)throw new TypeError("Generator is already executing.");for(;g;)try{if(l=1,c&&(f=2&b[0]?c.return:b[0]?c.throw||((f=c.return)&&f.call(c),0):c.next)&&!(f=f.call(c,b[1])).done)return f;switch(c=0,f&&(b=[2&b[0],f.value]),b[0]){case 0:case 1:f=b;break;case 4:return g.label++,{value:b[1],done:!1};case 5:g.label++,c=b[1],b=[0];continue;case 7:b=g.ops.pop(),g.trys.pop();continue;default:if(!(f=(f=g.trys).length>0&&f[f.length-1])&&(b[0]===6||b[0]===2)){g=0;continue}if(b[0]===3&&(!f||b[1]>f[0]&&b[1]<f[3])){g.label=b[1];break}if(b[0]===6&&g.label<f[1]){g.label=f[1],f=b;break}if(f&&g.label<f[2]){g.label=f[2],g.ops.push(b);break}f[2]&&g.ops.pop(),g.trys.pop();continue}b=h.call(s,g)}catch(x){b=[6,x],c=0}finally{l=f=0}if(5&b[0])throw b[1];return{value:b[0]?b[1]:void 0,done:!0}}([p,m])}}};function o(s){var h=this;s===void 0&&(s=[]);var l=[],c=0,f=0,v=0,g=0,y=0,p=0;this.size=function(){return p},this.empty=function(){return p===0},this.clear=function(){c=v=f=g=y=p=0,b.call(this,o.bucketSize),p=0},this.front=function(){return l[c][f]},this.back=function(){return l[v][g]},this.forEach=function(x){if(!this.empty()){var _=0;if(c!==v){for(I=f;I<o.bucketSize;++I)x(l[c][I],_++);for(I=c+1;I<v;++I)for(var k=0;k<o.bucketSize;++k)x(l[I][k],_++);for(I=0;I<=g;++I)x(l[v][I],_++)}else for(var I=f;I<=g;++I)x(l[c][I],_++)}};var m=function(x){var _=c*o.bucketSize+f,k=_+x,I=v*o.bucketSize+g;if(k<_||k>I)throw new Error("pos should more than 0 and less than queue's size");return{curNodeBucketIndex:Math.floor(k/o.bucketSize),curNodePointerIndex:k%o.bucketSize}};this.getElementByPos=function(x){var _=m(x),k=_.curNodeBucketIndex,I=_.curNodePointerIndex;return l[k][I]},this.eraseElementByPos=function(x){var _=this;if(x<0||x>p)throw new Error("pos should more than 0 and less than queue's size");if(x===0)this.popFront();else if(x===this.size())this.popBack();else{for(var k=[],I=x+1;I<p;++I)k.push(this.getElementByPos(I));this.cut(x),this.popBack(),k.forEach(function(P){return _.pushBack(P)})}},this.eraseElementByValue=function(x){if(!this.empty()){var _=[];this.forEach(function(P){P!==x&&_.push(P)});for(var k=_.length,I=0;I<k;++I)this.setElementByPos(I,_[I]);this.cut(k-1)}};var b=function(x){for(var _=[],k=x*o.sigma,I=Math.max(Math.ceil(k/o.bucketSize),2),P=0;P<I;++P)_.push(new Array(o.bucketSize));var M=Math.ceil(x/o.bucketSize),L=Math.floor(I/2)-Math.floor(M/2),U=L,$=0;if(this.size())for(P=0;P<M;++P){for(var S=0;S<o.bucketSize;++S)if(_[L+P][S]=this.front(),this.popFront(),this.empty()){U=L+P,$=S;break}if(this.empty())break}l=_,c=L,f=0,v=U,g=$,y=I,p=x};this.pushBack=function(x){this.empty()||(v===y-1&&g===o.bucketSize-1&&b.call(this,this.size()),g<o.bucketSize-1?++g:v<y-1&&(++v,g=0)),++p,l[v][g]=x},this.popBack=function(){this.empty()||(this.size()!==1&&(g>0?--g:c<v&&(--v,g=o.bucketSize-1)),p>0&&--p)},this.setElementByPos=function(x,_){var k=m(x),I=k.curNodeBucketIndex,P=k.curNodePointerIndex;l[I][P]=_},this.insert=function(x,_,k){var I=this;if(k===void 0&&(k=1),x===0)for(;k--;)this.pushFront(_);else if(x===this.size())for(;k--;)this.pushBack(_);else{for(var P=[],M=x;M<p;++M)P.push(this.getElementByPos(M));for(this.cut(x-1),M=0;M<k;++M)this.pushBack(_);P.forEach(function(L){return I.pushBack(L)})}},this.find=function(x){if(c===v){for(var _=f;_<=g;++_)if(l[c][_]===x)return!0;return!1}for(_=f;_<o.bucketSize;++_)if(l[c][_]===x)return!0;for(_=c+1;_<v;++_)for(var k=0;k<o.bucketSize;++k)if(l[_][k]===x)return!0;for(_=0;_<=g;++_)if(l[v][_]===x)return!0;return!1},this.reverse=function(){for(var x=0,_=p-1;x<_;){var k=this.getElementByPos(x);this.setElementByPos(x,this.getElementByPos(_)),this.setElementByPos(_,k),++x,--_}},this.unique=function(){if(!this.empty()){var x=[],_=this.front();this.forEach(function(I,P){P!==0&&I===_||(x.push(I),_=I)});for(var k=0;k<p;++k)this.setElementByPos(k,x[k]);this.cut(x.length-1)}},this.sort=function(x){var _=[];this.forEach(function(I){_.push(I)}),_.sort(x);for(var k=0;k<p;++k)this.setElementByPos(k,_[k])},this.pushFront=function(x){this.empty()||(c===0&&f===0&&b.call(this,this.size()),f>0?--f:c>0&&(--c,f=o.bucketSize-1)),++p,l[c][f]=x},this.popFront=function(){this.empty()||(this.size()!==1&&(f<o.bucketSize-1?++f:c<v&&(++c,f=0)),p>0&&--p)},this.shrinkToFit=function(){var x=this,_=[];this.forEach(function(M){_.push(M)});var k=_.length;l=[];for(var I=Math.ceil(k/o.bucketSize),P=0;P<I;++P)l.push(new Array(o.bucketSize));this.clear(),_.forEach(function(M){return x.pushBack(M)})},this.cut=function(x){if(x<0)this.clear();else{var _=m(x),k=_.curNodeBucketIndex,I=_.curNodePointerIndex;v=k,g=I,p=x+1}},this[Symbol.iterator]=function(){return function(){var x,_;return n(this,function(k){switch(k.label){case 0:if(p===0)return[2];if(c!==v)return[3,5];_=f,k.label=1;case 1:return _<=g?[4,l[c][_]]:[3,4];case 2:k.sent(),k.label=3;case 3:return++_,[3,1];case 4:return[2];case 5:_=f,k.label=6;case 6:return _<o.bucketSize?[4,l[c][_]]:[3,9];case 7:k.sent(),k.label=8;case 8:return++_,[3,6];case 9:_=c+1,k.label=10;case 10:if(!(_<v))return[3,15];x=0,k.label=11;case 11:return x<o.bucketSize?[4,l[_][x]]:[3,14];case 12:k.sent(),k.label=13;case 13:return++x,[3,11];case 14:return++_,[3,10];case 15:_=0,k.label=16;case 16:return _<=g?[4,l[v][_]]:[3,19];case 17:k.sent(),k.label=18;case 18:return++_,[3,16];case 19:return[2]}})}()},function(){var x=o.bucketSize;s.size?x=s.size():s.length&&(x=s.length);var _=x*o.sigma;y=Math.ceil(_/o.bucketSize),y=Math.max(y,3);for(var k=0;k<y;++k)l.push(new Array(o.bucketSize));var I=Math.ceil(x/o.bucketSize);c=Math.floor(y/2)-Math.floor(I/2),v=c,s.forEach(function(P){return h.pushBack(P)})}(),Object.freeze(this)}Object.defineProperty(r,"__esModule",{value:!0}),o.sigma=3,o.bucketSize=5e3,Object.freeze(o),r.default=o},{}],27:[function(i,a,r){var n=this&&this.__generator||function(c,f){var v,g,y,p,m={label:0,sent:function(){if(1&y[0])throw y[1];return y[1]},trys:[],ops:[]};return p={next:b(0),throw:b(1),return:b(2)},typeof Symbol=="function"&&(p[Symbol.iterator]=function(){return this}),p;function b(x){return function(_){return function(k){if(v)throw new TypeError("Generator is already executing.");for(;m;)try{if(v=1,g&&(y=2&k[0]?g.return:k[0]?g.throw||((y=g.return)&&y.call(g),0):g.next)&&!(y=y.call(g,k[1])).done)return y;switch(g=0,y&&(k=[2&k[0],y.value]),k[0]){case 0:case 1:y=k;break;case 4:return m.label++,{value:k[1],done:!1};case 5:m.label++,g=k[1],k=[0];continue;case 7:k=m.ops.pop(),m.trys.pop();continue;default:if(!(y=(y=m.trys).length>0&&y[y.length-1])&&(k[0]===6||k[0]===2)){m=0;continue}if(k[0]===3&&(!y||k[1]>y[0]&&k[1]<y[3])){m.label=k[1];break}if(k[0]===6&&m.label<y[1]){m.label=y[1],y=k;break}if(y&&m.label<y[2]){m.label=y[2],m.ops.push(k);break}y[2]&&m.ops.pop(),m.trys.pop();continue}k=f.call(c,m)}catch(I){k=[6,I],g=0}finally{v=y=0}if(5&k[0])throw k[1];return{value:k[0]?k[1]:void 0,done:!0}}([x,_])}}},o=this&&this.__values||function(c){var f=typeof Symbol=="function"&&Symbol.iterator,v=f&&c[f],g=0;if(v)return v.call(c);if(c&&typeof c.length=="number")return{next:function(){return c&&g>=c.length&&(c=void 0),{value:c&&c[g++],done:!c}}};throw new TypeError(f?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(r,"__esModule",{value:!0});var s=i("../LinkList/LinkList"),h=i("../Map/Map");function l(c,f,v){var g=this;if(c===void 0&&(c=[]),f===void 0&&(f=l.initSize),v=v||function(b){var x,_,k=0,I="";if(typeof b=="number")k=((k=Math.floor(b))<<5)-k,k&=k;else{I=typeof b!="string"?JSON.stringify(b):b;try{for(var P=o(I),M=P.next();!M.done;M=P.next())k=(k<<5)-k+M.value.charCodeAt(0),k&=k}catch(L){x={error:L}}finally{try{M&&!M.done&&(_=P.return)&&_.call(P)}finally{if(x)throw x.error}}}return k^=k>>>16},(f&f-1)!=0)throw new Error("initBucketNum must be 2 to the power of n");var y=0,p=[],m=Math.max(l.initSize,Math.min(l.maxSize,f));this.size=function(){return y},this.empty=function(){return y===0},this.clear=function(){y=0,m=f,p=[]},this.forEach=function(b){var x=0;p.forEach(function(_){_.forEach(function(k){b(k,x++)})})},this.setElement=function(b,x){var _,k;if(b==null)throw new Error("to avoid some unnecessary errors, we don't suggest you insert null or undefined here");if(x!=null){var I=v(b)&m-1;if(p[I]){var P=p[I].size();if(p[I]instanceof s.default){try{for(var M=o(p[I]),L=M.next();!L.done;L=M.next()){var U=L.value;if(U.key===b)return void(U.value=x)}}catch(S){_={error:S}}finally{try{L&&!L.done&&(k=M.return)&&k.call(M)}finally{if(_)throw _.error}}p[I].pushBack({key:b,value:x}),p[I].size()>=l.treeifyThreshold&&(p[I]=new h.default(p[I]))}else p[I].setElement(b,x);var $=p[I].size();y+=$-P}else++y,p[I]=new s.default([{key:b,value:x}]);y>m*l.sigma&&function(S){if(!(S>=l.maxSize)){m=2*S;var T=[];p.forEach(function(R,O){if(!R.empty()){if(R instanceof s.default&&R.size()===1){var K=R.front(),G=K.key,ae=K.value;T[v(G)&m-1]=new s.default([{key:G,value:ae}])}else if(R instanceof h.default){var V=new s.default,F=new s.default;R.forEach(function(W){(v(W.key)&S)==0?V.pushBack(W):F.pushBack(W)}),V.size()>l.untreeifyThreshold?T[O]=new h.default(V):V.size()&&(T[O]=V),F.size()>l.untreeifyThreshold?T[O+S]=new h.default(F):F.size()&&(T[O+S]=F)}else{var q=new s.default,Y=new s.default;R.forEach(function(W){(v(W.key)&S)==0?q.pushBack(W):Y.pushBack(W)}),q.size()&&(T[O]=q),Y.size()&&(T[O+S]=Y)}p[O].clear()}}),p=T}}.call(this,m)}else this.eraseElementByKey(b)},this.getElementByKey=function(b){var x,_,k=v(b)&m-1;if(p[k]){if(p[k]instanceof h.default)return p[k].getElementByKey(b);try{for(var I=o(p[k]),P=I.next();!P.done;P=I.next()){var M=P.value;if(M.key===b)return M.value}}catch(L){x={error:L}}finally{try{P&&!P.done&&(_=I.return)&&_.call(I)}finally{if(x)throw x.error}}}},this.eraseElementByKey=function(b){var x,_,k=v(b)&m-1;if(p[k]){var I=p[k].size();if(p[k]instanceof h.default)p[k].eraseElementByKey(b),p[k].size()<=l.untreeifyThreshold&&(p[k]=new s.default(p[k]));else{var P=-1;try{for(var M=o(p[k]),L=M.next();!L.done;L=M.next())if(++P,L.value.key===b){p[k].eraseElementByPos(P);break}}catch($){x={error:$}}finally{try{L&&!L.done&&(_=M.return)&&_.call(M)}finally{if(x)throw x.error}}}var U=p[k].size();y+=U-I}},this.find=function(b){var x,_,k=v(b)&m-1;if(!p[k])return!1;if(p[k]instanceof h.default)return p[k].find(b);try{for(var I=o(p[k]),P=I.next();!P.done;P=I.next())if(P.value.key===b)return!0}catch(M){x={error:M}}finally{try{P&&!P.done&&(_=I.return)&&_.call(I)}finally{if(x)throw x.error}}return!1},this[Symbol.iterator]=function(){return function(){var b,x,_,k,I,P;return n(this,function(M){switch(M.label){case 0:b=0,M.label=1;case 1:if(!(b<m))return[3,10];for(;b<m&&!p[b];)++b;if(b>=m)return[3,10];M.label=2;case 2:M.trys.push([2,7,8,9]),I=void 0,x=o(p[b]),_=x.next(),M.label=3;case 3:return _.done?[3,6]:[4,_.value];case 4:M.sent(),M.label=5;case 5:return _=x.next(),[3,3];case 6:return[3,9];case 7:return k=M.sent(),I={error:k},[3,9];case 8:try{_&&!_.done&&(P=x.return)&&P.call(x)}finally{if(I)throw I.error}return[7];case 9:return++b,[3,1];case 10:return[2]}})}()},c.forEach(function(b){var x=b.key,_=b.value;return g.setElement(x,_)}),Object.freeze(this)}l.initSize=16,l.maxSize=1<<30,l.sigma=.75,l.treeifyThreshold=8,l.untreeifyThreshold=6,l.minTreeifySize=64,Object.freeze(l),r.default=l},{"../LinkList/LinkList":29,"../Map/Map":30}],28:[function(i,a,r){var n=this&&this.__generator||function(c,f){var v,g,y,p,m={label:0,sent:function(){if(1&y[0])throw y[1];return y[1]},trys:[],ops:[]};return p={next:b(0),throw:b(1),return:b(2)},typeof Symbol=="function"&&(p[Symbol.iterator]=function(){return this}),p;function b(x){return function(_){return function(k){if(v)throw new TypeError("Generator is already executing.");for(;m;)try{if(v=1,g&&(y=2&k[0]?g.return:k[0]?g.throw||((y=g.return)&&y.call(g),0):g.next)&&!(y=y.call(g,k[1])).done)return y;switch(g=0,y&&(k=[2&k[0],y.value]),k[0]){case 0:case 1:y=k;break;case 4:return m.label++,{value:k[1],done:!1};case 5:m.label++,g=k[1],k=[0];continue;case 7:k=m.ops.pop(),m.trys.pop();continue;default:if(!(y=(y=m.trys).length>0&&y[y.length-1])&&(k[0]===6||k[0]===2)){m=0;continue}if(k[0]===3&&(!y||k[1]>y[0]&&k[1]<y[3])){m.label=k[1];break}if(k[0]===6&&m.label<y[1]){m.label=y[1],y=k;break}if(y&&m.label<y[2]){m.label=y[2],m.ops.push(k);break}y[2]&&m.ops.pop(),m.trys.pop();continue}k=f.call(c,m)}catch(I){k=[6,I],g=0}finally{v=y=0}if(5&k[0])throw k[1];return{value:k[0]?k[1]:void 0,done:!0}}([x,_])}}},o=this&&this.__values||function(c){var f=typeof Symbol=="function"&&Symbol.iterator,v=f&&c[f],g=0;if(v)return v.call(c);if(c&&typeof c.length=="number")return{next:function(){return c&&g>=c.length&&(c=void 0),{value:c&&c[g++],done:!c}}};throw new TypeError(f?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(r,"__esModule",{value:!0});var s=i("../Set/Set"),h=i("../LinkList/LinkList");function l(c,f,v){var g=this;if(c===void 0&&(c=[]),f===void 0&&(f=l.initSize),v=v||function(b){var x=0,_="";if(typeof b=="number")x=((x=Math.floor(b))<<5)-x,x&=x;else{_=typeof b!="string"?JSON.stringify(b):b;for(var k=0;k<_.length;k++)x=(x<<5)-x+_.charCodeAt(k),x&=x}return x^=x>>>16},(f&f-1)!=0)throw new Error("initBucketNum must be 2 to the power of n");var y=0,p=[],m=Math.max(l.initSize,Math.min(l.maxSize,f));this.size=function(){return y},this.empty=function(){return y===0},this.clear=function(){y=0,m=f,p=[]},this.forEach=function(b){var x=0;p.forEach(function(_){_.forEach(function(k){b(k,x++)})})},this.insert=function(b){if(b==null)throw new Error("to avoid some unnecessary errors, we don't suggest you insert null or undefined here");var x=v(b)&m-1;if(p[x]){var _=p[x].size();if(p[x]instanceof h.default){if(p[x].find(b))return;p[x].pushBack(b),p[x].size()>=l.treeifyThreshold&&(p[x]=new s.default(p[x]))}else p[x].insert(b);var k=p[x].size();y+=k-_}else p[x]=new h.default([b]),++y;y>m*l.sigma&&function(I){if(!(I>=l.maxSize)){m=2*I;var P=[];p.forEach(function(M,L){if(!M.empty()){if(M instanceof h.default&&M.size()===1){var U=M.front();if(U===void 0)throw new Error("unknown error");P[v(U)&m-1]=new h.default([U])}else if(M instanceof s.default){var $=new h.default,S=new h.default;M.forEach(function(O){(v(O)&I)==0?$.pushBack(O):S.pushBack(O)}),$.size()>l.untreeifyThreshold?P[L]=new s.default($):$.size()&&(P[L]=$),S.size()>l.untreeifyThreshold?P[L+I]=new s.default(S):S.size()&&(P[L+I]=S)}else{var T=new h.default,R=new h.default;M.forEach(function(O){(v(O)&I)==0?T.pushBack(O):R.pushBack(O)}),T.size()&&(P[L]=T),R.size()&&(P[L+I]=R)}p[L].clear()}}),p=P}}.call(this,m)},this.eraseElementByValue=function(b){var x=v(b)&m-1;if(p[x]){var _=p[x].size();p[x].eraseElementByValue(b),p[x]instanceof s.default&&p[x].size()<=l.untreeifyThreshold&&(p[x]=new h.default(p[x]));var k=p[x].size();y+=k-_}},this.find=function(b){var x=v(b)&m-1;return!!p[x]&&p[x].find(b)},this[Symbol.iterator]=function(){return function(){var b,x,_,k,I,P;return n(this,function(M){switch(M.label){case 0:b=0,M.label=1;case 1:if(!(b<m))return[3,10];for(;b<m&&!p[b];)++b;if(b>=m)return[3,10];M.label=2;case 2:M.trys.push([2,7,8,9]),I=void 0,x=o(p[b]),_=x.next(),M.label=3;case 3:return _.done?[3,6]:[4,_.value];case 4:M.sent(),M.label=5;case 5:return _=x.next(),[3,3];case 6:return[3,9];case 7:return k=M.sent(),I={error:k},[3,9];case 8:try{_&&!_.done&&(P=x.return)&&P.call(x)}finally{if(I)throw I.error}return[7];case 9:return++b,[3,1];case 10:return[2]}})}()},c.forEach(function(b){return g.insert(b)}),Object.freeze(this)}l.initSize=16,l.maxSize=1<<30,l.sigma=.75,l.treeifyThreshold=8,l.untreeifyThreshold=6,l.minTreeifySize=64,Object.freeze(l),r.default=l},{"../LinkList/LinkList":29,"../Set/Set":33}],29:[function(i,a,r){var n=this&&this.__generator||function(h,l){var c,f,v,g,y={label:0,sent:function(){if(1&v[0])throw v[1];return v[1]},trys:[],ops:[]};return g={next:p(0),throw:p(1),return:p(2)},typeof Symbol=="function"&&(g[Symbol.iterator]=function(){return this}),g;function p(m){return function(b){return function(x){if(c)throw new TypeError("Generator is already executing.");for(;y;)try{if(c=1,f&&(v=2&x[0]?f.return:x[0]?f.throw||((v=f.return)&&v.call(f),0):f.next)&&!(v=v.call(f,x[1])).done)return v;switch(f=0,v&&(x=[2&x[0],v.value]),x[0]){case 0:case 1:v=x;break;case 4:return y.label++,{value:x[1],done:!1};case 5:y.label++,f=x[1],x=[0];continue;case 7:x=y.ops.pop(),y.trys.pop();continue;default:if(!(v=(v=y.trys).length>0&&v[v.length-1])&&(x[0]===6||x[0]===2)){y=0;continue}if(x[0]===3&&(!v||x[1]>v[0]&&x[1]<v[3])){y.label=x[1];break}if(x[0]===6&&y.label<v[1]){y.label=v[1],v=x;break}if(v&&y.label<v[2]){y.label=v[2],y.ops.push(x);break}v[2]&&y.ops.pop(),y.trys.pop();continue}x=l.call(h,y)}catch(_){x=[6,_],f=0}finally{c=v=0}if(5&x[0])throw x[1];return{value:x[0]?x[1]:void 0,done:!0}}([m,b])}}};Object.defineProperty(r,"__esModule",{value:!0});var o=function(){return function(h){this.value=void 0,this.pre=void 0,this.next=void 0,this.value=h}}();function s(h){var l=this;h===void 0&&(h=[]);var c=0,f=void 0,v=void 0;this.size=function(){return c},this.empty=function(){return c===0},this.clear=function(){f=v=void 0,c=0},this.front=function(){return f==null?void 0:f.value},this.back=function(){return v==null?void 0:v.value},this.forEach=function(g){for(var y=f,p=0;y;){if(y.value===void 0)throw new Error("unknown error");g(y.value,p++),y=y.next}},this.getElementByPos=function(g){if(g<0||g>=c)throw new Error("pos must more then 0 and less then the list length");for(var y=f;g--&&y;)y=y.next;if(!y||y.value===void 0)throw new Error("unknown error");return y.value},this.eraseElementByPos=function(g){if(g<0||g>=c)throw new Error("erase pos must more then 0 and less then the list length");if(g===0)this.popFront();else if(g===c-1)this.popBack();else{for(var y=f;g--;){if(!(y!=null&&y.next))throw new Error("unknown error");y=y.next}if(!y||!y.pre||!y.next)throw new Error("unknown error");var p=y.pre,m=y.next;m.pre=p,p.next=m,c>0&&--c}},this.eraseElementByValue=function(g){for(;f&&f.value===g;)this.popFront();for(;v&&v.value===g;)this.popBack();if(f)for(var y=f;y;){if(y.value===g){var p=y.pre,m=y.next;m&&(m.pre=p),p&&(p.next=m),c>0&&--c}y=y.next}},this.pushBack=function(g){if(g==null)throw new Error("you can't push null or undefined here");++c;var y=new o(g);v?(v.next=y,y.pre=v,v=y):f=v=y},this.popBack=function(){v&&(c>0&&--c,v&&(f===v?f=v=void 0:(v=v.pre)&&(v.next=void 0)))},this.setElementByPos=function(g,y){if(y==null)throw new Error("you can't set null or undefined here");if(g<0||g>=c)throw new Error("pos must more then 0 and less then the list length");for(var p=f;g--;){if(!p)throw new Error("unknown error");p=p.next}p&&(p.value=y)},this.insert=function(g,y,p){if(p===void 0&&(p=1),y==null)throw new Error("you can't insert null or undefined here");if(g<0||g>c)throw new Error("insert pos must more then 0 and less then or equal to the list length");if(p<0)throw new Error("insert size must more than 0");if(g===0)for(;p--;)this.pushFront(y);else if(g===c)for(;p--;)this.pushBack(y);else{for(var m=f,b=1;b<g;++b){if(!(m!=null&&m.next))throw new Error("unknown error");m=m==null?void 0:m.next}if(!m)throw new Error("unknown error");var x=m.next;for(c+=p;p--;)m.next=new o(y),m.next.pre=m,m=m.next;m.next=x,x&&(x.pre=m)}},this.find=function(g){for(var y=f;y;){if(y.value===g)return!0;y=y.next}return!1},this.reverse=function(){for(var g=f,y=v,p=0;g&&y&&2*p<c;){var m=g.value;g.value=y.value,y.value=m,g=g.next,y=y.pre,++p}},this.unique=function(){for(var g=f;g;){for(var y=g;y&&y.next&&y.value===y.next.value;)y=y.next,c>0&&--c;g.next=y.next,g.next&&(g.next.pre=g),g=g.next}},this.sort=function(g){var y=[];this.forEach(function(m){y.push(m)}),y.sort(g);var p=f;y.forEach(function(m){p&&(p.value=m,p=p.next)})},this.pushFront=function(g){if(g==null)throw new Error("you can't push null or undefined here");++c;var y=new o(g);f?(y.next=f,f.pre=y,f=y):f=v=y},this.popFront=function(){f&&(c>0&&--c,f&&(f===v?f=v=void 0:(f=f.next)&&(f.pre=void 0)))},this.merge=function(g){var y=this,p=f;g.forEach(function(m){for(;p&&p.value!==void 0&&p.value<=m;)p=p.next;if(p===void 0)y.pushBack(m),p=v;else if(p===f)y.pushFront(m),p=f;else{++c;var b=p.pre;b&&(b.next=new o(m),b.next.pre=b,b.next.next=p,p&&(p.pre=b.next))}})},this[Symbol.iterator]=function(){return function(){var g;return n(this,function(y){switch(y.label){case 0:g=f,y.label=1;case 1:if(g===void 0)return[3,3];if(!g.value)throw new Error("unknown error");return[4,g.value];case 2:return y.sent(),g=g.next,[3,1];case 3:return[2]}})}()},h.forEach(function(g){return l.pushBack(g)}),Object.freeze(this)}Object.freeze(s),r.default=s},{}],30:[function(i,a,r){var n=this&&this.__generator||function(l,c){var f,v,g,y,p={label:0,sent:function(){if(1&g[0])throw g[1];return g[1]},trys:[],ops:[]};return y={next:m(0),throw:m(1),return:m(2)},typeof Symbol=="function"&&(y[Symbol.iterator]=function(){return this}),y;function m(b){return function(x){return function(_){if(f)throw new TypeError("Generator is already executing.");for(;p;)try{if(f=1,v&&(g=2&_[0]?v.return:_[0]?v.throw||((g=v.return)&&g.call(v),0):v.next)&&!(g=g.call(v,_[1])).done)return g;switch(v=0,g&&(_=[2&_[0],g.value]),_[0]){case 0:case 1:g=_;break;case 4:return p.label++,{value:_[1],done:!1};case 5:p.label++,v=_[1],_=[0];continue;case 7:_=p.ops.pop(),p.trys.pop();continue;default:if(!(g=(g=p.trys).length>0&&g[g.length-1])&&(_[0]===6||_[0]===2)){p=0;continue}if(_[0]===3&&(!g||_[1]>g[0]&&_[1]<g[3])){p.label=_[1];break}if(_[0]===6&&p.label<g[1]){p.label=g[1],g=_;break}if(g&&p.label<g[2]){p.label=g[2],p.ops.push(_);break}g[2]&&p.ops.pop(),p.trys.pop();continue}_=c.call(l,p)}catch(k){_=[6,k],v=0}finally{f=g=0}if(5&_[0])throw _[1];return{value:_[0]?_[1]:void 0,done:!0}}([b,x])}}},o=this&&this.__values||function(l){var c=typeof Symbol=="function"&&Symbol.iterator,f=c&&l[c],v=0;if(f)return f.call(l);if(l&&typeof l.length=="number")return{next:function(){return l&&v>=l.length&&(l=void 0),{value:l&&l[v++],done:!l}}};throw new TypeError(c?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(r,"__esModule",{value:!0});var s=i("../Base/TreeNode");function h(l,c){var f=this;l===void 0&&(l=[]),c=c||function(S,T){return S<T?-1:S>T?1:0};var v=0,g=new s.default;g.color=s.default.TreeNodeColorType.black,this.size=function(){return v},this.empty=function(){return v===0},this.clear=function(){v=0,g.key=g.value=void 0,g.leftChild=g.rightChild=g.brother=void 0};var y=function(S){if(!S||S.key===void 0)throw new Error("unknown error");return S.leftChild?y(S.leftChild):S},p=function(S){if(!S||S.key===void 0)throw new Error("unknown error");return S.rightChild?p(S.rightChild):S};this.front=function(){if(!this.empty()){var S=y(g);if(S.key===void 0||S.value===void 0)throw new Error("unknown error");return{key:S.key,value:S.value}}},this.back=function(){if(!this.empty()){var S=p(g);if(S.key===void 0||S.value===void 0)throw new Error("unknown error");return{key:S.key,value:S.value}}},this.forEach=function(S){var T,R,O=0;try{for(var K=o(this),G=K.next();!G.done;G=K.next())S(G.value,O++)}catch(ae){T={error:ae}}finally{try{G&&!G.done&&(R=K.return)&&R.call(K)}finally{if(T)throw T.error}}},this.getElementByPos=function(S){var T,R;if(S<0||S>=this.size())throw new Error("pos must more than 0 and less than set's size");var O=0;try{for(var K=o(this),G=K.next();!G.done;G=K.next()){var ae=G.value;if(O===S)return ae;++O}}catch(V){T={error:V}}finally{try{G&&!G.done&&(R=K.return)&&R.call(K)}finally{if(T)throw T.error}}throw new Error("unknown Error")};var m=function(S,T){if(S&&S.key!==void 0&&S.value!==void 0){var R=c(S.key,T);return R===0?{key:S.key,value:S.value}:R<0?m(S.rightChild,T):m(S.leftChild,T)||{key:S.key,value:S.value}}};this.lowerBound=function(S){return m(g,S)};var b=function(S,T){if(S&&S.key!==void 0&&S.value!==void 0)return c(S.key,T)<=0?b(S.rightChild,T):b(S.leftChild,T)||{key:S.key,value:S.value}};this.upperBound=function(S){return b(g,S)};var x=function(S,T){if(S&&S.key!==void 0&&S.value!==void 0){var R=c(S.key,T);return R===0?{key:S.key,value:S.value}:R>0?x(S.leftChild,T):x(S.rightChild,T)||{key:S.key,value:S.value}}};this.reverseLowerBound=function(S){return x(g,S)};var _=function(S,T){if(S&&S.key!==void 0&&S.value!==void 0)return c(S.key,T)>=0?_(S.leftChild,T):_(S.rightChild,T)||{key:S.key,value:S.value}};this.reverseUpperBound=function(S){return _(g,S)};var k=function(S){var T=S.parent;if(!T){if(S===g)return;throw new Error("unknown error")}if(S.color!==s.default.TreeNodeColorType.red){var R=S.brother;if(!R)throw new Error("unknown error");if(S===T.leftChild)if(R.color===s.default.TreeNodeColorType.red){R.color=s.default.TreeNodeColorType.black,T.color=s.default.TreeNodeColorType.red;var O=T.rotateLeft();g===T&&(g=O),k(S)}else R.color===s.default.TreeNodeColorType.black&&(R.rightChild&&R.rightChild.color===s.default.TreeNodeColorType.red?(R.color=T.color,T.color=s.default.TreeNodeColorType.black,R.rightChild&&(R.rightChild.color=s.default.TreeNodeColorType.black),O=T.rotateLeft(),g===T&&(g=O),S.color=s.default.TreeNodeColorType.black):R.rightChild&&R.rightChild.color!==s.default.TreeNodeColorType.black||!R.leftChild||R.leftChild.color!==s.default.TreeNodeColorType.red?R.leftChild&&R.leftChild.color!==s.default.TreeNodeColorType.black||R.rightChild&&R.rightChild.color!==s.default.TreeNodeColorType.black||(R.color=s.default.TreeNodeColorType.red,k(T)):(R.color=s.default.TreeNodeColorType.red,R.leftChild&&(R.leftChild.color=s.default.TreeNodeColorType.black),O=R.rotateRight(),g===R&&(g=O),k(S)));else S===T.rightChild&&(R.color===s.default.TreeNodeColorType.red?(R.color=s.default.TreeNodeColorType.black,T.color=s.default.TreeNodeColorType.red,O=T.rotateRight(),g===T&&(g=O),k(S)):R.color===s.default.TreeNodeColorType.black&&(R.leftChild&&R.leftChild.color===s.default.TreeNodeColorType.red?(R.color=T.color,T.color=s.default.TreeNodeColorType.black,R.leftChild&&(R.leftChild.color=s.default.TreeNodeColorType.black),O=T.rotateRight(),g===T&&(g=O),S.color=s.default.TreeNodeColorType.black):R.leftChild&&R.leftChild.color!==s.default.TreeNodeColorType.black||!R.rightChild||R.rightChild.color!==s.default.TreeNodeColorType.red?R.leftChild&&R.leftChild.color!==s.default.TreeNodeColorType.black||R.rightChild&&R.rightChild.color!==s.default.TreeNodeColorType.black||(R.color=s.default.TreeNodeColorType.red,k(T)):(R.color=s.default.TreeNodeColorType.red,R.rightChild&&(R.rightChild.color=s.default.TreeNodeColorType.black),O=R.rotateLeft(),g===R&&(g=O),k(S))))}else S.color=s.default.TreeNodeColorType.black},I=function(S){for(var T=S;T.leftChild||T.rightChild;){if(T.rightChild){T=y(T.rightChild);var R=S.key;S.key=T.key,T.key=R;var O=S.value;S.value=T.value,T.value=O,S=T}T.leftChild&&(T=p(T.leftChild),R=S.key,S.key=T.key,T.key=R,O=S.value,S.value=T.value,T.value=O,S=T)}k(T),T&&T.remove(),--v,g.color=s.default.TreeNodeColorType.black},P=function(S,T){return!(!S||S.key===void 0)&&(!!P(S.leftChild,T)||!!T(S)||P(S.rightChild,T))};this.eraseElementByPos=function(S){if(S<0||S>=v)throw new Error("pos must more than 0 and less than set's size");var T=0;P(g,function(R){return S===T?(I(R),!0):(++T,!1)})},this.eraseElementByKey=function(S){if(!this.empty()){var T=U(g,S);T!==void 0&&T.key!==void 0&&c(T.key,S)===0&&I(T)}};var M=function(S,T){if(!S||S.key===void 0)throw new Error("unknown error");var R=c(T,S.key);return R<0?S.leftChild?M(S.leftChild,T):(S.leftChild=new s.default,S.leftChild.parent=S,S.leftChild.brother=S.rightChild,S.rightChild&&(S.rightChild.brother=S.leftChild),S.leftChild):R>0?S.rightChild?M(S.rightChild,T):(S.rightChild=new s.default,S.rightChild.parent=S,S.rightChild.brother=S.leftChild,S.leftChild&&(S.leftChild.brother=S.rightChild),S.rightChild):S},L=function(S){var T=S.parent;if(!T){if(S===g)return;throw new Error("unknown error")}if(T.color!==s.default.TreeNodeColorType.black&&T.color===s.default.TreeNodeColorType.red){var R=T.brother,O=T.parent;if(!O)throw new Error("unknown error");if(R&&R.color===s.default.TreeNodeColorType.red)R.color=T.color=s.default.TreeNodeColorType.black,O.color=s.default.TreeNodeColorType.red,L(O);else if(!R||R.color===s.default.TreeNodeColorType.black)if(T===O.leftChild)if(S===T.leftChild){T.color=s.default.TreeNodeColorType.black,O.color=s.default.TreeNodeColorType.red;var K=O.rotateRight();O===g&&(g=K)}else S===T.rightChild&&(K=T.rotateLeft(),O===g&&(g=K),L(T));else T===O.rightChild&&(S===T.leftChild?(K=T.rotateRight(),O===g&&(g=K),L(T)):S===T.rightChild&&(T.color=s.default.TreeNodeColorType.black,O.color=s.default.TreeNodeColorType.red,K=O.rotateLeft(),O===g&&(g=K)))}};this.setElement=function(S,T){if(S==null)throw new Error("to avoid some unnecessary errors, we don't suggest you insert null or undefined here");if(T!=null){if(this.empty())return++v,g.key=S,g.value=T,void(g.color=s.default.TreeNodeColorType.black);var R=M(g,S);R.key===void 0||c(R.key,S)!==0?(++v,R.key=S,R.value=T,L(R),g.color=s.default.TreeNodeColorType.black):R.value=T}else this.eraseElementByKey(S)};var U=function(S,T){if(S&&S.key!==void 0){var R=c(T,S.key);return R<0?U(S.leftChild,T):R>0?U(S.rightChild,T):S}};this.find=function(S){return!!U(g,S)},this.getElementByKey=function(S){var T=U(g,S);if((T==null?void 0:T.key)===void 0||(T==null?void 0:T.value)===void 0)throw new Error("unknown error");return T.value},this.union=function(S){var T=this;S.forEach(function(R){var O=R.key,K=R.value;return T.setElement(O,K)})},this.getHeight=function(){if(this.empty())return 0;var S=function(T){return T?Math.max(S(T.leftChild),S(T.rightChild))+1:1};return S(g)};var $=function(S){return n(this,function(T){switch(T.label){case 0:return S&&S.key!==void 0&&S.value!==void 0?[5,o($(S.leftChild))]:[2];case 1:return T.sent(),[4,{key:S.key,value:S.value}];case 2:return T.sent(),[5,o($(S.rightChild))];case 3:return T.sent(),[2]}})};this[Symbol.iterator]=function(){return $(g)},l.forEach(function(S){var T=S.key,R=S.value;return f.setElement(T,R)}),Object.freeze(this)}Object.freeze(h),r.default=h},{"../Base/TreeNode":25}],31:[function(i,a,r){function n(o,s){o===void 0&&(o=[]),s=s||function(v,g){return v>g?-1:v<g?1:0};var h=[];o.forEach(function(v){return h.push(v)});var l=h.length,c=function(v,g){if(v<0||v>=l)throw new Error("unknown error");if(g<0||g>=l)throw new Error("unknown error");var y=h[v];h[v]=h[g],h[g]=y},f=function(v){if(v<0||v>=l)throw new Error("unknown error");var g=2*v+1,y=2*v+2;g<l&&s(h[v],h[g])>0&&c(v,g),y<l&&s(h[v],h[y])>0&&c(v,y)};(function(){for(var v=Math.floor((l-1)/2);v>=0;--v)for(var g=v,y=2*g+1;y<l;){var p=y+1,m=y;if(p<l&&s(h[y],h[p])>0&&(m=p),s(h[g],h[m])<=0)break;c(g,m),y=2*(g=m)+1}})(),this.size=function(){return l},this.empty=function(){return l===0},this.clear=function(){l=0,h.length=0},this.push=function(v){if(h.push(v),++l!==1)for(var g=l-1;g>0;){var y=Math.floor((g-1)/2);if(s(h[y],v)<=0)break;f(y),g=y}},this.pop=function(){if(!this.empty())if(this.size()!==1){var v=h[l-1];--l;for(var g=0;g<this.size();){var y=2*g+1,p=2*g+2;if(y>=this.size())break;var m=y;if(p<this.size()&&s(h[y],h[p])>0&&(m=p),s(h[m],v)>=0)break;h[g]=h[m],g=m}h[g]=v}else--l},this.top=function(){return h[0]},Object.freeze(this)}Object.defineProperty(r,"__esModule",{value:!0}),Object.freeze(n),r.default=n},{}],32:[function(i,a,r){Object.defineProperty(r,"__esModule",{value:!0});var n=i("../LinkList/LinkList");function o(s){s===void 0&&(s=[]);var h=new n.default(s);this.size=function(){return h.size()},this.empty=function(){return h.empty()},this.clear=function(){h.clear()},this.push=function(l){h.pushBack(l)},this.pop=function(){h.popFront()},this.front=function(){return h.front()},Object.freeze(this)}Object.freeze(o),r.default=o},{"../LinkList/LinkList":29}],33:[function(i,a,r){var n=this&&this.__generator||function(l,c){var f,v,g,y,p={label:0,sent:function(){if(1&g[0])throw g[1];return g[1]},trys:[],ops:[]};return y={next:m(0),throw:m(1),return:m(2)},typeof Symbol=="function"&&(y[Symbol.iterator]=function(){return this}),y;function m(b){return function(x){return function(_){if(f)throw new TypeError("Generator is already executing.");for(;p;)try{if(f=1,v&&(g=2&_[0]?v.return:_[0]?v.throw||((g=v.return)&&g.call(v),0):v.next)&&!(g=g.call(v,_[1])).done)return g;switch(v=0,g&&(_=[2&_[0],g.value]),_[0]){case 0:case 1:g=_;break;case 4:return p.label++,{value:_[1],done:!1};case 5:p.label++,v=_[1],_=[0];continue;case 7:_=p.ops.pop(),p.trys.pop();continue;default:if(!(g=(g=p.trys).length>0&&g[g.length-1])&&(_[0]===6||_[0]===2)){p=0;continue}if(_[0]===3&&(!g||_[1]>g[0]&&_[1]<g[3])){p.label=_[1];break}if(_[0]===6&&p.label<g[1]){p.label=g[1],g=_;break}if(g&&p.label<g[2]){p.label=g[2],p.ops.push(_);break}g[2]&&p.ops.pop(),p.trys.pop();continue}_=c.call(l,p)}catch(k){_=[6,k],v=0}finally{f=g=0}if(5&_[0])throw _[1];return{value:_[0]?_[1]:void 0,done:!0}}([b,x])}}},o=this&&this.__values||function(l){var c=typeof Symbol=="function"&&Symbol.iterator,f=c&&l[c],v=0;if(f)return f.call(l);if(l&&typeof l.length=="number")return{next:function(){return l&&v>=l.length&&(l=void 0),{value:l&&l[v++],done:!l}}};throw new TypeError(c?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(r,"__esModule",{value:!0});var s=i("../Base/TreeNode");function h(l,c){var f=this;l===void 0&&(l=[]),c=c||function(S,T){return S<T?-1:S>T?1:0};var v=0,g=new s.default;g.color=s.default.TreeNodeColorType.black,this.size=function(){return v},this.empty=function(){return v===0},this.clear=function(){v=0,g.key=void 0,g.leftChild=g.rightChild=g.brother=g.parent=void 0,g.color=s.default.TreeNodeColorType.black};var y=function(S){if(!S||S.key===void 0)throw new Error("unknown error");return S.leftChild?y(S.leftChild):S},p=function(S){if(!S||S.key===void 0)throw new Error("unknown error");return S.rightChild?p(S.rightChild):S};this.front=function(){if(!this.empty())return y(g).key},this.back=function(){if(!this.empty())return p(g).key},this.forEach=function(S){var T,R,O=0;try{for(var K=o(this),G=K.next();!G.done;G=K.next())S(G.value,O++)}catch(ae){T={error:ae}}finally{try{G&&!G.done&&(R=K.return)&&R.call(K)}finally{if(T)throw T.error}}},this.getElementByPos=function(S){var T,R;if(S<0||S>=this.size())throw new Error("pos must more than 0 and less than set's size");var O=0;try{for(var K=o(this),G=K.next();!G.done;G=K.next()){var ae=G.value;if(O===S)return ae;++O}}catch(V){T={error:V}}finally{try{G&&!G.done&&(R=K.return)&&R.call(K)}finally{if(T)throw T.error}}throw new Error("unknown error")};var m=function(S){var T=S.parent;if(!T){if(S===g)return;throw new Error("unknown error")}if(S.color!==s.default.TreeNodeColorType.red){var R=S.brother;if(!R)throw new Error("unknown error");if(S===T.leftChild)if(R.color===s.default.TreeNodeColorType.red){R.color=s.default.TreeNodeColorType.black,T.color=s.default.TreeNodeColorType.red;var O=T.rotateLeft();g===T&&(g=O),m(S)}else R.color===s.default.TreeNodeColorType.black&&(R.rightChild&&R.rightChild.color===s.default.TreeNodeColorType.red?(R.color=T.color,T.color=s.default.TreeNodeColorType.black,R.rightChild&&(R.rightChild.color=s.default.TreeNodeColorType.black),O=T.rotateLeft(),g===T&&(g=O),S.color=s.default.TreeNodeColorType.black):R.rightChild&&R.rightChild.color!==s.default.TreeNodeColorType.black||!R.leftChild||R.leftChild.color!==s.default.TreeNodeColorType.red?R.leftChild&&R.leftChild.color!==s.default.TreeNodeColorType.black||R.rightChild&&R.rightChild.color!==s.default.TreeNodeColorType.black||(R.color=s.default.TreeNodeColorType.red,m(T)):(R.color=s.default.TreeNodeColorType.red,R.leftChild&&(R.leftChild.color=s.default.TreeNodeColorType.black),O=R.rotateRight(),g===R&&(g=O),m(S)));else S===T.rightChild&&(R.color===s.default.TreeNodeColorType.red?(R.color=s.default.TreeNodeColorType.black,T.color=s.default.TreeNodeColorType.red,O=T.rotateRight(),g===T&&(g=O),m(S)):R.color===s.default.TreeNodeColorType.black&&(R.leftChild&&R.leftChild.color===s.default.TreeNodeColorType.red?(R.color=T.color,T.color=s.default.TreeNodeColorType.black,R.leftChild&&(R.leftChild.color=s.default.TreeNodeColorType.black),O=T.rotateRight(),g===T&&(g=O),S.color=s.default.TreeNodeColorType.black):R.leftChild&&R.leftChild.color!==s.default.TreeNodeColorType.black||!R.rightChild||R.rightChild.color!==s.default.TreeNodeColorType.red?R.leftChild&&R.leftChild.color!==s.default.TreeNodeColorType.black||R.rightChild&&R.rightChild.color!==s.default.TreeNodeColorType.black||(R.color=s.default.TreeNodeColorType.red,m(T)):(R.color=s.default.TreeNodeColorType.red,R.rightChild&&(R.rightChild.color=s.default.TreeNodeColorType.black),O=R.rotateLeft(),g===R&&(g=O),m(S))))}else S.color=s.default.TreeNodeColorType.black},b=function(S){for(var T=S;T.leftChild||T.rightChild;){if(T.rightChild){T=y(T.rightChild);var R=S.key;S.key=T.key,T.key=R,S=T}T.leftChild&&(T=p(T.leftChild),R=S.key,S.key=T.key,T.key=R,S=T)}m(T),T&&T.remove(),--v,g.color=s.default.TreeNodeColorType.black},x=function(S,T){return!(!S||S.key===void 0)&&(!!x(S.leftChild,T)||!!T(S)||x(S.rightChild,T))};this.eraseElementByPos=function(S){if(S<0||S>=v)throw new Error("pos must more than 0 and less than set's size");var T=0;x(g,function(R){return S===T?(b(R),!0):(++T,!1)})},this.eraseElementByValue=function(S){if(!this.empty()){var T=I(g,S);T!==void 0&&T.key!==void 0&&c(T.key,S)===0&&b(T)}};var _=function(S,T){if(!S||S.key===void 0)throw new Error("unknown error");var R=c(T,S.key);return R<0?S.leftChild?_(S.leftChild,T):(S.leftChild=new s.default,S.leftChild.parent=S,S.leftChild.brother=S.rightChild,S.rightChild&&(S.rightChild.brother=S.leftChild),S.leftChild):R>0?S.rightChild?_(S.rightChild,T):(S.rightChild=new s.default,S.rightChild.parent=S,S.rightChild.brother=S.leftChild,S.leftChild&&(S.leftChild.brother=S.rightChild),S.rightChild):S},k=function(S){var T=S.parent;if(!T){if(S===g)return;throw new Error("unknown error")}if(T.color!==s.default.TreeNodeColorType.black&&T.color===s.default.TreeNodeColorType.red){var R=T.brother,O=T.parent;if(!O)throw new Error("unknown error");if(R&&R.color===s.default.TreeNodeColorType.red)R.color=T.color=s.default.TreeNodeColorType.black,O.color=s.default.TreeNodeColorType.red,k(O);else if(!R||R.color===s.default.TreeNodeColorType.black)if(T===O.leftChild)if(S===T.leftChild){T.color=s.default.TreeNodeColorType.black,O.color=s.default.TreeNodeColorType.red;var K=O.rotateRight();O===g&&(g=K)}else S===T.rightChild&&(K=T.rotateLeft(),O===g&&(g=K),k(T));else T===O.rightChild&&(S===T.leftChild?(K=T.rotateRight(),O===g&&(g=K),k(T)):S===T.rightChild&&(T.color=s.default.TreeNodeColorType.black,O.color=s.default.TreeNodeColorType.red,K=O.rotateLeft(),O===g&&(g=K)))}};this.insert=function(S){if(S==null)throw new Error("to avoid some unnecessary errors, we don't suggest you insert null or undefined here");if(this.empty())return++v,g.key=S,void(g.color=s.default.TreeNodeColorType.black);var T=_(g,S);T.key!==void 0&&c(T.key,S)===0||(++v,T.key=S,k(T),g.color=s.default.TreeNodeColorType.black)};var I=function(S,T){if(S&&S.key!==void 0){var R=c(T,S.key);return R<0?I(S.leftChild,T):R>0?I(S.rightChild,T):S}};this.find=function(S){var T=I(g,S);return T!==void 0&&T.key!==void 0&&c(T.key,S)===0};var P=function(S,T){if(S&&S.key!==void 0){var R=c(S.key,T);if(R===0)return S.key;if(R<0)return P(S.rightChild,T);var O=P(S.leftChild,T);return O!==void 0?O:S.key}};this.lowerBound=function(S){return P(g,S)};var M=function(S,T){if(S&&S.key!==void 0){if(c(S.key,T)<=0)return M(S.rightChild,T);var R=M(S.leftChild,T);return R!==void 0?R:S.key}};this.upperBound=function(S){return M(g,S)};var L=function(S,T){if(S&&S.key!==void 0){var R=c(S.key,T);if(R===0)return S.key;if(R>0)return L(S.leftChild,T);var O=L(S.rightChild,T);return O!==void 0?O:S.key}};this.reverseLowerBound=function(S){return L(g,S)};var U=function(S,T){if(S&&S.key!==void 0){if(c(S.key,T)>=0)return U(S.leftChild,T);var R=U(S.rightChild,T);return R!==void 0?R:S.key}};this.reverseUpperBound=function(S){return U(g,S)},this.union=function(S){var T=this;S.forEach(function(R){return T.insert(R)})},this.getHeight=function(){if(this.empty())return 0;var S=function(T){return T?Math.max(S(T.leftChild),S(T.rightChild))+1:1};return S(g)};var $=function(S){return n(this,function(T){switch(T.label){case 0:return S&&S.key!==void 0?[5,o($(S.leftChild))]:[2];case 1:return T.sent(),[4,S.key];case 2:return T.sent(),[5,o($(S.rightChild))];case 3:return T.sent(),[2]}})};this[Symbol.iterator]=function(){return $(g)},l.forEach(function(S){return f.insert(S)}),Object.freeze(this)}Object.freeze(h),r.default=h},{"../Base/TreeNode":25}],34:[function(i,a,r){function n(o){var s=this;o===void 0&&(o=[]);var h=0,l=[];this.size=function(){return h},this.empty=function(){return h===0},this.clear=function(){h=0,l.length=0},this.push=function(c){l.push(c),++h},this.pop=function(){l.pop(),h>0&&--h},this.top=function(){return l[h-1]},o.forEach(function(c){return s.push(c)}),Object.freeze(this)}Object.defineProperty(r,"__esModule",{value:!0}),Object.freeze(n),r.default=n},{}],35:[function(i,a,r){var n=this&&this.__generator||function(c,f){var v,g,y,p,m={label:0,sent:function(){if(1&y[0])throw y[1];return y[1]},trys:[],ops:[]};return p={next:b(0),throw:b(1),return:b(2)},typeof Symbol=="function"&&(p[Symbol.iterator]=function(){return this}),p;function b(x){return function(_){return function(k){if(v)throw new TypeError("Generator is already executing.");for(;m;)try{if(v=1,g&&(y=2&k[0]?g.return:k[0]?g.throw||((y=g.return)&&y.call(g),0):g.next)&&!(y=y.call(g,k[1])).done)return y;switch(g=0,y&&(k=[2&k[0],y.value]),k[0]){case 0:case 1:y=k;break;case 4:return m.label++,{value:k[1],done:!1};case 5:m.label++,g=k[1],k=[0];continue;case 7:k=m.ops.pop(),m.trys.pop();continue;default:if(!(y=(y=m.trys).length>0&&y[y.length-1])&&(k[0]===6||k[0]===2)){m=0;continue}if(k[0]===3&&(!y||k[1]>y[0]&&k[1]<y[3])){m.label=k[1];break}if(k[0]===6&&m.label<y[1]){m.label=y[1],y=k;break}if(y&&m.label<y[2]){m.label=y[2],m.ops.push(k);break}y[2]&&m.ops.pop(),m.trys.pop();continue}k=f.call(c,m)}catch(I){k=[6,I],g=0}finally{v=y=0}if(5&k[0])throw k[1];return{value:k[0]?k[1]:void 0,done:!0}}([x,_])}}},o=this&&this.__read||function(c,f){var v=typeof Symbol=="function"&&c[Symbol.iterator];if(!v)return c;var g,y,p=v.call(c),m=[];try{for(;(f===void 0||f-- >0)&&!(g=p.next()).done;)m.push(g.value)}catch(b){y={error:b}}finally{try{g&&!g.done&&(v=p.return)&&v.call(p)}finally{if(y)throw y.error}}return m},s=this&&this.__spreadArray||function(c,f,v){if(v||arguments.length===2)for(var g,y=0,p=f.length;y<p;y++)!g&&y in f||(g||(g=Array.prototype.slice.call(f,0,y)),g[y]=f[y]);return c.concat(g||Array.prototype.slice.call(f))},h=this&&this.__values||function(c){var f=typeof Symbol=="function"&&Symbol.iterator,v=f&&c[f],g=0;if(v)return v.call(c);if(c&&typeof c.length=="number")return{next:function(){return c&&g>=c.length&&(c=void 0),{value:c&&c[g++],done:!c}}};throw new TypeError(f?"Object is not iterable.":"Symbol.iterator is not defined.")};function l(c){var f=this;c===void 0&&(c=[]);var v=0,g=[];this.size=function(){return v},this.empty=function(){return v===0},this.clear=function(){v=0,g.length=0},this.front=function(){if(!this.empty())return g[0]},this.back=function(){if(!this.empty())return g[v-1]},this.forEach=function(y){g.forEach(y)},this.getElementByPos=function(y){if(y<0||y>=v)throw new Error("pos must more than 0 and less than vector's size");return g[y]},this.eraseElementByPos=function(y){if(y<0||y>=v)throw new Error("pos must more than 0 and less than vector's size");for(var p=y;p<v-1;++p)g[p]=g[p+1];this.popBack()},this.eraseElementByValue=function(y){var p=[];this.forEach(function(b){b!==y&&p.push(b)}),p.forEach(function(b,x){g[x]=b});for(var m=p.length;v>m;)this.popBack()},this.pushBack=function(y){g.push(y),++v},this.popBack=function(){g.pop(),v>0&&--v},this.setElementByPos=function(y,p){if(y<0||y>=v)throw new Error("pos must more than 0 and less than vector's size");g[y]=p},this.insert=function(y,p,m){if(m===void 0&&(m=1),y<0||y>v)throw new Error("pos must more than 0 and less than or equal to vector's size");g.splice.apply(g,s([y,0],o(new Array(m).fill(p)),!1)),v+=m},this.find=function(y){return g.includes(y)},this.reverse=function(){g.reverse()},this.unique=function(){var y,p=[];this.forEach(function(b,x){x!==0&&b===y||(p.push(b),y=b)}),p.forEach(function(b,x){g[x]=b});for(var m=p.length;v>m;)this.popBack()},this.sort=function(y){g.sort(y)},this[Symbol.iterator]=function(){return function(){return n(this,function(y){switch(y.label){case 0:return[5,h(g)];case 1:return[2,y.sent()]}})}()},c.forEach(function(y){return f.pushBack(y)}),Object.freeze(this)}Object.defineProperty(r,"__esModule",{value:!0}),Object.freeze(l),r.default=l},{}],36:[function(i,a,r){Object.defineProperty(r,"__esModule",{value:!0}),r.HashMap=r.HashSet=r.Map=r.Set=r.PriorityQueue=r.Deque=r.LinkList=r.Queue=r.Stack=r.Vector=void 0;var n=i("./Vector/Vector");r.Vector=n.default;var o=i("./Stack/Stack");r.Stack=o.default;var s=i("./Queue/Queue");r.Queue=s.default;var h=i("./LinkList/LinkList");r.LinkList=h.default;var l=i("./Deque/Deque");r.Deque=l.default;var c=i("./PriorityQueue/PriorityQueue");r.PriorityQueue=c.default;var f=i("./Set/Set");r.Set=f.default;var v=i("./Map/Map");r.Map=v.default;var g=i("./HashSet/HashSet");r.HashSet=g.default;var y=i("./HashMap/HashMap");r.HashMap=y.default},{"./Deque/Deque":26,"./HashMap/HashMap":27,"./HashSet/HashSet":28,"./LinkList/LinkList":29,"./Map/Map":30,"./PriorityQueue/PriorityQueue":31,"./Queue/Queue":32,"./Set/Set":33,"./Stack/Stack":34,"./Vector/Vector":35}],37:[function(i,a,r){const n=i("yallist"),o=Symbol("max"),s=Symbol("length"),h=Symbol("lengthCalculator"),l=Symbol("allowStale"),c=Symbol("maxAge"),f=Symbol("dispose"),v=Symbol("noDisposeOnSet"),g=Symbol("lruList"),y=Symbol("cache"),p=Symbol("updateAgeOnGet"),m=()=>1,b=(M,L,U)=>{const $=M[y].get(L);if($){const S=$.value;if(x(M,S)){if(k(M,$),!M[l])return}else U&&(M[p]&&($.value.now=Date.now()),M[g].unshiftNode($));return S.value}},x=(M,L)=>{if(!L||!L.maxAge&&!M[c])return!1;const U=Date.now()-L.now;return L.maxAge?U>L.maxAge:M[c]&&U>M[c]},_=M=>{if(M[s]>M[o])for(let L=M[g].tail;M[s]>M[o]&&L!==null;){const U=L.prev;k(M,L),L=U}},k=(M,L)=>{if(L){const U=L.value;M[f]&&M[f](U.key,U.value),M[s]-=U.length,M[y].delete(U.key),M[g].removeNode(L)}};class I{constructor(L,U,$,S,T){this.key=L,this.value=U,this.length=$,this.now=S,this.maxAge=T||0}}const P=(M,L,U,$)=>{let S=U.value;x(M,S)&&(k(M,U),M[l]||(S=void 0)),S&&L.call($,S.value,S.key,M)};a.exports=class{constructor(M){if(typeof M=="number"&&(M={max:M}),M||(M={}),M.max&&(typeof M.max!="number"||M.max<0))throw new TypeError("max must be a non-negative number");this[o]=M.max||1/0;const L=M.length||m;if(this[h]=typeof L!="function"?m:L,this[l]=M.stale||!1,M.maxAge&&typeof M.maxAge!="number")throw new TypeError("maxAge must be a number");this[c]=M.maxAge||0,this[f]=M.dispose,this[v]=M.noDisposeOnSet||!1,this[p]=M.updateAgeOnGet||!1,this.reset()}set max(M){if(typeof M!="number"||M<0)throw new TypeError("max must be a non-negative number");this[o]=M||1/0,_(this)}get max(){return this[o]}set allowStale(M){this[l]=!!M}get allowStale(){return this[l]}set maxAge(M){if(typeof M!="number")throw new TypeError("maxAge must be a non-negative number");this[c]=M,_(this)}get maxAge(){return this[c]}set lengthCalculator(M){typeof M!="function"&&(M=m),M!==this[h]&&(this[h]=M,this[s]=0,this[g].forEach(L=>{L.length=this[h](L.value,L.key),this[s]+=L.length})),_(this)}get lengthCalculator(){return this[h]}get length(){return this[s]}get itemCount(){return this[g].length}rforEach(M,L){L=L||this;for(let U=this[g].tail;U!==null;){const $=U.prev;P(this,M,U,L),U=$}}forEach(M,L){L=L||this;for(let U=this[g].head;U!==null;){const $=U.next;P(this,M,U,L),U=$}}keys(){return this[g].toArray().map(M=>M.key)}values(){return this[g].toArray().map(M=>M.value)}reset(){this[f]&&this[g]&&this[g].length&&this[g].forEach(M=>this[f](M.key,M.value)),this[y]=new Map,this[g]=new n,this[s]=0}dump(){return this[g].map(M=>!x(this,M)&&{k:M.key,v:M.value,e:M.now+(M.maxAge||0)}).toArray().filter(M=>M)}dumpLru(){return this[g]}set(M,L,U){if((U=U||this[c])&&typeof U!="number")throw new TypeError("maxAge must be a number");const $=U?Date.now():0,S=this[h](L,M);if(this[y].has(M)){if(S>this[o])return k(this,this[y].get(M)),!1;const R=this[y].get(M).value;return this[f]&&(this[v]||this[f](M,R.value)),R.now=$,R.maxAge=U,R.value=L,this[s]+=S-R.length,R.length=S,this.get(M),_(this),!0}const T=new I(M,L,S,$,U);return T.length>this[o]?(this[f]&&this[f](M,L),!1):(this[s]+=T.length,this[g].unshift(T),this[y].set(M,this[g].head),_(this),!0)}has(M){if(!this[y].has(M))return!1;const L=this[y].get(M).value;return!x(this,L)}get(M){return b(this,M,!0)}peek(M){return b(this,M,!1)}pop(){const M=this[g].tail;return M?(k(this,M),M.value):null}del(M){k(this,this[y].get(M))}load(M){this.reset();const L=Date.now();for(let U=M.length-1;U>=0;U--){const $=M[U],S=$.e||0;if(S===0)this.set($.k,$.v);else{const T=S-L;T>0&&this.set($.k,$.v,T)}}}prune(){this[y].forEach((M,L)=>b(this,L,!1))}}},{yallist:83}],38:[function(i,a,r){(function(n){(function(){const o=a.exports;o.types={0:"reserved",1:"connect",2:"connack",3:"publish",4:"puback",5:"pubrec",6:"pubrel",7:"pubcomp",8:"subscribe",9:"suback",10:"unsubscribe",11:"unsuback",12:"pingreq",13:"pingresp",14:"disconnect",15:"auth"},o.codes={};for(const h in o.types){const l=o.types[h];o.codes[l]=h}o.CMD_SHIFT=4,o.CMD_MASK=240,o.DUP_MASK=8,o.QOS_MASK=3,o.QOS_SHIFT=1,o.RETAIN_MASK=1,o.VARBYTEINT_MASK=127,o.VARBYTEINT_FIN_MASK=128,o.VARBYTEINT_MAX=268435455,o.SESSIONPRESENT_MASK=1,o.SESSIONPRESENT_HEADER=n.from([o.SESSIONPRESENT_MASK]),o.CONNACK_HEADER=n.from([o.codes.connack<<o.CMD_SHIFT]),o.USERNAME_MASK=128,o.PASSWORD_MASK=64,o.WILL_RETAIN_MASK=32,o.WILL_QOS_MASK=24,o.WILL_QOS_SHIFT=3,o.WILL_FLAG_MASK=4,o.CLEAN_SESSION_MASK=2,o.CONNECT_HEADER=n.from([o.codes.connect<<o.CMD_SHIFT]),o.properties={sessionExpiryInterval:17,willDelayInterval:24,receiveMaximum:33,maximumPacketSize:39,topicAliasMaximum:34,requestResponseInformation:25,requestProblemInformation:23,userProperties:38,authenticationMethod:21,authenticationData:22,payloadFormatIndicator:1,messageExpiryInterval:2,contentType:3,responseTopic:8,correlationData:9,maximumQoS:36,retainAvailable:37,assignedClientIdentifier:18,reasonString:31,wildcardSubscriptionAvailable:40,subscriptionIdentifiersAvailable:41,sharedSubscriptionAvailable:42,serverKeepAlive:19,responseInformation:26,serverReference:28,topicAlias:35,subscriptionIdentifier:11},o.propertiesCodes={};for(const h in o.properties){const l=o.properties[h];o.propertiesCodes[l]=h}function s(h){return[0,1,2].map(l=>[0,1].map(c=>[0,1].map(f=>{const v=n.alloc(1);return v.writeUInt8(o.codes[h]<<o.CMD_SHIFT|(c?o.DUP_MASK:0)|l<<o.QOS_SHIFT|f,0,!0),v})))}o.propertiesTypes={sessionExpiryInterval:"int32",willDelayInterval:"int32",receiveMaximum:"int16",maximumPacketSize:"int32",topicAliasMaximum:"int16",requestResponseInformation:"byte",requestProblemInformation:"byte",userProperties:"pair",authenticationMethod:"string",authenticationData:"binary",payloadFormatIndicator:"byte",messageExpiryInterval:"int32",contentType:"string",responseTopic:"string",correlationData:"binary",maximumQoS:"int8",retainAvailable:"byte",assignedClientIdentifier:"string",reasonString:"string",wildcardSubscriptionAvailable:"byte",subscriptionIdentifiersAvailable:"byte",sharedSubscriptionAvailable:"byte",serverKeepAlive:"int16",responseInformation:"string",serverReference:"string",topicAlias:"int16",subscriptionIdentifier:"var"},o.PUBLISH_HEADER=s("publish"),o.SUBSCRIBE_HEADER=s("subscribe"),o.SUBSCRIBE_OPTIONS_QOS_MASK=3,o.SUBSCRIBE_OPTIONS_NL_MASK=1,o.SUBSCRIBE_OPTIONS_NL_SHIFT=2,o.SUBSCRIBE_OPTIONS_RAP_MASK=1,o.SUBSCRIBE_OPTIONS_RAP_SHIFT=3,o.SUBSCRIBE_OPTIONS_RH_MASK=3,o.SUBSCRIBE_OPTIONS_RH_SHIFT=4,o.SUBSCRIBE_OPTIONS_RH=[0,16,32],o.SUBSCRIBE_OPTIONS_NL=4,o.SUBSCRIBE_OPTIONS_RAP=8,o.SUBSCRIBE_OPTIONS_QOS=[0,1,2],o.UNSUBSCRIBE_HEADER=s("unsubscribe"),o.ACKS={unsuback:s("unsuback"),puback:s("puback"),pubcomp:s("pubcomp"),pubrel:s("pubrel"),pubrec:s("pubrec")},o.SUBACK_HEADER=n.from([o.codes.suback<<o.CMD_SHIFT]),o.VERSION3=n.from([3]),o.VERSION4=n.from([4]),o.VERSION5=n.from([5]),o.VERSION131=n.from([131]),o.VERSION132=n.from([132]),o.QOS=[0,1,2].map(h=>n.from([h])),o.EMPTY={pingreq:n.from([o.codes.pingreq<<4,0]),pingresp:n.from([o.codes.pingresp<<4,0]),disconnect:n.from([o.codes.disconnect<<4,0])}}).call(this)}).call(this,i("buffer").Buffer)},{buffer:17}],39:[function(i,a,r){(function(n){(function(){const o=i("./writeToStream"),s=i("events");class h extends s{constructor(){super(),this._array=new Array(20),this._i=0}write(c){return this._array[this._i++]=c,!0}concat(){let c=0;const f=new Array(this._array.length),v=this._array;let g,y=0;for(g=0;g<v.length&&v[g]!==void 0;g++)typeof v[g]!="string"?f[g]=v[g].length:f[g]=n.byteLength(v[g]),c+=f[g];const p=n.allocUnsafe(c);for(g=0;g<v.length&&v[g]!==void 0;g++)typeof v[g]!="string"?(v[g].copy(p,y),y+=f[g]):(p.write(v[g],y),y+=f[g]);return p}}a.exports=function(l,c){const f=new h;return o(l,f,c),f.concat()}}).call(this)}).call(this,i("buffer").Buffer)},{"./writeToStream":44,buffer:17,events:22}],40:[function(i,a,r){r.parser=i("./parser").parser,r.generate=i("./generate"),r.writeToStream=i("./writeToStream")},{"./generate":39,"./parser":43,"./writeToStream":44}],41:[function(i,a,r){(function(n){(function(){const s={},h=n.isBuffer(n.from([1,2]).subarray(0,1));function l(c){const f=n.allocUnsafe(2);return f.writeUInt8(c>>8,0),f.writeUInt8(255&c,1),f}a.exports={cache:s,generateCache:function(){for(let c=0;c<65536;c++)s[c]=l(c)},generateNumber:l,genBufVariableByteInt:function(c){let f=0,v=0;const g=n.allocUnsafe(4);do f=c%128|0,(c=c/128|0)>0&&(f|=128),g.writeUInt8(f,v++);while(c>0&&v<4);return c>0&&(v=0),h?g.subarray(0,v):g.slice(0,v)},generate4ByteBuffer:function(c){const f=n.allocUnsafe(4);return f.writeUInt32BE(c,0),f}}}).call(this)}).call(this,i("buffer").Buffer)},{buffer:17}],42:[function(i,a,r){a.exports=class{constructor(){this.cmd=null,this.retain=!1,this.qos=0,this.dup=!1,this.length=-1,this.topic=null,this.payload=null}}},{}],43:[function(i,a,r){const n=i("bl"),o=i("events"),s=i("./packet"),h=i("./constants"),l=i("debug")("mqtt-packet:parser");class c extends o{constructor(){super(),this.parser=this.constructor.parser}static parser(v){return this instanceof c?(this.settings=v||{},this._states=["_parseHeader","_parseLength","_parsePayload","_newPacket"],this._resetState(),this):new c().parser(v)}_resetState(){l("_resetState: resetting packet, error, _list, and _stateCounter"),this.packet=new s,this.error=null,this._list=n(),this._stateCounter=0}parse(v){for(this.error&&this._resetState(),this._list.append(v),l("parse: current state: %s",this._states[this._stateCounter]);(this.packet.length!==-1||this._list.length>0)&&this[this._states[this._stateCounter]]()&&!this.error;)this._stateCounter++,l("parse: state complete. _stateCounter is now: %d",this._stateCounter),l("parse: packet.length: %d, buffer list length: %d",this.packet.length,this._list.length),this._stateCounter>=this._states.length&&(this._stateCounter=0);return l("parse: exited while loop. packet: %d, buffer list length: %d",this.packet.length,this._list.length),this._list.length}_parseHeader(){const v=this._list.readUInt8(0);return this.packet.cmd=h.types[v>>h.CMD_SHIFT],this.packet.retain=(v&h.RETAIN_MASK)!=0,this.packet.qos=v>>h.QOS_SHIFT&h.QOS_MASK,this.packet.dup=(v&h.DUP_MASK)!=0,l("_parseHeader: packet: %o",this.packet),this._list.consume(1),!0}_parseLength(){const v=this._parseVarByteNum(!0);return v&&(this.packet.length=v.value,this._list.consume(v.bytes)),l("_parseLength %d",v.value),!!v}_parsePayload(){l("_parsePayload: payload %O",this._list);let v=!1;if(this.packet.length===0||this._list.length>=this.packet.length){switch(this._pos=0,this.packet.cmd){case"connect":this._parseConnect();break;case"connack":this._parseConnack();break;case"publish":this._parsePublish();break;case"puback":case"pubrec":case"pubrel":case"pubcomp":this._parseConfirmation();break;case"subscribe":this._parseSubscribe();break;case"suback":this._parseSuback();break;case"unsubscribe":this._parseUnsubscribe();break;case"unsuback":this._parseUnsuback();break;case"pingreq":case"pingresp":break;case"disconnect":this._parseDisconnect();break;case"auth":this._parseAuth();break;default:this._emitError(new Error("Not supported"))}v=!0}return l("_parsePayload complete result: %s",v),v}_parseConnect(){let v,g,y,p;l("_parseConnect");const m={},b=this.packet,x=this._parseString();if(x===null)return this._emitError(new Error("Cannot parse protocolId"));if(x!=="MQTT"&&x!=="MQIsdp")return this._emitError(new Error("Invalid protocolId"));if(b.protocolId=x,this._pos>=this._list.length)return this._emitError(new Error("Packet too short"));if(b.protocolVersion=this._list.readUInt8(this._pos),b.protocolVersion>=128&&(b.bridgeMode=!0,b.protocolVersion=b.protocolVersion-128),b.protocolVersion!==3&&b.protocolVersion!==4&&b.protocolVersion!==5)return this._emitError(new Error("Invalid protocol version"));if(this._pos++,this._pos>=this._list.length)return this._emitError(new Error("Packet too short"));if(m.username=this._list.readUInt8(this._pos)&h.USERNAME_MASK,m.password=this._list.readUInt8(this._pos)&h.PASSWORD_MASK,m.will=this._list.readUInt8(this._pos)&h.WILL_FLAG_MASK,m.will&&(b.will={},b.will.retain=(this._list.readUInt8(this._pos)&h.WILL_RETAIN_MASK)!=0,b.will.qos=(this._list.readUInt8(this._pos)&h.WILL_QOS_MASK)>>h.WILL_QOS_SHIFT),b.clean=(this._list.readUInt8(this._pos)&h.CLEAN_SESSION_MASK)!=0,this._pos++,b.keepalive=this._parseNum(),b.keepalive===-1)return this._emitError(new Error("Packet too short"));if(b.protocolVersion===5){const k=this._parseProperties();Object.getOwnPropertyNames(k).length&&(b.properties=k)}const _=this._parseString();if(_===null)return this._emitError(new Error("Packet too short"));if(b.clientId=_,l("_parseConnect: packet.clientId: %s",b.clientId),m.will){if(b.protocolVersion===5){const k=this._parseProperties();Object.getOwnPropertyNames(k).length&&(b.will.properties=k)}if((v=this._parseString())===null)return this._emitError(new Error("Cannot parse will topic"));if(b.will.topic=v,l("_parseConnect: packet.will.topic: %s",b.will.topic),(g=this._parseBuffer())===null)return this._emitError(new Error("Cannot parse will payload"));b.will.payload=g,l("_parseConnect: packet.will.paylaod: %s",b.will.payload)}if(m.username){if((p=this._parseString())===null)return this._emitError(new Error("Cannot parse username"));b.username=p,l("_parseConnect: packet.username: %s",b.username)}if(m.password){if((y=this._parseBuffer())===null)return this._emitError(new Error("Cannot parse password"));b.password=y}return this.settings=b,l("_parseConnect: complete"),b}_parseConnack(){l("_parseConnack");const v=this.packet;if(this._list.length<1)return null;if(v.sessionPresent=!!(this._list.readUInt8(this._pos++)&h.SESSIONPRESENT_MASK),this.settings.protocolVersion===5)this._list.length>=2?v.reasonCode=this._list.readUInt8(this._pos++):v.reasonCode=0;else{if(this._list.length<2)return null;v.returnCode=this._list.readUInt8(this._pos++)}if(v.returnCode===-1||v.reasonCode===-1)return this._emitError(new Error("Cannot parse return code"));if(this.settings.protocolVersion===5){const g=this._parseProperties();Object.getOwnPropertyNames(g).length&&(v.properties=g)}l("_parseConnack: complete")}_parsePublish(){l("_parsePublish");const v=this.packet;if(v.topic=this._parseString(),v.topic===null)return this._emitError(new Error("Cannot parse topic"));if(!(v.qos>0)||this._parseMessageId()){if(this.settings.protocolVersion===5){const g=this._parseProperties();Object.getOwnPropertyNames(g).length&&(v.properties=g)}v.payload=this._list.slice(this._pos,v.length),l("_parsePublish: payload from buffer list: %o",v.payload)}}_parseSubscribe(){l("_parseSubscribe");const v=this.packet;let g,y,p,m,b,x,_;if(v.qos!==1)return this._emitError(new Error("Wrong subscribe header"));if(v.subscriptions=[],this._parseMessageId()){if(this.settings.protocolVersion===5){const k=this._parseProperties();Object.getOwnPropertyNames(k).length&&(v.properties=k)}for(;this._pos<v.length;){if((g=this._parseString())===null)return this._emitError(new Error("Cannot parse topic"));if(this._pos>=v.length)return this._emitError(new Error("Malformed Subscribe Payload"));p=(y=this._parseByte())&h.SUBSCRIBE_OPTIONS_QOS_MASK,x=(y>>h.SUBSCRIBE_OPTIONS_NL_SHIFT&h.SUBSCRIBE_OPTIONS_NL_MASK)!=0,b=(y>>h.SUBSCRIBE_OPTIONS_RAP_SHIFT&h.SUBSCRIBE_OPTIONS_RAP_MASK)!=0,m=y>>h.SUBSCRIBE_OPTIONS_RH_SHIFT&h.SUBSCRIBE_OPTIONS_RH_MASK,_={topic:g,qos:p},this.settings.protocolVersion===5?(_.nl=x,_.rap=b,_.rh=m):this.settings.bridgeMode&&(_.rh=0,_.rap=!0,_.nl=!0),l("_parseSubscribe: push subscription `%s` to subscription",_),v.subscriptions.push(_)}}}_parseSuback(){l("_parseSuback");const v=this.packet;if(this.packet.granted=[],this._parseMessageId()){if(this.settings.protocolVersion===5){const g=this._parseProperties();Object.getOwnPropertyNames(g).length&&(v.properties=g)}for(;this._pos<this.packet.length;)this.packet.granted.push(this._list.readUInt8(this._pos++))}}_parseUnsubscribe(){l("_parseUnsubscribe");const v=this.packet;if(v.unsubscriptions=[],this._parseMessageId()){if(this.settings.protocolVersion===5){const g=this._parseProperties();Object.getOwnPropertyNames(g).length&&(v.properties=g)}for(;this._pos<v.length;){const g=this._parseString();if(g===null)return this._emitError(new Error("Cannot parse topic"));l("_parseUnsubscribe: push topic `%s` to unsubscriptions",g),v.unsubscriptions.push(g)}}}_parseUnsuback(){l("_parseUnsuback");const v=this.packet;if(!this._parseMessageId())return this._emitError(new Error("Cannot parse messageId"));if(this.settings.protocolVersion===5){const g=this._parseProperties();for(Object.getOwnPropertyNames(g).length&&(v.properties=g),v.granted=[];this._pos<this.packet.length;)this.packet.granted.push(this._list.readUInt8(this._pos++))}}_parseConfirmation(){l("_parseConfirmation: packet.cmd: `%s`",this.packet.cmd);const v=this.packet;if(this._parseMessageId(),this.settings.protocolVersion===5&&(v.length>2?(v.reasonCode=this._parseByte(),l("_parseConfirmation: packet.reasonCode `%d`",v.reasonCode)):v.reasonCode=0,v.length>3)){const g=this._parseProperties();Object.getOwnPropertyNames(g).length&&(v.properties=g)}return!0}_parseDisconnect(){const v=this.packet;if(l("_parseDisconnect"),this.settings.protocolVersion===5){this._list.length>0?v.reasonCode=this._parseByte():v.reasonCode=0;const g=this._parseProperties();Object.getOwnPropertyNames(g).length&&(v.properties=g)}return l("_parseDisconnect result: true"),!0}_parseAuth(){l("_parseAuth");const v=this.packet;if(this.settings.protocolVersion!==5)return this._emitError(new Error("Not supported auth packet for this version MQTT"));v.reasonCode=this._parseByte();const g=this._parseProperties();return Object.getOwnPropertyNames(g).length&&(v.properties=g),l("_parseAuth: result: true"),!0}_parseMessageId(){const v=this.packet;return v.messageId=this._parseNum(),v.messageId===null?(this._emitError(new Error("Cannot parse messageId")),!1):(l("_parseMessageId: packet.messageId %d",v.messageId),!0)}_parseString(v){const g=this._parseNum(),y=g+this._pos;if(g===-1||y>this._list.length||y>this.packet.length)return null;const p=this._list.toString("utf8",this._pos,y);return this._pos+=g,l("_parseString: result: %s",p),p}_parseStringPair(){return l("_parseStringPair"),{name:this._parseString(),value:this._parseString()}}_parseBuffer(){const v=this._parseNum(),g=v+this._pos;if(v===-1||g>this._list.length||g>this.packet.length)return null;const y=this._list.slice(this._pos,g);return this._pos+=v,l("_parseBuffer: result: %o",y),y}_parseNum(){if(this._list.length-this._pos<2)return-1;const v=this._list.readUInt16BE(this._pos);return this._pos+=2,l("_parseNum: result: %s",v),v}_parse4ByteNum(){if(this._list.length-this._pos<4)return-1;const v=this._list.readUInt32BE(this._pos);return this._pos+=4,l("_parse4ByteNum: result: %s",v),v}_parseVarByteNum(v){l("_parseVarByteNum");let g,y=0,p=1,m=0,b=!1;const x=this._pos?this._pos:0;for(;y<4&&x+y<this._list.length;){if(m+=p*((g=this._list.readUInt8(x+y++))&h.VARBYTEINT_MASK),p*=128,(g&h.VARBYTEINT_FIN_MASK)==0){b=!0;break}if(this._list.length<=y)break}return!b&&y===4&&this._list.length>=y&&this._emitError(new Error("Invalid variable byte integer")),x&&(this._pos+=y),l("_parseVarByteNum: result: %o",b=!!b&&(v?{bytes:y,value:m}:m)),b}_parseByte(){let v;return this._pos<this._list.length&&(v=this._list.readUInt8(this._pos),this._pos++),l("_parseByte: result: %o",v),v}_parseByType(v){switch(l("_parseByType: type: %s",v),v){case"byte":return this._parseByte()!==0;case"int8":return this._parseByte();case"int16":return this._parseNum();case"int32":return this._parse4ByteNum();case"var":return this._parseVarByteNum();case"string":return this._parseString();case"pair":return this._parseStringPair();case"binary":return this._parseBuffer()}}_parseProperties(){l("_parseProperties");const v=this._parseVarByteNum(),g=this._pos+v,y={};for(;this._pos<g;){const p=this._parseByte();if(!p)return this._emitError(new Error("Cannot parse property code type")),!1;const m=h.propertiesCodes[p];if(!m)return this._emitError(new Error("Unknown property")),!1;if(m!=="userProperties")y[m]?Array.isArray(y[m])?y[m].push(this._parseByType(h.propertiesTypes[m])):(y[m]=[y[m]],y[m].push(this._parseByType(h.propertiesTypes[m]))):y[m]=this._parseByType(h.propertiesTypes[m]);else{y[m]||(y[m]=Object.create(null));const b=this._parseByType(h.propertiesTypes[m]);if(y[m][b.name])if(Array.isArray(y[m][b.name]))y[m][b.name].push(b.value);else{const x=y[m][b.name];y[m][b.name]=[x],y[m][b.name].push(b.value)}else y[m][b.name]=b.value}}return y}_newPacket(){return l("_newPacket"),this.packet&&(this._list.consume(this.packet.length),l("_newPacket: parser emit packet: packet.cmd: %s, packet.payload: %s, packet.length: %d",this.packet.cmd,this.packet.payload,this.packet.length),this.emit("packet",this.packet)),l("_newPacket: new packet"),this.packet=new s,this._pos=0,!0}_emitError(v){l("_emitError"),this.error=v,this.emit("error",v)}}a.exports=c},{"./constants":38,"./packet":42,bl:15,debug:18,events:22}],44:[function(i,a,r){(function(n){(function(){const o=i("./constants"),s=n.allocUnsafe(0),h=n.from([0]),l=i("./numbers"),c=i("process-nextick-args").nextTick,f=i("debug")("mqtt-packet:writeToStream"),v=l.cache,g=l.generateNumber,y=l.generateCache,p=l.genBufVariableByteInt,m=l.generate4ByteBuffer;let b=U,x=!0;function _(V,F,q){switch(f("generate called"),F.cork&&(F.cork(),c(k,F)),x&&(x=!1,y()),f("generate: packet.cmd: %s",V.cmd),V.cmd){case"connect":return function(Y,W,J){const re=Y||{},ee=re.protocolId||"MQTT";let he=re.protocolVersion||4;const le=re.will;let se=re.clean;const E=re.keepalive||0,C=re.clientId||"",D=re.username,H=re.password,X=re.properties;se===void 0&&(se=!0);let Q=0;if(!ee||typeof ee!="string"&&!n.isBuffer(ee))return W.emit("error",new Error("Invalid protocolId")),!1;if(Q+=ee.length+2,he!==3&&he!==4&&he!==5)return W.emit("error",new Error("Invalid protocol version")),!1;if(Q+=1,(typeof C=="string"||n.isBuffer(C))&&(C||he>=4)&&(C||se))Q+=n.byteLength(C)+2;else{if(he<4)return W.emit("error",new Error("clientId must be supplied before 3.1.1")),!1;if(1*se==0)return W.emit("error",new Error("clientId must be given if cleanSession set to 0")),!1}if(typeof E!="number"||E<0||E>65535||E%1!=0)return W.emit("error",new Error("Invalid keepalive")),!1;if(Q+=2,Q+=1,he===5){var ne=T(W,X);if(!ne)return!1;Q+=ne.length}if(le){if(typeof le!="object")return W.emit("error",new Error("Invalid will")),!1;if(!le.topic||typeof le.topic!="string")return W.emit("error",new Error("Invalid will topic")),!1;if(Q+=n.byteLength(le.topic)+2,Q+=2,le.payload){if(!(le.payload.length>=0))return W.emit("error",new Error("Invalid will payload")),!1;typeof le.payload=="string"?Q+=n.byteLength(le.payload):Q+=le.payload.length}var ye={};if(he===5){if(!(ye=T(W,le.properties)))return!1;Q+=ye.length}}let ge=!1;if(D!=null){if(!ae(D))return W.emit("error",new Error("Invalid username")),!1;ge=!0,Q+=n.byteLength(D)+2}if(H!=null){if(!ge)return W.emit("error",new Error("Username is required to use password")),!1;if(!ae(H))return W.emit("error",new Error("Invalid password")),!1;Q+=G(H)+2}W.write(o.CONNECT_HEADER),P(W,Q),S(W,ee),re.bridgeMode&&(he+=128),W.write(he===131?o.VERSION131:he===132?o.VERSION132:he===4?o.VERSION4:he===5?o.VERSION5:o.VERSION3);let xe=0;return xe|=D!=null?o.USERNAME_MASK:0,xe|=H!=null?o.PASSWORD_MASK:0,xe|=le&&le.retain?o.WILL_RETAIN_MASK:0,xe|=le&&le.qos?le.qos<<o.WILL_QOS_SHIFT:0,xe|=le?o.WILL_FLAG_MASK:0,xe|=se?o.CLEAN_SESSION_MASK:0,W.write(n.from([xe])),b(W,E),he===5&&ne.write(),S(W,C),le&&(he===5&&ye.write(),M(W,le.topic),S(W,le.payload)),D!=null&&S(W,D),H!=null&&S(W,H),!0}(V,F);case"connack":return function(Y,W,J){const re=J?J.protocolVersion:4,ee=Y||{},he=re===5?ee.reasonCode:ee.returnCode,le=ee.properties;let se=2;if(typeof he!="number")return W.emit("error",new Error("Invalid return code")),!1;let E=null;if(re===5){if(!(E=T(W,le)))return!1;se+=E.length}return W.write(o.CONNACK_HEADER),P(W,se),W.write(ee.sessionPresent?o.SESSIONPRESENT_HEADER:h),W.write(n.from([he])),E!=null&&E.write(),!0}(V,F,q);case"publish":return function(Y,W,J){f("publish: packet: %o",Y);const re=J?J.protocolVersion:4,ee=Y||{},he=ee.qos||0,le=ee.retain?o.RETAIN_MASK:0,se=ee.topic,E=ee.payload||s,C=ee.messageId,D=ee.properties;let H=0;if(typeof se=="string")H+=n.byteLength(se)+2;else{if(!n.isBuffer(se))return W.emit("error",new Error("Invalid topic")),!1;H+=se.length+2}if(n.isBuffer(E)?H+=E.length:H+=n.byteLength(E),he&&typeof C!="number")return W.emit("error",new Error("Invalid messageId")),!1;he&&(H+=2);let X=null;if(re===5){if(!(X=T(W,D)))return!1;H+=X.length}return W.write(o.PUBLISH_HEADER[he][ee.dup?1:0][le?1:0]),P(W,H),b(W,G(se)),W.write(se),he>0&&b(W,C),X!=null&&X.write(),f("publish: payload: %o",E),W.write(E)}(V,F,q);case"puback":case"pubrec":case"pubrel":case"pubcomp":return function(Y,W,J){const re=J?J.protocolVersion:4,ee=Y||{},he=ee.cmd||"puback",le=ee.messageId,se=ee.dup&&he==="pubrel"?o.DUP_MASK:0;let E=0;const C=ee.reasonCode,D=ee.properties;let H=re===5?3:2;if(he==="pubrel"&&(E=1),typeof le!="number")return W.emit("error",new Error("Invalid messageId")),!1;let X=null;if(re===5&&typeof D=="object"){if(!(X=R(W,D,J,H)))return!1;H+=X.length}return W.write(o.ACKS[he][E][se][0]),P(W,H),b(W,le),re===5&&W.write(n.from([C])),X!==null&&X.write(),!0}(V,F,q);case"subscribe":return function(Y,W,J){f("subscribe: packet: ");const re=J?J.protocolVersion:4,ee=Y||{},he=ee.dup?o.DUP_MASK:0,le=ee.messageId,se=ee.subscriptions,E=ee.properties;let C=0;if(typeof le!="number")return W.emit("error",new Error("Invalid messageId")),!1;C+=2;let D=null;if(re===5){if(!(D=T(W,E)))return!1;C+=D.length}if(typeof se!="object"||!se.length)return W.emit("error",new Error("Invalid subscriptions")),!1;for(let X=0;X<se.length;X+=1){const Q=se[X].topic,ne=se[X].qos;if(typeof Q!="string")return W.emit("error",new Error("Invalid subscriptions - invalid topic")),!1;if(typeof ne!="number")return W.emit("error",new Error("Invalid subscriptions - invalid qos")),!1;if(re===5){if(typeof(se[X].nl||!1)!="boolean")return W.emit("error",new Error("Invalid subscriptions - invalid No Local")),!1;if(typeof(se[X].rap||!1)!="boolean")return W.emit("error",new Error("Invalid subscriptions - invalid Retain as Published")),!1;const xe=se[X].rh||0;if(typeof xe!="number"||xe>2)return W.emit("error",new Error("Invalid subscriptions - invalid Retain Handling")),!1}C+=n.byteLength(Q)+2+1}f("subscribe: writing to stream: %o",o.SUBSCRIBE_HEADER),W.write(o.SUBSCRIBE_HEADER[1][he?1:0][0]),P(W,C),b(W,le),D!==null&&D.write();let H=!0;for(const X of se){const Q=X.topic,ne=X.qos,ye=+X.nl,ge=+X.rap,xe=X.rh;let Se;M(W,Q),Se=o.SUBSCRIBE_OPTIONS_QOS[ne],re===5&&(Se|=ye?o.SUBSCRIBE_OPTIONS_NL:0,Se|=ge?o.SUBSCRIBE_OPTIONS_RAP:0,Se|=xe?o.SUBSCRIBE_OPTIONS_RH[xe]:0),H=W.write(n.from([Se]))}return H}(V,F,q);case"suback":return function(Y,W,J){const re=J?J.protocolVersion:4,ee=Y||{},he=ee.messageId,le=ee.granted,se=ee.properties;let E=0;if(typeof he!="number")return W.emit("error",new Error("Invalid messageId")),!1;if(E+=2,typeof le!="object"||!le.length)return W.emit("error",new Error("Invalid qos vector")),!1;for(let D=0;D<le.length;D+=1){if(typeof le[D]!="number")return W.emit("error",new Error("Invalid qos vector")),!1;E+=1}let C=null;if(re===5){if(!(C=R(W,se,J,E)))return!1;E+=C.length}return W.write(o.SUBACK_HEADER),P(W,E),b(W,he),C!==null&&C.write(),W.write(n.from(le))}(V,F,q);case"unsubscribe":return function(Y,W,J){const re=J?J.protocolVersion:4,ee=Y||{},he=ee.messageId,le=ee.dup?o.DUP_MASK:0,se=ee.unsubscriptions,E=ee.properties;let C=0;if(typeof he!="number")return W.emit("error",new Error("Invalid messageId")),!1;if(C+=2,typeof se!="object"||!se.length)return W.emit("error",new Error("Invalid unsubscriptions")),!1;for(let X=0;X<se.length;X+=1){if(typeof se[X]!="string")return W.emit("error",new Error("Invalid unsubscriptions")),!1;C+=n.byteLength(se[X])+2}let D=null;if(re===5){if(!(D=T(W,E)))return!1;C+=D.length}W.write(o.UNSUBSCRIBE_HEADER[1][le?1:0][0]),P(W,C),b(W,he),D!==null&&D.write();let H=!0;for(let X=0;X<se.length;X++)H=M(W,se[X]);return H}(V,F,q);case"unsuback":return function(Y,W,J){const re=J?J.protocolVersion:4,ee=Y||{},he=ee.messageId,le=ee.dup?o.DUP_MASK:0,se=ee.granted,E=ee.properties,C=ee.cmd;let D=2;if(typeof he!="number")return W.emit("error",new Error("Invalid messageId")),!1;if(re===5){if(typeof se!="object"||!se.length)return W.emit("error",new Error("Invalid qos vector")),!1;for(let X=0;X<se.length;X+=1){if(typeof se[X]!="number")return W.emit("error",new Error("Invalid qos vector")),!1;D+=1}}let H=null;if(re===5){if(!(H=R(W,E,J,D)))return!1;D+=H.length}return W.write(o.ACKS[C][0][le][0]),P(W,D),b(W,he),H!==null&&H.write(),re===5&&W.write(n.from(se)),!0}(V,F,q);case"pingreq":case"pingresp":return function(Y,W,J){return W.write(o.EMPTY[Y.cmd])}(V,F);case"disconnect":return function(Y,W,J){const re=J?J.protocolVersion:4,ee=Y||{},he=ee.reasonCode,le=ee.properties;let se=re===5?1:0,E=null;if(re===5){if(!(E=R(W,le,J,se)))return!1;se+=E.length}return W.write(n.from([o.codes.disconnect<<4])),P(W,se),re===5&&W.write(n.from([he])),E!==null&&E.write(),!0}(V,F,q);case"auth":return function(Y,W,J){const re=J?J.protocolVersion:4,ee=Y||{},he=ee.reasonCode,le=ee.properties;let se=re===5?1:0;re!==5&&W.emit("error",new Error("Invalid mqtt version for auth packet"));const E=R(W,le,J,se);return E?(se+=E.length,W.write(n.from([o.codes.auth<<4])),P(W,se),W.write(n.from([he])),E!==null&&E.write(),!0):!1}(V,F,q);default:return F.emit("error",new Error("Unknown command")),!1}}function k(V){V.uncork()}Object.defineProperty(_,"cacheNumbers",{get:()=>b===U,set(V){V?(v&&Object.keys(v).length!==0||(x=!0),b=U):(x=!1,b=$)}});const I={};function P(V,F){if(F>o.VARBYTEINT_MAX)return V.emit("error",new Error(`Invalid variable byte integer: ${F}`)),!1;let q=I[F];return q||(q=p(F),F<16384&&(I[F]=q)),f("writeVarByteInt: writing to stream: %o",q),V.write(q)}function M(V,F){const q=n.byteLength(F);return b(V,q),f("writeString: %s",F),V.write(F,"utf8")}function L(V,F,q){M(V,F),M(V,q)}function U(V,F){return f("writeNumberCached: number: %d",F),f("writeNumberCached: %o",v[F]),V.write(v[F])}function $(V,F){const q=g(F);return f("writeNumberGenerated: %o",q),V.write(q)}function S(V,F){typeof F=="string"?M(V,F):F?(b(V,F.length),V.write(F)):b(V,0)}function T(V,F){if(typeof F!="object"||F.length!=null)return{length:1,write(){K(V,{},0)}};let q=0;function Y(W,J){let re=0;switch(o.propertiesTypes[W]){case"byte":if(typeof J!="boolean")return V.emit("error",new Error(`Invalid ${W}: ${J}`)),!1;re+=2;break;case"int8":if(typeof J!="number"||J<0||J>255)return V.emit("error",new Error(`Invalid ${W}: ${J}`)),!1;re+=2;break;case"binary":if(J&&J===null)return V.emit("error",new Error(`Invalid ${W}: ${J}`)),!1;re+=1+n.byteLength(J)+2;break;case"int16":if(typeof J!="number"||J<0||J>65535)return V.emit("error",new Error(`Invalid ${W}: ${J}`)),!1;re+=3;break;case"int32":if(typeof J!="number"||J<0||J>4294967295)return V.emit("error",new Error(`Invalid ${W}: ${J}`)),!1;re+=5;break;case"var":if(typeof J!="number"||J<0||J>268435455)return V.emit("error",new Error(`Invalid ${W}: ${J}`)),!1;re+=1+n.byteLength(p(J));break;case"string":if(typeof J!="string")return V.emit("error",new Error(`Invalid ${W}: ${J}`)),!1;re+=3+n.byteLength(J.toString());break;case"pair":if(typeof J!="object")return V.emit("error",new Error(`Invalid ${W}: ${J}`)),!1;re+=Object.getOwnPropertyNames(J).reduce((ee,he)=>{const le=J[he];return Array.isArray(le)?ee+=le.reduce((se,E)=>se+=3+n.byteLength(he.toString())+2+n.byteLength(E.toString()),0):ee+=3+n.byteLength(he.toString())+2+n.byteLength(J[he].toString()),ee},0);break;default:return V.emit("error",new Error(`Invalid property ${W}: ${J}`)),!1}return re}if(F)for(const W in F){let J=0,re=0;const ee=F[W];if(Array.isArray(ee))for(let he=0;he<ee.length;he++){if(!(re=Y(W,ee[he])))return!1;J+=re}else{if(!(re=Y(W,ee)))return!1;J=re}if(!J)return!1;q+=J}return{length:n.byteLength(p(q))+q,write(){K(V,F,q)}}}function R(V,F,q,Y){const W=["reasonString","userProperties"],J=q&&q.properties&&q.properties.maximumPacketSize?q.properties.maximumPacketSize:0;let re=T(V,F);if(J)for(;Y+re.length>J;){const ee=W.shift();if(!ee||!F[ee])return!1;delete F[ee],re=T(V,F)}return re}function O(V,F,q){switch(o.propertiesTypes[F]){case"byte":V.write(n.from([o.properties[F]])),V.write(n.from([+q]));break;case"int8":V.write(n.from([o.properties[F]])),V.write(n.from([q]));break;case"binary":V.write(n.from([o.properties[F]])),S(V,q);break;case"int16":V.write(n.from([o.properties[F]])),b(V,q);break;case"int32":V.write(n.from([o.properties[F]])),function(Y,W){const J=m(W);f("write4ByteNumber: %o",J),Y.write(J)}(V,q);break;case"var":V.write(n.from([o.properties[F]])),P(V,q);break;case"string":V.write(n.from([o.properties[F]])),M(V,q);break;case"pair":Object.getOwnPropertyNames(q).forEach(Y=>{const W=q[Y];Array.isArray(W)?W.forEach(J=>{V.write(n.from([o.properties[F]])),L(V,Y.toString(),J.toString())}):(V.write(n.from([o.properties[F]])),L(V,Y.toString(),W.toString()))});break;default:return V.emit("error",new Error(`Invalid property ${F} value: ${q}`)),!1}}function K(V,F,q){P(V,q);for(const Y in F)if(Object.prototype.hasOwnProperty.call(F,Y)&&F[Y]!==null){const W=F[Y];if(Array.isArray(W))for(let J=0;J<W.length;J++)O(V,Y,W[J]);else O(V,Y,W)}}function G(V){return V?V instanceof n?V.length:n.byteLength(V):0}function ae(V){return typeof V=="string"||V instanceof n}a.exports=_}).call(this)}).call(this,i("buffer").Buffer)},{"./constants":38,"./numbers":41,buffer:17,debug:18,"process-nextick-args":49}],45:[function(i,a,r){var n=1e3,o=60*n,s=60*o,h=24*s,l=7*h,c=365.25*h;function f(v,g,y,p){var m=g>=1.5*y;return Math.round(v/y)+" "+p+(m?"s":"")}a.exports=function(v,g){g=g||{};var y=typeof v;if(y==="string"&&v.length>0)return function(p){if(!((p=String(p)).length>100)){var m=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(p);if(!!m){var b=parseFloat(m[1]);switch((m[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return b*c;case"weeks":case"week":case"w":return b*l;case"days":case"day":case"d":return b*h;case"hours":case"hour":case"hrs":case"hr":case"h":return b*s;case"minutes":case"minute":case"mins":case"min":case"m":return b*o;case"seconds":case"second":case"secs":case"sec":case"s":return b*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return b;default:return}}}}(v);if(y==="number"&&isFinite(v))return g.long?function(p){var m=Math.abs(p);return m>=h?f(p,m,h,"day"):m>=s?f(p,m,s,"hour"):m>=o?f(p,m,o,"minute"):m>=n?f(p,m,n,"second"):p+" ms"}(v):function(p){var m=Math.abs(p);return m>=h?Math.round(p/h)+"d":m>=s?Math.round(p/s)+"h":m>=o?Math.round(p/o)+"m":m>=n?Math.round(p/n)+"s":p+"ms"}(v);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(v))}},{}],46:[function(i,a,r){const n=i("./lib/number-allocator.js");a.exports.NumberAllocator=n},{"./lib/number-allocator.js":47}],47:[function(i,a,r){const n=i("js-sdsl").Set,o=i("debug")("number-allocator:trace"),s=i("debug")("number-allocator:error");function h(c,f){this.low=c,this.high=f}function l(c,f){if(!(this instanceof l))return new l(c,f);this.min=c,this.max=f,this.ss=new n([],(v,g)=>v.compare(g)),o("Create"),this.clear()}h.prototype.equals=function(c){return this.low===c.low&&this.high===c.high},h.prototype.compare=function(c){return this.low<c.low&&this.high<c.low?-1:c.low<this.low&&c.high<this.low?1:0},l.prototype.firstVacant=function(){return this.ss.size()===0?null:this.ss.front().low},l.prototype.alloc=function(){if(this.ss.size()===0)return o("alloc():empty"),null;const c=this.ss.front(),f=c.low;return f+1<=c.high?++c.low:this.ss.eraseElementByPos(0),o("alloc():"+f),f},l.prototype.use=function(c){const f=new h(c,c),v=this.ss.lowerBound(f);if(v){if(v.equals(f))return this.ss.eraseElementByValue(v),o("use():"+c),!0;if(v.low>c)return!1;if(v.low===c)return++v.low,o("use():"+c),!0;if(v.high===c)return--v.high,o("use():"+c),!0;const g=v.low;return v.low=c+1,this.ss.insert(new h(g,c-1)),o("use():"+c),!0}return o("use():failed"),!1},l.prototype.free=function(c){if(c<this.min||c>this.max)return void s("free():"+c+" is out of range");const f=new h(c,c),v=this.ss.lowerBound(f);if(v){if(v.low<=c&&c<=v.high)return void s("free():"+c+" has already been vacant");if(v===this.ss.front())c+1===v.low?--v.low:this.ss.insert(f);else{const g=this.ss.reverseLowerBound(f);g.high+1===c?c+1===v.low?(this.ss.eraseElementByValue(g),v.low=g.low):g.high=c:c+1===v.low?v.low=c:this.ss.insert(f)}}else{if(v===this.ss.front())return void this.ss.insert(f);const g=this.ss.reverseLowerBound(f);g.high+1===c?g.high=c:this.ss.insert(f)}o("free():"+c)},l.prototype.clear=function(){o("clear()"),this.ss.clear(),this.ss.insert(new h(this.min,this.max))},l.prototype.intervalCount=function(){return this.ss.size()},l.prototype.dump=function(){console.log("length:"+this.ss.size());for(const c of this.ss)console.log(c)},a.exports=l},{debug:18,"js-sdsl":36}],48:[function(i,a,r){var n=i("wrappy");function o(h){var l=function(){return l.called?l.value:(l.called=!0,l.value=h.apply(this,arguments))};return l.called=!1,l}function s(h){var l=function(){if(l.called)throw new Error(l.onceError);return l.called=!0,l.value=h.apply(this,arguments)},c=h.name||"Function wrapped with `once`";return l.onceError=c+" shouldn't be called more than once",l.called=!1,l}a.exports=n(o),a.exports.strict=n(s),o.proto=o(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return o(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return s(this)},configurable:!0})})},{wrappy:79}],49:[function(i,a,r){(function(n){(function(){n===void 0||!n.version||n.version.indexOf("v0.")===0||n.version.indexOf("v1.")===0&&n.version.indexOf("v1.8.")!==0?a.exports={nextTick:function(o,s,h,l){if(typeof o!="function")throw new TypeError('"callback" argument must be a function');var c,f,v=arguments.length;switch(v){case 0:case 1:return n.nextTick(o);case 2:return n.nextTick(function(){o.call(null,s)});case 3:return n.nextTick(function(){o.call(null,s,h)});case 4:return n.nextTick(function(){o.call(null,s,h,l)});default:for(c=new Array(v-1),f=0;f<c.length;)c[f++]=arguments[f];return n.nextTick(function(){o.apply(null,c)})}}}:a.exports=n}).call(this)}).call(this,i("_process"))},{_process:50}],50:[function(i,a,r){var n,o,s=a.exports={};function h(){throw new Error("setTimeout has not been defined")}function l(){throw new Error("clearTimeout has not been defined")}function c(_){if(n===setTimeout)return setTimeout(_,0);if((n===h||!n)&&setTimeout)return n=setTimeout,setTimeout(_,0);try{return n(_,0)}catch{try{return n.call(null,_,0)}catch{return n.call(this,_,0)}}}(function(){try{n=typeof setTimeout=="function"?setTimeout:h}catch{n=h}try{o=typeof clearTimeout=="function"?clearTimeout:l}catch{o=l}})();var f,v=[],g=!1,y=-1;function p(){g&&f&&(g=!1,f.length?v=f.concat(v):y=-1,v.length&&m())}function m(){if(!g){var _=c(p);g=!0;for(var k=v.length;k;){for(f=v,v=[];++y<k;)f&&f[y].run();y=-1,k=v.length}f=null,g=!1,function(I){if(o===clearTimeout)return clearTimeout(I);if((o===l||!o)&&clearTimeout)return o=clearTimeout,clearTimeout(I);try{o(I)}catch{try{return o.call(null,I)}catch{return o.call(this,I)}}}(_)}}function b(_,k){this.fun=_,this.array=k}function x(){}s.nextTick=function(_){var k=new Array(arguments.length-1);if(arguments.length>1)for(var I=1;I<arguments.length;I++)k[I-1]=arguments[I];v.push(new b(_,k)),v.length!==1||g||c(m)},b.prototype.run=function(){this.fun.apply(null,this.array)},s.title="browser",s.browser=!0,s.env={},s.argv=[],s.version="",s.versions={},s.on=x,s.addListener=x,s.once=x,s.off=x,s.removeListener=x,s.removeAllListeners=x,s.emit=x,s.prependListener=x,s.prependOnceListener=x,s.listeners=function(_){return[]},s.binding=function(_){throw new Error("process.binding is not supported")},s.cwd=function(){return"/"},s.chdir=function(_){throw new Error("process.chdir is not supported")},s.umask=function(){return 0}},{}],51:[function(i,a,r){(function(n){(function(){(function(o){var s=typeof r=="object"&&r&&!r.nodeType&&r,h=typeof a=="object"&&a&&!a.nodeType&&a,l=typeof n=="object"&&n;l.global!==l&&l.window!==l&&l.self!==l||(o=l);var c,f,v=2147483647,g=36,y=1,p=26,m=38,b=700,x=72,_=128,k="-",I=/^xn--/,P=/[^\x20-\x7E]/,M=/[\x2E\u3002\uFF0E\uFF61]/g,L={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},U=g-y,$=Math.floor,S=String.fromCharCode;function T(Y){throw new RangeError(L[Y])}function R(Y,W){for(var J=Y.length,re=[];J--;)re[J]=W(Y[J]);return re}function O(Y,W){var J=Y.split("@"),re="";return J.length>1&&(re=J[0]+"@",Y=J[1]),re+R((Y=Y.replace(M,".")).split("."),W).join(".")}function K(Y){for(var W,J,re=[],ee=0,he=Y.length;ee<he;)(W=Y.charCodeAt(ee++))>=55296&&W<=56319&&ee<he?(64512&(J=Y.charCodeAt(ee++)))==56320?re.push(((1023&W)<<10)+(1023&J)+65536):(re.push(W),ee--):re.push(W);return re}function G(Y){return R(Y,function(W){var J="";return W>65535&&(J+=S((W-=65536)>>>10&1023|55296),W=56320|1023&W),J+=S(W)}).join("")}function ae(Y,W){return Y+22+75*(Y<26)-((W!=0)<<5)}function V(Y,W,J){var re=0;for(Y=J?$(Y/b):Y>>1,Y+=$(Y/W);Y>U*p>>1;re+=g)Y=$(Y/U);return $(re+(U+1)*Y/(Y+m))}function F(Y){var W,J,re,ee,he,le,se,E,C,D,H,X=[],Q=Y.length,ne=0,ye=_,ge=x;for((J=Y.lastIndexOf(k))<0&&(J=0),re=0;re<J;++re)Y.charCodeAt(re)>=128&&T("not-basic"),X.push(Y.charCodeAt(re));for(ee=J>0?J+1:0;ee<Q;){for(he=ne,le=1,se=g;ee>=Q&&T("invalid-input"),((E=(H=Y.charCodeAt(ee++))-48<10?H-22:H-65<26?H-65:H-97<26?H-97:g)>=g||E>$((v-ne)/le))&&T("overflow"),ne+=E*le,!(E<(C=se<=ge?y:se>=ge+p?p:se-ge));se+=g)le>$(v/(D=g-C))&&T("overflow"),le*=D;ge=V(ne-he,W=X.length+1,he==0),$(ne/W)>v-ye&&T("overflow"),ye+=$(ne/W),ne%=W,X.splice(ne++,0,ye)}return G(X)}function q(Y){var W,J,re,ee,he,le,se,E,C,D,H,X,Q,ne,ye,ge=[];for(X=(Y=K(Y)).length,W=_,J=0,he=x,le=0;le<X;++le)(H=Y[le])<128&&ge.push(S(H));for(re=ee=ge.length,ee&&ge.push(k);re<X;){for(se=v,le=0;le<X;++le)(H=Y[le])>=W&&H<se&&(se=H);for(se-W>$((v-J)/(Q=re+1))&&T("overflow"),J+=(se-W)*Q,W=se,le=0;le<X;++le)if((H=Y[le])<W&&++J>v&&T("overflow"),H==W){for(E=J,C=g;!(E<(D=C<=he?y:C>=he+p?p:C-he));C+=g)ye=E-D,ne=g-D,ge.push(S(ae(D+ye%ne,0))),E=$(ye/ne);ge.push(S(ae(E,0))),he=V(J,Q,re==ee),J=0,++re}++J,++W}return ge.join("")}if(c={version:"1.4.1",ucs2:{decode:K,encode:G},decode:F,encode:q,toASCII:function(Y){return O(Y,function(W){return P.test(W)?"xn--"+q(W):W})},toUnicode:function(Y){return O(Y,function(W){return I.test(W)?F(W.slice(4).toLowerCase()):W})}},s&&h)if(a.exports==s)h.exports=c;else for(f in c)c.hasOwnProperty(f)&&(s[f]=c[f]);else o.punycode=c})(this)}).call(this)}).call(this,typeof Ot<"u"?Ot:typeof self<"u"?self:typeof window<"u"?window:{})},{}],52:[function(i,a,r){function n(s,h){return Object.prototype.hasOwnProperty.call(s,h)}a.exports=function(s,h,l,c){h=h||"&",l=l||"=";var f={};if(typeof s!="string"||s.length===0)return f;var v=/\+/g;s=s.split(h);var g=1e3;c&&typeof c.maxKeys=="number"&&(g=c.maxKeys);var y=s.length;g>0&&y>g&&(y=g);for(var p=0;p<y;++p){var m,b,x,_,k=s[p].replace(v,"%20"),I=k.indexOf(l);I>=0?(m=k.substr(0,I),b=k.substr(I+1)):(m=k,b=""),x=decodeURIComponent(m),_=decodeURIComponent(b),n(f,x)?o(f[x])?f[x].push(_):f[x]=[f[x],_]:f[x]=_}return f};var o=Array.isArray||function(s){return Object.prototype.toString.call(s)==="[object Array]"}},{}],53:[function(i,a,r){var n=function(l){switch(typeof l){case"string":return l;case"boolean":return l?"true":"false";case"number":return isFinite(l)?l:"";default:return""}};a.exports=function(l,c,f,v){return c=c||"&",f=f||"=",l===null&&(l=void 0),typeof l=="object"?s(h(l),function(g){var y=encodeURIComponent(n(g))+f;return o(l[g])?s(l[g],function(p){return y+encodeURIComponent(n(p))}).join(c):y+encodeURIComponent(n(l[g]))}).join(c):v?encodeURIComponent(n(v))+f+encodeURIComponent(n(l)):""};var o=Array.isArray||function(l){return Object.prototype.toString.call(l)==="[object Array]"};function s(l,c){if(l.map)return l.map(c);for(var f=[],v=0;v<l.length;v++)f.push(c(l[v],v));return f}var h=Object.keys||function(l){var c=[];for(var f in l)Object.prototype.hasOwnProperty.call(l,f)&&c.push(f);return c}},{}],54:[function(i,a,r){r.decode=r.parse=i("./decode"),r.encode=r.stringify=i("./encode")},{"./decode":52,"./encode":53}],55:[function(i,a,r){var n={};function o(h,l,c){c||(c=Error);var f=function(v){var g,y;function p(m,b,x){return v.call(this,function(_,k,I){return typeof l=="string"?l:l(_,k,I)}(m,b,x))||this}return y=v,(g=p).prototype=Object.create(y.prototype),g.prototype.constructor=g,g.__proto__=y,p}(c);f.prototype.name=c.name,f.prototype.code=h,n[h]=f}function s(h,l){if(Array.isArray(h)){var c=h.length;return h=h.map(function(f){return String(f)}),c>2?"one of ".concat(l," ").concat(h.slice(0,c-1).join(", "),", or ")+h[c-1]:c===2?"one of ".concat(l," ").concat(h[0]," or ").concat(h[1]):"of ".concat(l," ").concat(h[0])}return"of ".concat(l," ").concat(String(h))}o("ERR_INVALID_OPT_VALUE",function(h,l){return'The value "'+l+'" is invalid for option "'+h+'"'},TypeError),o("ERR_INVALID_ARG_TYPE",function(h,l,c){var f,v,g;if(typeof l=="string"&&(v="not ",l.substr(0,v.length)===v)?(f="must not be",l=l.replace(/^not /,"")):f="must be",function(p,m,b){return(b===void 0||b>p.length)&&(b=p.length),p.substring(b-m.length,b)===m}(h," argument"))g="The ".concat(h," ").concat(f," ").concat(s(l,"type"));else{var y=function(p,m,b){return typeof b!="number"&&(b=0),!(b+m.length>p.length)&&p.indexOf(m,b)!==-1}(h,".")?"property":"argument";g='The "'.concat(h,'" ').concat(y," ").concat(f," ").concat(s(l,"type"))}return g+=". Received type ".concat(typeof c)},TypeError),o("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),o("ERR_METHOD_NOT_IMPLEMENTED",function(h){return"The "+h+" method is not implemented"}),o("ERR_STREAM_PREMATURE_CLOSE","Premature close"),o("ERR_STREAM_DESTROYED",function(h){return"Cannot call "+h+" after a stream was destroyed"}),o("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),o("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),o("ERR_STREAM_WRITE_AFTER_END","write after end"),o("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),o("ERR_UNKNOWN_ENCODING",function(h){return"Unknown encoding: "+h},TypeError),o("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),a.exports.codes=n},{}],56:[function(i,a,r){(function(n){(function(){var o=Object.keys||function(p){var m=[];for(var b in p)m.push(b);return m};a.exports=v;var s=i("./_stream_readable"),h=i("./_stream_writable");i("inherits")(v,s);for(var l=o(h.prototype),c=0;c<l.length;c++){var f=l[c];v.prototype[f]||(v.prototype[f]=h.prototype[f])}function v(p){if(!(this instanceof v))return new v(p);s.call(this,p),h.call(this,p),this.allowHalfOpen=!0,p&&(p.readable===!1&&(this.readable=!1),p.writable===!1&&(this.writable=!1),p.allowHalfOpen===!1&&(this.allowHalfOpen=!1,this.once("end",g)))}function g(){this._writableState.ended||n.nextTick(y,this)}function y(p){p.end()}Object.defineProperty(v.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(v.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(v.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(v.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState!==void 0&&this._writableState!==void 0&&this._readableState.destroyed&&this._writableState.destroyed},set:function(p){this._readableState!==void 0&&this._writableState!==void 0&&(this._readableState.destroyed=p,this._writableState.destroyed=p)}})}).call(this)}).call(this,i("_process"))},{"./_stream_readable":58,"./_stream_writable":60,_process:50,inherits:24}],57:[function(i,a,r){a.exports=o;var n=i("./_stream_transform");function o(s){if(!(this instanceof o))return new o(s);n.call(this,s)}i("inherits")(o,n),o.prototype._transform=function(s,h,l){l(null,s)}},{"./_stream_transform":59,inherits:24}],58:[function(i,a,r){(function(n,o){(function(){var s;a.exports=T,T.ReadableState=S,i("events").EventEmitter;var h=function(E,C){return E.listeners(C).length},l=i("./internal/streams/stream"),c=i("buffer").Buffer,f=o.Uint8Array||function(){},v,g=i("util");v=g&&g.debuglog?g.debuglog("stream"):function(){};var y,p,m,b=i("./internal/streams/buffer_list"),x=i("./internal/streams/destroy"),_=i("./internal/streams/state").getHighWaterMark,k=i("../errors").codes,I=k.ERR_INVALID_ARG_TYPE,P=k.ERR_STREAM_PUSH_AFTER_EOF,M=k.ERR_METHOD_NOT_IMPLEMENTED,L=k.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;i("inherits")(T,l);var U=x.errorOrDestroy,$=["error","close","destroy","pause","resume"];function S(E,C,D){s=s||i("./_stream_duplex"),E=E||{},typeof D!="boolean"&&(D=C instanceof s),this.objectMode=!!E.objectMode,D&&(this.objectMode=this.objectMode||!!E.readableObjectMode),this.highWaterMark=_(this,E,"readableHighWaterMark",D),this.buffer=new b,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=E.emitClose!==!1,this.autoDestroy=!!E.autoDestroy,this.destroyed=!1,this.defaultEncoding=E.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,E.encoding&&(y||(y=i("string_decoder/").StringDecoder),this.decoder=new y(E.encoding),this.encoding=E.encoding)}function T(E){if(s=s||i("./_stream_duplex"),!(this instanceof T))return new T(E);var C=this instanceof s;this._readableState=new S(E,this,C),this.readable=!0,E&&(typeof E.read=="function"&&(this._read=E.read),typeof E.destroy=="function"&&(this._destroy=E.destroy)),l.call(this)}function R(E,C,D,H,X){v("readableAddChunk",C);var Q,ne=E._readableState;if(C===null)ne.reading=!1,function(ye,ge){if(v("onEofChunk"),!ge.ended){if(ge.decoder){var xe=ge.decoder.end();xe&&xe.length&&(ge.buffer.push(xe),ge.length+=ge.objectMode?1:xe.length)}ge.ended=!0,ge.sync?ae(ye):(ge.needReadable=!1,ge.emittedReadable||(ge.emittedReadable=!0,V(ye)))}}(E,ne);else if(X||(Q=function(ye,ge){var xe;Se=ge,c.isBuffer(Se)||Se instanceof f||typeof ge=="string"||ge===void 0||ye.objectMode||(xe=new I("chunk",["string","Buffer","Uint8Array"],ge));var Se;return xe}(ne,C)),Q)U(E,Q);else if(ne.objectMode||C&&C.length>0)if(typeof C=="string"||ne.objectMode||Object.getPrototypeOf(C)===c.prototype||(C=function(ye){return c.from(ye)}(C)),H)ne.endEmitted?U(E,new L):O(E,ne,C,!0);else if(ne.ended)U(E,new P);else{if(ne.destroyed)return!1;ne.reading=!1,ne.decoder&&!D?(C=ne.decoder.write(C),ne.objectMode||C.length!==0?O(E,ne,C,!1):F(E,ne)):O(E,ne,C,!1)}else H||(ne.reading=!1,F(E,ne));return!ne.ended&&(ne.length<ne.highWaterMark||ne.length===0)}function O(E,C,D,H){C.flowing&&C.length===0&&!C.sync?(C.awaitDrain=0,E.emit("data",D)):(C.length+=C.objectMode?1:D.length,H?C.buffer.unshift(D):C.buffer.push(D),C.needReadable&&ae(E)),F(E,C)}Object.defineProperty(T.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState!==void 0&&this._readableState.destroyed},set:function(E){this._readableState&&(this._readableState.destroyed=E)}}),T.prototype.destroy=x.destroy,T.prototype._undestroy=x.undestroy,T.prototype._destroy=function(E,C){C(E)},T.prototype.push=function(E,C){var D,H=this._readableState;return H.objectMode?D=!0:typeof E=="string"&&((C=C||H.defaultEncoding)!==H.encoding&&(E=c.from(E,C),C=""),D=!0),R(this,E,C,!1,D)},T.prototype.unshift=function(E){return R(this,E,null,!0,!1)},T.prototype.isPaused=function(){return this._readableState.flowing===!1},T.prototype.setEncoding=function(E){y||(y=i("string_decoder/").StringDecoder);var C=new y(E);this._readableState.decoder=C,this._readableState.encoding=this._readableState.decoder.encoding;for(var D=this._readableState.buffer.head,H="";D!==null;)H+=C.write(D.data),D=D.next;return this._readableState.buffer.clear(),H!==""&&this._readableState.buffer.push(H),this._readableState.length=H.length,this};var K=1073741824;function G(E,C){return E<=0||C.length===0&&C.ended?0:C.objectMode?1:E!=E?C.flowing&&C.length?C.buffer.head.data.length:C.length:(E>C.highWaterMark&&(C.highWaterMark=function(D){return D>=K?D=K:(D--,D|=D>>>1,D|=D>>>2,D|=D>>>4,D|=D>>>8,D|=D>>>16,D++),D}(E)),E<=C.length?E:C.ended?C.length:(C.needReadable=!0,0))}function ae(E){var C=E._readableState;v("emitReadable",C.needReadable,C.emittedReadable),C.needReadable=!1,C.emittedReadable||(v("emitReadable",C.flowing),C.emittedReadable=!0,n.nextTick(V,E))}function V(E){var C=E._readableState;v("emitReadable_",C.destroyed,C.length,C.ended),C.destroyed||!C.length&&!C.ended||(E.emit("readable"),C.emittedReadable=!1),C.needReadable=!C.flowing&&!C.ended&&C.length<=C.highWaterMark,re(E)}function F(E,C){C.readingMore||(C.readingMore=!0,n.nextTick(q,E,C))}function q(E,C){for(;!C.reading&&!C.ended&&(C.length<C.highWaterMark||C.flowing&&C.length===0);){var D=C.length;if(v("maybeReadMore read 0"),E.read(0),D===C.length)break}C.readingMore=!1}function Y(E){var C=E._readableState;C.readableListening=E.listenerCount("readable")>0,C.resumeScheduled&&!C.paused?C.flowing=!0:E.listenerCount("data")>0&&E.resume()}function W(E){v("readable nexttick read 0"),E.read(0)}function J(E,C){v("resume",C.reading),C.reading||E.read(0),C.resumeScheduled=!1,E.emit("resume"),re(E),C.flowing&&!C.reading&&E.read(0)}function re(E){var C=E._readableState;for(v("flow",C.flowing);C.flowing&&E.read()!==null;);}function ee(E,C){return C.length===0?null:(C.objectMode?D=C.buffer.shift():!E||E>=C.length?(D=C.decoder?C.buffer.join(""):C.buffer.length===1?C.buffer.first():C.buffer.concat(C.length),C.buffer.clear()):D=C.buffer.consume(E,C.decoder),D);var D}function he(E){var C=E._readableState;v("endReadable",C.endEmitted),C.endEmitted||(C.ended=!0,n.nextTick(le,C,E))}function le(E,C){if(v("endReadableNT",E.endEmitted,E.length),!E.endEmitted&&E.length===0&&(E.endEmitted=!0,C.readable=!1,C.emit("end"),E.autoDestroy)){var D=C._writableState;(!D||D.autoDestroy&&D.finished)&&C.destroy()}}function se(E,C){for(var D=0,H=E.length;D<H;D++)if(E[D]===C)return D;return-1}T.prototype.read=function(E){v("read",E),E=parseInt(E,10);var C=this._readableState,D=E;if(E!==0&&(C.emittedReadable=!1),E===0&&C.needReadable&&((C.highWaterMark!==0?C.length>=C.highWaterMark:C.length>0)||C.ended))return v("read: emitReadable",C.length,C.ended),C.length===0&&C.ended?he(this):ae(this),null;if((E=G(E,C))===0&&C.ended)return C.length===0&&he(this),null;var H,X=C.needReadable;return v("need readable",X),(C.length===0||C.length-E<C.highWaterMark)&&v("length less than watermark",X=!0),C.ended||C.reading?v("reading or ended",X=!1):X&&(v("do read"),C.reading=!0,C.sync=!0,C.length===0&&(C.needReadable=!0),this._read(C.highWaterMark),C.sync=!1,C.reading||(E=G(D,C))),(H=E>0?ee(E,C):null)===null?(C.needReadable=C.length<=C.highWaterMark,E=0):(C.length-=E,C.awaitDrain=0),C.length===0&&(C.ended||(C.needReadable=!0),D!==E&&C.ended&&he(this)),H!==null&&this.emit("data",H),H},T.prototype._read=function(E){U(this,new M("_read()"))},T.prototype.pipe=function(E,C){var D=this,H=this._readableState;switch(H.pipesCount){case 0:H.pipes=E;break;case 1:H.pipes=[H.pipes,E];break;default:H.pipes.push(E)}H.pipesCount+=1,v("pipe count=%d opts=%j",H.pipesCount,C);var X=(!C||C.end!==!1)&&E!==n.stdout&&E!==n.stderr?ne:Et;function Q(qe,Qe){v("onunpipe"),qe===D&&Qe&&Qe.hasUnpiped===!1&&(Qe.hasUnpiped=!0,v("cleanup"),E.removeListener("close",xt),E.removeListener("finish",it),E.removeListener("drain",ye),E.removeListener("error",Se),E.removeListener("unpipe",Q),D.removeListener("end",ne),D.removeListener("end",Et),D.removeListener("data",xe),ge=!0,!H.awaitDrain||E._writableState&&!E._writableState.needDrain||ye())}function ne(){v("onend"),E.end()}H.endEmitted?n.nextTick(X):D.once("end",X),E.on("unpipe",Q);var ye=function(qe){return function(){var Qe=qe._readableState;v("pipeOnDrain",Qe.awaitDrain),Qe.awaitDrain&&Qe.awaitDrain--,Qe.awaitDrain===0&&h(qe,"data")&&(Qe.flowing=!0,re(qe))}}(D);E.on("drain",ye);var ge=!1;function xe(qe){v("ondata");var Qe=E.write(qe);v("dest.write",Qe),Qe===!1&&((H.pipesCount===1&&H.pipes===E||H.pipesCount>1&&se(H.pipes,E)!==-1)&&!ge&&(v("false write response, pause",H.awaitDrain),H.awaitDrain++),D.pause())}function Se(qe){v("onerror",qe),Et(),E.removeListener("error",Se),h(E,"error")===0&&U(E,qe)}function xt(){E.removeListener("finish",it),Et()}function it(){v("onfinish"),E.removeListener("close",xt),Et()}function Et(){v("unpipe"),D.unpipe(E)}return D.on("data",xe),function(qe,Qe,Ti){if(typeof qe.prependListener=="function")return qe.prependListener(Qe,Ti);qe._events&&qe._events[Qe]?Array.isArray(qe._events[Qe])?qe._events[Qe].unshift(Ti):qe._events[Qe]=[Ti,qe._events[Qe]]:qe.on(Qe,Ti)}(E,"error",Se),E.once("close",xt),E.once("finish",it),E.emit("pipe",D),H.flowing||(v("pipe resume"),D.resume()),E},T.prototype.unpipe=function(E){var C=this._readableState,D={hasUnpiped:!1};if(C.pipesCount===0)return this;if(C.pipesCount===1)return E&&E!==C.pipes?this:(E||(E=C.pipes),C.pipes=null,C.pipesCount=0,C.flowing=!1,E&&E.emit("unpipe",this,D),this);if(!E){var H=C.pipes,X=C.pipesCount;C.pipes=null,C.pipesCount=0,C.flowing=!1;for(var Q=0;Q<X;Q++)H[Q].emit("unpipe",this,{hasUnpiped:!1});return this}var ne=se(C.pipes,E);return ne===-1?this:(C.pipes.splice(ne,1),C.pipesCount-=1,C.pipesCount===1&&(C.pipes=C.pipes[0]),E.emit("unpipe",this,D),this)},T.prototype.on=function(E,C){var D=l.prototype.on.call(this,E,C),H=this._readableState;return E==="data"?(H.readableListening=this.listenerCount("readable")>0,H.flowing!==!1&&this.resume()):E==="readable"&&(H.endEmitted||H.readableListening||(H.readableListening=H.needReadable=!0,H.flowing=!1,H.emittedReadable=!1,v("on readable",H.length,H.reading),H.length?ae(this):H.reading||n.nextTick(W,this))),D},T.prototype.addListener=T.prototype.on,T.prototype.removeListener=function(E,C){var D=l.prototype.removeListener.call(this,E,C);return E==="readable"&&n.nextTick(Y,this),D},T.prototype.removeAllListeners=function(E){var C=l.prototype.removeAllListeners.apply(this,arguments);return E!=="readable"&&E!==void 0||n.nextTick(Y,this),C},T.prototype.resume=function(){var E=this._readableState;return E.flowing||(v("resume"),E.flowing=!E.readableListening,function(C,D){D.resumeScheduled||(D.resumeScheduled=!0,n.nextTick(J,C,D))}(this,E)),E.paused=!1,this},T.prototype.pause=function(){return v("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(v("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},T.prototype.wrap=function(E){var C=this,D=this._readableState,H=!1;for(var X in E.on("end",function(){if(v("wrapped end"),D.decoder&&!D.ended){var ne=D.decoder.end();ne&&ne.length&&C.push(ne)}C.push(null)}),E.on("data",function(ne){v("wrapped data"),D.decoder&&(ne=D.decoder.write(ne)),(!D.objectMode||ne!=null)&&(D.objectMode||ne&&ne.length)&&(C.push(ne)||(H=!0,E.pause()))}),E)this[X]===void 0&&typeof E[X]=="function"&&(this[X]=function(ne){return function(){return E[ne].apply(E,arguments)}}(X));for(var Q=0;Q<$.length;Q++)E.on($[Q],this.emit.bind(this,$[Q]));return this._read=function(ne){v("wrapped _read",ne),H&&(H=!1,E.resume())},this},typeof Symbol=="function"&&(T.prototype[Symbol.asyncIterator]=function(){return p===void 0&&(p=i("./internal/streams/async_iterator")),p(this)}),Object.defineProperty(T.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(T.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(T.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(E){this._readableState&&(this._readableState.flowing=E)}}),T._fromList=ee,Object.defineProperty(T.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),typeof Symbol=="function"&&(T.from=function(E,C){return m===void 0&&(m=i("./internal/streams/from")),m(T,E,C)})}).call(this)}).call(this,i("_process"),typeof Ot<"u"?Ot:typeof self<"u"?self:typeof window<"u"?window:{})},{"../errors":55,"./_stream_duplex":56,"./internal/streams/async_iterator":61,"./internal/streams/buffer_list":62,"./internal/streams/destroy":63,"./internal/streams/from":65,"./internal/streams/state":67,"./internal/streams/stream":68,_process:50,buffer:17,events:22,inherits:24,"string_decoder/":75,util:16}],59:[function(i,a,r){a.exports=f;var n=i("../errors").codes,o=n.ERR_METHOD_NOT_IMPLEMENTED,s=n.ERR_MULTIPLE_CALLBACK,h=n.ERR_TRANSFORM_ALREADY_TRANSFORMING,l=n.ERR_TRANSFORM_WITH_LENGTH_0,c=i("./_stream_duplex");function f(y){if(!(this instanceof f))return new f(y);c.call(this,y),this._transformState={afterTransform:function(p,m){var b=this._transformState;b.transforming=!1;var x=b.writecb;if(x===null)return this.emit("error",new s);b.writechunk=null,b.writecb=null,m!=null&&this.push(m),x(p);var _=this._readableState;_.reading=!1,(_.needReadable||_.length<_.highWaterMark)&&this._read(_.highWaterMark)}.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,y&&(typeof y.transform=="function"&&(this._transform=y.transform),typeof y.flush=="function"&&(this._flush=y.flush)),this.on("prefinish",v)}function v(){var y=this;typeof this._flush!="function"||this._readableState.destroyed?g(this,null,null):this._flush(function(p,m){g(y,p,m)})}function g(y,p,m){if(p)return y.emit("error",p);if(m!=null&&y.push(m),y._writableState.length)throw new l;if(y._transformState.transforming)throw new h;return y.push(null)}i("inherits")(f,c),f.prototype.push=function(y,p){return this._transformState.needTransform=!1,c.prototype.push.call(this,y,p)},f.prototype._transform=function(y,p,m){m(new o("_transform()"))},f.prototype._write=function(y,p,m){var b=this._transformState;if(b.writecb=m,b.writechunk=y,b.writeencoding=p,!b.transforming){var x=this._readableState;(b.needTransform||x.needReadable||x.length<x.highWaterMark)&&this._read(x.highWaterMark)}},f.prototype._read=function(y){var p=this._transformState;p.writechunk===null||p.transforming?p.needTransform=!0:(p.transforming=!0,this._transform(p.writechunk,p.writeencoding,p.afterTransform))},f.prototype._destroy=function(y,p){c.prototype._destroy.call(this,y,function(m){p(m)})}},{"../errors":55,"./_stream_duplex":56,inherits:24}],60:[function(i,a,r){(function(n,o){(function(){function s(F){var q=this;this.next=null,this.entry=null,this.finish=function(){(function(Y,W,J){var re=Y.entry;for(Y.entry=null;re;){var ee=re.callback;W.pendingcb--,ee(J),re=re.next}W.corkedRequestsFree.next=Y})(q,F)}}var h;a.exports=T,T.WritableState=S;var l={deprecate:i("util-deprecate")},c=i("./internal/streams/stream"),f=i("buffer").Buffer,v=o.Uint8Array||function(){},g,y=i("./internal/streams/destroy"),p=i("./internal/streams/state").getHighWaterMark,m=i("../errors").codes,b=m.ERR_INVALID_ARG_TYPE,x=m.ERR_METHOD_NOT_IMPLEMENTED,_=m.ERR_MULTIPLE_CALLBACK,k=m.ERR_STREAM_CANNOT_PIPE,I=m.ERR_STREAM_DESTROYED,P=m.ERR_STREAM_NULL_VALUES,M=m.ERR_STREAM_WRITE_AFTER_END,L=m.ERR_UNKNOWN_ENCODING,U=y.errorOrDestroy;function $(){}function S(F,q,Y){h=h||i("./_stream_duplex"),F=F||{},typeof Y!="boolean"&&(Y=q instanceof h),this.objectMode=!!F.objectMode,Y&&(this.objectMode=this.objectMode||!!F.writableObjectMode),this.highWaterMark=p(this,F,"writableHighWaterMark",Y),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var W=F.decodeStrings===!1;this.decodeStrings=!W,this.defaultEncoding=F.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(J){(function(re,ee){var he=re._writableState,le=he.sync,se=he.writecb;if(typeof se!="function")throw new _;if(function(C){C.writing=!1,C.writecb=null,C.length-=C.writelen,C.writelen=0}(he),ee)(function(C,D,H,X,Q){--D.pendingcb,H?(n.nextTick(Q,X),n.nextTick(V,C,D),C._writableState.errorEmitted=!0,U(C,X)):(Q(X),C._writableState.errorEmitted=!0,U(C,X),V(C,D))})(re,he,le,ee,se);else{var E=G(he)||re.destroyed;E||he.corked||he.bufferProcessing||!he.bufferedRequest||K(re,he),le?n.nextTick(O,re,he,E,se):O(re,he,E,se)}})(q,J)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=F.emitClose!==!1,this.autoDestroy=!!F.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new s(this)}function T(F){var q=this instanceof(h=h||i("./_stream_duplex"));if(!q&&!g.call(T,this))return new T(F);this._writableState=new S(F,this,q),this.writable=!0,F&&(typeof F.write=="function"&&(this._write=F.write),typeof F.writev=="function"&&(this._writev=F.writev),typeof F.destroy=="function"&&(this._destroy=F.destroy),typeof F.final=="function"&&(this._final=F.final)),c.call(this)}function R(F,q,Y,W,J,re,ee){q.writelen=W,q.writecb=ee,q.writing=!0,q.sync=!0,q.destroyed?q.onwrite(new I("write")):Y?F._writev(J,q.onwrite):F._write(J,re,q.onwrite),q.sync=!1}function O(F,q,Y,W){Y||function(J,re){re.length===0&&re.needDrain&&(re.needDrain=!1,J.emit("drain"))}(F,q),q.pendingcb--,W(),V(F,q)}function K(F,q){q.bufferProcessing=!0;var Y=q.bufferedRequest;if(F._writev&&Y&&Y.next){var W=q.bufferedRequestCount,J=new Array(W),re=q.corkedRequestsFree;re.entry=Y;for(var ee=0,he=!0;Y;)J[ee]=Y,Y.isBuf||(he=!1),Y=Y.next,ee+=1;J.allBuffers=he,R(F,q,!0,q.length,J,"",re.finish),q.pendingcb++,q.lastBufferedRequest=null,re.next?(q.corkedRequestsFree=re.next,re.next=null):q.corkedRequestsFree=new s(q),q.bufferedRequestCount=0}else{for(;Y;){var le=Y.chunk,se=Y.encoding,E=Y.callback;if(R(F,q,!1,q.objectMode?1:le.length,le,se,E),Y=Y.next,q.bufferedRequestCount--,q.writing)break}Y===null&&(q.lastBufferedRequest=null)}q.bufferedRequest=Y,q.bufferProcessing=!1}function G(F){return F.ending&&F.length===0&&F.bufferedRequest===null&&!F.finished&&!F.writing}function ae(F,q){F._final(function(Y){q.pendingcb--,Y&&U(F,Y),q.prefinished=!0,F.emit("prefinish"),V(F,q)})}function V(F,q){var Y=G(q);if(Y&&(function(J,re){re.prefinished||re.finalCalled||(typeof J._final!="function"||re.destroyed?(re.prefinished=!0,J.emit("prefinish")):(re.pendingcb++,re.finalCalled=!0,n.nextTick(ae,J,re)))}(F,q),q.pendingcb===0&&(q.finished=!0,F.emit("finish"),q.autoDestroy))){var W=F._readableState;(!W||W.autoDestroy&&W.endEmitted)&&F.destroy()}return Y}i("inherits")(T,c),S.prototype.getBuffer=function(){for(var F=this.bufferedRequest,q=[];F;)q.push(F),F=F.next;return q},function(){try{Object.defineProperty(S.prototype,"buffer",{get:l.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}}(),typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(g=Function.prototype[Symbol.hasInstance],Object.defineProperty(T,Symbol.hasInstance,{value:function(F){return!!g.call(this,F)||this===T&&F&&F._writableState instanceof S}})):g=function(F){return F instanceof this},T.prototype.pipe=function(){U(this,new k)},T.prototype.write=function(F,q,Y){var W,J=this._writableState,re=!1,ee=!J.objectMode&&(W=F,f.isBuffer(W)||W instanceof v);return ee&&!f.isBuffer(F)&&(F=function(he){return f.from(he)}(F)),typeof q=="function"&&(Y=q,q=null),ee?q="buffer":q||(q=J.defaultEncoding),typeof Y!="function"&&(Y=$),J.ending?function(he,le){var se=new M;U(he,se),n.nextTick(le,se)}(this,Y):(ee||function(he,le,se,E){var C;return se===null?C=new P:typeof se=="string"||le.objectMode||(C=new b("chunk",["string","Buffer"],se)),!C||(U(he,C),n.nextTick(E,C),!1)}(this,J,F,Y))&&(J.pendingcb++,re=function(he,le,se,E,C,D){if(!se){var H=function(ye,ge,xe){return ye.objectMode||ye.decodeStrings===!1||typeof ge!="string"||(ge=f.from(ge,xe)),ge}(le,E,C);E!==H&&(se=!0,C="buffer",E=H)}var X=le.objectMode?1:E.length;le.length+=X;var Q=le.length<le.highWaterMark;if(Q||(le.needDrain=!0),le.writing||le.corked){var ne=le.lastBufferedRequest;le.lastBufferedRequest={chunk:E,encoding:C,isBuf:se,callback:D,next:null},ne?ne.next=le.lastBufferedRequest:le.bufferedRequest=le.lastBufferedRequest,le.bufferedRequestCount+=1}else R(he,le,!1,X,E,C,D);return Q}(this,J,ee,F,q,Y)),re},T.prototype.cork=function(){this._writableState.corked++},T.prototype.uncork=function(){var F=this._writableState;F.corked&&(F.corked--,F.writing||F.corked||F.bufferProcessing||!F.bufferedRequest||K(this,F))},T.prototype.setDefaultEncoding=function(F){if(typeof F=="string"&&(F=F.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((F+"").toLowerCase())>-1))throw new L(F);return this._writableState.defaultEncoding=F,this},Object.defineProperty(T.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(T.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),T.prototype._write=function(F,q,Y){Y(new x("_write()"))},T.prototype._writev=null,T.prototype.end=function(F,q,Y){var W=this._writableState;return typeof F=="function"?(Y=F,F=null,q=null):typeof q=="function"&&(Y=q,q=null),F!=null&&this.write(F,q),W.corked&&(W.corked=1,this.uncork()),W.ending||function(J,re,ee){re.ending=!0,V(J,re),ee&&(re.finished?n.nextTick(ee):J.once("finish",ee)),re.ended=!0,J.writable=!1}(this,W,Y),this},Object.defineProperty(T.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(T.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState!==void 0&&this._writableState.destroyed},set:function(F){this._writableState&&(this._writableState.destroyed=F)}}),T.prototype.destroy=y.destroy,T.prototype._undestroy=y.undestroy,T.prototype._destroy=function(F,q){q(F)}}).call(this)}).call(this,i("_process"),typeof Ot<"u"?Ot:typeof self<"u"?self:typeof window<"u"?window:{})},{"../errors":55,"./_stream_duplex":56,"./internal/streams/destroy":63,"./internal/streams/state":67,"./internal/streams/stream":68,_process:50,buffer:17,inherits:24,"util-deprecate":78}],61:[function(i,a,r){(function(n){(function(){var o;function s(k,I,P){return I in k?Object.defineProperty(k,I,{value:P,enumerable:!0,configurable:!0,writable:!0}):k[I]=P,k}var h=i("./end-of-stream"),l=Symbol("lastResolve"),c=Symbol("lastReject"),f=Symbol("error"),v=Symbol("ended"),g=Symbol("lastPromise"),y=Symbol("handlePromise"),p=Symbol("stream");function m(k,I){return{value:k,done:I}}function b(k){var I=k[l];if(I!==null){var P=k[p].read();P!==null&&(k[g]=null,k[l]=null,k[c]=null,I(m(P,!1)))}}var x=Object.getPrototypeOf(function(){}),_=Object.setPrototypeOf((s(o={get stream(){return this[p]},next:function(){var k=this,I=this[f];if(I!==null)return Promise.reject(I);if(this[v])return Promise.resolve(m(void 0,!0));if(this[p].destroyed)return new Promise(function(U,$){n.nextTick(function(){k[f]?$(k[f]):U(m(void 0,!0))})});var P,M=this[g];if(M)P=new Promise(function(U,$){return function(S,T){U.then(function(){$[v]?S(m(void 0,!0)):$[y](S,T)},T)}}(M,this));else{var L=this[p].read();if(L!==null)return Promise.resolve(m(L,!1));P=new Promise(this[y])}return this[g]=P,P}},Symbol.asyncIterator,function(){return this}),s(o,"return",function(){var k=this;return new Promise(function(I,P){k[p].destroy(null,function(M){M?P(M):I(m(void 0,!0))})})}),o),x);a.exports=function(k){var I,P=Object.create(_,(s(I={},p,{value:k,writable:!0}),s(I,l,{value:null,writable:!0}),s(I,c,{value:null,writable:!0}),s(I,f,{value:null,writable:!0}),s(I,v,{value:k._readableState.endEmitted,writable:!0}),s(I,y,{value:function(M,L){var U=P[p].read();U?(P[g]=null,P[l]=null,P[c]=null,M(m(U,!1))):(P[l]=M,P[c]=L)},writable:!0}),I));return P[g]=null,h(k,function(M){if(M&&M.code!=="ERR_STREAM_PREMATURE_CLOSE"){var L=P[c];return L!==null&&(P[g]=null,P[l]=null,P[c]=null,L(M)),void(P[f]=M)}var U=P[l];U!==null&&(P[g]=null,P[l]=null,P[c]=null,U(m(void 0,!0))),P[v]=!0}),k.on("readable",function(M){n.nextTick(b,M)}.bind(null,P)),P}}).call(this)}).call(this,i("_process"))},{"./end-of-stream":64,_process:50}],62:[function(i,a,r){function n(f,v){var g=Object.keys(f);if(Object.getOwnPropertySymbols){var y=Object.getOwnPropertySymbols(f);v&&(y=y.filter(function(p){return Object.getOwnPropertyDescriptor(f,p).enumerable})),g.push.apply(g,y)}return g}function o(f,v,g){return v in f?Object.defineProperty(f,v,{value:g,enumerable:!0,configurable:!0,writable:!0}):f[v]=g,f}function s(f,v){for(var g=0;g<v.length;g++){var y=v[g];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(f,y.key,y)}}var h=i("buffer").Buffer,l=i("util").inspect,c=l&&l.custom||"inspect";a.exports=function(){function f(){(function(y,p){if(!(y instanceof p))throw new TypeError("Cannot call a class as a function")})(this,f),this.head=null,this.tail=null,this.length=0}var v,g;return v=f,(g=[{key:"push",value:function(y){var p={data:y,next:null};this.length>0?this.tail.next=p:this.head=p,this.tail=p,++this.length}},{key:"unshift",value:function(y){var p={data:y,next:this.head};this.length===0&&(this.tail=p),this.head=p,++this.length}},{key:"shift",value:function(){if(this.length!==0){var y=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,y}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(y){if(this.length===0)return"";for(var p=this.head,m=""+p.data;p=p.next;)m+=y+p.data;return m}},{key:"concat",value:function(y){if(this.length===0)return h.alloc(0);for(var p,m,b,x=h.allocUnsafe(y>>>0),_=this.head,k=0;_;)p=_.data,m=x,b=k,h.prototype.copy.call(p,m,b),k+=_.data.length,_=_.next;return x}},{key:"consume",value:function(y,p){var m;return y<this.head.data.length?(m=this.head.data.slice(0,y),this.head.data=this.head.data.slice(y)):m=y===this.head.data.length?this.shift():p?this._getString(y):this._getBuffer(y),m}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(y){var p=this.head,m=1,b=p.data;for(y-=b.length;p=p.next;){var x=p.data,_=y>x.length?x.length:y;if(_===x.length?b+=x:b+=x.slice(0,y),(y-=_)===0){_===x.length?(++m,p.next?this.head=p.next:this.head=this.tail=null):(this.head=p,p.data=x.slice(_));break}++m}return this.length-=m,b}},{key:"_getBuffer",value:function(y){var p=h.allocUnsafe(y),m=this.head,b=1;for(m.data.copy(p),y-=m.data.length;m=m.next;){var x=m.data,_=y>x.length?x.length:y;if(x.copy(p,p.length-y,0,_),(y-=_)===0){_===x.length?(++b,m.next?this.head=m.next:this.head=this.tail=null):(this.head=m,m.data=x.slice(_));break}++b}return this.length-=b,p}},{key:c,value:function(y,p){return l(this,function(m){for(var b=1;b<arguments.length;b++){var x=arguments[b]!=null?arguments[b]:{};b%2?n(Object(x),!0).forEach(function(_){o(m,_,x[_])}):Object.getOwnPropertyDescriptors?Object.defineProperties(m,Object.getOwnPropertyDescriptors(x)):n(Object(x)).forEach(function(_){Object.defineProperty(m,_,Object.getOwnPropertyDescriptor(x,_))})}return m}({},p,{depth:0,customInspect:!1}))}}])&&s(v.prototype,g),f}()},{buffer:17,util:16}],63:[function(i,a,r){(function(n){(function(){function o(l,c){h(l,c),s(l)}function s(l){l._writableState&&!l._writableState.emitClose||l._readableState&&!l._readableState.emitClose||l.emit("close")}function h(l,c){l.emit("error",c)}a.exports={destroy:function(l,c){var f=this,v=this._readableState&&this._readableState.destroyed,g=this._writableState&&this._writableState.destroyed;return v||g?(c?c(l):l&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,n.nextTick(h,this,l)):n.nextTick(h,this,l)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(l||null,function(y){!c&&y?f._writableState?f._writableState.errorEmitted?n.nextTick(s,f):(f._writableState.errorEmitted=!0,n.nextTick(o,f,y)):n.nextTick(o,f,y):c?(n.nextTick(s,f),c(y)):n.nextTick(s,f)}),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(l,c){var f=l._readableState,v=l._writableState;f&&f.autoDestroy||v&&v.autoDestroy?l.destroy(c):l.emit("error",c)}}}).call(this)}).call(this,i("_process"))},{_process:50}],64:[function(i,a,r){var n=i("../../../errors").codes.ERR_STREAM_PREMATURE_CLOSE;function o(){}a.exports=function s(h,l,c){if(typeof l=="function")return s(h,null,l);l||(l={}),c=function(I){var P=!1;return function(){if(!P){P=!0;for(var M=arguments.length,L=new Array(M),U=0;U<M;U++)L[U]=arguments[U];I.apply(this,L)}}}(c||o);var f=l.readable||l.readable!==!1&&h.readable,v=l.writable||l.writable!==!1&&h.writable,g=function(){h.writable||p()},y=h._writableState&&h._writableState.finished,p=function(){v=!1,y=!0,f||c.call(h)},m=h._readableState&&h._readableState.endEmitted,b=function(){f=!1,m=!0,v||c.call(h)},x=function(I){c.call(h,I)},_=function(){var I;return f&&!m?(h._readableState&&h._readableState.ended||(I=new n),c.call(h,I)):v&&!y?(h._writableState&&h._writableState.ended||(I=new n),c.call(h,I)):void 0},k=function(){h.req.on("finish",p)};return function(I){return I.setHeader&&typeof I.abort=="function"}(h)?(h.on("complete",p),h.on("abort",_),h.req?k():h.on("request",k)):v&&!h._writableState&&(h.on("end",g),h.on("close",g)),h.on("end",b),h.on("finish",p),l.error!==!1&&h.on("error",x),h.on("close",_),function(){h.removeListener("complete",p),h.removeListener("abort",_),h.removeListener("request",k),h.req&&h.req.removeListener("finish",p),h.removeListener("end",g),h.removeListener("close",g),h.removeListener("finish",p),h.removeListener("end",b),h.removeListener("error",x),h.removeListener("close",_)}}},{"../../../errors":55}],65:[function(i,a,r){a.exports=function(){throw new Error("Readable.from is not available in the browser")}},{}],66:[function(i,a,r){var n,o=i("../../../errors").codes,s=o.ERR_MISSING_ARGS,h=o.ERR_STREAM_DESTROYED;function l(v){if(v)throw v}function c(v){v()}function f(v,g){return v.pipe(g)}a.exports=function(){for(var v=arguments.length,g=new Array(v),y=0;y<v;y++)g[y]=arguments[y];var p,m=function(x){return x.length?typeof x[x.length-1]!="function"?l:x.pop():l}(g);if(Array.isArray(g[0])&&(g=g[0]),g.length<2)throw new s("streams");var b=g.map(function(x,_){var k=_<g.length-1;return function(I,P,M,L){L=function(S){var T=!1;return function(){T||(T=!0,S.apply(void 0,arguments))}}(L);var U=!1;I.on("close",function(){U=!0}),n===void 0&&(n=i("./end-of-stream")),n(I,{readable:P,writable:M},function(S){if(S)return L(S);U=!0,L()});var $=!1;return function(S){if(!U&&!$)return $=!0,function(T){return T.setHeader&&typeof T.abort=="function"}(I)?I.abort():typeof I.destroy=="function"?I.destroy():void L(S||new h("pipe"))}}(x,k,_>0,function(I){p||(p=I),I&&b.forEach(c),k||(b.forEach(c),m(p))})});return g.reduce(f)}},{"../../../errors":55,"./end-of-stream":64}],67:[function(i,a,r){var n=i("../../../errors").codes.ERR_INVALID_OPT_VALUE;a.exports={getHighWaterMark:function(o,s,h,l){var c=function(f,v,g){return f.highWaterMark!=null?f.highWaterMark:v?f[g]:null}(s,l,h);if(c!=null){if(!isFinite(c)||Math.floor(c)!==c||c<0)throw new n(l?h:"highWaterMark",c);return Math.floor(c)}return o.objectMode?16:16384}}},{"../../../errors":55}],68:[function(i,a,r){a.exports=i("events").EventEmitter},{events:22}],69:[function(i,a,r){(r=a.exports=i("./lib/_stream_readable.js")).Stream=r,r.Readable=r,r.Writable=i("./lib/_stream_writable.js"),r.Duplex=i("./lib/_stream_duplex.js"),r.Transform=i("./lib/_stream_transform.js"),r.PassThrough=i("./lib/_stream_passthrough.js"),r.finished=i("./lib/internal/streams/end-of-stream.js"),r.pipeline=i("./lib/internal/streams/pipeline.js")},{"./lib/_stream_duplex.js":56,"./lib/_stream_passthrough.js":57,"./lib/_stream_readable.js":58,"./lib/_stream_transform.js":59,"./lib/_stream_writable.js":60,"./lib/internal/streams/end-of-stream.js":64,"./lib/internal/streams/pipeline.js":66}],70:[function(i,a,r){a.exports=function(){if(typeof arguments[0]!="function")throw new Error("callback needed");if(typeof arguments[1]!="number")throw new Error("interval needed");var n;if(arguments.length>0){n=new Array(arguments.length-2);for(var o=0;o<n.length;o++)n[o]=arguments[o+2]}return new function(s,h,l){var c=this;this._callback=s,this._args=l,this._interval=setInterval(s,h,this._args),this.reschedule=function(f){f||(f=c._interval),c._interval&&clearInterval(c._interval),c._interval=setInterval(c._callback,f,c._args)},this.clear=function(){c._interval&&(clearInterval(c._interval),c._interval=void 0)},this.destroy=function(){c._interval&&clearInterval(c._interval),c._callback=void 0,c._interval=void 0,c._args=void 0}}(arguments[0],arguments[1],n)}},{}],71:[function(i,a,r){a.exports=i("./index.js")()},{"./index.js":72}],72:[function(i,a,r){(function(n){(function(){function o(s){return s instanceof n?n.from(s):new s.constructor(s.buffer.slice(),s.byteOffset,s.length)}a.exports=function(s){return(s=s||{}).circles?function(l){var c=[],f=[];return l.proto?function g(y){if(typeof y!="object"||y===null)return y;if(y instanceof Date)return new Date(y);if(Array.isArray(y))return v(y,g);if(y instanceof Map)return new Map(v(Array.from(y),g));if(y instanceof Set)return new Set(v(Array.from(y),g));var p={};for(var m in c.push(y),f.push(p),y){var b=y[m];if(typeof b!="object"||b===null)p[m]=b;else if(b instanceof Date)p[m]=new Date(b);else if(b instanceof Map)p[m]=new Map(v(Array.from(b),g));else if(b instanceof Set)p[m]=new Set(v(Array.from(b),g));else if(ArrayBuffer.isView(b))p[m]=o(b);else{var x=c.indexOf(b);p[m]=x!==-1?f[x]:g(b)}}return c.pop(),f.pop(),p}:function g(y){if(typeof y!="object"||y===null)return y;if(y instanceof Date)return new Date(y);if(Array.isArray(y))return v(y,g);if(y instanceof Map)return new Map(v(Array.from(y),g));if(y instanceof Set)return new Set(v(Array.from(y),g));var p={};for(var m in c.push(y),f.push(p),y)if(Object.hasOwnProperty.call(y,m)!==!1){var b=y[m];if(typeof b!="object"||b===null)p[m]=b;else if(b instanceof Date)p[m]=new Date(b);else if(b instanceof Map)p[m]=new Map(v(Array.from(b),g));else if(b instanceof Set)p[m]=new Set(v(Array.from(b),g));else if(ArrayBuffer.isView(b))p[m]=o(b);else{var x=c.indexOf(b);p[m]=x!==-1?f[x]:g(b)}}return c.pop(),f.pop(),p};function v(g,y){for(var p=Object.keys(g),m=new Array(p.length),b=0;b<p.length;b++){var x=p[b],_=g[x];if(typeof _!="object"||_===null)m[x]=_;else if(_ instanceof Date)m[x]=new Date(_);else if(ArrayBuffer.isView(_))m[x]=o(_);else{var k=c.indexOf(_);m[x]=k!==-1?f[k]:y(_)}}return m}}(s):s.proto?function l(c){if(typeof c!="object"||c===null)return c;if(c instanceof Date)return new Date(c);if(Array.isArray(c))return h(c,l);if(c instanceof Map)return new Map(h(Array.from(c),l));if(c instanceof Set)return new Set(h(Array.from(c),l));var f={};for(var v in c){var g=c[v];typeof g!="object"||g===null?f[v]=g:g instanceof Date?f[v]=new Date(g):g instanceof Map?f[v]=new Map(h(Array.from(g),l)):g instanceof Set?f[v]=new Set(h(Array.from(g),l)):ArrayBuffer.isView(g)?f[v]=o(g):f[v]=l(g)}return f}:function l(c){if(typeof c!="object"||c===null)return c;if(c instanceof Date)return new Date(c);if(Array.isArray(c))return h(c,l);if(c instanceof Map)return new Map(h(Array.from(c),l));if(c instanceof Set)return new Set(h(Array.from(c),l));var f={};for(var v in c)if(Object.hasOwnProperty.call(c,v)!==!1){var g=c[v];typeof g!="object"||g===null?f[v]=g:g instanceof Date?f[v]=new Date(g):g instanceof Map?f[v]=new Map(h(Array.from(g),l)):g instanceof Set?f[v]=new Set(h(Array.from(g),l)):ArrayBuffer.isView(g)?f[v]=o(g):f[v]=l(g)}return f};function h(l,c){for(var f=Object.keys(l),v=new Array(f.length),g=0;g<f.length;g++){var y=f[g],p=l[y];typeof p!="object"||p===null?v[y]=p:p instanceof Date?v[y]=new Date(p):ArrayBuffer.isView(p)?v[y]=o(p):v[y]=c(p)}return v}}}).call(this)}).call(this,i("buffer").Buffer)},{buffer:17}],73:[function(i,a,r){var n=i("buffer"),o=n.Buffer;function s(l,c){for(var f in l)c[f]=l[f]}function h(l,c,f){return o(l,c,f)}o.from&&o.alloc&&o.allocUnsafe&&o.allocUnsafeSlow?a.exports=n:(s(n,r),r.Buffer=h),h.prototype=Object.create(o.prototype),s(o,h),h.from=function(l,c,f){if(typeof l=="number")throw new TypeError("Argument must not be a number");return o(l,c,f)},h.alloc=function(l,c,f){if(typeof l!="number")throw new TypeError("Argument must be a number");var v=o(l);return c!==void 0?typeof f=="string"?v.fill(c,f):v.fill(c):v.fill(0),v},h.allocUnsafe=function(l){if(typeof l!="number")throw new TypeError("Argument must be a number");return o(l)},h.allocUnsafeSlow=function(l){if(typeof l!="number")throw new TypeError("Argument must be a number");return n.SlowBuffer(l)}},{buffer:17}],74:[function(i,a,r){a.exports=function(n){var o=n._readableState;return o?o.objectMode||typeof n._duplexState=="number"?n.read():n.read((s=o,s.buffer.length?s.buffer.head?s.buffer.head.data.length:s.buffer[0].length:s.length)):null;var s}},{}],75:[function(i,a,r){var n=i("safe-buffer").Buffer,o=n.isEncoding||function(m){switch((m=""+m)&&m.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function s(m){var b;switch(this.encoding=function(x){var _=function(k){if(!k)return"utf8";for(var I;;)switch(k){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return k;default:if(I)return;k=(""+k).toLowerCase(),I=!0}}(x);if(typeof _!="string"&&(n.isEncoding===o||!o(x)))throw new Error("Unknown encoding: "+x);return _||x}(m),this.encoding){case"utf16le":this.text=c,this.end=f,b=4;break;case"utf8":this.fillLast=l,b=4;break;case"base64":this.text=v,this.end=g,b=3;break;default:return this.write=y,void(this.end=p)}this.lastNeed=0,this.lastTotal=0,this.lastChar=n.allocUnsafe(b)}function h(m){return m<=127?0:m>>5==6?2:m>>4==14?3:m>>3==30?4:m>>6==2?-1:-2}function l(m){var b=this.lastTotal-this.lastNeed,x=function(_,k,I){if((192&k[0])!=128)return _.lastNeed=0,"\uFFFD";if(_.lastNeed>1&&k.length>1){if((192&k[1])!=128)return _.lastNeed=1,"\uFFFD";if(_.lastNeed>2&&k.length>2&&(192&k[2])!=128)return _.lastNeed=2,"\uFFFD"}}(this,m);return x!==void 0?x:this.lastNeed<=m.length?(m.copy(this.lastChar,b,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(m.copy(this.lastChar,b,0,m.length),void(this.lastNeed-=m.length))}function c(m,b){if((m.length-b)%2==0){var x=m.toString("utf16le",b);if(x){var _=x.charCodeAt(x.length-1);if(_>=55296&&_<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=m[m.length-2],this.lastChar[1]=m[m.length-1],x.slice(0,-1)}return x}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=m[m.length-1],m.toString("utf16le",b,m.length-1)}function f(m){var b=m&&m.length?this.write(m):"";if(this.lastNeed){var x=this.lastTotal-this.lastNeed;return b+this.lastChar.toString("utf16le",0,x)}return b}function v(m,b){var x=(m.length-b)%3;return x===0?m.toString("base64",b):(this.lastNeed=3-x,this.lastTotal=3,x===1?this.lastChar[0]=m[m.length-1]:(this.lastChar[0]=m[m.length-2],this.lastChar[1]=m[m.length-1]),m.toString("base64",b,m.length-x))}function g(m){var b=m&&m.length?this.write(m):"";return this.lastNeed?b+this.lastChar.toString("base64",0,3-this.lastNeed):b}function y(m){return m.toString(this.encoding)}function p(m){return m&&m.length?this.write(m):""}r.StringDecoder=s,s.prototype.write=function(m){if(m.length===0)return"";var b,x;if(this.lastNeed){if((b=this.fillLast(m))===void 0)return"";x=this.lastNeed,this.lastNeed=0}else x=0;return x<m.length?b?b+this.text(m,x):this.text(m,x):b||""},s.prototype.end=function(m){var b=m&&m.length?this.write(m):"";return this.lastNeed?b+"\uFFFD":b},s.prototype.text=function(m,b){var x=function(k,I,P){var M=I.length-1;if(M<P)return 0;var L=h(I[M]);return L>=0?(L>0&&(k.lastNeed=L-1),L):--M<P||L===-2?0:(L=h(I[M]))>=0?(L>0&&(k.lastNeed=L-2),L):--M<P||L===-2?0:(L=h(I[M]))>=0?(L>0&&(L===2?L=0:k.lastNeed=L-3),L):0}(this,m,b);if(!this.lastNeed)return m.toString("utf8",b);this.lastTotal=x;var _=m.length-(x-this.lastNeed);return m.copy(this.lastChar,0,_),m.toString("utf8",b,_)},s.prototype.fillLast=function(m){if(this.lastNeed<=m.length)return m.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);m.copy(this.lastChar,this.lastTotal-this.lastNeed,0,m.length),this.lastNeed-=m.length}},{"safe-buffer":73}],76:[function(i,a,r){var n=i("punycode"),o=i("./util");function s(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}r.parse=I,r.resolve=function(P,M){return I(P,!1,!0).resolve(M)},r.resolveObject=function(P,M){return P?I(P,!1,!0).resolveObject(M):M},r.format=function(P){return o.isString(P)&&(P=I(P)),P instanceof s?P.format():s.prototype.format.call(P)},r.Url=s;var h=/^([a-z0-9.+-]+:)/i,l=/:[0-9]*$/,c=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,f=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r",`
- `," "]),v=["'"].concat(f),g=["%","/","?",";","#"].concat(v),y=["/","?","#"],p=/^[+a-z0-9A-Z_-]{0,63}$/,m=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,b={javascript:!0,"javascript:":!0},x={javascript:!0,"javascript:":!0},_={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},k=i("querystring");function I(P,M,L){if(P&&o.isObject(P)&&P instanceof s)return P;var U=new s;return U.parse(P,M,L),U}s.prototype.parse=function(P,M,L){if(!o.isString(P))throw new TypeError("Parameter 'url' must be a string, not "+typeof P);var U=P.indexOf("?"),$=U!==-1&&U<P.indexOf("#")?"?":"#",S=P.split($);S[0]=S[0].replace(/\\/g,"/");var T=P=S.join($);if(T=T.trim(),!L&&P.split("#").length===1){var R=c.exec(T);if(R)return this.path=T,this.href=T,this.pathname=R[1],R[2]?(this.search=R[2],this.query=M?k.parse(this.search.substr(1)):this.search.substr(1)):M&&(this.search="",this.query={}),this}var O=h.exec(T);if(O){var K=(O=O[0]).toLowerCase();this.protocol=K,T=T.substr(O.length)}if(L||O||T.match(/^\/\/[^@\/]+@[^@\/]+/)){var G=T.substr(0,2)==="//";!G||O&&x[O]||(T=T.substr(2),this.slashes=!0)}if(!x[O]&&(G||O&&!_[O])){for(var ae,V,F=-1,q=0;q<y.length;q++)(Y=T.indexOf(y[q]))!==-1&&(F===-1||Y<F)&&(F=Y);for((V=F===-1?T.lastIndexOf("@"):T.lastIndexOf("@",F))!==-1&&(ae=T.slice(0,V),T=T.slice(V+1),this.auth=decodeURIComponent(ae)),F=-1,q=0;q<g.length;q++){var Y;(Y=T.indexOf(g[q]))!==-1&&(F===-1||Y<F)&&(F=Y)}F===-1&&(F=T.length),this.host=T.slice(0,F),T=T.slice(F),this.parseHost(),this.hostname=this.hostname||"";var W=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!W)for(var J=this.hostname.split(/\./),re=(q=0,J.length);q<re;q++){var ee=J[q];if(ee&&!ee.match(p)){for(var he="",le=0,se=ee.length;le<se;le++)ee.charCodeAt(le)>127?he+="x":he+=ee[le];if(!he.match(p)){var E=J.slice(0,q),C=J.slice(q+1),D=ee.match(m);D&&(E.push(D[1]),C.unshift(D[2])),C.length&&(T="/"+C.join(".")+T),this.hostname=E.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),W||(this.hostname=n.toASCII(this.hostname));var H=this.port?":"+this.port:"",X=this.hostname||"";this.host=X+H,this.href+=this.host,W&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),T[0]!=="/"&&(T="/"+T))}if(!b[K])for(q=0,re=v.length;q<re;q++){var Q=v[q];if(T.indexOf(Q)!==-1){var ne=encodeURIComponent(Q);ne===Q&&(ne=escape(Q)),T=T.split(Q).join(ne)}}var ye=T.indexOf("#");ye!==-1&&(this.hash=T.substr(ye),T=T.slice(0,ye));var ge=T.indexOf("?");if(ge!==-1?(this.search=T.substr(ge),this.query=T.substr(ge+1),M&&(this.query=k.parse(this.query)),T=T.slice(0,ge)):M&&(this.search="",this.query={}),T&&(this.pathname=T),_[K]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){H=this.pathname||"";var xe=this.search||"";this.path=H+xe}return this.href=this.format(),this},s.prototype.format=function(){var P=this.auth||"";P&&(P=(P=encodeURIComponent(P)).replace(/%3A/i,":"),P+="@");var M=this.protocol||"",L=this.pathname||"",U=this.hash||"",$=!1,S="";this.host?$=P+this.host:this.hostname&&($=P+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&($+=":"+this.port)),this.query&&o.isObject(this.query)&&Object.keys(this.query).length&&(S=k.stringify(this.query));var T=this.search||S&&"?"+S||"";return M&&M.substr(-1)!==":"&&(M+=":"),this.slashes||(!M||_[M])&&$!==!1?($="//"+($||""),L&&L.charAt(0)!=="/"&&(L="/"+L)):$||($=""),U&&U.charAt(0)!=="#"&&(U="#"+U),T&&T.charAt(0)!=="?"&&(T="?"+T),M+$+(L=L.replace(/[?#]/g,function(R){return encodeURIComponent(R)}))+(T=T.replace("#","%23"))+U},s.prototype.resolve=function(P){return this.resolveObject(I(P,!1,!0)).format()},s.prototype.resolveObject=function(P){if(o.isString(P)){var M=new s;M.parse(P,!1,!0),P=M}for(var L=new s,U=Object.keys(this),$=0;$<U.length;$++){var S=U[$];L[S]=this[S]}if(L.hash=P.hash,P.href==="")return L.href=L.format(),L;if(P.slashes&&!P.protocol){for(var T=Object.keys(P),R=0;R<T.length;R++){var O=T[R];O!=="protocol"&&(L[O]=P[O])}return _[L.protocol]&&L.hostname&&!L.pathname&&(L.path=L.pathname="/"),L.href=L.format(),L}if(P.protocol&&P.protocol!==L.protocol){if(!_[P.protocol]){for(var K=Object.keys(P),G=0;G<K.length;G++){var ae=K[G];L[ae]=P[ae]}return L.href=L.format(),L}if(L.protocol=P.protocol,P.host||x[P.protocol])L.pathname=P.pathname;else{for(var V=(P.pathname||"").split("/");V.length&&!(P.host=V.shift()););P.host||(P.host=""),P.hostname||(P.hostname=""),V[0]!==""&&V.unshift(""),V.length<2&&V.unshift(""),L.pathname=V.join("/")}if(L.search=P.search,L.query=P.query,L.host=P.host||"",L.auth=P.auth,L.hostname=P.hostname||P.host,L.port=P.port,L.pathname||L.search){var F=L.pathname||"",q=L.search||"";L.path=F+q}return L.slashes=L.slashes||P.slashes,L.href=L.format(),L}var Y=L.pathname&&L.pathname.charAt(0)==="/",W=P.host||P.pathname&&P.pathname.charAt(0)==="/",J=W||Y||L.host&&P.pathname,re=J,ee=L.pathname&&L.pathname.split("/")||[],he=(V=P.pathname&&P.pathname.split("/")||[],L.protocol&&!_[L.protocol]);if(he&&(L.hostname="",L.port=null,L.host&&(ee[0]===""?ee[0]=L.host:ee.unshift(L.host)),L.host="",P.protocol&&(P.hostname=null,P.port=null,P.host&&(V[0]===""?V[0]=P.host:V.unshift(P.host)),P.host=null),J=J&&(V[0]===""||ee[0]==="")),W)L.host=P.host||P.host===""?P.host:L.host,L.hostname=P.hostname||P.hostname===""?P.hostname:L.hostname,L.search=P.search,L.query=P.query,ee=V;else if(V.length)ee||(ee=[]),ee.pop(),ee=ee.concat(V),L.search=P.search,L.query=P.query;else if(!o.isNullOrUndefined(P.search))return he&&(L.hostname=L.host=ee.shift(),(D=!!(L.host&&L.host.indexOf("@")>0)&&L.host.split("@"))&&(L.auth=D.shift(),L.host=L.hostname=D.shift())),L.search=P.search,L.query=P.query,o.isNull(L.pathname)&&o.isNull(L.search)||(L.path=(L.pathname?L.pathname:"")+(L.search?L.search:"")),L.href=L.format(),L;if(!ee.length)return L.pathname=null,L.search?L.path="/"+L.search:L.path=null,L.href=L.format(),L;for(var le=ee.slice(-1)[0],se=(L.host||P.host||ee.length>1)&&(le==="."||le==="..")||le==="",E=0,C=ee.length;C>=0;C--)(le=ee[C])==="."?ee.splice(C,1):le===".."?(ee.splice(C,1),E++):E&&(ee.splice(C,1),E--);if(!J&&!re)for(;E--;E)ee.unshift("..");!J||ee[0]===""||ee[0]&&ee[0].charAt(0)==="/"||ee.unshift(""),se&&ee.join("/").substr(-1)!=="/"&&ee.push("");var D,H=ee[0]===""||ee[0]&&ee[0].charAt(0)==="/";return he&&(L.hostname=L.host=H?"":ee.length?ee.shift():"",(D=!!(L.host&&L.host.indexOf("@")>0)&&L.host.split("@"))&&(L.auth=D.shift(),L.host=L.hostname=D.shift())),(J=J||L.host&&ee.length)&&!H&&ee.unshift(""),ee.length?L.pathname=ee.join("/"):(L.pathname=null,L.path=null),o.isNull(L.pathname)&&o.isNull(L.search)||(L.path=(L.pathname?L.pathname:"")+(L.search?L.search:"")),L.auth=P.auth||L.auth,L.slashes=L.slashes||P.slashes,L.href=L.format(),L},s.prototype.parseHost=function(){var P=this.host,M=l.exec(P);M&&((M=M[0])!==":"&&(this.port=M.substr(1)),P=P.substr(0,P.length-M.length)),P&&(this.hostname=P)}},{"./util":77,punycode:51,querystring:54}],77:[function(i,a,r){a.exports={isString:function(n){return typeof n=="string"},isObject:function(n){return typeof n=="object"&&n!==null},isNull:function(n){return n===null},isNullOrUndefined:function(n){return n==null}}},{}],78:[function(i,a,r){(function(n){(function(){function o(s){try{if(!n.localStorage)return!1}catch{return!1}var h=n.localStorage[s];return h!=null&&String(h).toLowerCase()==="true"}a.exports=function(s,h){if(o("noDeprecation"))return s;var l=!1;return function(){if(!l){if(o("throwDeprecation"))throw new Error(h);o("traceDeprecation")?console.trace(h):console.warn(h),l=!0}return s.apply(this,arguments)}}}).call(this)}).call(this,typeof Ot<"u"?Ot:typeof self<"u"?self:typeof window<"u"?window:{})},{}],79:[function(i,a,r){a.exports=function n(o,s){if(o&&s)return n(o)(s);if(typeof o!="function")throw new TypeError("need wrapper function");return Object.keys(o).forEach(function(l){h[l]=o[l]}),h;function h(){for(var l=new Array(arguments.length),c=0;c<l.length;c++)l[c]=arguments[c];var f=o.apply(this,l),v=l[l.length-1];return typeof f=="function"&&f!==v&&Object.keys(v).forEach(function(g){f[g]=v[g]}),f}}},{}],80:[function(i,a,r){a.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}},{}],81:[function(i,a,r){a.exports=function(){for(var o={},s=0;s<arguments.length;s++){var h=arguments[s];for(var l in h)n.call(h,l)&&(o[l]=h[l])}return o};var n=Object.prototype.hasOwnProperty},{}],82:[function(i,a,r){a.exports=function(n){n.prototype[Symbol.iterator]=function*(){for(let o=this.head;o;o=o.next)yield o.value}}},{}],83:[function(i,a,r){function n(c){var f=this;if(f instanceof n||(f=new n),f.tail=null,f.head=null,f.length=0,c&&typeof c.forEach=="function")c.forEach(function(y){f.push(y)});else if(arguments.length>0)for(var v=0,g=arguments.length;v<g;v++)f.push(arguments[v]);return f}function o(c,f,v){var g=f===c.head?new l(v,null,f,c):new l(v,f,f.next,c);return g.next===null&&(c.tail=g),g.prev===null&&(c.head=g),c.length++,g}function s(c,f){c.tail=new l(f,c.tail,null,c),c.head||(c.head=c.tail),c.length++}function h(c,f){c.head=new l(f,null,c.head,c),c.tail||(c.tail=c.head),c.length++}function l(c,f,v,g){if(!(this instanceof l))return new l(c,f,v,g);this.list=g,this.value=c,f?(f.next=this,this.prev=f):this.prev=null,v?(v.prev=this,this.next=v):this.next=null}a.exports=n,n.Node=l,n.create=n,n.prototype.removeNode=function(c){if(c.list!==this)throw new Error("removing node which does not belong to this list");var f=c.next,v=c.prev;return f&&(f.prev=v),v&&(v.next=f),c===this.head&&(this.head=f),c===this.tail&&(this.tail=v),c.list.length--,c.next=null,c.prev=null,c.list=null,f},n.prototype.unshiftNode=function(c){if(c!==this.head){c.list&&c.list.removeNode(c);var f=this.head;c.list=this,c.next=f,f&&(f.prev=c),this.head=c,this.tail||(this.tail=c),this.length++}},n.prototype.pushNode=function(c){if(c!==this.tail){c.list&&c.list.removeNode(c);var f=this.tail;c.list=this,c.prev=f,f&&(f.next=c),this.tail=c,this.head||(this.head=c),this.length++}},n.prototype.push=function(){for(var c=0,f=arguments.length;c<f;c++)s(this,arguments[c]);return this.length},n.prototype.unshift=function(){for(var c=0,f=arguments.length;c<f;c++)h(this,arguments[c]);return this.length},n.prototype.pop=function(){if(this.tail){var c=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,c}},n.prototype.shift=function(){if(this.head){var c=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,c}},n.prototype.forEach=function(c,f){f=f||this;for(var v=this.head,g=0;v!==null;g++)c.call(f,v.value,g,this),v=v.next},n.prototype.forEachReverse=function(c,f){f=f||this;for(var v=this.tail,g=this.length-1;v!==null;g--)c.call(f,v.value,g,this),v=v.prev},n.prototype.get=function(c){for(var f=0,v=this.head;v!==null&&f<c;f++)v=v.next;if(f===c&&v!==null)return v.value},n.prototype.getReverse=function(c){for(var f=0,v=this.tail;v!==null&&f<c;f++)v=v.prev;if(f===c&&v!==null)return v.value},n.prototype.map=function(c,f){f=f||this;for(var v=new n,g=this.head;g!==null;)v.push(c.call(f,g.value,this)),g=g.next;return v},n.prototype.mapReverse=function(c,f){f=f||this;for(var v=new n,g=this.tail;g!==null;)v.push(c.call(f,g.value,this)),g=g.prev;return v},n.prototype.reduce=function(c,f){var v,g=this.head;if(arguments.length>1)v=f;else{if(!this.head)throw new TypeError("Reduce of empty list with no initial value");g=this.head.next,v=this.head.value}for(var y=0;g!==null;y++)v=c(v,g.value,y),g=g.next;return v},n.prototype.reduceReverse=function(c,f){var v,g=this.tail;if(arguments.length>1)v=f;else{if(!this.tail)throw new TypeError("Reduce of empty list with no initial value");g=this.tail.prev,v=this.tail.value}for(var y=this.length-1;g!==null;y--)v=c(v,g.value,y),g=g.prev;return v},n.prototype.toArray=function(){for(var c=new Array(this.length),f=0,v=this.head;v!==null;f++)c[f]=v.value,v=v.next;return c},n.prototype.toArrayReverse=function(){for(var c=new Array(this.length),f=0,v=this.tail;v!==null;f++)c[f]=v.value,v=v.prev;return c},n.prototype.slice=function(c,f){(f=f||this.length)<0&&(f+=this.length),(c=c||0)<0&&(c+=this.length);var v=new n;if(f<c||f<0)return v;c<0&&(c=0),f>this.length&&(f=this.length);for(var g=0,y=this.head;y!==null&&g<c;g++)y=y.next;for(;y!==null&&g<f;g++,y=y.next)v.push(y.value);return v},n.prototype.sliceReverse=function(c,f){(f=f||this.length)<0&&(f+=this.length),(c=c||0)<0&&(c+=this.length);var v=new n;if(f<c||f<0)return v;c<0&&(c=0),f>this.length&&(f=this.length);for(var g=this.length,y=this.tail;y!==null&&g>f;g--)y=y.prev;for(;y!==null&&g>c;g--,y=y.prev)v.push(y.value);return v},n.prototype.splice=function(c,f,...v){c>this.length&&(c=this.length-1),c<0&&(c=this.length+c);for(var g=0,y=this.head;y!==null&&g<c;g++)y=y.next;var p=[];for(g=0;y&&g<f;g++)p.push(y.value),y=this.removeNode(y);for(y===null&&(y=this.tail),y!==this.head&&y!==this.tail&&(y=y.prev),g=0;g<v.length;g++)y=o(this,y,v[g]);return p},n.prototype.reverse=function(){for(var c=this.head,f=this.tail,v=c;v!==null;v=v.prev){var g=v.prev;v.prev=v.next,v.next=g}return this.head=f,this.tail=c,this};try{i("./iterator.js")(n)}catch{}},{"./iterator.js":82}]},{},[12])(12)})})(Qo);var jt=globalThis&&globalThis.__assign||function(){return jt=Object.assign||function(e){for(var t,i=1,a=arguments.length;i<a;i++){t=arguments[i];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},jt.apply(this,arguments)},Pt=globalThis&&globalThis.__awaiter||function(e,t,i,a){function r(n){return n instanceof i?n:new i(function(o){o(n)})}return new(i||(i=Promise))(function(n,o){function s(c){try{l(a.next(c))}catch(f){o(f)}}function h(c){try{l(a.throw(c))}catch(f){o(f)}}function l(c){c.done?n(c.value):r(c.value).then(s,h)}l((a=a.apply(e,t||[])).next())})},It=globalThis&&globalThis.__generator||function(e,t){var i={label:0,sent:function(){if(n[0]&1)throw n[1];return n[1]},trys:[],ops:[]},a,r,n,o;return o={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function s(l){return function(c){return h([l,c])}}function h(l){if(a)throw new TypeError("Generator is already executing.");for(;i;)try{if(a=1,r&&(n=l[0]&2?r.return:l[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,l[1])).done)return n;switch(r=0,n&&(l=[l[0]&2,n.value]),l[0]){case 0:case 1:n=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,r=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(n=i.trys,!(n=n.length>0&&n[n.length-1])&&(l[0]===6||l[0]===2)){i=0;continue}if(l[0]===3&&(!n||l[1]>n[0]&&l[1]<n[3])){i.label=l[1];break}if(l[0]===6&&i.label<n[1]){i.label=n[1],n=l;break}if(n&&i.label<n[2]){i.label=n[2],i.ops.push(l);break}n[2]&&i.ops.pop(),i.trys.pop();continue}l=t.call(e,i)}catch(c){l=[6,c],r=0}finally{a=n=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}},wt=globalThis&&globalThis.__values||function(e){var t=typeof Symbol=="function"&&Symbol.iterator,i=t&&e[t],a=0;if(i)return i.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},qt=globalThis&&globalThis.__read||function(e,t){var i=typeof Symbol=="function"&&e[Symbol.iterator];if(!i)return e;var a=i.call(e),r,n=[],o;try{for(;(t===void 0||t-- >0)&&!(r=a.next()).done;)n.push(r.value)}catch(s){o={error:s}}finally{try{r&&!r.done&&(i=a.return)&&i.call(a)}finally{if(o)throw o.error}}return n},bt=globalThis&&globalThis.__spreadArray||function(e,t,i){if(i||arguments.length===2)for(var a=0,r=t.length,n;a<r;a++)(n||!(a in t))&&(n||(n=Array.prototype.slice.call(t,0,a)),n[a]=t[a]);return e.concat(n||Array.prototype.slice.call(t))},LT=function(){function e(t,i){var a=this;i===void 0&&(i={}),this.penPluginMap=new Map,this.events={},this.facePen=ja,this.getWords=Xv,this.calcTextLines=Nn,this.calcTextRect=Ni,this.calcTextDrawRect=Gv,this.register=Vx,this.registerCanvasDraw=$x,this.registerAnchors=Yx,this.httpTimerList=[],this.updateTimerList=[],this.onEvent=function(r,n){switch(r){case"add":n.forEach(function(o){var s;(s=o.onAdd)===null||s===void 0||s.call(o,o)}),a.onSizeUpdate();break;case"enter":n&&n.onMouseEnter&&n.onMouseEnter(n,a.canvas.mousePos),a.store.data.locked&&a.doEvent(n,r);break;case"leave":n&&n.onMouseLeave&&n.onMouseLeave(n,a.canvas.mousePos),a.store.data.locked&&a.doEvent(n,r);break;case"active":case"inactive":a.store.data.locked&&n.forEach(function(o){a.doEvent(o,r)});break;case"click":n.pen&&n.pen.onClick&&!n.pen.disabled&&n.pen.onClick(n.pen,a.canvas.mousePos),a.store.data.locked&&n.pen&&!n.pen.disabled&&a.doEvent(n.pen,r);break;case"contextmenu":n.pen&&n.pen.onContextmenu&&!n.pen.disabled&&n.pen.onContextmenu(n.pen,a.canvas.mousePos),a.store.data.locked&&n.pen&&!n.pen.disabled&&a.doEvent(n.pen,r);break;case"mousedown":n.pen&&n.pen.onMouseDown&&!n.pen.disabled&&n.pen.onMouseDown(n.pen,a.canvas.mousePos),a.store.data.locked&&n.pen&&!n.pen.disabled&&a.doEvent(n.pen,r);break;case"mouseup":n.pen&&n.pen.onMouseUp&&!n.pen.disabled&&n.pen.onMouseUp(n.pen,a.canvas.mousePos),a.store.data.locked&&n.pen&&!n.pen.disabled&&a.doEvent(n.pen,r);break;case"dblclick":a.store.data.locked&&n.pen&&!n.pen.disabled&&a.doEvent(n.pen,r);break;case"valueUpdate":a.store.data.locked&&a.doEvent(n,r),a.canvas.tooltip.updateText(n);break;case"update":case"delete":case"translatePens":case"rotatePens":case"resizePens":a.onSizeUpdate();break;case"navigator":a.store.data.id||console.warn("\u8BF7\u5148\u4FDD\u5B58\u5F53\u524D\u56FE\u7EB8"),a.navigatorTo(n.params);break}a.store.messageEvents[r]&&a.store.messageEvents[r].forEach(function(o){var s=!1;o.event.conditions&&o.event.conditions.length?o.event.conditionType==="and"?s=o.event.conditions.every(function(h){return a.judgeCondition(o.pen,h.key,h)}):o.event.conditionType==="or"&&(s=o.event.conditions.some(function(h){return a.judgeCondition(o.pen,h.key,h)})):s=!0,s&&o.event.actions.forEach(function(h){a.events[h.action](o.pen,h)})})},this.doEvent=function(r,n){var o,s,h,l,c,f;if(!!r){var v=!1,g=[];if((o=r.events)===null||o===void 0||o.forEach(function(p,m){var b;if(p.actions&&p.actions.length){if(p.name===n){var x=!1;p.conditions&&p.conditions.length?p.conditionType==="and"?x=p.conditions.every(function($){return a.judgeCondition(r,$.key,$)}):p.conditionType==="or"&&(x=p.conditions.some(function($){return a.judgeCondition(r,$.key,$)})):x=!0,x&&g.push(m)}}else if(v=!0,a.events[p.action]&&p.name===n){var _=!(!((b=p.where)===null||b===void 0)&&b.type);if(p.where){var k=p.where,I=k.fn,P=k.fnJs,M=k.comparison,L=k.key,U=k.value;if(I)_=I(r,{meta2d:a});else if(P){try{p.where.fn=new Function("pen","context",P)}catch($){console.error("Error: make function:",$)}p.where.fn&&(_=p.where.fn(r,{meta2d:a}))}else switch(M){case">":_=r[L]>+U;break;case">=":_=r[L]>=+U;break;case"<":_=r[L]<+U;break;case"<=":_=r[L]<=+U;break;case"=":case"==":_=r[L]==U;break;case"!=":_=r[L]!=U;break;case"[)":_=Mo(+r[L],U);break;case"![)":_=!Mo(+r[L],U);break;case"[]":_=Bo(r[L],U);break;case"![]":_=!Bo(r[L],U);break}}_&&g.push(m)}}),v?(s=r.events)===null||s===void 0||s.forEach(function(p,m){g.includes(m)&&a.events[p.action](r,p)}):(h=r.events)===null||h===void 0||h.forEach(function(p,m){g.includes(m)&&p.actions.forEach(function(b){a.events[b.action]&&a.events[b.action](r,b)})}),n==="valueUpdate"){(l=r.realTimes)===null||l===void 0||l.forEach(function(p){var m,b,x=[];(m=p.triggers)===null||m===void 0||m.forEach(function(_,k){var I=!1;_.conditionType==="and"?I=_.conditions.every(function(P){return a.judgeCondition(r,p.key,P)}):_.conditionType==="or"&&(I=_.conditions.some(function(P){return a.judgeCondition(r,p.key,P)})),I&&x.push(k)}),(b=p.triggers)===null||b===void 0||b.forEach(function(_,k){var I;x.includes(k)&&((I=_.actions)===null||I===void 0||I.forEach(function(P){a.events[P.action](r,P)}))})});var y=[];(c=a.store.globalTriggers[r.id])===null||c===void 0||c.forEach(function(p,m){var b=!1;p.conditionType==="and"?b=p.conditions.every(function(x){return a.judgeCondition(a.store.pens[x.source],x.key,x)}):p.conditionType==="or"&&(b=p.conditions.some(function(x){return a.judgeCondition(a.store.pens[x.source],x.key,x)})),b&&y.push(m)}),(f=a.store.globalTriggers[r.id])===null||f===void 0||f.forEach(function(p,m){var b;y.includes(m)&&((b=p.actions)===null||b===void 0||b.forEach(function(x){a.events[x.action](r,x)}))})}a.doEvent(a.store.pens[r.parentId],n)}},this.renderPenRaw=cs,this.setElemPosition=Ai,this.setLifeCycleFunc=G2,this.store=e2(Me()),this.setOptions(i),this.setDatabyOptions(i),this.init(t),this.register(Ck()),this.registerCanvasDraw({cube:BE}),this.registerAnchors(Ak()),globalThis.meta2d=this,this.initEventFns(),this.store.emitter.on("*",this.onEvent)}return Object.defineProperty(e.prototype,"beforeAddPen",{get:function(){return this.canvas.beforeAddPen},set:function(t){this.canvas.beforeAddPen=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"beforeAddPens",{get:function(){return this.canvas.beforeAddPens},set:function(t){this.canvas.beforeAddPens=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"beforeAddAnchor",{get:function(){return this.canvas.beforeAddAnchor},set:function(t){this.canvas.beforeAddAnchor=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"beforeRemovePens",{get:function(){return this.canvas.beforeRemovePens},set:function(t){this.canvas.beforeRemovePens=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"beforeRemoveAnchor",{get:function(){return this.canvas.beforeRemoveAnchor},set:function(t){this.canvas.beforeRemoveAnchor=t},enumerable:!1,configurable:!0}),e.prototype.setOptions=function(t){var i;t===void 0&&(t={}),(t.grid!==void 0||t.gridColor!==void 0||t.gridSize!==void 0)&&this.canvas&&(this.canvas.canvasTemplate.bgPatchFlags=!0),(t.rule!==void 0||t.ruleColor!==void 0||t.ruleOptions!==void 0)&&(this.store.patchFlagsTop=!0,t.ruleOptions&&!((i=this.store.options)===null||i===void 0)&&i.ruleOptions&&(Object.assign(this.store.options.ruleOptions,t.ruleOptions),t.ruleOptions=this.store.options.ruleOptions)),t.background!==void 0&&this.canvas&&(this.canvas.canvasTemplate.bgPatchFlags=!0),t.resizeMode!==void 0&&(t.resizeMode||(this.canvas.hotkeyType=Ke.None)),(t.width!==void 0||t.height!==void 0)&&this.canvas&&(this.canvas.canvasTemplate.bgPatchFlags=!0),this.store.options=Object.assign(this.store.options,t),this.canvas&&t.scroll!==void 0&&(t.scroll?(!this.canvas.scroll&&(this.canvas.scroll=new Sg(this.canvas)),this.canvas.scroll.show()):this.canvas.scroll&&this.canvas.scroll.hide())},e.prototype.getOptions=function(){return this.store.options},e.prototype.setTheme=function(t){this.store.data.theme=t,this.setBackgroundColor(this.store.theme[t].background),this.canvas.parentElement.style.background=this.store.theme[t].parentBackground,this.store.data.color=this.store.theme[t].color,this.setOptions({ruleColor:this.store.theme[t].ruleColor,ruleOptions:this.store.theme[t].ruleOptions}),this.render()},e.prototype.setDatabyOptions=function(t){t===void 0&&(t={});var i=t.color,a=t.activeColor,r=t.activeBackground,n=t.grid,o=t.gridColor,s=t.gridSize,h=t.fromArrow,l=t.toArrow,c=t.rule,f=t.ruleColor,v=t.textColor;this.setRule({rule:c,ruleColor:f}),this.setGrid({grid:n,gridColor:o,gridSize:s}),this.store.data=Object.assign(this.store.data,{textColor:v,color:i,activeColor:a,activeBackground:r,fromArrow:h,toArrow:l})},e.prototype.init=function(t){typeof t=="string"?this.canvas=new Dd(this,document.getElementById(t),this.store):this.canvas=new Dd(this,t,this.store),this.resize(),this.canvas.listen()},e.prototype.initEventFns=function(){var t=this;this.events[dt.Link]=function(i,a){var r;if(window&&a.value&&typeof a.value=="string"){window.open(a.value,(r=a.params)!==null&&r!==void 0?r:"_blank");return}console.warn("[meta2d] Link param is not a string")},this.events[dt.SetProps]=function(i,a){var r=a.value;if(r&&typeof r=="object"){var n=a.params?t.find(a.params):t.find(i.id);n.forEach(function(o){r.hasOwnProperty("visible")&&o.visible!==r.visible&&t.setVisible(o,r.visible),t.setValue(jt({id:o.id},r),{render:!1,doEvent:!1})}),t.render();return}console.warn("[meta2d] SetProps value is not an object")},this.events[dt.StartAnimate]=function(i,a){var r=i;if(a.value&&(r=t.findOne(a.value)),!(t.store.animates.has(r)&&!r.calculative.pause)){if(a.targetType&&a.params){t.startAnimate(a.value||[i],a.params);return}if(!a.value||typeof a.value=="string"){t.startAnimate(a.value||[i]);return}console.warn("[meta2d] StartAnimate value is not a string")}},this.events[dt.PauseAnimate]=function(i,a){if(!a.value||typeof a.value=="string"){t.pauseAnimate(a.value||[i]);return}console.warn("[meta2d] PauseAnimate value is not a string")},this.events[dt.StopAnimate]=function(i,a){if(!a.value||typeof a.value=="string"){if(a.value){var r=t.findOne(a.value);if(!t.store.animates.has(r))return}else if(!t.store.animates.has(i))return;t.stopAnimate(a.value||[i]);return}console.warn("[meta2d] StopAnimate event value is not a string")},this.events[dt.StartVideo]=function(i,a){if(!a.value||typeof a.value=="string"){t.startVideo(a.value||[i]);return}console.warn("[meta2d] StartVideo value is not a string")},this.events[dt.PauseVideo]=function(i,a){if(!a.value||typeof a.value=="string"){t.pauseVideo(a.value||[i]);return}console.warn("[meta2d] PauseVideo value is not a string")},this.events[dt.StopVideo]=function(i,a){if(!a.value||typeof a.value=="string"){t.stopVideo(a.value||[i]);return}console.warn("[meta2d] StopVideo event value is not a string")},this.events[dt.JS]=function(i,a){var r;if(a.value&&!a.fn)try{if(typeof a.value!="string")throw new Error("[meta2d] Function value must be string");var n=a.value;a.fn=new Function("pen","params","context",n)}catch(o){console.error("[meta2d]: Error on make a function:",o)}(r=a.fn)===null||r===void 0||r.call(a,i,a.params,{meta2d:t,eventName:a.name})},this.events[dt.GlobalFn]=function(i,a){if(typeof a.value!="string"){console.warn("[meta2d] GlobalFn value must be a string");return}globalThis[a.value]&&globalThis[a.value](i,a.params)},this.events[dt.Emit]=function(i,a){if(typeof a.value!="string"){console.warn("[meta2d] Emit value must be a string");return}t.store.emitter.emit(a.value,{pen:i,params:a.params,eventName:a.name})},this.events[dt.SendPropData]=function(i,a){var r=ce(a.value);if(r&&typeof r=="object"){var n=a.params?t.findOne(a.params):i;for(var o in r)(r[o]===void 0||r[o]==="")&&(r[o]=n[o]);r.id=n.id,t.doSendDataEvent(r,a.extend);return}console.warn("[meta2d] SendPropData value is not an object")},this.events[dt.SendVarData]=function(i,a){var r=ce(a.value);if(r&&typeof r=="object"){var n=a.params?t.findOne(a.params):i,o=[],s=function(l){var c={dataId:l,value:r[l]};if(!c.value){var f=n.form.find(function(v){return v.dataIds&&v.dataIds.dataId===c.dataId});f&&(c.value=n[f.key])}o.push(c)};for(var h in r)s(h);t.doSendDataEvent(o,a.extend);return}console.warn("[meta2d] SendVarData value is not an object")},this.events[dt.Navigator]=function(i,a){a.value&&typeof a.value=="string"&&t.navigatorTo(a.value)},this.events[dt.Dialog]=function(i,a){a.params&&typeof a.params=="string"&&a.value&&typeof a.value=="string"&&t.canvas.dialog.show(a.value,a.params)},this.events[dt.SendData]=function(i,a){var r=ce(a.value);if(r&&typeof r=="object"&&a.targetType==="id"){var n=a.params?t.findOne(a.params):i;for(var o in r)(r[o]===void 0||r[o]==="")&&(r[o]=n[o]);r.id=n.id,t.sendDataToNetWork(r,a.network);return}},this.events[dt.PostMessage]=function(i,a){if(typeof a.value!="string"){console.warn("[meta2d] Emit value must be a string");return}var r=a.params?t.findOne(a.params):i;if(r.name!=="iframe"||!r.iframe){console.warn("\u4E0D\u662F\u5D4C\u5165\u9875\u9762");return}var n=nd(r.iframe.split("?")[1]);r.calculative.singleton.div.children[0].contentWindow.postMessage(JSON.stringify({name:a.value,id:n.id}),"*")},this.events[dt.PostMessageToParent]=function(i,a){if(typeof a.value!="string"){console.warn("[meta2d] Emit value must be a string");return}window.parent.postMessage(JSON.stringify(a.value),"*")}},e.prototype.navigatorTo=function(t){if(!!t){var i=window.location.href,a=i.split("id=");if(a.length>1){var r=a[1].indexOf("&");r===-1?window.location.href=a[0]+"id="+t:window.location.href=a[0]+"id="+t+a[1].slice(r)}}},e.prototype.doSendDataEvent=function(t,i){var a=this,r=JSON.stringify(t);this.mqttClient&&this.mqttClient.connected&&(i?i.split(",").forEach(function(n){a.mqttClient.publish(n,r)}):this.store.data.mqttTopics&&this.store.data.mqttTopics.split(",").forEach(function(n){a.mqttClient.publish(n,r)})),this.websocket&&this.websocket.readyState===1&&this.websocket.send(r),(this.store.data.https||this.store.data.http)&&this.sendDatabyHttp(r),this.store.emitter.emit("sendData",r)},e.prototype.sendDataToNetWork=function(t,i){return Pt(this,void 0,void 0,function(){var a,r,n,o,s,h,l,c,f;return It(this,function(v){switch(v.label){case 0:if(a=ce(i),a.data&&(Object.assign(a,a.data),delete a.data),!a.url)return[2];if(a.protocol!=="http")return[3,2];if(typeof a.headers=="object")for(r in a.headers)n=a.headers[r].match(new RegExp("(?<=\\$\\{).*?(?=\\})","g")),n&&(a.headers[r]=a.headers[r].replace("${"+n[0]+"}",this.getDynamicParam(n[0])));return o=void 0,a.method==="GET"&&(o="?"+Object.keys(t).map(function(g){return g+"="+t[g]}).join("&")),[4,fetch(a.url+(o||""),{headers:a.headers||{},method:a.method,body:a.method==="POST"?JSON.stringify(t):void 0})];case 1:return s=v.sent(),s.ok&&console.info("http\u6D88\u606F\u53D1\u9001\u6210\u529F"),[3,3];case 2:a.protocol==="mqtt"?(h=this.mqttClients.filter(function(g){return g.options.href===a.url}),h&&h.length?h[0].connected&&a.topics.split(",").forEach(function(g){h[0].publish(g,t)}):(l=Qo.exports.connect(a.url,a.options),l.on("connect",function(){console.info("mqtt\u8FDE\u63A5\u6210\u529F"),a.topics.split(",").forEach(function(g){l.publish(g,t),l==null||l.end()})}))):a.protocol==="websocket"&&(c=this.websockets.filter(function(g){return g.url===a.url}),c&&c.length?c[0].readyState===1&&c[0].send(t):(f=new WebSocket(a.url,a.protocols||void 0),f.onopen=function(){console.info("websocket\u8FDE\u63A5\u6210\u529F"),f.send(t),setTimeout(function(){f.close()},100)})),v.label=3;case 3:return[2]}})})},e.prototype.resize=function(t,i){this.canvas.resize(t,i),this.render(),this.store.emitter.emit("resize",{width:t,height:i}),this.canvas.scroll&&this.canvas.scroll.isShow&&this.canvas.scroll.init()},e.prototype.addPen=function(t,i,a){return a===void 0&&(a=!0),Pt(this,void 0,void 0,function(){return It(this,function(r){switch(r.label){case 0:return[4,this.canvas.addPen(t,i,a)];case 1:return[2,r.sent()]}})})},e.prototype.addPens=function(t,i){return Pt(this,void 0,void 0,function(){return It(this,function(a){switch(a.label){case 0:return[4,this.canvas.addPens(t,i)];case 1:return[2,a.sent()]}})})},e.prototype.render=function(t){var i;(i=this.canvas)===null||i===void 0||i.render(t)},e.prototype.setBackgroundImage=function(t,i){var a,r,n,o;return Pt(this,void 0,void 0,function(){function s(v){return Pt(this,void 0,void 0,function(){return It(this,function(g){return[2,new Promise(function(y){var p=new Image;p.src=v,h.store.options.cdn&&!(v.startsWith("http")||v.startsWith("//")||v.startsWith("data:image"))&&(p.src=h.store.options.cdn+v),p.crossOrigin="anonymous",p.onload=function(){y(p)}})]})})}var h,l,c,f;return It(this,function(v){switch(v.label){case 0:return h=this,this.store.data.bkImage=t,l=(i==null?void 0:i.width)||((a=this.store.data)===null||a===void 0?void 0:a.width)||((r=this.store.options)===null||r===void 0?void 0:r.width),c=(i==null?void 0:i.height)||((n=this.store.data)===null||n===void 0?void 0:n.height)||((o=this.store.options)===null||o===void 0?void 0:o.height),l&&c?(this.canvas.canvasTemplate.canvas.style.backgroundImage=null,this.canvas&&(this.canvas.canvasTemplate.bgPatchFlags=!0)):this.canvas.canvasTemplate.canvas.style.backgroundImage=t?"url('"+t+"')":"",t?[4,s(t)]:[3,2];case 1:return f=v.sent(),this.store.bkImg=f,l&&c&&this.canvas&&(this.canvas.canvasTemplate.init(),this.render()),[3,3];case 2:this.store.bkImg=null,v.label=3;case 3:return[2]}})})},e.prototype.setBackgroundColor=function(t){t===void 0&&(t=this.store.data.background),this.store.data.background=t,this.canvas&&(this.canvas.canvasTemplate.bgPatchFlags=!0)},e.prototype.setGrid=function(t){var i=t===void 0?{}:t,a=i.grid,r=a===void 0?this.store.data.grid:a,n=i.gridColor,o=n===void 0?this.store.data.gridColor:n,s=i.gridSize,h=s===void 0?this.store.data.gridSize:s,l=i.gridRotate,c=l===void 0?this.store.data.gridRotate:l;this.store.data.grid=r,this.store.data.gridColor=o,this.store.data.gridSize=h,this.store.data.gridRotate=c,this.canvas&&(this.canvas.canvasTemplate.bgPatchFlags=!0)},e.prototype.setRule=function(t){var i=t===void 0?{}:t,a=i.rule,r=a===void 0?this.store.data.rule:a,n=i.ruleColor,o=n===void 0?this.store.data.ruleColor:n;this.store.data.rule=r,this.store.data.ruleColor=o,this.store.patchFlagsTop=!0},e.prototype.open=function(t,i){var a,r,n,o,s,h,l,c,f=this;if(i===void 0&&(i=!0),this.clear(!1,t==null?void 0:t.template),this.canvas.autoPolylineFlag=!0,t){this.setBackgroundImage(t.bkImage,t),Object.assign(this.store.data,t),this.store.data.pens=[];try{for(var v=wt(t.pens),g=v.next();!g.done;g=v.next()){var y=g.value;y.id||(y.id=Me()),!y.calculative&&(y.calculative={canvas:this.canvas}),this.store.pens[y.id]=y}}catch(P){a={error:P}}finally{try{g&&!g.done&&(r=v.return)&&r.call(v)}finally{if(a)throw a.error}}try{for(var p=wt(t.pens),m=p.next();!m.done;m=p.next()){var y=m.value;this.canvas.makePen(y)}}catch(P){n={error:P}}finally{try{m&&!m.done&&(o=p.return)&&o.call(p)}finally{if(n)throw n.error}}try{for(var b=wt(t.pens),x=b.next();!x.done;x=b.next()){var y=x.value;this.canvas.updateLines(y)}}catch(P){s={error:P}}finally{try{x&&!x.done&&(h=b.return)&&h.call(b)}finally{if(s)throw s.error}}}if(this.canvas.patchFlagsLines.forEach(function(P){P.type&&f.canvas.initLineRect(P)}),this.store.data.template||(this.store.data.template=Me()),i||(this.canvas.opening=!0),this.initBindDatas(),this.initBinds(),this.initMessageEvents(),this.initGlobalTriggers(),this.render(),this.listenSocket(),this.connectSocket(),this.connectNetwork(),this.startAnimate(),this.startVideo(),this.doInitJS(),this.store.data.iconUrls)try{for(var _=wt(this.store.data.iconUrls),k=_.next();!k.done;k=_.next()){var I=k.value;u2(I,function(){f.render()})}}catch(P){l={error:P}}finally{try{k&&!k.done&&(c=_.return)&&c.call(_)}finally{if(l)throw l.error}}this.canvas.autoPolylineFlag=!1,this.store.emitter.emit("opened"),this.canvas.scroll&&this.canvas.scroll.isShow&&this.canvas.scroll.init()},e.prototype.cacheData=function(t){if(t&&this.store.options.cacheLength){var i=this.store.cacheDatas.findIndex(function(r){return r.data&&r.data._id===t});if(i===-1)this.store.cacheDatas.push({data:ce(this.store.data,!0)}),this.store.cacheDatas.length>this.store.options.cacheLength&&this.store.cacheDatas.shift();else{var a=this.store.cacheDatas.splice(i,1)[0];this.store.cacheDatas.push(a)}}},e.prototype.loadCacheData=function(t){var i=this,a=this.store.cacheDatas.findIndex(function(r){return r.data&&r.data._id===t});a!==-1&&(this.store.data=this.store.cacheDatas[a].data,this.setBackgroundImage(this.store.data.bkImage),this.store.pens={},this.store.data.pens.forEach(function(r){r.calculative.canvas=i.canvas,i.store.pens[r.id]=r,ke.path2dDraws[r.name]&&i.store.path2dMap.set(r,ke.path2dDraws[r.name](r)),r.type&&i.store.path2dMap.set(r,ke.path2dDraws[r.name](r)),r.image&&(r.calculative.imageDrawed=!1,i.canvas.loadImage(r))}),this.render())},e.prototype.initBindDatas=function(){var t=this;this.store.bindDatas={},this.store.data.pens.forEach(function(i){var a;(a=i.form)===null||a===void 0||a.forEach(function(r){var n;r.dataIds&&(Array.isArray(r.dataIds)?n=r.dataIds:n=[r.dataIds]),n==null||n.forEach(function(o){t.store.bindDatas[o.dataId]||(t.store.bindDatas[o.dataId]=[]),t.store.bindDatas[o.dataId].push({id:i.id,formItem:r})})})})},e.prototype.initBinds=function(){var t=this;this.store.bind={},this.store.data.pens.forEach(function(i){var a;(a=i.realTimes)===null||a===void 0||a.forEach(function(r){r.bind&&r.bind.id&&(t.store.bind[r.bind.id]||(t.store.bind[r.bind.id]=[]),t.store.bind[r.bind.id].push({id:i.id,key:r.key}))})})},e.prototype.connectSocket=function(){this.connectWebsocket(),this.connectMqtt(),this.connectHttp()},e.prototype.doInitJS=function(){var t=this.store.data.initJs;if(t&&t.trim())try{var i=new Function("context",t);i({meta2d:this})}catch(a){console.warn("initJs error",a)}},e.prototype.drawLine=function(t){t&&Tg(this.store),this.canvas.drawingLineName=t},e.prototype.alignPenToGrid=function(t){this.canvas.alignPenToGrid(t)},e.prototype.drawingPencil=function(){this.canvas.drawingPencil()},e.prototype.stopPencil=function(){this.canvas.stopPencil()},e.prototype.lock=function(t){this.store.data.locked=t,this.finishDrawLine(!0),this.canvas.drawingLineName="",this.stopPencil(),this.store.data.pens.forEach(function(i){i.externElement===!0&&i.onMove&&i.onMove(i)}),t>0&&this.initMessageEvents()},e.prototype.finishDrawLine=function(t){return Pt(this,void 0,void 0,function(){return It(this,function(i){switch(i.label){case 0:return[4,this.canvas.finishDrawline(t)];case 1:return i.sent(),[2]}})})},e.prototype.finishPencil=function(){return Pt(this,void 0,void 0,function(){return It(this,function(t){switch(t.label){case 0:return[4,this.canvas.finishPencil()];case 1:return t.sent(),[2]}})})},e.prototype.updateLineType=function(t,i){if(!(!t||t.name!="line"||!i||!this.canvas[i])){t.lineName=i;var a=lt(t),r=We(t);a.prev=void 0,a.next=void 0,r.prev=void 0,r.next=void 0,t.calculative.worldAnchors=[a,r],t.calculative.activeAnchor=a,this.canvas[i](this.store,t,r),t.lineName==="curve"&&(a.prev={penId:a.penId,x:a.x-50,y:a.y},a.next={penId:a.penId,x:a.x+50,y:a.y},r.prev={penId:r.penId,x:r.x-50,y:r.y},r.next={penId:r.penId,x:r.x+50,y:r.y}),t.calculative.activeAnchor=void 0,this.canvas.initLineRect(t),this.render()}},e.prototype.addDrawLineFn=function(t,i){this.canvas[t]=i,this.canvas.drawLineFns.push(t)},e.prototype.removeDrawLineFn=function(t){var i=this.canvas.drawLineFns.indexOf(t);i>-1&&this.canvas.drawLineFns.splice(i,1)},e.prototype.showMagnifier=function(){this.canvas.showMagnifier()},e.prototype.hideMagnifier=function(){this.canvas.hideMagnifier()},e.prototype.toggleMagnifier=function(){this.canvas.toggleMagnifier()},e.prototype.clear=function(t,i){var a,r,n;t===void 0&&(t=!0);try{for(var o=wt(this.store.data.pens),s=o.next();!s.done;s=o.next()){var h=s.value;(n=h.onDestroy)===null||n===void 0||n.call(h,h)}}catch(l){a={error:l}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(a)throw a.error}}t2(this.store,i),this.hideInput(),this.canvas.tooltip.hide(),this.map&&this.map.isShow&&(this.map.show(),this.map.setView()),this.canvas.clearCanvas(),sessionStorage.removeItem("page"),this.store.clipboard=void 0,this.store.sameTemplate||(this.canvas.canvasTemplate.bgPatchFlags=!0),this.store.patchFlagsBackground=!0,this.store.patchFlagsTop=!0,this.setBackgroundImage(void 0),t&&this.render()},e.prototype.emit=function(t,i){this.store.emitter.emit(t,i)},e.prototype.on=function(t,i){return this.store.emitter.on(t,i),this},e.prototype.off=function(t,i){return this.store.emitter.off(t,i),this},e.prototype.registerMoveDock=function(t){this.canvas.customMoveDock=t},e.prototype.registerResizeDock=function(t){this.canvas.customResizeDock=t},e.prototype.find=function(t){return this.canvas.find(t)},e.prototype.findOne=function(t){return this.canvas.findOne(t)},e.prototype.getPenRect=function(t){return this.canvas.getPenRect(t)},e.prototype.setPenRect=function(t,i,a){a===void 0&&(a=!0),this.canvas.setPenRect(t,i,a)},e.prototype.startAnimate=function(t,i){var a=this;this.stopAnimate(t);var r;t?typeof t=="string"?r=this.find(t):r=t:r=this.store.data.pens.filter(function(n){return(n.type||n.frames)&&n.autoPlay||n.animations&&n.animations.length&&n.animations.findIndex(function(o){return o.autoPlay})!==-1}),r.length&&(r.forEach(function(n){var o,s;if(n.calculative.pause){var h=Date.now()-n.calculative.pause;n.calculative.pause=void 0,n.calculative.frameStart+=h,n.calculative.frameEnd+=h}else{var l=-1;if(i!==void 0&&n.animations){if(typeof i=="string"){if(l=n.animations.findIndex(function(f){return f.name===i}),l===-1)return}else if(typeof i=="number")if(n.animations.length>i)l=i;else return}else i===void 0&&(l=(o=n.animations)===null||o===void 0?void 0:o.findIndex(function(f){return f.autoPlay}),l===-1&&((s=n.animations)===null||s===void 0?void 0:s.length)&&(l=0));if(l!==-1&&l!==void 0){var c=ce(n.animations[l]);delete c.name,c.currentAnimation=l,!n.type&&c.frames&&(c.showDuration=a.calcAnimateDuration(c)),a.setValue(jt({id:n.id},c),{doEvent:!1,history:!1})}a.store.animates.add(n),n.type||a.store.animateMap.set(n,n.calculative.canvas.getFrameProps(n))}}),this.initImageCanvas(r),this.canvas.animate())},e.prototype.pauseAnimate=function(t){var i=[];t?typeof t=="string"?i=this.find(t):i=t:this.store.animates.forEach(function(a){i.push(a)}),i.forEach(function(a){a.calculative.pause||(a.calculative.pause=Date.now())})},e.prototype.stopAnimate=function(t){var i=this,a=[];t?typeof t=="string"?a=this.find(t):a=t:this.store.animates.forEach(function(r){a.push(r)}),a.forEach(function(r){r.currentAnimation=void 0,r.calculative.pause=void 0,r.calculative.start=void 0,r.calculative.duration=void 0,r.calculative.animatePos=0,i.store.animates.delete(r),i.canvas.restoreNodeAnimate(r),i.canvas.updateLines(r),i.store.animateMap.delete(r)}),this.initImageCanvas(a),setTimeout(function(){var r;(r=i.canvas)===null||r===void 0||r.calcActiveRect(),i.render()},20)},e.prototype.startVideo=function(t){var i;t?typeof t=="string"?i=this.find(t):i=t:i=this.store.data.pens.filter(function(a){return(a.video||a.audio)&&a.autoPlay}),i.forEach(function(a){var r,n;(r=a.calculative.media)===null||r===void 0||r.play(),(n=a.onStartVideo)===null||n===void 0||n.call(a,a)})},e.prototype.pauseVideo=function(t){var i=[];t?typeof t=="string"?i=this.find(t):i=t:i=this.store.data.pens.filter(function(a){return(a.video||a.audio)&&a.autoPlay}),i.forEach(function(a){var r,n;(r=a.calculative.media)===null||r===void 0||r.pause(),(n=a.onPauseVideo)===null||n===void 0||n.call(a,a)})},e.prototype.stopVideo=function(t){var i=[];t?typeof t=="string"?i=this.find(t):i=t:i=this.store.data.pens.filter(function(a){return(a.video||a.audio)&&a.autoPlay}),i.forEach(function(a){var r;a.calculative.media&&(a.calculative.media.currentTime=0,a.calculative.media.pause()),(r=a.onStopVideo)===null||r===void 0||r.call(a,a)})},e.prototype.calcAnimateDuration=function(t){return t.frames.reduce(function(i,a){return i+a.duration},0)},e.prototype.combine=function(t,i){var a=this;if(t===void 0&&(t=this.store.active),!(!t||!t.length)){var r=ce(t);if(t.length===1&&t[0].type){t[0].type=Ye.Node,this.canvas.active(t),this.pushHistory({type:we.Update,initPens:r,pens:ce(t,!0)}),this.render();return}var n=Hi(t),o=jt(jt({id:Me(),name:"combine"},n),{children:[],showChild:i});this.canvas.makePen(o);var s=ce(o),h=1/0;t.forEach(function(l){var c,f=a.store.data.pens.findIndex(function(g){return g.id===l.id});if(f<h&&(h=f),!(l===o||l.parentId===o.id)){o.children.push(l.id),l.parentId=o.id;var v=Xo(l.calculative.worldRect,n);Object.assign(l,v),l.locked=(c=l.lockedOnCombine)!==null&&c!==void 0?c:ze.DisableMove}}),this.store.data.pens.splice(h,0,o),this.store.data.pens.pop(),this.canvas.active([o]),this.pushHistory({type:we.Add,pens:[s],step:3}),this.pushHistory({type:we.Update,initPens:[s],pens:[o],step:3}),this.pushHistory({type:we.Update,initPens:r,pens:t,step:3}),i!=null&&(t.forEach(function(l){Cr(l,!0)}),this.initImageCanvas([o])),this.store.emitter.emit("combine",[o]),this.render()}},e.prototype.uncombine=function(t){var i=this;if(!t&&this.store.active&&(t=this.store.active[0]),!(!t||!t.children)){var a=t.children.map(function(o){return i.store.pens[o]}),r=ce(a);a.forEach(function(o){o.parentId=void 0,o.x=o.calculative.worldRect.x,o.y=o.calculative.worldRect.y,o.width=o.calculative.worldRect.width,o.height=o.calculative.worldRect.height,o.locked=ze.None,o.calculative.active=void 0,o.calculative.hover=!1,i.setVisible(o,!0)});var n=this.isCombine(t)?3:2;this.pushHistory({type:we.Update,initPens:r,pens:a,step:n}),r=[ce(t)],t.children=void 0,this.pushHistory({type:we.Update,initPens:r,pens:[t],step:n}),this.isCombine(t)&&(this.delete([t]),this.store.histories[this.store.histories.length-1].step=n),this.inactive()}},e.prototype.appendChild=function(t){if(t===void 0&&(t=this.store.active),!!t&&!(t.length<2)){var i=t.findIndex(function(r){return r.name==="combine"&&r.showChild!==void 0});if(i!==-1){var a=t[i];this.pushChildren(a,bt(bt([],qt(t.slice(0,i)),!1),qt(t.slice(i+1)),!1)),t.forEach(function(r){Cr(r,!0)}),this.initImageCanvas(t),this.render()}else console.warn("Invalid operation!")}},e.prototype.isCombine=function(t){return!!(t.name==="combine"||t.children&&t.children.length>0)},e.prototype.active=function(t,i){i===void 0&&(i=!0),this.canvas.active(t,i)},e.prototype.inactive=function(){this.canvas.inactive()},e.prototype.activeAll=function(){this.canvas.active(this.store.data.pens.filter(function(t){return!t.parentId&&t.locked!==ze.Disable})),this.render()},e.prototype.delete=function(t,i,a){i===void 0&&(i=!1),a===void 0&&(a=!0),this.canvas.delete(t,i,a)},e.prototype.scale=function(t,i){i===void 0&&(i={x:0,y:0}),this.canvas.scale(t,i)},e.prototype.translate=function(t,i){this.canvas.translate(t,i)},e.prototype.translatePens=function(t,i,a){this.canvas.translatePens(t,i,a)},e.prototype.getParent=function(t,i){return ri(t,i)},e.prototype.data=function(){var t=ce(this.store.data),i=this.store.data,a=i.pens,r=i.paths;t.version=Yv.version,t.paths={};var n=function(s){Object.prototype.hasOwnProperty.call(r,s)&&a.find(function(h){return h.pathId===s})&&(t.paths[s]=r[s])};for(var o in r)n(o);return t.dataPoints=bt(bt([],qt(Object.keys(this.store.bind)),!1),qt(Object.keys(this.store.bindDatas)),!1),t},e.prototype.copy=function(t){this.canvas.copy(t)},e.prototype.cut=function(t){this.canvas.cut(t)},e.prototype.paste=function(){this.canvas.paste()},e.prototype.undo=function(){this.canvas.undo()},e.prototype.redo=function(){this.canvas.redo()},e.prototype.listenSocket=function(){try{var t=void 0,i=this.store.data.socketCbJs;if(i&&(t=new Function("e","context",i)),!t)return this.socketFn=null,!1;this.socketFn=t}catch(a){return console.error("Create the function for socket:",a),!1}return!0},e.prototype.connectWebsocket=function(t){var i=this;this.closeWebsocket(),t&&(this.store.data.websocket=t),this.store.data.websocket&&(this.websocket=new WebSocket(this.store.data.websocket,this.store.data.websocketProtocols||void 0),this.websocket.onmessage=function(a){i.socketCallback(a.data,{type:"websocket",url:i.store.data.websocket})},this.websocket.onclose=function(){console.info("Canvas websocket closed and reconneting..."),i.connectWebsocket()})},e.prototype.closeWebsocket=function(){this.websocket&&(this.websocket.onclose=void 0,this.websocket.close(),this.websocket=void 0)},e.prototype.connectMqtt=function(t){var i=this;this.closeMqtt(),t&&(this.store.data.mqtt=t.mqtt,this.store.data.mqttTopics=t.mqttTopics,this.store.data.mqttOptions=t.mqttOptions),this.store.data.mqtt&&(this.store.data.mqttOptions.clientId&&!this.store.data.mqttOptions.customClientId&&(this.store.data.mqttOptions.clientId=Me()),this.mqttClient=Qo.exports.connect(this.store.data.mqtt,this.store.data.mqttOptions),this.mqttClient.on("message",function(a,r){i.socketCallback(r.toString(),{topic:a,type:"mqtt",url:i.store.data.mqtt})}),this.store.data.mqttTopics&&this.mqttClient.subscribe(this.store.data.mqttTopics.split(",")))},e.prototype.closeMqtt=function(){var t;(t=this.mqttClient)===null||t===void 0||t.end()},e.prototype.connectHttp=function(){var t=this;this.closeHttp();var i=this.store.data.https;if(i)this.store.data.cancelFirstConnect||i.forEach(function(s){return Pt(t,void 0,void 0,function(){return It(this,function(h){return this.oldRequestHttp(s),[2]})})}),i.forEach(function(s,h){s.http&&(t.httpTimerList[h]=setInterval(function(){return Pt(t,void 0,void 0,function(){return It(this,function(l){return this.oldRequestHttp(s),[2]})})},s.httpTimeInterval||1e3))});else{var a=this.store.data,r=a.http,n=a.httpTimeInterval,o=a.httpHeaders;r&&(this.httpTimer=setInterval(function(){return Pt(t,void 0,void 0,function(){var s,h;return It(this,function(l){switch(l.label){case 0:return[4,fetch(r,{headers:o})];case 1:return s=l.sent(),s.ok?[4,s.text()]:[3,3];case 2:h=l.sent(),this.socketCallback(h,{type:"http",url:r}),l.label=3;case 3:return[2]}})})},n||1e3))}},e.prototype.oldRequestHttp=function(t){return Pt(this,void 0,void 0,function(){var i,a,r;return It(this,function(n){switch(n.label){case 0:return i=ce(t),i.http?[4,fetch(i.http,{headers:i.httpHeaders,method:i.method||"GET",body:i.method==="POST"?JSON.stringify(i.body):void 0})]:[3,3];case 1:return a=n.sent(),a.ok?[4,a.text()]:[3,3];case 2:r=n.sent(),this.socketCallback(r,{type:"http",url:i.http}),n.label=3;case 3:return[2]}})})},e.prototype.sendDatabyHttp=function(t){return Pt(this,void 0,void 0,function(){var i,a,r,n,o,s=this;return It(this,function(h){switch(h.label){case 0:return i=this.store.data.https,i?(i.forEach(function(l){return Pt(s,void 0,void 0,function(){var c;return It(this,function(f){switch(f.label){case 0:return l.http?[4,fetch(l.http,{method:"post",body:t,headers:l.httpHeaders})]:[3,2];case 1:c=f.sent(),c.ok&&console.info("http\u6D88\u606F\u53D1\u9001\u6210\u529F"),f.label=2;case 2:return[2]}})})}),[3,3]):[3,1];case 1:return a=this.store.data,r=a.http,n=a.httpHeaders,r?[4,fetch(r,{method:"post",body:t,headers:n})]:[3,3];case 2:o=h.sent(),o.ok&&console.info("http\u6D88\u606F\u53D1\u9001\u6210\u529F"),h.label=3;case 3:return[2]}})})},e.prototype.closeHttp=function(){clearInterval(this.httpTimer),this.httpTimer=void 0,this.httpTimerList&&this.httpTimerList.forEach(function(t){clearInterval(t),t=void 0})},e.prototype.connectNetwork=function(){var t=this;this.closeNetwork();var i=this.store.data.networks,a=[];if(i){var r=0;this.mqttClients=[];var n=0;this.websockets=[],i.forEach(function(o){o.type==="subscribe"&&(o.protocol==="mqtt"?(o.options.clientId&&!o.options.customClientId&&(o.options.clientId=Me()),t.mqttClients[r]=Qo.exports.connect(o.url,o.options),t.mqttClients[r].on("message",function(s,h){t.socketCallback(h.toString(),{topic:s,type:"mqtt",url:o.url})}),o.topics&&t.mqttClients[r].subscribe(o.topics.split(",")),r+=1):o.protocol==="websocket"?(t.websockets[n]=new WebSocket(o.url,o.protocols||void 0),t.websockets[n].onmessage=function(s){t.socketCallback(s.data,{type:"websocket",url:o.url})},n+=1):o.protocol==="http"&&a.push({url:o.url,interval:o.interval,headers:o.headers||void 0,method:o.method,body:o.body}))})}this.onNetworkConnect(a)},e.prototype.randomString=function(t){t=t||32;for(var i="ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678",a=i.length,r="",n=0;n<t;n++)r+=i.charAt(Math.floor(Math.random()*a));return r},e.prototype.penMock=function(t){var i=this,a;if(t.realTimes){var r={};if(t.realTimes.forEach(function(o){if(o.enableMock&&o.mock!==void 0)if(o.type==="float")if(o.mock&&o.mock.indexOf(",")!==-1){var s=o.mock.split(","),h=Math.floor(Math.random()*s.length);r[o.key]=parseFloat(s[h])}else if(o.mock&&o.mock.indexOf("-")!==-1){var l=void 0,c=void 0,f=void 0,s=o.mock.split("-");if(o.mock.charAt(0)==="-"?s.length===4?(l=-parseFloat(s[3]),c=-parseFloat(s[1]),f=s[3]):(l=parseFloat(s[2]),c=-parseFloat(s[1]),f=s[2]):(l=parseFloat(s[1]),c=parseFloat(s[0]),f=s[1]),(f+"").indexOf(".")!==-1){var v=(f+"").split(".")[1].length;r[o.key]=(Math.random()*(l-c)+c).toFixed(v)}else r[o.key]=Math.random()*(l-c)+c}else r[o.key]=parseFloat(o.mock);else if(o.type==="integer")if(o.mock&&o.mock.indexOf(",")!==-1){var s=o.mock.split(","),h=Math.floor(Math.random()*s.length);r[o.key]=parseInt(s[h])}else if(o.mock&&o.mock.indexOf("-")!==-1){var l=void 0,c=void 0,s=o.mock.split("-");o.mock.charAt(0)==="-"?s.length===4?(l=-parseFloat(s[3]),c=-parseFloat(s[1])):(l=parseFloat(s[2]),c=-parseFloat(s[1])):(l=parseInt(s[1]),c=parseInt(s[0])),r[o.key]=parseInt(Math.random()*(l-c)+c+"")}else r[o.key]=parseInt(o.mock);else if(o.type==="bool")typeof o.mock=="boolean"?r[o.key]=o.mock:o.mock==="true"?r[o.key]=!0:o.mock==="false"?r[o.key]=!1:r[o.key]=Math.random()<.5;else if(o.type==="object"||o.type==="array")o.mock;else if(o.mock&&o.mock.startsWith("{")&&o.mock.endsWith("}")){var g=o.mock.substring(1,o.mock.length-1),s=g.split(","),h=Math.floor(Math.random()*s.length);r[o.key]=s[h]}else if(o.mock&&o.mock.startsWith("[")&&o.mock.endsWith("]")){var f=parseInt(o.mock.substring(1,o.mock.length-1));r[o.key]=i.randomString(f)}else r[o.key]=o.mock}),Object.keys(r).length){var n=t.onBeforeValue?t.onBeforeValue(t,r):r;this.canvas.updateValue(t,n),this.store.emitter.emit("valueUpdate",t),(a=t.onValue)===null||a===void 0||a.call(t,t)}}},e.prototype.penNetwork=function(t){var i={url:t.apiUrl,method:t.apiMethod,headers:t.apiHeaders,body:t.apiBody};this.requestHttp(i),t.apiEnable?(this.store.pensNetwork||(this.store.pensNetwork={}),this.store.pensNetwork[t.id]=i):delete this.store.pensNetwork[t.id]},e.prototype.getDynamicParam=function(t){function i(n){var o,s=new RegExp("(^| )"+n+"=([^;]*)(;|$)");return(o=document.cookie.match(s))?decodeURIComponent(o[2]):""}var a=nd(),r=a[t]||localStorage[t]||i(t)||"";return r},e.prototype.onNetworkConnect=function(t){var i=this,a=this.store.data.enableMock;if(!(!(t&&t.length)&&!a)){if(this.store.pensNetwork)for(var r in this.store.pensNetwork)t.push(this.store.pensNetwork[r]);this.store.data.cancelFirstConnect||t.forEach(function(n){return Pt(i,void 0,void 0,function(){return It(this,function(o){return this.requestHttp(n),[2]})})}),a&&(this.updateTimer=setInterval(function(){i.store.data.pens.forEach(function(n){i.penMock(n)}),i.render()},this.store.data.networkInterval||1e3)),t.forEach(function(n,o){i.updateTimerList[o]=setInterval(function(){return Pt(i,void 0,void 0,function(){return It(this,function(s){return this.requestHttp(n),[2]})})},n.interval||1e3)})}},e.prototype.requestHttp=function(t){return Pt(this,void 0,void 0,function(){var i,a,r,a,r,n,o;return It(this,function(s){switch(s.label){case 0:if(i=ce(t),!i.url)return[3,3];if(typeof i.headers=="object")for(a in i.headers)typeof i.headers[a]=="string"&&(r=i.headers[a].match(new RegExp("(?<=\\$\\{).*?(?=\\})","g")),r&&(i.headers[a]=i.headers[a].replace("${"+r[0]+"}",this.getDynamicParam(r[0]))));if(typeof i.body=="object")for(a in i.body)typeof i.body[a]=="string"&&(r=i.body[a].match(new RegExp("(?<=\\$\\{).*?(?=\\})","g")),r&&(i.body[a]=i.body[a].replace("${"+r[0]+"}",this.getDynamicParam(r[0]))));return[4,fetch(i.url,{headers:i.headers,method:i.method,body:i.method==="GET"?void 0:JSON.stringify(i.body)})];case 1:return n=s.sent(),n.ok?[4,n.text()]:[3,3];case 2:o=s.sent(),this.socketCallback(o,{type:"http",url:i.url}),s.label=3;case 3:return[2]}})})},e.prototype.closeNetwork=function(){this.mqttClients&&this.mqttClients.forEach(function(t){t.end()}),this.websockets&&this.websockets.forEach(function(t){t.close()}),this.mqttClients=void 0,this.websockets=void 0,clearInterval(this.updateTimer),this.updateTimer=void 0,this.updateTimerList&&this.updateTimerList.forEach(function(t){clearInterval(t),t=void 0})},e.prototype.socketCallback=function(t,i){var a=this;this.store.emitter.emit("socket",{message:t,context:i});var r=t;if(!(this.socketFn&&(r=this.socketFn(t,{meta2d:this,type:i.type,topic:i.topic,url:i.url}),!r))){r===!0&&(r=t);var n;if(r.constructor===Object||r.constructor===Array)n=r;else if(typeof r=="string")try{n=JSON.parse(r)}catch(o){console.warn("Invalid socket data:",n,o)}else return;!n||(Array.isArray(n)||(n=[n]),n.length&&(n[0].dataId?this.setDatas(n):n.forEach(function(o){a.setValue(o)})))}},e.prototype.setDatas=function(t,i){var a=this,r=i===void 0?{}:i,n=r.render,o=n===void 0?!0:n,s=r.doEvent,h=s===void 0?!0:s,l=r.history,c=new Map;t.forEach(function(g){var y,p;(y=a.store.bindDatas[g.dataId])===null||y===void 0||y.forEach(function(m){var b,x=a.store.pens[m.id];if(!!x){var _=c.get(x);if(typeof x.onBinds=="function"){if(_)return;c.set(x,x.onBinds(x,t,m.formItem));return}_?_[m.formItem.key]=g.value:(_=(b={id:m.id},b[m.formItem.key]=g.value,b),c.set(x,_))}}),(p=a.store.bind[g.id])===null||p===void 0||p.forEach(function(m){var b,x=a.store.pens[m.id];if(!!x){var _=c.get(x);_?_[m.key]=g.value:(_=(b={id:m.id},b[m.key]=g.value,b),c.set(x,_))}})});var f,v;l&&(f=[]),c.forEach(function(g,y){a.setValue(g,{render:!1,doEvent:h,history:!1}),l&&(f.push(ce(y,!0)),v.push(y))}),o&&this.render(),l&&this.pushHistory({type:we.Update,initPens:f,pens:v})},e.prototype.setValue=function(t,i){var a=this,r=i===void 0?{}:i,n=r.render,o=n===void 0?!0:n,s=r.doEvent,h=s===void 0?!0:s,l=r.history,c=[];if(t.id){if(t.id===this.store.data.id){this.setDatabyOptions(t),t.bkImage&&this.setBackgroundImage(t.bkImage),t.background&&this.setBackgroundColor(t.background),this.render();return}var f=this.store.pens[t.id];if(f)c=[f];else{var v=this.store.bind[t.id];if(v&&v.length){c=[],this.setDatas([t],{render:o,doEvent:h,history:l});return}}}else if(t.dataId){c=[],this.setDatas([t],{render:o,doEvent:h,history:l});return}else if(t.tag)c=this.find(t.tag);else{var g=[];for(var y in t)g.push({dataId:y,id:y,value:t[y]});g.length&&this.setDatas(g,{render:o,doEvent:h,history:l});return}l=l&&!this.store.data.locked;var p;if(l&&(p=ce(c)),c.forEach(function(b){var x,_=b.onBeforeValue?b.onBeforeValue(b,t):t;t.frames&&(a.stopAnimate([b]),t.showDuration||(t.showDuration=t.frames.reduce(function(k,I){return k+I.duration},0))),su(b,_),a.canvas.updateValue(b,_),(x=b.onValue)===null||x===void 0||x.call(b,b)}),!this.store.data.locked&&this.store.active.length&&!this.canvas.movingPens&&this.canvas.calcActiveRect(),l){var m=ce(c);this.pushHistory({type:we.Update,initPens:p,pens:m})}h&&c.forEach(function(b){a.store.emitter.emit("valueUpdate",b)}),o&&this.render()},e.prototype._setValue=function(t,i){i===void 0&&(i=!1),this.setValue(t,{history:i,render:!1,doEvent:!1})},e.prototype.pushHistory=function(t){this.canvas.pushHistory(t)},e.prototype.showInput=function(t,i){this.canvas.showInput(t,i)},e.prototype.hideInput=function(){this.canvas.hideInput()},e.prototype.clearDropdownList=function(){this.canvas.clearDropdownList()},e.prototype.clearRuleLines=function(){this.canvas.clearRuleLines()},e.prototype.initGlobalTriggers=function(){var t=this,i;this.store.globalTriggers={},(i=this.store.data.triggers)===null||i===void 0||i.forEach(function(a){a.conditions.forEach(function(r){r.source&&(t.store.globalTriggers[r.source]||(t.store.globalTriggers[r.source]=[]),t.store.globalTriggers[r.source].includes(a)||t.store.globalTriggers[r.source].push(a))})})},e.prototype.initMessageEvents=function(){var t=this;this.store.messageEvents={},this.store.data.pens.forEach(function(i){var a;(a=i.events)===null||a===void 0||a.forEach(function(r){r.name==="message"&&r.message&&(t.store.messageEvents[r.message]||(t.store.messageEvents[r.message]=[]),t.store.messageEvents[r.message].push({pen:i,event:r}))})})},e.prototype.judgeCondition=function(t,i,a){var r=a.type,n=a.target,o=a.fnJs,s=a.fn,h=a.operator,l=a.valueType,c=!1;if(r==="fn"){if(s)c=s(t,{meta2d:this});else if(o){try{a.fn=new Function("pen","context",o)}catch(g){console.error("Error: make function:",g)}a.fn&&(c=a.fn(t,{meta2d:this}))}}else{var f=a.value;l==="prop"&&(f=this.store.pens[n][a.value]);var v=h2(t,i);switch(h){case">":c=v>+f;break;case">=":c=v>=+f;break;case"<":c=v<+f;break;case"<=":c=v<=+f;break;case"=":case"==":c=v==f;break;case"!=":c=v!=f;break;case"[)":c=Mo(+v,f);break;case"![)":c=!Mo(+v,f);break;case"[]":c=Bo(v,f);break;case"![]":c=!Bo(v,f);break}}return c},e.prototype.pushChildren=function(t,i){var a=this,r=[ce(t,!0)],n=[];t.children||(t.children=[]);var o=[];i.forEach(function(h){var l,c=ce(h,!0);if((!h.id||!a.store.pens[h.id])&&(a.canvas.makePen(h),c=null),h.parentId){var f=a.store.pens[h.parentId],v=f.children.findIndex(function(y){return y===h.id});r.push(ce(f,!0)),f.children.splice(v,1),o.push(ce(f,!0))}t.children.push(h.id),h.parentId=t.id;var g=Xo(h.calculative.worldRect,t.calculative.worldRect);Object.assign(h,g),h.locked=(l=h.lockedOnCombine)!==null&&l!==void 0?l:ze.DisableMove,c?(r.push(c),o.push(ce(h,!0))):n.push(ce(h,!0))}),o.push(ce(t,!0));var s=1;n.length&&(s=2,this.pushHistory({type:we.Add,pens:n,step:s})),this.pushHistory({type:we.Update,initPens:r,pens:o,step:s})},e.prototype.toPng=function(t,i,a,r){return a===void 0&&(a=!1),this.canvas.toPng(t,i,a,r)},e.prototype.activeToPng=function(t){return this.canvas.activeToPng(t)},e.prototype.pensToPng=function(t,i){return t===void 0&&(t=this.store.active),this.canvas.pensToPng(t,i)},e.prototype.downloadPng=function(t,i,a){var r,n,o=this,s;try{for(var h=wt(this.store.data.pens),l=h.next();!l.done;l=h.next()){var c=l.value;(c.calculative.img||["iframe"].includes(c.name))&&((s=c.onRenderPenRaw)===null||s===void 0||s.call(c,c))}}catch(f){r={error:f}}finally{try{l&&!l.done&&(n=h.return)&&n.call(h)}finally{if(r)throw r.error}}setTimeout(function(){var f=document.createElement("a");f.setAttribute("download",(t||o.store.data.name||"le5le.meta2d")+".png"),f.setAttribute("href",o.toPng(i,void 0,!0,a));var v=document.createEvent("MouseEvents");v.initEvent("click",!0,!0),f.dispatchEvent(v)},1e3)},e.prototype.downloadSvg=function(){var t,i;if(!window.C2S)throw console.error("\u8BF7\u5148\u52A0\u8F7D\u4E50\u543E\u4E50\u5B98\u7F51\u4E0B\u7684canvas2svg.js","https://assets.le5lecdn.com/2d/canvas2svg.js"),new Error("\u8BF7\u5148\u52A0\u8F7D\u4E50\u543E\u4E50\u5B98\u7F51\u4E0B\u7684canvas2svg.js");var a=this.getRect();a.x-=10,a.y-=10;var r=new window.C2S(a.width+20,a.height+20);r.textBaseline="middle";try{for(var n=wt(this.store.data.pens),o=n.next();!o.done;o=n.next()){var s=o.value;s.visible==!1||!hs(s,this.store)||cs(r,s,a,!0)}}catch(y){t={error:y}}finally{try{o&&!o.done&&(i=n.return)&&i.call(n)}finally{if(t)throw t.error}}var h=r.getSerializedSvg();this.store.data.background?(h=h.replace("{{bk}}",""),h=h.replace("{{bkRect}}",'<rect x="0" y="0" width="100%" height="100%" fill="'+this.store.data.background+'"></rect>')):(h=h.replace("{{bk}}",""),h=h.replace("{{bkRect}}","")),h=h.replace(/--le5le--/g,"&#x");var l=window.URL,c=new Blob([h]),f=l.createObjectURL(c),v=document.createElement("a");v.setAttribute("download",(this.store.data.name||"le5le.meta2d")+".svg"),v.setAttribute("href",f);var g=document.createEvent("MouseEvents");g.initEvent("click",!0,!0),v.dispatchEvent(g)},e.prototype.getRect=function(t){return t===void 0&&(t=this.store.data.pens),Hi(t)},e.prototype.hiddenTemplate=function(){this.canvas.canvasTemplate.hidden()},e.prototype.showTemplate=function(){this.canvas.canvasTemplate.show()},e.prototype.lockTemplate=function(t){this.store.data.pens.forEach(function(i){i.canvasLayer===Ne.CanvasTemplate&&(i.locked=t)})},e.prototype.fitView=function(t,i){if(t===void 0&&(t=!0),i===void 0&&(i=10),!!this.hasView()){var a=this.canvas.canvas,r=a.offsetWidth,n=a.offsetHeight;this.resize(r,n);var o=ar(i),s=this.getRect(),h=(r-o[1]-o[3])/s.width,l=(n-o[0]-o[2])/s.height,c=h;t?c=h>l?l:h:c=h>l?h:l,this.scale(c*this.store.data.scale),this.centerView()}},e.prototype.trimPens=function(){var t=this.store.data.pens.filter(function(i){return i.name==="line"&&i.anchors.length<2});this.delete(t)},e.prototype.fitTemplateView=function(t,i){var a=this;if(t===void 0&&(t=!0),i===void 0&&(i=10),!!this.hasView()){var r=this.canvas.canvas,n=r.offsetWidth,o=r.offsetHeight,s=ar(i),h=this.getRect(),l=(n-s[1]-s[3])/h.width,c=(o-s[0]-s[2])/h.height,f=l;t?f=l>c?c:l:f=l>c?l:c,this.canvas.templateScale(f*this.store.data.scale);var v=this.getRect(),g=this.store.data.pens.filter(function(y){return!y.parentId});this.canvas.templateTranslatePens(g,-v.x,-v.y),this.store.data.pens.forEach(function(y){y.type?a.canvas.initLineRect(y):a.canvas.updateLines(y)}),this.centerView()}},e.prototype.fitSizeView=function(t,i){t===void 0&&(t=!0),i===void 0&&(i=10);var a=this.canvas.canvas,r=a.offsetWidth,n=a.offsetHeight;this.resize(r,n);var o=ar(i),s=(this.store.data.width||this.store.options.width)*this.store.data.scale,h=(this.store.data.height||this.store.options.height)*this.store.data.scale,l=(r-o[1]-o[3])/s,c=(n-o[0]-o[2])/h,f=l;t==="width"?f=l:t==="height"?f=c:t?f=l>c?c:l:f=l>c?l:c,this.scale(f*this.store.data.scale),this.centerSizeView()},e.prototype.centerSizeView=function(){var t=this.getViewCenter(),i=this.store.data.width||this.store.options.width,a=this.store.data.height||this.store.options.height,r={x:0,y:0,width:i,height:a};tt(r);var n=r.center,o=this.store.data,s=o.scale,h=o.origin,l=o.x,c=o.y;this.translate((t.x-h.x)/s-n.x-l/s,(t.y-h.y)/s-n.y-c/s);var f=this.canvas.canvas,v=(f.scrollWidth-f.offsetWidth)/2,g=(f.scrollHeight-f.offsetHeight)/2;f.scrollTo(v,g)},e.prototype.scrollView=function(t,i){if(t===void 0&&(t=10),i===void 0&&(i=!1),!!this.hasView()&&!!this.canvas.scroll){var a=this.canvas.canvas,r=a.offsetWidth,n=a.offsetHeight;this.resize(r,n);var o=ar(t),s=this.getRect(),h=(r-o[1]-o[3])/s.width;this.scale(h*this.store.data.scale),this.topView(o[0]),i&&this.canvas.scroll.changeMode()}},e.prototype.screenView=function(t,i){if(t===void 0&&(t=10),i===void 0&&(i=!0),!!this.hasView()){var a=this.canvas.canvas,r=a.offsetWidth,n=a.offsetHeight;this.resize(r,n);var o=ar(t),s=this.getRect(),h=(r-o[1]-o[3])/s.width;i||(h=(n-o[0]-o[2])/s.height),this.scale(h*this.store.data.scale),this.topView(o[0])}},e.prototype.topView=function(t){if(t===void 0&&(t=10),!!this.hasView()){var i=this.getRect(),a=this.getViewCenter(),r=this.getPenRect(i);tt(r);var n=r.center,o=this.store.data,s=o.scale,h=o.origin,l=o.x,c=o.y;this.translate((a.x-h.x)/s-n.x-l/s,(t-h.y)/s-r.y-c/s);var f=this.canvas.canvas,v=(f.scrollWidth-f.offsetWidth)/2,g=(f.scrollHeight-f.offsetHeight)/2;f.scrollTo(v,g)}},e.prototype.centerView=function(){if(!!this.hasView()){var t=this.getRect(),i=this.getViewCenter(),a=this.getPenRect(t);tt(a);var r=a.center,n=this.store.data,o=n.scale,s=n.origin,h=n.x,l=n.y;this.translate((i.x-s.x)/o-r.x-h/o,(i.y-s.y)/o-r.y-l/o);var c=this.canvas.canvas,f=(c.scrollWidth-c.offsetWidth)/2,v=(c.scrollHeight-c.offsetHeight)/2;c.scrollTo(f,v)}},e.prototype.hasView=function(){return!!this.store.data.pens.filter(function(t){return!t.isRuleLine}).length},e.prototype.getViewCenter=function(){var t=this.canvas,i=t.width,a=t.height;return{x:i/2,y:a/2}},e.prototype.beSameByFirst=function(t,i){t===void 0&&(t=this.store.data.pens);for(var a=ce(t),r=t[0],n=this.getPenRect(r),o=n.width,s=n.height,h=1;h<t.length;h++){var l=t[h];i==="width"?this.setValue({id:l.id,width:o},{render:!1,doEvent:!1}):i==="height"?this.setValue({id:l.id,height:s},{render:!1,doEvent:!1}):this.setValue({id:l.id,width:o,height:s},{render:!1,doEvent:!1})}this.render(),this.pushHistory({type:we.Update,initPens:a,pens:t})},e.prototype.beSameByLast=function(t,i){t===void 0&&(t=this.store.data.pens);for(var a=ce(t),r=t[t.length-1],n=this.getPenRect(r),o=n.width,s=n.height,h=0;h<t.length-1;h++){var l=t[h];i==="width"?this.setValue({id:l.id,width:o},{render:!1,doEvent:!1}):i==="height"?this.setValue({id:l.id,height:s},{render:!1,doEvent:!1}):this.setValue({id:l.id,width:o,height:s},{render:!1,doEvent:!1})}this.render(),this.pushHistory({type:we.Update,initPens:a,pens:t})},e.prototype.formatPainterByFirst=function(t){t===void 0&&(t=this.store.data.pens);var i=ce(t),a=t[0],r={};hn.forEach(function(s){r[s]=a[s]});for(var n=1;n<t.length;n++){var o=t[n];this.setValue(jt({id:o.id},r),{render:!1,doEvent:!1})}this.render(),this.pushHistory({type:we.Update,initPens:i,pens:t})},e.prototype.formatPainterByLast=function(t){t===void 0&&(t=this.store.data.pens);var i=ce(t),a=t[t.length-1],r={};hn.forEach(function(s){r[s]=a[s]});for(var n=0;n<t.length-1;n++){var o=t[n];this.setValue(jt({id:o.id},r),{render:!1,doEvent:!1})}this.render(),this.pushHistory({type:we.Update,initPens:i,pens:t})},e.prototype.setFormatPainter=function(){var t=this,i=this.store.active,a={};if(i.length>0){var r=i[0];hn.forEach(function(o){a[o]=r[o]||t.store.options.defaultFormat[o]||t.store.options[o]})}else{var n={};hn.forEach(function(o){n[o]=t.store.options.defaultFormat[o]||t.store.options[o]||void 0})}localStorage.setItem("meta2d-formatPainter",JSON.stringify(a))},e.prototype.formatPainter=function(){for(var t=this.store.active,i=ce(t),a=JSON.parse(localStorage.getItem("meta2d-formatPainter")),r=0;r<t.length;r++){var n=t[r];this.setValue(jt({id:n.id},a),{render:!1,doEvent:!1})}this.render(),this.pushHistory({type:we.Update,initPens:i,pens:t})},e.prototype.clearFormatPainter=function(){var t=this,i=this.store.active,a=ce(i);hn.forEach(function(r){for(var n=0;n<i.length;n++){var o=i[n],s=t.store.options,h=s.fontSize,l=s.lineHeight;r==="lineWidth"?(o.lineWidth=1,o.calculative.lineWidth=1):r==="fontSize"?(o.fontSize=h,o.calculative.fontSize=h):r==="lineHeight"?(o.lineHeight=l,o.calculative.lineHeight=l):(delete o[r],delete o.calculative[r])}}),this.render(),this.pushHistory({type:we.Update,initPens:a,pens:i})},e.prototype.alignNodes=function(t,i,a){var r,n;i===void 0&&(i=this.store.data.pens),!a&&(a=this.getPenRect(this.getRect(i)));var o=ce(i);try{for(var s=wt(i),h=s.next();!h.done;h=s.next()){var l=h.value;this.alignPen(t,l,a)}}catch(c){r={error:c}}finally{try{h&&!h.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}this.initImageCanvas(i),this.initTemplateCanvas(i),this.render(),this.pushHistory({type:we.Update,initPens:o,pens:i})},e.prototype.alignNodesV=function(t,i){var a,r;i===void 0&&(i=this.store.data.pens);var n=this.store.data.width||this.store.options.width,o=this.store.data.height||this.store.options.height,s={x:0,y:0,width:n,height:o},h=ce(i);try{for(var l=wt(i),c=l.next();!c.done;c=l.next()){var f=c.value;this.alignPen(t,f,s)}}catch(v){a={error:v}}finally{try{c&&!c.done&&(r=l.return)&&r.call(l)}finally{if(a)throw a.error}}this.initImageCanvas(i),this.initTemplateCanvas(i),this.render(),this.pushHistory({type:we.Update,initPens:h,pens:i})},e.prototype.alignNodesByFirst=function(t,i){i===void 0&&(i=this.store.data.pens);for(var a=ce(i),r=i[0],n=this.getPenRect(r),o=1;o<i.length;o++){var s=i[o];this.alignPen(t,s,n)}this.initImageCanvas(i),this.initTemplateCanvas(i),this.render(),this.pushHistory({type:we.Update,initPens:a,pens:i})},e.prototype.alignNodesByLast=function(t,i){i===void 0&&(i=this.store.data.pens);for(var a=ce(i),r=i[i.length-1],n=this.getPenRect(r),o=0;o<i.length-1;o++){var s=i[o];this.alignPen(t,s,n)}this.initImageCanvas(i),this.initTemplateCanvas(i),this.render(),this.pushHistory({type:we.Update,initPens:a,pens:i})},e.prototype.alignPen=function(t,i,a){var r=this.getPenRect(i);switch(t){case"left":r.x=a.x;break;case"right":r.x=a.x+a.width-r.width;break;case"top":r.y=a.y;break;case"bottom":r.y=a.y+a.height-r.height;break;case"center":r.x=a.x+a.width/2-r.width/2;break;case"middle":r.y=a.y+a.height/2-r.height/2;break}this.setValue(jt({id:i.id},r),{render:!1,doEvent:!1})},e.prototype.spaceBetweenByDirection=function(t,i,a){var r,n,o=this;if(i===void 0&&(i=this.store.data.pens),!a&&(a=this.getPenRect(this.getRect(i))[t]),i=i.filter(function(m){return!m.parentId}),!(i.length<=2)){var s=ce(i),h=i.reduce(function(m,b){var x=o.getPenRect(b);return m+x[t]},0),l=(a-h)/(i.length-1);i=i.sort(function(m,b){return t==="width"?m.x-b.x:m.y-b.y});var c=this.getPenRect(i[0]),f=t==="width"?c.x:c.y;try{for(var v=wt(i),g=v.next();!g.done;g=v.next()){var y=g.value,p=this.getPenRect(y);t==="width"?p.x=f:p.y=f,f+=p[t]+l,this.setValue(jt({id:y.id},p),{render:!1,doEvent:!1})}}catch(m){r={error:m}}finally{try{g&&!g.done&&(n=v.return)&&n.call(v)}finally{if(r)throw r.error}}this.initImageCanvas(i),this.initTemplateCanvas(i),this.render(),this.pushHistory({type:we.Update,initPens:s,pens:i})}},e.prototype.spaceBetween=function(t,i){this.spaceBetweenByDirection("width",t,i)},e.prototype.spaceBetweenColumn=function(t,i){this.spaceBetweenByDirection("height",t,i)},e.prototype.layout=function(t,i,a){var r=this;t===void 0&&(t=this.store.data.pens),a===void 0&&(a=30);var n=this.getPenRect(Hi(t));!i&&(i=n.width),t=t.filter(function(c){return!c.type&&!c.parentId});var o=ce(t),s=0;t.forEach(function(c){var f=r.getPenRect(c);f.height>s&&(s=f.height)});var h=n.x,l=n.y;t.forEach(function(c,f){var v=r.getPenRect(c);if(v.x=h,v.y=l+s/2-v.height/2,r.setValue(jt({id:c.id},v),{render:!1,doEvent:!1}),f!==t.length-1){var g=h+v.width-n.x,y=r.getPenRect(t[f+1]);Math.round(i-g)>=Math.round(y.width+a)?h+=v.width+a:(h=n.x,l+=s+a)}}),this.initImageCanvas(t),this.initTemplateCanvas(t),this.render(),this.pushHistory({type:we.Update,initPens:o,pens:t})},e.prototype.gotoView=function(t){var i=this.getViewCenter(),a=i.x-t.calculative.worldRect.x-t.calculative.worldRect.width/2,r=i.y-t.calculative.worldRect.y-t.calculative.worldRect.height/2;this.canvas.scroll&&this.canvas.scroll.isShow&&this.canvas.scroll.translate(a-this.store.data.x,r-this.store.data.y),this.store.data.x=a,this.store.data.y=r,this.canvas.canvasImage.init(),this.canvas.canvasImageBottom.init(),this.render()},e.prototype.showMap=function(){this.map||(this.map=new Dk(this.canvas)),this.map.show()},e.prototype.hideMap=function(){this.map.hide()},e.prototype.onSizeUpdate=function(){var t=this;this.mapTimer&&(clearTimeout(this.mapTimer),this.mapTimer=void 0),this.mapTimer=setTimeout(function(){t.map&&t.map.isShow&&t.map.show(),t.canvas.scroll&&t.canvas.scroll.isShow&&t.canvas.scroll.resize()},500)},e.prototype.toggleAnchorMode=function(){this.canvas.toggleAnchorMode()},e.prototype.addAnchorHand=function(){this.canvas.addAnchorHand()},e.prototype.removeAnchorHand=function(){this.canvas.removeAnchorHand()},e.prototype.toggleAnchorHand=function(){this.canvas.toggleAnchorHand()},e.prototype.top=function(t){var i,a,r=this;t||(t=this.store.active),Array.isArray(t)||(t=[t]);var n=function(c){var f=o.store.data.pens,v=bt(bt([],qt(Er(c,o.store)),!1),[c],!1).map(function(y){return y.id}),g=f.filter(function(y){return v.includes(y.id)});g.forEach(function(y){var p=f.findIndex(function(m){return m.id===y.id});p>-1&&(f.push(f[p]),f.splice(p,1),r.initTemplateCanvas([y]),r.initImageCanvas([y])),r.specificLayerMove(y,"top")})},o=this;try{for(var s=wt(t),h=s.next();!h.done;h=s.next()){var l=h.value;n(l)}}catch(c){i={error:c}}finally{try{h&&!h.done&&(a=s.return)&&a.call(s)}finally{if(i)throw i.error}}this.store.emitter.emit("layer",{type:"top",pens:t})},e.prototype.initImageCanvas=function(t){this.canvas.initImageCanvas(t)},e.prototype.initTemplateCanvas=function(t){this.canvas.initTemplateCanvas(t)},e.prototype.bottom=function(t){var i,a;t||(t=this.store.active),Array.isArray(t)||(t=[t]);var r=function(l){for(var c=n.store.data.pens,f=bt(bt([],qt(Er(l,n.store)),!1),[l],!1).map(function(p){return p.id}),v=c.filter(function(p){return f.includes(p.id)}),g=function(p){var m=v[p],b=c.findIndex(function(x){return x.id===m.id});b>-1&&(c.unshift(c[b]),c.splice(b+1,1),n.initTemplateCanvas([m]),n.initImageCanvas([m])),n.specificLayerMove(m,"bottom")},y=v.length-1;y>=0;y--)g(y)},n=this;try{for(var o=wt(t),s=o.next();!s.done;s=o.next()){var h=s.value;r(h)}}catch(l){i={error:l}}finally{try{s&&!s.done&&(a=o.return)&&a.call(o)}finally{if(i)throw i.error}}this.store.emitter.emit("layer",{type:"bottom",pens:t})},e.prototype.upByArea=function(t){var i,a,r,n=this,o=this.store.data.pens.findIndex(function(b){return b.id===t.id});if(o===-1){console.warn("upByArea: pen not in canvas");return}var s=bt([t],qt(Er(t,this.store)),!1),h=s.map(function(b){return n.store.data.pens.findIndex(function(x){return x.id===b.id})});h.includes(-1)&&(console.warn("upByArea: pen children not in canvas"),h=h.filter(function(b){return b!==-1}));var l=Math.min.apply(Math,bt([],qt(h),!1)),c=t.calculative.worldRect,f=this.store.data.pens.findIndex(function(b,x){if(x<=l||b.id===t.id||g2(b,t))return!1;var _=b.calculative.worldRect;return fs(c,_)});if(f===-1){this.up(t);return}(i=this.store.data.pens).splice.apply(i,bt([f+1,0],qt(s),!1));var v=function(b){var x=g.store.data.pens.findIndex(function(_){return _.id===b.id});x>-1&&g.store.data.pens.splice(x,1)},g=this;try{for(var y=wt(s),p=y.next();!p.done;p=y.next()){var m=p.value;v(m)}}catch(b){a={error:b}}finally{try{p&&!p.done&&(r=y.return)&&r.call(y)}finally{if(a)throw a.error}}this.initImageCanvas([t])},e.prototype.specificLayerMove=function(t,i){var a;if(t.image&&t.name!=="gif"){var r=Ne.CanvasImageBottom;i==="top"?r=Ne.CanvasImage:(i==="up"||i==="down")&&(r=Ne.CanvasMain),this.setValue({id:t.id,canvasLayer:r},{render:!1,doEvent:!1,history:!1})}else if(t.externElement||t.name==="gif"){var n=1;i==="top"?(t.calculative.canvas.maxZindex+=1,n=t.calculative.canvas.maxZindex):i==="up"?n=t.calculative.zIndex===void 0?6:t.calculative.zIndex+1:i==="down"&&(n=t.calculative.zIndex===void 0?3:t.calculative.zIndex-1,n<1&&(n=1)),this.setValue({id:t.id,zIndex:n},{render:!1,doEvent:!1,history:!1}),!((a=t.calculative.singleton)===null||a===void 0)&&a.div&&Ai(t,t.calculative.singleton.div)}},e.prototype.up=function(t){var i,a,r=this;t||(t=this.store.active),Array.isArray(t)||(t=[t]);var n=function(c){var f=o.store.data.pens;if(c.children&&c.children.length){for(var v=bt(bt([],qt(Er(c,o.store)),!1),[c],!1),g=[],y=function(x){var _=f[x];v.findIndex(function(k){return k.id===_.id})!==-1&&(_.temIndex=x,g.push(_))},p=0;p<f.length;p++)y(p);var m=-1,b=0;g.forEach(function(x){x.temIndex-=b,f.splice(x.temIndex,1),b+=1,m=x.temIndex,delete x.temIndex,r.specificLayerMove(x,"up")}),f.splice.apply(f,bt([m+1,0],qt(g),!1)),o.initTemplateCanvas(g),o.initImageCanvas(g)}else{var p=f.findIndex(function(_){return _.id===c.id});p>-1&&p!==f.length-1&&(f.splice(p+2,0,f[p]),f.splice(p,1),o.initTemplateCanvas([c]),o.initImageCanvas([c])),o.specificLayerMove(c,"up")}},o=this;try{for(var s=wt(t),h=s.next();!h.done;h=s.next()){var l=h.value;n(l)}}catch(c){i={error:c}}finally{try{h&&!h.done&&(a=s.return)&&a.call(s)}finally{if(i)throw i.error}}this.store.emitter.emit("layer",{type:"up",pens:t})},e.prototype.down=function(t){var i,a,r=this;t||(t=this.store.active),Array.isArray(t)||(t=[t]);var n=function(c){var f=o.store.data.pens;if(c.children&&c.children.length){for(var v=bt(bt([],qt(Er(c,o.store)),!1),[c],!1),g=[],y=function(x){var _=f[x];v.findIndex(function(k){return k.id===_.id})!==-1&&(_.temIndex=x,g.push(_))},p=0;p<f.length;p++)y(p);var m=-1,b=0;g.forEach(function(x,_){x.temIndex-=b,f.splice(x.temIndex,1),b+=1,_===0&&(m=x.temIndex),delete x.temIndex,r.specificLayerMove(x,"down")}),f.splice.apply(f,bt([m-1,0],qt(g),!1)),o.initTemplateCanvas(g),o.initImageCanvas(g)}else{var p=f.findIndex(function(_){return _.id===c.id});p>-1&&p!==0&&(f.splice(p-1,0,f[p]),f.splice(p+1,1),o.initTemplateCanvas([c]),o.initImageCanvas([c])),o.specificLayerMove(c,"down")}},o=this;try{for(var s=wt(t),h=s.next();!h.done;h=s.next()){var l=h.value;n(l)}}catch(c){i={error:c}}finally{try{h&&!h.done&&(a=s.return)&&a.call(s)}finally{if(i)throw i.error}}this.store.emitter.emit("layer",{type:"down",pens:t})},e.prototype.setLayer=function(t,i,a){a===void 0&&(a=this.store.data.pens);var r=a.findIndex(function(n){return n.id===t.id});r>-1&&(r>i?(a.splice(i,0,a[r]),a.splice(r+1,1)):r<i&&(a.splice(i,0,a[r]),a.splice(r,1)))},e.prototype.changePenId=function(t,i){this.canvas.changePenId(t,i)},e.prototype.getLines=function(t,i){var a=this,r;if(i===void 0&&(i="all"),t.type===Ye.Line)return[];var n=[];return(r=t.connectedLines)===null||r===void 0||r.forEach(function(o){var s=o.lineId,h=a.store.pens[s];if(!h){console.warn(t,"node contain a error connectedLine");return}if(!n.find(function(l){return l.id===h.id}))switch(i){case"all":n.push(h);break;case"in":We(h).connectTo===t.id&&n.push(h);break;case"out":lt(h).connectTo===t.id&&n.push(h);break}}),n},e.prototype.nextNode=function(t){var i=this;if(t.type===Ye.Line){var a=this.store.pens[We(t).connectTo];return a?[a]:[]}else{var r=this.getLines(t,"out"),n=[];return r.forEach(function(o){var s,h,l=i.nextNode(o),c=function(y){var p=n.find(function(m){return m.id===y.id});!p&&n.push(y)};try{for(var f=wt(l),v=f.next();!v.done;v=f.next()){var g=v.value;c(g)}}catch(y){s={error:y}}finally{try{v&&!v.done&&(h=f.return)&&h.call(f)}finally{if(s)throw s.error}}}),n}},e.prototype.previousNode=function(t){var i=this;if(t.type===Ye.Line){var a=this.store.pens[lt(t).connectTo];return a?[a]:[]}else{var r=this.getLines(t,"in"),n=[];return r.forEach(function(o){var s,h,l=i.previousNode(o),c=function(y){var p=n.find(function(m){return m.id===y.id});!p&&n.push(y)};try{for(var f=wt(l),v=f.next();!v.done;v=f.next()){var g=v.value;c(g)}}catch(y){s={error:y}}finally{try{v&&!v.done&&(h=f.return)&&h.call(f)}finally{if(s)throw s.error}}}),n}},e.prototype.getNext=function(t){var i=this,a;if(t.type===Ye.Line){console.warn("\u975E\u8FDE\u7EBF\u8282\u70B9");return}var r=[];return(a=t.connectedLines)===null||a===void 0||a.forEach(function(n){var o,s,h=n.lineId,l=n.anchor,c=(o=t.anchors)===null||o===void 0?void 0:o.filter(function(m){return m.id===l})[0],f=i.findOne(h);if(f.anchors[0].connectTo==t.id){var v=f.anchors[f.anchors.length-1].connectTo;if(v){var g=i.findOne(v),y=(s=g.connectedLines)===null||s===void 0?void 0:s.filter(function(m){return m.lineId===f.id})[0],p=g.anchors.filter(function(m){return m.id===y.anchor})[0];r.push({from:t,fromAnchor:c,line:f,to:g,toAnchor:p})}}}),r},e.prototype.addAnchor=function(t,i,a){if(!!t){if(t.anchors||(t.anchors=[]),t.calculative.worldAnchors||(t.calculative.worldAnchors=[]),t.type===Ye.Line&&(a<0&&(a=t.anchors.length+1+a),a>t.anchors.length&&(a=t.anchors.length),a<0&&(a=0),a==0&&t.anchors[0].connectTo||a==t.anchors.length&&t.anchors[a-1].connectTo)){console.warn("\u7AEF\u70B9\u5B58\u5728\u8FDE\u63A5\u5173\u7CFB");return}var r=null,n=null;i.x<=1&&i.x>=0&&i.y<=1&&i.y>=0?(n={id:i.id||Me(),penId:t.id,x:t.calculative.worldRect.x+t.calculative.worldRect.width*i.x,y:t.calculative.worldRect.y+t.calculative.worldRect.height*i.y},t.calculative.worldRect&&t.rotate%360&&Ge(n,t.rotate,t.calculative.worldRect.center),r={id:n.id,penId:t.id,x:i.x,y:i.y}):(n={id:i.id||Me(),penId:t.id,x:i.x,y:i.y},t.calculative.worldRect&&(t.rotate%360&&Ge(i,-t.rotate,t.calculative.worldRect.center),r={id:n.id,penId:t.id,x:(i.x-t.calculative.worldRect.x)/t.calculative.worldRect.width,y:(i.y-t.calculative.worldRect.y)/t.calculative.worldRect.height})),t.type===Ye.Line?(t.calculative.worldAnchors.splice(a,0,n),t.anchors.splice(a,0,r),this.canvas.updateLines(t),this.canvas.initLineRect(t),this.render()):(t.calculative.worldAnchors.push(n),t.anchors.push(r))}},e.prototype.connectLine=function(t,i,a,r,n){if(n===void 0&&(n=!0),!a){var o=i.calculative.worldRect;a=Ma(t,{x:o.x+o.width/2,y:o.y+o.height/2})}if(!r){var o=t.calculative.worldRect;r=Ma(i,{x:o.x+o.width/2,y:o.y+o.height/2})}var s=Math.abs(a.x-r.x),h=Math.abs(a.y-r.y),l={height:h,lineName:"line",lineWidth:1,name:"line",type:1,width:s,x:Math.min(a.x,r.x),y:Math.min(a.y,r.y),anchors:[{x:a.x>r.x?1:0,y:a.y>r.y?1:0,id:Me()},{x:a.x>r.x?0:1,y:a.x>r.x?0:1,id:Me()}]};return this.addPens([l]),_t(t,a,l,l.calculative.worldAnchors[0]),_t(i,r,l,l.calculative.worldAnchors[1]),l.calculative.active=!1,this.canvas.updateLines(l),this.canvas.updateLines(t),this.canvas.updateLines(i),this.canvas.initLineRect(l),n&&this.render(),l},e.prototype.toComponent=function(t,i,a){if(t===void 0&&(t=this.store.data.pens),t.length===1){var r=ce(t[0]);return r.type=Ye.Node,r.id=void 0,[r]}var n=ce(t,!0),o=Hi(n),s=jt(jt({id:Me(),name:"combine"},o),{children:[],showChild:i});a&&(s.anchors=[{id:"0",penId:s.id,x:.5,y:0},{id:"1",penId:s.id,x:1,y:.5},{id:"2",penId:s.id,x:.5,y:1},{id:"3",penId:s.id,x:0,y:.5}]);var h=n.filter(function(f){return!f.parentId}),l=n.find(function(f){return f.width===o.width&&f.height===o.height}),c=l&&i===void 0;return h.length===1?s=h[0]:c&&(l.children||(l.children=[]),s=l),n.forEach(function(f){var v;if(!(f===s||f.parentId===s.id)&&!f.parentId){s.children.push(f.id),f.parentId=s.id;var g=Xo(f.calculative.worldRect,o);Object.assign(f,g),f.locked=(v=f.lockedOnCombine)!==null&&v!==void 0?v:ze.DisableMove}}),c||h.length===1?ce(n):ce(bt([s],qt(n),!1))},e.prototype.installPenPlugins=function(t,i){var a=this;if(!(!t.tag&&!t.name&&!t.id)){var r;t.id?r="id":t.tag?r="tag":t.name&&(r="name"),i.forEach(function(n){var o,s,h=n.plugin,l=n.options;if(!!h&&X2(h)&&r)if(h.install(t,l),!a.penPluginMap.has(h))a.penPluginMap.set(h,[(o={},o[r]=t[r],o.option=l,o)]);else{var c=a.penPluginMap.get(h).find(function(f){return f[r]===t[r]});c?c.option=l:a.penPluginMap.get(h).push((s={},s[r]=t[r],s.option=l,s))}})}},e.prototype.uninstallPenPlugins=function(t,i){var a=this,r;t.id?r="id":t.tag?r="tag":t.name&&(r="name"),r&&i.forEach(function(n){var o=n.plugin;o.uninstall(t,n.options);var s=a.penPluginMap.get(o),h=s.findIndex(function(l){return l[r]===t[r]});h!==-1&&(s.splice(h,1),s.length===0&&a.penPluginMap.delete(o))})},e.prototype.setVisible=function(t,i,a){var r,n;if(a===void 0&&(a=!0),this.onSizeUpdate(),this.setValue({id:t.id,visible:i},{render:!1,doEvent:!1}),t.children)try{for(var o=wt(t.children),s=o.next();!s.done;s=o.next()){var h=s.value,l=this.store.pens[h];l&&this.setVisible(l,i,!1)}}catch(f){r={error:f}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}var c=Er(t,this.store);this.initImageCanvas(c),a&&this.render()},e.prototype.clearHover=function(){this.canvas.clearHover()},e.prototype.closeSocket=function(){this.closeWebsocket(),this.closeMqtt(),this.closeHttp()},e.prototype.destroy=function(t){if(this.clear(!1),this.closeSocket(),this.closeNetwork(),this.store.emitter.all.clear(),this.canvas.destroy(),this.canvas=void 0,ke[this.store.id]=void 0,!t){for(var i in ke)delete ke[i];ke.path2dDraws={},ke.canvasDraws={},ke.anchors={},ke.htmlElements={}}},e}();function Mk(e,t){var i=t||new Path2D,a=e.calculative.worldRect,r=a.x,n=a.y,o=a.width,s=a.ey,h=o/4;if(i.moveTo(r+h,n),i.lineTo(r,n),i.lineTo(r,s),i.lineTo(r+h,s),i instanceof Path2D)return i}function Bk(e,t){var i=t||new Path2D,a=e.calculative.worldRect,r=a.x,n=a.y,o=a.width,s=a.ex,h=a.ey,l=e.offsetX,c=o/7;if(l>1?c=l:l>0&&(c=o*l),i.moveTo(r+c,n),i.lineTo(s,n),i.lineTo(r+o-c,h),i.lineTo(r,h),i.closePath(),i instanceof Path2D)return i}function Ok(e,t){var i=t||new Path2D,a=e.calculative.worldRect,r=a.x,n=a.y,o=a.width,s=a.height,h=a.ex,l=a.ey,c=o/8;if(i.moveTo(r+c,n),i.lineTo(h-c,n),i.bezierCurveTo(h+c/3,n,h+c/3,l,h-c,l),i.lineTo(r+c,l),i.lineTo(r,n+s/2),i.closePath(),i instanceof Path2D)return i}function Nk(e,t){var i=t||new Path2D,a=e.calculative.worldRect,r=a.x,n=a.y,o=a.width,s=a.height,h=a.ex,l=a.center,c=l.x,f=n+s*6/7,v=s/6;if(i.moveTo(r,n),i.lineTo(h,n),i.lineTo(h,f),i.bezierCurveTo(h-20,f-v,c+o/5,f-v,c,f),i.bezierCurveTo(c-o/5,f+v,r,f+v,r,f),i.closePath(),i instanceof Path2D)return i}function Fk(e,t){var i=t||new Path2D,a=e.calculative.worldRect,r=a.x,n=a.y,o=a.width,s=a.ex,h=a.ey,l=o/10;if(i.moveTo(r+l*2,n),i.bezierCurveTo(r-l*2/3,n,r-l*2/3,h,r+l*2,h),i.lineTo(s,h),i.bezierCurveTo(s-l,h,s-l,n,s,n),i.closePath(),i instanceof Path2D)return i}function zk(e,t){var i=t||new Path2D,a=e.calculative.worldRect,r=a.x,n=a.y,o=a.width,s=a.ex,h=a.ey;i.moveTo(r,n),i.lineTo(s,n),i.lineTo(s,h),i.lineTo(r,h),i.closePath();var l=o/7;if(i.moveTo(r,n+l),i.lineTo(s,n+l),i.moveTo(r+l,n),i.lineTo(r+l,h),i instanceof Path2D)return i}function Hk(e,t){var i=t||new Path2D,a=e.calculative.worldRect,r=a.x,n=a.y,o=a.height,s=a.ex,h=a.ey,l=o/4;if(i.moveTo(r,n+l),i.lineTo(s,n),i.lineTo(s,h),i.lineTo(r,h),i.closePath(),i instanceof Path2D)return i}function Uk(e,t){var i=t||new Path2D,a=e.calculative.worldRect,r=a.x,n=a.y,o=a.ex,s=a.ey;if(i.moveTo(r,n),i.lineTo(o,n),i.moveTo(r,s),i.lineTo(o,s),i instanceof Path2D)return i}function Wk(e,t){var i=t||new Path2D,a=e.calculative.worldRect,r=a.x,n=a.y,o=a.width,s=a.height,h=a.ex,l=a.ey;if(i.ellipse(r+o/2,n+s/2,o/2,s/2,0,0,Math.PI*2),i.moveTo(r+o/2,l),i.lineTo(h,l),i.closePath(),i instanceof Path2D)return i}function qk(e,t){var i=t||new Path2D,a=e.calculative.worldRect,r=a.x,n=a.y,o=a.width,s=a.ex,h=a.ey,l=o/7;if(i.moveTo(r,n),i.lineTo(s,n),i.lineTo(s,h),i.lineTo(r,h),i.closePath(),i.moveTo(r+l,n),i.lineTo(r+l,h),i.moveTo(s-l,n),i.lineTo(s-l,h),i instanceof Path2D)return i}function jk(e,t){var i=t||new Path2D,a=e.calculative.worldRect,r=a.x,n=a.y,o=a.height,s=a.ex,h=a.ey,l=o/7;if(i.moveTo(r,n+l),i.bezierCurveTo(r,n-l/2|0,s,n-l/2|0,s,n+l),i.lineTo(s,h-l),i.bezierCurveTo(s,h+l/2|0,r,h+l/2|0,r,h-l),i.closePath(),i.moveTo(r,h-l),i.bezierCurveTo(r,h-l*2|0,s,h-l*2|0,s,h-l),i instanceof Path2D)return i}function DT(){return{flowComment:Mk,flowData:Bk,flowDb:jk,flowDisplay:Ok,flowDocument:Nk,flowExternStorage:Fk,flowInternalStorage:zk,flowManually:Hk,flowParallel:Uk,flowQueue:Wk,flowSubprocess:qk}}globalThis&&globalThis.__values;var gs;(function(e){e[e.Add=0]="Add",e[e.Replace=1]="Replace",e[e.ReplaceAll=2]="ReplaceAll"})(gs||(gs={}));function Rg(e,t){var i=t.calculative.worldRect.height*14/16,a=e.match(/[\u4e00-\u9fa5]/g)||"",r=a.length,n=(e.length-r)*i*.6+r*i;return n}function Pg(e){if(e.direction=="horizontal"){var t=[],i=0,a=e.height;e.checkboxHeight=a,e.options.forEach(function(s,h){t.push(h*(40+a)+i),i+=Rg(s.text,e)}),e.optionPos=t;var r=t.length*(40+a)+i;e.checkboxWidth=r,e.width=r,e.calculative.width=r,e.calculative.worldRect={x:e.x,y:e.y,height:e.height,width:e.width,center:{x:e.x+e.width/2,y:e.y+e.height/2}},ot(e.calculative.worldRect)}else if(e.direction=="vertical"){e.optionInterval==null&&(e.optionInterval=20),e.optionHeight||(e.optionHeight=20);var n=[];e.options.forEach(function(s,h){n.push(h*(e.optionInterval+e.optionHeight))}),e.optionPos=n;var o=n[n.length-1]+e.optionHeight;e.checkboxHeight=o,e.width||(e.height=o,e.calculative.height=o,e.calculative.worldRect={x:e.x,y:e.y,height:e.height,width:e.width,center:{x:e.x+e.width/2,y:e.y+e.height/2}},ot(e.calculative.worldRect))}}globalThis&&globalThis.__values;function Kk(e,t){t.onClick||(t.onClick=Vk);var i=t.calculative.worldRect.x,a=t.calculative.worldRect.y,r=t.calculative.worldRect.width,n=t.calculative.worldRect.height;r<n*1.5&&(r=1.5*n),e.beginPath(),e.arc(i+n/2,a+n/2,n/2,Math.PI/2,Math.PI*3/2),e.lineTo(i+r-n/2,a),e.arc(i+r-n/2,a+n/2,n/2,-Math.PI/2,Math.PI/2),e.lineTo(i+n/2,a+n),t.checked?(e.fillStyle=t.onColor,(t.disabled||t.disable)&&(e.fillStyle=t.disableOnColor||Ft(.6,t.onColor)),e.fill(),e.closePath(),e.beginPath(),e.fillStyle="#ffffff",e.moveTo(i+n*2,a+n/2),e.arc(i+r-n/2,a+n/2,n/2>2?n/2-2:1,0,Math.PI*2),e.fill()):(e.fillStyle=t.offColor,(t.disabled||t.disable)&&(e.fillStyle=t.disableOffColor||Ft(.6,t.offColor)),e.fill(),e.closePath(),e.beginPath(),e.fillStyle="#ffffff",e.moveTo(i+n,a+n/2),e.arc(i+n/2,a+n/2,n/2>2?n/2-2:1,0,Math.PI*2),e.fill()),e.closePath()}function Vk(e){e.disabled||e.disable||(e.checked=!e.checked,e.calculative.canvas.store.emitter.emit("valueUpdate",e),e.calculative.canvas.render())}function $k(e,t){t.onAdd||(t.onAdd=mn,t.onResize=mn,t.onMove=mn,t.onMouseMove=Yk,t.onMouseDown=Ig,t.onValue=Gk,t.onBeforeValue=Xk),t.calculative.barRect||mn(t),t.calculative.canvas.store.data;var i=t.calculative.canvas.store.options,a=t.background;t.disabled&&(a=t.disabledBackground||Ft(.6,a)),e.fillStyle=a,e.beginPath();var r=t.calculative.worldRect.x+t.calculative.barRect.x,n=t.calculative.worldRect.y+t.calculative.barRect.y,o=t.calculative.barRect.width,s=t.calculative.barRect.height,h=s/2;e.moveTo(r+h,n),e.arcTo(r+o,n,r+o,n+s,h),e.arcTo(r+o,n+s,r,n+s,h),e.arcTo(r,n+s,t.x,t.y,h),e.arcTo(r,n,r+o,n,h),e.fill();var l=t.activeColor||i.activeColor;t.disabled&&(l=t.disabledColor||Ft(.6,l)),e.fillStyle=l,e.beginPath(),o=t.calculative.ballRect.x,e.moveTo(r+h,n),e.arcTo(r+o,n,r+o,n+s,h),e.arcTo(r+o,n+s,r,n+s,h),e.arcTo(r,n+s,t.x,t.y,h),e.arcTo(r,n,r+o,n,h),e.fill(),e.fillStyle=t.btnBackground||"#fff",e.strokeStyle=l,e.lineWidth=2,e.beginPath(),r=t.calculative.worldRect.x+t.calculative.ballRect.x,n=t.calculative.worldRect.y+t.calculative.ballRect.y+t.calculative.ballRect.height/2,e.lineWidth=t.calculative.ballRect.width/10,e.arc(r,n,t.calculative.ballRect.width/2,0,Math.PI*2),e.fill(),e.stroke()}function mn(e){if(e._textWidth||(e._textWidth=e.textWidth||50,e._fontSize=e.fontSize||12),e.textWidth=e.calculative.worldRect.width,e.calculative.textWidth=e.textWidth,e.unit||(e.unit="%"),e.sliderWidth||(e.sliderWidth=e.width),e.sliderHeight||(e.sliderHeight=e.height),!!e.calculative.worldRect){var t=e.calculative.worldRect.width/e.sliderWidth,i=e.calculative.worldRect.height/e.sliderHeight,a=Math.min(t,i);e.fontSize=e._fontSize*a;var r=e.calculative.worldRect.width-e._textWidth*a;e.textLeft=r+10*a,e.calculative.textLeft=e.textLeft,e.calculative.barRect={x:0,y:(e.calculative.worldRect.height-e.barHeight*i)/2,width:r,height:e.barHeight*i},ot(e.calculative.barRect),cu(e)}}function cu(e){var t=e.calculative.barRect.height*3.5,i=e.calculative.barRect.width*e.value/100;e.calculative.ballRect={x:i,y:(e.calculative.worldRect.height-t)/2,width:t,height:t},ot(e.calculative.ballRect),e.calculative.text=e.value+e.unit,Ni(e)}function Ig(e,t){if(!e.disabled){var i=t.x-e.calculative.worldRect.x;if(!(i>e.calculative.barRect.width)){var a=Math.round(i/e.calculative.barRect.width*100);a<e.min||a>e.max||a<0||a>100||(e.value=a,cu(e),e.calculative.text=e.value+e.unit,Ni(e),e.calculative.canvas.store.emitter.emit("valueUpdate",e),e.calculative.canvas.render())}}}function Yk(e,t){e.calculative.canvas.mouseDown&&Ig(e,t)}function Gk(e){e.calculative.isUpdateData&&(delete e.calculative.isUpdateData,mn(e)),cu(e)}function Xk(e,t){return e.calculative.isUpdateData=!1,(t.textWidth||t.barHeight)&&(t.textWidth&&(e._textWidth=0),e.calculative.isUpdateData=!0),t}function Zk(e,t){t.onMouseDown||(t.onMouseDown=Qk);var i=t.calculative.worldRect.x,a=t.calculative.worldRect.y,r=t.calculative.worldRect.height;t.calculative.worldRect.width;var n=t.calculative,o=n.fontStyle,s=n.fontWeight,h=n.fontSize,l=n.fontFamily,c=n.lineHeight,f=2;e.beginPath(),e.moveTo(i,a),e.arcTo(i+r,a,i+r,a+r,f),e.arcTo(i+r,a+r,i,a+r,f),e.arcTo(i,a+r,i,a,f),e.arcTo(i,a,i+r,a,f),e.strokeStyle="#d9d9d9",e.fillStyle="#ffffff00",t.checked&&(e.fillStyle=t.background||"#1890ff",e.strokeStyle=t.background||"#1890ff"),(t.isForbidden||t.disabled)&&(e.fillStyle=t.disabledBackground||Ft(.6,t.background)||"#ebebeb",e.strokeStyle=t.disabledColor||Ft(.6,t.color)||"#d9d9d9"),e.closePath(),e.fill(),e.stroke(),e.save(),t.checked&&(e.beginPath(),e.lineWidth=r/10,e.strokeStyle="#ffffff",e.moveTo(i+102/506*r,a+r/2),e.lineTo(i+220/506*r,a+346/460*r),e.lineTo(i+404/506*r,a+142/460*r),e.stroke()),e.restore(),e.save(),e.fillStyle=t.disabled||t.isForbidden?t.disabledTextColor||Ft(.6,t.textColor||t.color)||"#00000040":Ir(t,t.calculative.canvas.parent.store)||"#000000d9",e.textAlign="start",e.textBaseline="middle",e.font=Lr({fontStyle:o,fontWeight:s,fontFamily:l||t.calculative.canvas.parent.store.options.fontFamily,fontSize:h,lineHeight:c}),e.fillText(t.value+"",i+r+10,a+r/2),e.restore()}function Qk(e,t){e.isForbidden||(e.checked=!e.checked,e.calculative.canvas.store.emitter.emit("valueUpdate",e),e.calculative.canvas.render())}function Jk(e,t){t.onAdd||(t.onAdd=eC,t.optionPos||(t.onAdd(t),t.calculative.canvas.parent.active([t])),t.onMouseDown=tC,t.onValue=iC);var i=t.calculative.worldRect.x,a=t.calculative.worldRect.y,r=t.calculative.worldRect.height,n=t.calculative.worldRect.width;if(!!t.optionPos){var o=t.calculative,s=o.fontStyle,h=o.fontWeight;o.fontSize;var l=o.fontFamily,c=o.lineHeight;if(t.direction=="horizontal")for(var f=0;f<t.optionPos.length;f++){var v=t.optionPos[f]*n/t.checkboxWidth,g=t.options[f].isForbidden||t.disabled;e.beginPath(),e.arc(i+v+r/2,a+r/2,r/2,0,Math.PI*2),e.strokeStyle="#d9d9d9",e.fillStyle="#ffffff00",t.options[f].text===t.checked&&(e.strokeStyle=t.options[f].background||t.background||"#1890ff"),g&&(e.fillStyle=t.disabledBackground||Ft(.6,t.background)||"#ebebeb",e.strokeStyle=t.disabledColor||Ft(.6,t.color)||"#d9d9d9",t.options[f].text===t.checked&&(e.fillStyle="#ffffff00")),e.closePath(),e.fill(),e.stroke(),e.save(),t.options[f].text===t.checked&&(e.beginPath(),e.strokeStyle=t.options[f].background?t.options[f].background+"20":t.background||"#1890ff20",g&&(e.strokeStyle=t.disabledBackground||Ft(.6,t.background)||"#ebebeb"),e.arc(i+r/2+v,a+r/2,r/2+1.5,0,Math.PI*2),e.stroke(),e.closePath(),e.beginPath(),e.fillStyle=t.options[f].background||t.background||"#1890ff",g&&(e.fillStyle=t.disabledBackground||Ft(.6,t.background)||"#ebebeb"),e.arc(i+r/2+v,a+r/2,r/4,0,Math.PI*2),e.fill(),e.closePath()),e.restore(),e.save(),e.fillStyle=g?t.disabledTextColor||"#00000040":Ir(t,t.calculative.canvas.parent.store)||"#000000d9";var y=t.calculative.worldRect.height*14/16;e.textAlign="start",e.textBaseline="middle",e.font=Lr({fontStyle:s,fontWeight:h,fontFamily:l||t.calculative.canvas.parent.store.options.fontFamily,fontSize:y,lineHeight:c}),e.fillText(t.options[f].text,i+r+v+10/t.checkboxWidth*n,a+r/2),e.restore()}else if(t.direction=="vertical")for(var p=t.optionHeight*r/t.checkboxHeight,f=0;f<t.optionPos.length;f++){var v=t.optionPos[f]*r/t.checkboxHeight,g=t.options[f].isForbidden;e.beginPath(),e.arc(i+p/2,a+p/2+v,p/2,0,Math.PI*2),e.strokeStyle="#d9d9d9",e.fillStyle="#ffffff00",t.options[f].text===t.checked&&(e.strokeStyle=t.options[f].background||"#1890ff"),g&&(e.fillStyle="#ebebeb",e.strokeStyle="#d9d9d9"),e.closePath(),e.fill(),e.stroke(),e.save(),!g&&t.options[f].text===t.checked&&(e.beginPath(),e.strokeStyle=t.options[f].background?t.options[f].background+"20":"#1890ff20",e.arc(i+p/2,a+p/2+v,p/2+1.5,0,Math.PI*2),e.stroke(),e.closePath(),e.beginPath(),e.fillStyle=t.options[f].background||"#1890ff",e.arc(i+p/2,a+p/2+v,p/4,0,Math.PI*2),e.fill(),e.closePath()),e.restore(),e.save(),e.fillStyle=g?"#00000040":Ir(t,t.calculative.canvas.parent.store)||"#000000d9";var y=14*t.calculative.worldRect.height/t.checkboxHeight;e.textAlign="start",e.textBaseline="middle",e.font=Lr({fontStyle:s,fontWeight:h,fontFamily:l||t.calculative.canvas.parent.store.options.fontFamily,fontSize:y,lineHeight:c}),e.fillText(t.options[f].text,i+p+10,a+p/2+v),e.restore()}}}function eC(e){Pg(e)}function tC(e,t){if(e.direction=="horizontal")for(var i=0;i<e.optionPos.length;i++)!e.options[i].isForbidden&&t.x>e.calculative.worldRect.x+e.optionPos[i]*e.calculative.worldRect.width/e.checkboxWidth&&t.x<e.calculative.worldRect.x+(e.optionPos[i]+e.height)/e.checkboxWidth*e.calculative.worldRect.width+Rg(e.options[i].text,e)+10/e.checkboxWidth*e.calculative.worldRect.width&&(e.checked=e.options[i].text,e.calculative.canvas.store.emitter.emit("valueUpdate",e));else if(e.direction=="vertical")for(var a=e.calculative.worldRect.height/e.checkboxHeight,i=0;i<e.optionPos.length;i++)!e.options[i].isForbidden&&t.y>e.calculative.worldRect.y+e.optionPos[i]*a&&t.y<e.calculative.worldRect.y+(e.optionPos[i]+e.optionHeight)*a&&(e.checked=e.options[i].text,e.calculative.canvas.store.emitter.emit("valueUpdate",e));e.calculative.canvas.render()}function iC(e){Pg(e)}var Oa=globalThis&&globalThis.__assign||function(){return Oa=Object.assign||function(e){for(var t,i=1,a=arguments.length;i<a;i++){t=arguments[i];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},Oa.apply(this,arguments)},rC=globalThis&&globalThis.__read||function(e,t){var i=typeof Symbol=="function"&&e[Symbol.iterator];if(!i)return e;var a=i.call(e),r,n=[],o;try{for(;(t===void 0||t-- >0)&&!(r=a.next()).done;)n.push(r.value)}catch(s){o={error:s}}finally{try{r&&!r.done&&(i=a.return)&&i.call(a)}finally{if(o)throw o.error}}return n},aC=globalThis&&globalThis.__spreadArray||function(e,t,i){if(i||arguments.length===2)for(var a=0,r=t.length,n;a<r;a++)(n||!(a in t))&&(n||(n=Array.prototype.slice.call(t,0,a)),n[a]=t[a]);return e.concat(n||Array.prototype.slice.call(t))},qc=globalThis&&globalThis.__values||function(e){var t=typeof Symbol=="function"&&Symbol.iterator,i=t&&e[t],a=0;if(i)return i.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Kt=4,ta=20;function Md(e,t){t.onAdd||(t.onAdd=Lg,(!t.rowPos||!t.colPos||!t.calculative.maxOffsetY)&&t.onAdd(t),t.onMouseMove=dC,t.onMouseLeave=vC,t.onMouseDown=gC,t.onShowInput=hC,t.onInput=fC,t.onValue=EC,t.onBeforeValue=kC,t.onMouseEnter=RC,t.onWheel=CC,t.onDestroy=SC,t.onContextmenu=PC,t.onResize=IC,t.onMove=LC),t.data.length!==t.rowPos.length&&(t.initWorldRect=null,t.calculative.isUpdateData=!0,t.onValue(t)),t.data[0].length!==t.colPos.length&&(t.initWorldRect=null,t.calculative.isUpdateData=!0,t.onValue(t));var i=t.calculative.canvas.store.data,a=t.calculative.canvas.store.options;if(t.colHeaders=t.colHeaders===void 0?t.hasHeader:t.colHeaders,t.color=t.color||i.color||a.color,t.textColor=t.textColor||t.color||i.textColor||a.textColor,t.activeColor=t.activeColor||a.activeColor,t.hoverColor=t.hoverColor||a.hoverColor,t.activeBackground=t.activeBackground||a.activeBackground,t.hoverBackground=t.hoverBackground||a.hoverBackground,!t.colHeaders){e.save(),e.beginPath();var r=t.calculative.worldRect,n=r.x,o=r.y,s=r.width,h=r.height;e.fillStyle="#fff0",e.rect(n-1,o-1,s+2,h+2),e.fill(),e.clip()}sC(e,t),uC(e,t),cC(e,t),e.restore(),nC(e,t),lC(e,t),t.isFirstTime=!1}function nC(e,t){if(!!t.calculative.hover&&!!t.calculative.hoverCell&&!t.calculative.isInput&&!!t.calculative.isHover){var i=t.calculative.worldRect,a=t.calculative.canvas.mousePos;if(!(a.x>i.x&&a.x<i.x+i.width&&a.y>i.y&&a.y<i.y+i.height)){t.calculative.hover=!1,t.calculative.isHover=!1,t.calculative.hoverCell=void 0;return}var r=t.calculative.hoverCell,n=r.row,o=r.col,s=t.calculative.canvas.mousePos,h=s.x,l=s.y;if(!!t.data[n]){var c=t.data[n][o];if(!(typeof c=="object"||!c)){e.save(),e.beginPath(),e.textAlign="start",e.textBaseline="middle",e.font=e.font=(t.calculative.fontStyle||"")+" normal "+(t.calculative.fontWeight||"")+" "+(t.calculative.fontSize||12)+"px "+t.calculative.fontFamily;var f=e.measureText(c).width;e.beginPath(),e.fillStyle="#fff",e.strokeStyle="#000",e.moveTo(h,l),e.rect(h-10,l,f+20,20),e.fill(),e.stroke(),e.beginPath(),e.fillStyle="#000",e.fillText(c,h,l+10),e.restore()}}}}function oC(e){var t=[],i=[],a={};e.rowHeight||(e.rowHeight=40),e.colWidth||(e.colWidth=150);var r=0,n=e.styles&&e.styles.filter(function(b){return b.col!==void 0&&b.row===void 0&&b.width}),o={};n&&n.forEach(function(b){o[b.col]=b.width}),e.rowHeaders&&(r=ta);for(var s=function(b){r+=(o[b]||e.colWidth)*e.calculative.canvas.store.data.scale,t.push(r);var x=e.styles&&e.styles.filter(function(_){return _.col===b&&_.row===void 0});x&&(a[b]=x[0])},h=0;h<e.data[0].length;h++)s(h);var l=0,c=e.styles&&e.styles.filter(function(b){return b.col===void 0&&b.row!==void 0&&b.height}),f={};c&&c.forEach(function(b){f[b.row]=b.height});for(var v=l,g=0;g<e.data.length;g++)l+=(f[g]||e.rowHeight)*e.calculative.canvas.store.data.scale,i.push(l),g<e.maxNum&&(v=l);if(e.calculative.maxOffsetY=(l-v)/e.calculative.canvas.store.data.scale,!e.initWorldRect){e.colPos=t,e.rowPos=i,e.colStyle=a,e.initScale=e.calculative.canvas.store.data.scale,e.tableWidth=r,e.tableHeight=v||l,e.calculative.width=r,e.calculative.height=v||l,e.calculative.width=r,e.calculative.height=v||l,e.height||(e.height=e.calculative.height),e.width||(e.width=e.calculative.width);var y=e.x,p=e.y;if(e.parentId){var m=e.calculative.canvas.store.pens[e.parentId];y=m.calculative.worldRect.x+m.calculative.worldRect.width*e.x,p=m.calculative.worldRect.y+m.calculative.worldRect.height*e.y}e.calculative.worldRect={x:y,y:p,height:e.calculative.height,width:e.calculative.width,center:{x:e.x+e.calculative.width/2,y:e.y+e.calculative.height/2}},e.width=e.calculative.width,e.height=e.calculative.height,e.initWorldRect||(e.initWorldRect={width:e.calculative.worldRect.width,height:e.calculative.worldRect.height}),ot(e.calculative.worldRect)}}function sC(e,t){var i;if(!!t.colPos){var a=t.calculative.worldRect,r=a.x,n=a.y,o=a.width,s=a.height,h=a.ex,l=a.ey;e.save(),e.beginPath(),e.strokeStyle=t.color;var c=t.calculative.borderRadius||0,f=c;c<1&&(c=o*c,f=s*f);var v=c<f?c:f;if(o<2*v&&(v=o/2),s<2*v&&(v=s/2),e.moveTo(r+v,n),e.arcTo(h,n,h,l,v),e.arcTo(h,l,r,l,v),e.arcTo(r,l,r,n,v),e.arcTo(r,n,h,n,v),t.background&&(e.fillStyle=t.background,e.fill()),t.bordered!==!1&&(e.strokeStyle=t.borderColor||"#424B61",e.stroke()),t.hLine!==!1){var g=t.rowPos[t.rowPos.length-1];t.colHeaders&&(e.beginPath(),e.moveTo(t.calculative.worldRect.x,t.calculative.worldRect.y+t.rowPos[0]*t.calculative.worldRect.height/t.tableHeight),e.lineTo(t.calculative.worldRect.ex,t.calculative.worldRect.y+t.rowPos[0]*t.calculative.worldRect.height/t.tableHeight),e.strokeStyle=t.borderColor||"#424B61",e.stroke());for(var y=function(b){var x=t.rowPos[b];if(x===g)return"continue";var _=x*t.calculative.worldRect.height/t.tableHeight-t.offsetY*t.calculative.canvas.store.data.scale;if(t.colHeaders){if(_<0+t.rowPos[0]*t.calculative.worldRect.height/t.tableHeight||_>t.calculative.worldRect.height)return"continue"}else if(_<0||_>t.calculative.worldRect.height)return"continue";var k=(i=t.mergeCells)===null||i===void 0?void 0:i.filter(function(U){return U.row<=b&&b<U.row+U.rowspan-1});if(e.beginPath(),e.strokeStyle=t.borderColor||"#424B61",k!=null&&k.length){k.sort(function(U,$){return U.col-$.col}),e.moveTo(t.calculative.worldRect.x,t.calculative.worldRect.y+_);for(var I=0;I<k.length;I++){var P=k[I].col-1+k[I].colspan;P>=t.colPos.length&&(P=t.colPos.length-1);var M=t.colPos[k[I].col-1]*t.calculative.worldRect.width/t.tableWidth,L=t.colPos[P]*t.calculative.worldRect.width/t.tableWidth;e.lineTo(t.calculative.worldRect.x+M,t.calculative.worldRect.y+_),e.moveTo(t.calculative.worldRect.x+L,t.calculative.worldRect.y+_)}e.lineTo(t.calculative.worldRect.ex,t.calculative.worldRect.y+_)}else e.moveTo(t.calculative.worldRect.x,t.calculative.worldRect.y+_),e.lineTo(t.calculative.worldRect.ex,t.calculative.worldRect.y+_);e.stroke()},p=0;p<t.rowPos.length;p++)y(p)}if(t.vLine!==!1){var m=t.colPos[t.colPos.length-1];t.colPos.forEach(function(b,x){var _;if(b!==m){var k=(_=t.mergeCells)===null||_===void 0?void 0:_.filter(function(S){return S.col<=x&&x<S.col+S.colspan-1});if(e.beginPath(),e.strokeStyle=t.borderColor||"#424B61",k!=null&&k.length){k.sort(function(S,T){return S.row-T.row});var I=b*t.calculative.worldRect.width/t.tableWidth;e.moveTo(t.calculative.worldRect.x+I,t.calculative.worldRect.y),t.colHeaders&&e.lineTo(t.calculative.worldRect.x+I,t.calculative.worldRect.y+t.rowPos[0]*t.calculative.worldRect.height/t.tableHeight);for(var P=0;P<k.length;P++){var M=k[P].row-1+k[P].rowspan;M>=t.rowPos.length&&(M=t.rowPos.length-1);var L=t.rowPos[k[P].row-1]*t.calculative.worldRect.height/t.tableHeight-t.offsetY*t.calculative.canvas.store.data.scale,U=t.rowPos[M]*t.calculative.worldRect.height/t.tableHeight-t.offsetY*t.calculative.canvas.store.data.scale;L>t.calculative.worldRect.height&&(L=t.calculative.worldRect.height),L>=0&&e.lineTo(t.calculative.worldRect.x+I,t.calculative.worldRect.y+L),U>t.calculative.worldRect.height&&(U=t.calculative.worldRect.height),U>=0&&e.moveTo(t.calculative.worldRect.x+I,t.calculative.worldRect.y+U)}e.lineTo(t.calculative.worldRect.x+I,t.calculative.worldRect.ey)}else{var $=b*t.calculative.worldRect.width/t.tableWidth;e.moveTo(t.calculative.worldRect.x+$,t.calculative.worldRect.y),e.lineTo(t.calculative.worldRect.x+$,t.calculative.worldRect.ey)}e.stroke()}})}e.restore()}}function lC(e,t){if(t.calculative.activeCol!==void 0){e.save(),e.beginPath(),e.strokeStyle=t.activeColor,e.fillStyle="#278df833";var i=wC(t,t.calculative.activeCol);e.rect(i.x,t.calculative.worldRect.y,i.width,t.calculative.worldRect.height),e.fill(),e.stroke(),e.restore()}}function cC(e,t){if(t.calculative.mergeCell){e.save(),e.beginPath(),e.strokeStyle=t.activeColor,e.fillStyle="#278df833";var i=_C(t,t.calculative.mergeCell);e.rect(i.x,i.y,i.width,i.height),e.fill(),e.stroke(),e.restore()}}function uC(e,t){var i,a,r,n,o;if(!!t.colPos){t.calculative.texts||(t.calculative.texts=[]),t.calculative.canvas.store.data.scale;for(var s=1,h=function(c){if(t.colHeaders&&c===1){e.save(),e.beginPath();var f=t.calculative.worldRect,v=f.x,g=f.y,y=f.width,p=f.height;e.fillStyle="#fff0",e.rect(v-1,g+t.rowPos[0]*t.calculative.worldRect.height/t.tableHeight-1,y+2,p-t.rowPos[0]*t.calculative.worldRect.height/t.tableHeight+2),e.fill(),e.clip()}var m=t.calculative.worldRect.height/t.tableHeight;if(c>0&&t.offsetY*t.calculative.canvas.store.data.scale>t.rowPos[c]*m)return c>=t.calculative.startIndex&&(t.calculative.startIndex=c+1),"continue";if(t.rowPos[c-1]*m-t.offsetY*t.calculative.canvas.store.data.scale>t.calculative.worldRect.height)return c<t.calculative.endIndex&&(t.calculative.endIndex=c-1),"continue";for(var b=yC(t,c).style,x=function(P){var M=Dg(t,c,P),L=M.value,U=M.style,$=M.mergeCell,S=!0;U.wheres&&Array.isArray(U.wheres)&&(S=!1,S=U.wheres.every(function(se){var E=new Function("attr","return attr "+se.comparison+" "+se.value);return E(L)}));var T=t.color,R=t.textColor||t.color,O=null,K=null,G=null,ae=null;S&&(T=U.color||b.color||t.color,R=U.textColor||b.textColor||t.textColor,O=U.background||b.background,K=(U.fontSize||b.fontSize||0)*t.calculative.canvas.store.data.scale,G=U.fontWeight||b.fontWeight,ae=U.fontStyle||b.fontStyle);var V=void 0;t.stripe&&(t.colHeaders!==!1?c%2===1&&(O=O||t.stripeColor||"#407FFF1F"):c%2===0&&(O=O||t.stripeColor||"#407FFF1F")),t.calculative.active&&((i=t.calculative.activeCell)===null||i===void 0?void 0:i.row)===c&&((a=t.calculative.activeCell)===null||a===void 0?void 0:a.col)===P&&(T=t.activeColor,O=t.activeBackground,V=T,R=t.activeTextColor||t.activeColor),t.calculative.hover&&((r=t.calculative.hoverCell)===null||r===void 0?void 0:r.row)===c&&((n=t.calculative.hoverCell)===null||n===void 0?void 0:n.col)===P&&(T=t.hoverColor,O=t.hoverBackground,R=t.hoverTextColor||t.hoverColor,V=T);var F=Kc(t,c,P);if(F.y+F.height<t.calculative.worldRect.y||F.y>t.calculative.worldRect.height+t.calculative.worldRect.y||(O&&(e.save(),e.beginPath(),e.fillStyle=O,e.fillRect(F.x,F.y,F.width+.25*t.calculative.canvas.store.data.scale,F.height),e.restore()),V&&(e.save(),e.beginPath(),e.strokeStyle=V,e.strokeRect(F.x,F.y,F.width,F.height),e.restore()),$))return"continue";t.calculative.worldTextRect=F;var q=t.calculative.texts[c];if(t.calculative.texts[c]||(q=[],t.calculative.texts[c]=q),q[P]==null){if(typeof L=="object")if(c===0)q[P]=L.text;else{var Y=t.styles&&t.styles.filter(function(se){return se.col===P&&se.row===void 0&&se.pens});if(Y.length>0){if(q[P]="",t.isFirstTime){t.maxNum&&t.colHeaders&&c>=t.maxNum&&(L.visible=!1);var W=JSON.parse(JSON.stringify(Y[0].pens));W.forEach(function(se){Object.assign(se,{row:c,col:P},L),se.activeBackground=se.background,se.hoverBackground=se.background,se.activeColor=se.color,se.hoverColor=se.color,se.activeTextColor=se.textColor,se.hoverTextColor=se.textColor,se.height*=t.calculative.canvas.store.data.scale,se.width*=t.calculative.canvas.store.data.scale}),xC(t,F,W),t.calculative.canvas.parent.pushChildren(t,W)}return"continue"}}else L===void 0?q[P]="":q[P]=L.text||L+"";if(!q[P])return"continue";q[P]=Nn(t,q[P])}if(!q[P])return"continue";e.save(),e.beginPath(),e.fillStyle=R,e.textAlign="center",e.textBaseline="middle",e.font=(ae||t.calculative.fontStyle||"")+" normal "+(G||t.calculative.fontWeight||"")+" "+(K||t.calculative.fontSize||12)*s+"px "+t.calculative.fontFamily;var J=t.colStyle&&((o=t.colStyle[P])===null||o===void 0?void 0:o.textAlign);if(J&&(e.textAlign=J),q[P].length===1)J==="left"?e.fillText(q[P][0],F.x,F.y+F.height/2):J==="right"?e.fillText(q[P][0],F.x+F.width,F.y+F.height/2):e.fillText(q[P][0],F.x+F.width/2,F.y+F.height/2);else{var re=.55,ee=(K||t.calculative.fontSize)*t.calculative.lineHeight*s,he=q[P].length*ee,le=(F.height-he)/2;J==="left"?q[P].forEach(function(se,E){e.fillText(se,F.x,F.y+le+(E+re)*ee)}):J==="right"?q[P].forEach(function(se,E){e.fillText(se,F.x+F.width,F.y+le+(E+re)*ee)}):q[P].forEach(function(se,E){e.fillText(se,F.x+F.width/2,F.y+le+(E+re)*ee)})}e.restore()},_=0;_<t.colPos.length;_++)x(_);if(t.rowHeaders){e.save(),e.beginPath(),e.fillStyle=t.rowHeadersBackground||"#407FFF1F",e.strokeStyle=t.rowHeadersColor||"#000";var k=Kc(t,c,-1);e.rect(k.x,k.y,k.width,k.height),e.fill(),e.stroke(),e.font=(t.calculative.fontSize||12)*s+"px "+t.calculative.fontFamily,e.fillStyle=t.textColor||t.color,e.textAlign="center",e.textBaseline="middle",e.fillText(c+"",t.x+k.width/2,k.y+k.height/2),e.restore()}if(t.calculative.activeRow===c){e.save(),e.beginPath(),e.strokeStyle=t.activeColor,e.fillStyle="#278df833";var I=bC(t,c);e.rect(I.x,I.y,I.width,I.height),e.stroke(),e.fill(),e.restore()}},l=0;l<t.rowPos.length;l++)h(l)}}function Lg(e){var t;hu(e),!((t=e.children)===null||t===void 0)&&t.length||(e.isFirstTime=!0),e.offsetY||(e.offsetY=0),e.calculative.startIndex=0,e.calculative.endIndex=e.data.length,oC(e)}function hC(e,t){if(!!e.calculative.hoverCell&&!(e.calculative.hoverCell.row===void 0||e.calculative.hoverCell.col===void 0)){var i=Dg(e,e.calculative.hoverCell.row,e.calculative.hoverCell.col),a=i.value,r=i.mergeCell;if(!(typeof a=="object"&&e.calculative.hoverCell.row!==0)){e.calculative.isHover=!1,e.calculative.isInput=!0,e.calculative.canvas.render(),e.calculative.inputCell=e.calculative.hoverCell,r&&(e.calculative.inputCell=ce(r));var n=Kc(e,e.calculative.hoverCell.row,e.calculative.hoverCell.col);if(e.calculative.tempText=a.text||a+"",e.dropdownList=void 0,e.inputType=void 0,e.calculative.hoverCell.row!==0){var o=e.data[0][e.calculative.hoverCell.col];typeof o=="object"&&(o.type==="select"?e.dropdownList=o.dropdownList:o.type==="numeric"&&(e.inputType="number"))}e.calculative.canvas.showInput(e,n,"#ffffff")}}}function fC(e,t){!e.calculative.inputCell||(Og(e,e.calculative.inputCell.row,e.calculative.inputCell.col,t),e.calculative.isInput=!1,e.calculative.isHover=!0,e.calculative.canvas.render())}function dC(e,t){if(e.timer&&(e.calculative.isHover=!1,clearTimeout(e.timer)),e.timer=setTimeout(function(){e.calculative.isHover=!0,e.calculative.canvas.render()},500),e.calculative.focus&&e.calculative.canvas.externalElements.style.cursor.indexOf("resize")!==-1){var i=e.calculative.canvas.store.data.scale;if(e.calculative.hoverCell.lineCol){var a=t.x-e.calculative.downPos.x,r=e.calculative.hoverCell.lineCol<2?0:e.colPos[e.calculative.hoverCell.lineCol-2];if(e.colPos[e.calculative.hoverCell.lineCol-1]+a<r+Kt*2)return;if(e.colPos[e.calculative.hoverCell.lineCol-1]+a>e.colPos[e.calculative.hoverCell.lineCol]-Kt*2){for(var n=e.calculative.hoverCell.lineCol;n<e.colPos.length;n++)e.colPos[n]+=a;e.calculative.worldRect.width+=a,e.calculative.width+=a,e.width+=a,ot(e.calculative.worldRect),tt(e.calculative.worldRect),e.tableWidth+=a*i,e.calculative.canvas.activeRect=e.calculative.worldRect}for(var n=0;n<e.calculative.texts.length;n++)e.calculative.texts[n][e.calculative.hoverCell.lineCol-1]=null,e.calculative.texts[n][e.calculative.hoverCell.lineCol]=null;e.colPos[e.calculative.hoverCell.lineCol-1]+=a,e.calculative.downPos.x=t.x}if(e.calculative.hoverCell.lineRow){var a=t.y-e.calculative.downPos.y,o=e.calculative.hoverCell.lineRow<2?0:e.rowPos[e.calculative.hoverCell.lineRow-2];if(e.rowPos[e.calculative.hoverCell.lineRow-1]+a<o+Kt*2)return;if(e.rowPos[e.calculative.hoverCell.lineRow-1]+a>e.rowPos[e.calculative.hoverCell.lineRow]-Kt*2){for(var n=e.calculative.hoverCell.lineRow;n<e.rowPos.length;n++)e.rowPos[n]+=a;e.calculative.worldRect.height+=a*i,e.calculative.height+=a*i,e.height+=a*i,ot(e.calculative.worldRect),tt(e.calculative.worldRect),e.tableHeight+=a*i}e.rowPos[e.calculative.hoverCell.lineRow-1]+=a,e.calculative.downPos.y=t.y}e.calculative.canvas.render();return}if(e.calculative.focus&&e.calculative.canvas.mouseDown){if(e.calculative.activeCell.row<=0)return;e.calculative.hoverCell=jc(e,t),!e.locked&&!e.calculative.canvas.store.data.locked&&e.calculative.activeCell&&(e.calculative.mergeCell=mC(e),e.calculative.canvas.render());return}e.calculative.hoverCell=jc(e,t),e.calculative.focus&&!e.locked&&!e.calculative.canvas.store.data.locked&&(e.calculative.hoverCell.lineCol!==void 0&&(e.calculative.canvas.externalElements.style.cursor="col-resize"),e.calculative.hoverCell.lineRow!==void 0&&(e.calculative.canvas.externalElements.style.cursor="row-resize"),e.calculative.hoverCell.allRow!==void 0&&(e.calculative.canvas.externalElements.style.cursor='url("'+e.calculative.canvas.store.options.rightCursor+'") 8 8, auto'),e.calculative.hoverCell.allCol!==void 0&&(e.calculative.canvas.externalElements.style.cursor='url("'+e.calculative.canvas.store.options.downCursor+'") 8 8, auto')),e.calculative.canvas.render()}function vC(e,t){var i,a;hu(e),(a=(i=e.calculative.singleton)===null||i===void 0?void 0:i.tableScroll)===null||a===void 0||a.hideScroll(),e.calculative.canvas.render()}function gC(e,t){var i,a,r,n;if(e.calculative.downPos=ce(t),e.calculative.activeCell=jc(e,t),e.calculative.mergeCell&&!In({col:e.calculative.activeCell.col,colspan:1,row:e.calculative.activeCell.row,rowspan:1},e.calculative.mergeCell)&&(e.calculative.mergeCell=void 0),e.calculative.focus&&e.calculative.mergeCell===void 0&&e.calculative.activeCell.allRow===void 0)for(var o=0;o<((i=e.mergeCells)===null||i===void 0?void 0:i.length);o++)In({col:e.calculative.activeCell.col,colspan:1,row:e.calculative.activeCell.row,rowspan:1},e.mergeCells[o])&&(e.calculative.mergeCell=ce(e.mergeCells[o]));e.calculative.activeCol=void 0,e.calculative.activeRow=void 0,!e.locked&&!e.calculative.canvas.store.data.locked&&(!((a=e.calculative.singleton)===null||a===void 0)&&a.tableContextMenu&&e.calculative.singleton.tableContextMenu.hide(),((r=e.calculative.hoverCell)===null||r===void 0?void 0:r.allRow)!==void 0&&(e.calculative.activeRow=e.calculative.hoverCell.allRow),((n=e.calculative.hoverCell)===null||n===void 0?void 0:n.allCol)!==void 0&&(e.calculative.activeCol=e.calculative.hoverCell.allCol),e.calculative.mergeCell),e.calculative.canvas.render()}function jc(e,t){for(var i,a,r=e.calculative.worldRect.width/e.tableWidth,n=e.calculative.worldRect.height/e.tableHeight,o={row:void 0,col:void 0,lineRow:void 0,lineCol:void 0,allRow:void 0,allCol:void 0},s=0;s<e.colPos.length;s++){var h=s===0?0:e.colPos[s-1]*r;t.x<=e.calculative.worldRect.x+e.colPos[s]*r-Kt&&t.x>=e.calculative.worldRect.x+h+Kt&&(o.col=s),s!==0&&t.x<e.calculative.worldRect.x+h+Kt&&t.x>e.calculative.worldRect.x+h-Kt&&(o.lineCol=s)}var l=e.calculative.startIndex||0,c=e.calculative.endIndex||e.rowPos.length;if(e.colHeaders&&t.y<e.calculative.worldRect.y+e.rowPos[0]*n&&(o.row=0),o.row===void 0){for(var s=l;s<=c;s++){var f=s===0?0:e.rowPos[s-1]*n;t.y<=e.calculative.worldRect.y+e.rowPos[s]*n-e.offsetY*e.calculative.canvas.store.data.scale-Kt&&t.y>=e.calculative.worldRect.y+f-e.offsetY*e.calculative.canvas.store.data.scale+Kt&&(o.row=s),s!==0&&t.y<e.calculative.worldRect.y+f-e.offsetY*e.calculative.canvas.store.data.scale+Kt&&t.y>e.calculative.worldRect.y+f-e.offsetY*e.calculative.canvas.store.data.scale-Kt&&s<e.rowPos.length&&(o.lineRow=s)}if(t.x<e.calculative.worldRect.x+Kt+(e.colHeaders?ta:0)){o.allRow=0;for(var s=0;s<e.rowPos.length;s++)t.y>e.calculative.worldRect.y+e.rowPos[s]*n-e.offsetY*e.calculative.canvas.store.data.scale&&(o.allRow=s+1)}}if(t.y<e.calculative.worldRect.y+Kt){o.allCol=0;for(var s=0;s<e.rowPos.length;s++)t.x>e.calculative.worldRect.x+e.colPos[s]*r&&(o.allCol=s+1)}if(o.lineCol!==void 0){var v=[];o.row!==void 0&&(v=(i=e.mergeCells)===null||i===void 0?void 0:i.filter(function(g){return g.col<o.lineCol&&o.lineCol<g.col+g.colspan&&o.row>=g.row&&o.row<g.row+g.rowspan})),o.lineRow!==void 0&&(v=(a=e.mergeCells)===null||a===void 0?void 0:a.filter(function(g){return g.col<o.lineCol&&o.lineCol<g.col+g.colspan&&o.lineRow>=g.row&&o.lineRow<g.row+g.rowspan})),v!=null&&v.length&&(o.lineCol=void 0,o.col=v[0].col)}return e.maxNum&&(o.lineRow!==void 0&&(o.row=o.lineRow),o.lineRow=void 0),o}function Dg(e,t,i){var a;if(!(!e.data||!Array.isArray(e.data))){var r=(a=e.mergeCells)===null||a===void 0?void 0:a.filter(function(h){return h.row<=t&&h.row+h.rowspan>t&&h.col<=i&&h.col+h.colspan>i}),n=void 0;r!=null&&r.length&&((t!==r[0].row||i!==r[0].col)&&(n={row:r[0].row,col:r[0].col}),t=r[0].row,i=r[0].col);var o=e.data[t],s=e.styles&&e.styles.filter(function(h){return h.row===t&&h.col===i});if(Array.isArray(o))return{value:o[i],style:(s==null?void 0:s.length)>0?s[0]:{},mergeCell:n};if(!o.data||!Array.isArray(o.data))return}}function yC(e,t){if(!(!e.data||!Array.isArray(e.data))){var i=e.data[t],a=e.styles&&e.styles.filter(function(r){return r.row===t&&!r.col});if(Array.isArray(i))return{value:i,style:(a==null?void 0:a.length)>0?a[0]:{}};if(!i.data||!Array.isArray(i.data))return}}function mC(e){var t=ce(e.calculative.hoverCell);t.col||(t.col=t.lineCol||0),t.row||(t.row=t.lineRow);var i=Bg([Oa(Oa({},e.calculative.activeCell),{rowspan:1,colspan:1}),Oa(Oa({},t),{rowspan:1,colspan:1})]);return e.mergeCells&&(i=Mg(e,i)),i}function Mg(e,t){var i,a=(i=e.mergeCells)===null||i===void 0?void 0:i.filter(function(r){return pC(r,t)});return a!=null&&a.length?Mg(e,Bg(aC([t],rC(a),!1))):t}function pC(e,t){return!(e.row+e.rowspan<=t.row||e.row>=t.row+t.rowspan||e.col+e.colspan<=t.col||e.col>=t.col+t.colspan||In(e,t))}function In(e,t){return e.row>=t.row&&e.row+e.rowspan<=t.row+t.rowspan&&e.col>=t.col&&e.col+e.colspan<=t.col+t.colspan}function Bg(e){var t=e[0].col,i=e[0].row,a=e[0].col+e[0].colspan,r=e[0].row+e[0].rowspan;return e.forEach(function(n){t=Math.min(t,n.col),i=Math.min(i,n.row),a=Math.max(a,n.col+n.colspan),r=Math.max(r,n.row+n.rowspan)}),{col:t,row:i,colspan:a-t,rowspan:r-i}}function Og(e,t,i,a){if(!(!e.data||!Array.isArray(e.data))){e.isFirstTime=!1,e.calculative.texts=void 0;var r=e.data[t];!r||(r[i]instanceof Object?r[i].text=a:r[i]=a,e.calculative.canvas.store.emitter.emit("valueUpdate",e))}}function Kc(e,t,i){var a,r=e.calculative.worldRect.width/e.tableWidth,n=e.calculative.worldRect.height/e.tableHeight,o=(a=e.mergeCells)===null||a===void 0?void 0:a.filter(function(g){return g.col<=i&&g.row<=t&&g.col+g.colspan>i&&g.row+g.rowspan>t}),s=0,h=0;if(i>-1?h=e.colPos[i]*r:i===-1&&(e.rowHeaders?h=ta*r:h=0),i>0&&(s=e.colPos[i-1]*r),i===0&&e.rowHeaders&&(s=ta*r),o!=null&&o.length){o[0].col<1?e.rowHeaders?s=ta*r:s=0:s=e.colPos[o[0].col-1]*r;var l=o[0].col+o[0].colspan-1;l>=e.colPos.length&&(l=e.colPos.length-1),h=e.colPos[l]*r}var c=0,f=e.rowPos[t]*n;if(t>0&&(c=e.rowPos[t-1]*n),o!=null&&o.length){c=e.rowPos[o[0].row-1]*n;var l=o[0].row+o[0].rowspan-1;l>=e.rowPos.length&&(l=e.rowPos.length-1),f=e.rowPos[l]*n}var v=e.offsetY*e.calculative.canvas.store.data.scale;return t===0&&e.colHeaders&&(v=0),{x:e.calculative.worldRect.x+s,y:e.calculative.worldRect.y+c-v,ex:e.calculative.worldRect.x+h,ey:e.calculative.worldRect.y+f-v,width:h-s,height:f-c}}function wC(e,t){var i=e.calculative.worldRect.width/e.tableWidth,a=0;e.rowHeaders&&(a=ta*i);var r=e.colPos[t]*i;return t>0&&(a=e.colPos[t-1]*i),{x:e.calculative.worldRect.x+a,y:e.calculative.worldRect.y,ex:e.calculative.worldRect.x+r,ey:e.calculative.worldRect.ey,width:r-a,height:e.calculative.worldRect.height}}function bC(e,t){var i=e.calculative.worldRect.height/e.tableHeight,a=0,r=e.rowPos[t]*i;t>0&&(a=e.rowPos[t-1]*i);var n=e.offsetY*e.calculative.canvas.store.data.scale;return t===0&&e.colHeaders&&(n=0),{x:e.calculative.worldRect.x,y:e.calculative.worldRect.y+a-n,ex:e.calculative.worldRect.ex,ey:e.calculative.worldRect.y+r-n,width:e.calculative.worldRect.width,height:r-a}}function _C(e,t){var i=e.calculative.worldRect.width/e.tableWidth,a=e.calculative.worldRect.height/e.tableHeight,r=e.colPos[t.col-1]*i;t.col===0&&(r=0,e.rowHeaders&&(r=ta*i));var n=e.colPos[t.col+t.colspan-1]*i,o=e.rowPos[t.row-1]*a,s=e.rowPos[t.row+t.rowspan-1]*a,h=e.offsetY*e.calculative.canvas.store.data.scale;return{x:e.calculative.worldRect.x+r,y:e.calculative.worldRect.y+o-h,ex:e.calculative.worldRect.x+n,ey:e.calculative.worldRect.y+s-h,width:n-r,height:s-o}}function xC(e,t,i){var a,r,n,o,s=e.calculative.worldRect.width/e.tableWidth,h=e.calculative.worldRect.height/e.tableHeight,l=1,c=1;e.initWorldRect&&(e.calculative.worldRect.width!==e.initWorldRect.width&&(l=e.calculative.worldRect.width/e.initWorldRect.width),e.calculative.worldRect.height!==e.initWorldRect.height&&(c=e.calculative.worldRect.height/e.initWorldRect.height));var f=0,v=0,g=0,y=e.calculative.canvas.store.data.scale;if(i.length>1){try{for(var p=qc(i),m=p.next();!m.done;m=p.next()){var b=m.value;v+b.width*s+20*y*s<t.width?(b.x=t.x+v+10*y*s,b.y=t.y+g+10*y*h,v+=(b.width+10*y)*s,f=Math.max(f,g+(b.height+10*y)*h)):(v=0,g=f,b.x=t.x+v+10*y*s,b.y=t.y+g+10*y*h,f+=(b.height+10*y)*h)}}catch(I){a={error:I}}finally{try{m&&!m.done&&(r=p.return)&&r.call(p)}finally{if(a)throw a.error}}if(f+20*y*h<t.height){var x=(t.height-f-10*y*h)/2;try{for(var _=qc(i),k=_.next();!k.done;k=_.next()){var b=k.value;b.y+=x}}catch(I){n={error:I}}finally{try{k&&!k.done&&(o=_.return)&&o.call(_)}finally{if(n)throw n.error}}}}else i[0].x=t.x+(t.width-i[0].width)/2,i[0].y=t.y+(t.height-i[0].height)/2;i.forEach(function(I){I.width=I.width*l/y,I.height=I.height*c/y})}function EC(e){if(e.calculative.isUpdateData){delete e.calculative.isUpdateData;var t=ce(e.children);e.children=[],Lg(e),t&&t.forEach(function(i){e.calculative.canvas.delForce(e.calculative.canvas.findOne(i))}),e.calculative.texts=void 0}}function kC(e,t){var i,a;if(e.calculative.isUpdateData=!1,e.swiper!==void 0&&(e.swiper?hu(e):uu(e)),t.styles&&(e.initWorldRect=void 0),t.table||t.col==null&&t.row==null){if(t.dataY){var r=e.replaceMode,n=[];return r?r===gs.Replace?(n=e.data,t.dataX&&t.dataX.forEach(function(c,f){n[c]=t.dataY[f]})):r===gs.ReplaceAll&&(t.dataX?n[0]=t.dataX:n[0]=e.data[0],n=n.concat(t.dataY)):n=e.data.concat(t.dataY),delete t.dataX,delete t.dataY,e.calculative.isUpdateData=!0,Object.assign(t,{data:n})}(t.data||t.styles||t.maxNum)&&(e.calculative.isUpdateData=!0);try{for(var o=qc(Object.keys(t)),s=o.next();!s.done;s=o.next()){var h=s.value;h.includes("data.")&&(e.calculative.isUpdateData=!0)}}catch(c){i={error:c}}finally{try{s&&!s.done&&(a=o.return)&&a.call(o)}finally{if(i)throw i.error}}return t}var l=e.data[t.row];return l&&(l[t.col]instanceof Object||(l[t.col]=t.value),Og(e,t.row,t.col,t.value),e.calculative.canvas.render(),delete t.col,delete t.row),t}function CC(e,t){var i,a;if(!(!e.locked&&!e.calculative.canvas.store.data.locked)&&!!e.maxNum){var r=0;t.deltaY>0?r=4:r=-4,ys(e,r),(a=(i=e.calculative.singleton)===null||i===void 0?void 0:i.tableScroll)===null||a===void 0||a.updataScrollHTop()}}function ys(e,t){var i;e.calculative.startIndex=0,e.calculative.endIndex=e.data.length,e.offsetY||(e.offsetY=0),e.offsetY+=t;var a=e.calculative.worldRect.height/e.initWorldRect.height;e.offsetY>e.calculative.maxOffsetY*a&&(e.offsetY=e.calculative.maxOffsetY*a),e.offsetY<0&&(e.offsetY=0),(i=e.children)===null||i===void 0||i.forEach(function(r){var n=e.calculative.canvas.store.pens[r];AC(e,n)}),e.calculative.canvas.render()}function AC(e,t){if(!!t){t.oldY||(t.oldY=t.y);var i=t.calculative.worldRect;i.y,i.height;var a=e.calculative.worldRect;a.y,a.height;var r=e.calculative.canvas.store.data.scale;e.calculative.worldRect.height/e.tableHeight;var n=e.rowHeight;t.y=t.oldY-e.offsetY*r/e.calculative.worldRect.height;var o=n*(e.initScale||1)/e.tableHeight*e.maxNum;if(e.calculative.canvas.updatePenRect(t),e.colHeaders)if(t.y<e.rowPos[0]/e.tableHeight){if(t.calculative.visible=!1,t.visible=!1,t.y<e.rowPos[0]/e.tableHeight/2){t.oldY+=o;var s=t.row+e.maxNum;if(!e.data[s])return;var h=ce(e.data[s][t.col]);h.background&&(h.activeBackground=h.background,h.hoverBackground=h.background),h.color&&(h.hoverColor=h.color,h.activeColor=h.color),h.textColor&&(h.activeTextColor=h.textColor,h.hoverTextColor=h.textColor),Object.assign(t,h,{row:s}),Object.assign(t.calculative,h,{row:s})}}else if(t.y+t.height>1){if(t.calculative.visible=!1,t.visible=!1,t.y+t.height/2>1){t.oldY-=o;var s=t.row-e.maxNum;if(!e.data[s])return;var h=ce(e.data[s][t.col]);h.background&&(h.activeBackground=h.background,h.hoverBackground=h.background),h.color&&(h.hoverColor=h.color,h.activeColor=h.color),h.textColor&&(h.activeTextColor=h.textColor,h.hoverTextColor=h.textColor),Object.assign(t,h,{row:s}),Object.assign(t.calculative,h,{row:s})}}else t.visible=!0,t.calculative.visible=!0;else if(t.y<0){if(t.calculative.visible=!1,t.visible=!1,t.y<-n/e.tableHeight/2){t.oldY+=o;var s=t.row+e.maxNum;if(!e.data[s])return;var h=ce(e.data[s][t.col]);h.background&&(h.activeBackground=h.background,h.hoverBackground=h.background),h.color&&(h.hoverColor=h.color,h.activeColor=h.color),h.textColor&&(h.activeTextColor=h.textColor,h.hoverTextColor=h.textColor),Object.assign(t,h,{row:s}),Object.assign(t.calculative,h,{row:s})}}else if(t.y+t.height>1){if(t.calculative.visible=!1,t.visible=!1,t.y+t.height/2>1){t.oldY-=o;var s=t.row-e.maxNum;if(!e.data[s])return;var h=ce(e.data[s][t.col]);h.background&&(h.activeBackground=h.background,h.hoverBackground=h.background),h.color&&(h.hoverColor=h.color,h.activeColor=h.color),h.textColor&&(h.activeTextColor=h.textColor,h.hoverTextColor=h.textColor),Object.assign(t,h,{row:s}),Object.assign(t.calculative,h,{row:s})}}else t.calculative.visible=!0,t.visible=!0}}function SC(e){var t,i,a,r;(i=(t=e.calculative.singleton)===null||t===void 0?void 0:t.tableScroll)===null||i===void 0||i.destroy(),(r=(a=e.calculative.singleton)===null||a===void 0?void 0:a.tableContextMenu)===null||r===void 0||r.destroy(),uu(e)}function uu(e){e.interval&&(globalThis.clearInterval(e.interval),e.interval=null)}function hu(e){if(e.maxNum&&e.swiper){if(e.interval)return;e.interval=globalThis.setInterval(function(){e.offsetY>=e.calculative.maxOffsetY?(e.offsetY=0,TC(e)):e.offsetY%e.rowHeight?ys(e,1):(e.calculative.stap||(e.calculative.stap=0),e.calculative.stap+=1,e.calculative.stap==12&&(e.calculative.stap=0,ys(e,1)))},50)}}function TC(e){var t;(t=e.children)===null||t===void 0||t.forEach(function(i){var a=e.rowHeight,r=e.calculative.canvas.store.pens[i];if(!!r){var n=a*(e.initScale||1)/e.tableHeight*e.maxNum;r.oldY-=n;var o=r.row-e.maxNum;if(!!e.data[o]){var s=ce(e.data[o][r.col]);s.background&&(s.activeBackground=s.background,s.hoverBackground=s.background),s.color&&(s.hoverColor=s.color,s.activeColor=s.color),s.textColor&&(s.activeTextColor=s.textColor,s.hoverTextColor=s.textColor),r.calculative.visible=!0,r.visible=!0,Object.assign(r,s,{row:o}),Object.assign(r.calculative,s,{row:o})}}}),e.calculative.canvas.render()}function RC(e){uu(e),e.maxNum&&(e.locked||e.calculative.canvas.store.data.locked)&&(e.calculative.singleton||(e.calculative.singleton={}),e.calculative.singleton.tableScroll||(e.calculative.singleton.tableScroll=new BC(e)),e.calculative.singleton.tableScroll.showScroll())}function PC(e,t){e.calculative.singleton||(e.calculative.singleton={}),e.calculative.singleton.tableContextMenu||(e.calculative.singleton.tableContextMenu=new MC(e)),e.calculative.mergeCell!==void 0&&e.calculative.singleton.tableContextMenu.updateMenu("merge",t),e.calculative.activeRow!==void 0&&e.calculative.singleton.tableContextMenu.updateMenu("row",t),e.calculative.activeCol!==void 0&&e.calculative.singleton.tableContextMenu.updateMenu("col",t)}function IC(e){var t,i;(i=(t=e.calculative.singleton)===null||t===void 0?void 0:t.tableScroll)===null||i===void 0||i.updataScroll()}function LC(e){var t,i;(i=(t=e.calculative.singleton)===null||t===void 0?void 0:t.tableScroll)===null||i===void 0||i.updataScroll()}var DC={col:[{name:"\u5DE6\u63D2\u5165\u5217",key:"insertColLeft",disabled:!1},{name:"\u53F3\u63D2\u5165\u5217",key:"insertColRight",disabled:!1},{name:"\u5220\u9664\u5217",key:"deleteCol"},{name:"\u6E05\u7A7A\u5217",key:"clearCol"}],row:[{name:"\u4E0A\u63D2\u5165\u884C",key:"insertRowAbove",disabled:!1},{name:"\u4E0B\u63D2\u5165\u884C",key:"insertRowBelow",disabled:!1},{name:"\u5220\u9664\u884C",key:"deleteRow"},{name:"\u6E05\u7A7A\u884C",key:"clearRow"}],merge:[{name:"\u6E05\u7A7A\u5355\u5143\u683C",key:"clearCells"},{name:"\u53D6\u6D88\u5408\u5E76",key:"cancelMerge"},{name:"\u5408\u5E76",key:"mergeCell"}]},MC=function(){function e(t){var i=this;this.insertColLeft=function(a){var r,n,o;i.pen.data.forEach(function(l){l.splice(a,0,"")});var s=i.pen.colWidth;a!==0&&(s=i.pen.colPos[a-1]+i.pen.colWidth),i.pen.colPos.splice(a,0,s);for(var h=a+1;h<i.pen.colPos.length;h++)i.pen.colPos[h]+=i.pen.colWidth;i.pen.tableWidth+=i.pen.colWidth,i.pen.calculative.worldRect.width+=i.pen.colWidth,i.pen.calculative.worldRect.center.x+=i.pen.colWidth/2,i.pen.calculative.worldRect.ex+=i.pen.colWidth,i.pen.initWorldRect.width+=i.pen.colWidth,(r=i.pen.styles)===null||r===void 0||r.forEach(function(l){l.col>=a&&(l.col+=1)}),i.pen.calculative.activeCol+=1,!((n=i.pen.mergeCells)===null||n===void 0)&&n.length&&((o=i.pen.mergeCells)===null||o===void 0||o.forEach(function(l){l.col<a&&a<l.col+l.colspan&&(l.colspan+=1),l.col>=a&&(l.col+=1)})),i.pen.calculative.texts=void 0,i.pen.calculative.canvas.render()},this.insertColRight=function(a){var r,n,o;i.pen.data.forEach(function(h){h.splice(a+1,0,"")}),i.pen.colPos.splice(a+1,0,i.pen.colPos[a]+i.pen.colWidth);for(var s=a+2;s<i.pen.colPos.length;s++)i.pen.colPos[s]+=i.pen.colWidth;i.pen.tableWidth+=i.pen.colWidth,i.pen.calculative.worldRect.width+=i.pen.colWidth,i.pen.calculative.worldRect.center.x+=i.pen.colWidth/2,i.pen.calculative.worldRect.ex+=i.pen.colWidth,i.pen.initWorldRect.width+=i.pen.colWidth,(r=i.pen.styles)===null||r===void 0||r.forEach(function(h){h.col>=a&&(h.col+=1)}),!((n=i.pen.mergeCells)===null||n===void 0)&&n.length&&((o=i.pen.mergeCells)===null||o===void 0||o.forEach(function(h){h.col<a+1&&a+1<h.col+h.colspan&&(h.colspan+=1),h.col>=a+1&&(h.col+=1)})),i.pen.calculative.texts=void 0,i.pen.calculative.canvas.render()},this.deleteCol=function(a){var r,n,o;i.pen.data.forEach(function(c){c.splice(a,1)});var s=i.pen.colPos[a]-i.pen.colPos[a-1];a===0&&(s=i.pen.colPos[a]),i.pen.colPos.splice(a,1);for(var h=a;h<i.pen.colPos.length;h++)i.pen.colPos[h]-=s;if(i.pen.tableWidth-=s,i.pen.calculative.worldRect.width-=s,i.pen.calculative.worldRect.center.x-=s/2,i.pen.calculative.worldRect.ex-=s,i.pen.initWorldRect.width-=s,(r=i.pen.styles)===null||r===void 0||r.forEach(function(c){c.col>=a&&(c.col-=1)}),!((n=i.pen.mergeCells)===null||n===void 0)&&n.length)for(var h=0;h<((o=i.pen.mergeCells)===null||o===void 0?void 0:o.length);h++){var l=i.pen.mergeCells[h];l.col<=a&&a<l.col+l.colspan&&(l.colspan-=1),l.col>a&&(l.col-=1),(l.colspan<1||l.colspan===1&&l.rowspan===1)&&(i.pen.mergeCells.splice(h,1),h--)}i.pen.calculative.texts=void 0,i.pen.calculative.canvas.render()},this.clearCol=function(a){i.pen.data.forEach(function(r){r[a]=""}),i.pen.calculative.texts=void 0,i.pen.calculative.canvas.render()},this.insertRowAbove=function(a){for(var r,n=[],o=0;o<i.pen.colPos.length;o++)n.push("");i.pen.data.splice(a,0,n),i.pen.rowPos.splice(a,0,i.pen.rowPos[a-1]+i.pen.rowHeight);for(var o=a+1;o<i.pen.rowPos.length;o++)i.pen.rowPos[o]+=i.pen.rowHeight;i.pen.maxNum?i.pen.calculative.maxOffsetY+=i.pen.rowHeight*i.pen.calculative.canvas.store.data.scale:(i.pen.tableHeight+=i.pen.rowHeight,i.pen.height+=i.pen.rowHeight,i.pen.calculative.worldRect.height+=i.pen.rowHeight,i.pen.calculative.worldRect.center.y+=i.pen.rowHeight/2,i.pen.calculative.worldRect.ey+=i.pen.rowHeight,i.pen.initWorldRect.height+=i.pen.rowHeight,i.pen.calculative.endIndex+=1),i.pen.calculative.activeRow+=1,!((r=i.pen.mergeCells)===null||r===void 0)&&r.length&&i.pen.mergeCells.forEach(function(s){s.row<a&&a<s.row+s.rowspan&&(s.rowspan+=1),s.row>=a&&(s.row+=1)}),i.pen.calculative.texts=void 0,i.pen.calculative.canvas.render()},this.insertRowBelow=function(a){for(var r,n=[],o=0;o<i.pen.colPos.length;o++)n.push("");i.pen.data.splice(a+1,0,n);var s=i.pen.rowPos[a+1];a===i.pen.rowPos.length-1&&(s=i.pen.rowPos[a]+i.pen.rowHeight),i.pen.rowPos.splice(a+1,0,s);for(var o=a+2;o<i.pen.rowPos.length;o++)i.pen.rowPos[o]+=i.pen.rowHeight;i.pen.maxNum?i.pen.calculative.maxOffsetY+=i.pen.rowHeight*i.pen.calculative.canvas.store.data.scale:(i.pen.tableHeight+=i.pen.rowHeight,i.pen.height+=i.pen.rowHeight,i.pen.calculative.worldRect.height+=i.pen.rowHeight,i.pen.calculative.worldRect.center.y+=i.pen.rowHeight/2,i.pen.calculative.worldRect.ey+=i.pen.rowHeight,i.pen.initWorldRect.height+=i.pen.rowHeight,i.pen.calculative.endIndex+=1),!((r=i.pen.mergeCells)===null||r===void 0)&&r.length&&i.pen.mergeCells.forEach(function(h){h.row<a+1&&a+1<h.row+h.rowspan&&(h.rowspan+=1),h.row>=a+1&&(h.row+=1)}),i.pen.calculative.texts=void 0,i.pen.calculative.canvas.render()},this.deleteRow=function(a){var r;i.pen.data.splice(a,1),i.pen.rowPos.splice(a,1);for(var n=a;n<i.pen.rowPos.length;n++)i.pen.rowPos[n]-=i.pen.rowHeight;if(i.pen.calculative.maxOffsetY-=i.pen.rowHeight*i.pen.calculative.canvas.store.data.scale,!((r=i.pen.mergeCells)===null||r===void 0)&&r.length)for(var n=0;n<i.pen.mergeCells.length;n++){var o=i.pen.mergeCells[n];o.row<=a&&a<o.row+o.rowspan&&(o.rowspan-=1),o.row>a&&(o.row-=1),(o.rowspan<1||o.colspan===1&&o.rowspan===1)&&(i.pen.mergeCells.splice(n,1),n--)}i.pen.calculative.texts=void 0,i.pen.calculative.canvas.render()},this.clearRow=function(a){for(var r=0;r<i.pen.colPos.length;r++)i.pen.data[a][r]="";i.pen.calculative.texts=void 0,i.pen.calculative.canvas.render()},this.clearCells=function(){if(i.pen.calculative.mergeCell){for(var a=i.pen.calculative.mergeCell,r=a.row;r<a.row+a.rowspan;r++)for(var n=a.col;n<a.col+a.colspan;n++)i.pen.data[r][n]="";i.pen.calculative.texts=void 0,i.pen.calculative.canvas.render()}},this.cancelMerge=function(){var a;if(!((a=i.pen.mergeCells)===null||a===void 0)&&a.length){for(var r=0;r<i.pen.mergeCells.length;r++)In(i.pen.mergeCells[r],i.pen.calculative.mergeCell)&&(i.pen.mergeCells.splice(r,1),r--);i.pen.calculative.canvas.render()}else console.warn("No cells are merged")},this.mergeCell=function(){var a,r=i.pen.calculative.mergeCell;if(r){var n=i.pen.data[r.row][r.col];if(i.clearCells(),i.pen.calculative.texts=void 0,i.pen.data[r.row][r.col]=n,r.colspan>1||r.rowspan>1){for(var o=0;o<((a=i.pen.mergeCells)===null||a===void 0?void 0:a.length);o++)In(i.pen.mergeCells[o],r)&&(i.pen.mergeCells.splice(o,1),o--);i.pen.mergeCells||(i.pen.mergeCells=[]),i.pen.mergeCells.push(ce(r)),i.pen.calculative.canvas.render()}}},this.pen=t,this.options=DC,this.init()}return e.prototype.init=function(){var t=this,i;this.menu=document.createElement("ul"),this.menu.style.position="absolute",this.menu.style.zIndex="999",this.menu.style.backgroundColor="#fff",this.menu.style.listStyleType="none",this.menu.style.border="1px solid #ccc",this.menu.style.display="none",document.body.appendChild(this.menu),(i=this.pen.calculative.canvas.externalElements)===null||i===void 0||i.parentElement.appendChild(this.menu),this.pen.calculative.singleton||(this.pen.calculative.singleton={});for(var a in this.options)this.options[a].forEach(function(r){t.pen[r.key]=t[r.key]})},e.prototype.updateMenu=function(t,i){this.key!==t&&(this.key=t,this.setMenuList()),this.menu.style.display="block",this.menu.style.left=i.x+"px",this.menu.style.top=i.y+"px"},e.prototype.setMenuList=function(){for(var t=this;this.menu.firstChild;)this.menu.removeChild(this.menu.firstChild);for(var i=function(n){var o=document.createElement("li");o.style.width="100px",o.style.height="26px",o.style.color="#373737",o.style.paddingLeft="12px",o.style.lineHeight="26px",o.style.cursor="pointer",o.innerText=a.options[a.key][n].name,o.onclick=function(){["row","col"].includes(t.key)?t.pen[t.options[t.key][n].key](t.pen.calculative[t.key==="row"?"activeRow":"activeCol"]):t.pen[t.options[t.key][n].key](),t.menu.style.display="none"},o.onmouseover=function(){o.style.backgroundColor="#f5f5f5"},o.onmouseleave=function(){o.style.backgroundColor=""},a.menu.appendChild(o)},a=this,r=0;r<this.options[this.key].length;r++)i(r)},e.prototype.hide=function(){this.menu.style.display="none"},e.prototype.destroy=function(){this.menu.remove()},e}(),BC=function(){function e(t){var i=this;this.scrollLength=20,this.onMouseMove=function(a){if(i.isDownH){var r=a.y-i.isDownH,n=i.pen.calculative.maxOffsetY/i.pen.calculative.worldRect.height;ys(i.pen,r*n),i.updataScrollHTop(),i.isDownH=a.y}},this.onMouseUp=function(a){i.isDownH=0,i.isDownW=0},this.pen=t,this.init(),document.addEventListener("mousemove",this.onMouseMove),document.addEventListener("mouseup",this.onMouseUp)}return e.prototype.init=function(){var t=this,i,a;this.h=document.createElement("div"),this.w=document.createElement("div"),(i=this.pen.calculative.canvas.externalElements)===null||i===void 0||i.parentElement.appendChild(this.h),(a=this.pen.calculative.canvas.externalElements)===null||a===void 0||a.parentElement.appendChild(this.w),this.h.style.position="absolute",this.h.style.height="100px",this.h.style.width="5px",this.h.style.borderRadius=this.scrollLength+"px",this.h.style.backgroundColor="rgba(0,0,0)",this.h.style.zIndex="999",this.h.style.cursor="pointer",this.h.onmousedown=function(r){r.preventDefault(),r.stopPropagation(),t.isDownH=r.y},this.updataScroll()},e.prototype.updataScroll=function(){this.h&&(this.h.style.left=this.pen.calculative.worldRect.x+this.pen.calculative.canvas.store.data.x+this.pen.calculative.worldRect.width-5+"px",this.h.style.height=this.scrollLength*this.pen.calculative.canvas.store.data.scale+"px",this.updataScrollHTop())},e.prototype.updataScrollHTop=function(){if(this.h){this.pen.calculative.canvas.store.data.scale;var t=this.pen.calculative.worldRect.height/this.pen.initWorldRect.height;this.h.style.top=this.pen.calculative.worldRect.y+this.pen.calculative.canvas.store.data.y+this.pen.offsetY/(this.pen.calculative.maxOffsetY*t)*(this.pen.calculative.worldRect.height-this.scrollLength*this.pen.calculative.canvas.store.data.scale)+"px"}},e.prototype.hideScroll=function(){this.h&&!this.isDownH&&(this.h.style.display="none")},e.prototype.showScroll=function(){this.h&&(this.h.style.display="block")},e.prototype.destroy=function(){this.h.remove(),this.w.remove(),document.removeEventListener("mousemove",this.onMouseMove),document.removeEventListener("mouseup",this.onMouseUp)},e}();function MT(){return{radio:Jk,switch:Kk,slider:$k,checkbox:Zk,table:Md,table2:Md}}function OC(e,t){var i=t||new Path2D,a=e.calculative.worldRect,r=a.x,n=a.y,o=a.width,s=a.height,h=a.ey,l=e.calculative.lineLeft||.08,c=e.calculative.borderRadius||0,f=c;c<1&&(c=o*c,f=s*c);var v=c<f?c:f;if(o<2*v&&(v=o/2),s<2*v&&(v=s/2),i.moveTo(r+v,n),i.arcTo(r+o,n,r+o,n+s,v),i.arcTo(r+o,n+s,r,n+s,v),i.arcTo(r,n+s,r,n,v),i.arcTo(r,n,r+o,n,v),i.closePath(),i.moveTo(r+l*o,n),i.lineTo(r+l*o,h),i instanceof Path2D)return i}function NC(e,t){var i=t||new Path2D,a=e.calculative.worldRect,r=a.x,n=a.y,o=a.width,s=a.height,h=a.ex,l=e.calculative.lineTop||.08,c=e.calculative.borderRadius||0,f=c;c<1&&(c=o*c,f=s*f);var v=c<f?c:f;if(o<2*v&&(v=o/2),s<2*v&&(v=s/2),i.moveTo(r+v,n),i.arcTo(r+o,n,r+o,n+s,v),i.arcTo(r+o,n+s,r,n+s,v),i.arcTo(r,n+s,r,n,v),i.arcTo(r,n,r+o,n,v),i.closePath(),i.moveTo(r,n+l*s),i.lineTo(h,n+l*s),i instanceof Path2D)return i}function BT(){return{forkV:Wa,forkH:Wa,swimlaneH:OC,swimlaneV:NC}}function FC(e,t){e.onDestroy||(e.onDestroy=HC,e.onAdd=zC);var i=t||new Path2D,a=e.calculative.worldRect,r=a.x,n=a.y,o=a.width,s=a.height,h=a.ex,l=e.calculative.borderRadius||0,c=l;l<1&&(l*=o,c*=s);var f=l<c?l:c;o<2*f&&(f=o/2),s<2*f&&(f=s/2),i.moveTo(r+f,n),i.arcTo(r+o,n,r+o,n+s,f),i.arcTo(r+o,n+s,r,n+s,f),i.arcTo(r,n+s,r,n,f),i.arcTo(r,n,r+o,n,f);var v=.2*s;i.moveTo(r,n+v),i.lineTo(h,n+v);var g=n+v+(s-v)/2;if(i.moveTo(r,g),i.lineTo(h,g),i.closePath(),i instanceof Path2D)return i}function zC(e){var t=e.calculative.worldRect,i=t.x,a=t.y,r=t.width,n=t.height,o=e.list,s={name:"text",x:i,y:a+.2*n,width:r,height:.4*n,textAlign:"left",textBaseline:"top",textLeft:10,textTop:10},h={name:"text",x:i,y:a+.6*n,width:r,height:.4*n,textAlign:"left",textBaseline:"top",textLeft:10,textTop:10};Object.assign(s,o[0]),Object.assign(h,o[1]),e.calculative.canvas.makePen(s),e.calculative.canvas.makePen(h),e.calculative.canvas.parent.pushChildren(e,[s]),e.calculative.canvas.parent.pushChildren(e,[h])}function HC(e){var t=e.calculative.canvas.store;e.children.forEach(function(i){var a=t.data.pens.findIndex(function(r){return r.id===i});a>-1&&(t.data.pens.splice(a,1),t.pens[i]=void 0)}),e.children=void 0}function UC(e,t){e.onDestroy||(e.onDestroy=qC,e.onAdd=WC);var i=t||new Path2D,a=e.calculative.worldRect,r=a.x,n=a.y,o=a.width,s=a.height,h=a.ex,l=e.calculative.borderRadius||0,c=l;l<1&&(l=o*l,c=s*c);var f=l<c?l:c;o<2*f&&(f=o/2),s<2*f&&(f=s/2),i.moveTo(r+f,n),i.arcTo(r+o,n,r+o,n+s,f),i.lineTo(r+o,n+s-f),i.arcTo(r+o,n+s,r,n+s,f),i.arcTo(r,n+s,r,n,f),i.arcTo(r,n,r+o,n,f);var v=.2*s;if(i.moveTo(r,n+v),i.lineTo(h,n+v),i.closePath(),i instanceof Path2D)return i}function WC(e){var t=e.calculative.worldRect,i=t.x,a=t.y,r=t.width,n=t.height,o=e.list,s={name:"text",x:i,y:a+.2*n,width:r,height:.8*n,textAlign:"left",textBaseline:"top",textLeft:10,textTop:10};Object.assign(s,o[0]),e.calculative.canvas.makePen(s),e.calculative.canvas.parent.pushChildren(e,[s])}function qC(e){var t=e.calculative.canvas.store;e.children.forEach(function(i){var a=t.data.pens.findIndex(function(r){return r.id===i});a>-1&&(t.data.pens.splice(a,1),t.pens[i]=void 0)}),e.children=[]}function OT(){return{interfaceClass:FC,simpleClass:UC}}function jC(e,t){var i=t||new Path2D,a=e.calculative.worldRect,r=a.x,n=a.y,o=a.width,s=a.height;if(i.rect(r,n,o,s),i.closePath(),i instanceof Path2D)return i}function KC(e,t){var i,a=(i=t.headHeight)!==null&&i!==void 0?i:50,r=t.calculative.worldRect,n=r.x,o=r.y,s=r.width,h=r.height,l=r.ey,c=t.calculative.borderRadius||0,f=c;t.calculative.borderRadius<1&&(c*=s,f*=h);var v=c<f?c:f;s<2*v&&(v=s/2),a<2*v&&(v=a/2),e.beginPath(),e.moveTo(n+v,o),e.arcTo(n+s,o,n+s,o+a,v),e.arcTo(n+s,o+a,n,o+a,v),e.arcTo(n,o+a,n,o,v),e.arcTo(n,o,n+s,o,v),e.closePath(),e.stroke(),e.save(),e.beginPath(),e.lineWidth=1,e.setLineDash([7,7]);var g=n+s/2;e.moveTo(g,o+a+1),e.lineTo(g,l),e.closePath(),e.stroke(),e.restore()}function NT(){return{sequenceFocus:jC}}function FT(){return{lifeline:KC}}const zT={background:"#ECE5E5",color:"#fff",textColor:"#fff",anchorColor:"#f90",gridSize:30,grid:!1,gridColor:"rgba(255,255,255,0.1)",drawingLineName:"line"},HT=[{name:"line",label:"\u76F4\u7EBF",icon:"t-line"},{name:"polyline",label:"\u7EBF\u6BB5",icon:"t-polyline"},{name:"curve",label:"\u66F2\u7EBF",icon:"t-curve2"},{name:"mind",label:"\u8111\u56FE\u66F2\u7EBF",icon:"t-mind"}],UT=["triangle","diamond","circle","lineDown","lineUp","triangleSolid","diamondSolid","circleSolid","line"],WT=["#000","#fff","#f00","#0f0","rgba(255,255,255,0.5)"],VC={name:"\u7BA1\u9053",show:!0,list:[{name:"\u77ED",data:{text:"",width:22,height:30,name:"svgPath",image:"/static/figures/pipe-new/\u77ED.svg"}},{name:"\u6A2A\u5411",data:{text:"",width:68,height:30,name:"svgPath",image:"/static/figures/pipe-new/\u6A2A\u5411.svg"}},{name:"45\u5EA6",data:{text:"",width:75,height:58,name:"svgPath",image:"/static/figures/pipe-new/45\u5EA6.svg"}},{name:"90\u5EA6",data:{text:"",width:84,height:84,name:"svgPath",image:"/static/figures/pipe-new/90\u5EA6.svg"}},{name:"\u56DB\u901A",data:{text:"",width:95,height:84,name:"svgPath",image:"/static/figures/pipe-new/\u56DB\u901A.svg"}},{name:"\u77ED-\u7070\u8272",data:{text:"",width:22,height:30,name:"svgPath",image:"/static/figures/pipe-new/\u77ED-\u7070\u8272.svg"}},{name:"\u6A2A\u5411-\u7070\u8272",data:{text:"",width:68,height:30,name:"svgPath",image:"/static/figures/pipe-new/\u6A2A\u5411-\u7070\u8272.svg"}},{name:"45\u5EA6-\u7070\u8272",data:{text:"",width:75,height:58,name:"svgPath",image:"/static/figures/pipe-new/45\u5EA6-\u7070\u8272.svg"}},{name:"90\u5EA6-\u7070\u8272",data:{text:"",width:84,height:84,name:"svgPath",image:"/static/figures/pipe-new/90\u5EA6-\u7070\u8272.svg"}},{name:"\u4E09\u901AL",data:{text:"",width:91,height:79,name:"svgPath",image:"/static/figures/pipe-new/\u4E09\u901AL.svg"}},{name:"\u77ED-\u84DD\u8272",data:{text:"",width:22,height:30,name:"svgPath",image:"/static/figures/pipe-new/\u77ED-\u84DD\u8272.svg"}},{name:"\u6A2A\u5411-\u84DD\u8272",data:{text:"",width:68,height:30,name:"svgPath",image:"/static/figures/pipe-new/\u6A2A\u5411-\u84DD\u8272.svg"}},{name:"45\u5EA6-\u84DD\u8272",data:{text:"",width:75,height:58,name:"svgPath",image:"/static/figures/pipe-new/45\u5EA6-\u84DD\u8272.svg"}},{name:"90\u5EA6-\u84DD\u8272",data:{text:"",width:84,height:84,name:"svgPath",image:"/static/figures/pipe-new/90\u5EA6-\u84DD\u8272.svg"}},{name:"\u4E09\u901AT",data:{text:"",width:85,height:66,name:"svgPath",image:"/static/figures/pipe-new/\u4E09\u901AT.svg"}},{name:"\u77ED-\u7D2B\u8272",data:{text:"",width:22,height:30,name:"svgPath",image:"/static/figures/pipe-new/\u77ED-\u7D2B\u8272.svg"}},{name:"\u6A2A\u5411-\u7D2B\u8272",data:{text:"",width:68,height:30,name:"svgPath",image:"/static/figures/pipe-new/\u6A2A\u5411-\u7D2B\u8272.svg"}},{name:"45\u5EA6-\u7D2B\u8272",data:{text:"",width:75,height:58,name:"svgPath",image:"/static/figures/pipe-new/45\u5EA6-\u7D2B\u8272.svg"}},{name:"90\u5EA6-\u7D2B\u8272",data:{text:"",width:84,height:84,name:"svgPath",image:"/static/figures/pipe-new/90\u5EA6-\u7D2B\u8272.svg"}},{name:"\u4E09\u901AY",data:{text:"",width:85,height:85,name:"svgPath",image:"/static/figures/pipe-new/\u4E09\u901AY.svg"}},{name:"\u9600\u95E8-\u7EFF\u8272",data:{text:"",width:32,height:80,name:"svgPath",image:"/static/figures/pipe-new/\u9600\u95E8-green.svg"}},{name:"\u9600\u95E8-\u7EA2\u8272",data:{text:"",width:32,height:80,name:"svgPath",image:"/static/figures/pipe-new/\u9600\u95E8-red.svg"}},{name:"\u9600\u95E8-\u9EC4\u8272",data:{text:"",width:32,height:80,name:"svgPath",image:"/static/figures/pipe-new/\u9600\u95E8-yellow.svg"}},{name:"\u7BA1\u9053\u5E26\u9600\u95E8",data:{text:"",width:86,height:38,name:"svgPath",image:"/static/figures/pipe-new/\u7BA1\u9053\u5E26\u9600\u95E8.svg"}},{name:"\u5206\u6C14\u7F38",data:{text:"",width:229,height:108,name:"svgPath",image:"/static/figures/pipe-new/\u5206\u6C14\u7F38.svg"}}]},$C={name:"\u6309\u94AE",show:!0,list:[{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE0.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE1.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE2.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE3.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE4.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE5.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE6.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE7.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE8.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE9.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE10.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE11.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE12.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE13.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE14.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE15.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE16.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE17.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE18.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE19.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE20.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE21.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE22.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE23.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE24.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE25.svg"}},{data:{text:"",width:31,height:52,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE26.svg"}},{data:{text:"",width:31,height:52,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE27.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE28.svg"}},{data:{text:"",width:31,height:52,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE29.svg"}},{data:{text:"",width:31,height:52,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE30.svg"}},{data:{text:"",width:31,height:52,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE31.svg"}},{data:{text:"",width:31,height:52,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE32.svg"}},{data:{text:"",width:31,height:52,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE33.svg"}},{data:{text:"",width:31,height:52,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE34.svg"}},{data:{text:"",width:31,height:52,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE35.svg"}},{data:{text:"",width:31,height:52,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE36.svg"}},{data:{text:"",width:31,height:52,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE37.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE38.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE39.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE40.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE41.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE42.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE43.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE44.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE45.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE46.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE47.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE48.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE49.svg"}}]},YC={name:"\u7535\u529B",show:!0,list:[{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/ele-1/1.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/ele-1/2.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/ele-1/3.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/ele-1/4.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/ele-1/5.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/ele-1/6.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/ele-1/7.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/ele-1/8.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/ele-1/9.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/ele-1/10.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/ele-1/11.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/ele-1/12.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/ele-1/13.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/ele-1/14.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/ele-1/15.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/ele-1/16.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/ele-1/17.svg"}}]},qT=["time-comp"],jT=[{name:"\u57FA\u672C\u5F62\u72B6",show:!0,list:[{name:"square",icon:"t-icon t-rect",id:1,data:{text:"\u6B63\u65B9\u5F62",width:100,height:100,name:"square"}},{name:"rectangle",icon:"t-icon t-rectangle",id:2,data:{text:"\u5706\u89D2\u77E9\u5F62",width:200,height:50,borderRadius:.1,name:"rectangle"}},{name:"circle",icon:"t-icon t-circle",id:3,data:{text:"\u5706",width:100,height:100,name:"circle"}},{name:"text",icon:"t-icon t-text",id:16,data:{text:"\u6587\u5B57",width:100,height:40,name:"text",disableAnchor:!0}},{name:"triangle",icon:"t-icon t-triangle",id:4,data:{text:"\u4E09\u89D2\u5F62",width:100,height:100,name:"triangle"}},{name:"diamond",icon:"t-icon t-diamond",id:5,data:{text:"\u83F1\u5F62",width:100,height:100,name:"diamond"}},{name:"pentagon",icon:"t-icon t-pentagon",id:6,data:{text:"\u4E94\u8FB9\u5F62",width:100,height:100,name:"pentagon"}},{name:"hexagon",icon:"t-icon t-hexagon",id:7,data:{text:"\u516D\u8FB9\u5F62",width:100,height:100,name:"hexagon"}},{name:"pentagram",icon:"t-icon t-pentagram",id:8,data:{text:"\u4E94\u89D2\u661F",width:100,height:100,name:"pentagram"}},{name:"leftArrow",icon:"t-icon t-arrow-left",id:9,data:{text:"\u5DE6\u7BAD\u5934",width:120,height:60,name:"leftArrow"}},{name:"rightArrow",icon:"t-icon t-arrow-right",id:10,data:{text:"\u53F3\u7BAD\u5934",width:120,height:60,name:"rightArrow"}},{name:"twowayArrow",icon:"t-icon t-twoway-arrow",id:11,data:{text:"\u53CC\u5411\u7BAD\u5934",width:150,height:60,name:"twowayArrow"}},{name:"cloud",icon:"t-icon t-cloud",id:13,data:{text:"\u4E91",width:100,height:100,name:"cloud"}},{name:"message",icon:"t-icon t-msg",id:14,data:{textTop:-.1,text:"\u6D88\u606F\u6846",width:100,height:100,name:"message"}},{name:"file",icon:"t-icon t-file",id:15,data:{text:"\u6587\u6863",width:80,height:100,name:"file"}},{name:"image",icon:"t-icon t-image",id:17,data:{text:"",width:100,height:100,name:"image",image:"https://zhgy.sagoo.cn/base-api/upload_file/2023-11-24/cx73xp2ebryeijgtdt.jpeg"}},{name:"\u52A8\u56FE",icon:"t-icon t-image",data:{text:"",width:100,height:100,name:"gif",image:"/plugin/topo/static/gif.gif"}},{name:"people",icon:"t-icon t-people",id:19,data:{width:70,height:100,name:"people"}},{name:"switch",icon:"t-icon t-kaiguan",data:{name:"switch",checked:!0,onColor:"#1890ff",offColor:"#BFBFBF",width:60,height:30}}]},{name:"\u529F\u80FD\u7EC4\u4EF6",show:!0,list:[{name:"\u65F6\u95F4",icon:"topoicon topo-time",id:16,data:{text:"2022/12/12 12:12:12",width:200,height:40,name:"text",tags:["time-comp"],disableAnchor:!0}},{name:"\u6309\u94AE",icon:"t-icon t-anniu",data:{name:"rectangle",customType:"link-button",x:300,y:200,width:80,height:30,disableAnchor:!0,borderRadius:2,text:"\u6309\u94AE",activeBackground:"#40a9ff",activeColor:"#40a9ff",background:"#1890ff",color:"#1890ff",hoverBackground:"#40a9ff",hoverColor:"#40a9ff",textColor:"#ffffff",hoverTextColor:"#ffffff",activeTextColor:"#ffffff"}}]},{...VC},{...$C},{...YC},{name:"\u7535\u529B\u7CFB\u7EDF-1",show:!0,list:[{font_family:"sg-ele",my_class:"uniE00A",unicode:"e900"},{font_family:"sg-ele",my_class:"uniE04D",unicode:"e97e"},{font_family:"sg-ele",my_class:"uniE04E",unicode:"e97f"},{font_family:"sg-ele",my_class:"uniE005",unicode:"e981"},{font_family:"sg-ele",my_class:"uniE007",unicode:"e98f"},{font_family:"sg-ele",my_class:"uniE006",unicode:"e988"},{font_family:"sg-ele",my_class:"uniE008",unicode:"e996"},{font_family:"sg-ele",my_class:"uniE009",unicode:"e99d"},{font_family:"sg-ele",my_class:"uniE012",unicode:"e9b2"},{font_family:"sg-ele",my_class:"uniE082",unicode:"ea09"},{font_family:"sg-ele",my_class:"uniE088",unicode:"ea0f"},{font_family:"sg-ele",my_class:"uniE090",unicode:"ea11"},{font_family:"sg-ele",my_class:"uniE107",unicode:"ea22"},{font_family:"sg-ele",my_class:"uniE152",unicode:"ea4f"},{font_family:"sg-ele",my_class:"uniE080",unicode:"ea07"},{font_family:"sg-ele",my_class:"uniE084",unicode:"ea0b"},{font_family:"sg-ele",my_class:"uniE059",unicode:"e9f2"},{font_family:"sg-ele",my_class:"uniE10C",unicode:"e9a7"},{font_family:"sg-ele",my_class:"uniE0A0",unicode:"e901"}]},{name:"\u7535\u529B\u7CFB\u7EDF-2",show:!0,list:[{font_family:"sg-ele",my_class:"uniE09E",unicode:"e9a2"},{font_family:"sg-ele",my_class:"uniE010",unicode:"e9a4"},{font_family:"sg-ele",my_class:"uniE014",unicode:"e9bf"},{font_family:"sg-ele",my_class:"uniE040",unicode:"e9df"},{font_family:"sg-ele",my_class:"uniE041",unicode:"e9e0"},{font_family:"sg-ele",my_class:"uniE042",unicode:"e9e1"},{font_family:"sg-ele",my_class:"uniE043",unicode:"e9e2"},{font_family:"sg-ele",my_class:"uniE044",unicode:"e9e3"},{font_family:"sg-ele",my_class:"uniE062",unicode:"e9f5"},{font_family:"sg-ele",my_class:"uniE110",unicode:"ea25"},{font_family:"sg-ele",my_class:"uniE095",unicode:"ea16"},{font_family:"sg-ele",my_class:"uniE0FC",unicode:"e961"},{font_family:"sg-ele",my_class:"uniE02B",unicode:"e96e"},{font_family:"sg-ele",my_class:"uniE06C",unicode:"e98b"},{font_family:"sg-ele",my_class:"uniE0A1",unicode:"e902"},{font_family:"sg-ele",my_class:"uniE0ED",unicode:"e951"},{font_family:"sg-ele",my_class:"uniE00E",unicode:"e943"},{font_family:"sg-ele",my_class:"uniE0DB",unicode:"e93e"},{font_family:"sg-ele",my_class:"uniE0F0",unicode:"e955"},{font_family:"sg-ele",my_class:"uniE0EC",unicode:"e950"},{font_family:"sg-ele",my_class:"uniE0EE",unicode:"e952"},{font_family:"sg-ele",my_class:"uniE00B",unicode:"e911"},{font_family:"sg-ele",my_class:"uniE018",unicode:"e9c9"},{font_family:"sg-ele",my_class:"uniE103",unicode:"ea1e"},{font_family:"sg-ele",my_class:"uniE094",unicode:"ea15"},{font_family:"sg-ele",my_class:"uniE073",unicode:"ea00"}]},{name:"\u7535\u529B\u7CFB\u7EDF-3",show:!0,list:[{font_family:"sg-ele",my_class:"uniE0E4",unicode:"e948"},{font_family:"sg-ele",my_class:"uniE00F",unicode:"e954"},{font_family:"sg-ele",my_class:"uniE05A",unicode:"e982"},{font_family:"sg-ele",my_class:"uniE0AC",unicode:"e90d"},{font_family:"sg-ele",my_class:"uniE0AD",unicode:"e90e"},{font_family:"sg-ele",my_class:"uniE08F",unicode:"e99c"},{font_family:"sg-ele",my_class:"uniE02D",unicode:"e970"},{font_family:"sg-ele",my_class:"uniE09A",unicode:"e99e"},{font_family:"sg-ele",my_class:"uniE00D",unicode:"e932"},{font_family:"sg-ele",my_class:"uniE0C5",unicode:"e928"},{font_family:"sg-ele",my_class:"uniE10B",unicode:"e9a6"},{font_family:"sg-ele",my_class:"uniE00C",unicode:"e922"},{font_family:"sg-ele",my_class:"uniE0F5",unicode:"e95a"},{font_family:"sg-ele",my_class:"uniE01D",unicode:"e969"},{font_family:"sg-ele",my_class:"uniE02C",unicode:"e96f"},{font_family:"sg-ele",my_class:"uniE002",unicode:"e96c"},{font_family:"sg-ele",my_class:"uniE019",unicode:"e9ca"},{font_family:"sg-ele",my_class:"uniE020",unicode:"e9cb"},{font_family:"sg-ele",my_class:"uniE021",unicode:"e9cc"},{font_family:"sg-ele",my_class:"uniE022",unicode:"e9cd"},{font_family:"sg-ele",my_class:"uniE102",unicode:"ea1d"},{font_family:"sg-ele",my_class:"uniE023",unicode:"e9ce"},{font_family:"sg-ele",my_class:"uniE024",unicode:"e9cf"},{font_family:"sg-ele",my_class:"uniE025",unicode:"e9d0"},{font_family:"sg-ele",my_class:"uniE015",unicode:"e9c6"},{font_family:"sg-ele",my_class:"uniE0CB",unicode:"e92d"},{font_family:"sg-ele",my_class:"uniE0E2",unicode:"e946"},{font_family:"sg-ele",my_class:"uniE091",unicode:"ea12"},{font_family:"sg-ele",my_class:"uniE096",unicode:"ea17"}]},{name:"\u7535\u529B\u7CFB\u7EDF-4",show:!0,list:[{font_family:"sg-ele",my_class:"uniE0A2",unicode:"e903"},{font_family:"sg-ele",my_class:"uniE0A3",unicode:"e904"},{font_family:"sg-ele",my_class:"uniE0A6",unicode:"e907"},{font_family:"sg-ele",my_class:"uniE0A8",unicode:"e909"},{font_family:"sg-ele",my_class:"uniE0AE",unicode:"e90f"},{font_family:"sg-ele",my_class:"uniE0C7",unicode:"e929"},{font_family:"sg-ele",my_class:"uniE0C8",unicode:"e92a"},{font_family:"sg-ele",my_class:"uniE0EB",unicode:"e94f"},{font_family:"sg-ele",my_class:"uniE03E",unicode:"e978"},{font_family:"sg-ele",my_class:"uniE05F",unicode:"e987"},{font_family:"sg-ele",my_class:"uniE08A",unicode:"e997"},{font_family:"sg-ele",my_class:"uniE0BC",unicode:"e91e"},{font_family:"sg-ele",my_class:"uniE071",unicode:"e9fe"},{font_family:"sg-ele",my_class:"uniE111",unicode:"ea26"},{font_family:"sg-ele",my_class:"uniE112",unicode:"ea27"},{font_family:"sg-ele",my_class:"uniE100",unicode:"ea1b"},{font_family:"sg-ele",my_class:"uniE108",unicode:"ea23"},{font_family:"sg-ele",my_class:"uniE104",unicode:"ea1f"},{font_family:"sg-ele",my_class:"uniE105",unicode:"ea20"},{font_family:"sg-ele",my_class:"uniE079",unicode:"ea06"},{font_family:"sg-ele",my_class:"uniE072",unicode:"e9ff"},{font_family:"sg-ele",my_class:"uniE10D",unicode:"e9a8"},{font_family:"sg-ele",my_class:"uniE056",unicode:"e9ef"},{font_family:"sg-ele",my_class:"uniE047",unicode:"e9e6"},{font_family:"sg-ele",my_class:"uniE048",unicode:"e9e7"},{font_family:"sg-ele",my_class:"uniE049",unicode:"e9e8"},{font_family:"sg-ele",my_class:"uniE026",unicode:"e9d1"},{font_family:"sg-ele",my_class:"uniE028",unicode:"e9d3"},{font_family:"sg-ele",my_class:"uniE06F",unicode:"e98e"},{font_family:"sg-ele",my_class:"uniE11B",unicode:"e9ad"},{font_family:"sg-ele",my_class:"uniE04A",unicode:"e97b"},{font_family:"sg-ele",my_class:"uniE04B",unicode:"e97c"},{font_family:"sg-ele",my_class:"uniE04C",unicode:"e97d"},{font_family:"sg-ele",my_class:"uniE0EF",unicode:"e953"},{font_family:"sg-ele",my_class:"uniE0D8",unicode:"e93b"},{font_family:"sg-ele",my_class:"uniE0C9",unicode:"e92b"},{font_family:"sg-ele",my_class:"uniE0BE",unicode:"e920"}]},{name:"\u7535\u529B\u7CFB\u7EDF-5",show:!0,list:[{font_family:"sg-ele",my_class:"uniE140",unicode:"ea43"},{font_family:"sg-ele",my_class:"uniE0B5",unicode:"e917"},{font_family:"sg-ele",my_class:"uniE0E8",unicode:"e94c"},{font_family:"sg-ele",my_class:"uniE0B9",unicode:"e91b"},{font_family:"sg-ele",my_class:"uniE0AB",unicode:"e90c"},{font_family:"sg-ele",my_class:"uniE14F",unicode:"e9c5"},{font_family:"sg-ele",my_class:"uniE070",unicode:"e9fd"},{font_family:"sg-ele",my_class:"uniE0A7",unicode:"e908"},{font_family:"sg-ele",my_class:"uniE0A9",unicode:"e90a"},{font_family:"sg-ele",my_class:"uniE0AA",unicode:"e90b"},{font_family:"sg-ele",my_class:"uniE077",unicode:"ea04"},{font_family:"sg-ele",my_class:"uniE06E",unicode:"e98d"},{font_family:"sg-ele",my_class:"uniE10E",unicode:"e9a9"},{font_family:"sg-ele",my_class:"uniE10F",unicode:"e9aa"},{font_family:"sg-ele",my_class:"uniE0DC",unicode:"e93f"},{font_family:"sg-ele",my_class:"uniE0E7",unicode:"e94b"},{font_family:"sg-ele",my_class:"uniE113",unicode:"ea28"},{font_family:"sg-ele",my_class:"uniE127",unicode:"ea36"},{font_family:"sg-ele",my_class:"uniE097",unicode:"ea18"},{font_family:"sg-ele",my_class:"uniE136",unicode:"ea3f"},{font_family:"sg-ele",my_class:"uniE0A5",unicode:"e906"},{font_family:"sg-ele",my_class:"uniE0CE",unicode:"e930"},{font_family:"sg-ele",my_class:"uniE045",unicode:"e9e4"},{font_family:"sg-ele",my_class:"uniE046",unicode:"e9e5"},{font_family:"sg-ele",my_class:"uniE0E0",unicode:"e944"},{font_family:"sg-ele",my_class:"uniE063",unicode:"e9f6"},{font_family:"sg-ele",my_class:"uniE0F1",unicode:"e956"},{font_family:"sg-ele",my_class:"uniE07C",unicode:"e992"},{font_family:"sg-ele",my_class:"uniE07D",unicode:"e993"},{font_family:"sg-ele",my_class:"uniE08C",unicode:"e999"},{font_family:"sg-ele",my_class:"uniE0B3",unicode:"e915"},{font_family:"sg-ele",my_class:"uniE0AF",unicode:"e910"},{font_family:"sg-ele",my_class:"uniE0B2",unicode:"e914"},{font_family:"sg-ele",my_class:"uniE0B6",unicode:"e918"},{font_family:"sg-ele",my_class:"uniE0FB",unicode:"e960"},{font_family:"sg-ele",my_class:"uniE0B8",unicode:"e91a"},{font_family:"sg-ele",my_class:"uniE0CD",unicode:"e92f"},{font_family:"sg-ele",my_class:"uniE0D1",unicode:"e934"},{font_family:"sg-ele",my_class:"uniE0D3",unicode:"e936"},{font_family:"sg-ele",my_class:"uniE0D5",unicode:"e938"},{font_family:"sg-ele",my_class:"uniE087",unicode:"ea0e"},{font_family:"sg-ele",my_class:"uniE0D9",unicode:"e93c"},{font_family:"sg-ele",my_class:"uniE0DD",unicode:"e940"},{font_family:"sg-ele",my_class:"uniE0DE",unicode:"e941"},{font_family:"sg-ele",my_class:"uniE0DF",unicode:"e942"},{font_family:"sg-ele",my_class:"uniE0E3",unicode:"e947"},{font_family:"sg-ele",my_class:"uniE0E5",unicode:"e949"},{font_family:"sg-ele",my_class:"uniE0E6",unicode:"e94a"},{font_family:"sg-ele",my_class:"uniE0E9",unicode:"e94d"},{font_family:"sg-ele",my_class:"uniE0F2",unicode:"e957"},{font_family:"sg-ele",my_class:"uniE0FA",unicode:"e95f"},{font_family:"sg-ele",my_class:"uniE0FF",unicode:"e964"},{font_family:"sg-ele",my_class:"uniE001",unicode:"e965"},{font_family:"sg-ele",my_class:"uniE01A",unicode:"e966"},{font_family:"sg-ele",my_class:"uniE01E",unicode:"e96a"},{font_family:"sg-ele",my_class:"uniE003",unicode:"e973"},{font_family:"sg-ele",my_class:"uniE0E1",unicode:"e945"},{font_family:"sg-ele",my_class:"uniE035",unicode:"e9da"},{font_family:"sg-ele",my_class:"uniE0C0",unicode:"e923"},{font_family:"sg-ele",my_class:"uniE03F",unicode:"e979"},{font_family:"sg-ele",my_class:"uniE05E",unicode:"e986"},{font_family:"sg-ele",my_class:"uniE07F",unicode:"e995"},{font_family:"sg-ele",my_class:"uniE08B",unicode:"e998"},{font_family:"sg-ele",my_class:"uniE08D",unicode:"e99a"},{font_family:"sg-ele",my_class:"uniE09B",unicode:"e99f"},{font_family:"sg-ele",my_class:"uniE09C",unicode:"e9a0"},{font_family:"sg-ele",my_class:"uniE029",unicode:"e9d4"},{font_family:"sg-ele",my_class:"uniE036",unicode:"e9db"},{font_family:"sg-ele",my_class:"uniE037",unicode:"e9dc"},{font_family:"sg-ele",my_class:"uniE038",unicode:"e9dd"},{font_family:"sg-ele",my_class:"uniE053",unicode:"e9ec"},{font_family:"sg-ele",my_class:"uniE054",unicode:"e9ed"},{font_family:"sg-ele",my_class:"uniE076",unicode:"ea03"},{font_family:"sg-ele",my_class:"uniE081",unicode:"ea08"},{font_family:"sg-ele",my_class:"uniE085",unicode:"ea0c"},{font_family:"sg-ele",my_class:"uniE089",unicode:"ea10"},{font_family:"sg-ele",my_class:"uniE098",unicode:"ea19"},{font_family:"sg-ele",my_class:"uniE093",unicode:"ea14"}]},{name:"\u7535\u529B\u7CFB\u7EDF-6",show:!0,list:[{font_family:"sg-ele",my_class:"uniE147",unicode:"ea4a"},{font_family:"sg-ele",my_class:"uniE145",unicode:"ea48"},{font_family:"sg-ele",my_class:"uniE148",unicode:"ea4b"},{font_family:"sg-ele",my_class:"uniE139",unicode:"ea42"},{font_family:"sg-ele",my_class:"uniE133",unicode:"ea3c"},{font_family:"sg-ele",my_class:"uniE135",unicode:"ea3e"},{font_family:"sg-ele",my_class:"uniE064",unicode:"e9f7"},{font_family:"sg-ele",my_class:"uniE065",unicode:"e9f8"},{font_family:"sg-ele",my_class:"uniE066",unicode:"e9f9"},{font_family:"sg-ele",my_class:"uniE067",unicode:"e9fa"},{font_family:"sg-ele",my_class:"uniE068",unicode:"e9fb"},{font_family:"sg-ele",my_class:"uniE14B",unicode:"e9c1"},{font_family:"sg-ele",my_class:"uniE14D",unicode:"e9c3"},{font_family:"sg-ele",my_class:"uniE13A",unicode:"e9b9"},{font_family:"sg-ele",my_class:"uniE13B",unicode:"e9ba"},{font_family:"sg-ele",my_class:"uniE12C",unicode:"e9b4"},{font_family:"sg-ele",my_class:"uniE06D",unicode:"e98c"},{font_family:"sg-ele",my_class:"uniE05C",unicode:"e984"},{font_family:"sg-ele",my_class:"uniE03A",unicode:"e974"},{font_family:"sg-ele",my_class:"uniE03B",unicode:"e975"},{font_family:"sg-ele",my_class:"uniE03C",unicode:"e976"},{font_family:"sg-ele",my_class:"uniE004",unicode:"e97a"},{font_family:"sg-ele",my_class:"uniE134",unicode:"ea3d"},{font_family:"sg-ele",my_class:"uniE128",unicode:"ea37"},{font_family:"sg-ele",my_class:"uniE122",unicode:"ea31"},{font_family:"sg-ele",my_class:"uniE123",unicode:"ea32"},{font_family:"sg-ele",my_class:"uniE120",unicode:"ea2f"},{font_family:"sg-ele",my_class:"uniE039",unicode:"e9de"},{font_family:"sg-ele",my_class:"uniE03D",unicode:"e977"},{font_family:"sg-ele",my_class:"uniE05D",unicode:"e985"},{font_family:"sg-ele",my_class:"uniE0EA",unicode:"e94e"},{font_family:"sg-ele",my_class:"uniE08E",unicode:"e99b"},{font_family:"sg-ele",my_class:"uniE07A",unicode:"e990"},{font_family:"sg-ele",my_class:"uniE07B",unicode:"e991"},{font_family:"sg-ele",my_class:"uniE074",unicode:"ea01"},{font_family:"sg-ele",my_class:"uniE078",unicode:"ea05"}]},{name:"\u7535\u529B\u7CFB\u7EDF-7",show:!0,list:[{font_family:"sg-ele",my_class:"uniE02A",unicode:"e96d"},{font_family:"sg-ele",my_class:"uniE02E",unicode:"e971"},{font_family:"sg-ele",my_class:"uniE02F",unicode:"e972"},{font_family:"sg-ele",my_class:"uniE131",unicode:"ea3a"},{font_family:"sg-ele",my_class:"uniE132",unicode:"ea3b"},{font_family:"sg-ele",my_class:"uniE143",unicode:"ea46"},{font_family:"sg-ele",my_class:"uniE0A4",unicode:"e905"},{font_family:"sg-ele",my_class:"uniE144",unicode:"ea47"},{font_family:"sg-ele",my_class:"uniE146",unicode:"ea49"},{font_family:"sg-ele",my_class:"uniE149",unicode:"ea4c"},{font_family:"sg-ele",my_class:"uniE150",unicode:"ea4d"},{font_family:"sg-ele",my_class:"uniE154",unicode:"ea50"},{font_family:"sg-ele",my_class:"uniE151",unicode:"ea4e"},{font_family:"sg-ele",my_class:"uniE138",unicode:"ea41"},{font_family:"sg-ele",my_class:"uniE0C2",unicode:"e925"},{font_family:"sg-ele",my_class:"uniE027",unicode:"e9d2"},{font_family:"sg-ele",my_class:"uniE141",unicode:"ea44"},{font_family:"sg-ele",my_class:"uniE126",unicode:"ea35"},{font_family:"sg-ele",my_class:"uniE129",unicode:"ea38"},{font_family:"sg-ele",my_class:"uniE130",unicode:"ea39"},{font_family:"sg-ele",my_class:"uniE069",unicode:"e9fc"},{font_family:"sg-ele",my_class:"uniE057",unicode:"e9f0"},{font_family:"sg-ele",my_class:"uniE058",unicode:"e9f1"},{font_family:"sg-ele",my_class:"uniE030",unicode:"e9d5"},{font_family:"sg-ele",my_class:"uniE031",unicode:"e9d6"},{font_family:"sg-ele",my_class:"uniE032",unicode:"e9d7"},{font_family:"sg-ele",my_class:"uniE033",unicode:"e9d8"},{font_family:"sg-ele",my_class:"uniE034",unicode:"e9d9"},{font_family:"sg-ele",my_class:"uniE12B",unicode:"e9b3"},{font_family:"sg-ele",my_class:"uniE12D",unicode:"e9b5"},{font_family:"sg-ele",my_class:"uniE12E",unicode:"e9b6"},{font_family:"sg-ele",my_class:"uniE12F",unicode:"e9b7"},{font_family:"sg-ele",my_class:"uniE14A",unicode:"e9c0"},{font_family:"sg-ele",my_class:"uniE14C",unicode:"e9c2"},{font_family:"sg-ele",my_class:"uniE14E",unicode:"e9c4"},{font_family:"sg-ele",my_class:"uniE06A",unicode:"e989"},{font_family:"sg-ele",my_class:"uniE011",unicode:"e9ab"},{font_family:"sg-ele",my_class:"uniE075",unicode:"ea02"},{font_family:"sg-ele",my_class:"uniE083",unicode:"ea0a"},{font_family:"sg-ele",my_class:"uniE0C4",unicode:"e927"},{font_family:"sg-ele",my_class:"uniE0B1",unicode:"e913"},{font_family:"sg-ele",my_class:"uniE0FE",unicode:"e963"}]},{name:"\u7535\u529B\u7CFB\u7EDF-8",show:!0,list:[{font_family:"sg-ele",my_class:"uniE114",unicode:"ea29"},{font_family:"sg-ele",my_class:"uniE115",unicode:"ea2a"},{font_family:"sg-ele",my_class:"uniE116",unicode:"ea2b"},{font_family:"sg-ele",my_class:"uniE117",unicode:"ea2c"},{font_family:"sg-ele",my_class:"uniE118",unicode:"ea2d"},{font_family:"sg-ele",my_class:"uniE119",unicode:"ea2e"},{font_family:"sg-ele",my_class:"uniE121",unicode:"ea30"},{font_family:"sg-ele",my_class:"uniE124",unicode:"ea33"},{font_family:"sg-ele",my_class:"uniE0B0",unicode:"e912"},{font_family:"sg-ele",my_class:"uniE0B7",unicode:"e919"},{font_family:"sg-ele",my_class:"uniE0BA",unicode:"e91c"},{font_family:"sg-ele",my_class:"uniE0BB",unicode:"e91d"},{font_family:"sg-ele",my_class:"uniE0BD",unicode:"e91f"},{font_family:"sg-ele",my_class:"uniE0C1",unicode:"e924"},{font_family:"sg-ele",my_class:"uniE0CC",unicode:"e92e"},{font_family:"sg-ele",my_class:"uniE0DA",unicode:"e93d"},{font_family:"sg-ele",my_class:"uniE0F3",unicode:"e958"},{font_family:"sg-ele",my_class:"uniE0F4",unicode:"e959"},{font_family:"sg-ele",my_class:"uniE0F6",unicode:"e95b"},{font_family:"sg-ele",my_class:"uniE0F7",unicode:"e95c"},{font_family:"sg-ele",my_class:"uniE0F8",unicode:"e95d"},{font_family:"sg-ele",my_class:"uniE0F9",unicode:"e95e"},{font_family:"sg-ele",my_class:"uniE0FD",unicode:"e962"},{font_family:"sg-ele",my_class:"uniE04F",unicode:"e980"},{font_family:"sg-ele",my_class:"uniE05B",unicode:"e983"},{font_family:"sg-ele",my_class:"uniE11A",unicode:"e9ac"},{font_family:"sg-ele",my_class:"uniE11C",unicode:"e9ae"},{font_family:"sg-ele",my_class:"uniE11D",unicode:"e9af"},{font_family:"sg-ele",my_class:"uniE11E",unicode:"e9b0"},{font_family:"sg-ele",my_class:"uniE13C",unicode:"e9bb"},{font_family:"sg-ele",my_class:"uniE13D",unicode:"e9bc"},{font_family:"sg-ele",my_class:"uniE13E",unicode:"e9bd"},{font_family:"sg-ele",my_class:"uniE052",unicode:"e9eb"},{font_family:"sg-ele",my_class:"uniE055",unicode:"e9ee"},{font_family:"sg-ele",my_class:"uniE060",unicode:"e9f3"},{font_family:"sg-ele",my_class:"uniE0B4",unicode:"e916"},{font_family:"sg-ele",my_class:"uniE0BF",unicode:"e921"},{font_family:"sg-ele",my_class:"uniE0CA",unicode:"e92c"},{font_family:"sg-ele",my_class:"uniE0D7",unicode:"e93a"},{font_family:"sg-ele",my_class:"uniE06B",unicode:"e98a"},{font_family:"sg-ele",my_class:"uniE10A",unicode:"e9a5"},{font_family:"sg-ele",my_class:"uniE017",unicode:"e9c8"},{font_family:"sg-ele",my_class:"uniE050",unicode:"e9e9"},{font_family:"sg-ele",my_class:"uniE086",unicode:"ea0d"},{font_family:"sg-ele",my_class:"uniE099",unicode:"ea1a"},{font_family:"sg-ele",my_class:"uniE101",unicode:"ea1c"}]},{name:"\u7535\u529B\u7CFB\u7EDF-9",show:!0,list:[{font_family:"sg-ele",my_class:"uniE106",unicode:"ea21"},{font_family:"sg-ele",my_class:"uniE109",unicode:"ea24"},{font_family:"sg-ele",my_class:"uniE061",unicode:"e9f4"},{font_family:"sg-ele",my_class:"uniE092",unicode:"ea13"},{font_family:"sg-ele",my_class:"uniE01B",unicode:"e967"},{font_family:"sg-ele",my_class:"uniE01C",unicode:"e968"},{font_family:"sg-ele",my_class:"uniE09D",unicode:"e9a1"},{font_family:"sg-ele",my_class:"uniE09F",unicode:"e9a3"},{font_family:"sg-ele",my_class:"uniE11F",unicode:"e9b1"},{font_family:"sg-ele",my_class:"uniE13F",unicode:"e9be"},{font_family:"sg-ele",my_class:"uniE016",unicode:"e9c7"},{font_family:"sg-ele",my_class:"uniE125",unicode:"ea34"},{font_family:"sg-ele",my_class:"uniE137",unicode:"ea40"},{font_family:"sg-ele",my_class:"uniE142",unicode:"ea45"},{font_family:"sg-ele",my_class:"uniE0C3",unicode:"e926"},{font_family:"sg-ele",my_class:"uniE0CF",unicode:"e931"},{font_family:"sg-ele",my_class:"uniE0D0",unicode:"e933"},{font_family:"sg-ele",my_class:"uniE0D2",unicode:"e935"},{font_family:"sg-ele",my_class:"uniE0D4",unicode:"e937"},{font_family:"sg-ele",my_class:"uniE0D6",unicode:"e939"},{font_family:"sg-ele",my_class:"uniE051",unicode:"e9ea"}]},{name:"\u8111\u56FE",show:!1,list:[{name:"mindNode",icon:"t-icon t-zhuti",data:{text:"\u4E3B\u9898",width:200,height:50,name:"mindNode",borderRadius:.5}},{name:"mindLine",icon:"t-icon t-zizhuti",data:{text:"\u5B50\u4E3B\u9898",width:160,height:40,name:"mindLine"}}]},{name:"\u6D41\u7A0B\u56FE",show:!1,list:[{name:"\u5F00\u59CB/\u7ED3\u675F",icon:"t-icon t-flow-start",id:21,data:{text:"\u5F00\u59CB/\u7ED3\u675F",width:120,height:40,borderRadius:.5,name:"rectangle"}},{name:"\u6D41\u7A0B",icon:"t-icon t-rectangle",id:22,data:{text:"\u6D41\u7A0B",width:120,height:40,name:"rectangle"}},{name:"\u5224\u5B9A",icon:"t-icon t-diamond",id:23,data:{text:"\u5224\u5B9A",width:120,height:60,name:"diamond"}},{name:"\u6570\u636E",icon:"t-icon t-flow-data",id:24,data:{text:"\u6570\u636E",width:120,height:50,name:"flowData"}},{name:"\u51C6\u5907",icon:"t-icon t-flow-ready",id:25,data:{text:"\u51C6\u5907",width:120,height:50,name:"hexagon"}},{name:"\u5B50\u6D41\u7A0B",icon:"t-icon t-flow-subprocess",id:26,data:{text:"\u5B50\u6D41\u7A0B",width:120,height:50,name:"flowSubprocess"}},{name:"\u6570\u636E\u5E93",icon:"t-icon t-db",id:27,data:{text:"\u6570\u636E\u5E93",width:80,height:120,name:"flowDb"}},{name:"\u6587\u6863",icon:"t-icon t-flow-document",id:28,data:{text:"\u6587\u6863",width:120,height:100,name:"flowDocument"}},{name:"\u5185\u90E8\u5B58\u50A8",icon:"t-icon t-internal-storage",id:29,data:{text:"\u5185\u90E8\u5B58\u50A8",width:120,height:80,name:"flowInternalStorage"}},{name:"\u5916\u90E8\u5B58\u50A8",icon:"t-icon t-extern-storage",id:30,data:{text:"\u5916\u90E8\u5B58\u50A8",width:120,height:80,name:"flowExternStorage"}},{name:"\u961F\u5217",icon:"t-icon t-flow-queue",id:31,data:{text:"\u961F\u5217",width:100,height:100,name:"flowQueue"}},{name:"\u624B\u52A8\u8F93\u5165",icon:"t-icon t-flow-manually",id:32,data:{text:"\u624B\u52A8\u8F93\u5165",width:120,height:80,name:"flowManually"}},{name:"\u5C55\u793A",icon:"t-icon t-flow-display",id:33,data:{text:"\u5C55\u793A",width:120,height:80,name:"flowDisplay"}},{name:"\u5E76\u884C\u6A21\u5F0F",icon:"t-icon t-flow-parallel",id:34,data:{text:"\u5E76\u884C\u6A21\u5F0F",width:120,height:50,name:"flowParallel"}},{name:"\u6CE8\u91CA",icon:"t-icon t-flow-comment",id:35,data:{text:"\u6CE8\u91CA",width:100,height:100,name:"flowComment"}}]},{name:"\u6D3B\u52A8\u56FE",show:!1,list:[{name:"\u5F00\u59CB",icon:"t-icon t-inital",id:36,data:{text:"",width:30,height:30,name:"circle",background:"#555",color:"transparent"}},{name:"\u7ED3\u675F",icon:"t-icon t-final",id:37,data:{width:30,height:30,name:"activityFinal"}},{name:"\u6D3B\u52A8",icon:"t-icon t-action",id:38,data:{text:"\u6D3B\u52A8",width:120,height:50,borderRadius:.25,name:"rectangle"}},{name:"\u51B3\u7B56/\u5408\u5E76",icon:"t-icon t-diamond",id:39,data:{text:"\u51B3\u7B56/\u5408\u5E76",width:120,height:50,name:"diamond"}},{name:"\u5782\u76F4\u6CF3\u9053",icon:"t-icon t-swimlane-v",id:40,data:{text:"\u5782\u76F4\u6CF3\u9053",width:200,height:500,name:"swimlaneV",textHeight:.1}},{name:"\u6C34\u5E73\u6CF3\u9053",icon:"t-icon t-swimlane-h",id:41,data:{text:"\u6C34\u5E73\u6CF3\u9053",width:500,height:200,name:"swimlaneH",textWidth:.01,textLeft:.04,textAlign:"start"}},{name:"\u5782\u76F4\u5206\u5C94/\u6C47\u5408",icon:"t-icon t-fork-v",id:42,data:{text:"\u5782\u76F4\u5206\u5C94/\u6C47\u5408",width:10,height:150,name:"forkV",fillStyle:"#555",strokeStyle:"transparent"}},{name:"\u6C34\u5E73\u5206\u5C94/\u6C47\u5408",icon:"t-icon t-fork",id:43,data:{text:"\u6C34\u5E73\u5206\u5C94/\u6C47\u5408",width:150,height:10,name:"forkH",fillStyle:"#555",strokeStyle:"transparent"}}]},{name:"\u65F6\u5E8F\u56FE\u548C\u7C7B\u56FE",show:!1,list:[{name:"\u751F\u547D\u7EBF",icon:"t-icon t-lifeline",id:44,data:{text:"\u751F\u547D\u7EBF",width:150,height:400,textHeight:50,name:"lifeline"}},{name:"\u6FC0\u6D3B",icon:"t-icon t-focus",id:45,data:{text:"\u6FC0\u6D3B",width:12,height:200,name:"sequenceFocus"}},{name:"\u7B80\u5355\u7C7B",icon:"t-icon t-simple-class",id:46,data:{text:"Topolgoy",width:270,height:200,textHeight:.2,name:"simpleClass",textAlign:"center",textBaseline:"top",textTop:10,list:[{text:`- name: string
- + setName(name: string): void`}]}},{name:"\u7C7B",icon:"t-icon t-class",id:47,data:{text:"Topolgoy",width:270,height:200,textHeight:.2,name:"interfaceClass",textAlign:"center",textBaseline:"top",textTop:10,list:[{text:"- name: string"},{text:"+ setName(name: string): void"}]}}]}];var Ng={exports:{}},fu={exports:{}},Fg=function(t,i){return function(){for(var r=new Array(arguments.length),n=0;n<r.length;n++)r[n]=arguments[n];return t.apply(i,r)}},GC=Fg,Dr=Object.prototype.toString;function du(e){return Array.isArray(e)}function Vc(e){return typeof e>"u"}function XC(e){return e!==null&&!Vc(e)&&e.constructor!==null&&!Vc(e.constructor)&&typeof e.constructor.isBuffer=="function"&&e.constructor.isBuffer(e)}function zg(e){return Dr.call(e)==="[object ArrayBuffer]"}function ZC(e){return Dr.call(e)==="[object FormData]"}function QC(e){var t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&zg(e.buffer),t}function JC(e){return typeof e=="string"}function eA(e){return typeof e=="number"}function Hg(e){return e!==null&&typeof e=="object"}function Jo(e){if(Dr.call(e)!=="[object Object]")return!1;var t=Object.getPrototypeOf(e);return t===null||t===Object.prototype}function tA(e){return Dr.call(e)==="[object Date]"}function iA(e){return Dr.call(e)==="[object File]"}function rA(e){return Dr.call(e)==="[object Blob]"}function Ug(e){return Dr.call(e)==="[object Function]"}function aA(e){return Hg(e)&&Ug(e.pipe)}function nA(e){return Dr.call(e)==="[object URLSearchParams]"}function oA(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function sA(){return typeof navigator<"u"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window<"u"&&typeof document<"u"}function vu(e,t){if(!(e===null||typeof e>"u"))if(typeof e!="object"&&(e=[e]),du(e))for(var i=0,a=e.length;i<a;i++)t.call(null,e[i],i,e);else for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.call(null,e[r],r,e)}function $c(){var e={};function t(r,n){Jo(e[n])&&Jo(r)?e[n]=$c(e[n],r):Jo(r)?e[n]=$c({},r):du(r)?e[n]=r.slice():e[n]=r}for(var i=0,a=arguments.length;i<a;i++)vu(arguments[i],t);return e}function lA(e,t,i){return vu(t,function(r,n){i&&typeof r=="function"?e[n]=GC(r,i):e[n]=r}),e}function cA(e){return e.charCodeAt(0)===65279&&(e=e.slice(1)),e}var Gt={isArray:du,isArrayBuffer:zg,isBuffer:XC,isFormData:ZC,isArrayBufferView:QC,isString:JC,isNumber:eA,isObject:Hg,isPlainObject:Jo,isUndefined:Vc,isDate:tA,isFile:iA,isBlob:rA,isFunction:Ug,isStream:aA,isURLSearchParams:nA,isStandardBrowserEnv:sA,forEach:vu,merge:$c,extend:lA,trim:oA,stripBOM:cA},Sa=Gt;function Bd(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var Wg=function(t,i,a){if(!i)return t;var r;if(a)r=a(i);else if(Sa.isURLSearchParams(i))r=i.toString();else{var n=[];Sa.forEach(i,function(h,l){h===null||typeof h>"u"||(Sa.isArray(h)?l=l+"[]":h=[h],Sa.forEach(h,function(f){Sa.isDate(f)?f=f.toISOString():Sa.isObject(f)&&(f=JSON.stringify(f)),n.push(Bd(l)+"="+Bd(f))}))}),r=n.join("&")}if(r){var o=t.indexOf("#");o!==-1&&(t=t.slice(0,o)),t+=(t.indexOf("?")===-1?"?":"&")+r}return t},uA=Gt;function _s(){this.handlers=[]}_s.prototype.use=function(t,i,a){return this.handlers.push({fulfilled:t,rejected:i,synchronous:a?a.synchronous:!1,runWhen:a?a.runWhen:null}),this.handlers.length-1};_s.prototype.eject=function(t){this.handlers[t]&&(this.handlers[t]=null)};_s.prototype.forEach=function(t){uA.forEach(this.handlers,function(a){a!==null&&t(a)})};var hA=_s,fA=Gt,dA=function(t,i){fA.forEach(t,function(r,n){n!==i&&n.toUpperCase()===i.toUpperCase()&&(t[i]=r,delete t[n])})},qg=function(t,i,a,r,n){return t.config=i,a&&(t.code=a),t.request=r,t.response=n,t.isAxiosError=!0,t.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}},t},tc,Od;function jg(){if(Od)return tc;Od=1;var e=qg;return tc=function(i,a,r,n,o){var s=new Error(i);return e(s,a,r,n,o)},tc}var ic,Nd;function vA(){if(Nd)return ic;Nd=1;var e=jg();return ic=function(i,a,r){var n=r.config.validateStatus;!r.status||!n||n(r.status)?i(r):a(e("Request failed with status code "+r.status,r.config,null,r.request,r))},ic}var rc,Fd;function gA(){if(Fd)return rc;Fd=1;var e=Gt;return rc=e.isStandardBrowserEnv()?function(){return{write:function(a,r,n,o,s,h){var l=[];l.push(a+"="+encodeURIComponent(r)),e.isNumber(n)&&l.push("expires="+new Date(n).toGMTString()),e.isString(o)&&l.push("path="+o),e.isString(s)&&l.push("domain="+s),h===!0&&l.push("secure"),document.cookie=l.join("; ")},read:function(a){var r=document.cookie.match(new RegExp("(^|;\\s*)("+a+")=([^;]*)"));return r?decodeURIComponent(r[3]):null},remove:function(a){this.write(a,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}(),rc}var ac,zd;function yA(){return zd||(zd=1,ac=function(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}),ac}var nc,Hd;function mA(){return Hd||(Hd=1,nc=function(t,i){return i?t.replace(/\/+$/,"")+"/"+i.replace(/^\/+/,""):t}),nc}var oc,Ud;function pA(){if(Ud)return oc;Ud=1;var e=yA(),t=mA();return oc=function(a,r){return a&&!e(r)?t(a,r):r},oc}var sc,Wd;function wA(){if(Wd)return sc;Wd=1;var e=Gt,t=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];return sc=function(a){var r={},n,o,s;return a&&e.forEach(a.split(`
- `),function(l){if(s=l.indexOf(":"),n=e.trim(l.substr(0,s)).toLowerCase(),o=e.trim(l.substr(s+1)),n){if(r[n]&&t.indexOf(n)>=0)return;n==="set-cookie"?r[n]=(r[n]?r[n]:[]).concat([o]):r[n]=r[n]?r[n]+", "+o:o}}),r},sc}var lc,qd;function bA(){if(qd)return lc;qd=1;var e=Gt;return lc=e.isStandardBrowserEnv()?function(){var i=/(msie|trident)/i.test(navigator.userAgent),a=document.createElement("a"),r;function n(o){var s=o;return i&&(a.setAttribute("href",s),s=a.href),a.setAttribute("href",s),{href:a.href,protocol:a.protocol?a.protocol.replace(/:$/,""):"",host:a.host,search:a.search?a.search.replace(/^\?/,""):"",hash:a.hash?a.hash.replace(/^#/,""):"",hostname:a.hostname,port:a.port,pathname:a.pathname.charAt(0)==="/"?a.pathname:"/"+a.pathname}}return r=n(window.location.href),function(s){var h=e.isString(s)?n(s):s;return h.protocol===r.protocol&&h.host===r.host}}():function(){return function(){return!0}}(),lc}var cc,jd;function xs(){if(jd)return cc;jd=1;function e(t){this.message=t}return e.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},e.prototype.__CANCEL__=!0,cc=e,cc}var uc,Kd;function Vd(){if(Kd)return uc;Kd=1;var e=Gt,t=vA(),i=gA(),a=Wg,r=pA(),n=wA(),o=bA(),s=jg(),h=Es(),l=xs();return uc=function(f){return new Promise(function(g,y){var p=f.data,m=f.headers,b=f.responseType,x;function _(){f.cancelToken&&f.cancelToken.unsubscribe(x),f.signal&&f.signal.removeEventListener("abort",x)}e.isFormData(p)&&delete m["Content-Type"];var k=new XMLHttpRequest;if(f.auth){var I=f.auth.username||"",P=f.auth.password?unescape(encodeURIComponent(f.auth.password)):"";m.Authorization="Basic "+btoa(I+":"+P)}var M=r(f.baseURL,f.url);k.open(f.method.toUpperCase(),a(M,f.params,f.paramsSerializer),!0),k.timeout=f.timeout;function L(){if(!!k){var $="getAllResponseHeaders"in k?n(k.getAllResponseHeaders()):null,S=!b||b==="text"||b==="json"?k.responseText:k.response,T={data:S,status:k.status,statusText:k.statusText,headers:$,config:f,request:k};t(function(O){g(O),_()},function(O){y(O),_()},T),k=null}}if("onloadend"in k?k.onloadend=L:k.onreadystatechange=function(){!k||k.readyState!==4||k.status===0&&!(k.responseURL&&k.responseURL.indexOf("file:")===0)||setTimeout(L)},k.onabort=function(){!k||(y(s("Request aborted",f,"ECONNABORTED",k)),k=null)},k.onerror=function(){y(s("Network Error",f,null,k)),k=null},k.ontimeout=function(){var S=f.timeout?"timeout of "+f.timeout+"ms exceeded":"timeout exceeded",T=f.transitional||h.transitional;f.timeoutErrorMessage&&(S=f.timeoutErrorMessage),y(s(S,f,T.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",k)),k=null},e.isStandardBrowserEnv()){var U=(f.withCredentials||o(M))&&f.xsrfCookieName?i.read(f.xsrfCookieName):void 0;U&&(m[f.xsrfHeaderName]=U)}"setRequestHeader"in k&&e.forEach(m,function(S,T){typeof p>"u"&&T.toLowerCase()==="content-type"?delete m[T]:k.setRequestHeader(T,S)}),e.isUndefined(f.withCredentials)||(k.withCredentials=!!f.withCredentials),b&&b!=="json"&&(k.responseType=f.responseType),typeof f.onDownloadProgress=="function"&&k.addEventListener("progress",f.onDownloadProgress),typeof f.onUploadProgress=="function"&&k.upload&&k.upload.addEventListener("progress",f.onUploadProgress),(f.cancelToken||f.signal)&&(x=function($){!k||(y(!$||$&&$.type?new l("canceled"):$),k.abort(),k=null)},f.cancelToken&&f.cancelToken.subscribe(x),f.signal&&(f.signal.aborted?x():f.signal.addEventListener("abort",x))),p||(p=null),k.send(p)})},uc}var hc,$d;function Es(){if($d)return hc;$d=1;var e=Gt,t=dA,i=qg,a={"Content-Type":"application/x-www-form-urlencoded"};function r(h,l){!e.isUndefined(h)&&e.isUndefined(h["Content-Type"])&&(h["Content-Type"]=l)}function n(){var h;return(typeof XMLHttpRequest<"u"||typeof process<"u"&&Object.prototype.toString.call(process)==="[object process]")&&(h=Vd()),h}function o(h,l,c){if(e.isString(h))try{return(l||JSON.parse)(h),e.trim(h)}catch(f){if(f.name!=="SyntaxError")throw f}return(c||JSON.stringify)(h)}var s={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:n(),transformRequest:[function(l,c){return t(c,"Accept"),t(c,"Content-Type"),e.isFormData(l)||e.isArrayBuffer(l)||e.isBuffer(l)||e.isStream(l)||e.isFile(l)||e.isBlob(l)?l:e.isArrayBufferView(l)?l.buffer:e.isURLSearchParams(l)?(r(c,"application/x-www-form-urlencoded;charset=utf-8"),l.toString()):e.isObject(l)||c&&c["Content-Type"]==="application/json"?(r(c,"application/json"),o(l)):l}],transformResponse:[function(l){var c=this.transitional||s.transitional,f=c&&c.silentJSONParsing,v=c&&c.forcedJSONParsing,g=!f&&this.responseType==="json";if(g||v&&e.isString(l)&&l.length)try{return JSON.parse(l)}catch(y){if(g)throw y.name==="SyntaxError"?i(y,this,"E_JSON_PARSE"):y}return l}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(l){return l>=200&&l<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};return e.forEach(["delete","get","head"],function(l){s.headers[l]={}}),e.forEach(["post","put","patch"],function(l){s.headers[l]=e.merge(a)}),hc=s,hc}var _A=Gt,xA=Es(),EA=function(t,i,a){var r=this||xA;return _A.forEach(a,function(o){t=o.call(r,t,i)}),t},fc,Yd;function Kg(){return Yd||(Yd=1,fc=function(t){return!!(t&&t.__CANCEL__)}),fc}var Gd=Gt,dc=EA,kA=Kg(),CA=Es(),AA=xs();function vc(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new AA("canceled")}var SA=function(t){vc(t),t.headers=t.headers||{},t.data=dc.call(t,t.data,t.headers,t.transformRequest),t.headers=Gd.merge(t.headers.common||{},t.headers[t.method]||{},t.headers),Gd.forEach(["delete","get","head","post","put","patch","common"],function(r){delete t.headers[r]});var i=t.adapter||CA.adapter;return i(t).then(function(r){return vc(t),r.data=dc.call(t,r.data,r.headers,t.transformResponse),r},function(r){return kA(r)||(vc(t),r&&r.response&&(r.response.data=dc.call(t,r.response.data,r.response.headers,t.transformResponse))),Promise.reject(r)})},ii=Gt,Vg=function(t,i){i=i||{};var a={};function r(c,f){return ii.isPlainObject(c)&&ii.isPlainObject(f)?ii.merge(c,f):ii.isPlainObject(f)?ii.merge({},f):ii.isArray(f)?f.slice():f}function n(c){if(ii.isUndefined(i[c])){if(!ii.isUndefined(t[c]))return r(void 0,t[c])}else return r(t[c],i[c])}function o(c){if(!ii.isUndefined(i[c]))return r(void 0,i[c])}function s(c){if(ii.isUndefined(i[c])){if(!ii.isUndefined(t[c]))return r(void 0,t[c])}else return r(void 0,i[c])}function h(c){if(c in i)return r(t[c],i[c]);if(c in t)return r(void 0,t[c])}var l={url:o,method:o,data:o,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:h};return ii.forEach(Object.keys(t).concat(Object.keys(i)),function(f){var v=l[f]||n,g=v(f);ii.isUndefined(g)&&v!==h||(a[f]=g)}),a},gc,Xd;function $g(){return Xd||(Xd=1,gc={version:"0.25.0"}),gc}var TA=$g().version,gu={};["object","boolean","number","function","string","symbol"].forEach(function(e,t){gu[e]=function(a){return typeof a===e||"a"+(t<1?"n ":" ")+e}});var Zd={};gu.transitional=function(t,i,a){function r(n,o){return"[Axios v"+TA+"] Transitional option '"+n+"'"+o+(a?". "+a:"")}return function(n,o,s){if(t===!1)throw new Error(r(o," has been removed"+(i?" in "+i:"")));return i&&!Zd[o]&&(Zd[o]=!0,console.warn(r(o," has been deprecated since v"+i+" and will be removed in the near future"))),t?t(n,o,s):!0}};function RA(e,t,i){if(typeof e!="object")throw new TypeError("options must be an object");for(var a=Object.keys(e),r=a.length;r-- >0;){var n=a[r],o=t[n];if(o){var s=e[n],h=s===void 0||o(s,n,e);if(h!==!0)throw new TypeError("option "+n+" must be "+h);continue}if(i!==!0)throw Error("Unknown option "+n)}}var PA={assertOptions:RA,validators:gu},Yg=Gt,IA=Wg,Qd=hA,Jd=SA,ks=Vg,Gg=PA,Ta=Gg.validators;function zn(e){this.defaults=e,this.interceptors={request:new Qd,response:new Qd}}zn.prototype.request=function(t,i){if(typeof t=="string"?(i=i||{},i.url=t):i=t||{},!i.url)throw new Error("Provided config url is not valid");i=ks(this.defaults,i),i.method?i.method=i.method.toLowerCase():this.defaults.method?i.method=this.defaults.method.toLowerCase():i.method="get";var a=i.transitional;a!==void 0&&Gg.assertOptions(a,{silentJSONParsing:Ta.transitional(Ta.boolean),forcedJSONParsing:Ta.transitional(Ta.boolean),clarifyTimeoutError:Ta.transitional(Ta.boolean)},!1);var r=[],n=!0;this.interceptors.request.forEach(function(g){typeof g.runWhen=="function"&&g.runWhen(i)===!1||(n=n&&g.synchronous,r.unshift(g.fulfilled,g.rejected))});var o=[];this.interceptors.response.forEach(function(g){o.push(g.fulfilled,g.rejected)});var s;if(!n){var h=[Jd,void 0];for(Array.prototype.unshift.apply(h,r),h=h.concat(o),s=Promise.resolve(i);h.length;)s=s.then(h.shift(),h.shift());return s}for(var l=i;r.length;){var c=r.shift(),f=r.shift();try{l=c(l)}catch(v){f(v);break}}try{s=Jd(l)}catch(v){return Promise.reject(v)}for(;o.length;)s=s.then(o.shift(),o.shift());return s};zn.prototype.getUri=function(t){if(!t.url)throw new Error("Provided config url is not valid");return t=ks(this.defaults,t),IA(t.url,t.params,t.paramsSerializer).replace(/^\?/,"")};Yg.forEach(["delete","get","head","options"],function(t){zn.prototype[t]=function(i,a){return this.request(ks(a||{},{method:t,url:i,data:(a||{}).data}))}});Yg.forEach(["post","put","patch"],function(t){zn.prototype[t]=function(i,a,r){return this.request(ks(r||{},{method:t,url:i,data:a}))}});var LA=zn,yc,ev;function DA(){if(ev)return yc;ev=1;var e=xs();function t(i){if(typeof i!="function")throw new TypeError("executor must be a function.");var a;this.promise=new Promise(function(o){a=o});var r=this;this.promise.then(function(n){if(!!r._listeners){var o,s=r._listeners.length;for(o=0;o<s;o++)r._listeners[o](n);r._listeners=null}}),this.promise.then=function(n){var o,s=new Promise(function(h){r.subscribe(h),o=h}).then(n);return s.cancel=function(){r.unsubscribe(o)},s},i(function(o){r.reason||(r.reason=new e(o),a(r.reason))})}return t.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},t.prototype.subscribe=function(a){if(this.reason){a(this.reason);return}this._listeners?this._listeners.push(a):this._listeners=[a]},t.prototype.unsubscribe=function(a){if(!!this._listeners){var r=this._listeners.indexOf(a);r!==-1&&this._listeners.splice(r,1)}},t.source=function(){var a,r=new t(function(o){a=o});return{token:r,cancel:a}},yc=t,yc}var mc,tv;function MA(){return tv||(tv=1,mc=function(t){return function(a){return t.apply(null,a)}}),mc}var pc,iv;function BA(){if(iv)return pc;iv=1;var e=Gt;return pc=function(i){return e.isObject(i)&&i.isAxiosError===!0},pc}var rv=Gt,OA=Fg,es=LA,NA=Vg,FA=Es();function Xg(e){var t=new es(e),i=OA(es.prototype.request,t);return rv.extend(i,es.prototype,t),rv.extend(i,t),i.create=function(r){return Xg(NA(e,r))},i}var Ui=Xg(FA);Ui.Axios=es;Ui.Cancel=xs();Ui.CancelToken=DA();Ui.isCancel=Kg();Ui.VERSION=$g().version;Ui.all=function(t){return Promise.all(t)};Ui.spread=MA();Ui.isAxiosError=BA();fu.exports=Ui;fu.exports.default=Ui;(function(e){e.exports=fu.exports})(Ng);const lr=px(Ng.exports);lr.defaults.baseURL=window.env.server;lr.defaults.timeout=Number("50000");lr.defaults.headers.post["Content-Type"]="application/json;charset=utf-8";let av=!1;lr.interceptors.request.use(e=>{const t=localStorage.getItem("token");return t&&(e.headers.Authorization="Bearer "+t),e});lr.interceptors.response.use(e=>{var t,i,a;return e.data&&e.data.code===0?Promise.resolve((t=e.data)==null?void 0:t.data):e.data&&e.data.code===401?(setTimeout(()=>{window.location.href="/"},1e3),Ca.error((i=e.data)==null?void 0:i.message)):(Ca.error((a=e.data)==null?void 0:a.message),Promise.reject(e.data))},e=>{var t,i;return av?!1:e.response?(Ca.closeAll(),Ca.error(((t=e.response.data)==null?void 0:t.msg)||"\u767B\u5F55\u5931\u6548\uFF0C\u7A0D\u540E\u91CD\u65B0\u767B\u5F55"),((i=e.response.data)==null?void 0:i.code)===401&&(localStorage.removeItem("token"),setTimeout(()=>{window.location.href="/"},1e3)),Promise.reject(e)):(av=!0,Ca.closeAll(),Ca.error("\u8BF7\u6C42\u51FA\u9519\uFF01\uFF01\uFF01"),Promise.reject(e))});function Qi(e,t){return lr.post(e,t)}function wc(e,t){return lr({url:e,method:"delete",data:t})}function Ji(e,t){return lr.get(e,{params:t})}function zA(e,t){return lr.put(e,t)}const KT={tokenRefresh:()=>Qi("/tokenRefresh",{appId:0}),login:()=>Qi("/jwt/login",{username:"hxy",password:"hxy123"}),folder:()=>Ji("/configure/folder/list"),folderData:e=>Ji("/configure/diagram/getInfoByFolderId",{folderId:e}),folderAdd:(e,t)=>Qi("/configure/folder/add",{name:e,types:t}),folderEdit:(e,t,i)=>Qi("/configure/folder/edit",{name:e,types:t,id:i}),folderDel:e=>wc("/configure/folder/del",{id:e}),topologyAdd:e=>Qi("/configure/diagram/add",e),topologyEdit:e=>Qi("/configure/diagram/edit",e),topologyDel:e=>wc("/configure/diagram/del",{id:e}),topology:e=>Ji("/configure/diagram/getInfoById",{id:e}),topologyName:e=>Ji("/configure/diagram/getInfoByName",{name:e}),deviceList:()=>Ji("/product/device/list"),functionList:e=>Ji("/product/tsl/function/all",e),devicePoint:e=>Ji(`/configure/devicePoint/${e}`),do:e=>Qi("/product/function/do",e),uploadImg:e=>Qi("/common/singleImg",e),drawer:{pointAdd:e=>Qi("/configure/point/add",e),pointDel:e=>wc("/configure/point/del",{id:e}),pointEdit:e=>zA("/configure/point/edit",e),getEchartInfo:e=>Ji("/configure/point/getEchartInfo",e),getInfoByDiagramIdAndPointId:e=>Ji("/configure/point/getInfoByDiagramIdAndPointId",e)}};var cr={};(function(e){var t=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";function i(n,o){return Object.prototype.hasOwnProperty.call(n,o)}e.assign=function(n){for(var o=Array.prototype.slice.call(arguments,1);o.length;){var s=o.shift();if(!!s){if(typeof s!="object")throw new TypeError(s+"must be non-object");for(var h in s)i(s,h)&&(n[h]=s[h])}}return n},e.shrinkBuf=function(n,o){return n.length===o?n:n.subarray?n.subarray(0,o):(n.length=o,n)};var a={arraySet:function(n,o,s,h,l){if(o.subarray&&n.subarray){n.set(o.subarray(s,s+h),l);return}for(var c=0;c<h;c++)n[l+c]=o[s+c]},flattenChunks:function(n){var o,s,h,l,c,f;for(h=0,o=0,s=n.length;o<s;o++)h+=n[o].length;for(f=new Uint8Array(h),l=0,o=0,s=n.length;o<s;o++)c=n[o],f.set(c,l),l+=c.length;return f}},r={arraySet:function(n,o,s,h,l){for(var c=0;c<h;c++)n[l+c]=o[s+c]},flattenChunks:function(n){return[].concat.apply([],n)}};e.setTyped=function(n){n?(e.Buf8=Uint8Array,e.Buf16=Uint16Array,e.Buf32=Int32Array,e.assign(e,a)):(e.Buf8=Array,e.Buf16=Array,e.Buf32=Array,e.assign(e,r))},e.setTyped(t)})(cr);var Hn={},Wi={},Ka={},HA=cr,UA=4,nv=0,ov=1,WA=2;function Va(e){for(var t=e.length;--t>=0;)e[t]=0}var qA=0,Zg=1,jA=2,KA=3,VA=258,yu=29,Un=256,Ln=Un+1+yu,za=30,mu=19,Qg=2*Ln+1,Gr=15,bc=16,$A=7,pu=256,Jg=16,ey=17,ty=18,Yc=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],ts=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],YA=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],iy=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],GA=512,rr=new Array((Ln+2)*2);Va(rr);var En=new Array(za*2);Va(En);var Dn=new Array(GA);Va(Dn);var Mn=new Array(VA-KA+1);Va(Mn);var wu=new Array(yu);Va(wu);var ms=new Array(za);Va(ms);function _c(e,t,i,a,r){this.static_tree=e,this.extra_bits=t,this.extra_base=i,this.elems=a,this.max_length=r,this.has_stree=e&&e.length}var ry,ay,ny;function xc(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function oy(e){return e<256?Dn[e]:Dn[256+(e>>>7)]}function Bn(e,t){e.pending_buf[e.pending++]=t&255,e.pending_buf[e.pending++]=t>>>8&255}function Yt(e,t,i){e.bi_valid>bc-i?(e.bi_buf|=t<<e.bi_valid&65535,Bn(e,e.bi_buf),e.bi_buf=t>>bc-e.bi_valid,e.bi_valid+=i-bc):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=i)}function Fi(e,t,i){Yt(e,i[t*2],i[t*2+1])}function sy(e,t){var i=0;do i|=e&1,e>>>=1,i<<=1;while(--t>0);return i>>>1}function XA(e){e.bi_valid===16?(Bn(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=e.bi_buf&255,e.bi_buf>>=8,e.bi_valid-=8)}function ZA(e,t){var i=t.dyn_tree,a=t.max_code,r=t.stat_desc.static_tree,n=t.stat_desc.has_stree,o=t.stat_desc.extra_bits,s=t.stat_desc.extra_base,h=t.stat_desc.max_length,l,c,f,v,g,y,p=0;for(v=0;v<=Gr;v++)e.bl_count[v]=0;for(i[e.heap[e.heap_max]*2+1]=0,l=e.heap_max+1;l<Qg;l++)c=e.heap[l],v=i[i[c*2+1]*2+1]+1,v>h&&(v=h,p++),i[c*2+1]=v,!(c>a)&&(e.bl_count[v]++,g=0,c>=s&&(g=o[c-s]),y=i[c*2],e.opt_len+=y*(v+g),n&&(e.static_len+=y*(r[c*2+1]+g)));if(p!==0){do{for(v=h-1;e.bl_count[v]===0;)v--;e.bl_count[v]--,e.bl_count[v+1]+=2,e.bl_count[h]--,p-=2}while(p>0);for(v=h;v!==0;v--)for(c=e.bl_count[v];c!==0;)f=e.heap[--l],!(f>a)&&(i[f*2+1]!==v&&(e.opt_len+=(v-i[f*2+1])*i[f*2],i[f*2+1]=v),c--)}}function ly(e,t,i){var a=new Array(Gr+1),r=0,n,o;for(n=1;n<=Gr;n++)a[n]=r=r+i[n-1]<<1;for(o=0;o<=t;o++){var s=e[o*2+1];s!==0&&(e[o*2]=sy(a[s]++,s))}}function QA(){var e,t,i,a,r,n=new Array(Gr+1);for(i=0,a=0;a<yu-1;a++)for(wu[a]=i,e=0;e<1<<Yc[a];e++)Mn[i++]=a;for(Mn[i-1]=a,r=0,a=0;a<16;a++)for(ms[a]=r,e=0;e<1<<ts[a];e++)Dn[r++]=a;for(r>>=7;a<za;a++)for(ms[a]=r<<7,e=0;e<1<<ts[a]-7;e++)Dn[256+r++]=a;for(t=0;t<=Gr;t++)n[t]=0;for(e=0;e<=143;)rr[e*2+1]=8,e++,n[8]++;for(;e<=255;)rr[e*2+1]=9,e++,n[9]++;for(;e<=279;)rr[e*2+1]=7,e++,n[7]++;for(;e<=287;)rr[e*2+1]=8,e++,n[8]++;for(ly(rr,Ln+1,n),e=0;e<za;e++)En[e*2+1]=5,En[e*2]=sy(e,5);ry=new _c(rr,Yc,Un+1,Ln,Gr),ay=new _c(En,ts,0,za,Gr),ny=new _c(new Array(0),YA,0,mu,$A)}function cy(e){var t;for(t=0;t<Ln;t++)e.dyn_ltree[t*2]=0;for(t=0;t<za;t++)e.dyn_dtree[t*2]=0;for(t=0;t<mu;t++)e.bl_tree[t*2]=0;e.dyn_ltree[pu*2]=1,e.opt_len=e.static_len=0,e.last_lit=e.matches=0}function uy(e){e.bi_valid>8?Bn(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function JA(e,t,i,a){uy(e),a&&(Bn(e,i),Bn(e,~i)),HA.arraySet(e.pending_buf,e.window,t,i,e.pending),e.pending+=i}function sv(e,t,i,a){var r=t*2,n=i*2;return e[r]<e[n]||e[r]===e[n]&&a[t]<=a[i]}function Ec(e,t,i){for(var a=e.heap[i],r=i<<1;r<=e.heap_len&&(r<e.heap_len&&sv(t,e.heap[r+1],e.heap[r],e.depth)&&r++,!sv(t,a,e.heap[r],e.depth));)e.heap[i]=e.heap[r],i=r,r<<=1;e.heap[i]=a}function lv(e,t,i){var a,r,n=0,o,s;if(e.last_lit!==0)do a=e.pending_buf[e.d_buf+n*2]<<8|e.pending_buf[e.d_buf+n*2+1],r=e.pending_buf[e.l_buf+n],n++,a===0?Fi(e,r,t):(o=Mn[r],Fi(e,o+Un+1,t),s=Yc[o],s!==0&&(r-=wu[o],Yt(e,r,s)),a--,o=oy(a),Fi(e,o,i),s=ts[o],s!==0&&(a-=ms[o],Yt(e,a,s)));while(n<e.last_lit);Fi(e,pu,t)}function Gc(e,t){var i=t.dyn_tree,a=t.stat_desc.static_tree,r=t.stat_desc.has_stree,n=t.stat_desc.elems,o,s,h=-1,l;for(e.heap_len=0,e.heap_max=Qg,o=0;o<n;o++)i[o*2]!==0?(e.heap[++e.heap_len]=h=o,e.depth[o]=0):i[o*2+1]=0;for(;e.heap_len<2;)l=e.heap[++e.heap_len]=h<2?++h:0,i[l*2]=1,e.depth[l]=0,e.opt_len--,r&&(e.static_len-=a[l*2+1]);for(t.max_code=h,o=e.heap_len>>1;o>=1;o--)Ec(e,i,o);l=n;do o=e.heap[1],e.heap[1]=e.heap[e.heap_len--],Ec(e,i,1),s=e.heap[1],e.heap[--e.heap_max]=o,e.heap[--e.heap_max]=s,i[l*2]=i[o*2]+i[s*2],e.depth[l]=(e.depth[o]>=e.depth[s]?e.depth[o]:e.depth[s])+1,i[o*2+1]=i[s*2+1]=l,e.heap[1]=l++,Ec(e,i,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],ZA(e,t),ly(i,h,e.bl_count)}function cv(e,t,i){var a,r=-1,n,o=t[0*2+1],s=0,h=7,l=4;for(o===0&&(h=138,l=3),t[(i+1)*2+1]=65535,a=0;a<=i;a++)n=o,o=t[(a+1)*2+1],!(++s<h&&n===o)&&(s<l?e.bl_tree[n*2]+=s:n!==0?(n!==r&&e.bl_tree[n*2]++,e.bl_tree[Jg*2]++):s<=10?e.bl_tree[ey*2]++:e.bl_tree[ty*2]++,s=0,r=n,o===0?(h=138,l=3):n===o?(h=6,l=3):(h=7,l=4))}function uv(e,t,i){var a,r=-1,n,o=t[0*2+1],s=0,h=7,l=4;for(o===0&&(h=138,l=3),a=0;a<=i;a++)if(n=o,o=t[(a+1)*2+1],!(++s<h&&n===o)){if(s<l)do Fi(e,n,e.bl_tree);while(--s!==0);else n!==0?(n!==r&&(Fi(e,n,e.bl_tree),s--),Fi(e,Jg,e.bl_tree),Yt(e,s-3,2)):s<=10?(Fi(e,ey,e.bl_tree),Yt(e,s-3,3)):(Fi(e,ty,e.bl_tree),Yt(e,s-11,7));s=0,r=n,o===0?(h=138,l=3):n===o?(h=6,l=3):(h=7,l=4)}}function eS(e){var t;for(cv(e,e.dyn_ltree,e.l_desc.max_code),cv(e,e.dyn_dtree,e.d_desc.max_code),Gc(e,e.bl_desc),t=mu-1;t>=3&&e.bl_tree[iy[t]*2+1]===0;t--);return e.opt_len+=3*(t+1)+5+5+4,t}function tS(e,t,i,a){var r;for(Yt(e,t-257,5),Yt(e,i-1,5),Yt(e,a-4,4),r=0;r<a;r++)Yt(e,e.bl_tree[iy[r]*2+1],3);uv(e,e.dyn_ltree,t-1),uv(e,e.dyn_dtree,i-1)}function iS(e){var t=4093624447,i;for(i=0;i<=31;i++,t>>>=1)if(t&1&&e.dyn_ltree[i*2]!==0)return nv;if(e.dyn_ltree[9*2]!==0||e.dyn_ltree[10*2]!==0||e.dyn_ltree[13*2]!==0)return ov;for(i=32;i<Un;i++)if(e.dyn_ltree[i*2]!==0)return ov;return nv}var hv=!1;function rS(e){hv||(QA(),hv=!0),e.l_desc=new xc(e.dyn_ltree,ry),e.d_desc=new xc(e.dyn_dtree,ay),e.bl_desc=new xc(e.bl_tree,ny),e.bi_buf=0,e.bi_valid=0,cy(e)}function hy(e,t,i,a){Yt(e,(qA<<1)+(a?1:0),3),JA(e,t,i,!0)}function aS(e){Yt(e,Zg<<1,3),Fi(e,pu,rr),XA(e)}function nS(e,t,i,a){var r,n,o=0;e.level>0?(e.strm.data_type===WA&&(e.strm.data_type=iS(e)),Gc(e,e.l_desc),Gc(e,e.d_desc),o=eS(e),r=e.opt_len+3+7>>>3,n=e.static_len+3+7>>>3,n<=r&&(r=n)):r=n=i+5,i+4<=r&&t!==-1?hy(e,t,i,a):e.strategy===UA||n===r?(Yt(e,(Zg<<1)+(a?1:0),3),lv(e,rr,En)):(Yt(e,(jA<<1)+(a?1:0),3),tS(e,e.l_desc.max_code+1,e.d_desc.max_code+1,o+1),lv(e,e.dyn_ltree,e.dyn_dtree)),cy(e),a&&uy(e)}function oS(e,t,i){return e.pending_buf[e.d_buf+e.last_lit*2]=t>>>8&255,e.pending_buf[e.d_buf+e.last_lit*2+1]=t&255,e.pending_buf[e.l_buf+e.last_lit]=i&255,e.last_lit++,t===0?e.dyn_ltree[i*2]++:(e.matches++,t--,e.dyn_ltree[(Mn[i]+Un+1)*2]++,e.dyn_dtree[oy(t)*2]++),e.last_lit===e.lit_bufsize-1}Ka._tr_init=rS;Ka._tr_stored_block=hy;Ka._tr_flush_block=nS;Ka._tr_tally=oS;Ka._tr_align=aS;function sS(e,t,i,a){for(var r=e&65535|0,n=e>>>16&65535|0,o=0;i!==0;){o=i>2e3?2e3:i,i-=o;do r=r+t[a++]|0,n=n+r|0;while(--o);r%=65521,n%=65521}return r|n<<16|0}var fy=sS;function lS(){for(var e,t=[],i=0;i<256;i++){e=i;for(var a=0;a<8;a++)e=e&1?3988292384^e>>>1:e>>>1;t[i]=e}return t}var cS=lS();function uS(e,t,i,a){var r=cS,n=a+i;e^=-1;for(var o=a;o<n;o++)e=e>>>8^r[(e^t[o])&255];return e^-1}var dy=uS,bu={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},Nt=cr,yi=Ka,vy=fy,_r=dy,hS=bu,la=0,fS=1,dS=3,Pr=4,fv=5,zi=0,dv=1,mi=-2,vS=-3,kc=-5,gS=-1,yS=1,qo=2,mS=3,pS=4,wS=0,bS=2,Cs=8,_S=9,xS=15,ES=8,kS=29,CS=256,Xc=CS+1+kS,AS=30,SS=19,TS=2*Xc+1,RS=15,He=3,Sr=258,Ci=Sr+He+1,PS=32,As=42,Zc=69,is=73,rs=91,as=103,Xr=113,pn=666,mt=1,Wn=2,ia=3,$a=4,IS=3;function Tr(e,t){return e.msg=hS[t],t}function vv(e){return(e<<1)-(e>4?9:0)}function Ar(e){for(var t=e.length;--t>=0;)e[t]=0}function xr(e){var t=e.state,i=t.pending;i>e.avail_out&&(i=e.avail_out),i!==0&&(Nt.arraySet(e.output,t.pending_buf,t.pending_out,i,e.next_out),e.next_out+=i,t.pending_out+=i,e.total_out+=i,e.avail_out-=i,t.pending-=i,t.pending===0&&(t.pending_out=0))}function St(e,t){yi._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,xr(e.strm)}function Ue(e,t){e.pending_buf[e.pending++]=t}function gn(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=t&255}function LS(e,t,i,a){var r=e.avail_in;return r>a&&(r=a),r===0?0:(e.avail_in-=r,Nt.arraySet(t,e.input,e.next_in,r,i),e.state.wrap===1?e.adler=vy(e.adler,t,r,i):e.state.wrap===2&&(e.adler=_r(e.adler,t,r,i)),e.next_in+=r,e.total_in+=r,r)}function gy(e,t){var i=e.max_chain_length,a=e.strstart,r,n,o=e.prev_length,s=e.nice_match,h=e.strstart>e.w_size-Ci?e.strstart-(e.w_size-Ci):0,l=e.window,c=e.w_mask,f=e.prev,v=e.strstart+Sr,g=l[a+o-1],y=l[a+o];e.prev_length>=e.good_match&&(i>>=2),s>e.lookahead&&(s=e.lookahead);do if(r=t,!(l[r+o]!==y||l[r+o-1]!==g||l[r]!==l[a]||l[++r]!==l[a+1])){a+=2,r++;do;while(l[++a]===l[++r]&&l[++a]===l[++r]&&l[++a]===l[++r]&&l[++a]===l[++r]&&l[++a]===l[++r]&&l[++a]===l[++r]&&l[++a]===l[++r]&&l[++a]===l[++r]&&a<v);if(n=Sr-(v-a),a=v-Sr,n>o){if(e.match_start=t,o=n,n>=s)break;g=l[a+o-1],y=l[a+o]}}while((t=f[t&c])>h&&--i!==0);return o<=e.lookahead?o:e.lookahead}function ra(e){var t=e.w_size,i,a,r,n,o;do{if(n=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-Ci)){Nt.arraySet(e.window,e.window,t,t,0),e.match_start-=t,e.strstart-=t,e.block_start-=t,a=e.hash_size,i=a;do r=e.head[--i],e.head[i]=r>=t?r-t:0;while(--a);a=t,i=a;do r=e.prev[--i],e.prev[i]=r>=t?r-t:0;while(--a);n+=t}if(e.strm.avail_in===0)break;if(a=LS(e.strm,e.window,e.strstart+e.lookahead,n),e.lookahead+=a,e.lookahead+e.insert>=He)for(o=e.strstart-e.insert,e.ins_h=e.window[o],e.ins_h=(e.ins_h<<e.hash_shift^e.window[o+1])&e.hash_mask;e.insert&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[o+He-1])&e.hash_mask,e.prev[o&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=o,o++,e.insert--,!(e.lookahead+e.insert<He)););}while(e.lookahead<Ci&&e.strm.avail_in!==0)}function DS(e,t){var i=65535;for(i>e.pending_buf_size-5&&(i=e.pending_buf_size-5);;){if(e.lookahead<=1){if(ra(e),e.lookahead===0&&t===la)return mt;if(e.lookahead===0)break}e.strstart+=e.lookahead,e.lookahead=0;var a=e.block_start+i;if((e.strstart===0||e.strstart>=a)&&(e.lookahead=e.strstart-a,e.strstart=a,St(e,!1),e.strm.avail_out===0)||e.strstart-e.block_start>=e.w_size-Ci&&(St(e,!1),e.strm.avail_out===0))return mt}return e.insert=0,t===Pr?(St(e,!0),e.strm.avail_out===0?ia:$a):(e.strstart>e.block_start&&(St(e,!1),e.strm.avail_out===0),mt)}function Cc(e,t){for(var i,a;;){if(e.lookahead<Ci){if(ra(e),e.lookahead<Ci&&t===la)return mt;if(e.lookahead===0)break}if(i=0,e.lookahead>=He&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+He-1])&e.hash_mask,i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),i!==0&&e.strstart-i<=e.w_size-Ci&&(e.match_length=gy(e,i)),e.match_length>=He)if(a=yi._tr_tally(e,e.strstart-e.match_start,e.match_length-He),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=He){e.match_length--;do e.strstart++,e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+He-1])&e.hash_mask,i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart;while(--e.match_length!==0);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+1])&e.hash_mask;else a=yi._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(a&&(St(e,!1),e.strm.avail_out===0))return mt}return e.insert=e.strstart<He-1?e.strstart:He-1,t===Pr?(St(e,!0),e.strm.avail_out===0?ia:$a):e.last_lit&&(St(e,!1),e.strm.avail_out===0)?mt:Wn}function Ra(e,t){for(var i,a,r;;){if(e.lookahead<Ci){if(ra(e),e.lookahead<Ci&&t===la)return mt;if(e.lookahead===0)break}if(i=0,e.lookahead>=He&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+He-1])&e.hash_mask,i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=He-1,i!==0&&e.prev_length<e.max_lazy_match&&e.strstart-i<=e.w_size-Ci&&(e.match_length=gy(e,i),e.match_length<=5&&(e.strategy===yS||e.match_length===He&&e.strstart-e.match_start>4096)&&(e.match_length=He-1)),e.prev_length>=He&&e.match_length<=e.prev_length){r=e.strstart+e.lookahead-He,a=yi._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-He),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=r&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+He-1])&e.hash_mask,i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart);while(--e.prev_length!==0);if(e.match_available=0,e.match_length=He-1,e.strstart++,a&&(St(e,!1),e.strm.avail_out===0))return mt}else if(e.match_available){if(a=yi._tr_tally(e,0,e.window[e.strstart-1]),a&&St(e,!1),e.strstart++,e.lookahead--,e.strm.avail_out===0)return mt}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(a=yi._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<He-1?e.strstart:He-1,t===Pr?(St(e,!0),e.strm.avail_out===0?ia:$a):e.last_lit&&(St(e,!1),e.strm.avail_out===0)?mt:Wn}function MS(e,t){for(var i,a,r,n,o=e.window;;){if(e.lookahead<=Sr){if(ra(e),e.lookahead<=Sr&&t===la)return mt;if(e.lookahead===0)break}if(e.match_length=0,e.lookahead>=He&&e.strstart>0&&(r=e.strstart-1,a=o[r],a===o[++r]&&a===o[++r]&&a===o[++r])){n=e.strstart+Sr;do;while(a===o[++r]&&a===o[++r]&&a===o[++r]&&a===o[++r]&&a===o[++r]&&a===o[++r]&&a===o[++r]&&a===o[++r]&&r<n);e.match_length=Sr-(n-r),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=He?(i=yi._tr_tally(e,1,e.match_length-He),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(i=yi._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),i&&(St(e,!1),e.strm.avail_out===0))return mt}return e.insert=0,t===Pr?(St(e,!0),e.strm.avail_out===0?ia:$a):e.last_lit&&(St(e,!1),e.strm.avail_out===0)?mt:Wn}function BS(e,t){for(var i;;){if(e.lookahead===0&&(ra(e),e.lookahead===0)){if(t===la)return mt;break}if(e.match_length=0,i=yi._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,i&&(St(e,!1),e.strm.avail_out===0))return mt}return e.insert=0,t===Pr?(St(e,!0),e.strm.avail_out===0?ia:$a):e.last_lit&&(St(e,!1),e.strm.avail_out===0)?mt:Wn}function Bi(e,t,i,a,r){this.good_length=e,this.max_lazy=t,this.nice_length=i,this.max_chain=a,this.func=r}var Na;Na=[new Bi(0,0,0,0,DS),new Bi(4,4,8,4,Cc),new Bi(4,5,16,8,Cc),new Bi(4,6,32,32,Cc),new Bi(4,4,16,16,Ra),new Bi(8,16,32,32,Ra),new Bi(8,16,128,128,Ra),new Bi(8,32,128,256,Ra),new Bi(32,128,258,1024,Ra),new Bi(32,258,258,4096,Ra)];function OS(e){e.window_size=2*e.w_size,Ar(e.head),e.max_lazy_match=Na[e.level].max_lazy,e.good_match=Na[e.level].good_length,e.nice_match=Na[e.level].nice_length,e.max_chain_length=Na[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=He-1,e.match_available=0,e.ins_h=0}function NS(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Cs,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Nt.Buf16(TS*2),this.dyn_dtree=new Nt.Buf16((2*AS+1)*2),this.bl_tree=new Nt.Buf16((2*SS+1)*2),Ar(this.dyn_ltree),Ar(this.dyn_dtree),Ar(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Nt.Buf16(RS+1),this.heap=new Nt.Buf16(2*Xc+1),Ar(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Nt.Buf16(2*Xc+1),Ar(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function yy(e){var t;return!e||!e.state?Tr(e,mi):(e.total_in=e.total_out=0,e.data_type=bS,t=e.state,t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?As:Xr,e.adler=t.wrap===2?0:1,t.last_flush=la,yi._tr_init(t),zi)}function my(e){var t=yy(e);return t===zi&&OS(e.state),t}function FS(e,t){return!e||!e.state||e.state.wrap!==2?mi:(e.state.gzhead=t,zi)}function py(e,t,i,a,r,n){if(!e)return mi;var o=1;if(t===gS&&(t=6),a<0?(o=0,a=-a):a>15&&(o=2,a-=16),r<1||r>_S||i!==Cs||a<8||a>15||t<0||t>9||n<0||n>pS)return Tr(e,mi);a===8&&(a=9);var s=new NS;return e.state=s,s.strm=e,s.wrap=o,s.gzhead=null,s.w_bits=a,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=r+7,s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+He-1)/He),s.window=new Nt.Buf8(s.w_size*2),s.head=new Nt.Buf16(s.hash_size),s.prev=new Nt.Buf16(s.w_size),s.lit_bufsize=1<<r+6,s.pending_buf_size=s.lit_bufsize*4,s.pending_buf=new Nt.Buf8(s.pending_buf_size),s.d_buf=1*s.lit_bufsize,s.l_buf=(1+2)*s.lit_bufsize,s.level=t,s.strategy=n,s.method=i,my(e)}function zS(e,t){return py(e,t,Cs,xS,ES,wS)}function HS(e,t){var i,a,r,n;if(!e||!e.state||t>fv||t<0)return e?Tr(e,mi):mi;if(a=e.state,!e.output||!e.input&&e.avail_in!==0||a.status===pn&&t!==Pr)return Tr(e,e.avail_out===0?kc:mi);if(a.strm=e,i=a.last_flush,a.last_flush=t,a.status===As)if(a.wrap===2)e.adler=0,Ue(a,31),Ue(a,139),Ue(a,8),a.gzhead?(Ue(a,(a.gzhead.text?1:0)+(a.gzhead.hcrc?2:0)+(a.gzhead.extra?4:0)+(a.gzhead.name?8:0)+(a.gzhead.comment?16:0)),Ue(a,a.gzhead.time&255),Ue(a,a.gzhead.time>>8&255),Ue(a,a.gzhead.time>>16&255),Ue(a,a.gzhead.time>>24&255),Ue(a,a.level===9?2:a.strategy>=qo||a.level<2?4:0),Ue(a,a.gzhead.os&255),a.gzhead.extra&&a.gzhead.extra.length&&(Ue(a,a.gzhead.extra.length&255),Ue(a,a.gzhead.extra.length>>8&255)),a.gzhead.hcrc&&(e.adler=_r(e.adler,a.pending_buf,a.pending,0)),a.gzindex=0,a.status=Zc):(Ue(a,0),Ue(a,0),Ue(a,0),Ue(a,0),Ue(a,0),Ue(a,a.level===9?2:a.strategy>=qo||a.level<2?4:0),Ue(a,IS),a.status=Xr);else{var o=Cs+(a.w_bits-8<<4)<<8,s=-1;a.strategy>=qo||a.level<2?s=0:a.level<6?s=1:a.level===6?s=2:s=3,o|=s<<6,a.strstart!==0&&(o|=PS),o+=31-o%31,a.status=Xr,gn(a,o),a.strstart!==0&&(gn(a,e.adler>>>16),gn(a,e.adler&65535)),e.adler=1}if(a.status===Zc)if(a.gzhead.extra){for(r=a.pending;a.gzindex<(a.gzhead.extra.length&65535)&&!(a.pending===a.pending_buf_size&&(a.gzhead.hcrc&&a.pending>r&&(e.adler=_r(e.adler,a.pending_buf,a.pending-r,r)),xr(e),r=a.pending,a.pending===a.pending_buf_size));)Ue(a,a.gzhead.extra[a.gzindex]&255),a.gzindex++;a.gzhead.hcrc&&a.pending>r&&(e.adler=_r(e.adler,a.pending_buf,a.pending-r,r)),a.gzindex===a.gzhead.extra.length&&(a.gzindex=0,a.status=is)}else a.status=is;if(a.status===is)if(a.gzhead.name){r=a.pending;do{if(a.pending===a.pending_buf_size&&(a.gzhead.hcrc&&a.pending>r&&(e.adler=_r(e.adler,a.pending_buf,a.pending-r,r)),xr(e),r=a.pending,a.pending===a.pending_buf_size)){n=1;break}a.gzindex<a.gzhead.name.length?n=a.gzhead.name.charCodeAt(a.gzindex++)&255:n=0,Ue(a,n)}while(n!==0);a.gzhead.hcrc&&a.pending>r&&(e.adler=_r(e.adler,a.pending_buf,a.pending-r,r)),n===0&&(a.gzindex=0,a.status=rs)}else a.status=rs;if(a.status===rs)if(a.gzhead.comment){r=a.pending;do{if(a.pending===a.pending_buf_size&&(a.gzhead.hcrc&&a.pending>r&&(e.adler=_r(e.adler,a.pending_buf,a.pending-r,r)),xr(e),r=a.pending,a.pending===a.pending_buf_size)){n=1;break}a.gzindex<a.gzhead.comment.length?n=a.gzhead.comment.charCodeAt(a.gzindex++)&255:n=0,Ue(a,n)}while(n!==0);a.gzhead.hcrc&&a.pending>r&&(e.adler=_r(e.adler,a.pending_buf,a.pending-r,r)),n===0&&(a.status=as)}else a.status=as;if(a.status===as&&(a.gzhead.hcrc?(a.pending+2>a.pending_buf_size&&xr(e),a.pending+2<=a.pending_buf_size&&(Ue(a,e.adler&255),Ue(a,e.adler>>8&255),e.adler=0,a.status=Xr)):a.status=Xr),a.pending!==0){if(xr(e),e.avail_out===0)return a.last_flush=-1,zi}else if(e.avail_in===0&&vv(t)<=vv(i)&&t!==Pr)return Tr(e,kc);if(a.status===pn&&e.avail_in!==0)return Tr(e,kc);if(e.avail_in!==0||a.lookahead!==0||t!==la&&a.status!==pn){var h=a.strategy===qo?BS(a,t):a.strategy===mS?MS(a,t):Na[a.level].func(a,t);if((h===ia||h===$a)&&(a.status=pn),h===mt||h===ia)return e.avail_out===0&&(a.last_flush=-1),zi;if(h===Wn&&(t===fS?yi._tr_align(a):t!==fv&&(yi._tr_stored_block(a,0,0,!1),t===dS&&(Ar(a.head),a.lookahead===0&&(a.strstart=0,a.block_start=0,a.insert=0))),xr(e),e.avail_out===0))return a.last_flush=-1,zi}return t!==Pr?zi:a.wrap<=0?dv:(a.wrap===2?(Ue(a,e.adler&255),Ue(a,e.adler>>8&255),Ue(a,e.adler>>16&255),Ue(a,e.adler>>24&255),Ue(a,e.total_in&255),Ue(a,e.total_in>>8&255),Ue(a,e.total_in>>16&255),Ue(a,e.total_in>>24&255)):(gn(a,e.adler>>>16),gn(a,e.adler&65535)),xr(e),a.wrap>0&&(a.wrap=-a.wrap),a.pending!==0?zi:dv)}function US(e){var t;return!e||!e.state?mi:(t=e.state.status,t!==As&&t!==Zc&&t!==is&&t!==rs&&t!==as&&t!==Xr&&t!==pn?Tr(e,mi):(e.state=null,t===Xr?Tr(e,vS):zi))}function WS(e,t){var i=t.length,a,r,n,o,s,h,l,c;if(!e||!e.state||(a=e.state,o=a.wrap,o===2||o===1&&a.status!==As||a.lookahead))return mi;for(o===1&&(e.adler=vy(e.adler,t,i,0)),a.wrap=0,i>=a.w_size&&(o===0&&(Ar(a.head),a.strstart=0,a.block_start=0,a.insert=0),c=new Nt.Buf8(a.w_size),Nt.arraySet(c,t,i-a.w_size,a.w_size,0),t=c,i=a.w_size),s=e.avail_in,h=e.next_in,l=e.input,e.avail_in=i,e.next_in=0,e.input=t,ra(a);a.lookahead>=He;){r=a.strstart,n=a.lookahead-(He-1);do a.ins_h=(a.ins_h<<a.hash_shift^a.window[r+He-1])&a.hash_mask,a.prev[r&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=r,r++;while(--n);a.strstart=r,a.lookahead=He-1,ra(a)}return a.strstart+=a.lookahead,a.block_start=a.strstart,a.insert=a.lookahead,a.lookahead=0,a.match_length=a.prev_length=He-1,a.match_available=0,e.next_in=h,e.input=l,e.avail_in=s,a.wrap=o,zi}Wi.deflateInit=zS;Wi.deflateInit2=py;Wi.deflateReset=my;Wi.deflateResetKeep=yy;Wi.deflateSetHeader=FS;Wi.deflate=HS;Wi.deflateEnd=US;Wi.deflateSetDictionary=WS;Wi.deflateInfo="pako deflate (from Nodeca project)";var ca={},Ss=cr,wy=!0,by=!0;try{String.fromCharCode.apply(null,[0])}catch{wy=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{by=!1}var On=new Ss.Buf8(256);for(var br=0;br<256;br++)On[br]=br>=252?6:br>=248?5:br>=240?4:br>=224?3:br>=192?2:1;On[254]=On[254]=1;ca.string2buf=function(e){var t,i,a,r,n,o=e.length,s=0;for(r=0;r<o;r++)i=e.charCodeAt(r),(i&64512)===55296&&r+1<o&&(a=e.charCodeAt(r+1),(a&64512)===56320&&(i=65536+(i-55296<<10)+(a-56320),r++)),s+=i<128?1:i<2048?2:i<65536?3:4;for(t=new Ss.Buf8(s),n=0,r=0;n<s;r++)i=e.charCodeAt(r),(i&64512)===55296&&r+1<o&&(a=e.charCodeAt(r+1),(a&64512)===56320&&(i=65536+(i-55296<<10)+(a-56320),r++)),i<128?t[n++]=i:i<2048?(t[n++]=192|i>>>6,t[n++]=128|i&63):i<65536?(t[n++]=224|i>>>12,t[n++]=128|i>>>6&63,t[n++]=128|i&63):(t[n++]=240|i>>>18,t[n++]=128|i>>>12&63,t[n++]=128|i>>>6&63,t[n++]=128|i&63);return t};function _y(e,t){if(t<65534&&(e.subarray&&by||!e.subarray&&wy))return String.fromCharCode.apply(null,Ss.shrinkBuf(e,t));for(var i="",a=0;a<t;a++)i+=String.fromCharCode(e[a]);return i}ca.buf2binstring=function(e){return _y(e,e.length)};ca.binstring2buf=function(e){for(var t=new Ss.Buf8(e.length),i=0,a=t.length;i<a;i++)t[i]=e.charCodeAt(i);return t};ca.buf2string=function(e,t){var i,a,r,n,o=t||e.length,s=new Array(o*2);for(a=0,i=0;i<o;){if(r=e[i++],r<128){s[a++]=r;continue}if(n=On[r],n>4){s[a++]=65533,i+=n-1;continue}for(r&=n===2?31:n===3?15:7;n>1&&i<o;)r=r<<6|e[i++]&63,n--;if(n>1){s[a++]=65533;continue}r<65536?s[a++]=r:(r-=65536,s[a++]=55296|r>>10&1023,s[a++]=56320|r&1023)}return _y(s,a)};ca.utf8border=function(e,t){var i;for(t=t||e.length,t>e.length&&(t=e.length),i=t-1;i>=0&&(e[i]&192)===128;)i--;return i<0||i===0?t:i+On[e[i]]>t?i:t};function qS(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}var xy=qS,kn=Wi,Cn=cr,Qc=ca,Jc=bu,jS=xy,Ey=Object.prototype.toString,KS=0,Ac=4,Ha=0,gv=1,yv=2,VS=-1,$S=0,YS=8;function aa(e){if(!(this instanceof aa))return new aa(e);this.options=Cn.assign({level:VS,method:YS,chunkSize:16384,windowBits:15,memLevel:8,strategy:$S,to:""},e||{});var t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new jS,this.strm.avail_out=0;var i=kn.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(i!==Ha)throw new Error(Jc[i]);if(t.header&&kn.deflateSetHeader(this.strm,t.header),t.dictionary){var a;if(typeof t.dictionary=="string"?a=Qc.string2buf(t.dictionary):Ey.call(t.dictionary)==="[object ArrayBuffer]"?a=new Uint8Array(t.dictionary):a=t.dictionary,i=kn.deflateSetDictionary(this.strm,a),i!==Ha)throw new Error(Jc[i]);this._dict_set=!0}}aa.prototype.push=function(e,t){var i=this.strm,a=this.options.chunkSize,r,n;if(this.ended)return!1;n=t===~~t?t:t===!0?Ac:KS,typeof e=="string"?i.input=Qc.string2buf(e):Ey.call(e)==="[object ArrayBuffer]"?i.input=new Uint8Array(e):i.input=e,i.next_in=0,i.avail_in=i.input.length;do{if(i.avail_out===0&&(i.output=new Cn.Buf8(a),i.next_out=0,i.avail_out=a),r=kn.deflate(i,n),r!==gv&&r!==Ha)return this.onEnd(r),this.ended=!0,!1;(i.avail_out===0||i.avail_in===0&&(n===Ac||n===yv))&&(this.options.to==="string"?this.onData(Qc.buf2binstring(Cn.shrinkBuf(i.output,i.next_out))):this.onData(Cn.shrinkBuf(i.output,i.next_out)))}while((i.avail_in>0||i.avail_out===0)&&r!==gv);return n===Ac?(r=kn.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===Ha):(n===yv&&(this.onEnd(Ha),i.avail_out=0),!0)};aa.prototype.onData=function(e){this.chunks.push(e)};aa.prototype.onEnd=function(e){e===Ha&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Cn.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function _u(e,t){var i=new aa(t);if(i.push(e,!0),i.err)throw i.msg||Jc[i.err];return i.result}function GS(e,t){return t=t||{},t.raw=!0,_u(e,t)}function XS(e,t){return t=t||{},t.gzip=!0,_u(e,t)}Hn.Deflate=aa;Hn.deflate=_u;Hn.deflateRaw=GS;Hn.gzip=XS;var qn={},Si={},jo=30,ZS=12,QS=function(t,i){var a,r,n,o,s,h,l,c,f,v,g,y,p,m,b,x,_,k,I,P,M,L,U,$,S;a=t.state,r=t.next_in,$=t.input,n=r+(t.avail_in-5),o=t.next_out,S=t.output,s=o-(i-t.avail_out),h=o+(t.avail_out-257),l=a.dmax,c=a.wsize,f=a.whave,v=a.wnext,g=a.window,y=a.hold,p=a.bits,m=a.lencode,b=a.distcode,x=(1<<a.lenbits)-1,_=(1<<a.distbits)-1;e:do{p<15&&(y+=$[r++]<<p,p+=8,y+=$[r++]<<p,p+=8),k=m[y&x];t:for(;;){if(I=k>>>24,y>>>=I,p-=I,I=k>>>16&255,I===0)S[o++]=k&65535;else if(I&16){P=k&65535,I&=15,I&&(p<I&&(y+=$[r++]<<p,p+=8),P+=y&(1<<I)-1,y>>>=I,p-=I),p<15&&(y+=$[r++]<<p,p+=8,y+=$[r++]<<p,p+=8),k=b[y&_];i:for(;;){if(I=k>>>24,y>>>=I,p-=I,I=k>>>16&255,I&16){if(M=k&65535,I&=15,p<I&&(y+=$[r++]<<p,p+=8,p<I&&(y+=$[r++]<<p,p+=8)),M+=y&(1<<I)-1,M>l){t.msg="invalid distance too far back",a.mode=jo;break e}if(y>>>=I,p-=I,I=o-s,M>I){if(I=M-I,I>f&&a.sane){t.msg="invalid distance too far back",a.mode=jo;break e}if(L=0,U=g,v===0){if(L+=c-I,I<P){P-=I;do S[o++]=g[L++];while(--I);L=o-M,U=S}}else if(v<I){if(L+=c+v-I,I-=v,I<P){P-=I;do S[o++]=g[L++];while(--I);if(L=0,v<P){I=v,P-=I;do S[o++]=g[L++];while(--I);L=o-M,U=S}}}else if(L+=v-I,I<P){P-=I;do S[o++]=g[L++];while(--I);L=o-M,U=S}for(;P>2;)S[o++]=U[L++],S[o++]=U[L++],S[o++]=U[L++],P-=3;P&&(S[o++]=U[L++],P>1&&(S[o++]=U[L++]))}else{L=o-M;do S[o++]=S[L++],S[o++]=S[L++],S[o++]=S[L++],P-=3;while(P>2);P&&(S[o++]=S[L++],P>1&&(S[o++]=S[L++]))}}else if((I&64)===0){k=b[(k&65535)+(y&(1<<I)-1)];continue i}else{t.msg="invalid distance code",a.mode=jo;break e}break}}else if((I&64)===0){k=m[(k&65535)+(y&(1<<I)-1)];continue t}else if(I&32){a.mode=ZS;break e}else{t.msg="invalid literal/length code",a.mode=jo;break e}break}}while(r<n&&o<h);P=p>>3,r-=P,p-=P<<3,y&=(1<<p)-1,t.next_in=r,t.next_out=o,t.avail_in=r<n?5+(n-r):5-(r-n),t.avail_out=o<h?257+(h-o):257-(o-h),a.hold=y,a.bits=p},mv=cr,Pa=15,pv=852,wv=592,bv=0,Sc=1,_v=2,JS=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],eT=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],tT=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],iT=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64],rT=function(t,i,a,r,n,o,s,h){var l=h.bits,c=0,f=0,v=0,g=0,y=0,p=0,m=0,b=0,x=0,_=0,k,I,P,M,L,U=null,$=0,S,T=new mv.Buf16(Pa+1),R=new mv.Buf16(Pa+1),O=null,K=0,G,ae,V;for(c=0;c<=Pa;c++)T[c]=0;for(f=0;f<r;f++)T[i[a+f]]++;for(y=l,g=Pa;g>=1&&T[g]===0;g--);if(y>g&&(y=g),g===0)return n[o++]=1<<24|64<<16|0,n[o++]=1<<24|64<<16|0,h.bits=1,0;for(v=1;v<g&&T[v]===0;v++);for(y<v&&(y=v),b=1,c=1;c<=Pa;c++)if(b<<=1,b-=T[c],b<0)return-1;if(b>0&&(t===bv||g!==1))return-1;for(R[1]=0,c=1;c<Pa;c++)R[c+1]=R[c]+T[c];for(f=0;f<r;f++)i[a+f]!==0&&(s[R[i[a+f]]++]=f);if(t===bv?(U=O=s,S=19):t===Sc?(U=JS,$-=257,O=eT,K-=257,S=256):(U=tT,O=iT,S=-1),_=0,f=0,c=v,L=o,p=y,m=0,P=-1,x=1<<y,M=x-1,t===Sc&&x>pv||t===_v&&x>wv)return 1;for(;;){G=c-m,s[f]<S?(ae=0,V=s[f]):s[f]>S?(ae=O[K+s[f]],V=U[$+s[f]]):(ae=32+64,V=0),k=1<<c-m,I=1<<p,v=I;do I-=k,n[L+(_>>m)+I]=G<<24|ae<<16|V|0;while(I!==0);for(k=1<<c-1;_&k;)k>>=1;if(k!==0?(_&=k-1,_+=k):_=0,f++,--T[c]===0){if(c===g)break;c=i[a+s[f]]}if(c>y&&(_&M)!==P){for(m===0&&(m=y),L+=v,p=c-m,b=1<<p;p+m<g&&(b-=T[p+m],!(b<=0));)p++,b<<=1;if(x+=1<<p,t===Sc&&x>pv||t===_v&&x>wv)return 1;P=_&M,n[P]=y<<24|p<<16|L-o|0}}return _!==0&&(n[L+_]=c-m<<24|64<<16|0),h.bits=y,0},ni=cr,eu=fy,Oi=dy,aT=QS,An=rT,nT=0,ky=1,Cy=2,xv=4,oT=5,Ko=6,na=0,sT=1,lT=2,pi=-2,Ay=-3,Sy=-4,cT=-5,Ev=8,Ty=1,kv=2,Cv=3,Av=4,Sv=5,Tv=6,Rv=7,Pv=8,Iv=9,Lv=10,ps=11,er=12,Tc=13,Dv=14,Rc=15,Mv=16,Bv=17,Ov=18,Nv=19,Vo=20,$o=21,Fv=22,zv=23,Hv=24,Uv=25,Wv=26,Pc=27,qv=28,jv=29,nt=30,Ry=31,uT=32,hT=852,fT=592,dT=15,vT=dT;function Kv(e){return(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24)}function gT(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new ni.Buf16(320),this.work=new ni.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function Py(e){var t;return!e||!e.state?pi:(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=t.wrap&1),t.mode=Ty,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new ni.Buf32(hT),t.distcode=t.distdyn=new ni.Buf32(fT),t.sane=1,t.back=-1,na)}function Iy(e){var t;return!e||!e.state?pi:(t=e.state,t.wsize=0,t.whave=0,t.wnext=0,Py(e))}function Ly(e,t){var i,a;return!e||!e.state||(a=e.state,t<0?(i=0,t=-t):(i=(t>>4)+1,t<48&&(t&=15)),t&&(t<8||t>15))?pi:(a.window!==null&&a.wbits!==t&&(a.window=null),a.wrap=i,a.wbits=t,Iy(e))}function Dy(e,t){var i,a;return e?(a=new gT,e.state=a,a.window=null,i=Ly(e,t),i!==na&&(e.state=null),i):pi}function yT(e){return Dy(e,vT)}var Vv=!0,Ic,Lc;function mT(e){if(Vv){var t;for(Ic=new ni.Buf32(512),Lc=new ni.Buf32(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(An(ky,e.lens,0,288,Ic,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;An(Cy,e.lens,0,32,Lc,0,e.work,{bits:5}),Vv=!1}e.lencode=Ic,e.lenbits=9,e.distcode=Lc,e.distbits=5}function My(e,t,i,a){var r,n=e.state;return n.window===null&&(n.wsize=1<<n.wbits,n.wnext=0,n.whave=0,n.window=new ni.Buf8(n.wsize)),a>=n.wsize?(ni.arraySet(n.window,t,i-n.wsize,n.wsize,0),n.wnext=0,n.whave=n.wsize):(r=n.wsize-n.wnext,r>a&&(r=a),ni.arraySet(n.window,t,i-a,r,n.wnext),a-=r,a?(ni.arraySet(n.window,t,i-a,a,0),n.wnext=a,n.whave=n.wsize):(n.wnext+=r,n.wnext===n.wsize&&(n.wnext=0),n.whave<n.wsize&&(n.whave+=r))),0}function pT(e,t){var i,a,r,n,o,s,h,l,c,f,v,g,y,p,m=0,b,x,_,k,I,P,M,L,U=new ni.Buf8(4),$,S,T=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&e.avail_in!==0)return pi;i=e.state,i.mode===er&&(i.mode=Tc),o=e.next_out,r=e.output,h=e.avail_out,n=e.next_in,a=e.input,s=e.avail_in,l=i.hold,c=i.bits,f=s,v=h,L=na;e:for(;;)switch(i.mode){case Ty:if(i.wrap===0){i.mode=Tc;break}for(;c<16;){if(s===0)break e;s--,l+=a[n++]<<c,c+=8}if(i.wrap&2&&l===35615){i.check=0,U[0]=l&255,U[1]=l>>>8&255,i.check=Oi(i.check,U,2,0),l=0,c=0,i.mode=kv;break}if(i.flags=0,i.head&&(i.head.done=!1),!(i.wrap&1)||(((l&255)<<8)+(l>>8))%31){e.msg="incorrect header check",i.mode=nt;break}if((l&15)!==Ev){e.msg="unknown compression method",i.mode=nt;break}if(l>>>=4,c-=4,M=(l&15)+8,i.wbits===0)i.wbits=M;else if(M>i.wbits){e.msg="invalid window size",i.mode=nt;break}i.dmax=1<<M,e.adler=i.check=1,i.mode=l&512?Lv:er,l=0,c=0;break;case kv:for(;c<16;){if(s===0)break e;s--,l+=a[n++]<<c,c+=8}if(i.flags=l,(i.flags&255)!==Ev){e.msg="unknown compression method",i.mode=nt;break}if(i.flags&57344){e.msg="unknown header flags set",i.mode=nt;break}i.head&&(i.head.text=l>>8&1),i.flags&512&&(U[0]=l&255,U[1]=l>>>8&255,i.check=Oi(i.check,U,2,0)),l=0,c=0,i.mode=Cv;case Cv:for(;c<32;){if(s===0)break e;s--,l+=a[n++]<<c,c+=8}i.head&&(i.head.time=l),i.flags&512&&(U[0]=l&255,U[1]=l>>>8&255,U[2]=l>>>16&255,U[3]=l>>>24&255,i.check=Oi(i.check,U,4,0)),l=0,c=0,i.mode=Av;case Av:for(;c<16;){if(s===0)break e;s--,l+=a[n++]<<c,c+=8}i.head&&(i.head.xflags=l&255,i.head.os=l>>8),i.flags&512&&(U[0]=l&255,U[1]=l>>>8&255,i.check=Oi(i.check,U,2,0)),l=0,c=0,i.mode=Sv;case Sv:if(i.flags&1024){for(;c<16;){if(s===0)break e;s--,l+=a[n++]<<c,c+=8}i.length=l,i.head&&(i.head.extra_len=l),i.flags&512&&(U[0]=l&255,U[1]=l>>>8&255,i.check=Oi(i.check,U,2,0)),l=0,c=0}else i.head&&(i.head.extra=null);i.mode=Tv;case Tv:if(i.flags&1024&&(g=i.length,g>s&&(g=s),g&&(i.head&&(M=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Array(i.head.extra_len)),ni.arraySet(i.head.extra,a,n,g,M)),i.flags&512&&(i.check=Oi(i.check,a,g,n)),s-=g,n+=g,i.length-=g),i.length))break e;i.length=0,i.mode=Rv;case Rv:if(i.flags&2048){if(s===0)break e;g=0;do M=a[n+g++],i.head&&M&&i.length<65536&&(i.head.name+=String.fromCharCode(M));while(M&&g<s);if(i.flags&512&&(i.check=Oi(i.check,a,g,n)),s-=g,n+=g,M)break e}else i.head&&(i.head.name=null);i.length=0,i.mode=Pv;case Pv:if(i.flags&4096){if(s===0)break e;g=0;do M=a[n+g++],i.head&&M&&i.length<65536&&(i.head.comment+=String.fromCharCode(M));while(M&&g<s);if(i.flags&512&&(i.check=Oi(i.check,a,g,n)),s-=g,n+=g,M)break e}else i.head&&(i.head.comment=null);i.mode=Iv;case Iv:if(i.flags&512){for(;c<16;){if(s===0)break e;s--,l+=a[n++]<<c,c+=8}if(l!==(i.check&65535)){e.msg="header crc mismatch",i.mode=nt;break}l=0,c=0}i.head&&(i.head.hcrc=i.flags>>9&1,i.head.done=!0),e.adler=i.check=0,i.mode=er;break;case Lv:for(;c<32;){if(s===0)break e;s--,l+=a[n++]<<c,c+=8}e.adler=i.check=Kv(l),l=0,c=0,i.mode=ps;case ps:if(i.havedict===0)return e.next_out=o,e.avail_out=h,e.next_in=n,e.avail_in=s,i.hold=l,i.bits=c,lT;e.adler=i.check=1,i.mode=er;case er:if(t===oT||t===Ko)break e;case Tc:if(i.last){l>>>=c&7,c-=c&7,i.mode=Pc;break}for(;c<3;){if(s===0)break e;s--,l+=a[n++]<<c,c+=8}switch(i.last=l&1,l>>>=1,c-=1,l&3){case 0:i.mode=Dv;break;case 1:if(mT(i),i.mode=Vo,t===Ko){l>>>=2,c-=2;break e}break;case 2:i.mode=Bv;break;case 3:e.msg="invalid block type",i.mode=nt}l>>>=2,c-=2;break;case Dv:for(l>>>=c&7,c-=c&7;c<32;){if(s===0)break e;s--,l+=a[n++]<<c,c+=8}if((l&65535)!==(l>>>16^65535)){e.msg="invalid stored block lengths",i.mode=nt;break}if(i.length=l&65535,l=0,c=0,i.mode=Rc,t===Ko)break e;case Rc:i.mode=Mv;case Mv:if(g=i.length,g){if(g>s&&(g=s),g>h&&(g=h),g===0)break e;ni.arraySet(r,a,n,g,o),s-=g,n+=g,h-=g,o+=g,i.length-=g;break}i.mode=er;break;case Bv:for(;c<14;){if(s===0)break e;s--,l+=a[n++]<<c,c+=8}if(i.nlen=(l&31)+257,l>>>=5,c-=5,i.ndist=(l&31)+1,l>>>=5,c-=5,i.ncode=(l&15)+4,l>>>=4,c-=4,i.nlen>286||i.ndist>30){e.msg="too many length or distance symbols",i.mode=nt;break}i.have=0,i.mode=Ov;case Ov:for(;i.have<i.ncode;){for(;c<3;){if(s===0)break e;s--,l+=a[n++]<<c,c+=8}i.lens[T[i.have++]]=l&7,l>>>=3,c-=3}for(;i.have<19;)i.lens[T[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,$={bits:i.lenbits},L=An(nT,i.lens,0,19,i.lencode,0,i.work,$),i.lenbits=$.bits,L){e.msg="invalid code lengths set",i.mode=nt;break}i.have=0,i.mode=Nv;case Nv:for(;i.have<i.nlen+i.ndist;){for(;m=i.lencode[l&(1<<i.lenbits)-1],b=m>>>24,x=m>>>16&255,_=m&65535,!(b<=c);){if(s===0)break e;s--,l+=a[n++]<<c,c+=8}if(_<16)l>>>=b,c-=b,i.lens[i.have++]=_;else{if(_===16){for(S=b+2;c<S;){if(s===0)break e;s--,l+=a[n++]<<c,c+=8}if(l>>>=b,c-=b,i.have===0){e.msg="invalid bit length repeat",i.mode=nt;break}M=i.lens[i.have-1],g=3+(l&3),l>>>=2,c-=2}else if(_===17){for(S=b+3;c<S;){if(s===0)break e;s--,l+=a[n++]<<c,c+=8}l>>>=b,c-=b,M=0,g=3+(l&7),l>>>=3,c-=3}else{for(S=b+7;c<S;){if(s===0)break e;s--,l+=a[n++]<<c,c+=8}l>>>=b,c-=b,M=0,g=11+(l&127),l>>>=7,c-=7}if(i.have+g>i.nlen+i.ndist){e.msg="invalid bit length repeat",i.mode=nt;break}for(;g--;)i.lens[i.have++]=M}}if(i.mode===nt)break;if(i.lens[256]===0){e.msg="invalid code -- missing end-of-block",i.mode=nt;break}if(i.lenbits=9,$={bits:i.lenbits},L=An(ky,i.lens,0,i.nlen,i.lencode,0,i.work,$),i.lenbits=$.bits,L){e.msg="invalid literal/lengths set",i.mode=nt;break}if(i.distbits=6,i.distcode=i.distdyn,$={bits:i.distbits},L=An(Cy,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,$),i.distbits=$.bits,L){e.msg="invalid distances set",i.mode=nt;break}if(i.mode=Vo,t===Ko)break e;case Vo:i.mode=$o;case $o:if(s>=6&&h>=258){e.next_out=o,e.avail_out=h,e.next_in=n,e.avail_in=s,i.hold=l,i.bits=c,aT(e,v),o=e.next_out,r=e.output,h=e.avail_out,n=e.next_in,a=e.input,s=e.avail_in,l=i.hold,c=i.bits,i.mode===er&&(i.back=-1);break}for(i.back=0;m=i.lencode[l&(1<<i.lenbits)-1],b=m>>>24,x=m>>>16&255,_=m&65535,!(b<=c);){if(s===0)break e;s--,l+=a[n++]<<c,c+=8}if(x&&(x&240)===0){for(k=b,I=x,P=_;m=i.lencode[P+((l&(1<<k+I)-1)>>k)],b=m>>>24,x=m>>>16&255,_=m&65535,!(k+b<=c);){if(s===0)break e;s--,l+=a[n++]<<c,c+=8}l>>>=k,c-=k,i.back+=k}if(l>>>=b,c-=b,i.back+=b,i.length=_,x===0){i.mode=Wv;break}if(x&32){i.back=-1,i.mode=er;break}if(x&64){e.msg="invalid literal/length code",i.mode=nt;break}i.extra=x&15,i.mode=Fv;case Fv:if(i.extra){for(S=i.extra;c<S;){if(s===0)break e;s--,l+=a[n++]<<c,c+=8}i.length+=l&(1<<i.extra)-1,l>>>=i.extra,c-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=zv;case zv:for(;m=i.distcode[l&(1<<i.distbits)-1],b=m>>>24,x=m>>>16&255,_=m&65535,!(b<=c);){if(s===0)break e;s--,l+=a[n++]<<c,c+=8}if((x&240)===0){for(k=b,I=x,P=_;m=i.distcode[P+((l&(1<<k+I)-1)>>k)],b=m>>>24,x=m>>>16&255,_=m&65535,!(k+b<=c);){if(s===0)break e;s--,l+=a[n++]<<c,c+=8}l>>>=k,c-=k,i.back+=k}if(l>>>=b,c-=b,i.back+=b,x&64){e.msg="invalid distance code",i.mode=nt;break}i.offset=_,i.extra=x&15,i.mode=Hv;case Hv:if(i.extra){for(S=i.extra;c<S;){if(s===0)break e;s--,l+=a[n++]<<c,c+=8}i.offset+=l&(1<<i.extra)-1,l>>>=i.extra,c-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){e.msg="invalid distance too far back",i.mode=nt;break}i.mode=Uv;case Uv:if(h===0)break e;if(g=v-h,i.offset>g){if(g=i.offset-g,g>i.whave&&i.sane){e.msg="invalid distance too far back",i.mode=nt;break}g>i.wnext?(g-=i.wnext,y=i.wsize-g):y=i.wnext-g,g>i.length&&(g=i.length),p=i.window}else p=r,y=o-i.offset,g=i.length;g>h&&(g=h),h-=g,i.length-=g;do r[o++]=p[y++];while(--g);i.length===0&&(i.mode=$o);break;case Wv:if(h===0)break e;r[o++]=i.length,h--,i.mode=$o;break;case Pc:if(i.wrap){for(;c<32;){if(s===0)break e;s--,l|=a[n++]<<c,c+=8}if(v-=h,e.total_out+=v,i.total+=v,v&&(e.adler=i.check=i.flags?Oi(i.check,r,v,o-v):eu(i.check,r,v,o-v)),v=h,(i.flags?l:Kv(l))!==i.check){e.msg="incorrect data check",i.mode=nt;break}l=0,c=0}i.mode=qv;case qv:if(i.wrap&&i.flags){for(;c<32;){if(s===0)break e;s--,l+=a[n++]<<c,c+=8}if(l!==(i.total&4294967295)){e.msg="incorrect length check",i.mode=nt;break}l=0,c=0}i.mode=jv;case jv:L=sT;break e;case nt:L=Ay;break e;case Ry:return Sy;case uT:default:return pi}return e.next_out=o,e.avail_out=h,e.next_in=n,e.avail_in=s,i.hold=l,i.bits=c,(i.wsize||v!==e.avail_out&&i.mode<nt&&(i.mode<Pc||t!==xv))&&My(e,e.output,e.next_out,v-e.avail_out),f-=e.avail_in,v-=e.avail_out,e.total_in+=f,e.total_out+=v,i.total+=v,i.wrap&&v&&(e.adler=i.check=i.flags?Oi(i.check,r,v,e.next_out-v):eu(i.check,r,v,e.next_out-v)),e.data_type=i.bits+(i.last?64:0)+(i.mode===er?128:0)+(i.mode===Vo||i.mode===Rc?256:0),(f===0&&v===0||t===xv)&&L===na&&(L=cT),L}function wT(e){if(!e||!e.state)return pi;var t=e.state;return t.window&&(t.window=null),e.state=null,na}function bT(e,t){var i;return!e||!e.state||(i=e.state,(i.wrap&2)===0)?pi:(i.head=t,t.done=!1,na)}function _T(e,t){var i=t.length,a,r,n;return!e||!e.state||(a=e.state,a.wrap!==0&&a.mode!==ps)?pi:a.mode===ps&&(r=1,r=eu(r,t,i,0),r!==a.check)?Ay:(n=My(e,t,i,i),n?(a.mode=Ry,Sy):(a.havedict=1,na))}Si.inflateReset=Iy;Si.inflateReset2=Ly;Si.inflateResetKeep=Py;Si.inflateInit=yT;Si.inflateInit2=Dy;Si.inflate=pT;Si.inflateEnd=wT;Si.inflateGetHeader=bT;Si.inflateSetDictionary=_T;Si.inflateInfo="pako inflate (from Nodeca project)";var By={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};function xT(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}var ET=xT,Ua=Si,Sn=cr,ns=ca,ft=By,tu=bu,kT=xy,CT=ET,Oy=Object.prototype.toString;function oa(e){if(!(this instanceof oa))return new oa(e);this.options=Sn.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,t.windowBits===0&&(t.windowBits=-15)),t.windowBits>=0&&t.windowBits<16&&!(e&&e.windowBits)&&(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(t.windowBits&15)===0&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new kT,this.strm.avail_out=0;var i=Ua.inflateInit2(this.strm,t.windowBits);if(i!==ft.Z_OK)throw new Error(tu[i]);if(this.header=new CT,Ua.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=ns.string2buf(t.dictionary):Oy.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(i=Ua.inflateSetDictionary(this.strm,t.dictionary),i!==ft.Z_OK)))throw new Error(tu[i])}oa.prototype.push=function(e,t){var i=this.strm,a=this.options.chunkSize,r=this.options.dictionary,n,o,s,h,l,c=!1;if(this.ended)return!1;o=t===~~t?t:t===!0?ft.Z_FINISH:ft.Z_NO_FLUSH,typeof e=="string"?i.input=ns.binstring2buf(e):Oy.call(e)==="[object ArrayBuffer]"?i.input=new Uint8Array(e):i.input=e,i.next_in=0,i.avail_in=i.input.length;do{if(i.avail_out===0&&(i.output=new Sn.Buf8(a),i.next_out=0,i.avail_out=a),n=Ua.inflate(i,ft.Z_NO_FLUSH),n===ft.Z_NEED_DICT&&r&&(n=Ua.inflateSetDictionary(this.strm,r)),n===ft.Z_BUF_ERROR&&c===!0&&(n=ft.Z_OK,c=!1),n!==ft.Z_STREAM_END&&n!==ft.Z_OK)return this.onEnd(n),this.ended=!0,!1;i.next_out&&(i.avail_out===0||n===ft.Z_STREAM_END||i.avail_in===0&&(o===ft.Z_FINISH||o===ft.Z_SYNC_FLUSH))&&(this.options.to==="string"?(s=ns.utf8border(i.output,i.next_out),h=i.next_out-s,l=ns.buf2string(i.output,s),i.next_out=h,i.avail_out=a-h,h&&Sn.arraySet(i.output,i.output,s,h,0),this.onData(l)):this.onData(Sn.shrinkBuf(i.output,i.next_out))),i.avail_in===0&&i.avail_out===0&&(c=!0)}while((i.avail_in>0||i.avail_out===0)&&n!==ft.Z_STREAM_END);return n===ft.Z_STREAM_END&&(o=ft.Z_FINISH),o===ft.Z_FINISH?(n=Ua.inflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===ft.Z_OK):(o===ft.Z_SYNC_FLUSH&&(this.onEnd(ft.Z_OK),i.avail_out=0),!0)};oa.prototype.onData=function(e){this.chunks.push(e)};oa.prototype.onEnd=function(e){e===ft.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Sn.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function xu(e,t){var i=new oa(t);if(i.push(e,!0),i.err)throw i.msg||tu[i.err];return i.result}function AT(e,t){return t=t||{},t.raw=!0,xu(e,t)}qn.Inflate=oa;qn.inflate=xu;qn.inflateRaw=AT;qn.ungzip=xu;var ST=cr.assign,TT=Hn,RT=qn,PT=By,Ny={};ST(Ny,TT,RT,PT);var VT=Ny,iu={exports:{}};/**
- * @license
- * Lodash <https://lodash.com/>
- * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
- * Released under MIT license <https://lodash.com/license>
- * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
- * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
- */(function(e,t){(function(){var i,a="4.17.21",r=200,n="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",o="Expected a function",s="Invalid `variable` option passed into `_.template`",h="__lodash_hash_undefined__",l=500,c="__lodash_placeholder__",f=1,v=2,g=4,y=1,p=2,m=1,b=2,x=4,_=8,k=16,I=32,P=64,M=128,L=256,U=512,$=30,S="...",T=800,R=16,O=1,K=2,G=3,ae=1/0,V=9007199254740991,F=17976931348623157e292,q=0/0,Y=4294967295,W=Y-1,J=Y>>>1,re=[["ary",M],["bind",m],["bindKey",b],["curry",_],["curryRight",k],["flip",U],["partial",I],["partialRight",P],["rearg",L]],ee="[object Arguments]",he="[object Array]",le="[object AsyncFunction]",se="[object Boolean]",E="[object Date]",C="[object DOMException]",D="[object Error]",H="[object Function]",X="[object GeneratorFunction]",Q="[object Map]",ne="[object Number]",ye="[object Null]",ge="[object Object]",xe="[object Promise]",Se="[object Proxy]",xt="[object RegExp]",it="[object Set]",Et="[object String]",qe="[object Symbol]",Qe="[object Undefined]",Ti="[object WeakMap]",Fy="[object WeakSet]",Ya="[object ArrayBuffer]",ua="[object DataView]",Ts="[object Float32Array]",Rs="[object Float64Array]",Ps="[object Int8Array]",Is="[object Int16Array]",Ls="[object Int32Array]",Ds="[object Uint8Array]",Ms="[object Uint8ClampedArray]",Bs="[object Uint16Array]",Os="[object Uint32Array]",zy=/\b__p \+= '';/g,Hy=/\b(__p \+=) '' \+/g,Uy=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Eu=/&(?:amp|lt|gt|quot|#39);/g,ku=/[&<>"']/g,Wy=RegExp(Eu.source),qy=RegExp(ku.source),jy=/<%-([\s\S]+?)%>/g,Ky=/<%([\s\S]+?)%>/g,Cu=/<%=([\s\S]+?)%>/g,Vy=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,$y=/^\w*$/,Yy=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Ns=/[\\^$.*+?()[\]{}|]/g,Gy=RegExp(Ns.source),Fs=/^\s+/,Xy=/\s/,Zy=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Qy=/\{\n\/\* \[wrapped with (.+)\] \*/,Jy=/,? & /,e0=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,t0=/[()=,{}\[\]\/\s]/,i0=/\\(\\)?/g,r0=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Au=/\w*$/,a0=/^[-+]0x[0-9a-f]+$/i,n0=/^0b[01]+$/i,o0=/^\[object .+?Constructor\]$/,s0=/^0o[0-7]+$/i,l0=/^(?:0|[1-9]\d*)$/,c0=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,jn=/($^)/,u0=/['\n\r\u2028\u2029\\]/g,Kn="\\ud800-\\udfff",h0="\\u0300-\\u036f",f0="\\ufe20-\\ufe2f",d0="\\u20d0-\\u20ff",Su=h0+f0+d0,Tu="\\u2700-\\u27bf",Ru="a-z\\xdf-\\xf6\\xf8-\\xff",v0="\\xac\\xb1\\xd7\\xf7",g0="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",y0="\\u2000-\\u206f",m0=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Pu="A-Z\\xc0-\\xd6\\xd8-\\xde",Iu="\\ufe0e\\ufe0f",Lu=v0+g0+y0+m0,zs="['\u2019]",p0="["+Kn+"]",Du="["+Lu+"]",Vn="["+Su+"]",Mu="\\d+",w0="["+Tu+"]",Bu="["+Ru+"]",Ou="[^"+Kn+Lu+Mu+Tu+Ru+Pu+"]",Hs="\\ud83c[\\udffb-\\udfff]",b0="(?:"+Vn+"|"+Hs+")",Nu="[^"+Kn+"]",Us="(?:\\ud83c[\\udde6-\\uddff]){2}",Ws="[\\ud800-\\udbff][\\udc00-\\udfff]",ha="["+Pu+"]",Fu="\\u200d",zu="(?:"+Bu+"|"+Ou+")",_0="(?:"+ha+"|"+Ou+")",Hu="(?:"+zs+"(?:d|ll|m|re|s|t|ve))?",Uu="(?:"+zs+"(?:D|LL|M|RE|S|T|VE))?",Wu=b0+"?",qu="["+Iu+"]?",x0="(?:"+Fu+"(?:"+[Nu,Us,Ws].join("|")+")"+qu+Wu+")*",E0="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",k0="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",ju=qu+Wu+x0,C0="(?:"+[w0,Us,Ws].join("|")+")"+ju,A0="(?:"+[Nu+Vn+"?",Vn,Us,Ws,p0].join("|")+")",S0=RegExp(zs,"g"),T0=RegExp(Vn,"g"),qs=RegExp(Hs+"(?="+Hs+")|"+A0+ju,"g"),R0=RegExp([ha+"?"+Bu+"+"+Hu+"(?="+[Du,ha,"$"].join("|")+")",_0+"+"+Uu+"(?="+[Du,ha+zu,"$"].join("|")+")",ha+"?"+zu+"+"+Hu,ha+"+"+Uu,k0,E0,Mu,C0].join("|"),"g"),P0=RegExp("["+Fu+Kn+Su+Iu+"]"),I0=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,L0=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],D0=-1,et={};et[Ts]=et[Rs]=et[Ps]=et[Is]=et[Ls]=et[Ds]=et[Ms]=et[Bs]=et[Os]=!0,et[ee]=et[he]=et[Ya]=et[se]=et[ua]=et[E]=et[D]=et[H]=et[Q]=et[ne]=et[ge]=et[xt]=et[it]=et[Et]=et[Ti]=!1;var Je={};Je[ee]=Je[he]=Je[Ya]=Je[ua]=Je[se]=Je[E]=Je[Ts]=Je[Rs]=Je[Ps]=Je[Is]=Je[Ls]=Je[Q]=Je[ne]=Je[ge]=Je[xt]=Je[it]=Je[Et]=Je[qe]=Je[Ds]=Je[Ms]=Je[Bs]=Je[Os]=!0,Je[D]=Je[H]=Je[Ti]=!1;var M0={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"s"},B0={"&":"&","<":"<",">":">",'"':""","'":"'"},O0={"&":"&","<":"<",">":">",""":'"',"'":"'"},N0={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},F0=parseFloat,z0=parseInt,Ku=typeof Ot=="object"&&Ot&&Ot.Object===Object&&Ot,H0=typeof self=="object"&&self&&self.Object===Object&&self,kt=Ku||H0||Function("return this")(),js=t&&!t.nodeType&&t,Mr=js&&!0&&e&&!e.nodeType&&e,Vu=Mr&&Mr.exports===js,Ks=Vu&&Ku.process,si=function(){try{var te=Mr&&Mr.require&&Mr.require("util").types;return te||Ks&&Ks.binding&&Ks.binding("util")}catch{}}(),$u=si&&si.isArrayBuffer,Yu=si&&si.isDate,Gu=si&&si.isMap,Xu=si&&si.isRegExp,Zu=si&&si.isSet,Qu=si&&si.isTypedArray;function Xt(te,ue,oe){switch(oe.length){case 0:return te.call(ue);case 1:return te.call(ue,oe[0]);case 2:return te.call(ue,oe[0],oe[1]);case 3:return te.call(ue,oe[0],oe[1],oe[2])}return te.apply(ue,oe)}function U0(te,ue,oe,pe){for(var Te=-1,je=te==null?0:te.length;++Te<je;){var gt=te[Te];ue(pe,gt,oe(gt),te)}return pe}function li(te,ue){for(var oe=-1,pe=te==null?0:te.length;++oe<pe&&ue(te[oe],oe,te)!==!1;);return te}function W0(te,ue){for(var oe=te==null?0:te.length;oe--&&ue(te[oe],oe,te)!==!1;);return te}function Ju(te,ue){for(var oe=-1,pe=te==null?0:te.length;++oe<pe;)if(!ue(te[oe],oe,te))return!1;return!0}function ur(te,ue){for(var oe=-1,pe=te==null?0:te.length,Te=0,je=[];++oe<pe;){var gt=te[oe];ue(gt,oe,te)&&(je[Te++]=gt)}return je}function $n(te,ue){var oe=te==null?0:te.length;return!!oe&&fa(te,ue,0)>-1}function Vs(te,ue,oe){for(var pe=-1,Te=te==null?0:te.length;++pe<Te;)if(oe(ue,te[pe]))return!0;return!1}function rt(te,ue){for(var oe=-1,pe=te==null?0:te.length,Te=Array(pe);++oe<pe;)Te[oe]=ue(te[oe],oe,te);return Te}function hr(te,ue){for(var oe=-1,pe=ue.length,Te=te.length;++oe<pe;)te[Te+oe]=ue[oe];return te}function $s(te,ue,oe,pe){var Te=-1,je=te==null?0:te.length;for(pe&&je&&(oe=te[++Te]);++Te<je;)oe=ue(oe,te[Te],Te,te);return oe}function q0(te,ue,oe,pe){var Te=te==null?0:te.length;for(pe&&Te&&(oe=te[--Te]);Te--;)oe=ue(oe,te[Te],Te,te);return oe}function Ys(te,ue){for(var oe=-1,pe=te==null?0:te.length;++oe<pe;)if(ue(te[oe],oe,te))return!0;return!1}var j0=Gs("length");function K0(te){return te.split("")}function V0(te){return te.match(e0)||[]}function eh(te,ue,oe){var pe;return oe(te,function(Te,je,gt){if(ue(Te,je,gt))return pe=je,!1}),pe}function Yn(te,ue,oe,pe){for(var Te=te.length,je=oe+(pe?1:-1);pe?je--:++je<Te;)if(ue(te[je],je,te))return je;return-1}function fa(te,ue,oe){return ue===ue?am(te,ue,oe):Yn(te,th,oe)}function $0(te,ue,oe,pe){for(var Te=oe-1,je=te.length;++Te<je;)if(pe(te[Te],ue))return Te;return-1}function th(te){return te!==te}function ih(te,ue){var oe=te==null?0:te.length;return oe?Zs(te,ue)/oe:q}function Gs(te){return function(ue){return ue==null?i:ue[te]}}function Xs(te){return function(ue){return te==null?i:te[ue]}}function rh(te,ue,oe,pe,Te){return Te(te,function(je,gt,Xe){oe=pe?(pe=!1,je):ue(oe,je,gt,Xe)}),oe}function Y0(te,ue){var oe=te.length;for(te.sort(ue);oe--;)te[oe]=te[oe].value;return te}function Zs(te,ue){for(var oe,pe=-1,Te=te.length;++pe<Te;){var je=ue(te[pe]);je!==i&&(oe=oe===i?je:oe+je)}return oe}function Qs(te,ue){for(var oe=-1,pe=Array(te);++oe<te;)pe[oe]=ue(oe);return pe}function G0(te,ue){return rt(ue,function(oe){return[oe,te[oe]]})}function ah(te){return te&&te.slice(0,lh(te)+1).replace(Fs,"")}function Zt(te){return function(ue){return te(ue)}}function Js(te,ue){return rt(ue,function(oe){return te[oe]})}function Ga(te,ue){return te.has(ue)}function nh(te,ue){for(var oe=-1,pe=te.length;++oe<pe&&fa(ue,te[oe],0)>-1;);return oe}function oh(te,ue){for(var oe=te.length;oe--&&fa(ue,te[oe],0)>-1;);return oe}function X0(te,ue){for(var oe=te.length,pe=0;oe--;)te[oe]===ue&&++pe;return pe}var Z0=Xs(M0),Q0=Xs(B0);function J0(te){return"\\"+N0[te]}function em(te,ue){return te==null?i:te[ue]}function da(te){return P0.test(te)}function tm(te){return I0.test(te)}function im(te){for(var ue,oe=[];!(ue=te.next()).done;)oe.push(ue.value);return oe}function el(te){var ue=-1,oe=Array(te.size);return te.forEach(function(pe,Te){oe[++ue]=[Te,pe]}),oe}function sh(te,ue){return function(oe){return te(ue(oe))}}function fr(te,ue){for(var oe=-1,pe=te.length,Te=0,je=[];++oe<pe;){var gt=te[oe];(gt===ue||gt===c)&&(te[oe]=c,je[Te++]=oe)}return je}function Gn(te){var ue=-1,oe=Array(te.size);return te.forEach(function(pe){oe[++ue]=pe}),oe}function rm(te){var ue=-1,oe=Array(te.size);return te.forEach(function(pe){oe[++ue]=[pe,pe]}),oe}function am(te,ue,oe){for(var pe=oe-1,Te=te.length;++pe<Te;)if(te[pe]===ue)return pe;return-1}function nm(te,ue,oe){for(var pe=oe+1;pe--;)if(te[pe]===ue)return pe;return pe}function va(te){return da(te)?sm(te):j0(te)}function wi(te){return da(te)?lm(te):K0(te)}function lh(te){for(var ue=te.length;ue--&&Xy.test(te.charAt(ue)););return ue}var om=Xs(O0);function sm(te){for(var ue=qs.lastIndex=0;qs.test(te);)++ue;return ue}function lm(te){return te.match(qs)||[]}function cm(te){return te.match(R0)||[]}var um=function te(ue){ue=ue==null?kt:ga.defaults(kt.Object(),ue,ga.pick(kt,L0));var oe=ue.Array,pe=ue.Date,Te=ue.Error,je=ue.Function,gt=ue.Math,Xe=ue.Object,tl=ue.RegExp,hm=ue.String,ci=ue.TypeError,Xn=oe.prototype,fm=je.prototype,ya=Xe.prototype,Zn=ue["__core-js_shared__"],Qn=fm.toString,$e=ya.hasOwnProperty,dm=0,ch=function(){var u=/[^.]+$/.exec(Zn&&Zn.keys&&Zn.keys.IE_PROTO||"");return u?"Symbol(src)_1."+u:""}(),Jn=ya.toString,vm=Qn.call(Xe),gm=kt._,ym=tl("^"+Qn.call($e).replace(Ns,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),eo=Vu?ue.Buffer:i,dr=ue.Symbol,to=ue.Uint8Array,uh=eo?eo.allocUnsafe:i,io=sh(Xe.getPrototypeOf,Xe),hh=Xe.create,fh=ya.propertyIsEnumerable,ro=Xn.splice,dh=dr?dr.isConcatSpreadable:i,Xa=dr?dr.iterator:i,Br=dr?dr.toStringTag:i,ao=function(){try{var u=Hr(Xe,"defineProperty");return u({},"",{}),u}catch{}}(),mm=ue.clearTimeout!==kt.clearTimeout&&ue.clearTimeout,pm=pe&&pe.now!==kt.Date.now&&pe.now,wm=ue.setTimeout!==kt.setTimeout&&ue.setTimeout,no=gt.ceil,oo=gt.floor,il=Xe.getOwnPropertySymbols,bm=eo?eo.isBuffer:i,vh=ue.isFinite,_m=Xn.join,xm=sh(Xe.keys,Xe),yt=gt.max,Tt=gt.min,Em=pe.now,km=ue.parseInt,gh=gt.random,Cm=Xn.reverse,rl=Hr(ue,"DataView"),Za=Hr(ue,"Map"),al=Hr(ue,"Promise"),ma=Hr(ue,"Set"),Qa=Hr(ue,"WeakMap"),Ja=Hr(Xe,"create"),so=Qa&&new Qa,pa={},Am=Ur(rl),Sm=Ur(Za),Tm=Ur(al),Rm=Ur(ma),Pm=Ur(Qa),lo=dr?dr.prototype:i,en=lo?lo.valueOf:i,yh=lo?lo.toString:i;function N(u){if(ct(u)&&!Re(u)&&!(u instanceof Oe)){if(u instanceof ui)return u;if($e.call(u,"__wrapped__"))return pf(u)}return new ui(u)}var wa=function(){function u(){}return function(d){if(!st(d))return{};if(hh)return hh(d);u.prototype=d;var w=new u;return u.prototype=i,w}}();function co(){}function ui(u,d){this.__wrapped__=u,this.__actions__=[],this.__chain__=!!d,this.__index__=0,this.__values__=i}N.templateSettings={escape:jy,evaluate:Ky,interpolate:Cu,variable:"",imports:{_:N}},N.prototype=co.prototype,N.prototype.constructor=N,ui.prototype=wa(co.prototype),ui.prototype.constructor=ui;function Oe(u){this.__wrapped__=u,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=Y,this.__views__=[]}function Im(){var u=new Oe(this.__wrapped__);return u.__actions__=zt(this.__actions__),u.__dir__=this.__dir__,u.__filtered__=this.__filtered__,u.__iteratees__=zt(this.__iteratees__),u.__takeCount__=this.__takeCount__,u.__views__=zt(this.__views__),u}function Lm(){if(this.__filtered__){var u=new Oe(this);u.__dir__=-1,u.__filtered__=!0}else u=this.clone(),u.__dir__*=-1;return u}function Dm(){var u=this.__wrapped__.value(),d=this.__dir__,w=Re(u),A=d<0,B=w?u.length:0,z=Kp(0,B,this.__views__),j=z.start,Z=z.end,ie=Z-j,fe=A?Z:j-1,de=this.__iteratees__,ve=de.length,me=0,_e=Tt(ie,this.__takeCount__);if(!w||!A&&B==ie&&_e==ie)return Hh(u,this.__actions__);var Ce=[];e:for(;ie--&&me<_e;){fe+=d;for(var Le=-1,Ae=u[fe];++Le<ve;){var Be=de[Le],Fe=Be.iteratee,ei=Be.type,Bt=Fe(Ae);if(ei==K)Ae=Bt;else if(!Bt){if(ei==O)continue e;break e}}Ce[me++]=Ae}return Ce}Oe.prototype=wa(co.prototype),Oe.prototype.constructor=Oe;function Or(u){var d=-1,w=u==null?0:u.length;for(this.clear();++d<w;){var A=u[d];this.set(A[0],A[1])}}function Mm(){this.__data__=Ja?Ja(null):{},this.size=0}function Bm(u){var d=this.has(u)&&delete this.__data__[u];return this.size-=d?1:0,d}function Om(u){var d=this.__data__;if(Ja){var w=d[u];return w===h?i:w}return $e.call(d,u)?d[u]:i}function Nm(u){var d=this.__data__;return Ja?d[u]!==i:$e.call(d,u)}function Fm(u,d){var w=this.__data__;return this.size+=this.has(u)?0:1,w[u]=Ja&&d===i?h:d,this}Or.prototype.clear=Mm,Or.prototype.delete=Bm,Or.prototype.get=Om,Or.prototype.has=Nm,Or.prototype.set=Fm;function qi(u){var d=-1,w=u==null?0:u.length;for(this.clear();++d<w;){var A=u[d];this.set(A[0],A[1])}}function zm(){this.__data__=[],this.size=0}function Hm(u){var d=this.__data__,w=uo(d,u);if(w<0)return!1;var A=d.length-1;return w==A?d.pop():ro.call(d,w,1),--this.size,!0}function Um(u){var d=this.__data__,w=uo(d,u);return w<0?i:d[w][1]}function Wm(u){return uo(this.__data__,u)>-1}function qm(u,d){var w=this.__data__,A=uo(w,u);return A<0?(++this.size,w.push([u,d])):w[A][1]=d,this}qi.prototype.clear=zm,qi.prototype.delete=Hm,qi.prototype.get=Um,qi.prototype.has=Wm,qi.prototype.set=qm;function ji(u){var d=-1,w=u==null?0:u.length;for(this.clear();++d<w;){var A=u[d];this.set(A[0],A[1])}}function jm(){this.size=0,this.__data__={hash:new Or,map:new(Za||qi),string:new Or}}function Km(u){var d=Eo(this,u).delete(u);return this.size-=d?1:0,d}function Vm(u){return Eo(this,u).get(u)}function $m(u){return Eo(this,u).has(u)}function Ym(u,d){var w=Eo(this,u),A=w.size;return w.set(u,d),this.size+=w.size==A?0:1,this}ji.prototype.clear=jm,ji.prototype.delete=Km,ji.prototype.get=Vm,ji.prototype.has=$m,ji.prototype.set=Ym;function Nr(u){var d=-1,w=u==null?0:u.length;for(this.__data__=new ji;++d<w;)this.add(u[d])}function Gm(u){return this.__data__.set(u,h),this}function Xm(u){return this.__data__.has(u)}Nr.prototype.add=Nr.prototype.push=Gm,Nr.prototype.has=Xm;function bi(u){var d=this.__data__=new qi(u);this.size=d.size}function Zm(){this.__data__=new qi,this.size=0}function Qm(u){var d=this.__data__,w=d.delete(u);return this.size=d.size,w}function Jm(u){return this.__data__.get(u)}function ep(u){return this.__data__.has(u)}function tp(u,d){var w=this.__data__;if(w instanceof qi){var A=w.__data__;if(!Za||A.length<r-1)return A.push([u,d]),this.size=++w.size,this;w=this.__data__=new ji(A)}return w.set(u,d),this.size=w.size,this}bi.prototype.clear=Zm,bi.prototype.delete=Qm,bi.prototype.get=Jm,bi.prototype.has=ep,bi.prototype.set=tp;function mh(u,d){var w=Re(u),A=!w&&Wr(u),B=!w&&!A&&pr(u),z=!w&&!A&&!B&&Ea(u),j=w||A||B||z,Z=j?Qs(u.length,hm):[],ie=Z.length;for(var fe in u)(d||$e.call(u,fe))&&!(j&&(fe=="length"||B&&(fe=="offset"||fe=="parent")||z&&(fe=="buffer"||fe=="byteLength"||fe=="byteOffset")||Yi(fe,ie)))&&Z.push(fe);return Z}function ph(u){var d=u.length;return d?u[gl(0,d-1)]:i}function ip(u,d){return ko(zt(u),Fr(d,0,u.length))}function rp(u){return ko(zt(u))}function nl(u,d,w){(w!==i&&!_i(u[d],w)||w===i&&!(d in u))&&Ki(u,d,w)}function tn(u,d,w){var A=u[d];(!($e.call(u,d)&&_i(A,w))||w===i&&!(d in u))&&Ki(u,d,w)}function uo(u,d){for(var w=u.length;w--;)if(_i(u[w][0],d))return w;return-1}function ap(u,d,w,A){return vr(u,function(B,z,j){d(A,B,w(B),j)}),A}function wh(u,d){return u&&Pi(d,pt(d),u)}function np(u,d){return u&&Pi(d,Ut(d),u)}function Ki(u,d,w){d=="__proto__"&&ao?ao(u,d,{configurable:!0,enumerable:!0,value:w,writable:!0}):u[d]=w}function ol(u,d){for(var w=-1,A=d.length,B=oe(A),z=u==null;++w<A;)B[w]=z?i:Hl(u,d[w]);return B}function Fr(u,d,w){return u===u&&(w!==i&&(u=u<=w?u:w),d!==i&&(u=u>=d?u:d)),u}function hi(u,d,w,A,B,z){var j,Z=d&f,ie=d&v,fe=d&g;if(w&&(j=B?w(u,A,B,z):w(u)),j!==i)return j;if(!st(u))return u;var de=Re(u);if(de){if(j=$p(u),!Z)return zt(u,j)}else{var ve=Rt(u),me=ve==H||ve==X;if(pr(u))return qh(u,Z);if(ve==ge||ve==ee||me&&!B){if(j=ie||me?{}:cf(u),!Z)return ie?Op(u,np(j,u)):Bp(u,wh(j,u))}else{if(!Je[ve])return B?u:{};j=Yp(u,ve,Z)}}z||(z=new bi);var _e=z.get(u);if(_e)return _e;z.set(u,j),Ff(u)?u.forEach(function(Ae){j.add(hi(Ae,d,w,Ae,u,z))}):Of(u)&&u.forEach(function(Ae,Be){j.set(Be,hi(Ae,d,w,Be,u,z))});var Ce=fe?ie?Al:Cl:ie?Ut:pt,Le=de?i:Ce(u);return li(Le||u,function(Ae,Be){Le&&(Be=Ae,Ae=u[Be]),tn(j,Be,hi(Ae,d,w,Be,u,z))}),j}function op(u){var d=pt(u);return function(w){return bh(w,u,d)}}function bh(u,d,w){var A=w.length;if(u==null)return!A;for(u=Xe(u);A--;){var B=w[A],z=d[B],j=u[B];if(j===i&&!(B in u)||!z(j))return!1}return!0}function _h(u,d,w){if(typeof u!="function")throw new ci(o);return cn(function(){u.apply(i,w)},d)}function rn(u,d,w,A){var B=-1,z=$n,j=!0,Z=u.length,ie=[],fe=d.length;if(!Z)return ie;w&&(d=rt(d,Zt(w))),A?(z=Vs,j=!1):d.length>=r&&(z=Ga,j=!1,d=new Nr(d));e:for(;++B<Z;){var de=u[B],ve=w==null?de:w(de);if(de=A||de!==0?de:0,j&&ve===ve){for(var me=fe;me--;)if(d[me]===ve)continue e;ie.push(de)}else z(d,ve,A)||ie.push(de)}return ie}var vr=Yh(Ri),xh=Yh(ll,!0);function sp(u,d){var w=!0;return vr(u,function(A,B,z){return w=!!d(A,B,z),w}),w}function ho(u,d,w){for(var A=-1,B=u.length;++A<B;){var z=u[A],j=d(z);if(j!=null&&(Z===i?j===j&&!Jt(j):w(j,Z)))var Z=j,ie=z}return ie}function lp(u,d,w,A){var B=u.length;for(w=Ie(w),w<0&&(w=-w>B?0:B+w),A=A===i||A>B?B:Ie(A),A<0&&(A+=B),A=w>A?0:Hf(A);w<A;)u[w++]=d;return u}function Eh(u,d){var w=[];return vr(u,function(A,B,z){d(A,B,z)&&w.push(A)}),w}function Ct(u,d,w,A,B){var z=-1,j=u.length;for(w||(w=Xp),B||(B=[]);++z<j;){var Z=u[z];d>0&&w(Z)?d>1?Ct(Z,d-1,w,A,B):hr(B,Z):A||(B[B.length]=Z)}return B}var sl=Gh(),kh=Gh(!0);function Ri(u,d){return u&&sl(u,d,pt)}function ll(u,d){return u&&kh(u,d,pt)}function fo(u,d){return ur(d,function(w){return Gi(u[w])})}function zr(u,d){d=yr(d,u);for(var w=0,A=d.length;u!=null&&w<A;)u=u[Ii(d[w++])];return w&&w==A?u:i}function Ch(u,d,w){var A=d(u);return Re(u)?A:hr(A,w(u))}function Dt(u){return u==null?u===i?Qe:ye:Br&&Br in Xe(u)?jp(u):rw(u)}function cl(u,d){return u>d}function cp(u,d){return u!=null&&$e.call(u,d)}function up(u,d){return u!=null&&d in Xe(u)}function hp(u,d,w){return u>=Tt(d,w)&&u<yt(d,w)}function ul(u,d,w){for(var A=w?Vs:$n,B=u[0].length,z=u.length,j=z,Z=oe(z),ie=1/0,fe=[];j--;){var de=u[j];j&&d&&(de=rt(de,Zt(d))),ie=Tt(de.length,ie),Z[j]=!w&&(d||B>=120&&de.length>=120)?new Nr(j&&de):i}de=u[0];var ve=-1,me=Z[0];e:for(;++ve<B&&fe.length<ie;){var _e=de[ve],Ce=d?d(_e):_e;if(_e=w||_e!==0?_e:0,!(me?Ga(me,Ce):A(fe,Ce,w))){for(j=z;--j;){var Le=Z[j];if(!(Le?Ga(Le,Ce):A(u[j],Ce,w)))continue e}me&&me.push(Ce),fe.push(_e)}}return fe}function fp(u,d,w,A){return Ri(u,function(B,z,j){d(A,w(B),z,j)}),A}function an(u,d,w){d=yr(d,u),u=df(u,d);var A=u==null?u:u[Ii(di(d))];return A==null?i:Xt(A,u,w)}function Ah(u){return ct(u)&&Dt(u)==ee}function dp(u){return ct(u)&&Dt(u)==Ya}function vp(u){return ct(u)&&Dt(u)==E}function nn(u,d,w,A,B){return u===d?!0:u==null||d==null||!ct(u)&&!ct(d)?u!==u&&d!==d:gp(u,d,w,A,nn,B)}function gp(u,d,w,A,B,z){var j=Re(u),Z=Re(d),ie=j?he:Rt(u),fe=Z?he:Rt(d);ie=ie==ee?ge:ie,fe=fe==ee?ge:fe;var de=ie==ge,ve=fe==ge,me=ie==fe;if(me&&pr(u)){if(!pr(d))return!1;j=!0,de=!1}if(me&&!de)return z||(z=new bi),j||Ea(u)?of(u,d,w,A,B,z):Wp(u,d,ie,w,A,B,z);if(!(w&y)){var _e=de&&$e.call(u,"__wrapped__"),Ce=ve&&$e.call(d,"__wrapped__");if(_e||Ce){var Le=_e?u.value():u,Ae=Ce?d.value():d;return z||(z=new bi),B(Le,Ae,w,A,z)}}return me?(z||(z=new bi),qp(u,d,w,A,B,z)):!1}function yp(u){return ct(u)&&Rt(u)==Q}function hl(u,d,w,A){var B=w.length,z=B,j=!A;if(u==null)return!z;for(u=Xe(u);B--;){var Z=w[B];if(j&&Z[2]?Z[1]!==u[Z[0]]:!(Z[0]in u))return!1}for(;++B<z;){Z=w[B];var ie=Z[0],fe=u[ie],de=Z[1];if(j&&Z[2]){if(fe===i&&!(ie in u))return!1}else{var ve=new bi;if(A)var me=A(fe,de,ie,u,d,ve);if(!(me===i?nn(de,fe,y|p,A,ve):me))return!1}}return!0}function Sh(u){if(!st(u)||Qp(u))return!1;var d=Gi(u)?ym:o0;return d.test(Ur(u))}function mp(u){return ct(u)&&Dt(u)==xt}function pp(u){return ct(u)&&Rt(u)==it}function wp(u){return ct(u)&&Po(u.length)&&!!et[Dt(u)]}function Th(u){return typeof u=="function"?u:u==null?Wt:typeof u=="object"?Re(u)?Ih(u[0],u[1]):Ph(u):Zf(u)}function fl(u){if(!ln(u))return xm(u);var d=[];for(var w in Xe(u))$e.call(u,w)&&w!="constructor"&&d.push(w);return d}function bp(u){if(!st(u))return iw(u);var d=ln(u),w=[];for(var A in u)A=="constructor"&&(d||!$e.call(u,A))||w.push(A);return w}function dl(u,d){return u<d}function Rh(u,d){var w=-1,A=Ht(u)?oe(u.length):[];return vr(u,function(B,z,j){A[++w]=d(B,z,j)}),A}function Ph(u){var d=Tl(u);return d.length==1&&d[0][2]?hf(d[0][0],d[0][1]):function(w){return w===u||hl(w,u,d)}}function Ih(u,d){return Pl(u)&&uf(d)?hf(Ii(u),d):function(w){var A=Hl(w,u);return A===i&&A===d?Ul(w,u):nn(d,A,y|p)}}function vo(u,d,w,A,B){u!==d&&sl(d,function(z,j){if(B||(B=new bi),st(z))_p(u,d,j,w,vo,A,B);else{var Z=A?A(Ll(u,j),z,j+"",u,d,B):i;Z===i&&(Z=z),nl(u,j,Z)}},Ut)}function _p(u,d,w,A,B,z,j){var Z=Ll(u,w),ie=Ll(d,w),fe=j.get(ie);if(fe){nl(u,w,fe);return}var de=z?z(Z,ie,w+"",u,d,j):i,ve=de===i;if(ve){var me=Re(ie),_e=!me&&pr(ie),Ce=!me&&!_e&&Ea(ie);de=ie,me||_e||Ce?Re(Z)?de=Z:ut(Z)?de=zt(Z):_e?(ve=!1,de=qh(ie,!0)):Ce?(ve=!1,de=jh(ie,!0)):de=[]:un(ie)||Wr(ie)?(de=Z,Wr(Z)?de=Uf(Z):(!st(Z)||Gi(Z))&&(de=cf(ie))):ve=!1}ve&&(j.set(ie,de),B(de,ie,A,z,j),j.delete(ie)),nl(u,w,de)}function Lh(u,d){var w=u.length;if(!!w)return d+=d<0?w:0,Yi(d,w)?u[d]:i}function Dh(u,d,w){d.length?d=rt(d,function(z){return Re(z)?function(j){return zr(j,z.length===1?z[0]:z)}:z}):d=[Wt];var A=-1;d=rt(d,Zt(Ee()));var B=Rh(u,function(z,j,Z){var ie=rt(d,function(fe){return fe(z)});return{criteria:ie,index:++A,value:z}});return Y0(B,function(z,j){return Mp(z,j,w)})}function xp(u,d){return Mh(u,d,function(w,A){return Ul(u,A)})}function Mh(u,d,w){for(var A=-1,B=d.length,z={};++A<B;){var j=d[A],Z=zr(u,j);w(Z,j)&&on(z,yr(j,u),Z)}return z}function Ep(u){return function(d){return zr(d,u)}}function vl(u,d,w,A){var B=A?$0:fa,z=-1,j=d.length,Z=u;for(u===d&&(d=zt(d)),w&&(Z=rt(u,Zt(w)));++z<j;)for(var ie=0,fe=d[z],de=w?w(fe):fe;(ie=B(Z,de,ie,A))>-1;)Z!==u&&ro.call(Z,ie,1),ro.call(u,ie,1);return u}function Bh(u,d){for(var w=u?d.length:0,A=w-1;w--;){var B=d[w];if(w==A||B!==z){var z=B;Yi(B)?ro.call(u,B,1):pl(u,B)}}return u}function gl(u,d){return u+oo(gh()*(d-u+1))}function kp(u,d,w,A){for(var B=-1,z=yt(no((d-u)/(w||1)),0),j=oe(z);z--;)j[A?z:++B]=u,u+=w;return j}function yl(u,d){var w="";if(!u||d<1||d>V)return w;do d%2&&(w+=u),d=oo(d/2),d&&(u+=u);while(d);return w}function De(u,d){return Dl(ff(u,d,Wt),u+"")}function Cp(u){return ph(ka(u))}function Ap(u,d){var w=ka(u);return ko(w,Fr(d,0,w.length))}function on(u,d,w,A){if(!st(u))return u;d=yr(d,u);for(var B=-1,z=d.length,j=z-1,Z=u;Z!=null&&++B<z;){var ie=Ii(d[B]),fe=w;if(ie==="__proto__"||ie==="constructor"||ie==="prototype")return u;if(B!=j){var de=Z[ie];fe=A?A(de,ie,Z):i,fe===i&&(fe=st(de)?de:Yi(d[B+1])?[]:{})}tn(Z,ie,fe),Z=Z[ie]}return u}var Oh=so?function(u,d){return so.set(u,d),u}:Wt,Sp=ao?function(u,d){return ao(u,"toString",{configurable:!0,enumerable:!1,value:ql(d),writable:!0})}:Wt;function Tp(u){return ko(ka(u))}function fi(u,d,w){var A=-1,B=u.length;d<0&&(d=-d>B?0:B+d),w=w>B?B:w,w<0&&(w+=B),B=d>w?0:w-d>>>0,d>>>=0;for(var z=oe(B);++A<B;)z[A]=u[A+d];return z}function Rp(u,d){var w;return vr(u,function(A,B,z){return w=d(A,B,z),!w}),!!w}function go(u,d,w){var A=0,B=u==null?A:u.length;if(typeof d=="number"&&d===d&&B<=J){for(;A<B;){var z=A+B>>>1,j=u[z];j!==null&&!Jt(j)&&(w?j<=d:j<d)?A=z+1:B=z}return B}return ml(u,d,Wt,w)}function ml(u,d,w,A){var B=0,z=u==null?0:u.length;if(z===0)return 0;d=w(d);for(var j=d!==d,Z=d===null,ie=Jt(d),fe=d===i;B<z;){var de=oo((B+z)/2),ve=w(u[de]),me=ve!==i,_e=ve===null,Ce=ve===ve,Le=Jt(ve);if(j)var Ae=A||Ce;else fe?Ae=Ce&&(A||me):Z?Ae=Ce&&me&&(A||!_e):ie?Ae=Ce&&me&&!_e&&(A||!Le):_e||Le?Ae=!1:Ae=A?ve<=d:ve<d;Ae?B=de+1:z=de}return Tt(z,W)}function Nh(u,d){for(var w=-1,A=u.length,B=0,z=[];++w<A;){var j=u[w],Z=d?d(j):j;if(!w||!_i(Z,ie)){var ie=Z;z[B++]=j===0?0:j}}return z}function Fh(u){return typeof u=="number"?u:Jt(u)?q:+u}function Qt(u){if(typeof u=="string")return u;if(Re(u))return rt(u,Qt)+"";if(Jt(u))return yh?yh.call(u):"";var d=u+"";return d=="0"&&1/u==-ae?"-0":d}function gr(u,d,w){var A=-1,B=$n,z=u.length,j=!0,Z=[],ie=Z;if(w)j=!1,B=Vs;else if(z>=r){var fe=d?null:Hp(u);if(fe)return Gn(fe);j=!1,B=Ga,ie=new Nr}else ie=d?[]:Z;e:for(;++A<z;){var de=u[A],ve=d?d(de):de;if(de=w||de!==0?de:0,j&&ve===ve){for(var me=ie.length;me--;)if(ie[me]===ve)continue e;d&&ie.push(ve),Z.push(de)}else B(ie,ve,w)||(ie!==Z&&ie.push(ve),Z.push(de))}return Z}function pl(u,d){return d=yr(d,u),u=df(u,d),u==null||delete u[Ii(di(d))]}function zh(u,d,w,A){return on(u,d,w(zr(u,d)),A)}function yo(u,d,w,A){for(var B=u.length,z=A?B:-1;(A?z--:++z<B)&&d(u[z],z,u););return w?fi(u,A?0:z,A?z+1:B):fi(u,A?z+1:0,A?B:z)}function Hh(u,d){var w=u;return w instanceof Oe&&(w=w.value()),$s(d,function(A,B){return B.func.apply(B.thisArg,hr([A],B.args))},w)}function wl(u,d,w){var A=u.length;if(A<2)return A?gr(u[0]):[];for(var B=-1,z=oe(A);++B<A;)for(var j=u[B],Z=-1;++Z<A;)Z!=B&&(z[B]=rn(z[B]||j,u[Z],d,w));return gr(Ct(z,1),d,w)}function Uh(u,d,w){for(var A=-1,B=u.length,z=d.length,j={};++A<B;){var Z=A<z?d[A]:i;w(j,u[A],Z)}return j}function bl(u){return ut(u)?u:[]}function _l(u){return typeof u=="function"?u:Wt}function yr(u,d){return Re(u)?u:Pl(u,d)?[u]:mf(Ve(u))}var Pp=De;function mr(u,d,w){var A=u.length;return w=w===i?A:w,!d&&w>=A?u:fi(u,d,w)}var Wh=mm||function(u){return kt.clearTimeout(u)};function qh(u,d){if(d)return u.slice();var w=u.length,A=uh?uh(w):new u.constructor(w);return u.copy(A),A}function xl(u){var d=new u.constructor(u.byteLength);return new to(d).set(new to(u)),d}function Ip(u,d){var w=d?xl(u.buffer):u.buffer;return new u.constructor(w,u.byteOffset,u.byteLength)}function Lp(u){var d=new u.constructor(u.source,Au.exec(u));return d.lastIndex=u.lastIndex,d}function Dp(u){return en?Xe(en.call(u)):{}}function jh(u,d){var w=d?xl(u.buffer):u.buffer;return new u.constructor(w,u.byteOffset,u.length)}function Kh(u,d){if(u!==d){var w=u!==i,A=u===null,B=u===u,z=Jt(u),j=d!==i,Z=d===null,ie=d===d,fe=Jt(d);if(!Z&&!fe&&!z&&u>d||z&&j&&ie&&!Z&&!fe||A&&j&&ie||!w&&ie||!B)return 1;if(!A&&!z&&!fe&&u<d||fe&&w&&B&&!A&&!z||Z&&w&&B||!j&&B||!ie)return-1}return 0}function Mp(u,d,w){for(var A=-1,B=u.criteria,z=d.criteria,j=B.length,Z=w.length;++A<j;){var ie=Kh(B[A],z[A]);if(ie){if(A>=Z)return ie;var fe=w[A];return ie*(fe=="desc"?-1:1)}}return u.index-d.index}function Vh(u,d,w,A){for(var B=-1,z=u.length,j=w.length,Z=-1,ie=d.length,fe=yt(z-j,0),de=oe(ie+fe),ve=!A;++Z<ie;)de[Z]=d[Z];for(;++B<j;)(ve||B<z)&&(de[w[B]]=u[B]);for(;fe--;)de[Z++]=u[B++];return de}function $h(u,d,w,A){for(var B=-1,z=u.length,j=-1,Z=w.length,ie=-1,fe=d.length,de=yt(z-Z,0),ve=oe(de+fe),me=!A;++B<de;)ve[B]=u[B];for(var _e=B;++ie<fe;)ve[_e+ie]=d[ie];for(;++j<Z;)(me||B<z)&&(ve[_e+w[j]]=u[B++]);return ve}function zt(u,d){var w=-1,A=u.length;for(d||(d=oe(A));++w<A;)d[w]=u[w];return d}function Pi(u,d,w,A){var B=!w;w||(w={});for(var z=-1,j=d.length;++z<j;){var Z=d[z],ie=A?A(w[Z],u[Z],Z,w,u):i;ie===i&&(ie=u[Z]),B?Ki(w,Z,ie):tn(w,Z,ie)}return w}function Bp(u,d){return Pi(u,Rl(u),d)}function Op(u,d){return Pi(u,sf(u),d)}function mo(u,d){return function(w,A){var B=Re(w)?U0:ap,z=d?d():{};return B(w,u,Ee(A,2),z)}}function ba(u){return De(function(d,w){var A=-1,B=w.length,z=B>1?w[B-1]:i,j=B>2?w[2]:i;for(z=u.length>3&&typeof z=="function"?(B--,z):i,j&&Mt(w[0],w[1],j)&&(z=B<3?i:z,B=1),d=Xe(d);++A<B;){var Z=w[A];Z&&u(d,Z,A,z)}return d})}function Yh(u,d){return function(w,A){if(w==null)return w;if(!Ht(w))return u(w,A);for(var B=w.length,z=d?B:-1,j=Xe(w);(d?z--:++z<B)&&A(j[z],z,j)!==!1;);return w}}function Gh(u){return function(d,w,A){for(var B=-1,z=Xe(d),j=A(d),Z=j.length;Z--;){var ie=j[u?Z:++B];if(w(z[ie],ie,z)===!1)break}return d}}function Np(u,d,w){var A=d&m,B=sn(u);function z(){var j=this&&this!==kt&&this instanceof z?B:u;return j.apply(A?w:this,arguments)}return z}function Xh(u){return function(d){d=Ve(d);var w=da(d)?wi(d):i,A=w?w[0]:d.charAt(0),B=w?mr(w,1).join(""):d.slice(1);return A[u]()+B}}function _a(u){return function(d){return $s(Gf(Yf(d).replace(S0,"")),u,"")}}function sn(u){return function(){var d=arguments;switch(d.length){case 0:return new u;case 1:return new u(d[0]);case 2:return new u(d[0],d[1]);case 3:return new u(d[0],d[1],d[2]);case 4:return new u(d[0],d[1],d[2],d[3]);case 5:return new u(d[0],d[1],d[2],d[3],d[4]);case 6:return new u(d[0],d[1],d[2],d[3],d[4],d[5]);case 7:return new u(d[0],d[1],d[2],d[3],d[4],d[5],d[6])}var w=wa(u.prototype),A=u.apply(w,d);return st(A)?A:w}}function Fp(u,d,w){var A=sn(u);function B(){for(var z=arguments.length,j=oe(z),Z=z,ie=xa(B);Z--;)j[Z]=arguments[Z];var fe=z<3&&j[0]!==ie&&j[z-1]!==ie?[]:fr(j,ie);if(z-=fe.length,z<w)return tf(u,d,po,B.placeholder,i,j,fe,i,i,w-z);var de=this&&this!==kt&&this instanceof B?A:u;return Xt(de,this,j)}return B}function Zh(u){return function(d,w,A){var B=Xe(d);if(!Ht(d)){var z=Ee(w,3);d=pt(d),w=function(Z){return z(B[Z],Z,B)}}var j=u(d,w,A);return j>-1?B[z?d[j]:j]:i}}function Qh(u){return $i(function(d){var w=d.length,A=w,B=ui.prototype.thru;for(u&&d.reverse();A--;){var z=d[A];if(typeof z!="function")throw new ci(o);if(B&&!j&&xo(z)=="wrapper")var j=new ui([],!0)}for(A=j?A:w;++A<w;){z=d[A];var Z=xo(z),ie=Z=="wrapper"?Sl(z):i;ie&&Il(ie[0])&&ie[1]==(M|_|I|L)&&!ie[4].length&&ie[9]==1?j=j[xo(ie[0])].apply(j,ie[3]):j=z.length==1&&Il(z)?j[Z]():j.thru(z)}return function(){var fe=arguments,de=fe[0];if(j&&fe.length==1&&Re(de))return j.plant(de).value();for(var ve=0,me=w?d[ve].apply(this,fe):de;++ve<w;)me=d[ve].call(this,me);return me}})}function po(u,d,w,A,B,z,j,Z,ie,fe){var de=d&M,ve=d&m,me=d&b,_e=d&(_|k),Ce=d&U,Le=me?i:sn(u);function Ae(){for(var Be=arguments.length,Fe=oe(Be),ei=Be;ei--;)Fe[ei]=arguments[ei];if(_e)var Bt=xa(Ae),ti=X0(Fe,Bt);if(A&&(Fe=Vh(Fe,A,B,_e)),z&&(Fe=$h(Fe,z,j,_e)),Be-=ti,_e&&Be<fe){var ht=fr(Fe,Bt);return tf(u,d,po,Ae.placeholder,w,Fe,ht,Z,ie,fe-Be)}var xi=ve?w:this,Zi=me?xi[u]:u;return Be=Fe.length,Z?Fe=aw(Fe,Z):Ce&&Be>1&&Fe.reverse(),de&&ie<Be&&(Fe.length=ie),this&&this!==kt&&this instanceof Ae&&(Zi=Le||sn(Zi)),Zi.apply(xi,Fe)}return Ae}function Jh(u,d){return function(w,A){return fp(w,u,d(A),{})}}function wo(u,d){return function(w,A){var B;if(w===i&&A===i)return d;if(w!==i&&(B=w),A!==i){if(B===i)return A;typeof w=="string"||typeof A=="string"?(w=Qt(w),A=Qt(A)):(w=Fh(w),A=Fh(A)),B=u(w,A)}return B}}function El(u){return $i(function(d){return d=rt(d,Zt(Ee())),De(function(w){var A=this;return u(d,function(B){return Xt(B,A,w)})})})}function bo(u,d){d=d===i?" ":Qt(d);var w=d.length;if(w<2)return w?yl(d,u):d;var A=yl(d,no(u/va(d)));return da(d)?mr(wi(A),0,u).join(""):A.slice(0,u)}function zp(u,d,w,A){var B=d&m,z=sn(u);function j(){for(var Z=-1,ie=arguments.length,fe=-1,de=A.length,ve=oe(de+ie),me=this&&this!==kt&&this instanceof j?z:u;++fe<de;)ve[fe]=A[fe];for(;ie--;)ve[fe++]=arguments[++Z];return Xt(me,B?w:this,ve)}return j}function ef(u){return function(d,w,A){return A&&typeof A!="number"&&Mt(d,w,A)&&(w=A=i),d=Xi(d),w===i?(w=d,d=0):w=Xi(w),A=A===i?d<w?1:-1:Xi(A),kp(d,w,A,u)}}function _o(u){return function(d,w){return typeof d=="string"&&typeof w=="string"||(d=vi(d),w=vi(w)),u(d,w)}}function tf(u,d,w,A,B,z,j,Z,ie,fe){var de=d&_,ve=de?j:i,me=de?i:j,_e=de?z:i,Ce=de?i:z;d|=de?I:P,d&=~(de?P:I),d&x||(d&=~(m|b));var Le=[u,d,B,_e,ve,Ce,me,Z,ie,fe],Ae=w.apply(i,Le);return Il(u)&&vf(Ae,Le),Ae.placeholder=A,gf(Ae,u,d)}function kl(u){var d=gt[u];return function(w,A){if(w=vi(w),A=A==null?0:Tt(Ie(A),292),A&&vh(w)){var B=(Ve(w)+"e").split("e"),z=d(B[0]+"e"+(+B[1]+A));return B=(Ve(z)+"e").split("e"),+(B[0]+"e"+(+B[1]-A))}return d(w)}}var Hp=ma&&1/Gn(new ma([,-0]))[1]==ae?function(u){return new ma(u)}:Vl;function rf(u){return function(d){var w=Rt(d);return w==Q?el(d):w==it?rm(d):G0(d,u(d))}}function Vi(u,d,w,A,B,z,j,Z){var ie=d&b;if(!ie&&typeof u!="function")throw new ci(o);var fe=A?A.length:0;if(fe||(d&=~(I|P),A=B=i),j=j===i?j:yt(Ie(j),0),Z=Z===i?Z:Ie(Z),fe-=B?B.length:0,d&P){var de=A,ve=B;A=B=i}var me=ie?i:Sl(u),_e=[u,d,w,A,B,de,ve,z,j,Z];if(me&&tw(_e,me),u=_e[0],d=_e[1],w=_e[2],A=_e[3],B=_e[4],Z=_e[9]=_e[9]===i?ie?0:u.length:yt(_e[9]-fe,0),!Z&&d&(_|k)&&(d&=~(_|k)),!d||d==m)var Ce=Np(u,d,w);else d==_||d==k?Ce=Fp(u,d,Z):(d==I||d==(m|I))&&!B.length?Ce=zp(u,d,w,A):Ce=po.apply(i,_e);var Le=me?Oh:vf;return gf(Le(Ce,_e),u,d)}function af(u,d,w,A){return u===i||_i(u,ya[w])&&!$e.call(A,w)?d:u}function nf(u,d,w,A,B,z){return st(u)&&st(d)&&(z.set(d,u),vo(u,d,i,nf,z),z.delete(d)),u}function Up(u){return un(u)?i:u}function of(u,d,w,A,B,z){var j=w&y,Z=u.length,ie=d.length;if(Z!=ie&&!(j&&ie>Z))return!1;var fe=z.get(u),de=z.get(d);if(fe&&de)return fe==d&&de==u;var ve=-1,me=!0,_e=w&p?new Nr:i;for(z.set(u,d),z.set(d,u);++ve<Z;){var Ce=u[ve],Le=d[ve];if(A)var Ae=j?A(Le,Ce,ve,d,u,z):A(Ce,Le,ve,u,d,z);if(Ae!==i){if(Ae)continue;me=!1;break}if(_e){if(!Ys(d,function(Be,Fe){if(!Ga(_e,Fe)&&(Ce===Be||B(Ce,Be,w,A,z)))return _e.push(Fe)})){me=!1;break}}else if(!(Ce===Le||B(Ce,Le,w,A,z))){me=!1;break}}return z.delete(u),z.delete(d),me}function Wp(u,d,w,A,B,z,j){switch(w){case ua:if(u.byteLength!=d.byteLength||u.byteOffset!=d.byteOffset)return!1;u=u.buffer,d=d.buffer;case Ya:return!(u.byteLength!=d.byteLength||!z(new to(u),new to(d)));case se:case E:case ne:return _i(+u,+d);case D:return u.name==d.name&&u.message==d.message;case xt:case Et:return u==d+"";case Q:var Z=el;case it:var ie=A&y;if(Z||(Z=Gn),u.size!=d.size&&!ie)return!1;var fe=j.get(u);if(fe)return fe==d;A|=p,j.set(u,d);var de=of(Z(u),Z(d),A,B,z,j);return j.delete(u),de;case qe:if(en)return en.call(u)==en.call(d)}return!1}function qp(u,d,w,A,B,z){var j=w&y,Z=Cl(u),ie=Z.length,fe=Cl(d),de=fe.length;if(ie!=de&&!j)return!1;for(var ve=ie;ve--;){var me=Z[ve];if(!(j?me in d:$e.call(d,me)))return!1}var _e=z.get(u),Ce=z.get(d);if(_e&&Ce)return _e==d&&Ce==u;var Le=!0;z.set(u,d),z.set(d,u);for(var Ae=j;++ve<ie;){me=Z[ve];var Be=u[me],Fe=d[me];if(A)var ei=j?A(Fe,Be,me,d,u,z):A(Be,Fe,me,u,d,z);if(!(ei===i?Be===Fe||B(Be,Fe,w,A,z):ei)){Le=!1;break}Ae||(Ae=me=="constructor")}if(Le&&!Ae){var Bt=u.constructor,ti=d.constructor;Bt!=ti&&"constructor"in u&&"constructor"in d&&!(typeof Bt=="function"&&Bt instanceof Bt&&typeof ti=="function"&&ti instanceof ti)&&(Le=!1)}return z.delete(u),z.delete(d),Le}function $i(u){return Dl(ff(u,i,_f),u+"")}function Cl(u){return Ch(u,pt,Rl)}function Al(u){return Ch(u,Ut,sf)}var Sl=so?function(u){return so.get(u)}:Vl;function xo(u){for(var d=u.name+"",w=pa[d],A=$e.call(pa,d)?w.length:0;A--;){var B=w[A],z=B.func;if(z==null||z==u)return B.name}return d}function xa(u){var d=$e.call(N,"placeholder")?N:u;return d.placeholder}function Ee(){var u=N.iteratee||jl;return u=u===jl?Th:u,arguments.length?u(arguments[0],arguments[1]):u}function Eo(u,d){var w=u.__data__;return Zp(d)?w[typeof d=="string"?"string":"hash"]:w.map}function Tl(u){for(var d=pt(u),w=d.length;w--;){var A=d[w],B=u[A];d[w]=[A,B,uf(B)]}return d}function Hr(u,d){var w=em(u,d);return Sh(w)?w:i}function jp(u){var d=$e.call(u,Br),w=u[Br];try{u[Br]=i;var A=!0}catch{}var B=Jn.call(u);return A&&(d?u[Br]=w:delete u[Br]),B}var Rl=il?function(u){return u==null?[]:(u=Xe(u),ur(il(u),function(d){return fh.call(u,d)}))}:$l,sf=il?function(u){for(var d=[];u;)hr(d,Rl(u)),u=io(u);return d}:$l,Rt=Dt;(rl&&Rt(new rl(new ArrayBuffer(1)))!=ua||Za&&Rt(new Za)!=Q||al&&Rt(al.resolve())!=xe||ma&&Rt(new ma)!=it||Qa&&Rt(new Qa)!=Ti)&&(Rt=function(u){var d=Dt(u),w=d==ge?u.constructor:i,A=w?Ur(w):"";if(A)switch(A){case Am:return ua;case Sm:return Q;case Tm:return xe;case Rm:return it;case Pm:return Ti}return d});function Kp(u,d,w){for(var A=-1,B=w.length;++A<B;){var z=w[A],j=z.size;switch(z.type){case"drop":u+=j;break;case"dropRight":d-=j;break;case"take":d=Tt(d,u+j);break;case"takeRight":u=yt(u,d-j);break}}return{start:u,end:d}}function Vp(u){var d=u.match(Qy);return d?d[1].split(Jy):[]}function lf(u,d,w){d=yr(d,u);for(var A=-1,B=d.length,z=!1;++A<B;){var j=Ii(d[A]);if(!(z=u!=null&&w(u,j)))break;u=u[j]}return z||++A!=B?z:(B=u==null?0:u.length,!!B&&Po(B)&&Yi(j,B)&&(Re(u)||Wr(u)))}function $p(u){var d=u.length,w=new u.constructor(d);return d&&typeof u[0]=="string"&&$e.call(u,"index")&&(w.index=u.index,w.input=u.input),w}function cf(u){return typeof u.constructor=="function"&&!ln(u)?wa(io(u)):{}}function Yp(u,d,w){var A=u.constructor;switch(d){case Ya:return xl(u);case se:case E:return new A(+u);case ua:return Ip(u,w);case Ts:case Rs:case Ps:case Is:case Ls:case Ds:case Ms:case Bs:case Os:return jh(u,w);case Q:return new A;case ne:case Et:return new A(u);case xt:return Lp(u);case it:return new A;case qe:return Dp(u)}}function Gp(u,d){var w=d.length;if(!w)return u;var A=w-1;return d[A]=(w>1?"& ":"")+d[A],d=d.join(w>2?", ":" "),u.replace(Zy,`{
- /* [wrapped with `+d+`] */
- `)}function Xp(u){return Re(u)||Wr(u)||!!(dh&&u&&u[dh])}function Yi(u,d){var w=typeof u;return d=d==null?V:d,!!d&&(w=="number"||w!="symbol"&&l0.test(u))&&u>-1&&u%1==0&&u<d}function Mt(u,d,w){if(!st(w))return!1;var A=typeof d;return(A=="number"?Ht(w)&&Yi(d,w.length):A=="string"&&d in w)?_i(w[d],u):!1}function Pl(u,d){if(Re(u))return!1;var w=typeof u;return w=="number"||w=="symbol"||w=="boolean"||u==null||Jt(u)?!0:$y.test(u)||!Vy.test(u)||d!=null&&u in Xe(d)}function Zp(u){var d=typeof u;return d=="string"||d=="number"||d=="symbol"||d=="boolean"?u!=="__proto__":u===null}function Il(u){var d=xo(u),w=N[d];if(typeof w!="function"||!(d in Oe.prototype))return!1;if(u===w)return!0;var A=Sl(w);return!!A&&u===A[0]}function Qp(u){return!!ch&&ch in u}var Jp=Zn?Gi:Yl;function ln(u){var d=u&&u.constructor,w=typeof d=="function"&&d.prototype||ya;return u===w}function uf(u){return u===u&&!st(u)}function hf(u,d){return function(w){return w==null?!1:w[u]===d&&(d!==i||u in Xe(w))}}function ew(u){var d=To(u,function(A){return w.size===l&&w.clear(),A}),w=d.cache;return d}function tw(u,d){var w=u[1],A=d[1],B=w|A,z=B<(m|b|M),j=A==M&&w==_||A==M&&w==L&&u[7].length<=d[8]||A==(M|L)&&d[7].length<=d[8]&&w==_;if(!(z||j))return u;A&m&&(u[2]=d[2],B|=w&m?0:x);var Z=d[3];if(Z){var ie=u[3];u[3]=ie?Vh(ie,Z,d[4]):Z,u[4]=ie?fr(u[3],c):d[4]}return Z=d[5],Z&&(ie=u[5],u[5]=ie?$h(ie,Z,d[6]):Z,u[6]=ie?fr(u[5],c):d[6]),Z=d[7],Z&&(u[7]=Z),A&M&&(u[8]=u[8]==null?d[8]:Tt(u[8],d[8])),u[9]==null&&(u[9]=d[9]),u[0]=d[0],u[1]=B,u}function iw(u){var d=[];if(u!=null)for(var w in Xe(u))d.push(w);return d}function rw(u){return Jn.call(u)}function ff(u,d,w){return d=yt(d===i?u.length-1:d,0),function(){for(var A=arguments,B=-1,z=yt(A.length-d,0),j=oe(z);++B<z;)j[B]=A[d+B];B=-1;for(var Z=oe(d+1);++B<d;)Z[B]=A[B];return Z[d]=w(j),Xt(u,this,Z)}}function df(u,d){return d.length<2?u:zr(u,fi(d,0,-1))}function aw(u,d){for(var w=u.length,A=Tt(d.length,w),B=zt(u);A--;){var z=d[A];u[A]=Yi(z,w)?B[z]:i}return u}function Ll(u,d){if(!(d==="constructor"&&typeof u[d]=="function")&&d!="__proto__")return u[d]}var vf=yf(Oh),cn=wm||function(u,d){return kt.setTimeout(u,d)},Dl=yf(Sp);function gf(u,d,w){var A=d+"";return Dl(u,Gp(A,nw(Vp(A),w)))}function yf(u){var d=0,w=0;return function(){var A=Em(),B=R-(A-w);if(w=A,B>0){if(++d>=T)return arguments[0]}else d=0;return u.apply(i,arguments)}}function ko(u,d){var w=-1,A=u.length,B=A-1;for(d=d===i?A:d;++w<d;){var z=gl(w,B),j=u[z];u[z]=u[w],u[w]=j}return u.length=d,u}var mf=ew(function(u){var d=[];return u.charCodeAt(0)===46&&d.push(""),u.replace(Yy,function(w,A,B,z){d.push(B?z.replace(i0,"$1"):A||w)}),d});function Ii(u){if(typeof u=="string"||Jt(u))return u;var d=u+"";return d=="0"&&1/u==-ae?"-0":d}function Ur(u){if(u!=null){try{return Qn.call(u)}catch{}try{return u+""}catch{}}return""}function nw(u,d){return li(re,function(w){var A="_."+w[0];d&w[1]&&!$n(u,A)&&u.push(A)}),u.sort()}function pf(u){if(u instanceof Oe)return u.clone();var d=new ui(u.__wrapped__,u.__chain__);return d.__actions__=zt(u.__actions__),d.__index__=u.__index__,d.__values__=u.__values__,d}function ow(u,d,w){(w?Mt(u,d,w):d===i)?d=1:d=yt(Ie(d),0);var A=u==null?0:u.length;if(!A||d<1)return[];for(var B=0,z=0,j=oe(no(A/d));B<A;)j[z++]=fi(u,B,B+=d);return j}function sw(u){for(var d=-1,w=u==null?0:u.length,A=0,B=[];++d<w;){var z=u[d];z&&(B[A++]=z)}return B}function lw(){var u=arguments.length;if(!u)return[];for(var d=oe(u-1),w=arguments[0],A=u;A--;)d[A-1]=arguments[A];return hr(Re(w)?zt(w):[w],Ct(d,1))}var cw=De(function(u,d){return ut(u)?rn(u,Ct(d,1,ut,!0)):[]}),uw=De(function(u,d){var w=di(d);return ut(w)&&(w=i),ut(u)?rn(u,Ct(d,1,ut,!0),Ee(w,2)):[]}),hw=De(function(u,d){var w=di(d);return ut(w)&&(w=i),ut(u)?rn(u,Ct(d,1,ut,!0),i,w):[]});function fw(u,d,w){var A=u==null?0:u.length;return A?(d=w||d===i?1:Ie(d),fi(u,d<0?0:d,A)):[]}function dw(u,d,w){var A=u==null?0:u.length;return A?(d=w||d===i?1:Ie(d),d=A-d,fi(u,0,d<0?0:d)):[]}function vw(u,d){return u&&u.length?yo(u,Ee(d,3),!0,!0):[]}function gw(u,d){return u&&u.length?yo(u,Ee(d,3),!0):[]}function yw(u,d,w,A){var B=u==null?0:u.length;return B?(w&&typeof w!="number"&&Mt(u,d,w)&&(w=0,A=B),lp(u,d,w,A)):[]}function wf(u,d,w){var A=u==null?0:u.length;if(!A)return-1;var B=w==null?0:Ie(w);return B<0&&(B=yt(A+B,0)),Yn(u,Ee(d,3),B)}function bf(u,d,w){var A=u==null?0:u.length;if(!A)return-1;var B=A-1;return w!==i&&(B=Ie(w),B=w<0?yt(A+B,0):Tt(B,A-1)),Yn(u,Ee(d,3),B,!0)}function _f(u){var d=u==null?0:u.length;return d?Ct(u,1):[]}function mw(u){var d=u==null?0:u.length;return d?Ct(u,ae):[]}function pw(u,d){var w=u==null?0:u.length;return w?(d=d===i?1:Ie(d),Ct(u,d)):[]}function ww(u){for(var d=-1,w=u==null?0:u.length,A={};++d<w;){var B=u[d];A[B[0]]=B[1]}return A}function xf(u){return u&&u.length?u[0]:i}function bw(u,d,w){var A=u==null?0:u.length;if(!A)return-1;var B=w==null?0:Ie(w);return B<0&&(B=yt(A+B,0)),fa(u,d,B)}function _w(u){var d=u==null?0:u.length;return d?fi(u,0,-1):[]}var xw=De(function(u){var d=rt(u,bl);return d.length&&d[0]===u[0]?ul(d):[]}),Ew=De(function(u){var d=di(u),w=rt(u,bl);return d===di(w)?d=i:w.pop(),w.length&&w[0]===u[0]?ul(w,Ee(d,2)):[]}),kw=De(function(u){var d=di(u),w=rt(u,bl);return d=typeof d=="function"?d:i,d&&w.pop(),w.length&&w[0]===u[0]?ul(w,i,d):[]});function Cw(u,d){return u==null?"":_m.call(u,d)}function di(u){var d=u==null?0:u.length;return d?u[d-1]:i}function Aw(u,d,w){var A=u==null?0:u.length;if(!A)return-1;var B=A;return w!==i&&(B=Ie(w),B=B<0?yt(A+B,0):Tt(B,A-1)),d===d?nm(u,d,B):Yn(u,th,B,!0)}function Sw(u,d){return u&&u.length?Lh(u,Ie(d)):i}var Tw=De(Ef);function Ef(u,d){return u&&u.length&&d&&d.length?vl(u,d):u}function Rw(u,d,w){return u&&u.length&&d&&d.length?vl(u,d,Ee(w,2)):u}function Pw(u,d,w){return u&&u.length&&d&&d.length?vl(u,d,i,w):u}var Iw=$i(function(u,d){var w=u==null?0:u.length,A=ol(u,d);return Bh(u,rt(d,function(B){return Yi(B,w)?+B:B}).sort(Kh)),A});function Lw(u,d){var w=[];if(!(u&&u.length))return w;var A=-1,B=[],z=u.length;for(d=Ee(d,3);++A<z;){var j=u[A];d(j,A,u)&&(w.push(j),B.push(A))}return Bh(u,B),w}function Ml(u){return u==null?u:Cm.call(u)}function Dw(u,d,w){var A=u==null?0:u.length;return A?(w&&typeof w!="number"&&Mt(u,d,w)?(d=0,w=A):(d=d==null?0:Ie(d),w=w===i?A:Ie(w)),fi(u,d,w)):[]}function Mw(u,d){return go(u,d)}function Bw(u,d,w){return ml(u,d,Ee(w,2))}function Ow(u,d){var w=u==null?0:u.length;if(w){var A=go(u,d);if(A<w&&_i(u[A],d))return A}return-1}function Nw(u,d){return go(u,d,!0)}function Fw(u,d,w){return ml(u,d,Ee(w,2),!0)}function zw(u,d){var w=u==null?0:u.length;if(w){var A=go(u,d,!0)-1;if(_i(u[A],d))return A}return-1}function Hw(u){return u&&u.length?Nh(u):[]}function Uw(u,d){return u&&u.length?Nh(u,Ee(d,2)):[]}function Ww(u){var d=u==null?0:u.length;return d?fi(u,1,d):[]}function qw(u,d,w){return u&&u.length?(d=w||d===i?1:Ie(d),fi(u,0,d<0?0:d)):[]}function jw(u,d,w){var A=u==null?0:u.length;return A?(d=w||d===i?1:Ie(d),d=A-d,fi(u,d<0?0:d,A)):[]}function Kw(u,d){return u&&u.length?yo(u,Ee(d,3),!1,!0):[]}function Vw(u,d){return u&&u.length?yo(u,Ee(d,3)):[]}var $w=De(function(u){return gr(Ct(u,1,ut,!0))}),Yw=De(function(u){var d=di(u);return ut(d)&&(d=i),gr(Ct(u,1,ut,!0),Ee(d,2))}),Gw=De(function(u){var d=di(u);return d=typeof d=="function"?d:i,gr(Ct(u,1,ut,!0),i,d)});function Xw(u){return u&&u.length?gr(u):[]}function Zw(u,d){return u&&u.length?gr(u,Ee(d,2)):[]}function Qw(u,d){return d=typeof d=="function"?d:i,u&&u.length?gr(u,i,d):[]}function Bl(u){if(!(u&&u.length))return[];var d=0;return u=ur(u,function(w){if(ut(w))return d=yt(w.length,d),!0}),Qs(d,function(w){return rt(u,Gs(w))})}function kf(u,d){if(!(u&&u.length))return[];var w=Bl(u);return d==null?w:rt(w,function(A){return Xt(d,i,A)})}var Jw=De(function(u,d){return ut(u)?rn(u,d):[]}),eb=De(function(u){return wl(ur(u,ut))}),tb=De(function(u){var d=di(u);return ut(d)&&(d=i),wl(ur(u,ut),Ee(d,2))}),ib=De(function(u){var d=di(u);return d=typeof d=="function"?d:i,wl(ur(u,ut),i,d)}),rb=De(Bl);function ab(u,d){return Uh(u||[],d||[],tn)}function nb(u,d){return Uh(u||[],d||[],on)}var ob=De(function(u){var d=u.length,w=d>1?u[d-1]:i;return w=typeof w=="function"?(u.pop(),w):i,kf(u,w)});function Cf(u){var d=N(u);return d.__chain__=!0,d}function sb(u,d){return d(u),u}function Co(u,d){return d(u)}var lb=$i(function(u){var d=u.length,w=d?u[0]:0,A=this.__wrapped__,B=function(z){return ol(z,u)};return d>1||this.__actions__.length||!(A instanceof Oe)||!Yi(w)?this.thru(B):(A=A.slice(w,+w+(d?1:0)),A.__actions__.push({func:Co,args:[B],thisArg:i}),new ui(A,this.__chain__).thru(function(z){return d&&!z.length&&z.push(i),z}))});function cb(){return Cf(this)}function ub(){return new ui(this.value(),this.__chain__)}function hb(){this.__values__===i&&(this.__values__=zf(this.value()));var u=this.__index__>=this.__values__.length,d=u?i:this.__values__[this.__index__++];return{done:u,value:d}}function fb(){return this}function db(u){for(var d,w=this;w instanceof co;){var A=pf(w);A.__index__=0,A.__values__=i,d?B.__wrapped__=A:d=A;var B=A;w=w.__wrapped__}return B.__wrapped__=u,d}function vb(){var u=this.__wrapped__;if(u instanceof Oe){var d=u;return this.__actions__.length&&(d=new Oe(this)),d=d.reverse(),d.__actions__.push({func:Co,args:[Ml],thisArg:i}),new ui(d,this.__chain__)}return this.thru(Ml)}function gb(){return Hh(this.__wrapped__,this.__actions__)}var yb=mo(function(u,d,w){$e.call(u,w)?++u[w]:Ki(u,w,1)});function mb(u,d,w){var A=Re(u)?Ju:sp;return w&&Mt(u,d,w)&&(d=i),A(u,Ee(d,3))}function pb(u,d){var w=Re(u)?ur:Eh;return w(u,Ee(d,3))}var wb=Zh(wf),bb=Zh(bf);function _b(u,d){return Ct(Ao(u,d),1)}function xb(u,d){return Ct(Ao(u,d),ae)}function Eb(u,d,w){return w=w===i?1:Ie(w),Ct(Ao(u,d),w)}function Af(u,d){var w=Re(u)?li:vr;return w(u,Ee(d,3))}function Sf(u,d){var w=Re(u)?W0:xh;return w(u,Ee(d,3))}var kb=mo(function(u,d,w){$e.call(u,w)?u[w].push(d):Ki(u,w,[d])});function Cb(u,d,w,A){u=Ht(u)?u:ka(u),w=w&&!A?Ie(w):0;var B=u.length;return w<0&&(w=yt(B+w,0)),Io(u)?w<=B&&u.indexOf(d,w)>-1:!!B&&fa(u,d,w)>-1}var Ab=De(function(u,d,w){var A=-1,B=typeof d=="function",z=Ht(u)?oe(u.length):[];return vr(u,function(j){z[++A]=B?Xt(d,j,w):an(j,d,w)}),z}),Sb=mo(function(u,d,w){Ki(u,w,d)});function Ao(u,d){var w=Re(u)?rt:Rh;return w(u,Ee(d,3))}function Tb(u,d,w,A){return u==null?[]:(Re(d)||(d=d==null?[]:[d]),w=A?i:w,Re(w)||(w=w==null?[]:[w]),Dh(u,d,w))}var Rb=mo(function(u,d,w){u[w?0:1].push(d)},function(){return[[],[]]});function Pb(u,d,w){var A=Re(u)?$s:rh,B=arguments.length<3;return A(u,Ee(d,4),w,B,vr)}function Ib(u,d,w){var A=Re(u)?q0:rh,B=arguments.length<3;return A(u,Ee(d,4),w,B,xh)}function Lb(u,d){var w=Re(u)?ur:Eh;return w(u,Ro(Ee(d,3)))}function Db(u){var d=Re(u)?ph:Cp;return d(u)}function Mb(u,d,w){(w?Mt(u,d,w):d===i)?d=1:d=Ie(d);var A=Re(u)?ip:Ap;return A(u,d)}function Bb(u){var d=Re(u)?rp:Tp;return d(u)}function Ob(u){if(u==null)return 0;if(Ht(u))return Io(u)?va(u):u.length;var d=Rt(u);return d==Q||d==it?u.size:fl(u).length}function Nb(u,d,w){var A=Re(u)?Ys:Rp;return w&&Mt(u,d,w)&&(d=i),A(u,Ee(d,3))}var Fb=De(function(u,d){if(u==null)return[];var w=d.length;return w>1&&Mt(u,d[0],d[1])?d=[]:w>2&&Mt(d[0],d[1],d[2])&&(d=[d[0]]),Dh(u,Ct(d,1),[])}),So=pm||function(){return kt.Date.now()};function zb(u,d){if(typeof d!="function")throw new ci(o);return u=Ie(u),function(){if(--u<1)return d.apply(this,arguments)}}function Tf(u,d,w){return d=w?i:d,d=u&&d==null?u.length:d,Vi(u,M,i,i,i,i,d)}function Rf(u,d){var w;if(typeof d!="function")throw new ci(o);return u=Ie(u),function(){return--u>0&&(w=d.apply(this,arguments)),u<=1&&(d=i),w}}var Ol=De(function(u,d,w){var A=m;if(w.length){var B=fr(w,xa(Ol));A|=I}return Vi(u,A,d,w,B)}),Pf=De(function(u,d,w){var A=m|b;if(w.length){var B=fr(w,xa(Pf));A|=I}return Vi(d,A,u,w,B)});function If(u,d,w){d=w?i:d;var A=Vi(u,_,i,i,i,i,i,d);return A.placeholder=If.placeholder,A}function Lf(u,d,w){d=w?i:d;var A=Vi(u,k,i,i,i,i,i,d);return A.placeholder=Lf.placeholder,A}function Df(u,d,w){var A,B,z,j,Z,ie,fe=0,de=!1,ve=!1,me=!0;if(typeof u!="function")throw new ci(o);d=vi(d)||0,st(w)&&(de=!!w.leading,ve="maxWait"in w,z=ve?yt(vi(w.maxWait)||0,d):z,me="trailing"in w?!!w.trailing:me);function _e(ht){var xi=A,Zi=B;return A=B=i,fe=ht,j=u.apply(Zi,xi),j}function Ce(ht){return fe=ht,Z=cn(Be,d),de?_e(ht):j}function Le(ht){var xi=ht-ie,Zi=ht-fe,Qf=d-xi;return ve?Tt(Qf,z-Zi):Qf}function Ae(ht){var xi=ht-ie,Zi=ht-fe;return ie===i||xi>=d||xi<0||ve&&Zi>=z}function Be(){var ht=So();if(Ae(ht))return Fe(ht);Z=cn(Be,Le(ht))}function Fe(ht){return Z=i,me&&A?_e(ht):(A=B=i,j)}function ei(){Z!==i&&Wh(Z),fe=0,A=ie=B=Z=i}function Bt(){return Z===i?j:Fe(So())}function ti(){var ht=So(),xi=Ae(ht);if(A=arguments,B=this,ie=ht,xi){if(Z===i)return Ce(ie);if(ve)return Wh(Z),Z=cn(Be,d),_e(ie)}return Z===i&&(Z=cn(Be,d)),j}return ti.cancel=ei,ti.flush=Bt,ti}var Hb=De(function(u,d){return _h(u,1,d)}),Ub=De(function(u,d,w){return _h(u,vi(d)||0,w)});function Wb(u){return Vi(u,U)}function To(u,d){if(typeof u!="function"||d!=null&&typeof d!="function")throw new ci(o);var w=function(){var A=arguments,B=d?d.apply(this,A):A[0],z=w.cache;if(z.has(B))return z.get(B);var j=u.apply(this,A);return w.cache=z.set(B,j)||z,j};return w.cache=new(To.Cache||ji),w}To.Cache=ji;function Ro(u){if(typeof u!="function")throw new ci(o);return function(){var d=arguments;switch(d.length){case 0:return!u.call(this);case 1:return!u.call(this,d[0]);case 2:return!u.call(this,d[0],d[1]);case 3:return!u.call(this,d[0],d[1],d[2])}return!u.apply(this,d)}}function qb(u){return Rf(2,u)}var jb=Pp(function(u,d){d=d.length==1&&Re(d[0])?rt(d[0],Zt(Ee())):rt(Ct(d,1),Zt(Ee()));var w=d.length;return De(function(A){for(var B=-1,z=Tt(A.length,w);++B<z;)A[B]=d[B].call(this,A[B]);return Xt(u,this,A)})}),Nl=De(function(u,d){var w=fr(d,xa(Nl));return Vi(u,I,i,d,w)}),Mf=De(function(u,d){var w=fr(d,xa(Mf));return Vi(u,P,i,d,w)}),Kb=$i(function(u,d){return Vi(u,L,i,i,i,d)});function Vb(u,d){if(typeof u!="function")throw new ci(o);return d=d===i?d:Ie(d),De(u,d)}function $b(u,d){if(typeof u!="function")throw new ci(o);return d=d==null?0:yt(Ie(d),0),De(function(w){var A=w[d],B=mr(w,0,d);return A&&hr(B,A),Xt(u,this,B)})}function Yb(u,d,w){var A=!0,B=!0;if(typeof u!="function")throw new ci(o);return st(w)&&(A="leading"in w?!!w.leading:A,B="trailing"in w?!!w.trailing:B),Df(u,d,{leading:A,maxWait:d,trailing:B})}function Gb(u){return Tf(u,1)}function Xb(u,d){return Nl(_l(d),u)}function Zb(){if(!arguments.length)return[];var u=arguments[0];return Re(u)?u:[u]}function Qb(u){return hi(u,g)}function Jb(u,d){return d=typeof d=="function"?d:i,hi(u,g,d)}function e1(u){return hi(u,f|g)}function t1(u,d){return d=typeof d=="function"?d:i,hi(u,f|g,d)}function i1(u,d){return d==null||bh(u,d,pt(d))}function _i(u,d){return u===d||u!==u&&d!==d}var r1=_o(cl),a1=_o(function(u,d){return u>=d}),Wr=Ah(function(){return arguments}())?Ah:function(u){return ct(u)&&$e.call(u,"callee")&&!fh.call(u,"callee")},Re=oe.isArray,n1=$u?Zt($u):dp;function Ht(u){return u!=null&&Po(u.length)&&!Gi(u)}function ut(u){return ct(u)&&Ht(u)}function o1(u){return u===!0||u===!1||ct(u)&&Dt(u)==se}var pr=bm||Yl,s1=Yu?Zt(Yu):vp;function l1(u){return ct(u)&&u.nodeType===1&&!un(u)}function c1(u){if(u==null)return!0;if(Ht(u)&&(Re(u)||typeof u=="string"||typeof u.splice=="function"||pr(u)||Ea(u)||Wr(u)))return!u.length;var d=Rt(u);if(d==Q||d==it)return!u.size;if(ln(u))return!fl(u).length;for(var w in u)if($e.call(u,w))return!1;return!0}function u1(u,d){return nn(u,d)}function h1(u,d,w){w=typeof w=="function"?w:i;var A=w?w(u,d):i;return A===i?nn(u,d,i,w):!!A}function Fl(u){if(!ct(u))return!1;var d=Dt(u);return d==D||d==C||typeof u.message=="string"&&typeof u.name=="string"&&!un(u)}function f1(u){return typeof u=="number"&&vh(u)}function Gi(u){if(!st(u))return!1;var d=Dt(u);return d==H||d==X||d==le||d==Se}function Bf(u){return typeof u=="number"&&u==Ie(u)}function Po(u){return typeof u=="number"&&u>-1&&u%1==0&&u<=V}function st(u){var d=typeof u;return u!=null&&(d=="object"||d=="function")}function ct(u){return u!=null&&typeof u=="object"}var Of=Gu?Zt(Gu):yp;function d1(u,d){return u===d||hl(u,d,Tl(d))}function v1(u,d,w){return w=typeof w=="function"?w:i,hl(u,d,Tl(d),w)}function g1(u){return Nf(u)&&u!=+u}function y1(u){if(Jp(u))throw new Te(n);return Sh(u)}function m1(u){return u===null}function p1(u){return u==null}function Nf(u){return typeof u=="number"||ct(u)&&Dt(u)==ne}function un(u){if(!ct(u)||Dt(u)!=ge)return!1;var d=io(u);if(d===null)return!0;var w=$e.call(d,"constructor")&&d.constructor;return typeof w=="function"&&w instanceof w&&Qn.call(w)==vm}var zl=Xu?Zt(Xu):mp;function w1(u){return Bf(u)&&u>=-V&&u<=V}var Ff=Zu?Zt(Zu):pp;function Io(u){return typeof u=="string"||!Re(u)&&ct(u)&&Dt(u)==Et}function Jt(u){return typeof u=="symbol"||ct(u)&&Dt(u)==qe}var Ea=Qu?Zt(Qu):wp;function b1(u){return u===i}function _1(u){return ct(u)&&Rt(u)==Ti}function x1(u){return ct(u)&&Dt(u)==Fy}var E1=_o(dl),k1=_o(function(u,d){return u<=d});function zf(u){if(!u)return[];if(Ht(u))return Io(u)?wi(u):zt(u);if(Xa&&u[Xa])return im(u[Xa]());var d=Rt(u),w=d==Q?el:d==it?Gn:ka;return w(u)}function Xi(u){if(!u)return u===0?u:0;if(u=vi(u),u===ae||u===-ae){var d=u<0?-1:1;return d*F}return u===u?u:0}function Ie(u){var d=Xi(u),w=d%1;return d===d?w?d-w:d:0}function Hf(u){return u?Fr(Ie(u),0,Y):0}function vi(u){if(typeof u=="number")return u;if(Jt(u))return q;if(st(u)){var d=typeof u.valueOf=="function"?u.valueOf():u;u=st(d)?d+"":d}if(typeof u!="string")return u===0?u:+u;u=ah(u);var w=n0.test(u);return w||s0.test(u)?z0(u.slice(2),w?2:8):a0.test(u)?q:+u}function Uf(u){return Pi(u,Ut(u))}function C1(u){return u?Fr(Ie(u),-V,V):u===0?u:0}function Ve(u){return u==null?"":Qt(u)}var A1=ba(function(u,d){if(ln(d)||Ht(d)){Pi(d,pt(d),u);return}for(var w in d)$e.call(d,w)&&tn(u,w,d[w])}),Wf=ba(function(u,d){Pi(d,Ut(d),u)}),Lo=ba(function(u,d,w,A){Pi(d,Ut(d),u,A)}),S1=ba(function(u,d,w,A){Pi(d,pt(d),u,A)}),T1=$i(ol);function R1(u,d){var w=wa(u);return d==null?w:wh(w,d)}var P1=De(function(u,d){u=Xe(u);var w=-1,A=d.length,B=A>2?d[2]:i;for(B&&Mt(d[0],d[1],B)&&(A=1);++w<A;)for(var z=d[w],j=Ut(z),Z=-1,ie=j.length;++Z<ie;){var fe=j[Z],de=u[fe];(de===i||_i(de,ya[fe])&&!$e.call(u,fe))&&(u[fe]=z[fe])}return u}),I1=De(function(u){return u.push(i,nf),Xt(qf,i,u)});function L1(u,d){return eh(u,Ee(d,3),Ri)}function D1(u,d){return eh(u,Ee(d,3),ll)}function M1(u,d){return u==null?u:sl(u,Ee(d,3),Ut)}function B1(u,d){return u==null?u:kh(u,Ee(d,3),Ut)}function O1(u,d){return u&&Ri(u,Ee(d,3))}function N1(u,d){return u&&ll(u,Ee(d,3))}function F1(u){return u==null?[]:fo(u,pt(u))}function z1(u){return u==null?[]:fo(u,Ut(u))}function Hl(u,d,w){var A=u==null?i:zr(u,d);return A===i?w:A}function H1(u,d){return u!=null&&lf(u,d,cp)}function Ul(u,d){return u!=null&&lf(u,d,up)}var U1=Jh(function(u,d,w){d!=null&&typeof d.toString!="function"&&(d=Jn.call(d)),u[d]=w},ql(Wt)),W1=Jh(function(u,d,w){d!=null&&typeof d.toString!="function"&&(d=Jn.call(d)),$e.call(u,d)?u[d].push(w):u[d]=[w]},Ee),q1=De(an);function pt(u){return Ht(u)?mh(u):fl(u)}function Ut(u){return Ht(u)?mh(u,!0):bp(u)}function j1(u,d){var w={};return d=Ee(d,3),Ri(u,function(A,B,z){Ki(w,d(A,B,z),A)}),w}function K1(u,d){var w={};return d=Ee(d,3),Ri(u,function(A,B,z){Ki(w,B,d(A,B,z))}),w}var V1=ba(function(u,d,w){vo(u,d,w)}),qf=ba(function(u,d,w,A){vo(u,d,w,A)}),$1=$i(function(u,d){var w={};if(u==null)return w;var A=!1;d=rt(d,function(z){return z=yr(z,u),A||(A=z.length>1),z}),Pi(u,Al(u),w),A&&(w=hi(w,f|v|g,Up));for(var B=d.length;B--;)pl(w,d[B]);return w});function Y1(u,d){return jf(u,Ro(Ee(d)))}var G1=$i(function(u,d){return u==null?{}:xp(u,d)});function jf(u,d){if(u==null)return{};var w=rt(Al(u),function(A){return[A]});return d=Ee(d),Mh(u,w,function(A,B){return d(A,B[0])})}function X1(u,d,w){d=yr(d,u);var A=-1,B=d.length;for(B||(B=1,u=i);++A<B;){var z=u==null?i:u[Ii(d[A])];z===i&&(A=B,z=w),u=Gi(z)?z.call(u):z}return u}function Z1(u,d,w){return u==null?u:on(u,d,w)}function Q1(u,d,w,A){return A=typeof A=="function"?A:i,u==null?u:on(u,d,w,A)}var Kf=rf(pt),Vf=rf(Ut);function J1(u,d,w){var A=Re(u),B=A||pr(u)||Ea(u);if(d=Ee(d,4),w==null){var z=u&&u.constructor;B?w=A?new z:[]:st(u)?w=Gi(z)?wa(io(u)):{}:w={}}return(B?li:Ri)(u,function(j,Z,ie){return d(w,j,Z,ie)}),w}function e_(u,d){return u==null?!0:pl(u,d)}function t_(u,d,w){return u==null?u:zh(u,d,_l(w))}function i_(u,d,w,A){return A=typeof A=="function"?A:i,u==null?u:zh(u,d,_l(w),A)}function ka(u){return u==null?[]:Js(u,pt(u))}function r_(u){return u==null?[]:Js(u,Ut(u))}function a_(u,d,w){return w===i&&(w=d,d=i),w!==i&&(w=vi(w),w=w===w?w:0),d!==i&&(d=vi(d),d=d===d?d:0),Fr(vi(u),d,w)}function n_(u,d,w){return d=Xi(d),w===i?(w=d,d=0):w=Xi(w),u=vi(u),hp(u,d,w)}function o_(u,d,w){if(w&&typeof w!="boolean"&&Mt(u,d,w)&&(d=w=i),w===i&&(typeof d=="boolean"?(w=d,d=i):typeof u=="boolean"&&(w=u,u=i)),u===i&&d===i?(u=0,d=1):(u=Xi(u),d===i?(d=u,u=0):d=Xi(d)),u>d){var A=u;u=d,d=A}if(w||u%1||d%1){var B=gh();return Tt(u+B*(d-u+F0("1e-"+((B+"").length-1))),d)}return gl(u,d)}var s_=_a(function(u,d,w){return d=d.toLowerCase(),u+(w?$f(d):d)});function $f(u){return Wl(Ve(u).toLowerCase())}function Yf(u){return u=Ve(u),u&&u.replace(c0,Z0).replace(T0,"")}function l_(u,d,w){u=Ve(u),d=Qt(d);var A=u.length;w=w===i?A:Fr(Ie(w),0,A);var B=w;return w-=d.length,w>=0&&u.slice(w,B)==d}function c_(u){return u=Ve(u),u&&qy.test(u)?u.replace(ku,Q0):u}function u_(u){return u=Ve(u),u&&Gy.test(u)?u.replace(Ns,"\\$&"):u}var h_=_a(function(u,d,w){return u+(w?"-":"")+d.toLowerCase()}),f_=_a(function(u,d,w){return u+(w?" ":"")+d.toLowerCase()}),d_=Xh("toLowerCase");function v_(u,d,w){u=Ve(u),d=Ie(d);var A=d?va(u):0;if(!d||A>=d)return u;var B=(d-A)/2;return bo(oo(B),w)+u+bo(no(B),w)}function g_(u,d,w){u=Ve(u),d=Ie(d);var A=d?va(u):0;return d&&A<d?u+bo(d-A,w):u}function y_(u,d,w){u=Ve(u),d=Ie(d);var A=d?va(u):0;return d&&A<d?bo(d-A,w)+u:u}function m_(u,d,w){return w||d==null?d=0:d&&(d=+d),km(Ve(u).replace(Fs,""),d||0)}function p_(u,d,w){return(w?Mt(u,d,w):d===i)?d=1:d=Ie(d),yl(Ve(u),d)}function w_(){var u=arguments,d=Ve(u[0]);return u.length<3?d:d.replace(u[1],u[2])}var b_=_a(function(u,d,w){return u+(w?"_":"")+d.toLowerCase()});function __(u,d,w){return w&&typeof w!="number"&&Mt(u,d,w)&&(d=w=i),w=w===i?Y:w>>>0,w?(u=Ve(u),u&&(typeof d=="string"||d!=null&&!zl(d))&&(d=Qt(d),!d&&da(u))?mr(wi(u),0,w):u.split(d,w)):[]}var x_=_a(function(u,d,w){return u+(w?" ":"")+Wl(d)});function E_(u,d,w){return u=Ve(u),w=w==null?0:Fr(Ie(w),0,u.length),d=Qt(d),u.slice(w,w+d.length)==d}function k_(u,d,w){var A=N.templateSettings;w&&Mt(u,d,w)&&(d=i),u=Ve(u),d=Lo({},d,A,af);var B=Lo({},d.imports,A.imports,af),z=pt(B),j=Js(B,z),Z,ie,fe=0,de=d.interpolate||jn,ve="__p += '",me=tl((d.escape||jn).source+"|"+de.source+"|"+(de===Cu?r0:jn).source+"|"+(d.evaluate||jn).source+"|$","g"),_e="//# sourceURL="+($e.call(d,"sourceURL")?(d.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++D0+"]")+`
- `;u.replace(me,function(Ae,Be,Fe,ei,Bt,ti){return Fe||(Fe=ei),ve+=u.slice(fe,ti).replace(u0,J0),Be&&(Z=!0,ve+=`' +
- __e(`+Be+`) +
- '`),Bt&&(ie=!0,ve+=`';
- `+Bt+`;
- __p += '`),Fe&&(ve+=`' +
- ((__t = (`+Fe+`)) == null ? '' : __t) +
- '`),fe=ti+Ae.length,Ae}),ve+=`';
- `;var Ce=$e.call(d,"variable")&&d.variable;if(!Ce)ve=`with (obj) {
- `+ve+`
- }
- `;else if(t0.test(Ce))throw new Te(s);ve=(ie?ve.replace(zy,""):ve).replace(Hy,"$1").replace(Uy,"$1;"),ve="function("+(Ce||"obj")+`) {
- `+(Ce?"":`obj || (obj = {});
- `)+"var __t, __p = ''"+(Z?", __e = _.escape":"")+(ie?`, __j = Array.prototype.join;
- function print() { __p += __j.call(arguments, '') }
- `:`;
- `)+ve+`return __p
- }`;var Le=Xf(function(){return je(z,_e+"return "+ve).apply(i,j)});if(Le.source=ve,Fl(Le))throw Le;return Le}function C_(u){return Ve(u).toLowerCase()}function A_(u){return Ve(u).toUpperCase()}function S_(u,d,w){if(u=Ve(u),u&&(w||d===i))return ah(u);if(!u||!(d=Qt(d)))return u;var A=wi(u),B=wi(d),z=nh(A,B),j=oh(A,B)+1;return mr(A,z,j).join("")}function T_(u,d,w){if(u=Ve(u),u&&(w||d===i))return u.slice(0,lh(u)+1);if(!u||!(d=Qt(d)))return u;var A=wi(u),B=oh(A,wi(d))+1;return mr(A,0,B).join("")}function R_(u,d,w){if(u=Ve(u),u&&(w||d===i))return u.replace(Fs,"");if(!u||!(d=Qt(d)))return u;var A=wi(u),B=nh(A,wi(d));return mr(A,B).join("")}function P_(u,d){var w=$,A=S;if(st(d)){var B="separator"in d?d.separator:B;w="length"in d?Ie(d.length):w,A="omission"in d?Qt(d.omission):A}u=Ve(u);var z=u.length;if(da(u)){var j=wi(u);z=j.length}if(w>=z)return u;var Z=w-va(A);if(Z<1)return A;var ie=j?mr(j,0,Z).join(""):u.slice(0,Z);if(B===i)return ie+A;if(j&&(Z+=ie.length-Z),zl(B)){if(u.slice(Z).search(B)){var fe,de=ie;for(B.global||(B=tl(B.source,Ve(Au.exec(B))+"g")),B.lastIndex=0;fe=B.exec(de);)var ve=fe.index;ie=ie.slice(0,ve===i?Z:ve)}}else if(u.indexOf(Qt(B),Z)!=Z){var me=ie.lastIndexOf(B);me>-1&&(ie=ie.slice(0,me))}return ie+A}function I_(u){return u=Ve(u),u&&Wy.test(u)?u.replace(Eu,om):u}var L_=_a(function(u,d,w){return u+(w?" ":"")+d.toUpperCase()}),Wl=Xh("toUpperCase");function Gf(u,d,w){return u=Ve(u),d=w?i:d,d===i?tm(u)?cm(u):V0(u):u.match(d)||[]}var Xf=De(function(u,d){try{return Xt(u,i,d)}catch(w){return Fl(w)?w:new Te(w)}}),D_=$i(function(u,d){return li(d,function(w){w=Ii(w),Ki(u,w,Ol(u[w],u))}),u});function M_(u){var d=u==null?0:u.length,w=Ee();return u=d?rt(u,function(A){if(typeof A[1]!="function")throw new ci(o);return[w(A[0]),A[1]]}):[],De(function(A){for(var B=-1;++B<d;){var z=u[B];if(Xt(z[0],this,A))return Xt(z[1],this,A)}})}function B_(u){return op(hi(u,f))}function ql(u){return function(){return u}}function O_(u,d){return u==null||u!==u?d:u}var N_=Qh(),F_=Qh(!0);function Wt(u){return u}function jl(u){return Th(typeof u=="function"?u:hi(u,f))}function z_(u){return Ph(hi(u,f))}function H_(u,d){return Ih(u,hi(d,f))}var U_=De(function(u,d){return function(w){return an(w,u,d)}}),W_=De(function(u,d){return function(w){return an(u,w,d)}});function Kl(u,d,w){var A=pt(d),B=fo(d,A);w==null&&!(st(d)&&(B.length||!A.length))&&(w=d,d=u,u=this,B=fo(d,pt(d)));var z=!(st(w)&&"chain"in w)||!!w.chain,j=Gi(u);return li(B,function(Z){var ie=d[Z];u[Z]=ie,j&&(u.prototype[Z]=function(){var fe=this.__chain__;if(z||fe){var de=u(this.__wrapped__),ve=de.__actions__=zt(this.__actions__);return ve.push({func:ie,args:arguments,thisArg:u}),de.__chain__=fe,de}return ie.apply(u,hr([this.value()],arguments))})}),u}function q_(){return kt._===this&&(kt._=gm),this}function Vl(){}function j_(u){return u=Ie(u),De(function(d){return Lh(d,u)})}var K_=El(rt),V_=El(Ju),$_=El(Ys);function Zf(u){return Pl(u)?Gs(Ii(u)):Ep(u)}function Y_(u){return function(d){return u==null?i:zr(u,d)}}var G_=ef(),X_=ef(!0);function $l(){return[]}function Yl(){return!1}function Z_(){return{}}function Q_(){return""}function J_(){return!0}function ex(u,d){if(u=Ie(u),u<1||u>V)return[];var w=Y,A=Tt(u,Y);d=Ee(d),u-=Y;for(var B=Qs(A,d);++w<u;)d(w);return B}function tx(u){return Re(u)?rt(u,Ii):Jt(u)?[u]:zt(mf(Ve(u)))}function ix(u){var d=++dm;return Ve(u)+d}var rx=wo(function(u,d){return u+d},0),ax=kl("ceil"),nx=wo(function(u,d){return u/d},1),ox=kl("floor");function sx(u){return u&&u.length?ho(u,Wt,cl):i}function lx(u,d){return u&&u.length?ho(u,Ee(d,2),cl):i}function cx(u){return ih(u,Wt)}function ux(u,d){return ih(u,Ee(d,2))}function hx(u){return u&&u.length?ho(u,Wt,dl):i}function fx(u,d){return u&&u.length?ho(u,Ee(d,2),dl):i}var dx=wo(function(u,d){return u*d},1),vx=kl("round"),gx=wo(function(u,d){return u-d},0);function yx(u){return u&&u.length?Zs(u,Wt):0}function mx(u,d){return u&&u.length?Zs(u,Ee(d,2)):0}return N.after=zb,N.ary=Tf,N.assign=A1,N.assignIn=Wf,N.assignInWith=Lo,N.assignWith=S1,N.at=T1,N.before=Rf,N.bind=Ol,N.bindAll=D_,N.bindKey=Pf,N.castArray=Zb,N.chain=Cf,N.chunk=ow,N.compact=sw,N.concat=lw,N.cond=M_,N.conforms=B_,N.constant=ql,N.countBy=yb,N.create=R1,N.curry=If,N.curryRight=Lf,N.debounce=Df,N.defaults=P1,N.defaultsDeep=I1,N.defer=Hb,N.delay=Ub,N.difference=cw,N.differenceBy=uw,N.differenceWith=hw,N.drop=fw,N.dropRight=dw,N.dropRightWhile=vw,N.dropWhile=gw,N.fill=yw,N.filter=pb,N.flatMap=_b,N.flatMapDeep=xb,N.flatMapDepth=Eb,N.flatten=_f,N.flattenDeep=mw,N.flattenDepth=pw,N.flip=Wb,N.flow=N_,N.flowRight=F_,N.fromPairs=ww,N.functions=F1,N.functionsIn=z1,N.groupBy=kb,N.initial=_w,N.intersection=xw,N.intersectionBy=Ew,N.intersectionWith=kw,N.invert=U1,N.invertBy=W1,N.invokeMap=Ab,N.iteratee=jl,N.keyBy=Sb,N.keys=pt,N.keysIn=Ut,N.map=Ao,N.mapKeys=j1,N.mapValues=K1,N.matches=z_,N.matchesProperty=H_,N.memoize=To,N.merge=V1,N.mergeWith=qf,N.method=U_,N.methodOf=W_,N.mixin=Kl,N.negate=Ro,N.nthArg=j_,N.omit=$1,N.omitBy=Y1,N.once=qb,N.orderBy=Tb,N.over=K_,N.overArgs=jb,N.overEvery=V_,N.overSome=$_,N.partial=Nl,N.partialRight=Mf,N.partition=Rb,N.pick=G1,N.pickBy=jf,N.property=Zf,N.propertyOf=Y_,N.pull=Tw,N.pullAll=Ef,N.pullAllBy=Rw,N.pullAllWith=Pw,N.pullAt=Iw,N.range=G_,N.rangeRight=X_,N.rearg=Kb,N.reject=Lb,N.remove=Lw,N.rest=Vb,N.reverse=Ml,N.sampleSize=Mb,N.set=Z1,N.setWith=Q1,N.shuffle=Bb,N.slice=Dw,N.sortBy=Fb,N.sortedUniq=Hw,N.sortedUniqBy=Uw,N.split=__,N.spread=$b,N.tail=Ww,N.take=qw,N.takeRight=jw,N.takeRightWhile=Kw,N.takeWhile=Vw,N.tap=sb,N.throttle=Yb,N.thru=Co,N.toArray=zf,N.toPairs=Kf,N.toPairsIn=Vf,N.toPath=tx,N.toPlainObject=Uf,N.transform=J1,N.unary=Gb,N.union=$w,N.unionBy=Yw,N.unionWith=Gw,N.uniq=Xw,N.uniqBy=Zw,N.uniqWith=Qw,N.unset=e_,N.unzip=Bl,N.unzipWith=kf,N.update=t_,N.updateWith=i_,N.values=ka,N.valuesIn=r_,N.without=Jw,N.words=Gf,N.wrap=Xb,N.xor=eb,N.xorBy=tb,N.xorWith=ib,N.zip=rb,N.zipObject=ab,N.zipObjectDeep=nb,N.zipWith=ob,N.entries=Kf,N.entriesIn=Vf,N.extend=Wf,N.extendWith=Lo,Kl(N,N),N.add=rx,N.attempt=Xf,N.camelCase=s_,N.capitalize=$f,N.ceil=ax,N.clamp=a_,N.clone=Qb,N.cloneDeep=e1,N.cloneDeepWith=t1,N.cloneWith=Jb,N.conformsTo=i1,N.deburr=Yf,N.defaultTo=O_,N.divide=nx,N.endsWith=l_,N.eq=_i,N.escape=c_,N.escapeRegExp=u_,N.every=mb,N.find=wb,N.findIndex=wf,N.findKey=L1,N.findLast=bb,N.findLastIndex=bf,N.findLastKey=D1,N.floor=ox,N.forEach=Af,N.forEachRight=Sf,N.forIn=M1,N.forInRight=B1,N.forOwn=O1,N.forOwnRight=N1,N.get=Hl,N.gt=r1,N.gte=a1,N.has=H1,N.hasIn=Ul,N.head=xf,N.identity=Wt,N.includes=Cb,N.indexOf=bw,N.inRange=n_,N.invoke=q1,N.isArguments=Wr,N.isArray=Re,N.isArrayBuffer=n1,N.isArrayLike=Ht,N.isArrayLikeObject=ut,N.isBoolean=o1,N.isBuffer=pr,N.isDate=s1,N.isElement=l1,N.isEmpty=c1,N.isEqual=u1,N.isEqualWith=h1,N.isError=Fl,N.isFinite=f1,N.isFunction=Gi,N.isInteger=Bf,N.isLength=Po,N.isMap=Of,N.isMatch=d1,N.isMatchWith=v1,N.isNaN=g1,N.isNative=y1,N.isNil=p1,N.isNull=m1,N.isNumber=Nf,N.isObject=st,N.isObjectLike=ct,N.isPlainObject=un,N.isRegExp=zl,N.isSafeInteger=w1,N.isSet=Ff,N.isString=Io,N.isSymbol=Jt,N.isTypedArray=Ea,N.isUndefined=b1,N.isWeakMap=_1,N.isWeakSet=x1,N.join=Cw,N.kebabCase=h_,N.last=di,N.lastIndexOf=Aw,N.lowerCase=f_,N.lowerFirst=d_,N.lt=E1,N.lte=k1,N.max=sx,N.maxBy=lx,N.mean=cx,N.meanBy=ux,N.min=hx,N.minBy=fx,N.stubArray=$l,N.stubFalse=Yl,N.stubObject=Z_,N.stubString=Q_,N.stubTrue=J_,N.multiply=dx,N.nth=Sw,N.noConflict=q_,N.noop=Vl,N.now=So,N.pad=v_,N.padEnd=g_,N.padStart=y_,N.parseInt=m_,N.random=o_,N.reduce=Pb,N.reduceRight=Ib,N.repeat=p_,N.replace=w_,N.result=X1,N.round=vx,N.runInContext=te,N.sample=Db,N.size=Ob,N.snakeCase=b_,N.some=Nb,N.sortedIndex=Mw,N.sortedIndexBy=Bw,N.sortedIndexOf=Ow,N.sortedLastIndex=Nw,N.sortedLastIndexBy=Fw,N.sortedLastIndexOf=zw,N.startCase=x_,N.startsWith=E_,N.subtract=gx,N.sum=yx,N.sumBy=mx,N.template=k_,N.times=ex,N.toFinite=Xi,N.toInteger=Ie,N.toLength=Hf,N.toLower=C_,N.toNumber=vi,N.toSafeInteger=C1,N.toString=Ve,N.toUpper=A_,N.trim=S_,N.trimEnd=T_,N.trimStart=R_,N.truncate=P_,N.unescape=I_,N.uniqueId=ix,N.upperCase=L_,N.upperFirst=Wl,N.each=Af,N.eachRight=Sf,N.first=xf,Kl(N,function(){var u={};return Ri(N,function(d,w){$e.call(N.prototype,w)||(u[w]=d)}),u}(),{chain:!1}),N.VERSION=a,li(["bind","bindKey","curry","curryRight","partial","partialRight"],function(u){N[u].placeholder=N}),li(["drop","take"],function(u,d){Oe.prototype[u]=function(w){w=w===i?1:yt(Ie(w),0);var A=this.__filtered__&&!d?new Oe(this):this.clone();return A.__filtered__?A.__takeCount__=Tt(w,A.__takeCount__):A.__views__.push({size:Tt(w,Y),type:u+(A.__dir__<0?"Right":"")}),A},Oe.prototype[u+"Right"]=function(w){return this.reverse()[u](w).reverse()}}),li(["filter","map","takeWhile"],function(u,d){var w=d+1,A=w==O||w==G;Oe.prototype[u]=function(B){var z=this.clone();return z.__iteratees__.push({iteratee:Ee(B,3),type:w}),z.__filtered__=z.__filtered__||A,z}}),li(["head","last"],function(u,d){var w="take"+(d?"Right":"");Oe.prototype[u]=function(){return this[w](1).value()[0]}}),li(["initial","tail"],function(u,d){var w="drop"+(d?"":"Right");Oe.prototype[u]=function(){return this.__filtered__?new Oe(this):this[w](1)}}),Oe.prototype.compact=function(){return this.filter(Wt)},Oe.prototype.find=function(u){return this.filter(u).head()},Oe.prototype.findLast=function(u){return this.reverse().find(u)},Oe.prototype.invokeMap=De(function(u,d){return typeof u=="function"?new Oe(this):this.map(function(w){return an(w,u,d)})}),Oe.prototype.reject=function(u){return this.filter(Ro(Ee(u)))},Oe.prototype.slice=function(u,d){u=Ie(u);var w=this;return w.__filtered__&&(u>0||d<0)?new Oe(w):(u<0?w=w.takeRight(-u):u&&(w=w.drop(u)),d!==i&&(d=Ie(d),w=d<0?w.dropRight(-d):w.take(d-u)),w)},Oe.prototype.takeRightWhile=function(u){return this.reverse().takeWhile(u).reverse()},Oe.prototype.toArray=function(){return this.take(Y)},Ri(Oe.prototype,function(u,d){var w=/^(?:filter|find|map|reject)|While$/.test(d),A=/^(?:head|last)$/.test(d),B=N[A?"take"+(d=="last"?"Right":""):d],z=A||/^find/.test(d);!B||(N.prototype[d]=function(){var j=this.__wrapped__,Z=A?[1]:arguments,ie=j instanceof Oe,fe=Z[0],de=ie||Re(j),ve=function(Be){var Fe=B.apply(N,hr([Be],Z));return A&&me?Fe[0]:Fe};de&&w&&typeof fe=="function"&&fe.length!=1&&(ie=de=!1);var me=this.__chain__,_e=!!this.__actions__.length,Ce=z&&!me,Le=ie&&!_e;if(!z&&de){j=Le?j:new Oe(this);var Ae=u.apply(j,Z);return Ae.__actions__.push({func:Co,args:[ve],thisArg:i}),new ui(Ae,me)}return Ce&&Le?u.apply(this,Z):(Ae=this.thru(ve),Ce?A?Ae.value()[0]:Ae.value():Ae)})}),li(["pop","push","shift","sort","splice","unshift"],function(u){var d=Xn[u],w=/^(?:push|sort|unshift)$/.test(u)?"tap":"thru",A=/^(?:pop|shift)$/.test(u);N.prototype[u]=function(){var B=arguments;if(A&&!this.__chain__){var z=this.value();return d.apply(Re(z)?z:[],B)}return this[w](function(j){return d.apply(Re(j)?j:[],B)})}}),Ri(Oe.prototype,function(u,d){var w=N[d];if(w){var A=w.name+"";$e.call(pa,A)||(pa[A]=[]),pa[A].push({name:d,func:w})}}),pa[po(i,b).name]=[{name:"wrapper",func:i}],Oe.prototype.clone=Im,Oe.prototype.reverse=Lm,Oe.prototype.value=Dm,N.prototype.at=lb,N.prototype.chain=cb,N.prototype.commit=ub,N.prototype.next=hb,N.prototype.plant=db,N.prototype.reverse=vb,N.prototype.toJSON=N.prototype.valueOf=N.prototype.value=gb,N.prototype.first=N.prototype.head,Xa&&(N.prototype[Xa]=fb),N},ga=um();Mr?((Mr.exports=ga)._=ga,js._=ga):kt._=ga}).call(Ot)})(iu,iu.exports);const $T=iu.exports;export{LT as M,$T as _,BT as a,FT as b,OT as c,MT as d,KT as e,DT as f,jT as g,WT as h,HT as i,UT as j,qT as k,VT as p,NT as s,zT as t};
|