lodash.ea17c5bc.js 907 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. var nx=Object.defineProperty;var rx=(e,t,i)=>t in e?nx(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i;var W=(e,t,i)=>(rx(e,typeof t!="symbol"?t+"":t,i),i);import{P as Be}from"./index.aa99da01.js";function Oa(e,t){const i=t||new Path2D;if(e.name==="combine"&&!e.draw)return i instanceof Path2D?i:void 0;e.setTheme||(e.setTheme=ox);let a=e.calculative.borderRadius||0,s=a;const{x:n,y:r,width:l,height:o,ex:u,ey:c}=e.calculative.worldRect;a<1&&(a=l*a,s=o*s);let f=a<s?a:s;if(l<2*f&&(f=l/2),o<2*f&&(f=o/2),i.moveTo(n+f,r),i.arcTo(u,r,u,c,f),i.arcTo(u,c,n,c,f),i.arcTo(n,c,n,r,f),i.arcTo(n,r,u,r,f),i.closePath(),i instanceof Path2D)return i}function ox(e,t){if(!!e.affectByTheme){for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){const a=t[i];e.hasOwnProperty(i)&&(e[i]=a),e.calculative.hasOwnProperty(i)&&(e.calculative[i]=a)}e.hoverTextColor=t.textPrimaryColor,e.iconColor=t.buttonBg,e.calculative.iconColor=t.buttonBg,e.hoverBackground=t.formBg,e.activeBackground=t.activeBg,e.color=t.borderColor,e.calculative.color=t.borderColor,e.textColor=t["textColor-9"],e.calculative.textColor=t["textColor-9"]}}const lx=Oa;function cx(e,t){const i=t||new Path2D,{x:a,y:s,width:n,height:r}=e.calculative.worldRect;if(i.ellipse(a+n/2,s+r/2,n/2,r/2,0,0,Math.PI*2),i instanceof Path2D)return i}var $t;(function(e){e[e.Node=0]="Node",e[e.Line=1]="Line"})($t||($t={}));var Mt;(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"})(Mt||(Mt={}));var hf;(function(e){e[e.Default=0]="Default",e[e.In=1]="In",e[e.Out=2]="Out"})(hf||(hf={}));var Rs;(function(e){e[e.None=0]="None",e[e.Linear=1]="Linear",e[e.Radial=2]="Radial"})(Rs||(Rs={}));var zt;(function(e){e[e.CanvasTemplate=1]="CanvasTemplate",e[e.CanvasImageBottom=2]="CanvasImageBottom",e[e.CanvasMain=3]="CanvasMain",e[e.CanvasImage=4]="CanvasImage"})(zt||(zt={}));const hx=["text","textWidth","textHeight","textLeft","textTop","fontFamily","fontSize","lineHeight","fontStyle","fontWeight","textAlign","textBaseline","whiteSpace","ellipsis","keepDecimal"],ux=["x","y","width","height","flipX","flipY"],fx=["paddingTop","paddingRight","paddingBottom","paddingLeft","flipX","flipY","visible","showChild"],dx=["iconLeft","iconTop","iconRotate"],Md=["globalAlpha","flipY","flipX","x","y","width","height","iconWidth","iconHeight","imageRatio","iconLeft","iconTop","iconAlign","rotate","visible"];var We;(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",e[e.Custom=5]="Custom"})(We||(We={}));var ps;(function(e){e[e.Image=0]="Image",e[e.Icon=1]="Icon",e[e.Pen=2]="Pen",e[e.Element=3]="Element"})(ps||(ps={}));const Od=["gif","iframe","video","echarts","highcharts","lightningCharts","vue"],Cl=["radio","checkbox","button","inputDom","slider","echarts"],Gs=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","shadow","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","animations","toArrow","fromArrow","lineName","textType","textGradientColors"]),Fl={textType:0,bkType:0,strokeType:0};function gx(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 xt;(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"})(xt||(xt={}));var Yt;(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"})(Yt||(Yt={}));var Vi;(function(e){e[e.None=0]="None",e[e.Down=1]="Down",e[e.Translate=2]="Translate"})(Vi||(Vi={}));var It;(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"})(It||(It={}));const uf=["nw-resize","ne-resize","se-resize","sw-resize"],ff=["n-resize","e-resize","s-resize","w-resize"],vx=["curve","polyline","line"],Nd=["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","visible","iconColor"];var Na;(function(e){e[e.Mirror=0]="Mirror",e[e.Bilateral=1]="Bilateral",e[e.Free=2]="Free"})(Na||(Na={}));var Ae;(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"})(Ae||(Ae={}));var $i;(function(e){e[e.Default=0]="Default",e[e.Line=1]="Line"})($i||($i={}));function Gt(e,t,i){if(!t||t%360===0)return;const a=t*Math.PI/180,s=(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=s,e.y=n,e.prev&&Gt(e.prev,t,i),e.next&&Gt(e.next,t,i)}function ms(e,t,i=5,a){if(t.type===$i.Line){let s=a.rotate;a.flipX&&(s*=-1),a.flipY&&(s*=-1);let n=t.rotate+s;return a.flipX&&(n*=-1),a.flipY&&(n*=-1),Ui(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 Hr(e,t,i){e.x=i.x-(i.x-e.x)*t,e.y=i.y-(i.y-e.y)*t}function ui(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;const i=e.x-t.x,a=e.y-t.y;let s=Math.atan(Math.abs(i/a))/(2*Math.PI)*360;return i>0&&a>0?s=180-s:i<0&&a>0?s+=180:i<0&&a<0&&(s=360-s),s}function Qr(e,t){const i=e.x-t.x,a=e.y-t.y;return Math.sqrt(i*i+a*a)}function mx(e,t){let i=It.None;if(!t)return i;const a=e.x-t.x,s=e.y-t.y;return Math.abs(a)>Math.abs(s)?a>0?i=It.Right:i=It.Left:s>0?i=It.Bottom:i=It.Up,i}function nn(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 df(e,t){return e.anchorId===t.anchorId&&e.connectTo===t.connectTo}function mr(e,t,i){let 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 yx="@meta2d/core",px="1.0.86",bx="@meta2d/core: Powerful, Beautiful, Simple, Open - Web-Based 2D At Its Best .",xx="index.js",_x="index.d.ts",Ex={copy:"copyfiles package.json ../../dist/core/",build:"tsc && npm run copy"},Ax=["meta2d","diagram","2D","canvas"],kx="alsmile123@qq.com",Cx="MIT",Fx={type:"git",url:"git+https://github.com/le5le-com/meta2d.js.git"},Rx={url:"https://github.com/le5le-com/meta2d.js/issues"},Tx="https://github.com/le5le-com/meta2d.js#readme",Px={"@types/marked":"^4.0.3","@types/offscreencanvas":"latest","@types/zrender":"^4.0.0"},Sx={mitt:"^2.1.0",mqtt:"^4.2.6"},Ix={access:"public"},Bx="78f2a53ca1839c89b56e2e498d17ba4eb987ad14",zd={name:yx,version:px,description:bx,main:xx,types:_x,scripts:Ex,keywords:Ax,author:kx,license:Cx,repository:Fx,bugs:Rx,homepage:Tx,devDependencies:Px,dependencies:Sx,publishConfig:Ix,gitHead:Bx},Et={version:zd.version,path2dDraws:{},canvasDraws:{},anchors:{},lineAnimateDraws:{},htmlElements:{}};function Hd(e){Object.assign(Et.path2dDraws,e)}function Dx(e){Object.assign(Et.canvasDraws,e)}function Lx(e){Object.assign(Et.anchors,e)}function Mx(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 Ba;(function(e){e[e.None=-1]="None",e[e.Document=0]="Document",e[e.Canvas=1]="Canvas"})(Ba||(Ba={}));const Ox={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:Ba.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:["tablePlus"],textFlip:!0,textRotate:!0,unavailableKeys:[],diagramOptions:{},svgPathStroke:!0,reconnetTimes:10},Nx=["color","hoverColor","activeColor","disabledColor","background","activeBackground","hoverBackground","disabledBackground","anchorColor","hoverAnchorColor","anchorBackground","animateColor","textColor","ruleColor","ruleLineColor","gridColor","lineColor","penBackground","dockPenColor"],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"}}},Qs={cssRuleSelector:":root",style_prefix:"le5le_",vendor_css_prefix:"--le-",dark:["textColor-9: rgba(255,255,255,0.90)","textColor-6: rgba(255,255,255,0.60)","textColor-1: rgba(255,255,255,1)","textColor-4: rgba(255,255,255,0.40)","textPrimaryColor: #7f838c","textSecondColor: rgba(255,255,255,0.90)","textDisabledColor: rgba(255,255,255,0.40)","textActiveColor: #0052d9","buttonBg: #4583ff","buttonDisabledBg: #0057CC","buttonDisabledColor: #FFFFFF26","buttonGradient: linear-gradient(360deg,#4583ff, #33ccff)","containerBg: rgba(21,24,28,0.95)","tabBg: #303746","tabActiveBg: #4583ff","tabDisabledBg: #282e3b","tabDisabledColor: rgba(255,255,255,0.26)","tabActiveColor: rgba(255,255,255,0.90)","formBg: #2a2f36","datePickerCellActiveRangeBg: #2c4475","componentDisabledBg: #282e3b","dataPickerCellActiveBg: #001b52","activeBg: #25375b","popContentBg: #252b37","disabledBg: #7f838c","disabledBg-2: #282E3B","tableStripeColor: rgba(150,192,255,0.10)","tableMenuBg: #303746","tableMenuDividerBg: rgb(76 81 94)","tableMenuHandleBg: #454f64","tableMenuColor: #bdc7db","tableMenuBorderColor: transparent","tableColRowBg: #303746","tableColRowActiveBg: #4A5263","tableColRowColor: rgba(255,255,255,0.6)","paginationColor: rgba(255,255,255,0.6)","paginationActiveColor: #4583ff","paginationActiveBg: rgba(69,131,255,0.20)","sliderBg: #303746","sliderBtnBg: #000000","notificationBorderColor: transparent","notificationBg: #282e3b","borderColor: #424b61","borderOutsideColor: #4583ff","formBorderColor: #424b61","borderInsideColor: rgba(255,255,255,0.40)","shadow: 0px 1px 10px 0px rgba(0,0,0,0.05), 0px 4px 5px 0px rgba(0,0,0,0.08), 0px 2px 4px -1px rgba(0,0,0,0.12)","radius: 4px"],light:["textColor-9: rgba(0,0,0,0.90)","textColor-6: rgba(0,0,0,0.60)","textColor-1: rgba(0,0,0,1)","textColor-4: rgba(0,0,0,0.40)","textPrimaryColor: #7f838c","textSecondColor: #171B27","textDisabledColor: rgba(0, 0, 0, 0.6)","textActiveColor: #0052d9","buttonBg: #4583ff","buttonDisabledBg: #b5c7ff","buttonDisabledColor: #FFFFFF","buttonGradient: linear-gradient(360deg,#4583ff, #33ccff)","containerBg: #ffffff","tabBg: #f1f2f5","tabActiveBg: #4583ff","tabDisabledBg: #e2e6ea","tabDisabledColor: rgba(0,0,0,0.26)","tabActiveColor: #ffffff","formBg: #EFF1F4","datePickerCellActiveRangeBg: #f2f3ff","componentDisabledBg: #eee","dataPickerCellActiveBg: #edefff","activeBg: #f2f3ff","popContentBg: #ffffff","disabledBg: #7f838c","disabledBg-2: #E2E6EA","tableStripeColor: #f1f2f5","tableMenuBg: #ffffff","tableMenuDividerBg: #e2e6ea","tableMenuHandleBg: #ebedf1","tableMenuColor: rgba(0,0,0,0.60)","tableMenuBorderColor: #e2e6ea","tableColRowBg: #ebedf1","tableColRowActiveBg: #bcc4d0","tableColRowColor: rgba(0,0,0,0.4)","paginationColor: rgba(0,0,0,0.6)","paginationActiveColor: #ffffff","paginationActiveBg: #4583ff","sliderBg: #e2e6ea","sliderBtnBg: #ffffff","notificationBorderColor: transparent","notificationBg: #ffffff","borderColor: #d6dbe3","borderOutsideColor: #d6dbe3","formBorderColor: #d4d6d9","borderInsideColor: #e7e7e7","shadow: 0px 2px 4px 0px rgba(107,113,121,0.25)","radius: 4px"],camelCaseToHyphenated(e){return e.replace(/[A-Z]/g,t=>"-"+t.toLowerCase())},_addVendorCssPrefix(e){return e.map(t=>{const[i,a]=t.split(":");return`${this.vendor_css_prefix}${this.camelCaseToHyphenated(i.trim())}:${a.trim()}`})},createThemeSheet(e,t){const i=document.createElement("style");i.type="text/css",i.id=this.style_prefix+t,document.head.appendChild(i);const a=e||"dark",s=this.getTheme(a),n=`${this.cssRuleSelector} { ${s.join(";")} }`;i.innerHTML=n},destroyThemeSheet(e){const t=this.findStyleSheet(this.style_prefix+e);t&&document.head.removeChild(t.ownerNode)},addTheme(e,t){Object.assign(this,{[e]:t})},getTheme(e){return this._addVendorCssPrefix(this[e]||this.light)},getThemeObj(e="dark"){const t=":";return this[e].reduce((a,s)=>{const[n,r]=s.split(t);return a[n]=r,a},{})},findStyleSheet(e){const t=document.styleSheets;for(let i=0;i<t.length;i++){const a=t[i];if(a.ownerNode&&a.ownerNode.id===e)return a}return null},updateCssRule(e,t){const a=this.getTheme(t),s=this.findStyleSheet(this.style_prefix+e);if(!s)return;let n=!1;for(let r=0;r<s.cssRules.length;r++)if(s.cssRules[r].selectorText===this.cssRuleSelector){n=!0;break}if(n)for(let r=0;r<s.cssRules.length;r++){const l=s.cssRules[r];if(l.selectorText===this.cssRuleSelector)if(s.insertRule){s.deleteRule(r);const o=`${this.cssRuleSelector} { ${a.join(";")} }`;s.insertRule(o,r)}else s.addRule&&(l.style.cssText=a.join(";"))}else if(s.insertRule){const r=`${this.cssRuleSelector} { ${a.join(";")} }`;s.insertRule(r,s.cssRules.length)}else if(s.addRule){const r=s.cssRules.find(l=>l.selectorText===this.cssRuleSelector);if(r){const l=a.join(";");r.style.cssText+=`; ${l}`}else s.addRule(this.cssRuleSelector,a.join(";"))}}};var bt;(function(e){e[e.Add=0]="Add",e[e.Update=1]="Update",e[e.Delete=2]="Delete",e[e.Replace=3]="Replace"})(bt||(bt={}));const Hx=()=>({data:{x:0,y:0,scale:1,pens:[],origin:{x:0,y:0},center:{x:0,y:0},paths:{}},histories:[],pens:{},path2dMap:new WeakMap,animateMap:new WeakMap,active:[],animates:new Set,options:{...Ox},theme:{...zx},emitter:Mx(),bindDatas:{},bind:{},pensNetwork:{},cacheDatas:[],messageEvents:{},templatePens:{},globalTriggers:{}}),Wx=(e="default")=>(Et[e]||(Et[e]=Hx(),Et[e].id=e),Et[e]),Ux=(e,t)=>{const i=e.data.template===t;if(i)for(const a of e.data.pens)a.canvasLayer===zt.CanvasTemplate&&(e.templatePens[a.id]=a);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:i?t:null,lineAnimateDraws:{}},e.sameTemplate=i,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()};function Fi(e){const{paddingTop:t,paddingBottom:i,paddingLeft:a,paddingRight:s,worldRect:n,canvas:r}=e.calculative;let{textLeft:l,textTop:o,textWidth:u,textHeight:c}=e.calculative,f=a,g=t;const v=n.width-a-s,m=n.height-t-i;u&&u<1&&(u*=n.width),c&&c<1&&(c*=n.height),u<e.calculative.fontSize&&(u=e.calculative.fontSize),f+=(l||0)+n.x,g+=(o||0)+n.y;const w=e.textAlign||r.store.options.textAlign,y=e.textBaseline||r.store.options.textBaseline;switch(w){case"center":f+=(v-(u||v))/2;break;case"right":f+=v-(u||v);break}switch(y){case"middle":g+=(m-(c||m))/2;break;case"bottom":g+=m-(c||m);break}const _={x:f,y:g,width:u||v,height:c||m};re(_),e.calculative.worldTextRect=_,_n(e),e.calculative.textDrawRect=void 0}function vc(e,t){const i=t.calculative.fontSize*t.calculative.lineHeight,a=t.calculative.textLines.length*i,s=Vx(e,t),n=t.calculative.worldTextRect;let r=n.x+(n.width-s)/2,l=n.y+(n.height-a)/2;const o=t.calculative.canvas.store.options;switch(t.textAlign||o.textAlign){case"left":r=n.x;break;case"right":r=n.x+n.width-s;break}switch(t.textBaseline||o.textBaseline){case"top":l=n.y;break;case"bottom":l=n.ey-a;break}t.calculative.textDrawRect={x:r,y:l,width:s,height:a},re(t.calculative.textDrawRect)}function _n(e,t=e.calculative.text){if(t==null){e.calculative.textLines=[];return}t=t.toString();const i=e.calculative.keepDecimal;if(i!=null){const o=Number(t);isNaN(o)||(t=o.toFixed(i))}let a=[];const s=e.calculative.fontSize*e.calculative.lineHeight,n=e.calculative.worldTextRect.height,r=Math.floor(n/s),l=r>1?r:1;switch(e.whiteSpace){case"nowrap":if(e.ellipsis!==!1){const c=gf(t.split(""),e);c[0]&&(a.push(c[0]),c.length>1&&Rl(a))}else a.push(t);break;case"pre-line":a=t.split(/[\n]/g),e.ellipsis!==!1&&a.length>l&&(a=a.slice(0,l),Rl(a));break;case"break-all":default:const o=t.split(/[\n]/g);let u=0;t:for(const c of o){const f=e.whiteSpace==="break-all"?c.split(""):Wd(c);let g=gf(f,e);if(g.length===0&&(g=[""]),e.ellipsis!=!1)for(const v of g)if(u++,u>l){Rl(a);break t}else a.push(v);else a.push(...g)}break}return e.calculative.textLines=a,a}function Wd(e=""){const t=[];let i="";for(let a=0;a<e.length;++a){const s=e.charCodeAt(a);s<33||s>126?(i&&(t.push(i),i=""),t.push(e[a])):i+=e[a]}return i&&t.push(i),t}function gf(e,t){const i=t.calculative.canvas,a=i.offscreen.getContext("2d"),{fontStyle:s,fontWeight:n,fontSize:r,fontFamily:l,lineHeight:o}=t.calculative;a.save();const u=[];let c=e[0]||"";for(let f=1;f<e.length;++f){const g=e[f]||"",v=c+g;let m=0;if(i.store.options.measureTextWidth)a.font=Le({fontStyle:s,fontWeight:n,fontFamily:l||i.store.options.fontFamily,fontSize:r,lineHeight:o}),m=a.measureText(v).width;else{const y=v.match(/[^\x00-\xff]/g)||"",_=y.length*r,A=v.match(/\s/g)||"",x=A.length*r*.3,C=(v.length-y.length-A.length)*r*.6;m=_+x+C}const w=t.calculative.worldTextRect.width;m<=w+.1?c+=g:(c.length&&u.push(c),c=g)}return c.length&&u.push(c),a.restore(),u}function Vx(e,t){let i=0;return t.calculative.textLineWidths=[],t.calculative.textLines.forEach(a=>{const s=e.measureText(a).width;t.calculative.textLineWidths.push(s),i<s&&(i=s)}),i}function Rl(e){e[e.length-1]=e[e.length-1].slice(0,-3)+"..."}function $x(e){let t=e.text.split(`
  2. `);const i=e.calculative.canvas,a=i.offscreen.getContext("2d"),{fontStyle:s,fontWeight:n,fontSize:r,fontFamily:l,lineHeight:o}=e.calculative;let u=0,c=0;a.save();for(let g=0;g<t.length;g++){if(i.store.options.measureTextWidth)a.font=Le({fontStyle:s,fontWeight:n,fontFamily:l||i.store.options.fontFamily,fontSize:r,lineHeight:o}),c=a.measureText(t[g]).width;else{const v=t[g].match(/[^\x00-\xff]/g)||"",m=v.length*r,w=t[g].match(/\s/g)||"",y=w.length*r*.3,_=(t[g].length-v.length-w.length)*r*.6;c=m+y+_}c>u&&(u=c)}a.restore();let f=t.length*r*o;e.textAlign==="left"||(e.textAlign==="right"?e.x=e.x-(u-e.width):e.x=e.x-(u-e.width)/2),e.textBaseline==="top"||(e.textBaseline==="bottom"?e.y=e.y-(f-e.height):e.y=e.y-(f-e.height)/2),e.height=f+5,e.width=u+5,e.calculative.canvas.updatePenRect(e),e.calculative.canvas.calcActiveRect()}function ht(e,t=!1){if(Array.isArray(e)){const i=[];return e.forEach(a=>{i.push(ht(a,t))}),i}else if(typeof e=="object"){if(e===null)return null;if(e.constructor===RegExp)return e;const i={};for(const a in e)if(!(["canvas","lastFrame","socketFn"].includes(a)||e[a]instanceof HTMLImageElement||e[a]instanceof HTMLMediaElement)){{if(a==="calculative"&&!t)continue;if(a==="singleton"){t?i[a]={}:i[a]=e[a];continue}}i[a]=ht(e[a],t)}return i}return e}function Xl(e,t,i){if(Array.isArray(e)){const a=[];return e.forEach(s=>{a.push(Xl(s,t,i))}),a}else if(typeof e=="object"){if(e===null)return null;for(const a in e)if(t.includes(a))if(Array.isArray(e[a]))e[a].forEach((s,n)=>{Number.isNaN(Number(s))||(e[a][n]=Number(s*i))});else{if(Number.isNaN(Number(e[a])))continue;e[a]=Number(e[a])*i}else e[a]=Xl(e[a],t,i);return e}return e}const je={};function Ud(e,t,i){if(!je[t.fromArrow])return;const a=le(t),{x:s,y:n}=a,r={x:s,y:n};if(r.step=(t.fromArrowSize||10)*i.data.scale,a.next)r.rotate=ui(a.next,a)+90;else{const o=t.calculative.worldAnchors[1];if(!o)return;o.prev?r.rotate=ui(o.prev,a)+90:r.rotate=ui(o,a)+90}e.save(),e.beginPath(),e.setLineDash([]);const l=t.fromArrowColor||t.calculative.color;l&&(e.strokeStyle=l),je[t.fromArrow](e,t,i,r),e.restore()}function Vd(e,t,i){if(!je[t.toArrow]||t.calculative.worldAnchors.length<2)return;e.save();const a=Vt(t),{x:s,y:n}=a,r={x:s,y:n};if(r.step=(t.toArrowSize||10)*i.data.scale,a.prev)r.rotate=ui(a.prev,a)+90;else{const o=t.calculative.worldAnchors[t.calculative.worldAnchors.length-2];o.next?r.rotate=ui(o.next,a)+90:r.rotate=ui(o,a)+90}e.beginPath(),e.setLineDash([]);const l=t.toArrowColor||t.calculative.color;l&&(e.strokeStyle=l),je[t.toArrow](e,t,i,r),e.restore()}je.triangleSolid=(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);const s=a.x-a.step;e.moveTo(s,a.y-a.step/4),e.lineTo(a.x,a.y),e.lineTo(s,a.y+a.step/4),e.closePath(),e.stroke(),e.fillStyle=e.strokeStyle,e.fill(),e.restore()};je.reTriangleSolid=(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);const s=a.x-a.step/2;e.moveTo(a.x,a.y-a.step/2),e.lineTo(s,a.y),e.lineTo(a.x,a.y+a.step/2),e.closePath(),e.stroke(),e.fillStyle=e.strokeStyle,e.fill(),e.restore()};je.triangle=(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);const s=a.x-a.step;e.moveTo(s,a.y-a.step/4),e.lineTo(a.x,a.y),e.lineTo(s,a.y+a.step/4),e.closePath(),e.stroke(),e.fillStyle=i.data.background||"#ffffff",e.fill(),e.restore()};je.circleSolid=(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);const s=a.step/2;e.arc(a.x-s,a.y,s,0,2*Math.PI),e.stroke(),e.fillStyle=e.strokeStyle,e.fill(),e.restore()};je.circle=(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);const s=a.step/2;e.arc(a.x-s,a.y,s,0,2*Math.PI),e.stroke(),e.fillStyle=i.data.background||"#ffffff",e.fill(),e.restore()};je.diamondSolid=(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);const s=a.x-a.step,n=a.step/2;e.moveTo(s,a.y),e.lineTo(s+n,a.y-n/2),e.lineTo(a.x,a.y),e.lineTo(s+n,a.y+n/2),e.closePath(),e.stroke(),e.fillStyle=e.strokeStyle,e.fill(),e.restore()};je.diamond=(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);const s=a.x-a.step,n=a.step/2;e.moveTo(s,a.y),e.lineTo(s+n,a.y-n/2),e.lineTo(a.x,a.y),e.lineTo(s+n,a.y+n/2),e.closePath(),e.stroke(),e.fillStyle=i.data.background||"#ffffff",e.fill(),e.restore()};je.line=(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);const s=a.x-a.step;e.moveTo(s,a.y-a.step/3),e.lineTo(a.x,a.y),e.lineTo(s,a.y+a.step/3),e.stroke(),e.restore()};je.lineUp=(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);const s=a.x-a.step;e.moveTo(s,a.y-a.step/3),e.lineTo(a.x,a.y),e.stroke(),e.restore()};je.lineDown=(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);const s=a.x-a.step;e.moveTo(s,a.y+a.step/3),e.lineTo(a.x,a.y),e.stroke(),e.restore()};function Gl(e){const t=parseInt,i=Math.round;let a=e.length,s={};if(a>9){const[n,r,l,o]=e=e.split(",");if(a=e.length,a<3||a>4)return null;s.r=t(n[3]=="a"?n.slice(5):n.slice(4)),s.g=t(r),s.b=t(l),s.a=o?parseFloat(o):-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?(s.r=e>>24&255,s.g=e>>16&255,s.b=e>>8&255,s.a=i((e&255)/.255)/1e3):(s.r=e>>16,s.g=e>>8&255,s.b=e&255,s.a=-1)}return s}function ke(e,t,i,a){let s,n,r,l,o,u,c,f=Math.round,g=typeof i=="string";return typeof e!="number"||e<-1||e>1||typeof t!="string"||t[0]!="r"&&t[0]!="#"||i&&!g||(c=t.length>9,c=g?i.length>9?!0:i=="c"?!c:!1:c,o=Gl(t),l=e<0,u=i&&i!="c"?Gl(i):l?{r:0,g:0,b:0,a:-1}:{r:255,g:255,b:255,a:-1},e=l?e*-1:e,l=1-e,!o||!u)?null:(a?(s=f(l*o.r+e*u.r),n=f(l*o.g+e*u.g),r=f(l*o.b+e*u.b)):(s=f((l*o.r**2+e*u.r**2)**.5),n=f((l*o.g**2+e*u.g**2)**.5),r=f((l*o.b**2+e*u.b**2)**.5)),g=o.a,u=u.a,o=g>=0||u>=0,g=o?g<0?u:u<0?g:g*l+u*e:0,c?"rgb"+(o?"a(":"(")+s+","+n+","+r+(o?","+f(g*1e3)/1e3:"")+")":"#"+(4294967296+s*16777216+n*65536+r*256+(o?f(g*255):0)).toString(16).slice(1,o?void 0:-2))}globalThis.pSBC=ke;function Wr(e,t){const i=Gl(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})`}function us(e,t){if(isNaN(e)){console.warn("realValue not number");return}if(typeof t!="string"){console.warn("collection must be string");return}const[i,a]=[t[0],t[t.length-1]];if(!["[","("].includes(i)){console.warn('collection must start with "[" or "("');return}if(!["]",")"].includes(a)){console.warn('collection must end with "]" or ")"');return}const s=t.substring(1,t.length-1).split(",");if(s.length!==2){console.warn("collection must have 2 numbers");return}const[n,r]=[+s[0],+s[1]];if(n>=r){console.warn("startNum must less than endNum");return}return e>n||i==="["&&e===n?e<r||a==="]"&&e===r:!1}function fs(e,t){if(typeof t!="string"){console.warn("collection must be string");return}const[i,a]=[t[0],t[t.length-1]];if(i!=="["||a!=="]"){console.warn('collection must start with "[" and end with "]"');return}const s=t.substring(1,t.length-1).split(",");for(const n of s)if(n.includes("..")){const[r,l]=n.split(".."),[o,u]=[+r,+l];if(o>=u){console.warn("startNum must less than endNum");return}if(e>=o&&e<=u)return!0}else if(e==n)return!0;return!1}function jx(e,t,i){const a=1-e;return 3*a*a*e*t+3*a*e*e*i+e*e*e}function St(){return((1+Math.random())*4294967296|0).toString(16).substring(1)}const qi=e=>{let t=0,i=0,a=0,s=0;return typeof e=="number"?t=i=a=s=e:typeof e=="string"?t=i=a=s=parseInt(e,10):Array.isArray(e)&&(t=e[0],a=Tl(e[1])?e[0]:e[1],s=Tl(e[2])?e[0]:e[2],i=Tl(e[3])?a:e[3]),[t,a,s,i]};function Tl(e){return e==null}async function qx(e){return new Promise((t,i)=>{const a=new FileReader;a.onload=s=>{t(s.target.result)},a.onerror=s=>{i(s)},a.readAsDataURL(e)})}async function Yx(e,t,i,a){const s=new FormData;if(s.append("file",e),i)for(const r in i)i.hasOwnProperty(r)&&s.append(r,i[r]);return(await(await fetch(t,{method:"POST",headers:a,body:s})).json()).url}function Kx(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 ws(e){let t=e||window.location.search.split("?")[1];const i=new URLSearchParams(t);return Object.fromEntries(i.entries())}function gn(e){let t;const i=new RegExp("(^| )"+e+"=([^;]*)(;|$)");return(t=document.cookie.match(i))?decodeURIComponent(t[2]):""}var Ur;(function(e){e[e.None=0]="None",e[e.LocalStorage=1]="LocalStorage",e[e.Cookie=2]="Cookie"})(Ur||(Ur={}));const Xx=location.host.indexOf("le5le.com")!==-1;function Sr(){var t;const e=(t=globalThis.le5leTokenName)!=null?t:"token";switch(globalThis.le5leTokenType){case Ur.LocalStorage:return localStorage.getItem(e);case Ur.Cookie:return gn(e);default:return Xx?gn(e):localStorage.getItem(e)}}async function $d(e,t){var o,u;if(globalThis.getMeta2dData)return await globalThis.getMeta2dData(t);const i=e.options.navigatorNetWork;let s=`/api/data/${location.href.includes("2d.")||location.href.includes("/2d")?"2d":"v"}/get`,n=((o=ws())==null?void 0:o.id)||s.includes("${id}");if(!n&&((u=ws())==null?void 0:u.data)){s=`./projects/${t}`;const f=new URL(window.location);f.searchParams.set("data",t),history.pushState({},"",f)}i!=null&&i.url&&(i.url.includes("${id}")?s=i.url.replace("${id}",t):s=i.url+((i==null?void 0:i.method)==="GET"?`?id=${t}`:""));let r=(i==null?void 0:i.method)||"POST";n||(r="GET");const l=await fetch(s,{headers:{Authorization:`Bearer ${Sr()}`},method:r,body:r==="GET"?void 0:JSON.stringify({id:t})});if(l.ok){let c=await l.text();return c.constructor===Object||c.constructor===Array?c=JSON.parse(JSON.stringify(c)):typeof c=="string"&&(c=JSON.parse(c)),c.data&&(c=c.data),c}else e.emitter.emit("error",{type:"http",error:l})}function ya(e,t){if(t==null)return e;const i=t.split(".");for(;i.length&&(e=e[i.shift()]););return e}function Vr(e,t,i){t!=null&&t.split(".").reduce((a,s,n)=>a[s]=t.split(".").length===++n?i:a[s]||{},e)}function Zl(e,t){const i=["\u5929","\u4E00","\u4E8C","\u4E09","\u56DB","\u4E94","\u516D"];let a=new Date;t&&(a=new Date(t));const s=a.getFullYear(),n=a.getMonth()+1,r=a.getDate(),l=a.getDay(),o=a.getHours(),u=a.getMinutes(),c=a.getSeconds();return new Function("year","month","day","week","hours","minutes","seconds",e?`return ${e}`:"return `${year}:${month}:${day} ${hours}:${minutes}:${seconds} \u661F\u671F${week}`")(s,n,r,i[l],o,u,c)}function Gx(e,t){if(!e||!t)return!1;let i=ti(e);for(;i;){if(i.id===t.id)return!0;i=ti(i)}return!1}function ti(e,t){if(!e||!e.parentId||!e.calculative)return;const a=e.calculative.canvas.store.pens[e.parentId];return t&&ti(a,t)||a}function Qe(e,t){if(!e||!e.children)return[];const i=[];return e.children.forEach(a=>{const s=t.pens[a];s&&(i.push(s),i.push(...Qe(s,t)))}),i}function mc(e,t){if(!e||!e.followers)return[];const i=[];return e.followers.forEach(a=>{const s=t.pens[a];s&&!s.parentId&&(i.push(s),i.push(...mc(s,t)))}),i}function Zx(e,t){const{worldRect:i,gradientFromColor:a,gradientToColor:s,gradientAngle:n}=t.calculative;return qd(e,i,a,s,n)}function Jx(e,t){const{worldRect:i,gradientFromColor:a,gradientToColor:s,gradientRadius:n}=t.calculative;if(!a||!s)return;const{width:r,height:l,center:o}=i,{x:u,y:c}=o;let f=r;f<l&&(f=l),f*=.5;const g=e.createRadialGradient(u,c,f*(n||0),u,c,f);return g.addColorStop(0,a),g.addColorStop(1,s),g}function Qx(e,t,i,a,s){let n=0;n=Math.PI/2-Math.atan2(a-t,i-e);const r=(e+i)/2,l=(t+a)/2,o=r+s*Math.sin(90*Math.PI/180-n),u=l+s*-Math.cos(90*Math.PI/180-n),c=r+s*Math.sin(270*Math.PI/180-n),f=l+s*-Math.cos(270*Math.PI/180-n);return[o,u,c,f]}function t2(e,t){const{worldRect:i,gradientColors:a,gradientRadius:s}=t.calculative;if(!a)return;let n=t.calculative.gradientColors;t.calculative.checked&&(n=t.calculative.onGradientColors);const{width:r,height:l,center:o}=i,{x:u,y:c}=o;let f=r;f<l&&(f=l),f*=.5;const{colors:g}=Ya(n),v=e.createRadialGradient(u,c,f*(s||0),u,c,f);return g.forEach(m=>{v.addColorStop(m.i,m.color)}),v}function e2(e,t){const{x:i,y:a,ex:s,width:n,height:r,center:l}=t.calculative.worldRect;let o=[{x:s,y:a+r/2},{x:i,y:a+r/2}],u=t.calculative.gradientColors;t.calculative.checked&&(u=t.calculative.onGradientColors);const{angle:c,colors:f}=Ya(u);let g=yc(c,n,r);return o.forEach(v=>{Gt(v,c,l)}),to(e,o,f,g)}function i2(e,t){const{worldRect:i,textGradientColors:a}=t.calculative;if(!a)return;const{width:s,height:n,center:r}=i,{x:l,y:o}=r;let u=s;u<n&&(u=n),u*=.5;const{colors:c}=Ya(a),f=e.createRadialGradient(l,o,0,l,o,u);return c.forEach(g=>{f.addColorStop(g.i,g.color)}),f}function a2(e,t){!t.calculative.textDrawRect&&vc(e,t),Qt(t.calculative.textDrawRect);const{x:i,y:a,ex:s,width:n,height:r,center:l}=t.calculative.textDrawRect;let o=[{x:s,y:a+r/2},{x:i,y:a+r/2}];const{angle:u,colors:c}=Ya(t.calculative.textGradientColors);let f=yc(u,n,r);return o.forEach(g=>{Gt(g,u,l)}),to(e,o,c,f)}function yc(e,t,i){const a=Math.atan(i/t)/Math.PI*180;let s=(e-90)%360,n=0;return s>a&&s<180-a||s>180+a&&s<360-a||s<0?(s>270?s=360-s:s>180?s=s-180:s>90&&(s=180-s),n=Math.abs(i/Math.sin(s/180*Math.PI)/2)):(s>270?s=360-s:s>180?s=s-180:s>90&&(s=180-s),n=Math.abs(t/Math.cos(s/180*Math.PI)/2)),n}function Ya(e){if(typeof e=="string"&&e.startsWith("linear-gradient")){let t=e.slice(16,-2).split("deg,");if(t.length>1){let i=t[1].split("%,");const a=[];return i.forEach(s=>{if(/rgba?/.test(s)){let n=s.split(") ");a.push({color:s2(n[0]+")"),i:parseFloat(n[1])/100})}else{let n=s.split(" ");n.length>2?a.push({color:n[1],i:parseFloat(n[2])/100}):a.push({color:n[0],i:parseFloat(n[1])/100})}}),{angle:parseFloat(t[0]),colors:a}}else return{angle:parseFloat(t[0]),colors:[]}}else return{angle:0,colors:[]}}function s2(e){if(/rgba?/.test(e)){let t=e.split(",");if(t.length<3)return"";e="#";for(let i=0,a;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(")","");let n=parseInt(a*255+"").toString(16);n=n.length===2?n:"0"+n,e+=n}e=e.toUpperCase()}return e}function n2(e,t){const{x:i,y:a,ex:s,width:n,height:r,center:l}=t.calculative.worldRect;let o=[{x:s,y:a+r/2},{x:i,y:a+r/2}];const{angle:u,colors:c}=Ya(t.calculative.lineGradientColors);let f=yc(u,n,r);return o.forEach(g=>{Gt(g,u,l)}),to(e,o,c,f)}function to(e,t,i,a){let s=Qx(t[0].x,t[0].y,t[1].x,t[1].y,a),n=e.createLinearGradient(s[0],s[1],s[2],s[3]);return i.forEach(r=>{n.addColorStop(r.i,r.color)}),n}function ua(e,t,i){let a=[];t.calculative.gradientColorStop?a=t.calculative.gradientColorStop:(a=Ya(t.calculative.lineGradientColors).colors,t.calculative.gradientColorStop=a),e.strokeStyle=to(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 jd(e,t){const i=t.calculative.worldAnchors;let a=t.calculative.lineWidth*(t.calculative.gradientSmooth||t.calculative.lineSmooth||0);for(let s=0;s<i.length-1;s++)if((t.lineName==="curve"||t.lineName==="mind")&&i[s].curvePoints){if(s>0){let l=i[s-1].curvePoints;l?yr(e,t,a,l[l.length-1],i[s],i[s].curvePoints[0]):yr(e,t,a,i[s-1],i[s],i[s].curvePoints[0]);let o=Ki(a,i[s],i[s].curvePoints[0]);ua(e,t,[o,i[s].curvePoints[1]])}else ua(e,t,[i[s],i[s].curvePoints[0]]),ua(e,t,[i[s].curvePoints[0],i[s].curvePoints[1]]);let n=i[s].curvePoints.length-1;for(let l=1;l<n;l++)ua(e,t,[i[s].curvePoints[l],i[s].curvePoints[l+1]]);let r=Ki(a,i[s+1],i[s].curvePoints[n]);ua(e,t,[i[s].curvePoints[n],r])}else{let n=i[s],r=i[s+1];if(s>0&&s<i.length-1){let o=i[s-1].curvePoints;o?yr(e,t,a,o[o.length-1],i[s],i[s+1]):yr(e,t,a,i[s-1],i[s],i[s+1])}s>0&&s<i.length-1&&(n=Ki(a,i[s],i[s+1])),s<i.length-2&&(r=Ki(a,i[s+1],i[s]));let l=!1;if(s===0&&t.fromLineCap&&t.fromLineCap!=="butt"&&(e.save(),l=!0,e.lineCap=t.fromLineCap),s!==0&&s===i.length-2&&t.toLineCap&&t.toLineCap!=="butt"&&(e.save(),l=!0,e.lineCap=t.toLineCap),ua(e,t,[n,r]),l&&e.restore(),i.length===2&&s===0){e.save(),l=!0,e.lineCap=t.toLineCap;let o=.1,u=.1;n.x-r.x===0?u=0:o=(n.y-r.y)/(n.x-r.x)*.1,ua(e,t,[{x:r.x-u,y:r.y-o},r]),e.restore()}}}function Ki(e,t,i){let 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 yr(e,t,i,a,s,n){let r=Ki(i,s,a),l=Ki(i,s,n),o={x:s.x,y:s.y},u=r2(t.calculative.canvas.store.data.smoothNum||20,r,o,l);for(let c=0;c<u.length-1;c++)ua(e,t,[{x:u[c].x,y:u[c].y},{x:u[c+1].x,y:u[c+1].y}])}function vf(e,t,i,a){let s=Ki(t,i,a),n={x:i.x,y:i.y};e.quadraticCurveTo(n.x,n.y,s.x,s.y)}function pc(e){const t=e.calculative.worldAnchors;let i=e.calculative.lineWidth*(e.calculative.gradientSmooth||e.calculative.lineSmooth||0);const a=new Path2D;for(let s=0;s<t.length-1;s++){t[s];let n=t[s+1];if(s==0&&a.moveTo(t[s].x,t[s].y),s>0&&s<t.length-1){let r=t[s-1].curvePoints;vf(a,i,t[s],t[s+1])}s>0&&s<t.length-1&&Ki(i,t[s],t[s+1]),s<t.length-2&&(n=Ki(i,t[s+1],t[s])),a.lineTo(n.x,n.y)}return a}function r2(e=100,t,i,a,s){let n=null;const r=[];!a&&!s?n=o2:a&&!s?n=l2:a&&s&&(n=c2);for(let l=0;l<e;l++)r.push(n(l/e,t,i,a,s));return s?r.push(s):a&&r.push(a),r}function o2(e,t,i){const{x:a,y:s}=t,{x:n,y:r}=i;let l=a+(n-a)*e,o=s+(r-s)*e;return{x:l,y:o}}function l2(e,t,i,a){const{x:s,y:n}=t,{x:r,y:l}=i,{x:o,y:u}=a;let c=(1-e)*(1-e)*s+2*e*(1-e)*r+e*e*o,f=(1-e)*(1-e)*n+2*e*(1-e)*l+e*e*u;return{x:c,y:f}}function c2(e,t,i,a,s){const{x:n,y:r}=t,{x:l,y:o}=s,{x:u,y:c}=i,{x:f,y:g}=a;let v=n*(1-e)*(1-e)*(1-e)+3*u*e*(1-e)*(1-e)+3*f*e*e*(1-e)+l*e*e*e,m=r*(1-e)*(1-e)*(1-e)+3*c*e*(1-e)*(1-e)+3*g*e*e*(1-e)+o*e*e*e;return{x:v,y:m}}function h2(e,t){const{worldRect:i,lineGradientFromColor:a,lineGradientToColor:s,lineGradientAngle:n}=t.calculative;return qd(e,i,a,s,n)}function qd(e,t,i,a,s){if(!i||!a)return;const{x:n,y:r,center:l,ex:o,ey:u}=t,c={x:n,y:l.y},f={x:o,y:l.y};s%90===0&&s%180?(c.x=l.x,f.x=l.x,s%270?(c.y=r,f.y=u):(c.y=u,f.y=r)):s&&(Gt(c,s,t.center),Gt(f,s,t.center));const g=e.createLinearGradient(c.x,c.y,f.x,f.y);return g.addColorStop(0,i),g.addColorStop(1,a),g}function u2(e){const{worldIconRect:t,iconWidth:i,iconHeight:a,imgNaturalWidth:s,imgNaturalHeight:n}=e.calculative;let{x:r,y:l,width:o,height:u}=t;if(i&&(o=i),a&&(u=a),s&&n&&e.imageRatio){const c=t.width/s,f=t.height/n,g=Math.min(c,f),v=s/n;i?u=i/v:a?o=a*v:(o=g*s,u=g*n)}switch(r+=(t.width-o)/2,l+=(t.height-u)/2,e.iconAlign){case"top":l=t.y;break;case"bottom":l=t.ey-u;break;case"left":r=t.x;break;case"right":r=t.ex-o;break;case"left-top":r=t.x,l=t.y;break;case"right-top":r=t.ex-o,l=t.y;break;case"left-bottom":r=t.x,l=t.ey-u;break;case"right-bottom":r=t.ex-o,l=t.ey-u;break}return{x:r,y:l,width:o,height:u}}function Es(e,t){const{x:i,y:a,width:s,height:n}=u2(t),{worldIconRect:r,iconRotate:l,img:o}=t.calculative;if(e.filter=t.filter,l){const{x:u,y:c}=r.center;e.translate(u,c),e.rotate(l*Math.PI/180),e.translate(-u,-c)}if(t.imageRadius){e.save();let u=t.calculative.imageRadius||0,c=u;const{x:f,y:g,width:v,height:m,ex:w,ey:y}=t.calculative.worldRect;u<1&&(u=v*u,c=m*c);let _=u<c?u:c;v<2*_&&(_=v/2),m<2*_&&(_=m/2),e.beginPath(),e.moveTo(f+_,g),e.arcTo(w,g,w,y,_),e.arcTo(w,y,f,y,_),e.arcTo(f,y,f,g,_),e.arcTo(f,g,w,g,_),e.clip(),e.drawImage(o,i,a,s,n),e.restore()}else{let u=a,c=0;if(t.thumbImg){let f=o.naturalWidth,g=o.naturalHeight;c=(n/s*f-g)/2,u=a+c}e.drawImage(o,i,u,s,n-2*c)}}function Ji(e,t){const{textColor:i,color:a}=e.calculative,{styles:s}=t;return i||a||s.textColor||s.color}function Yd(e,t){const{fontStyle:i,fontWeight:a,fontSize:s,fontFamily:n,lineHeight:r,text:l,hiddenText:o,canvas:u,textHasShadow:c,textBackground:f,textType:g}=t.calculative;if(t.input&&!t.text&&t.calculative.canvas.inputDiv.dataset.penId!==t.id){e.save(),e.font=Le({fontStyle:i,fontWeight:a,fontFamily:n,fontSize:s,lineHeight:r}),e.fillStyle=t.placeholderColor||"#c0c0c0";const D=t.calculative.worldTextRect;e.fillText(t.placeholder||"\u8BF7\u8F93\u5165",D.x,D.y+D.height/2),e.restore()}if(l==null||o)return;const v=u.store;e.save(),c||(e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0);let m;t.calculative.disabled?m=t.disabledTextColor||t.disabledColor||ke(.4,Ji(t,v)):t.calculative.hover?m=t.hoverTextColor||t.hoverColor||v.styles.hoverColor:t.calculative.active&&(m=t.activeTextColor||t.activeColor||v.styles.activeColor);let w;g===Rs.Linear?w=a2(e,t):g===Rs.Radial&&(w=i2(e,t)),e.fillStyle=m||w||Ji(t,v),e.font=Le({fontStyle:i,fontWeight:a,fontFamily:n||v.options.fontFamily,fontSize:s,lineHeight:r}),!t.calculative.textDrawRect&&vc(e,t);const{x:y,y:_,width:A,height:x}=t.calculative.textDrawRect;f&&(e.save(),e.fillStyle=f,e.fillRect(y,_,A,x),e.restore());const C=.55,T=t.textAlign||v.options.textAlign,I=s*r;t.calculative.textLines.forEach((D,B)=>{const V=t.calculative.textLineWidths[B];let Q=0;T==="center"?Q=(A-V)/2:T==="right"&&(Q=A-V),e.fillText(D,y+Q,_+(B+C)*I);const{textDecorationColor:F,textDecorationDash:R,textDecoration:P}=t;P&&f2(e,{x:y+Q,y:_+(B+C)*I,width:V},{textDecorationColor:F,textDecorationDash:R,fontSize:s});const{textStrickoutColor:M,textStrickoutDash:Y,textStrickout:Z}=t;Z&&d2(e,{x:y+Q,y:_+(B+C)*I,width:V},{textStrickoutColor:M,textStrickoutDash:Y,fontSize:s})}),e.restore()}function f2(e,t,i){const{textDecorationColor:a,textDecorationDash:s,fontSize:n}=i;let{x:r,y:l,width:o}=t;switch(e.textBaseline){case"top":l+=n;break;case"middle":l+=n/2;break}e.save(),e.beginPath(),e.strokeStyle=a||e.fillStyle,e.lineWidth=1,e.moveTo(r,l),e.setLineDash(s||[]),e.lineTo(r+o,l),e.stroke(),e.restore()}function d2(e,t,i){const{textStrickoutColor:a,textStrickoutDash:s,fontSize:n}=i;let{x:r,y:l,width:o}=t;switch(e.textBaseline){case"top":l+=n/2;break;case"bottom":l-=n/2;break}e.save(),e.beginPath(),e.strokeStyle=a||e.fillStyle,e.lineWidth=1,e.moveTo(r,l),e.setLineDash(s||[]),e.lineTo(r+o,l),e.stroke(),e.restore()}function Kd(e,t,i){if(i==null)return;const{fontStyle:a,fontWeight:s,fontSize:n,fontFamily:r,lineHeight:l,canvas:o}=t.calculative,u=o.store;e.save();let c;t.calculative.hover?c=t.hoverTextColor||t.hoverColor||u.styles.hoverColor:t.calculative.active&&(c=t.activeTextColor||t.activeColor||u.styles.activeColor),e.fillStyle=c||Ji(t,u),e.font=Le({fontStyle:a,fontWeight:s,fontFamily:r||u.options.fontFamily,fontSize:n,lineHeight:l});const f=e.measureText(i).width;let g,v;for(const m of t.calculative.worldAnchors){if(!v){v=m;continue}const w=Qr(v,m),y=Math.floor(w/f);g="";for(let A=0;A<y;A++)g+=i;const _=ui(v,m)-270;if(e.save(),_%360!==0){const{x:A,y:x}=v;e.translate(A,x);let C=_*Math.PI/180;e.rotate(C),e.translate(-A,-x)}e.fillText(g,v.x,v.y+l/2),e.restore(),v=m}e.restore()}function Xd(e,t){const i=t.calculative.canvas.store;e.save(),e.shadowColor="",e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0,e.textAlign="center",e.textBaseline="middle";const a=t.calculative.worldIconRect;let s=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":s=a.x,e.textAlign="left";break;case"right":s=a.ex,e.textAlign="right";break;case"left-top":s=a.x,n=a.y,e.textAlign="left",e.textBaseline="top";break;case"right-top":s=a.ex,n=a.y,e.textAlign="right",e.textBaseline="top";break;case"left-bottom":s=a.x,n=a.ey,e.textAlign="left",e.textBaseline="bottom";break;case"right-bottom":s=a.ex,n=a.ey,e.textAlign="right",e.textBaseline="bottom";break}const r=t.calculative.iconWeight;let l;const o=t.calculative.iconFamily;t.calculative.iconSize>0?l=t.calculative.iconSize:a.width>a.height?l=a.height:l=a.width,e.font=Le({fontSize:l,fontWeight:r,fontFamily:o}),e.fillStyle=t.calculative.iconColor||Ji(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,s,n),e.restore()}function Gd(e,t){if(!t.input)return;const i=t.calculative.canvas.store.data.scale,a=t.calculative.canvas.inputDiv.dataset.penId,{x:s,y:n,width:r,height:l}=t.calculative.worldRect;e.save(),e.beginPath(),t.id===a?(e.moveTo(s+r-20*i,n+l/2+2*i),e.lineTo(s+r-14*i,n+l/2-4*i),e.lineTo(s+r-8*i,n+l/2+2*i)):(e.moveTo(s+r-20*i,n+l/2-4*i),e.lineTo(s+r-14*i,n+l/2+2*i),e.lineTo(s+r-8*i,n+l/2-4*i)),e.stroke(),e.restore()}function Le({fontStyle:e="normal",textDecoration:t="normal",fontWeight:i="normal",fontSize:a=12,fontFamily:s="Arial",lineHeight:n=1}={}){return`${e} ${t} ${i} ${a}px/${n} ${s}`}function za(e,t){const{x:i,ex:a,y:s,ey:n}=t.calculative.worldRect||{};t.calculative.flipX&&(e.translate(i+a,0),e.scale(-1,1)),t.calculative.flipY&&(e.translate(0,s+n),e.scale(1,-1))}function Gi(e,t,i=!1){const{x:a,y:s}=t.calculative.worldRect.pivot||t.calculative.worldRect.center;e.translate(a,s);let n=t.calculative.rotate*Math.PI/180;i||(t.calculative.flipX&&(n*=-1),t.calculative.flipY&&(n*=-1)),e.rotate(n),e.translate(-a,-s)}function Sa(e,t,i){e.save(),e.translate(.5,.5),e.beginPath(),L2(e,t);const a=t.calculative.canvas.store,s=t.textFlip||a.options.textFlip,n=t.textRotate||a.options.textRotate;(!s||!n)&&e.save(),za(e,t),t.calculative.rotate&&t.name!=="line"&&Gi(e,t),(t.calculative.lineWidth>1||i)&&(e.lineWidth=t.calculative.lineWidth),T2(e,a,t);let r,l=!1,o;t.calculative.disabled?(o=t.disabledColor||a.styles.disabledColor||ke(.4,t.calculative.color||a.styles.color),r=t.disabledBackground||a.styles.disabledBackground||ke(.4,t.calculative.background||a.styles.penBackground)):t.mouseDownValid&&t.calculative.mouseDown?(o=t.mouseDownColor||ke(-.4,t.calculative.color||a.styles.color),r=t.mouseDownBackground||ke(-.4,t.calculative.background||a.styles.penBackground)):t.switch&&t.calculative.checked?t.calculative.bkType||(r=t.onBackground):t.calculative.hover?(o=t.hoverColor||a.styles.hoverColor,r=t.hoverBackground||a.styles.hoverBackground):t.calculative.active?(o=t.activeColor||a.styles.activeColor,r=t.activeBackground||a.styles.activeBackground):t.calculative.isDock&&(t.type===$t.Line?o=a.styles.dockPenColor:r=Wr(a.styles.dockPenColor,.2));const u=t.calculative.strokeImg;if(t.calculative.strokeImage&&u)e.strokeStyle=o||e.createPattern(u,"repeat");else{let f;t.calculative.strokeType?t.calculative.lineGradientColors?t.name==="line"?l=!0:t.calculative.lineGradient?f=t.calculative.lineGradient:(f=n2(e,t),t.calculative.lineGradient=f):f=h2(e,t):f=t.calculative.color||(t.type?a.data.lineColor:"")||a.styles.color,e.strokeStyle=o||f}const c=t.calculative.backgroundImg;if(t.calculative.backgroundImage&&c)e.fillStyle=r||e.createPattern(c,"repeat"),r=!0;else{let f;t.calculative.bkType===Rs.Linear?t.calculative.gradientColors?t.calculative.gradient?f=t.calculative.gradient:(f=e2(e,t),t.calculative.gradient=f):f=Zx(e,t):t.calculative.bkType===Rs.Radial?t.calculative.gradientColors?t.calculative.radialGradient?f=t.calculative.radialGradient:(f=t2(e,t),t.calculative.radialGradient=f):f=Jx(e,t):f=t.calculative.background||a.styles.penBackground,e.fillStyle=r||f,r=!!f}if(Zd(e,t),Jd(e,t),Ha(e,t),t.calculative.lineDash&&e.setLineDash(t.calculative.lineDash.map(f=>f*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?(jd(e,t),tg(!0,e,t,a)):(Qd(!0,e,t,a,r),og(e,t)),!(t.image&&t.calculative.img)&&t.calculative.icon&&Xd(e,t),t.dropdownList&&Gd(e,t),(!s||!n)&&e.restore(),s&&!n&&za(e,t),!s&&n&&t.calculative.rotate&&t.name!=="line"&&Gi(e,t,!0),Yd(e,t),t.type===$t.Line&&t.fillTexts)for(const f of t.fillTexts)Kd(e,t,f);e.restore()}function Zd(e,t){const i=t.lineCap||(t.type?"round":"square");i?e.lineCap=i:t.type&&(e.lineCap="round")}function Jd(e,t){const i=t.lineJoin;i?e.lineJoin=i:t.type&&(e.lineJoin="round")}function $r(e,t,i,a){var u;e.save(),i&&e.translate(-i.x,-i.y),(u=e.setAttrs)==null||u.call(e,t);let s=!1;const n=t.calculative.canvas.store,r=t.textFlip||n.options.textFlip,l=t.textRotate||n.options.textRotate;e.beginPath(),(!r||!l)&&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"&&Gi(e,t),(t.calculative.lineWidth>1||a)&&(e.lineWidth=t.calculative.lineWidth);let o;if(t.calculative.hover)e.strokeStyle=t.hoverColor||n.styles.hoverColor,e.fillStyle=t.hoverBackground||n.styles.hoverBackground,o=t.hoverBackground||n.styles.hoverBackground;else if(t.calculative.active)e.strokeStyle=t.activeColor||n.styles.activeColor,e.fillStyle=t.activeBackground||n.styles.activeBackground,o=t.activeBackground||n.styles.activeBackground;else{if(t.strokeImage)t.calculative.strokeImg&&(e.strokeStyle=e.createPattern(t.calculative.strokeImg,"repeat"),o=!0);else{let c;t.calculative.strokeType&&t.calculative.lineGradientColors&&t.name==="line"?s=!0:c=t.calculative.color||n.styles.color,e.strokeStyle=c}t.backgroundImage?t.calculative.backgroundImg&&(e.fillStyle=e.createPattern(t.calculative.backgroundImg,"repeat"),o=!0):(e.fillStyle=t.background,o=!!t.background)}if(Zd(e,t),Jd(e,t),Ha(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),s?(jd(e,t),tg(!0,e,t,n)):(Qd(!1,e,t,n,o),og(e,t)),t.calculative.img?(e.save(),e.shadowColor="",e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0,Es(e,t),e.restore()):t.calculative.icon&&Xd(e,t),t.dropdownList&&Gd(e,t),(!r||!l)&&e.restore(),r&&!l&&(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))),!r&&l&&t.calculative.rotate&&t.name!=="line"&&Gi(e,t,!0),Yd(e,t),t.type===$t.Line&&t.fillTexts)for(const c of t.fillTexts)Kd(e,t,c);e.restore()}function Qd(e=!0,t,i,a,s){if(i.name==="drawCommand")return;const n=e?a.path2dMap.get(i):Et.path2dDraws[i.name];let r=null,l=null;if(i.type===$t.Line&&(i.fromLineCap&&i.fromLineCap!=="butt"&&(t.lineCap="butt",r=new Path2D,r.moveTo(i.calculative.worldAnchors[0].x,i.calculative.worldAnchors[0].y),r.lineTo(i.calculative.worldAnchors[0].x,i.calculative.worldAnchors[0].y)),i.toLineCap&&i.toLineCap!=="butt"&&(t.lineCap="butt",l=new Path2D,l.moveTo(i.calculative.worldAnchors[i.calculative.worldAnchors.length-1].x,i.calculative.worldAnchors[i.calculative.worldAnchors.length-1].y),l.lineTo(i.calculative.worldAnchors[i.calculative.worldAnchors.length-1].x,i.calculative.worldAnchors[i.calculative.worldAnchors.length-1].y))),n){if(i.type===$t.Line&&i.borderWidth){t.save(),t.beginPath();const u=i.calculative.lineWidth+i.calculative.borderWidth;t.lineWidth=u,t.strokeStyle=i.borderColor,r&&(t.save(),t.lineCap=i.fromLineCap,t.stroke(r),t.restore()),n instanceof Path2D?(s&&t.fill(n),u&&t.stroke(n)):(n(i,t),s&&t.fill(),u&&t.stroke()),l&&(t.save(),t.lineCap=i.toLineCap,t.stroke(l),t.restore()),t.restore()}n instanceof Path2D?i.type?i.close&&s&&t.fill(n):s&&t.fill(n):(t.save(),n(i,t),s&&t.fill(),t.restore());const o=i.calculative.progress;if(o!=null){t.save();const{ex:u,x:c,y:f,width:g,height:v,ey:m}=i.calculative.worldRect;let w=null;if(i.calculative.verticalProgress?w=i.reverseProgress?t.createLinearGradient(c,f,c,f+v*o):t.createLinearGradient(c,m,c,f+v*(1-o)):w=i.reverseProgress?t.createLinearGradient(u,f,c+g*(1-o),f):t.createLinearGradient(c,f,c+g*o,f),i.calculative.progressGradientColors){const{colors:y}=Ya(i.calculative.progressGradientColors);y.forEach(_=>{w.addColorStop(_.i,_.color)})}else{const y=i.calculative.progressColor||i.calculative.color||a.options.activeColor||a.data.color;w.addColorStop(0,y),w.addColorStop(1,y)}w.addColorStop(1,"transparent"),t.fillStyle=w,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")&&(r&&(t.save(),t.lineCap=i.fromLineCap,t.stroke(r),t.restore()),t.stroke(n),l&&(t.save(),t.lineCap=i.toLineCap,t.stroke(l),t.restore())):(n(i,t),t.stroke())),i.type){if(i.calculative.animatePos){if(t.save(),eg(t,i,a),i.lineAnimateType===We.Arrow||i.lineAnimateType===We.WaterDrop){let u=gg(i,t);u instanceof Path2D?(t.stroke(u),t.fill(u)):(t.stroke(),t.fill())}else n instanceof Path2D?(r&&!i.lineAnimateType&&(t.save(),t.lineCap=i.fromLineCap,t.stroke(r),t.restore()),t.lineCap=i.lineCap,t.stroke(n)):(n(i,t),t.stroke());t.restore()}i.fromArrow&&Ud(t,i,a),i.toArrow&&Vd(t,i,a),i.calculative.active&&!i.calculative.pencil&&!a.options.disableAnchor&&!a.data.locked&&ig(t,i)}}}function tg(e=!0,t,i,a){const s=e?a.path2dMap.get(i):Et.path2dDraws[i.name];if(s&&i.type){if(i.calculative.animatePos){if(t.save(),eg(t,i,a),t.beginPath(),s instanceof Path2D)if(i.lineName==="polyline"||i.lineName==="line")if(i.lineAnimateType===We.Arrow||i.lineAnimateType===We.WaterDrop){const n=gg(i);t.stroke(n),t.fill(n)}else i.calculative.gradientSmooth||i.calculative.lineSmooth?(i.calculative.gradientAnimatePath||(i.calculative.gradientAnimatePath=pc(i)),i.calculative.gradientAnimatePath instanceof Path2D&&t.stroke(i.calculative.gradientAnimatePath)):t.stroke(s);else t.stroke(s);else s(i,t),t.stroke();t.restore()}i.fromArrow&&Ud(t,i,a),i.toArrow&&Vd(t,i,a),i.calculative.active&&!i.calculative.pencil&&!a.options.disableAnchor&&!a.data.locked&&ig(t,i)}}function eg(e,t,i){var s;e.strokeStyle=t.animateColor||i.styles.animateColor,t.animateShadow&&(e.shadowBlur=t.animateShadowBlur||t.animateLineWidth||6,e.shadowColor=t.animateShadowColor||t.animateColor||i.styles.animateColor),t.calculative.animateLineWidth&&(e.lineWidth=t.calculative.animateLineWidth*i.data.scale);let a=0;switch(t.lineAnimateType){case We.Beads:t.animateReverse?e.lineDashOffset=t.calculative.animatePos:e.lineDashOffset=t.length-t.calculative.animatePos,a=t.calculative.lineWidth||5,a<5&&(a=5);const n=t.animateLineDash&&t.animateLineDash.map(r=>r*a/5);e.setLineDash(n||[a,a*2]);break;case We.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 We.Arrow:e.fillStyle=t.animateColor||i.styles.animateColor,e.lineWidth=1;break;case We.WaterDrop:e.fillStyle=t.animateColor||i.styles.animateColor,e.lineWidth=1;break;case We.Custom:switch(t.lineAnimateTargetType){case ps.Image:if((s=t.lineAnimateImages)!=null||(t.lineAnimateImages=[]),t.lineAnimateImages.length>0){const o=t.lineAnimateImages.map((u,c)=>{const f=Et.htmlElements[u];if(!f)t.calculative.canvas.__loadImage(u);else return f});pr(e,t,"image",o)}break;case ps.Icon:const r=t.lineAnimateIcon;pr(e,t,"icon",r);break;case ps.Pen:t.lineAnimatePens&&pr(e,t,"pen",t.lineAnimatePens);break;case ps.Element:const l=t.lineAnimateElement;pr(e,t,"element",l)}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 pr(e,t,i,a){let s=null;switch(i){case"image":s=g2(a);break;case"icon":s=m2(a);break;case"pen":let n=t.calculative.canvas.find(a);t.lineAnimateElementCount=n.length,s=v2(n);break;case"element":if(s=Et.lineAnimateDraws[a],!s)return;break}y2(e,t,s)}function g2(e){return function(t,i,a,s){const n=i.calculative.canvas.store.data.scale,r=i.lineAnimateElementWidth||10,l=i.lineAnimateElementHeight||10,o=e[s%e.length];!o||(t.beginPath(),t.translate(a.x+r/2*n,a.y+l/2*n),t.rotate(a.rotate*Math.PI/180),t.scale(n,n),t.translate(-(r/2*n),-(l/2*n)),t.drawImage(o,0,0,r,l))}}function v2(e){return function(t,i,a,s){const n=e[s%e.length];if(!n)return;const r=i.calculative.canvas.store.data.scale,l=i.calculative.canvas.store.data.origin,o=i.calculative.canvas.parent,u=n.width,c=n.height,f=a.x-u/2,g=a.y-c/2,v=(f-l.x)/r,m=(g-l.y)/r,w=u/r,y=c/r,_={x:v,y:m,width:w,height:y,rotate:a.rotate};o.setValue({id:n.id,..._})}}function m2(e){return function(t,i,a,s){const n=i.calculative.canvas.store.data.scale,r=i.lineAnimateElementWidth||10,l=i.lineAnimateElementHeight||10;t.beginPath(),t.translate(a.x+r/2*n,a.y+l/2*n),t.rotate(a.rotate*Math.PI/180),t.scale(n,n),t.translate(-(r/2*n),-(l/2*n));const o=i.calculative.iconWeight;let u;const c=i.calculative.iconFamily;u=i.calculative.iconSize||Math.max(i.lineAnimateElementWidth||0,i.lineAnimateElementHeight||0)||10,t.font=Le({fontSize:u,fontWeight:o,fontFamily:c}),t.fillStyle=i.calculative.iconColor||Ji(i,i.calculative.canvas.parent.store),i.calculative.iconRotate&&t.rotate(i.calculative.iconRotate*Math.PI/180),t.beginPath(),t.fillText(e,0,0)}}function y2(e,t,i){var l;const a=Array.isArray(t.lineAnimateDash)?t.lineAnimateDash:((l=t.lineAnimateDash)==null?void 0:l.split(",").map(o=>Number(o)))||[10,20],s=t.calculative.canvas.store.data.scale,n=Yr(t)/s;p2(n,a,t.lineAnimateDashOffset,t.lineAnimateElementCount).forEach((o,u)=>{const c=w2(t,o.start);if(!!c)try{e.save(),i(e,t,c,u),e.restore()}catch(f){e.restore(),console.warn(f)}})}function p2(e,t,i=0,a,s=0){const n=[];if(!t||t.length===0)return n.push({start:0,end:e,isDash:!0}),n;const r=t.reduce((c,f)=>c+f,0);let l=(-i+s)%r;l<0&&(l+=r);let o=0,u=0;for(a||(a=1/0);u<e&&o<a;)for(let c=0;c<t.length;c++){const f=t[c],g=c%2===0;let v=u,m=u+f-l;if(m>e&&(m=e),g&&m>v){const w=(v+s)%e,y=(m+s)%e;n.push({start:w,end:y,isDash:!0}),o+=1}if(u=m,l=0,u>=e||o>=a)break}return n}function w2(e,t=0){let i,a=null;if(e.calculative.worldAnchors.forEach(r=>{a&&(i=Bf(i,a,a.next,r.prev,r)),a=r}),e.close){let r=e.calculative.worldAnchors[0];i=Bf(i,a,a.next,r.prev,r)}let s=0;return e.animateReverse?s=e.length-e.calculative.animatePos-t*e.calculative.canvas.store.data.scale:s=e.calculative.animatePos-t*e.calculative.canvas.store.data.scale,T_(i,s)}function ig(e,t){const i=t.calculative.canvas.store;e.save(),e.lineWidth=1,e.fillStyle=t.activeColor||i.styles.activeColor,t.calculative.worldAnchors.forEach(a=>{!a.hidden&&!a.isTemp&&b2(e,a,t)}),e.restore()}function b2(e,t,i){if(!t)return;const a=i.calculative.canvas.store.activeAnchor===i.calculative.activeAnchor&&i.calculative.activeAnchor===t;let s=3;i.calculative.lineWidth>3&&(s=i.calculative.lineWidth),i.anchorRadius&&(s=i.anchorRadius),t.radius&&(s=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,s,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,s,0,Math.PI*2),e.fill(),e.stroke(),e.restore(),e.beginPath(),e.arc(t.x,t.y,s,0,Math.PI*2),e.fill(),e.stroke()),e.beginPath(),e.arc(t.x,t.y,s,0,Math.PI*2),e.fill(),e.stroke()):(e.save(),e.fillStyle="#ffffff",e.beginPath(),e.arc(t.x,t.y,s,0,Math.PI*2),e.fill(),e.stroke(),e.restore())}function ag(e){const t=e.calculative.canvas.store;let 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,re(i),Qt(i),e.pivot&&Ql(i,e.pivot);else{const a=t.pens[e.parentId];let s=a.calculative.worldRect;s||(s=ag(a)),i.x=s.x+s.width*e.x,i.y=s.y+s.height*e.y,i.width=s.width*e.width,i.height=s.height*e.height,a.flipX&&(i.x=s.width-(i.x-s.x+i.width)+s.x),a.flipY&&(i.y=s.height-(i.y-s.y+i.height)+s.y),re(i),i.rotate=s.rotate+e.rotate,Qt(i),e.pivot&&Ql(i,e.pivot)}return e.calculative.worldRect=i,wc(e,i),i}function wc(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 Ir(e){const t=ht(e.calculative.worldRect);if(delete t.pivot,!e.parentId){Object.assign(e,t);return}const a=e.calculative.canvas.store.pens[e.parentId].calculative.worldRect;Object.assign(e,fa(t,a))}function As(e){const t=e.calculative.canvas.store;let i=[];if(e.anchors){let a=ht(e.anchors);e.flipX&&a.forEach(s=>{s.x=.5-(s.x-.5)}),e.flipY&&a.forEach(s=>{s.y=.5-(s.y-.5)}),a.forEach(s=>{i.push(x2(e,s))})}if(!i.length&&!e.type&&!e.calculative.canvas.parent.isCombine(e)){const{x:a,y:s,width:n,height:r}=e.calculative.worldRect;i=t.options.defaultAnchors.map((l,o)=>({id:`${o}`,penId:e.id,x:a+n*l.x,y:s+r*l.y}))}e.calculative.rotate&&e.name!=="line"&&i.forEach(a=>{Gt(a,e.calculative.rotate,e.calculative.worldRect.pivot||e.calculative.worldRect.center)}),(!e.type||e.anchors)&&(e.calculative.worldAnchors=i),e.calculative.activeAnchor&&i.length&&(e.calculative.activeAnchor=i.find(a=>{a.id,e.calculative.activeAnchor.id})),e.calculative.gradientAnimatePath=void 0}function sg(e){var t;if((t=e.children)!=null&&t.length){let i=e.calculative.worldRect;e.children.forEach(a=>{const s=e.calculative.canvas.store.pens[a];s.calculative.initRect&&s.calculative.initRelativeRect&&(s.calculative.initRect.x=i.x+i.width*s.calculative.initRelativeRect.x,s.calculative.initRect.y=i.y+i.height*s.calculative.initRelativeRect.y,s.calculative.initRect.ex=s.calculative.initRect.x+i.width*s.calculative.initRelativeRect.width,s.calculative.initRect.ey=s.calculative.initRect.y+i.height+s.calculative.initRelativeRect.height,Qt(s.calculative.initRect)),sg(s)})}}function x2(e,t){const i={...t},{x:a,y:s,width:n,height:r}=e.calculative.worldRect;return i.x=a+n*t.x,i.y=s+r*t.y,t.prev&&(i.prev={penId:e.id,connectTo:t.prev.connectTo,x:a+n*t.prev.x,y:s+r*t.prev.y}),t.next&&(i.next={penId:e.id,connectTo:t.next.connectTo,x:a+n*t.next.x,y:s+r*t.next.y}),i}function mf(e,t){const{paddingTop:i,paddingBottom:a,paddingLeft:s,paddingRight:n}=t.calculative;let r=s,l=i,o=t.calculative.worldRect.width-s-n,u=t.calculative.worldRect.height-i-a,c=t.calculative.iconLeft,f=t.calculative.iconTop;c&&Math.abs(c)<1&&(c=t.calculative.worldRect.width*c),f&&Math.abs(f)<1&&(f=t.calculative.worldRect.height*f),r+=c||0,l+=f||0,o-=c||0,u-=f||0;let g=t.calculative.iconRotate||0;if(t.parentId){const v=e[t.parentId].calculative;v&&(g+=v.rotate,g%=360)}r=t.calculative.worldRect.x+r,l=t.calculative.worldRect.y+l,t.calculative.worldIconRect={x:r,y:l,width:o,height:u,rotate:g},re(t.calculative.worldIconRect),Qt(t.calculative.worldIconRect)}function ds(e,t,i){vn(e.calculative.worldRect,t,i,e.pivot),e.calculative.initRect&&vn(e.calculative.initRect,t,i,e.pivot),ng(e,t,i),e.calculative.x&&Hr(e.calculative,t,i),e.type&&As(e)}function ng(e,t,i){var a;!e||(a=e.children)!=null&&a.length&&e.children.forEach(s=>{const n=e.calculative.canvas.store.pens[s];n&&(n.calculative.initRect&&vn(n.calculative.initRect,t,i),ng(n,t,i))})}function _2(e,t){e.anchors||(e.anchors=[]),e.calculative.worldAnchors||(e.calculative.worldAnchors=[]);const 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&&Gt(t,-e.rotate,e.calculative.worldRect.center);const 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 E2(e,t,i){e.anchors||(e.anchors=[]),e.calculative.worldAnchors||(e.calculative.worldAnchors=[]);const a=__(e,t,i);return e.calculative.worldAnchors.splice(i+1,0,a),e.anchors.splice(i+1,0,rn(a,e.calculative.worldRect)),e.calculative.activeAnchor=a,a}function A2(e,t){if(!e||!e.calculative.worldAnchors)return;let i=e.calculative.worldAnchors.findIndex(a=>a.id===t.id);i>-1&&e.calculative.worldAnchors.splice(i,1),i=e.anchors.findIndex(a=>a.id===t.id),i>-1&&e.anchors.splice(i,1)}function Ts(e,t){if(!t||!t.calculative||!t.calculative.worldRect.center)return It.None;if(e.anchorId){let i=t.anchors.filter(a=>a.id===e.anchorId);if(i.length&&i[0].direction>-1)return i[0].direction}return mx(e,t.calculative.worldRect.center)}function bs(e,t){let i=1/0,a;return e.calculative.worldAnchors.forEach(s=>{const n=Qr(t,s);i>n&&(i=n,a=s)}),a}function yf(e,t,i){e.x+=t,e.y+=i,e.anchors&&e.anchors.forEach(a=>{nn(a,t,i)}),e.calculative.worldAnchors&&e.calculative.worldAnchors.forEach(a=>{nn(a,t,i)})}function bc(e){if(e&&e.calculative&&e.calculative.worldAnchors.length){let t=Vt(e);if(!e.anchors||!e.anchors.length)for(;e.calculative.worldAnchors.length&&t!==e.calculative.activeAnchor;)e.calculative.worldAnchors.pop(),t=Vt(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 we(e,t,i,a){var l,o,u,c,f,g;if(!e||!t||!i||!a||t.twoWay===Ae.DisableConnected||t.twoWay===Ae.Disable||a.twoWay===Ae.DisableConnectTo||a.twoWay===Ae.Disable)return;if(t.twoWay===Ae.In){if(i.calculative.worldAnchors.length===1)return;const v=Vt(i);if(a.id!==v.id)return}if(t.twoWay===Ae.Out){const v=le(i);if(a.id!==v.id)return}if(a.connectTo===e.id&&a.anchorId===t.id)return;if(a.connectTo){const v=e.calculative.canvas.store.pens[a.connectTo];xs(v,Ia(v,a.anchorId),i,a)}e.connectedLines||(e.connectedLines=[]),e.connectedLines.findIndex(v=>v.lineId===i.id&&v.lineAnchor===a.id&&v.anchor===t.id)<0&&e.connectedLines.push({lineId:i.id,lineAnchor:a.id,anchor:t.id}),a.connectTo=e.id,a.anchorId=t.id,e.type&&we(i,a,e,t),e.calculative.canvas.store.emitter.emit("connectLine",{line:i,lineAnchor:a,pen:e,anchor:t});let n=((l=i.calculative.worldAnchors)==null?void 0:l.length)>=2?(o=i.calculative.worldAnchors)==null?void 0:o[0].connectTo:void 0,r=((u=i.calculative.worldAnchors)==null?void 0:u.length)>=2?(f=i.calculative.canvas.store.pens[(c=i.calculative.worldAnchors)==null?void 0:c[0].connectTo])==null?void 0:f.anchors.find(v=>{var m;return v.id===((m=i.calculative.worldAnchors)==null?void 0:m[0].anchorId)}):void 0;return(g=e.onConnectLine)==null||g.call(e,e,{line:i,lineAnchor:a,pen:e,anchor:t,fromPen:n,fromAnchor:r}),!0}function xs(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]=ht(e.connectedLines)),e.connectedLines.forEach((s,n,r)=>{(s.lineId===i.id||s.lineId===i.id)&&s.lineAnchor===a.id&&s.anchor===t.id&&r.splice(n,1)}),a.connectTo=void 0,a.anchorId=void 0,e.type&&t.connectTo===i.id&&t.anchorId===a.id&&xs(i,a,e,t),e.calculative.canvas.store.emitter.emit("disconnectLine",{line:i,lineAnchor:a,pen:e,anchor:t}),!0}function Ia(e,t){var i;if(!(!e||!t))return(i=e.calculative.worldAnchors)==null?void 0:i.find(a=>a.id===t)}function le(e){if(!(!e||!e.calculative.worldAnchors))return e.calculative.worldAnchors[0]}function Vt(e){if(!(!e||!e.calculative.worldAnchors))return e.calculative.worldAnchors[e.calculative.worldAnchors.length-1]}function k2(e,t){var a,s;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;for(const n of e.frames){e.calculative.duration+=n.duration;for(const r in n)r!=="duration"&&!e[r]&&r==="scale"&&(e[r]=1)}}if(e.animateCycle||(e.animateCycle=1/0),e.calculative.start){let n=0;const r=Math.ceil((t-e.calculative.start)/e.calculative.duration);if(r>e.animateCycle)return e.currentAnimation=void 0,e.calculative.start=void 0,wf(e,1),0;const l=(t-e.calculative.start)%e.calculative.duration||e.calculative.duration;let o=0;for(const f of e.frames)if(o+=f.duration,l>o)++n;else break;if(!e.frames[n])return!0;let u=!1;n!==e.calculative.frameIndex&&(u=!0,e.calculative.frameIndex=n,e.calculative.frameDuration=e.frames[n].duration,n>0&&(e.calculative.frameStart+=e.frames[n-1].duration),e.calculative.frameEnd=e.calculative.frameStart+e.calculative.frameDuration);let c=!1;if(r>e.calculative.cycleIndex&&(e.calculative.cycleIndex=r,e.calculative.frameStart=e.calculative.start+e.calculative.duration*(r-1),c=!0),u||c)if(e.calculative.x=e.calculative.initRect.x,e.calculative.y=e.calculative.initRect.y,((s=e.children)==null?void 0:s.length)&&!e.parentId?e.calculative.canvas.rotatePen(e,(e.calculative.initRect.rotate||0)-(e.calculative.rotate||0),e.calculative.initRect):e.calculative.rotate=e.calculative.initRect.rotate||0,n>0){e.prevFrame={};const f=e.frames[n-1];for(const g in f)e.prevFrame[g]=f[g];Object.assign(e.prevFrame,{rotate:f.rotate||0,x:f.x||0,y:f.y||0,scale:f.scale||1})}else pf(e)}else{if(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=ht(e.calculative.worldRect),e.parentId&&(e.calculative.initRelativeRect={x:e.x,y:e.y,width:e.width,height:e.height}),(a=e.children)!=null&&a.length){const n=e.calculative.canvas.store;e.calculative.childrenVisible={},e.children.forEach(r=>{e.calculative.childrenVisible[r]=n.pens[r].visible})}e.calculative.initRect.rotate=e.calculative.rotate||0,pf(e)}const i=(t-e.calculative.frameStart)/e.calculative.frameDuration%1;return i>0&&wf(e,i),!0}function pf(e){e.prevFrame={};for(const 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 wf(e,t){var s,n,r,l,o,u;if(t<0)return;t>1&&(t=1);const i=e.frames[e.calculative.frameIndex],a=e.calculative.canvas.store.data.scale;for(const c in i)if(c!=="duration"){if(c==="scale"){e.calculative.worldRect=ht(e.calculative.initRect),vn(e.calculative.worldRect,e.prevFrame.scale,e.calculative.worldRect.center);const f=e.prevFrame.scale+(i[c]-e.prevFrame.scale)*t;vn(e.calculative.worldRect,f/e.prevFrame.scale,e.calculative.worldRect.center),e.calculative.patchFlags=!0}else if(c==="x"){const f=Zs(e,c,e.calculative.frameIndex)*a;e.calculative.worldRect.x=e.calculative.initRect.x+f,e.calculative.worldRect.ex=e.calculative.initRect.ex+f,e.calculative.worldRect.center.x=e.calculative.initRect.center.x+f,(s=e.calculative.worldRect.pivot)!=null&&s.x&&(e.calculative.worldRect.pivot.x=((n=e.calculative.initRect.pivot)==null?void 0:n.x)+f),Da(e.calculative.worldRect,i[c]*t*a,0),e.calculative.patchFlags=!0}else if(c==="y"){const f=Zs(e,c,e.calculative.frameIndex)*a;e.calculative.worldRect.y=e.calculative.initRect.y+f,e.calculative.worldRect.ey=e.calculative.initRect.ey+f,e.calculative.worldRect.center.y=e.calculative.initRect.center.y+f,(r=e.calculative.worldRect.pivot)!=null&&r.x&&(e.calculative.worldRect.pivot.y=((l=e.calculative.initRect.pivot)==null?void 0:l.y)+f),Da(e.calculative.worldRect,0,i[c]*t*a),e.calculative.patchFlags=!0}else if(c==="width"){const f=Zs(e,c,e.calculative.frameIndex)*a;e.calculative.worldRect.width=e.calculative.initRect.width+f,e.calculative.worldRect.ex=e.calculative.initRect.ex+f,e.calculative.worldRect.center.x=e.calculative.initRect.center.x+f;let g=i[c]*t*a;e.calculative.worldRect.width+=g,e.calculative.worldRect.ex+=g,e.calculative.worldRect.center.x+=g,e.calculative.patchFlags=!0}else if(c==="height"){const f=Zs(e,c,e.calculative.frameIndex)*a;e.calculative.worldRect.height=e.calculative.initRect.height+f,e.calculative.worldRect.ey=e.calculative.initRect.ey+f,e.calculative.worldRect.center.y=e.calculative.initRect.center.y+f;let g=i[c]*t*a;e.calculative.worldRect.height+=g,e.calculative.worldRect.ey+=g,e.calculative.worldRect.center.y+=g,e.calculative.patchFlags=!0}else if(c==="rotate"){e.prevFrame[c]>=360&&(e.prevFrame[c]%=360);const f=Zs(e,c,e.calculative.frameIndex),g=(e.calculative.initRect.rotate+f+i[c]*t)%360-(e.calculative.rotate||0);(o=e.children)!=null&&o.length?e.calculative.canvas.rotatePen(e,g,e.calculative.initRect):e.calculative.rotate=(e.calculative.initRect.rotate+f+i[c]*t)%360,e.calculative.patchFlags=!0}else if(c==="image")e.image=i.image,e.calculative.image=void 0,e.calculative.canvas.loadImage(e),e.canvasLayer===zt.CanvasImageBottom?e.calculative.canvas.canvasImageBottom.init():e.canvasLayer===zt.CanvasImage&&e.calculative.canvas.canvasImage.init();else if(C2(i[c],c,e)){e.prevFrame[c]==null&&(c==="globalAlpha"?e.prevFrame[c]=1:e.prevFrame[c]=0);const f=e.prevFrame[c]+(i[c]-e.prevFrame[c])*t;e.calculative[c]=Math.round(f*100)/100}else{if(c==="visible"&&!e.calculative.image){if((u=e.children)!=null&&u.length){const g=Qe(e,e.calculative.canvas.store);e.calculative.canvas.initImageCanvas(g)}}e.calculative[c]=i[c];const f={};f[c]=i[c],xc(e,f)}c==="text"&&_n(e)}}function C2(e,t,i){const a=["strokeType","bkType","showChild"];return typeof e=="number"&&i.linear!==!1&&!a.includes(t)}function F2(e,t){if(e.calculative.start===0)return e.calculative.start=void 0,e.calculative.cycleStart=void 0,0;e.animateCycle||(e.animateCycle=1/0),e.animateSpan||(e.animateSpan=1);const i=(t-e.calculative.cycleStart)/1e3;if(e.curveAnimate){let a=[];e.animateTimingFunction?a=Array.isArray(e.animateTimingFunction)?e.animateTimingFunction:e.animateTimingFunction.split(","):a=[.25,.25,.75,.75];const s=e.duration||5,n=i/s,r=jx(n,a[1],a[3]);e.calculative.animatePos=r*e.length}else e.calculative.animatePos+=e.animateSpan*(e.calculative.canvas.store.data.scale||1);if(e.calculative.cycleStart||(e.calculative.cycleStart=t),!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||e.curveAnimate&&i>e.duration){if(++e.calculative.cycleIndex,e.calculative.cycleIndex>e.animateCycle)return e.currentAnimation=void 0,e.calculative.start=void 0,e.calculative.cycleStart=void 0,0;e.calculative.cycleStart=void 0,e.calculative.animatePos=e.animateSpan}return!0}function ys(e,t=!0){if(!e.children||e.childActive===!1)return;const i=e.calculative.canvas.store;e.children.forEach(a=>{const s=i.pens[a];s&&(s.calculative.active=t,ys(s,t))})}function tn(e,t=!0){if(!e)return;const i=e.calculative.canvas.store;e.calculative.hover=t,e.childHover!==!1&&e.children&&e.children.forEach(a=>{var s,n;((s=i.pens[a])==null?void 0:s.hoverColor)==null&&((n=i.pens[a])==null?void 0:n.hoverBackground)==null&&tn(i.pens[a],t)})}function Fe(e,t){if(!t)return;const i=e.calculative.canvas.store,a=e.calculative.worldRect;if(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===Mt.DisableEdit||e.locked===Mt.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"),e.className&&(t.className=e.className),e.styles)for(let s in e.styles)t.style[s]=e.styles[s]}function Pl(e){return e.every(t=>t.locked)}function bf(e){return e.every(t=>t.disableRotate)}function rg(e,t,i){var a;e.type?(e.calculative.worldAnchors.forEach(s=>{Gt(s,t,i.center)}),R2(e),Ir(e)):(e.calculative.rotate?e.calculative.rotate+=t:e.calculative.rotate=t,Gt(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.forEach(s=>{const n=e.calculative.canvas.store.pens[s];rg(n,t,i)})}function R2(e){var s;if(!((s=e.calculative.worldAnchors)!=null&&s.length)||!isFinite(e.x)||!isFinite(e.x)||e.x==null||e.y==null)return;const t=ic(e);e.parentId||Object.assign(e,t);const{fontSize:i,lineHeight:a}=e.calculative.canvas.store.options;e.fontSize?e.fontSize<0&&(e.fontSize=0,e.calculative.fontSize=0):(e.fontSize=i>=0?i:12,e.calculative.fontSize=e.fontSize*e.calculative.canvas.store.data.scale),e.lineHeight||(e.lineHeight=a,e.calculative.lineHeight=e.lineHeight),Qt(t),e.calculative.worldRect=t,wc(e,t),Fi(e),e.calculative.worldAnchors&&(e.anchors=e.calculative.worldAnchors.map(n=>rn(n,e.calculative.worldRect)))}function xf(e){return e.every(t=>t.disableSize||t.pivot)}function Zs(e,t,i){if(!e.frames||!t)return 0;let a=0;for(let s=0;s<i;s++)e.frames[s]&&(a+=e.frames[s][t]||0);return a}function jr(e,t){var a;let i=e;for(;i&&i.parentId;){const s=i;i=t.pens[i.parentId];const n=(a=i==null?void 0:i.calculative)==null?void 0:a.showChild;if(n!=null&&i.children[n]!==s.id)return!1}return!0}function Yi(e,t=!1){var s,n,r;const{store:i,canvasRect:a}=e.calculative.canvas;if(t&&((s=e.children)==null||s.forEach(l=>{const o=i.pens[l];o&&Yi(o,!0)})),e.calculative.inView=!0,jr(e,i)?(e.visible==!1||e.calculative.visible==!1)&&(e.calculative.inView=!1,(e.canvasLayer===zt.CanvasImageBottom||e.canvasLayer===zt.CanvasImage)&&((n=e.frames)==null?void 0:n.length)&&(e.calculative.inView=e.frames.some(l=>l.hasOwnProperty("visible")))):e.calculative.inView=!1,e.calculative.inView){const{x:l,y:o,width:u,height:c,rotate:f}=e.calculative.worldRect,g={x:l+i.data.x,y:o+i.data.y,width:u,height:c,rotate:f};re(g),Xi(g,a)||(e.calculative.inView=!1)}(r=e.calculative.singleton)!=null&&r.div&&Fe(e,e.calculative.singleton.div)}function T2(e,t,i){if(t.fillWorldTextRect){e.save(),e.fillStyle="#c3deb7";const{x:a,y:s,width:n,height:r}=i.calculative.worldTextRect;e.fillRect(a,s,n,r),e.restore()}}function Ha(e,t){const i=t.calculative.globalAlpha;typeof i=="number"&&i<1&&!isNaN(i)&&(e.globalAlpha=i)}function og(e,t){const i=P2(e,t)||Et.canvasDraws[t.name];i&&(e.save(),i(e,t),e.restore())}function P2(e,t){const i=t.drawCommand;if(!(!i||t.name==="line"))return(a,s)=>{i.forEach(n=>{try{n.steps=n.steps.flat(1/0),n.steps.reduce((r,l)=>{const o=S2(l,s,r.x,r.y);try{if(o.c){if(o.c.startsWith("_")){const c=o.c.split("_")[1];return typeof o.v.value=="number"&&(o.v.value*=s.calculative.canvas.store.data.scale),(o.p||a)[c]=o.v.value,{x:r.x,y:r.y}}let u=[];for(const c in o.v)u.push(o.v[c]);return(o.p||a)[o.c](...u),{x:o.startX||o.v.x,y:o.startY||o.v.y}}return{x:r.x,y:r.y}}catch{}},{})}catch{}}),a.stroke()}}function S2(e,t,i,a){var n;const s={visio:D2,dxf:I2,canvas:B2};return((n=s[t.parseType])==null?void 0:n.call(s,e,t,i,a))||e}function I2(e,t,i,a){var c,f;const{x:s,y:n,width:r,height:l}=t.calculative.worldRect,{originWidth:o,originHeight:u}=t.dxfOrigin;switch(e.c){case"beginPath":return{c:"beginPath",v:{}};case"closePath":return{c:"closePath",v:{}};case"moveTo":return{c:"moveTo",v:{x:e.v.x*(r/o)+s,y:e.v.y*(l/u)+n}};case"lineTo":return{c:"lineTo",v:{x:e.v.x*(r/o)+s,y:e.v.y*(l/u)+n}};case"arc":return{c:"ellipse",v:{x:e.v.x*(r/o)+s,y:e.v.y*(l/u)+n,rx:e.v.xr*(r/o),ry:e.v.yr*(l/u),rotation:e.v.rotation||0,startAngle:e.v.startAngle,endAngle:e.v.endAngle,a:(c=e.v.aclockwise)!=null?c:!0}};case"ellipse":return{c:"ellipse",v:{x:e.v.x*(r/o)+s,y:e.v.y*(l/u)+n,rx:e.v.xr*(r/o),ry:e.v.yr*(l/u),rotation:e.v.rotation||0,startAngle:e.v.startAngle,endAngle:e.v.endAngle,a:(f=e.v.aclockwise)!=null?f:!0}};case"_font":return{c:"_font",v:{value:e.v.fontSize*t.calculative.canvas.store.data.scale+"px "+(e.v.fontFamily||t.calculative.canvas.store.options.fontFamily)}};case"_fillStyle":return{c:"_fillStyle",v:{value:t.color||e.v.value}};default:const g={c:e.c,v:{...e.v}};return g.v.x!==void 0&&(g.v.x=e.v.x*(r/o)+s),g.v.y!==void 0&&(g.v.y=e.v.y*(l/u)+n),g}}function B2(e,t,i,a){var c,f;const{x:s,y:n,width:r,height:l}=t.calculative.worldRect,{originWidth:o,originHeight:u}=t.origin;switch(e.c){case"beginPath":return{c:"beginPath",v:{}};case"closePath":return{c:"closePath",v:{}};case"moveTo":return{c:"moveTo",v:{x:e.v.x*(r/o)+s,y:e.v.y*(l/u)+n}};case"lineTo":return{c:"lineTo",v:{x:e.v.x*(r/o)+s,y:e.v.y*(l/u)+n}};case"arc":return{c:"ellipse",v:{x:e.v.x*(r/o)+s,y:e.v.y*(l/u)+n,rx:e.v.xr*(r/o),ry:e.v.yr*(l/u),rotation:e.v.rotation||0,startAngle:e.v.startAngle,endAngle:e.v.endAngle,a:(c=e.v.aclockwise)!=null?c:!0}};case"ellipse":return{c:"ellipse",v:{x:e.v.x*(r/o)+s,y:e.v.y*(l/u)+n,rx:e.v.xr*(r/o),ry:e.v.yr*(l/u),rotation:e.v.rotation||0,startAngle:e.v.startAngle,endAngle:e.v.endAngle,a:(f=e.v.aclockwise)!=null?f:!0}};case"_font":return{c:"_font",v:{value:e.v.fontSize*t.calculative.canvas.store.data.scale+"px "+(e.v.fontFamily||t.calculative.canvas.store.options.fontFamily)}};default:const g={c:e.c,v:{...e.v}};return g.v.x!==void 0&&(g.v.x=e.v.x*(r/o)+s),g.v.y!==void 0&&(g.v.y=e.v.y*(l/u)+n),g}}function D2(e,t,i,a){const{x:s,y:n,width:r,height:l}=t.calculative.worldRect,{width:o,height:u}=t.origin;switch(e.c){case"MoveTo":return{c:"moveTo",v:{x:+e.v.X*100*(r/o)+s,y:+e.v.Y*100*(l/u)+n}};case"RelMoveTo":return{c:"moveTo",v:{x:+e.v.X*o*(r/o)+s,y:+e.v.Y*u*(l/u)+n}};case"LineTo":return{c:"lineTo",v:{x:+e.v.X*100*(r/o)+s,y:+e.v.Y*100*(l/u)+n}};case"RelLineTo":return{c:"lineTo",v:{x:+e.v.X*o*(r/o)+s,y:+e.v.Y*u*(l/u)+n}};case"Ellipse":let c=e.v.X,f=e.v.Y,g=Math.abs(e.v.A-e.v.C),v=Math.abs(e.v.B-e.v.D);return{c:"ellipse",v:{x:c*100*(r/o)+s,y:f*100*(l/u)+n,radiuX:g*100*(r/o),radiuY:v*100*(l/u),rotation:0,startAngle:0,endAngle:Math.PI*2,anticlockwise:!0}};case"EllipticalArcTo":const m=e.v.X*100*(r/o)+s,w=e.v.Y*100*(l/u)+n,y=e.v.A*100*(r/o)+s,_=e.v.B*100*(l/u)+n;e.v.C;const A=e.v.D*(r/l)*(u/o),x=(m-i)*(_-a)-(w-a)*(y-i)>0,C=_f(i,a,m,w,y,_,A);return!e.orign&&(e.orign={}),!e.orign.startA&&(e.orign.startA=wr(C.x0,C.y0,i,a)),!e.orign.endA&&(e.orign.endA=wr(C.x0,C.y0,m,w)),{c:"ellipse",v:{centerX:C.x0,centerY:C.y0,radiuX:C.a,radiuY:C.b,rotation:0,startAngle:e.orign.startA,endAngle:e.orign.endA,anticlockwise:x},startX:m,startY:w};case"RelEllipticalArcTo":const T=e.v.X*o*(r/o)+s,I=e.v.Y*u*(l/u)+n,D=e.v.A*o*(r/o)+s,B=e.v.B*u*(l/u)+n;e.v.C;const V=e.v.D*(r/l)*(u/o),Q=(T-i)*(B-a)-(I-a)*(D-i)>0,F=_f(i,a,T,I,D,B,V);return!e.orign&&(e.orign={}),!e.orign.startA&&(e.orign.startA=wr(F.x0,F.y0,i,a)),!e.orign.endA&&(e.orign.endA=wr(F.x0,F.y0,T,I)),{c:"ellipse",v:{centerX:F.x0,centerY:F.y0,radiuX:F.a,radiuY:F.b,rotation:0,startAngle:e.orign.startA,endAngle:e.orign.endA,anticlockwise:Q},startX:T,startY:I};case"ArcTo":let R=e.v.X*100*r/o+s,P=e.v.Y*100*l/u+n,M=e.v.A*100*(r/l)*(u/o),Y=(i+R)/2,Z=(a+P)/2,nt=Math.sqrt((R-i)**2+(P-a)**2),j=nt**2/(8*M)+M/2,H=-(P-a)/nt,$=(R-i)/nt,K=Y+H*j,U=Z+$*j,tt=K,at=U,et=Math.atan2(a-at,i-tt),ut=Math.atan2(P-at,R-tt);return{c:"arc",v:{x:tt,y:at,radius:j,startAngle:et,endAngle:ut,aclockwise:!0}};default:const ct=ht(e);return Object.entries(ct.v).forEach(([ot,b])=>{var E,S;(E=ot.endsWith)!=null&&E.call(ot,"_x")?typeof b=="number"&&(ct.v[ot]=b*(r/o)+s):(S=ot.endsWith)!=null&&S.call(ot,"_y")?typeof b=="number"&&(ct.v[ot]=b*(l/u)+n):typeof b=="number"&&(ct.v[ot]=b)}),ct}}function L2(e,t){e.filter=t.filter}function xc(e,t){for(const i in t)Nd.includes(i)&&(i=="fontSize"&&t[i]<0&&(t[i]=0),e[i]=t[i],["fontSize","lineWidth"].includes(i)?(e.calculative[i]=t[i]*e.calculative.canvas.store.data.scale,Fi(e)):e.calculative[i]=t[i]),e.image&&e.name!=="gif"&&Md.includes(i)&&(e.calculative.canvas.store.patchFlagsTop=!0,e.calculative.canvas.store.patchFlagsBackground=!0,e.calculative.imageDrawed=!1);if(e.calculative.canvas.parent.isCombine(e)){const i=e.children;i==null||i.forEach(a=>{let s=ht(t);e.calculative.childrenVisible&&e.calculative.childrenVisible[a]===!1&&delete s.visible;const n=e.calculative.canvas.store.pens[a];n&&xc(n,s)})}}function _f(e,t,i,a,s,n,r){let l=(e-i)*(e+i)*(a-n)-(i-s)*(i+s)*(t-a)+r*r*(t-a)*(a-n)*(t-n),o=2*((e-i)*(a-n)-(i-s)*(t-a)),u=l/o,c=(e-i)*(i-s)*(e-s)+r*r*((i-s)*(t-a)*(t+a)-(e-i)*(a-n)*(a+n)),f=2*r*r*((i-s)*(t-a)-(e-i)*(a-n)),g=c/f,v=Math.sqrt(Math.pow(e-u,2)+Math.pow(r*(t-g),2)),m=v/r;return{x0:u,y0:g,a:v,b:m}}function wr(e,t,i,a){let s=i-e,n=a-t,r=Math.atan2(n,s);return r<0&&(r+=2*Math.PI),r}function Ef(e,t,i){let a,s,n=1/0,r=1/0;const l=8;for(const o of e.data.pens){if(o.calculative.inView===!1)continue;_c(o).forEach(c=>{if(c===t||c===i)return;let f=(o.calculative.worldRect.center.x-t.x)*(o.calculative.worldRect.center.x-t.x)+(o.calculative.worldRect.center.y-t.y)*(o.calculative.worldRect.center.y-t.y);const g=Math.abs(c.x-t.x);g>0&&g<l&&f<n&&(a={x:Math.round(c.x)+.5,y:Math.round(c.y)+.5,prev:{x:Math.round(t.x)+.5,y:Math.round(t.y)+.5},step:c.x-t.x},n=f);const v=Math.abs(c.y-t.y);v>0&&v<l&&f<r&&(s={x:Math.round(c.x)+.5,y:Math.round(c.y)+.5,prev:{x:Math.round(t.x)+.5,y:Math.round(t.y)+.5},step:c.y-t.y},r=f)})}return{xDock:a,yDock:s}}function M2(e,t,i,a){let s=[];return i.length===1?(s=ht(_c(i[0])),s.forEach(n=>{n.x+=a.x,n.y+=a.y})):(Qt(t),s=[t.center,...Zi(t)]),lg(e,s,t,!0)}function _c(e){if(e.type){if(e.type===$t.Line)return e.calculative.worldAnchors}else{const t=Zi(e.calculative.worldRect);return Qt(e.calculative.worldRect),[...e.calculative.worldAnchors,...t,e.calculative.worldRect.center]}}function O2(e,t,i,a){const s=Zi(t);return lg(e,s,t)}function lg(e,t,i,a=!1){let s,n,r=1/0,l=1/0;const o=10,u=$2(i,o);return e.data.pens.forEach(c=>{const{inView:f,worldRect:g,active:v}=c.calculative;if(f===!1||!a&&v||V2(u,g)||c.type&&e.active.some(w=>cg(e,w,c)))return;const m=_c(c);if(!!m)for(const w of m)for(const y of t){const _=w.x-y.x,A=w.y-y.y,x=Math.abs(_),C=Math.abs(A);i.center||(i.center={x:i.x+i.width/2,y:i.y+i.height/2}),x<o&&x<r&&(s={x:Math.round(w.x)+.5,y:Math.round(w.y)+.5,step:_,prev:{x:Math.round(y.x)+.5,y:Math.round(y.y)+.5},penId:c.id,anchorId:y.id,dockAnchorId:w.id},r=x),C<o&&C<l&&(n={x:Math.round(w.x)+.5,y:Math.round(w.y)+.5,step:A,prev:{x:Math.round(y.x)+.5,y:Math.round(y.y)+.5},penId:c.id,anchorId:y.id,dockAnchorId:w.id},l=C)}}),{xDock:s,yDock:n}}function cg(e,t,i){if(!i.type)return!1;if(Array.isArray(t==null?void 0:t.connectedLines)){for(const a of t==null?void 0:t.connectedLines)if(a.lineId===i.id)return!0}if(Array.isArray(t==null?void 0:t.children))for(const a of t.children){const s=e.pens[a];if(cg(e,s,i))return!0}return!1}function Jl(e,t){return e.toFixed(12)==t}function N2(e,t=4){let i=e.map(u=>u.calculative.worldRect);const a=i.map(u=>u.x),s=i.map(u=>u.y),n=a.reduce((u,c)=>u+c,0)/a.length,r=s.reduce((u,c)=>u+c,0)/s.length,l=Math.sqrt(a.map(u=>Math.pow(u-n,2)).reduce((u,c)=>u+c,0)/a.length),o=Math.sqrt(s.map(u=>Math.pow(u-r,2)).reduce((u,c)=>u+c,0)/s.length);return e.filter(u=>{let c=u.calculative.worldRect;const f=(c.x-n)/l,g=(c.y-r)/o;return Math.sqrt(f*f+g*g)>t})}function Af(e){if(e.id=St(),Array.isArray(e.anchors))for(const t of e.anchors)e.type&&(t.id=St()),t.penId=e.id,t.prev&&(e.type&&(t.prev.id=St()),t.prev.penId=e.id),t.next&&(e.type&&(t.next.id=St()),t.next.penId=e.id)}function z2(){let e=null,t=new Map;return(i,a,s,n=!1)=>{if(t.has(i)&&t.get(i)?e=t.get(i):t.set(i,e=new Map),typeof s!="function")return()=>{console.warn("[rewritePenLifeCycle] warn: not a function ")};let r=new Set,l=new Map;e.has(a)&&e.get(a)?r=e.get(a):(l.set(a,i[a]),e.set(a,r)),n?r.delete(s):r.add(s);let o=l.get(a),u=(...c)=>{o==null||o(...c),r.forEach(f=>{f(...c)})};i[a]=u}}let H2=z2();function W2(e){return!e.name&&!e.install?(console.error("installPenPlugin Error: Validation Failed"),!1):!0}function Ui(e,t){if(!t)return;if(t.ex==null&&re(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||Qt(t);const 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(a=>{Gt(a,t.rotate,t.pivot||t.center)}),U2(e,i)}function Wa(e,t,i=0){const{x:a,y:s,ex:n,ey:r}=t;return e.x>=a-i&&e.x<=n+i&&e.y>=s-i&&e.y<=r+i}function Qt(e){e.center||(e.center={}),e.center.x=e.x+e.width/2,e.center.y=e.y+e.height/2}function re(e){e.ex=e.x+e.width,e.ey=e.y+e.height}function Ql(e,t){e.pivot||(e.pivot={}),e.pivot.x=e.x+e.width*t.x,e.pivot.y=e.y+e.height*t.y}function U2(e,t){if(t.length<3)return!1;let i=!1,a=t[t.length-1];for(const s of t)a.y>e.y!=s.y>e.y&&s.x+(e.y-s.y)*(a.x-s.x)/(a.y-s.y)>e.x&&(i=!i),a=s;return i}function hi(e){const t=[];e.forEach(a=>{if(a.isRuleLine)return;const s=a.calculative.worldRect;if(s){const n=Zi(s);t.push(...n)}});const i=En(t);return Qt(i),i}function Zi(e){const 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||Qt(e),t.forEach(i=>{Gt(i,e.rotate,e.pivot||e.center)})),t}function En(e){let t=1/0,i=1/0,a=-1/0,s=-1/0;return e==null||e.forEach(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),s=Math.max(s,n.y))}),{x:t,y:i,ex:a,ey:s,width:a-t,height:s-i}}function Xi(e,t,i){return e.rotate&&(e=En(Zi(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 V2(e,t){return(t.x>e.ex||t.ex<e.x)&&(t.y>e.ey||t.ey<e.y)}function $2(e,t){const i=qi(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 re(a),a}function Da(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),e.pivot&&(e.pivot.x+=t,e.pivot.y+=i)}function j2(e,t){const 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 tc({k:i,point:e.from},{k:a,point:t.from})}function tc(e,t){if(Jl(e.k,0))return{x:t.point.x,y:e.point.y};if(Jl(t.k,0))return{x:e.point.x,y:t.point.y};const i=e.point.y-e.k*e.point.x,s=(t.point.y-t.k*t.point.x-i)/(e.k-t.k),n=e.k*s+i;return{x:s,y:n}}function q2(e,t){const i=j2({from:e[0],to:e[2]},{from:e[1],to:e[3]});for(const a of e)Gt(a,-t,i);return En(e)}function kf(e,t,i,a){let s=e.rotate?e.rotate%360:0;if(s){const n=Zi(e),r=(n[0].y-n[1].y)/(n[0].x-n[1].x),l=(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){let c=t*Math.tan((90-(360-s)-Math.atan(e.width/e.height)/Math.PI*180)/180*Math.PI);n[a].y+=c}else{let c=t*Math.tan((90-(360-s)+Math.atan(e.width/e.height)/Math.PI*180)/180*Math.PI);n[a].y+=c}else n[a].y+=i;const u=n[(a+2)%4];n[(a+1)%4]=tc({k:a%2?l:r,point:n[a]},{k:a%2?r:l,point:u}),n[(a+4-1)%4]=tc({k:a%2?r:l,point:n[a]},{k:a%2?l:r,point:u})}else{const u=[4,6].includes(a)?l:r;Jl(u,0)?(n[a%4].x+=t,n[(a+1)%4].x+=t):(n[a%4].y+=i,n[a%4].x+=i/u,n[(a+1)%4].y+=i,n[(a+1)%4].x+=i/u)}if((n[0].x-n[1].x)**2+(n[0].y-n[1].y)**2<25||(n[1].x-n[2].x)**2+(n[1].y-n[2].y)**2<25)return;const o=q2(n,e.rotate);Qt(o),Object.assign(e,o);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 vn(e,t,i,a){!e||(e.width*=t,e.height*=t,Hr(e,t,i),re(e),Qt(e),a&&Ql(e,a))}function fa(e,t){const 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 re(i),i}function rn(e,t){const{x:i,y:a,width:s,height:n}=t,{penId:r,connectTo:l}=e,o=Object.assign({},e,{x:s?(e.x-i)/s:0,y:n?(e.y-a)/n:0});return e.prev&&(o.prev={penId:r,connectTo:l,x:s?(e.prev.x-i)/s:0,y:n?(e.prev.y-a)/n:0}),e.next&&(o.next={penId:r,connectTo:l,x:s?(e.next.x-i)/s:0,y:n?(e.next.y-a)/n:0}),o}function Y2(e,t){let i=!1;for(let a=0,s=t.length-1;a<t.length;s=a++){let n=t[a].x,r=t[a].y,l=t[s].x,o=t[s].y;r>e.y!=o>e.y&&e.x<(l-n)*(e.y-r)/(o-r)+n&&(i=!i)}return i}const K2=/^[\t\n\f\r ]*([MLHVZCSQTAmlhvzcsqta])[\t\n\f\r ]*/,Cf=/^[01]/,Jt=/^[+-]?(([0-9]*\.[0-9]+)|([0-9]+\.)|([0-9]+))([eE][+-]?[0-9]+)?/,X2=/^(([\t\n\f\r ]+,?[\t\n\f\r ]*)|(,[\t\n\f\r ]*))/,G2={M:[Jt,Jt],L:[Jt,Jt],H:[Jt],V:[Jt],Z:[],C:[Jt,Jt,Jt,Jt,Jt,Jt],S:[Jt,Jt,Jt,Jt],Q:[Jt,Jt,Jt,Jt],T:[Jt,Jt],A:[Jt,Jt,Jt,Cf,Cf,Jt,Jt]};function Z2(e){let t=0;const i=[];for(;t<e.length;){const a=e.slice(t).match(K2);if(a!==null){const s=a[1];t+=a[0].length;const n=e_(s,e,t);t=n.cursor,i.push(...n.commands)}else throw new Error("malformed path (first error at "+t+")")}return{commands:i}}function Ff(e){let t=1/0,i=1/0,a=-1/0,s=-1/0;return a_(e),e.commands.forEach(n=>{n.worldPoints.forEach((r,l)=>{l%2===0?(r<t&&(t=r),r>a&&(a=r)):(r<i&&(i=r),r>s&&(s=r))})}),{x:t,y:i,ex:a,ey:s,width:a-t+1,height:s-i+1}}function J2(e,t,i){i==null&&(i=t),e.commands.forEach((a,s)=>{if(!(a.relative&&s))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((n,r)=>{a.values[r]=n+(r%2===0?t:i)});break}})}function Q2(e,t,i){i==null&&(i=t),e.commands.forEach(a=>{switch(a.key){case"A":case"a":const s=a.values[0],n=a.values[1],r=Math.PI*a.values[2]/180,l=Math.cos(r),o=Math.sin(r),u=n*n*i*i*l*l+s*s*i*i*o*o,c=2*t*i*l*o*(n*n-s*s),f=s*s*t*t*l*l+n*n*t*t*o*o,g=-(s*s*n*n*t*t*i*i),v=c*c-4*u*f,m=Math.sqrt((u-f)*(u-f)+c*c);a.values[2]=c!==0?Math.atan((f-u-m)/c)*180/Math.PI:u<f?0:90,a.values[0]=-Math.sqrt(2*v*g*(u+f+m))/v,a.values[1]=-Math.sqrt(2*v*g*(u+f-m))/v,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((w,y)=>{a.values[y]=w*(y%2===0?t:i)});break}})}function t_(e){let t="";return e.commands.forEach(i=>{t+=i.key+" ",i.values.forEach(a=>{t+=a+" "})}),t}function e_(e,t,i){const a=G2[e.toUpperCase()],s=[];for(;i<=t.length;){const n={key:e,values:[]};for(const r of a){const l=t.slice(i).match(r);if(l!==null){n.values.push(+l[0]),i+=l[0].length;const o=t.slice(i).match(X2);o!==null&&(i+=o[0].length)}else{if(n.values.length===0)return{cursor:i,commands:s};throw new Error("malformed path (first error at "+i+")")}}if(n.relative=n.key.toUpperCase()!==n.key,s.push(n),a.length===0)return{cursor:i,commands:s};e==="m"&&(e="l"),e==="M"&&(e="L")}throw new Error("malformed path (first error at "+i+")")}function i_(e,t){const i=[];let a=e.relative&&t?{x:t.worldPoints[t.worldPoints.length-2],y:t.worldPoints[t.worldPoints.length-1]}:{x:0,y:0};for(let s=0;s<e.values.length-1;s+=2)i.push(a.x+e.values[s]),i.push(a.y+e.values[s+1]);e.worldPoints=i}function a_(e){let t,i=0,a=0;e.commands.forEach(s=>{switch(s.key){case"Z":case"z":s.worldPoints=[i,a];break;case"H":s.worldPoints=[s.values[0],t.worldPoints[t.worldPoints.length-1]];break;case"h":s.worldPoints=[s.values[0]+t.worldPoints[t.worldPoints.length-2],t.worldPoints[t.worldPoints.length-1]];break;case"V":s.worldPoints=[t.worldPoints[t.worldPoints.length-2],s.values[0]];break;case"v":s.worldPoints=[t.worldPoints[t.worldPoints.length-2],s.values[0]+t.worldPoints[t.worldPoints.length-1]];break;case"A":s.worldPoints=[t.worldPoints[t.worldPoints.length-2],s.values[0]+t.worldPoints[t.worldPoints.length-1]];break;default:i_(s,t);break}(s.key==="M"||s.key==="m"||s.key==="Z"||s.key==="z")&&(i=s.worldPoints[s.worldPoints.length-2],a=s.worldPoints[s.worldPoints.length-1]),t=s})}function s_(e,t){var o;const a=e.calculative.canvas.store.data.paths[e.pathId];if(!a)return new Path2D;const s=Z2(a);e.calculative.svgRect=Ff(s),Qt(e.calculative.svgRect),(e.calculative.svgRect.width!==e.calculative.worldRect.width||e.calculative.svgRect.height!==e.calculative.worldRect.height)&&Q2(s,e.calculative.worldRect.width/e.calculative.svgRect.width,e.calculative.worldRect.height/e.calculative.svgRect.height);const n=Ff(s);Qt(n),J2(s,e.calculative.worldRect.x-n.x,e.calculative.worldRect.y-n.y);const r=t_(s);if(t){(o=t.svgPath)==null||o.call(t,r);return}return new Path2D(r)}function n_(e,t){const i=t||new Path2D,{x:a,y:s,width:n,height:r}=e.calculative.worldRect;if(i.moveTo(a+n/2,s),i.lineTo(a+n,s+r/2),i.lineTo(a+n/2,s+r),i.lineTo(a,s+r/2),i.lineTo(a+n/2,s),i.closePath(),i instanceof Path2D)return i}function r_(e,t){const i=t||new Path2D,{x:a,y:s,width:n,height:r}=e.calculative.worldRect;if(i.moveTo(a+n/2,s),i.lineTo(a+n,s+r),i.lineTo(a,s+r),i.lineTo(a+n/2,s),i.closePath(),i instanceof Path2D)return i}function o_(e){const t=[{x:.5,y:0},{x:.75,y:.5},{x:.5,y:1},{x:.25,y:.5}];e.anchors=t.map(({x:i,y:a},s)=>({id:`${s}`,penId:e.id,x:i,y:a}))}function l_(e,t){const i=t||new Path2D,{x:a,y:s,width:n,height:r}=e.calculative.worldRect;if(i.moveTo(a+n/2,s),i.lineTo(a+n,s+r*2/5),i.lineTo(a+n*4/5,s+r),i.lineTo(a+n/5,s+r),i.lineTo(a,s+r*2/5),i.closePath(),i instanceof Path2D)return i}function c_(e){const 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(({x:i,y:a},s)=>({id:`${s}`,penId:e.id,x:i,y:a}))}function h_(e,t){e.onResize||(e.onResize=u_);const i=t||new Path2D,{width:a,height:s,center:n}=e.calculative.worldRect,r=a>s?s:a,l=n.x,o=n.y,u=o-r/2,c=o-r/4,f=-(c-o)*Math.sin(Math.PI/180*324)+l,g=(c-o)*Math.cos(Math.PI/180*324)+o;i.moveTo(f,g);for(let v=0;v<5;++v)i.lineTo(-(u-o)*Math.sin(Math.PI/180*72*v)+l,(u-o)*Math.cos(Math.PI/180*72*v)+o),i.lineTo((f-l)*Math.cos(Math.PI/180*72*(v+1))-(g-o)*Math.sin(Math.PI/180*72*(v+1))+l,(f-l)*Math.sin(Math.PI/180*72*(v+1))+(g-o)*Math.cos(Math.PI/180*72*(v+1))+o);if(i.closePath(),i instanceof Path2D)return i}function hg(e){const{width:t,height:i}=e,a=t>i?i:t,s=[];for(let n=0;n<5;++n)s.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=s}function u_(e){const t=e.anchors.filter(i=>i.flag!==1);hg(e),e.anchors=e.anchors.concat(...t)}function f_(e,t){const i=t||new Path2D,{x:a,y:s,width:n,height:r}=e.calculative.worldRect;if(i.moveTo(a+n/4,s),i.lineTo(a+n*3/4,s),i.lineTo(a+n,s+r/2),i.lineTo(a+n*3/4,s+r),i.lineTo(a+n*1/4,s+r),i.lineTo(a,s+r/2),i.lineTo(a+n/4,s),i.closePath(),i instanceof Path2D)return i}function d_(e,t){const i=t||new Path2D,{x:a,y:s,width:n,height:r}=e.calculative.worldRect;if(i.moveTo(a,s+r/2),i.lineTo(a+r/2,s),i.lineTo(a+r/2,s+r/3),i.lineTo(a+n,s+r/3),i.lineTo(a+n,s+r*2/3),i.lineTo(a+r/2,s+r*2/3),i.lineTo(a+r/2,s+r*2/3),i.lineTo(a+r/2,s+r),i.closePath(),i instanceof Path2D)return i}function g_(e,t){const i=t||new Path2D,{x:a,y:s,width:n,height:r}=e.calculative.worldRect;if(i.moveTo(a,s+r/3),i.lineTo(a+(n-r/2),s+r/3),i.lineTo(a+(n-r/2),s),i.lineTo(a+n,s+r/2),i.lineTo(a+(n-r/2),s+r),i.lineTo(a+(n-r/2),s+r*2/3),i.lineTo(a,s+r*2/3),i.closePath(),i instanceof Path2D)return i}function v_(e,t){const i=t||new Path2D,{x:a,y:s,width:n,height:r}=e.calculative.worldRect;if(i.moveTo(a,s+r/2),i.lineTo(a+r/2,s),i.lineTo(a+r/2,s+r/3),i.lineTo(a+(n-r/2),s+r/3),i.lineTo(a+(n-r/2),s),i.lineTo(a+n,s+r/2),i.lineTo(a+(n-r/2),s+r),i.lineTo(a+(n-r/2),s+r*2/3),i.lineTo(a+r/2,s+r*2/3),i.lineTo(a+r/2,s+r),i.closePath(),i instanceof Path2D)return i}function m_(e,t){const i=t||new Path2D,{x:a,y:s,width:n,height:r,ey:l}=e.calculative.worldRect;if(i.moveTo(a,s),i.lineTo(a+n,s),i.lineTo(a+n,s+r*3/4),i.lineTo(a+n*8/16,s+r*3/4),i.lineTo(a+n/4,l),i.lineTo(a+n*5/16,s+r*3/4),i.lineTo(a,s+r*3/4),i.closePath(),i instanceof Path2D)return i}function y_(e,t){const i=t||new Path2D,{x:a,y:s,width:n,height:r}=e.calculative.worldRect;if(i.moveTo(a+n/5,s+r*13/16),i.bezierCurveTo(a-n/15,s+r*13/16,a-n/15,s+r*7/16,a+n/5,s+r*7/16),i.bezierCurveTo(a+n/5,s,a+n*4/5,s,a+n*4/5,s+r*7/16),i.bezierCurveTo(a+n*16/15,s+r*7/16,a+n*16/15,s+r*13/16,a+n*4/5,s+r*13/16),i.closePath(),i instanceof Path2D)return i}function p_(e,t){const i=t||new Path2D,{x:a,y:s,width:n,ex:r,ey:l}=e.calculative.worldRect,o=n/6;if(i.moveTo(a,s),i.lineTo(r-o,s),i.lineTo(r,s+o),i.lineTo(r,l),i.lineTo(a,l),i.closePath(),i.moveTo(r-o,s),i.lineTo(r-o,s+o),i.lineTo(r,s+o),i.closePath(),i instanceof Path2D)return i}function w_(e,t){const{x:i,y:a,width:s,ex:n,ey:r}=t.calculative.worldRect;let l=s*.25;const o=t.z;o>1?l=o*t.calculative.canvas.store.data.scale:o>0&&(l=s*o);const u={x:i,y:a+l},c={x:n-l,y:a+l},f={x:n-l,y:r};Sl(e,[u,c,f,{x:i,y:r}],t.backgroundFront||t.background,t.color),Sl(e,[u,{x:i+l,y:a},{x:n,y:a},c],t.backgroundUp||t.background,t.color),Sl(e,[c,{x:n,y:a},{x:n,y:r-l},f],t.backgroundRight||t.background,t.color)}function Sl(e,t,i="",a=""){e.save(),i&&(e.fillStyle=i),a&&(e.strokeStyle=a),e.beginPath();for(let s=0;s<t.length;++s)s?e.lineTo(t[s].x,t[s].y):e.moveTo(t[s].x,t[s].y);e.closePath(),i&&e.fill(),e.stroke(),e.restore()}function b_(e,t){const i=t||new Path2D,{x:a,y:s,width:n,ex:r,ey:l}=e.calculative.worldRect,o=n/4,u=a+n/2;if(i.arc(u,s+o,o,0,Math.PI*2),i.moveTo(a,s+o*3),i.lineTo(r,s+o*3),i.moveTo(u,s+o*2),i.lineTo(u,s+o*4),i.moveTo(u,s+o*4),i.lineTo(a,l),i.moveTo(u,s+o*4),i.lineTo(r,l),i.closePath(),i instanceof Path2D)return i}function x_(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},Qr(t.calculative.activeAnchor.next,t.calculative.activeAnchor)<5?t.calculative.activeAnchor.next=void 0:(t.calculative.activeAnchor.prev={...t.calculative.activeAnchor.next},Gt(t.calculative.activeAnchor.prev,180,t.calculative.activeAnchor)));else{const a=t.calculative.worldAnchors[0];if(!a.next){const n=Ts(a,e.pens[a.connectTo]);Rf(a,n,50),a.prev=void 0}const s=t.calculative.worldAnchors[t.calculative.worldAnchors.length-1];if(s&&s!==a&&!s.prev){const n=Ts(s,e.pens[s.connectTo]);Rf(s,n,-50),s.next=void 0}}}function Rf(e,t,i){switch(t){case It.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 It.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 It.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 It.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 ec(e,t,i,a){const s=1-e,n=s*s*t.x+2*s*e*i.x+e*e*a.x,r=s*s*t.y+2*s*e*i.y+e*e*a.y;return{x:n,y:r,step:e}}function ug(e,t,i,a,s){const{x:n,y:r}=t,{x:l,y:o}=s,{x:u,y:c}=i,{x:f,y:g}=a,v=1-e,m=n*v*v*v+3*u*e*v*v+3*f*e*e*v+l*e*e*e,w=r*v*v*v+3*c*e*v*v+3*g*e*e*v+o*e*e*e;return{x:m,y:w,step:e}}function ca(e,t,i){return{x:e.x+i*(t.x-e.x),y:e.y+i*(t.y-e.y)}}function __(e,t,i){let a=e.calculative.worldAnchors[i],s=e.calculative.worldAnchors[i+1];!s&&e.close&&(s=e.calculative.worldAnchors[0]);const n=t.step;let r;if(a.next&&s.prev){const l=a,o=a.next,u=s.prev,c=s,f=ca(l,o,n),g=ca(o,u,n),v=ca(u,c,n),m=ca(f,g,n),w=ca(g,v,n);r=ca(m,w,n),m.penId=e.id,r.prev=m,w.penId=e.id,r.next=w,a.next.x=f.x,a.next.y=f.y,s.prev.x=v.x,s.prev.y=v.y}else if(a.next||s.prev){const l=a,o=a.next||s.prev,u=s,c=ca(l,o,n),f=ca(o,u,n);r=t,c.penId=e.id,f.penId=e.id,r.prev=c,r.next=f,a.next=void 0,s.prev=void 0}else r=t;return r.penId=e.id,r.id=St(),r.prevNextType=Na.Bilateral,r}function E_(e,t,i){if(t.calculative.worldAnchors||(t.calculative.worldAnchors=[]),t.calculative.worldAnchors.length<2)return;let a=t.calculative.activeAnchor,s=i||Vt(t);if(!a||!s)return;const n=20,r=e.pens[a.connectTo];let l=Ts(a,r);switch(l===It.None&&(s.x>a.x?l=It.Right:l=It.Left),a.next={id:St(),penId:t.id,x:a.x,y:a.y,prevNextType:2},s.prev={id:St(),penId:t.id,x:s.x,y:s.y,prevNextType:2},l){case It.Up:a.next.y-=n,s.prev.y=a.y;break;case It.Bottom:a.next.y+=n,s.prev.y=a.y;break;case It.Left:a.next.x-=n,s.prev.x=a.x;break;default:a.next.x+=n,s.prev.x=a.x;break}}function A_(e,t){const i=t||new Path2D;if((e.lineName==="line"||e.lineName==="polyline")&&e.calculative.lineSmooth){let s=pc(e);if(i instanceof Path2D&&i.addPath(s),i instanceof Path2D)return i}const a=e.calculative.worldAnchors;if(a.length>1){let s;a.forEach(n=>{s?Tf(i,s,n):n.start=!0,s=n}),e.close&&(e.lineName==="curve"?Tf(i,s,a[0]):i.closePath())}if(i instanceof Path2D)return i}function k_(e,t,i){var n;if(t.calculative.worldAnchors||(t.calculative.worldAnchors=[]),t.calculative.worldAnchors.length<2||((n=t.anchors)==null?void 0:n.length)>1)return;const a=le(t),s=Vt(t);!a||!s||!s.id||a===s||(a.next=void 0,bc(t),s.prev=void 0,t.calculative.worldAnchors.push(s))}function Tf(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 ic(e){return Yr(e),En(fg(e))}function fg(e){const t=[];let i;return e.calculative.worldAnchors.forEach(a=>{t.push(a),i&&t.push(...Pf(i,a,e)),i=a}),e.close&&e.calculative.worldAnchors.length>1&&t.push(...Pf(i,e.calculative.worldAnchors[0],e)),t}function qr(e){return e!=null&&e.lineWidth?e.lineWidth/2+4:4}function Pf(e,t,i){const a=[];if(!t)return a;let s=.02;if(e.lineLength&&!i.parentId&&(s=qr(i)/e.lineLength),e.next)if(t.prev)for(let n=s;n<1;n+=s)a.push(ug(n,e,e.next,t.prev,t));else for(let n=s;n<1;n+=s)a.push(ec(n,e,e.next,t));else if(t.prev)for(let n=s;n<1;n+=s)a.push(ec(n,e,t.prev,t));else a.push({x:t.x,y:t.y});return a.length>1&&(e.curvePoints=a),a}function C_(e,t){const i=qr(t);let a=0,s,n;for(const r of t.calculative.worldAnchors){if(s){if(n=Sf(e,s,r,i),n)return{i:a,point:n};++a}s=r}if(t.close&&t.calculative.worldAnchors.length>1&&(n=Sf(e,s,t.calculative.worldAnchors[0],i)))return{i:a,point:n}}function Sf(e,t,i,a=4){if(!t.next&&!i.prev){const{x:s,y:n}=t,{x:r,y:l}=i,o=Math.min(s,r),u=Math.max(s,r),c=Math.min(n,l),f=Math.max(n,l);return e.x>=o-a&&e.x<=u+a&&e.y>=c-a&&e.y<=f+a?F_(e,t,i,a):void 0}else if(t.curvePoints){for(const s of t.curvePoints)if(ms(e,s,a))return s}}function F_(e,t,i,a=4){if(t.x===i.x){if(Math.abs(e.x-t.x)<=a)return{x:t.x,y:e.y}}else{const s=(t.y-i.y)/(t.x-i.x),n=t.y-s*t.x;if(Math.abs((s*e.x+n-e.y)/Math.sqrt(s*s+1))<=a){const o=(e.x+s*e.y-s*n)/(s*s+1);return{x:o,y:s*o+n}}}}function If(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;const s=document.createElementNS("http://www.w3.org/2000/svg","path");return t&&i?s.setAttribute("d",`M${e.x} ${e.y} C${t.x} ${t.y} ${i.x} ${i.y} ${a.x} ${a.y}`):t?s.setAttribute("d",`M${e.x} ${e.y} Q${t.x} ${t.y} ${a.x} ${a.y}`):s.setAttribute("d",`M${e.x} ${e.y} Q${i.x} ${i.y} ${a.x} ${a.y}`),s.getTotalLength()||0}function Yr(e){if(e.calculative.worldAnchors.length<2)return 0;let t=0,i;if(e.calculative.worldAnchors.forEach(a=>{i&&(i.lineLength=If(i,i.next,a.prev,a),t+=i.lineLength),i=a}),e.close){const a=le(e);i.lineLength=If(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 Il(e,t){const i=e.calculative.worldAnchors;for(let a=0;a<i.length-1;a++){const s=i[a],n=i[a+1];if(!s.next&&!n.prev){if(dg(s,n,t))return!0}else if(R_(s,n,t))return!0}return!1}function dg(e,t,i){if(Wa(e,i)||Wa(t,i))return!0;const a=e.x,s=e.y,n=t.x,r=t.y;let l=i.x,o=i.y,u=i.ex,c=i.ey;const f=s-r,g=n-a,v=a*r-n*s;if(f*l+g*o+v>=0&&f*u+g*c+v<=0||f*l+g*o+v<=0&&f*u+g*c+v>=0||f*l+g*c+v>=0&&f*u+g*o+v<=0||f*l+g*c+v<=0&&f*u+g*o+v>=0){if(l>u){const m=l;l=u,u=m}if(o<c){const m=o;o=c,c=m}return!(a<l&&n<l||a>u&&n>u||s>o&&r>o||s<c&&r<c)}else return!1}function R_(e,t,i){if(!e.next&&!t.prev)return dg(e,t,i);if(e.next&&t.prev)for(let s=.02;s<1;s+=.02){const n=ug(s,e,e.next,t.prev,t);if(Wa(n,i))return!0}else if(e.next||t.prev)for(let s=.02;s<1;s+=.02){const n=ec(s,e,e.next||t.prev,t);if(Wa(n,i))return!0}return!1}function Bf(e,t,i,a,s){let n="";return e||(n+=`M${t.x} ${t.y} `,e=document.createElementNS("http://www.w3.org/2000/svg","path"),e.setAttribute("d",n)),n=e.getAttribute("d")||"",i&&a?n+=`C${i.x} ${i.y} ${a.x} ${a.y} ${s.x} ${s.y}`:i?n+=`Q${i.x} ${i.y} ${s.x} ${s.y}`:n+=`Q${(a==null?void 0:a.x)||t.x} ${(a==null?void 0:a.y)||t.y} ${s.x} ${s.y}`,e.setAttribute("d",n),e}function T_(e,t){const i=e.getTotalLength();if(t<0||t>i)return null;const a=.01,s=e.getPointAtLength(t),n=e.getPointAtLength(t-a),r=Math.atan2(s.y-n.y,s.x-n.x);return{x:s.x,y:s.y,rotate:r/Math.PI*180,progress:t/i}}let Ue=10;function P_(e,t,i){var w;if(t.calculative.worldAnchors||(t.calculative.worldAnchors=[]),Ue=e.options.polylineSpace||10,t.calculative.worldAnchors.length<2)return;let a=le(t),s=Vt(t);if(!a||!s)return;let n;if(((w=t.anchors)==null?void 0:w.length)&&a===t.calculative.activeAnchor?(n=!0,a=s,s=le(t)):(!t.anchors||!t.anchors.length)&&a!==t.calculative.activeAnchor&&(a=t.calculative.activeAnchor),!a||!s)return;a.next=void 0,s.prev=void 0;const r=s.connectTo;bc(t);const l=[],o=e.pens[a.connectTo],u=e.pens[s.connectTo],c=Ts(a,o),f=Ts(s,u);let g=Df(a,c,Ue);g&&(a=g,l.push(g)),g=Df(s,f,Ue);const v=s;let m;if(g&&(s=g,v.connectTo&&(g.y>v.y&&a.y<v.y||g.y<v.y&&a.y>v.y))){m=g;let y=Ue;a.x<g.x&&(y=-y),Math.abs(a.x-g.x)<y&&(y=-y),s={x:g.x+y,y:g.y,id:St()}}switch(c){case It.Up:l.push(...S_(a,s,f));break;case It.Right:l.push(...I_(a,s,f));break;case It.Bottom:l.push(...B_(a,s,f));break;case It.Left:l.push(...D_(a,s,f));break;default:l.push(...L_(t,a,s));break}if(l.forEach(y=>{y.id=St(),y.penId=t.id,t.calculative.worldAnchors.push(y)}),t.calculative.worldAnchors.push(s),m&&t.calculative.worldAnchors.push(m),g&&t.calculative.worldAnchors.push(v),n&&t.calculative.worldAnchors.reverse(),r){const y=t.calculative.worldAnchors.length-2;t.calculative.worldAnchors[y].isTemp=!1,t.calculative.worldAnchors[1].isTemp=!1}}function Df(e,t,i){const a={x:e.x,y:e.y,id:St()};switch(t){case It.Up:a.y-=i;break;case It.Right:a.x+=i;break;case It.Bottom:a.y+=i;break;case It.Left:a.x-=i;break;default:return}return a}function S_(e,t,i){if(e.x===t.x||e.y===t.y)return[];const a=[];let s,n;switch(i){case It.Up:e.y<t.y?(s=t.x,n=e.y):(s=e.x,n=t.y),a.push({x:s,y:n});break;case It.Bottom:if(s=t.x,n=e.y,t.y>e.y)s=e.x+(t.x-e.x)/2,a.push({x:s,y:e.y},{x:s,y:t.y});else{const r=(e.y+t.y)/2;a.push({x:e.x,y:r},{x:t.x,y:r})}break;case It.Right:s=t.x,n=e.y,t.x<e.x&&t.y<e.y&&(s=e.x,n=t.y),a.push({x:s,y:n});break;case It.Left:s=t.x,n=e.y,t.x>e.x&&t.y<e.y&&(s=e.x,n=t.y),a.push({x:s,y:n});break;default:if(t.y>e.y-Ue)s=e.x+(t.x-e.x)/2,a.push({x:s,y:e.y},{x:s,y:t.y});else{const r=(e.y+t.y+Ue)/2;a.push({x:e.x,y:r},{x:t.x,y:r})}break}return a}function I_(e,t,i){if(e.x===t.x||e.y===t.y)return[];const a=[];let s,n;switch(i){case It.Up:s=e.x,n=t.y,t.x>e.x&&t.y>e.y&&(s=t.x,n=e.y),a.push({x:s,y:n});break;case It.Bottom:s=e.x,n=t.y,t.x>e.x&&t.y<e.y&&(s=t.x,n=e.y),a.push({x:s,y:n});break;case It.Left:if(s=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{const r=(e.x+t.x)/2;a.push({x:r,y:n},{x:r,y:t.y})}break;case It.Right:t.x<e.x?a.push({x:e.x,y:t.y}):a.push({x:t.x,y:e.y});break;default:if(s=t.x,n=t.y,t.x<e.x+Ue)a.push({x:e.x,y:n});else{const r=(e.x+t.x-Ue)/2;a.push({x:r,y:e.y},{x:r,y:n})}break}return a}function B_(e,t,i){if(e.x===t.x||e.y===t.y)return[];const a=[];let s,n;switch(i){case It.Up:if(s=e.x,n=t.y,t.y<e.y)s=e.x+(t.x-e.x)/2,a.push({x:s,y:e.y},{x:s,y:t.y});else{const r=(e.y+t.y)/2;a.push({x:s,y:r},{x:t.x,y:r})}break;case It.Right:s=t.x,n=e.y,t.x<e.x&&t.y>e.y&&(s=e.x,n=t.y),a.push({x:s,y:n});break;case It.Bottom:e.y>t.y?(s=t.x,n=e.y):(s=e.x,n=t.y),a.push({x:s,y:n});break;case It.Left:s=t.x,n=e.y,t.x>e.x&&t.y>e.y&&(s=e.x,n=t.y),a.push({x:s,y:n});break;default:if(s=e.x,t.y<e.y+Ue)s=e.x+(t.x-e.x)/2,a.push({x:s,y:e.y},{x:s,y:t.y});else{const r=(e.y+t.y-Ue)/2;a.push({x:s,y:r},{x:t.x,y:r})}break}return a}function D_(e,t,i){if(e.x===t.x||e.y===t.y)return[];const a=[];let s,n;switch(i){case It.Up:s=e.x,n=t.y,t.x<e.x&&t.y>e.y&&(s=t.x,n=e.y),a.push({x:s,y:n});break;case It.Bottom:s=e.x,n=t.y,t.x<e.x&&t.y<e.y&&(s=t.x,n=e.y),a.push({x:s,y:n});break;case It.Right:if(s=e.x,n=t.y,t.x>e.x)s=t.x,n=e.y+(t.y-e.y)/2,a.push({x:e.x,y:n},{x:t.x,y:n});else{const r=(e.x+t.x)/2;a.push({x:r,y:e.y},{x:r,y:t.y})}break;case It.Left:t.x>e.x?a.push({x:e.x,y:t.y}):a.push({x:t.x,y:e.y});break;default:if(s=e.x,n=t.y,t.x<e.x-Ue){const r=(e.x+t.x+Ue)/2;a.push({x:r,y:e.y},{x:r,y:n})}else a.push({x:e.x,y:n});break}return a}function L_(e,t,i){const a=[];e.calculative.drawlineH==null&&(e.calculative.drawlineH=Math.abs(i.x-t.x)>Math.abs(i.y-t.y));let s=e.calculative.worldAnchors.findIndex(n=>n.id==t.id);if(s>1){let n=e.calculative.worldAnchors[s-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)<Ue&&(i.isTemp=!0)):(a.push({x:t.x,y:i.y}),Math.abs(i.x-t.x)<Ue&&(i.isTemp=!0))),a}function br(e,t,i=!0){var s,n;let a=e.calculative.worldAnchors;i||(a=[],e.calculative.worldAnchors.forEach(r=>{a.unshift(r)}));for(let r=0;r<a.length&&a[r].id!==t.id;r++)if(a[r].y!==t.y||a[r].x===((s=a[r+1])==null?void 0:s.x)&&a[r].y!==((n=a[r+1])==null?void 0:n.y))return!1;return!0}function xr(e,t,i=!0){var s,n;let a=e.calculative.worldAnchors;i||(a=[],e.calculative.worldAnchors.forEach(r=>{a.unshift(r)}));for(let r=0;r<a.length&&a[r].id!==t.id;r++)if(a[r].x!==t.x||a[r].y===((s=a[r+1])==null?void 0:s.y)&&a[r].x!==((n=a[r+1])==null?void 0:n.x))return!1;return!0}function M_(e,t,i){if(!e.calculative.worldAnchors)return;const a=e.calculative.worldAnchors.findIndex(o=>o.id===t.id),s=le(e),n=Vt(e);let r=e.calculative.worldAnchors[a-1],l=e.calculative.worldAnchors[a+1];if(e.calculative.h==null&&(s.connectTo&&(br(e,t,!0)?e.calculative.h=!0:xr(e,t,!0)&&(e.calculative.h=!1)),e.calculative.h==null&&n.connectTo&&(br(e,t,!1)?e.calculative.h=!0:xr(e,t,!1)&&(e.calculative.h=!1)),e.calculative.h==null&&(r?e.calculative.h=r.y===t.y:l&&(e.calculative.h=l.y===t.y))),e.calculative.h){if(t.x=i.x,s.connectTo&&br(e,t,!0)){l&&l.y!==t.y&&(l.x=t.x);return}if(n.connectTo&&br(e,t,!1)){r&&r.y!==t.y&&(r.x=t.x);return}const o=e.anchors[a];let u;for(let c=a-1;c>-1;c--)if(r=e.anchors[c],u==null&&(u=r.y===o.y),u===!0)if(r.y===o.y)e.calculative.worldAnchors[c].y=i.y;else break;else if(r.x===o.x)e.calculative.worldAnchors[c].x=i.x;else break;u=void 0;for(let c=a+1;c<e.calculative.worldAnchors.length&&(l=e.anchors[c],l);c++)if(u==null&&(u=l.y===o.y),u===!0)if(l.y===o.y)e.calculative.worldAnchors[c].y=i.y;else break;else if(l.x===o.x)e.calculative.worldAnchors[c].x=i.x;else break;t.y=i.y}else{if(t.y=i.y,s.connectTo&&xr(e,t,!0)){l&&l.x!==t.x&&(l.y=t.y);return}if(n.connectTo&&xr(e,t,!1)){r&&r.x!==t.x&&(r.y=t.y);return}const o=e.anchors[a];let u;for(let c=a-1;c>-1;c--)if(r=e.anchors[c],u==null&&(u=r.x===o.x),u===!0)if(r.x===o.x)e.calculative.worldAnchors[c].x=i.x;else break;else if(r.y===o.y)e.calculative.worldAnchors[c].y=i.y;else break;u=void 0;for(let c=a+1;c<e.calculative.worldAnchors.length&&(l=e.anchors[c],l);c++)if(u==null&&(u=l.x===o.x),u===!0)if(l.x===o.x)e.calculative.worldAnchors[c].x=i.x;else break;else if(l.y===o.y)e.calculative.worldAnchors[c].y=i.y;else break;t.x=i.x}}function ac(e,t,i,a){const s=[];let n,r,l,o,u,c,f,g,v,m,w,y,_,A;v=e[i],m=e[a],l=v.x,o=v.y,f=m.x-l,g=m.y-o,A=f*f+g*g,n=t;for(let x=i+1;x<a;x++)w=e[x],f!==0||g!==0?(y=((w.x-l)*f+(w.y-o)*g)/A,y>1?(u=w.x-m.x,c=w.y-m.y):y>0?(u=w.x-(l+f*y),c=w.y-(o+g*y)):(u=w.x-l,c=w.y-o)):(u=w.x-l,c=w.y-o),_=u*u+c*c,_>n&&(r=x,n=_);return n>t&&(r-i>1&&s.push(...ac(e,t,i,r)),s.push({id:e[r].id,penId:e[r].penId,x:e[r].x,y:e[r].y}),a-r>1&&s.push(...ac(e,t,r,a))),s}function O_(e,t=.8,i=!1){if(e.length<3)return e;let a,s,n,r,l,o,u,c,f,g,v,m,w,y,_;const A=(x,C,T,I)=>(r=Math.sqrt(x*x+C*C),r>0?(m=x/r,y=C/r):(m=1,y=0),l=Math.sqrt(T*T+I*I),l>0?(w=T/l,_=I/l):(w=1,_=0),Math.acos(m*w+y*_));g=[],v=e.length,a=e[0],e[v-1],g.push({...e[0]});for(let x=0;x<v-1;x++){if(s=e[x],n=e[x+1],f=Math.abs(A(s.x-a.x,s.y-a.y,n.x-s.x,n.y-s.y)),r)if(f<t*3.14)if(i&&(r=Math.min(r,l),l=r),o=(m+w)/2,u=(y+_)/2,c=Math.sqrt(o*o+u*u),c===0)g.push({...s});else{o/=c,u/=c;const C={...s};C.prevNextType=Na.Bilateral,C.prev={penId:C.penId,x:s.x-o*r*.25,y:s.y-u*r*.25},C.next={penId:C.penId,x:s.x+o*l*.25,y:s.y+u*l*.25},g.push(C)}else g.push({...s});a=s}return g.push({...e[e.length-1]}),g}function gg(e,t){const i=t||new Path2D,a=e.calculative.worldAnchors;let s=e.calculative.canvas.store.data.scale,n=(e.calculative.animateLineWidth||6)*s,r=(e.animateLineWidth*2||12)*s;e.lineAnimateType===We.WaterDrop&&(r=(e.animateLineWidth*4||24)*s);let l=(e.animateInterval||100)*s,o=e.calculative.lineWidth*(e.calculative.lineSmooth||0),u=(e.calculative.animateLineWidth/2||3)*s;if(e.animateReverse&&(r=-r,n=-n),a.length>1){let c,f=0;for(let g=0;g<a.length;g++){let v=a[g];if(c){let m=N_(c,v),w={x:c.x+(e.calculative.animatePos-f)%l*Math.cos(m*Math.PI/180),y:c.y-(e.calculative.animatePos-f)%l*Math.sin(m*Math.PI/180)};e.animateReverse&&(w={x:c.x+(e.length-(e.calculative.animatePos+f))%l*Math.cos(m*Math.PI/180),y:c.y-(e.length-(e.calculative.animatePos+f))%l*Math.sin(m*Math.PI/180)});let y=Math.sqrt((w.x-c.x)**2+(w.y-c.y)**2),_=Math.sqrt((v.x-c.x)**2+(v.y-c.y)**2);for(;y<_;)(e.animateReverse&&y-r<_||!e.animateReverse&&y>r)&&y>o+r&&_-y>o&&(e.lineAnimateType===We.Arrow?z_(i,w,n,m,u,r):e.lineAnimateType===We.WaterDrop&&H_(i,w,e.animateReverse,m,u,r)),w.x+=l*Math.cos(m*Math.PI/180),w.y-=l*Math.sin(m*Math.PI/180),y=Math.sqrt((w.x-c.x)**2+(w.y-c.y)**2)}c=v}}if(i instanceof Path2D)return i}function N_(e,t){let i=t.x-e.x,a=t.y-e.y,s=Math.atan(a/i)*180/Math.PI;return t.x>=e.x?s=-s:s=180-s,s}function va(e,t,i){let 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 z_(e,t,i,a,s,n){let r=va({x:t.x+i,y:t.y+.57*i},{x:t.x,y:t.y},a),l=va({x:t.x+i,y:t.y-.57*i},{x:t.x,y:t.y},a),o=va({x:t.x+i,y:t.y+s/2},{x:t.x,y:t.y},a),u=va({x:t.x+n,y:t.y+s/2},{x:t.x,y:t.y},a),c=va({x:t.x+i,y:t.y-s/2},{x:t.x,y:t.y},a),f=va({x:t.x+n,y:t.y-s/2},{x:t.x,y:t.y},a);e.moveTo(r.x,r.y),e.lineTo(t.x,t.y),e.lineTo(l.x,l.y),e.lineTo(c.x,c.y),e.lineTo(f.x,f.y),e.lineTo(u.x,u.y),e.lineTo(o.x,o.y),e.lineTo(r.x,r.y)}function H_(e,t,i,a,s,n){let r=s/2;i&&(r=-s/2);let l=va({x:t.x,y:t.y+r},{x:t.x,y:t.y},a),o=va({x:t.x+n,y:t.y},{x:t.x,y:t.y},a),u=Math.PI/2;i&&(u=-Math.PI/2),e.moveTo(t.x,t.y),e.arc(t.x,t.y,s/2,-u-a/180*Math.PI,u-a/180*Math.PI,!1),e.lineTo(o.x,o.y),e.lineTo(l.x,l.y)}function W_(e){var i;e.onDestroy||(e.onDestroy=U_,e.onMove=_r,e.onResize=_r,e.onRotate=_r,e.onValue=_r,e.onMouseMove=$_,e.onBeforeValue=V_,e.onRenderPenRaw=j_),e.calculative.singleton||(e.calculative.singleton={});const t=e.calculative.worldRect;if(!e.calculative.singleton.div){const a=document.createElement("div");a.style.position="absolute",a.style.outline="none",a.style.left="-9999px",a.style.top="-9999px",a.style.width=t.width+"px",a.style.height=t.height+"px",document.body.appendChild(a),(i=e.calculative.canvas.externalElements)==null||i.parentElement.appendChild(a),Fe(e,a),e.calculative.singleton.div=a;const s=document.createElement("iframe");s.style.width="100%",s.style.height="100%",s.scrolling=e.scrolling||"no",s.frameBorder="0",s.style.border="none",s.src=e.iframe,e.calculative.iframe=e.iframe,a.appendChild(s),mg(e),s.onload=()=>{s.setAttribute("document.domain","")}}return e.calculative.patchFlags&&Fe(e,e.calculative.singleton.div),e.onRenderPenRaw(e),new Path2D}function U_(e){yg(e),e.calculative.singleton&&e.calculative.singleton.div&&(e.calculative.singleton.div.remove(),delete e.calculative.singleton.div)}function _r(e){e.calculative.singleton.div&&Fe(e,e.calculative.singleton.div)}function V_(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={});let i=ht(t);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&&(e.calculative.singleton.div.children.length===1?mg(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(let i=1;i<5;i++)e.calculative.singleton.div.children[i].style["backdrop-filter"]=`blur(${t.blur||2}px)`;if(t.blurBackground!==void 0)for(let i=1;i<5;i++)e.calculative.singleton.div.children[i].style.backgroundColor=t.blurBackground;return t}function $_(e,t){if(!(!e.calculative.canvas.store.data.locked&&!e.locked)&&vg(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){let i=e.calculative.singleton.div.parentNode.children;for(let a=0;a<6;a++)i[a].style.pointerEvents="none"}}function vg(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 mg(e){if(!vg(e.operationalRect))return;const t=e.calculative.singleton.div;if(!t)return;const 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);const 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);const s=document.createElement("div");s.style.position="absolute",s.style.left=e.operationalRect.x*100+"%",s.style.bottom="0px",s.style.width=e.operationalRect.width*100+"%",s.style.height=(1-e.operationalRect.y-e.operationalRect.height)*100+"%",s.style["backdrop-filter"]=`blur(${e.blur||2}px)`,s.style.backgroundColor=e.blurBackground,t.appendChild(s);const 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);let r=()=>{yg(e)};i.onmouseenter=r,s.onmouseenter=r,a.onmouseenter=r,n.onmouseenter=r,t.onmouseleave=r}function yg(e){if(!(!e.calculative.canvas.store.data.locked&&!e.locked)&&e.calculative.zIndex<5){let t=e.calculative.singleton.div.parentNode.children;for(let i=1;i<6;i++)t[i].style.pointerEvents="initial"}}function j_(e){if(e.thumbImg&&!e.calculative.img){const 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=i=>{t.remove(),e.calculative.img=void 0},e.calculative.img=t}}const Ve={},Br=['<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 q_(e){var t;if(e.onDestroy||(e.onDestroy=Y_,e.onMove=Bl,e.onResize=Bl,e.onRotate=Bl,e.onClick=Lf,e.onValue=X_,e.onChangeId=K_),Ve[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{const 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");const s=document.createElement("div");s.innerHTML=Br[1],s.style.position="absolute",s.style.right="0",s.style.bottom="0",s.style.width="20px",s.style.height="20px",s.style.fill="hsla(0, 0%, 100%, .8)",s.style.zIndex="1",s.style.display="none",i.appendChild(a),i.appendChild(s),s.onclick=r=>{r.stopPropagation(),e.calculative.media.muted?(s.innerHTML=Br[0],e.calculative.media.muted=!1):(s.innerHTML=Br[1],e.calculative.media.muted=!0)},e.calculative.singleton||(e.calculative.singleton={}),e.calculative.singleton.muted=s,i.onmouseenter=r=>{e.hideMuted||(s.style.display="block")},i.onmouseleave=r=>{s.style.display="none"},i.onclick=r=>{r.stopPropagation(),Lf(e)};let n;e.audio?(n=document.createElement("audio"),n.controls=e.controls,n.src=e.audio):(n=document.createElement("video"),n.src=e.video),n.loop=e.playLoop,n.ontimeupdate=()=>{pg(a,n,e.calculative.worldRect.width)},n.onended=()=>{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%",n.style.objectFit=e.objectFit||"contain",i.appendChild(n),Ve[e.id]=i,(t=e.calculative.canvas.externalElements)==null||t.parentElement.appendChild(i),Fe(e,i),e.autoPlay&&(n.autoplay=!0,n.muted=!0)}return e.calculative.patchFlags&&Fe(e,Ve[e.id]),new Path2D}function Y_(e){Ve[e.id].onclick=null,Ve[e.id].remove(),Ve[e.id]=void 0}function Bl(e){Fe(e,Ve[e.id]);const t=Ve[e.id].children[0],i=Ve[e.id].children[1];pg(t,i,e.calculative.worldRect.width)}function Lf(e){e.calculative.media&&(e.calculative.media.muted=!1,e.calculative.singleton.muted.innerHTML=Br[0],e.calculative.media.paused?e.calculative.media.play():e.calculative.media.pause())}function pg(e,t,i){e.style.width=t.currentTime/t.duration*i+"px"}function K_(e,t,i){!Ve[t]||(Ve[i]=Ve[t],delete Ve[t])}function X_(e){const t=Ve[e.id];if(!t)return;Fe(e,t),e.calculative.media||(e.calculative.media=t.querySelector("video"));const 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}function Pi(){try{const e=new OffscreenCanvas(0,0),t=e.getContext("2d");return t&&t.arc?e:document.createElement("canvas")}catch{return document.createElement("canvas")}}class on{constructor(t,i){W(this,"parentElement");W(this,"store");W(this,"box");W(this,"text");W(this,"arrowUp");W(this,"arrowDown");W(this,"x");W(this,"y");W(this,"currentPen");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=()=>{this.hide(),this.store.lastHover=void 0};let a;for(let s=0;s<document.styleSheets.length;s++)document.styleSheets[s].title==="le5le.com/tooltip"&&(a=document.styleSheets[s]);if(!a){let s=document.createElement("style");s.type="text/css",s.title="le5le.com/tooltip",document.head.appendChild(s),s=document.createElement("style"),s.type="text/css",document.head.appendChild(s),a=s.sheet,a.insertRule(".meta2d-tooltip{position:absolute;padding:8px 0;z-index:10;left: -9999px;top: -9999px;}"),a.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;}"),a.insertRule(".meta2d-tooltip .arrow{position:absolute;border:10px solid transparent;background:transparent;top:-5px;left:50%;transform:translateX(-50%)}"),a.insertRule(".meta2d-tooltip .arrow.down{top:initial;bottom: -1px;}")}}static getTitle(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)}setText(t){const i=this.box.getBoundingClientRect();let a=globalThis.marked;const s=on.getTitle(t);if(a){this.text.innerHTML=a(s);const n=this.text.getElementsByTagName("A");for(let r=0;r<n.length;++r)n[r].setAttribute("target","_blank")}else this.text.innerHTML=s;return i}updateText(t){var s;if(((s=this.currentPen)==null?void 0:s.id)!==t.id||on.titleEmpty(t))return;const i=this.setText(t),a=this.box.getBoundingClientRect();this.changePositionByText(i,a)}changePositionByText(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"}static titleEmpty(t){return!t.title&&!t.titleFn&&!t.titleFnJs}show(t,i){if(this.currentPen=t,on.titleEmpty(t)){let l=ti(t,!0);l&&this.show(l,i);return}this.setText(t);const a=this.box.getBoundingClientRect(),s=t.calculative.worldRect;let n=t.calculative.canvas.store.data.x+i.x-a.width/2,r=t.calculative.canvas.store.data.y+i.y-a.height;t.type||(n=t.calculative.canvas.store.data.x+s.x-(a.width-s.width)/2,r=t.calculative.canvas.store.data.y+s.ey-a.height-s.height),r>0?(this.arrowUp.style.borderBottomColor="transparent",this.arrowDown.style.borderTopColor="#777777"):(r+=a.height+s.height+5,this.arrowUp.style.borderBottomColor="#777777",this.arrowDown.style.borderTopColor="transparent"),this.x=n,this.y=r,this.box.style.left=this.x+"px",this.box.style.top=this.y+"px"}hide(){this.currentPen=null,this.x=-9999,this.box.style.left="-9999px"}translate(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")}destroy(){this.box.onmouseleave=null}}class wg{constructor(t){W(this,"parent");W(this,"h");W(this,"v");W(this,"isDownH");W(this,"isDownV");W(this,"x");W(this,"y");W(this,"hSize");W(this,"vSize");W(this,"scrollX");W(this,"scrollY");W(this,"lastScrollX");W(this,"lastScrollY");W(this,"rect");W(this,"isShow");W(this,"pageMode");W(this,"onMouseDownH",t=>{t.preventDefault(),t.stopPropagation(),this.isDownH=t.x,this.x=this.parent.store.data.x||0,this.lastScrollX=this.scrollX});W(this,"onMouseDownV",t=>{t.preventDefault(),t.stopPropagation(),this.isDownV=t.y,this.y=this.parent.store.data.y||0,this.lastScrollY=this.scrollY});W(this,"onMouseMove",t=>{if(this.isDownH){const i=t.x-this.isDownH;this.scrollX=this.lastScrollX+i,this.h.style.left=`${this.scrollX}px`,this.parent.store.data.x=this.x-i*this.rect.width/this.parent.parentElement.clientWidth}if(this.isDownV){const i=t.y-this.isDownV;if(this.pageMode&&this.canMouseMove(i))return;this.scrollY=this.lastScrollY+i,this.v.style.top=`${this.scrollY}px`,this.parent.store.data.y=this.y-i*this.rect.height/this.parent.parentElement.clientHeight}(this.isDownH||this.isDownV)&&(this.parent.onMovePens(),this.parent.canvasTemplate.init(),this.parent.canvasImage.init(),this.parent.canvasImageBottom.init(),this.parent.render())});W(this,"onMouseUp",t=>{!this.isDownH&&!this.isDownV||(this.isDownH=void 0,this.isDownV=void 0,this.scrollX<20?(this.scrollX=20,this.h.style.left=`${this.scrollX}px`):this.scrollX>this.parent.parentElement.clientWidth-this.hSize-20&&(this.scrollX=this.parent.parentElement.clientWidth-this.hSize-20,this.h.style.left=`${this.scrollX}px`),this.scrollY<20?(this.scrollY=20,this.v.style.top=`${this.scrollY}px`):this.scrollY>this.parent.parentElement.clientHeight-this.vSize-20&&(this.scrollY=this.parent.parentElement.clientHeight-this.vSize-20,this.v.style.top=`${this.scrollY}px`),this.resize())});this.parent=t,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);let i;for(let a=0;a<document.styleSheets.length;a++)document.styleSheets[a].title==="le5le/scroll"&&(i=document.styleSheets[a]);if(!i){let a=document.createElement("style");a.type="text/css",a.title="le5le.com/scroll",document.head.appendChild(a),a=document.createElement("style"),a.type="text/css",document.head.appendChild(a),i=a.sheet,i.insertRule(".meta2d-scroll{position:absolute;width:8px;height:200px;background:#dddddd;border-radius:10px;z-index:20;cursor:default;}"),i.insertRule(".meta2d-scroll:hover{background:#cccccc;cursor:pointer}"),i.insertRule(".meta2d-scroll.v{right:0;top:calc(50% - 100px);}"),i.insertRule(".meta2d-scroll.h{bottom:2px;left:calc(50% - 100px);width:200px;height:8px;}")}this.init()}init(){this.isShow=!0,this.resize(),this.initPos()}canMouseMove(t){const 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}changeMode(){this.pageMode=!0,this.h.style.display="none",this.parent.parent.getRect().height<this.parent.height&&(this.v.style.display="none")}initPos(){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`}resize(){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"}show(){this.isShow=!0,this.h.style.display="block",this.v.style.display="block",document.addEventListener("mousemove",this.onMouseMove),document.addEventListener("mouseup",this.onMouseUp)}hide(){this.isShow=!1,this.h.style.display="none",this.v.style.display="none",this.destroy()}translate(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`)}wheel(t){let 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())}destroy(){document.removeEventListener("mousemove",this.onMouseMove),document.removeEventListener("mouseup",this.onMouseUp)}}class Mf{constructor(t,i,a){W(this,"parentElement");W(this,"store");W(this,"isBottom");W(this,"canvas",document.createElement("canvas"));W(this,"otherOffsreen",Pi());W(this,"offscreen",Pi());W(this,"animateOffsScreen",Pi());W(this,"fitOffscreen",Pi());W(this,"fitFlag",!1);W(this,"currentFit");W(this,"activeFit");this.parentElement=t,this.store=i,this.isBottom=a,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"}resize(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.fitOffscreen.width=t,this.fitOffscreen.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.fitOffscreen.getContext("2d").scale(this.store.dpiRatio,this.store.dpiRatio),this.fitOffscreen.getContext("2d").textBaseline="middle",this.init()}init(){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.fitOffscreen.getContext("2d").clearRect(0,0,this.canvas.width,this.canvas.height);for(const t of this.store.data.pens)this.hasImage(t)&&(t.calculative.imageDrawed=!1);this.isBottom?this.store.patchFlagsBackground=!0:this.store.patchFlagsTop=!0}clear(){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.fitOffscreen.getContext("2d").clearRect(0,0,this.canvas.width,this.canvas.height),this.canvas.getContext("2d").clearRect(0,0,this.canvas.width,this.canvas.height)}hasImage(t){return t.calculative.hasImage=t.calculative&&t.calculative.inView&&(this.isBottom&&t.canvasLayer===zt.CanvasImageBottom||!this.isBottom&&t.canvasLayer===zt.CanvasImage)&&t.image&&t.calculative.img&&t.name!=="gif",t.calculative.hasImage}render(){var r;let t=!1,i=!1;for(const l of this.store.data.pens)this.hasImage(l)&&(this.store.animates.has(l)?i=!0:l.calculative.imageDrawed||(t=!0),l.parentId&&this.store.animates.has(ti(l,!0))&&(i=!0));const a=this.store.patchFlagsBackground,s=this.store.patchFlagsTop;if(s&&!this.isBottom){const l=this.otherOffsreen.getContext("2d");l.clearRect(0,0,this.canvas.width,this.canvas.height),this.renderRule(l)}if(this.store.patchFlagsLast&&this.offscreen.getContext("2d").clearRect(0,0,this.canvas.width,this.canvas.height),t){const l=this.offscreen.getContext("2d");l.save(),l.clearRect(0,0,this.canvas.width,this.canvas.height),l.translate(this.store.data.x,this.store.data.y);for(const o of this.store.data.pens)!o.calculative.hasImage||this.store.animates.has(o)||this.store.animates.has(ti(o,!0))||o.canvasLayer!==zt.CanvasTemplate&&(o.calculative.imageDrawed=!0,l.save(),za(l,o),o.calculative.rotate&&Gi(l,o),Ha(l,o),Es(l,o),l.restore());l.restore()}if(i){const l=this.animateOffsScreen.getContext("2d");l.save(),l.clearRect(0,0,this.canvas.width,this.canvas.height),l.translate(this.store.data.x,this.store.data.y);for(const o of this.store.animates)!o.calculative.hasImage||o.canvasLayer!==zt.CanvasTemplate&&(o.visible===!1||o.calculative.visible===!1||(o.calculative.imageDrawed=!0,l.save(),za(l,o),o.calculative.rotate&&Gi(l,o),Ha(l,o),Es(l,o),l.restore()));for(const o of this.store.data.pens)!o.calculative.hasImage||!o.parentId||o.canvasLayer!==zt.CanvasTemplate&&(o.visible===!1||o.calculative.visible===!1||this.store.animates.has(ti(o,!0))&&(o.calculative.imageDrawed=!0,l.save(),za(l,o),o.calculative.rotate&&Gi(l,o),Ha(l,o),Es(l,o),l.restore()));l.restore()}if(!this.isBottom&&!this.store.data.locked&&this.fitFlag){const l=(this.store.data.width||this.store.options.width)*this.store.data.scale,o=(this.store.data.height||this.store.options.height)*this.store.data.scale,u=this.store.data.origin.x+this.store.data.x||this.store.options.x||0,c=this.store.data.origin.y+this.store.data.y||this.store.options.y||0,f=this.fitOffscreen.getContext("2d");f.save(),f.clearRect(0,0,this.canvas.width,this.canvas.height),f.fillStyle="#ffffff66",f.strokeStyle=this.store.styles.activeColor,(r=this.store.data.fits)==null||r.forEach((g,v)=>{f.fillRect(u+l*g.x,c+o*g.y,l*g.width,o*g.height),g.active&&f.strokeRect(u+l*g.x,c+o*g.y,l*g.width,o*g.height)}),f.restore()}if(t||i||a&&this.isBottom||s&&!this.isBottom){const 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,!this.store.data.locked&&this.fitFlag&&l.drawImage(this.fitOffscreen,0,0,this.canvas.width,this.canvas.height))}}renderRule(t){var x,C,T,I,D,B,V,Q;const{data:i,options:a}=this.store,{rule:s,ruleColor:n,scale:r,origin:l}=i;if(!(s!=null?s:a.rule))return;const o=r*10;t.save();const u=n||a.ruleColor||"#ccc";t.strokeStyle=Wr(u,.7);const c=l.x+i.x,f=l.y+i.y,{width:g,height:v}=this.canvas;let m=((x=a.ruleOptions)==null?void 0:x.height)||20;(C=a.ruleOptions)!=null&&C.background&&(t.beginPath(),t.fillStyle=(T=a.ruleOptions)==null?void 0:T.background,t.rect(0,0,g,m),t.fill(),t.rect(0,0,m,v),t.fill()),(I=a.ruleOptions)!=null&&I.underline&&(t.beginPath(),t.fillStyle=Wr(u,.7),t.moveTo(0,m),t.lineTo(g,m),t.stroke(),t.moveTo(m,0),t.lineTo(m,v),t.stroke());let w=m/4;((D=a.ruleOptions)==null?void 0:D.baseline)==="bottom"&&(w=m*3/4),t.beginPath(),t.lineWidth=m/2,t.lineDashOffset=-c%o,t.setLineDash([1,o-1]),t.moveTo(0,w),t.lineTo(g,w),t.stroke(),t.beginPath(),t.lineDashOffset=-f%o,t.moveTo(w,0),t.lineTo(w,v),t.stroke(),t.strokeStyle=u,t.beginPath(),t.lineWidth=m,t.lineDashOffset=-c%(o*10),t.setLineDash([1,o*10-1]),t.moveTo(0,m/2),t.lineTo(g,m/2),t.stroke(),t.beginPath(),t.lineDashOffset=-f%(o*10),t.moveTo(m/2,0),t.lineTo(m/2,v),t.stroke(),t.beginPath(),t.fillStyle=((B=a.ruleOptions)==null?void 0:B.textColor)||t.strokeStyle;let y=0-Math.floor(c/o/10)*100,_=((V=a.ruleOptions)==null?void 0:V.textTop)||16,A=((Q=a.ruleOptions)==null?void 0:Q.textLeft)||4;c<0&&(y-=100);for(let F=c%(o*10);F<g;F+=10*o,y+=100)o<3&&y%500||t.fillText(y.toString(),F+A,_);y=0-Math.floor(f/o/10)*100,f<0&&(y-=100);for(let F=f%(o*10);F<v;F+=10*o,y+=100)o<3&&y%500||(t.save(),t.beginPath(),t.translate(_,F-A),t.rotate(270*Math.PI/180),t.fillText(y.toString(),0,0),t.restore());t.restore()}}class G_{constructor(t,i,a){W(this,"parentCanvas");W(this,"parentElement");W(this,"store");W(this,"canvas",document.createElement("canvas"));W(this,"magnifierScreen",Pi());W(this,"offscreen",Pi());W(this,"domOffscreen",Pi());W(this,"magnifierSize",300);W(this,"magnifier");this.parentCanvas=t,this.parentElement=i,this.store=a,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",this.canvas.style.pointerEvents="none"}resize(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.domOffscreen.width=t,this.domOffscreen.height=i,this.domOffscreen.getContext("2d").scale(this.store.dpiRatio,this.store.dpiRatio),this.domOffscreen.getContext("2d").textBaseline="middle",this.magnifierScreen.width=this.magnifierSize+5,this.magnifierScreen.height=this.magnifierSize+5}renderMagnifier(){if(!this.magnifier)return;const t=this.magnifierSize/2,i=this.magnifierSize+5,a=this.magnifierScreen.getContext("2d");a.clearRect(0,0,i,i),a.lineWidth=5,a.save(),a.translate(2.5,2.5),a.save(),a.arc(t,t,t,0,Math.PI*2,!1),a.clip(),a.translate(-t,-t),a.scale(2,2);const s={x:(this.parentCanvas.mousePos.x+this.store.data.x)*this.store.dpiRatio,y:(this.parentCanvas.mousePos.y+this.store.data.y)*this.store.dpiRatio};[this.parentCanvas.canvasTemplate.bgOffscreen,this.parentCanvas.canvasTemplate.offscreen,this.parentCanvas.canvasImageBottom.offscreen,this.parentCanvas.canvasImageBottom.animateOffsScreen,this.parentCanvas.offscreen,this.parentCanvas.canvasImage.offscreen,this.parentCanvas.canvasImage.animateOffsScreen,this.domOffscreen].forEach(o=>{a.drawImage(o,s.x-t,s.y-t,this.magnifierSize,this.magnifierSize,0,0,this.magnifierSize,this.magnifierSize)}),a.restore(),a.beginPath();const r=a.createRadialGradient(t,t,t-5,t,t,t);r.addColorStop(0,"rgba(0,0,0,0.2)"),r.addColorStop(.8,"rgb(200,200,200)"),r.addColorStop(.9,"rgb(200,200,200)"),r.addColorStop(1,"rgba(200,200,200,0.9)"),a.strokeStyle=r,a.arc(t,t,t,0,Math.PI*2,!1),a.stroke(),a.restore(),this.offscreen.getContext("2d").drawImage(this.magnifierScreen,0,0,this.magnifierSize+5,this.magnifierSize+5,(s.x-t-2.5)/this.store.dpiRatio,(s.y-t-2.5)/this.store.dpiRatio,(this.magnifierSize+5)/this.store.dpiRatio,(this.magnifierSize+5)/this.store.dpiRatio)}updateDomOffscreen(){const t=this.domOffscreen.getContext("2d");t.clearRect(0,0,this.domOffscreen.width,this.domOffscreen.height);for(const i of this.store.data.pens)if((i.externElement||i.name==="gif")&&i.calculative.img){t.save(),t.translate(this.store.data.x,this.store.data.y);const{x:a,y:s,width:n,height:r}=i.calculative.worldRect;t.drawImage(i.calculative.img,a,s,n,r),t.restore()}}render(){this.offscreen.getContext("2d").clearRect(0,0,this.canvas.width,this.canvas.height),this.renderMagnifier();const 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)}}function bg(e){if(e.data.locked)throw new Error("canvas is locked")}class Z_{constructor(t,i){W(this,"parentElement");W(this,"box");W(this,"iframe");W(this,"dialog");W(this,"close");W(this,"title");W(this,"body");W(this,"x");W(this,"y");W(this,"url");W(this,"meta2dDiv");W(this,"dialogMeta2d");W(this,"store");this.parentElement=t,this.store=i,this.box=document.createElement("div"),this.dialog=document.createElement("div");let a=document.createElement("div");this.title=document.createElement("div"),this.close=document.createElement("span"),this.close.innerHTML=`
  3. <svg fill="none" viewBox="0 0 16 16" width="1em" height="1em">
  4. <path
  5. fill="currentColor"
  6. 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"
  7. fill-opacity="0.9"
  8. ></path>
  9. </svg>`,this.body=document.createElement("div"),this.iframe=document.createElement("iframe"),this.iframe.setAttribute("frameborder","0"),this.meta2dDiv=document.createElement("div"),this.box.className="meta2d-dialog_mask",this.dialog.className="meta2d-dialog",this.body.className="meta2d-dialog_body",a.className="meta2d-dialog_header",this.title.className="meta2d-dialog-content",this.close.className="meta2d-dialog-close",this.meta2dDiv.className="meta2d-dialog-meta2d",a.appendChild(this.title),a.appendChild(this.close),this.body.appendChild(this.iframe),this.body.appendChild(this.meta2dDiv),this.dialog.appendChild(a),this.dialog.appendChild(this.body),this.box.appendChild(this.dialog),t.appendChild(this.box),this.dialog.onclick=n=>{n.stopPropagation()},this.box.onclick=()=>{this.hide()},this.close.onclick=()=>{this.hide()};let s;for(let n=0;n<document.styleSheets.length;n++)document.styleSheets[n].title==="le5le.com/dialog"&&(s=document.styleSheets[n]);if(!s){let n=document.createElement("style");n.type="text/css",n.title="le5le.com/dialog",document.head.appendChild(n),n=document.createElement("style"),n.type="text/css",document.head.appendChild(n),s=n.sheet,s.insertRule(`.meta2d-dialog_mask {
  10. display: none;
  11. position: absolute;
  12. top: 0%;
  13. left: 0%;
  14. width: 100%;
  15. height: 100%;
  16. background-color: #0000006f;
  17. z-index: 9999;`),s.insertRule(`.meta2d-dialog_mask .meta2d-dialog {
  18. position: absolute;
  19. top: 15vh;
  20. left: 10%;
  21. width: 80%;
  22. height:420px;
  23. padding: 16px 20px;
  24. border-radius: 9px;
  25. z-index: 19999;
  26. overflow: auto;
  27. }`),s.insertRule(`.meta2d-dialog_header {
  28. display: flex;
  29. position: relative;
  30. z-index: 999;
  31. }`),s.insertRule(`.meta2d-dialog-content {
  32. width: calc(100% - 20px);
  33. font-weight: 600;
  34. font-size: 14px;
  35. color: #bdc7db;
  36. padding-bottom:8px;
  37. }`),s.insertRule(`.meta2d-dialog-close {
  38. width: 20px;
  39. height: 20px;
  40. line-height: 20px;
  41. text-align: center;
  42. color: #617b91;
  43. position: absolute;
  44. right:20px;
  45. top:2px;
  46. }`),s.insertRule(`.meta2d-dialog-close svg{
  47. width: 18px;
  48. height: 18px;
  49. }`),s.insertRule(`.meta2d-dialog-close :hover{
  50. cursor: pointer;
  51. }`),s.insertRule(`.meta2d-dialog_body{
  52. width: 100%;
  53. height: 100%;
  54. } `),s.insertRule(`.meta2d-dialog_body iframe{
  55. width: 100%;
  56. height: 100%;
  57. }`),s.insertRule(`.meta2d-dialog_body .meta2d-dialog-meta2d{
  58. width: 100%;
  59. height: 100%;
  60. display: none;
  61. }`)}}async show(t,i,a,s){if(!i)return;const n=this.isUrl(i);if(n?(this.meta2dDiv.style.display="none",this.iframe.style.display="block"):(this.iframe.style.display="none",this.meta2dDiv.style.display="block"),n&&i!==this.url&&(this.iframe.setAttribute("src",i),this.url=i),t&&(this.title.innerText=t),t?(this.dialog.style.padding="16px 20px",this.title.style.display="block",this.body.style.height="calc(100% - 26px)",this.close.style.top="2px",this.close.style.right="2px",this.body.style.background="#1e2430"):(this.dialog.style.padding="0px",this.title.style.display="none",this.body.style.height="100%",this.body.style.overflow="hidden",this.close.style.top="18px",this.close.style.right="20px",this.body.style.background="transparent"),a&&(this.dialog.style.width=a.width?a.width+"px":"80%",this.dialog.style.height=a.height?a.height+"px":"420px",this.dialog.style.top=a.y?a.y+"px":a.height?`calc( 50% - ${a.height/2}px )`:"15vh",this.dialog.style.left=a.x?a.x+"px":`calc( 50% - ${a.width?a.width/2+"px":"40%"} )`),n&&s){let r=0;const l=setInterval(()=>{this.iframe.contentWindow.meta2d&&(clearInterval(l),setTimeout(()=>{this.iframe.contentWindow.postMessage(JSON.stringify({name:"dialog",data:s}),"*")},100)),r++,r>50&&clearInterval(l)},300)}if((!this.dialogMeta2d||n)&&(this.box.style.display="block"),!n){this.meta2dDiv.style.display="block",this.dialogMeta2d||(globalThis.mainMeta2d=globalThis.meta2d,this.dialogMeta2d=new TE(this.meta2dDiv),globalThis.meta2d=globalThis.mainMeta2d);const r=await $d(this.store,i);r&&(this.box.style.display="block",this.dialogMeta2d.clear(!0),this.dialogMeta2d.open(r,!1),this.dialogMeta2d.lock(1),this.dialogMeta2d.resize(),this.dialogMeta2d.fitView(!0,0),this.dialogMeta2d.render(!0))}}hide(){this.box.style.display="none"}isUrl(t){return!!(t.startsWith("http")||t.includes("?")||t.includes("/"))}destroy(){var t;this.dialog.onclick=void 0,this.box.onclick=void 0,this.close.onclick=void 0,(t=this.dialogMeta2d)==null||t.destroy(!0)}}class Kr{constructor(t){W(this,"parentElement");W(this,"box");W(this,"currentAnchor");this.parentElement=t,this.box=document.createElement("div"),this.box.className="meta2d-title",t.appendChild(this.box);let i;for(let a=0;a<document.styleSheets.length;a++)document.styleSheets[a].title==="le5le.com/title"&&(i=document.styleSheets[a]);if(!i){let a=document.createElement("style");a.type="text/css",a.title="le5le.com/title",document.head.appendChild(a),a=document.createElement("style"),a.type="text/css",document.head.appendChild(a),i=a.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;}")}}static getTitle(t){}setText(t){this.box.innerText=t.title}updateText(t){var i;((i=this.currentAnchor)==null?void 0:i.id)===t.id&&(Kr.titleEmpty(t)||(this.setText(t),this.changePositionByAnchor(t)))}changePositionByAnchor(t){this.box.style.left=t.x+10+"px",this.box.style.top=t.y+10+"px"}static titleEmpty(t){return!t.title}show(t,i){if(Kr.titleEmpty(t))return;this.currentAnchor=t,this.setText(t);let a={x:i.calculative.canvas.store.data.x+t.x,y:i.calculative.canvas.store.data.y+t.y};this.changePositionByAnchor(a)}hide(){this.box.style.left="-9999px",this.box.innerText="",this.currentAnchor=null}destroy(){this.box.onmouseleave=null}}class J_{constructor(t,i){W(this,"parentElement");W(this,"store");W(this,"canvas",document.createElement("canvas"));W(this,"offscreen",Pi());W(this,"bgOffscreen",Pi());W(this,"patchFlags");W(this,"bgPatchFlags");W(this,"fit");this.parentElement=t,this.store=i,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"}resize(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()}init(){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}hidden(){this.canvas.style.display="none"}show(){this.canvas.style.display="block"}clear(){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}render(){var t;if(this.bgPatchFlags){const i=this.bgOffscreen.getContext("2d");i.clearRect(0,0,this.canvas.width,this.canvas.height);const a=this.store.data.width||this.store.options.width,s=this.store.data.height||this.store.options.height,n=this.store.data.x||this.store.options.x||0,r=this.store.data.y||this.store.options.y||0,l=this.store.data.background||this.store.styles.background;l&&(i.save(),i.fillStyle=l,i.globalAlpha=(t=this.store.data.globalAlpha)!=null?t:this.store.options.globalAlpha,a&&s&&!this.fit?(i.shadowOffsetX=this.store.options.shadowOffsetX,i.shadowOffsetY=this.store.options.shadowOffsetY,i.shadowBlur=this.store.options.shadowBlur,i.shadowColor=this.store.options.shadowColor,i.fillRect(this.store.data.origin.x+n,this.store.data.origin.y+r,a*this.store.data.scale,s*this.store.data.scale)):i.fillRect(0,0,this.canvas.width,this.canvas.height),i.restore()),a&&s&&this.store.bkImg&&(i.save(),this.fit?i.drawImage(this.store.bkImg,0,0,this.canvas.offsetWidth,this.canvas.offsetHeight):i.drawImage(this.store.bkImg,this.store.data.origin.x+n,this.store.data.origin.y+r,a*this.store.data.scale,s*this.store.data.scale),i.restore()),this.renderGrid(i)}if(this.patchFlags){const i=this.offscreen.getContext("2d");i.save(),i.clearRect(0,0,this.canvas.width,this.canvas.height),i.translate(this.store.data.x,this.store.data.y);for(const a of this.store.data.pens)!isFinite(a.x)||a.canvasLayer===zt.CanvasTemplate&&a.calculative.inView&&(Sa(i,a),a.image&&a.name!=="gif"&&a.calculative.img&&(i.save(),za(i,a),a.calculative.rotate&&Gi(i,a),Ha(i,a),Es(i,a),i.restore()));i.restore()}if(this.patchFlags||this.bgPatchFlags){const i=this.canvas.getContext("2d");i.clearRect(0,0,this.canvas.width,this.canvas.height),i.drawImage(this.bgOffscreen,0,0,this.canvas.width,this.canvas.height),i.drawImage(this.offscreen,0,0,this.canvas.width,this.canvas.height),this.patchFlags=!1,this.bgPatchFlags=!1}}renderGrid(t){const{data:i,options:a}=this.store,{grid:s,gridRotate:n,gridColor:r,gridSize:l,scale:o,origin:u}=i;if(!(s!=null?s:a.grid))return;t.save();const c=(i.width||a.width)*o,f=(i.height||a.height)*o,g=(i.x||a.x||0)+u.x,v=(i.y||a.y||0)+u.y;t.lineWidth=1,t.strokeStyle=r||a.gridColor,t.beginPath();let m=(l||a.gridSize)*o;if(m=m<0?0:m,!c||!f){const w=this.store.dpiRatio,y=this.canvas.width/w,_=this.canvas.height/w,A=g/m,x=v/m,C=m*10,T=g-Math.ceil(A)*m,I=v-Math.ceil(x)*m,D=y+T+C,B=_+I+C;if(n){const V=n*Math.PI/180,Q=V+Math.PI/2,F={x:Math.sin(V),y:-Math.cos(V)},R={x:Math.sin(Q),y:-Math.cos(Q)};Of(t,y,_,m,F),Of(t,y,_,m,R)}else{for(let V=T;V<=D;V+=m)t.moveTo(V,I),t.lineTo(V,_+I+C);for(let V=I;V<=B;V+=m)t.moveTo(T,V),t.lineTo(y+T+C,V)}}else if(n){const w=n*Math.PI/180,y=w+Math.PI/2,_={x:Math.sin(w),y:-Math.cos(w)},A={x:Math.sin(y),y:-Math.cos(y)};Nf(t,g,v,c,f,m,_),Nf(t,g,v,c,f,m,A)}else{const w=c+g,y=f+v;for(let _=g;_<=w;_+=m)t.moveTo(_,v),t.lineTo(_,f+v);for(let _=v;_<=y;_+=m)t.moveTo(g,_),t.lineTo(c+g,_)}t.stroke(),t.restore()}}function Of(e,t,i,a,s,n){const r=[{x:0,y:0},{x:t,y:0},{x:t,y:i},{x:0,y:i}];let l=1/0,o=-1/0;r.forEach(c=>{const f=c.x*s.x+c.y*s.y;l=Math.min(l,f),o=Math.max(o,f)});const u=Math.ceil((o-l)/a);e.beginPath();for(let c=0;c<=u;c++){const f=l+c*a;let g=[];for(let v=0;v<r.length;v++){const m=r[v],w=r[(v+1)%r.length],y=s.x*(w.y-m.y)-s.y*(w.x-m.x);if(Math.abs(y)>1e-6){const _=(f-m.x*s.x-m.y*s.y)/(s.x*(w.x-m.x)+s.y*(w.y-m.y));if(_>=0&&_<=1){const A=m.x+_*(w.x-m.x),x=m.y+_*(w.y-m.y);g.push({x:A,y:x})}}}g.length>=2&&(e.moveTo(g[0].x,g[0].y),e.lineTo(g[1].x,g[1].y))}e.stroke()}function Nf(e,t,i,a,s,n,r,l){const o=[{x:t,y:i},{x:t+a,y:i},{x:t+a,y:i+s},{x:t,y:i+s}];let u=1/0,c=-1/0;o.forEach(m=>{const w=m.x*r.x+m.y*r.y;u=Math.min(u,w),c=Math.max(c,w)});const f=c-u,g=Math.ceil(f/n),v=u;e.beginPath();for(let m=0;m<=g;m++){const w=v+m*n,y=[];for(let _=0;_<o.length;_++){const A=o[_],x=o[(_+1)%4],C=x.x-A.x,T=x.y-A.y,I=r.x*T-r.y*C;if(Math.abs(I)>1e-6){const D=(w-A.x*r.x-A.y*r.y)/(r.x*C+r.y*T);D>=0&&D<=1&&y.push({x:A.x+D*C,y:A.y+D*T})}}y.length>=2&&(e.moveTo(y[0].x,y[0].y),e.lineTo(y[1].x,y[1].y))}e.stroke()}const Q_={success:{},info:{icon:'<svg fill="none" viewBox="0 0 24 24"><path fill="#0052d9" d="M12 23a11 11 0 100-22 11 11 0 000 22zM11 8.5v-2h2v2h-2zm2 1.5v7.5h-2V10h2z"></path></svg>'},warning:{},error:{}};class tE{constructor(t,i){W(this,"parentElement");W(this,"store");W(this,"box");W(this,"text");W(this,"arrowUp");W(this,"arrowDown");W(this,"icon");W(this,"confirm");W(this,"cancel");W(this,"x");W(this,"y");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.icon=document.createElement("div"),this.confirm=document.createElement("button"),this.cancel=document.createElement("button"),this.box.className="meta2d-popconfirm",this.text.className="text",this.arrowUp.className="arrow",this.arrowDown.className="arrow down",this.icon.className="icon",this.confirm.className="confirm",this.cancel.className="cancel",this.confirm.innerHTML="\u786E\u5B9A",this.cancel.innerHTML="\u53D6\u6D88",this.icon.innerHTML=Q_.info.icon,this.box.appendChild(this.text),this.box.appendChild(this.arrowUp),this.box.appendChild(this.arrowDown),this.box.appendChild(this.confirm),this.box.appendChild(this.cancel),this.box.appendChild(this.icon),t.appendChild(this.box);let a;for(let s=0;s<document.styleSheets.length;s++)document.styleSheets[s].title==="le5le.com/popconfirm"&&(a=document.styleSheets[s]);if(!a){let s=document.createElement("style");s.type="text/css",s.title="le5le.com/popconfirm",document.head.appendChild(s),s=document.createElement("style"),s.type="text/css",document.head.appendChild(s),a=s.sheet,a.insertRule(".meta2d-popconfirm{position:absolute;z-index:999;left: -9999px;top: -9999px;padding:16px;max-width:400px;background:#fff;border-radius:6px;box-shadow:0 3px 14px 2px rgba(0, 0, 0, .05),0 8px 10px 1px rgba(0, 0, 0, 6%),0 5px 5px -3px rgba(0, 0, 0, 10%);}"),a.insertRule(".meta2d-popconfirm .text{outline:none;padding:0px 0px 40px 28px;border-radius:4px;color:rgba(0, 0, 0, 0.9);overflow-y:auto;line-height:22px;font-size:13px;}"),a.insertRule(".meta2d-popconfirm .arrow{position:absolute;border:10px solid transparent;background:transparent;top:-18px;left:50%;transform:translateX(-50%)}"),a.insertRule(".meta2d-popconfirm .arrow.down{top:initial;bottom: -18px;}"),a.insertRule(".meta2d-popconfirm .icon{position:absolute;width:22px;height:22px;left:16px;top:16px;}"),a.insertRule(".meta2d-popconfirm .confirm{position:absolute;right:16px;bottom:16px;width:40px;height:24px;text-align:center;background:#4582e6;color:#fff;border-radius:3px;border-color:transparent}"),a.insertRule(".meta2d-popconfirm .confirm:hover{background:#003cab;}"),a.insertRule(".meta2d-popconfirm .cancel{position:absolute;right:64px;bottom:16px;width:40px;height:24px;text-align:center;background:#dcdcdc;color:rgba(0, 0, 0, 0.9);border-radius:3px;border-color:transparent}"),a.insertRule(".meta2d-popconfirm .cancel:hover{background:#a6a6a6;}")}}show(t,i){if(!t)return;const a=this.box.getBoundingClientRect(),s=t.calculative.worldRect;let n=t.calculative.canvas.store.data.x+i.x-a.width/2,r=t.calculative.canvas.store.data.y+i.y-a.height-20;t.type||(n=t.calculative.canvas.store.data.x+s.x-(a.width-s.width)/2,r=t.calculative.canvas.store.data.y+s.ey-a.height-s.height),r>0?(this.arrowUp.style.borderBottomColor="transparent",this.arrowDown.style.borderTopColor="#fff",r-=10):(r+=a.height+s.height+5,r+=10,this.arrowUp.style.borderBottomColor="#fff",this.arrowDown.style.borderTopColor="transparent"),this.x=n,this.y=r,this.box.style.left=this.x+"px",this.box.style.top=this.y+"px"}hide(){this.x=-9999,this.box.style.left="-9999px"}showModal(t,i,a){return new Promise(s=>{this.text.innerHTML=a||"\u786E\u8BA4\u6267\u884C\u64CD\u4F5C\u5417\uFF1F",this.show(t,i),this.confirm.onclick=()=>{s(!0),this.hide()},this.cancel.onclick=()=>{s(!1),this.hide()}})}destroy(){this.box=null}}const He="-moving";class zf{constructor(t,i,a){W(this,"parent");W(this,"parentElement");W(this,"store");W(this,"canvas",document.createElement("canvas"));W(this,"offscreen",Pi());W(this,"width");W(this,"height");W(this,"externalElements",document.createElement("div"));W(this,"clientRect");W(this,"canvasRect");W(this,"activeRect");W(this,"initActiveRect");W(this,"dragRect");W(this,"lastRotate",0);W(this,"sizeCPs");W(this,"activeInitPos");W(this,"hoverType",xt.None);W(this,"resizeIndex",0);W(this,"mouseDown");W(this,"hotkeyType");W(this,"mouseRight");W(this,"addCaches");W(this,"touchCenter");W(this,"initTouchDis");W(this,"initScale");W(this,"touchScaling");W(this,"touchMoving");W(this,"startTouches");W(this,"lastOffsetX",0);W(this,"lastOffsetY",0);W(this,"drawingLineName");W(this,"drawLineFns",[...vx]);W(this,"drawingLine");W(this,"pencil");W(this,"pencilLine");W(this,"movingPens");W(this,"patchFlagsLines",new Set);W(this,"dock");W(this,"prevAnchor");W(this,"nextAnchor");W(this,"lastMouseTime",0);W(this,"hoverTimer",0);W(this,"fitTimer",0);W(this,"willInactivePen");W(this,"patchFlags",!1);W(this,"lastRender",0);W(this,"touchStart",0);W(this,"touchStartTimer");W(this,"timer");W(this,"lastAnimateRender",0);W(this,"animateRendering",!1);W(this,"renderTimer");W(this,"initPens");W(this,"pointSize",8);W(this,"pasteOffset",!0);W(this,"opening",!1);W(this,"maxZindex",5);W(this,"canMoveLine",!1);W(this,"randomIdObj");W(this,"keyOptions");W(this,"beforeAddPen");W(this,"beforeAddPens");W(this,"beforeAddAnchor");W(this,"beforeRemovePens");W(this,"beforeRemoveAnchor");W(this,"customResizeDock");W(this,"customMoveDock");W(this,"inputParent",document.createElement("div"));W(this,"inputDiv",document.createElement("div"));W(this,"dropdown",document.createElement("ul"));W(this,"tooltip");W(this,"popconfirm");W(this,"title");W(this,"mousePos",{x:0,y:0});W(this,"scroll");W(this,"movingAnchor");W(this,"canvasTemplate");W(this,"canvasImage");W(this,"canvasImageBottom");W(this,"magnifierCanvas");W(this,"dialog");W(this,"autoPolylineFlag",!1);W(this,"stopPropagation",t=>{t.stopPropagation()});W(this,"curve",x_);W(this,"polyline",P_);W(this,"mind",E_);W(this,"line",k_);W(this,"onCopy",t=>{this.store.options.disableClipboard||t.target!==this.externalElements&&t.target!==document.body&&t.target.offsetParent!==this.externalElements||this.copy()});W(this,"onCut",t=>{this.store.options.disableClipboard||t.target!==this.externalElements&&t.target!==document.body&&t.target.offsetParent!==this.externalElements||this.cut()});W(this,"onPaste",async t=>{if(this.store.data.locked||this.store.options.disableClipboard||t.target!==this.externalElements&&t.target!==document.body&&t.target.offsetParent!==this.externalElements)return;let i;if(navigator.clipboard&&t.clipboardData){const a=t.clipboardData.items;if(a){for(let s=0;s<a.length;s++)if(a[s].type.indexOf("image")!==-1&&a[s].getAsFile()){i=!0;break}}}if(i){const a=t.clipboardData.items;if(a){for(let s=0;s<a.length;s++)if(a[s].type.indexOf("image")!==-1&&a[s].getAsFile()){const{x:n,y:r}=this.mousePos,l=a[s].getAsFile();let o=a[s].type.slice(6)==="gif"?"gif":"image";if(l!==null){const u=o==="gif",c=await this.fileToPen(l,u);c.height=c.height/c.width*100,c.width=100,c.x=n-50/2,c.y=r-c.height/c.width*50,c.externElement=u,this.addPens([c]),this.active([c]),this.copy([c])}}}}else this.paste()});W(this,"onMessage",t=>{if(typeof t.data!="string"||!t.data||t.data.startsWith("setImmediate")||t.data.startsWith("webpackHotUpdate"))return;let i=JSON.parse(t.data);typeof i=="object"?this.parent.doMessageEvent(i.name,JSON.stringify(i.data)):this.parent.doMessageEvent(i)});W(this,"onwheel",t=>{if(this.inputDiv.contentEditable==="true"||this.drawingLine||this.pencil)return;if(this.store.hover&&this.store.hover.onWheel){this.store.hover.onWheel(this.store.hover,t);return}if(this.store.data.disableScale||this.store.options.disableScale||(t.preventDefault(),t.stopPropagation(),this.mouseDown&&(this.hoverType===xt.Node||this.hoverType===xt.Line))||this.store.data.locked===Mt.Disable||this.store.data.locked===Mt.DisableScale||this.store.data.locked===Mt.DisableMoveScale)return;if(!t.ctrlKey&&Math.abs(t.wheelDelta)<100&&t.deltaY.toString().indexOf(".")===-1){if(this.store.options.scroll&&!t.metaKey&&this.scroll){this.scroll.wheel(t.deltaY<0);return}const n=this.store.data.scale||1;this.translate(-t.deltaX/n,-t.deltaY/n);return}if(Math.abs(t.wheelDelta)>100&&this.store.options.scroll&&this.scroll&&!this.store.options.scrollButScale&&!(t.ctrlKey||t.metaKey)){this.scroll.wheel(t.deltaY<0);return}if(this.store.options.disableTouchPadScale)return;let i=.015;if(this.store.options.scaleOff)i=this.store.options.scaleOff,t.deltaY>0&&(i=-this.store.options.scaleOff);else if(/mac os /i.test(navigator.userAgent))t.ctrlKey?t.deltaY>0&&(i*=-1):i*=t.wheelDeltaY/240;else{let r=.2;t.deltaY.toString().indexOf(".")!==-1&&(r=.01),t.deltaY>0?i=-r:i=r}let{offsetX:a,offsetY:s}=t;this.scale(this.store.data.scale+i,{x:a,y:s}),this.externalElements.focus()});W(this,"onkeydown",t=>{var n,r,l;if(this.store.data.locked>=Mt.DisableEdit&&t.target.tagName!=="INPUT"&&t.target.tagName!=="TEXTAREA"&&!t.target.dataset.meta2dIgnore&&this.store.active.forEach(o=>{var u;(u=o.onKeyDown)==null||u.call(o,o,t.key)}),this.store.data.locked>=Mt.DisableEdit||t.target.tagName==="INPUT"||t.target.tagName==="TEXTAREA"||t.target.dataset.meta2dIgnore||this.store.options.unavailableKeys.includes(t.key))return;this.keyOptions||(this.keyOptions={}),this.keyOptions.altKey=t.altKey,this.keyOptions.shiftKey=t.shiftKey,this.keyOptions.ctrlKey=t.ctrlKey,this.keyOptions.metaKey=t.metaKey,this.keyOptions.F=!1,(t.key==="F"||t.key==="f")&&(this.keyOptions.F=!0);let i=10,a=10,s=null;if(this.store.options.strictScope){const o=this.store.data.width||this.store.options.width,u=this.store.data.height||this.store.options.height;o&&u&&(s={x:this.store.data.origin.x,y:this.store.data.origin.y,width:o*this.store.data.scale,height:u*this.store.data.scale})}switch(t.key){case" ":this.hotkeyType=Yt.Translate;break;case"Control":this.drawingLine?this.drawingLine.calculative.drawlineH=!this.drawingLine.calculative.drawlineH:this.hotkeyType||(this.patchFlags=!0,this.hotkeyType=Yt.Select);break;case"Meta":break;case"Shift":this.store.active.length===1&&this.store.active[0].type&&this.store.activeAnchor?this.toggleAnchorHand():this.hotkeyType||(this.patchFlags=!0,this.store.options.resizeMode||(this.hotkeyType=Yt.Resize));break;case"Alt":if(!t.ctrlKey&&!t.shiftKey&&this.drawingLine){const o=Vt(this.drawingLine);o!==this.drawingLine.calculative.activeAnchor?(bc(this.drawingLine),this.drawingLine.calculative.worldAnchors.push(o)):this.drawingLine.calculative.worldAnchors.push({x:o.x,y:o.y});const u=this.drawLineFns.indexOf(this.drawingLineName);this.drawingLineName=this.drawLineFns[(u+1)%this.drawLineFns.length],this.drawingLine.lineName=this.drawingLineName,this.drawline(),this.patchFlags=!0}t.preventDefault();break;case"a":case"A":t.ctrlKey||t.metaKey?(this.active(this.store.data.pens.filter(o=>!o.parentId&&o.locked!==Mt.Disable)),t.preventDefault()):this.toggleAnchorMode();break;case"Delete":case"Backspace":if(this.canvasImage.fitFlag&&this.canvasImage.activeFit){this.deleteFit();break}!this.store.data.locked&&this.delete();break;case"ArrowLeft":if(this.movingAnchor){this.translateAnchor(-1,0);break}if(i=-1,t.shiftKey&&(i=-5),(t.ctrlKey||t.metaKey)&&(i=-10),i=i*this.store.data.scale,this.store.activeAnchor&&this.store.active&&this.store.active.length===1&&this.store.active[0].type){this.moveLineAnchor({x:this.store.activeAnchor.x+i,y:this.store.activeAnchor.y},{});break}s&&this.activeRect.x+i<s.x&&(i=s.x-this.activeRect.x),this.translatePens(this.store.active,i,0);break;case"ArrowUp":if(this.movingAnchor){this.translateAnchor(0,-1);break}if(a=-1,t.shiftKey&&(a=-5),(t.ctrlKey||t.metaKey)&&(a=-10),a=a*this.store.data.scale,s&&this.activeRect.y+a<s.y&&(a=s.y-this.activeRect.y),this.store.activeAnchor&&this.store.active&&this.store.active.length===1&&this.store.active[0].type){this.moveLineAnchor({x:this.store.activeAnchor.x,y:this.store.activeAnchor.y+a},{});break}this.translatePens(this.store.active,0,a);break;case"ArrowRight":if(this.movingAnchor){this.translateAnchor(1,0);break}if(i=1,t.shiftKey&&(i=5),(t.ctrlKey||t.metaKey)&&(i=10),i=i*this.store.data.scale,this.store.activeAnchor&&this.store.active&&this.store.active.length===1&&this.store.active[0].type){this.moveLineAnchor({x:this.store.activeAnchor.x+i,y:this.store.activeAnchor.y},{});break}s&&this.activeRect.x+this.activeRect.width+i>s.x+s.width&&(i=s.x+s.width-(this.activeRect.x+this.activeRect.width)),this.translatePens(this.store.active,i,0);break;case"ArrowDown":if(this.movingAnchor){this.translateAnchor(0,1);break}if(a=1,t.shiftKey&&(a=5),(t.ctrlKey||t.metaKey)&&(a=10),a=a*this.store.data.scale,s&&this.activeRect.y+this.activeRect.height+a>s.y+s.height&&(a=s.y+s.height-(this.activeRect.y+this.activeRect.height)),this.store.activeAnchor&&this.store.active&&this.store.active.length===1&&this.store.active[0].type){this.moveLineAnchor({x:this.store.activeAnchor.x,y:this.store.activeAnchor.y+a},{});break}this.translatePens(this.store.active,0,a);break;case"d":case"D":(n=this.store.active[0])!=null&&n.locked||this.removeAnchorHand();break;case"h":case"H":(r=this.store.active[0])!=null&&r.locked||this.addAnchorHand();break;case"m":case"M":this.toggleMagnifier();break;case"g":case"G":if(t.ctrlKey||t.metaKey){t.shiftKey?this.parent.uncombine():this.store.active.length>1&&this.parent.combine(this.store.active),t.preventDefault();break}this.hoverType===xt.NodeAnchor&&(this.movingAnchor=this.store.hoverAnchor,this.externalElements.style.cursor="move");break;case"s":case"S":!this.store.data.locked&&this.hoverType===xt.LineAnchor&&this.store.hover===this.store.active[0]&&this.splitLine(this.store.active[0],this.store.hoverAnchor),(t.ctrlKey||t.metaKey)&&this.store.emitter.emit("save",{event:t});break;case"c":case"C":(t.ctrlKey||t.metaKey)&&this.store.options.disableClipboard&&this.copy();break;case"x":case"X":(t.ctrlKey||t.metaKey)&&this.store.options.disableClipboard&&this.cut();break;case"\u221A":case"v":case"V":!t.ctrlKey&&!t.metaKey&&(this.pencil&&this.stopPencil(),this.drawingLineName?(this.finishDrawline(),this.drawingLineName=""):this.drawingLineName=this.store.options.drawingLineName),!this.store.data.locked&&(t.ctrlKey||t.metaKey)&&(this.store.options.disableClipboard||!this.store.options.disableClipboard&&t.altKey)&&this.paste();break;case"b":case"B":this.drawingLineName&&(this.finishDrawline(),this.drawingLineName=""),this.pencil?this.stopPencil():this.drawingPencil();break;case"y":case"Y":(t.ctrlKey||t.metaKey)&&this.redo();break;case"z":case"Z":t.ctrlKey||t.metaKey?this.undo():t.shiftKey&&this.redo();break;case"Enter":this.drawingLineName&&(this.finishDrawline(!0),this.store.active[0].anchors[0].connectTo?this.drawingLineName="":this.drawingLineName=this.store.options.drawingLineName),this.store.active&&(this.store.active.forEach(o=>{o.type?(o.close=!o.close,o.close&&fg(o),this.store.path2dMap.set(o,Et.path2dDraws.line(o)),Yr(o)):o.calculative.focus=!0}),this.render());break;case"Escape":this.drawingLineName&&this.finishDrawline(),this.drawingLineName=void 0,this.stopPencil(),this.store.active&&this.store.active.forEach(o=>{o.type||(o.calculative.focus=!1)}),this.movingPens&&(this.getAllByPens(this.movingPens).forEach(o=>{this.store.pens[o.id]=void 0}),this.movingPens=void 0,this.mouseDown=void 0,this.clearDock(),(l=this.store.active)==null||l.forEach(o=>{this.updateLines(o)}),this.calcActiveRect(),this.patchFlags=!0),this.hotkeyType=Yt.None,this.movingAnchor=void 0,this.magnifierCanvas.magnifier&&(this.magnifierCanvas.magnifier=!1,this.patchFlags=!0);break;case"E":case"e":this.store.options.disableAnchor=!this.store.options.disableAnchor,this.store.emitter.emit("disableAnchor",this.store.options.disableAnchor);break;case"=":(t.ctrlKey||t.metaKey)&&(this.scale(this.store.data.scale+.1),t.preventDefault(),t.stopPropagation());break;case"-":(t.ctrlKey||t.metaKey)&&(this.scale(this.store.data.scale-.1),t.preventDefault(),t.stopPropagation());break;case"l":case"L":this.canMoveLine=!0;break;case"[":this.parent.down();break;case"]":this.parent.up();break;case"{":this.parent.bottom();break;case"}":this.parent.top();break;case"F":case"f":!this.store.data.locked&&(t.ctrlKey||t.metaKey)&&!this.store.options.disableClipboard&&this.paste(),this.setFollowers();break}this.render(!1)});W(this,"onkeyup",t=>{switch(t.key){case"l":case"L":this.canMoveLine=!1;break}this.hotkeyType&&this.render(),this.hotkeyType<Yt.AddAnchor&&(this.hotkeyType=Yt.None)});W(this,"ondrop",async t=>{if(this.store.data.locked){console.warn("canvas is locked, can not drop");return}t.preventDefault(),t.stopPropagation();const i=t.dataTransfer.getData("Meta2d")||t.dataTransfer.getData("Text");let a=null;try{i&&(a=JSON.parse(i))}catch{}if(!a){const{files:s}=t.dataTransfer;if(s.length&&s[0].type.match("image.*")&&!(this.addCaches&&this.addCaches.length)){const n=s[0].type==="image/gif";a=await this.fileToPen(s[0],n)}else if(this.addCaches&&this.addCaches.length)a=this.addCaches,this.addCaches=[];else{this.store.emitter.emit("drop",void 0);return}}if(a=Array.isArray(a)?a:[a],a[0]&&a[0].draggable!==!1){const s={x:t.offsetX,y:t.offsetY};this.calibrateMouse(s),this.dropPens(a,s),this.addCaches=[],this.getContainerHover(s),this.mousePos.x=s.x,this.mousePos.y=s.y,this.store.emitter.emit("mouseup",{x:s.x,y:s.y,pen:this.store.hoverContainer})}this.store.emitter.emit("drop",a||i)});W(this,"ontouchstart",t=>{this.store.data.locked!==Mt.Disable&&(this.touchStartTimer&&clearTimeout(this.touchStartTimer),this.touchStartTimer=setTimeout(()=>{this.touchStart=performance.now();const i=t.touches[0].pageX-this.clientRect.x,a=t.touches[0].pageY-this.clientRect.y,s={x:i,y:a};if(this.calibrateMouse(s),this.getHover(s),this.onMouseDown({x:i,y:a,clientX:t.touches[0].clientX,clientY:t.touches[0].clientY,pageX:t.touches[0].pageX,pageY:t.touches[0].pageY,ctrlKey:t.ctrlKey||t.metaKey,shiftKey:t.shiftKey,altKey:t.altKey,buttons:1}),t.touches.length===2){this.initTouchDis=Math.hypot(t.touches[0].pageX-t.touches[1].pageX,t.touches[0].pageY-t.touches[1].pageY),this.initScale=this.store.data.scale,this.startTouches=t.touches,this.touchCenter={x:t.touches[0].pageX+(t.touches[1].pageX-t.touches[0].pageX)/2-this.clientRect.x,y:t.touches[0].pageY+(t.touches[1].pageY-t.touches[0].pageY)/2-this.clientRect.y};return}else t.touches.length===3&&(this.store.emitter.emit("contextmenu",{e:{x:i,y:a,clientX:t.touches[0].clientX,clientY:t.touches[0].clientY,pageX:t.touches[0].pageX,pageY:t.touches[0].pageY},clientRect:this.clientRect}),t.preventDefault(),t.stopPropagation());this.touchStartTimer=void 0},50))});W(this,"ontouchmove",t=>{var l;if(this.store.data.locked===Mt.Disable)return;t.stopPropagation(),t.preventDefault();const i=performance.now();if(i-this.touchStart<50)return;this.touchStart=i;const a=t.touches,s=a.length,n=t.touches[0].pageX-this.clientRect.x,r=t.touches[0].pageY-this.clientRect.y;if(s===1)this.onMouseMove({x:n,y:r,clientX:t.changedTouches[0].clientX,clientY:t.changedTouches[0].clientY,pageX:t.changedTouches[0].pageX,pageY:t.changedTouches[0].pageY,ctrlKey:t.ctrlKey||t.metaKey,shiftKey:t.shiftKey,altKey:t.altKey,buttons:1});else if(s===2&&((l=this.startTouches)==null?void 0:l.length)===2){if(!this.touchMoving&&!this.touchScaling){const o=this.startTouches[0].pageX-a[0].pageX,u=this.startTouches[1].pageX-a[1].pageX,c=this.startTouches[0].pageY-a[0].pageY,f=this.startTouches[1].pageY-a[1].pageY;(o>=0&&u<0||o<=0&&u>0)&&(c>=0&&f<0||c<=0&&f>0)?this.touchScaling=!0:this.touchMoving=!0}if(this.touchScaling){if(this.store.data.disableScale||this.store.options.disableScale)return;const o=Math.hypot(a[0].pageX-a[1].pageX,a[0].pageY-a[1].pageY)/this.initTouchDis;this.scale(this.initScale*o,ht(this.touchCenter))}if(this.touchMoving){if(this.store.data.locked>=Mt.DisableMove&&this.store.data.locked!==Mt.DisableScale||this.store.data.disableScale||this.store.options.disableScale)return;if(this.lastOffsetX){const{scale:o}=this.store.data;this.translate((n-this.lastOffsetX)/o,(r-this.lastOffsetY)/o)}this.lastOffsetX=n,this.lastOffsetY=r}}});W(this,"ontouchend",t=>{if(this.store.data.locked===Mt.Disable)return;this.touchCenter=void 0,this.touchScaling=void 0,this.touchMoving=void 0,this.startTouches=void 0,this.lastOffsetX=0,this.lastOffsetY=0;const i=t.changedTouches[0].pageX-this.clientRect.x,a=t.changedTouches[0].pageY-this.clientRect.y;this.onMouseUp({x:i,y:a,clientX:t.changedTouches[0].clientX,clientY:t.changedTouches[0].clientY,pageX:t.changedTouches[0].pageX,pageY:t.changedTouches[0].pageY,ctrlKey:t.ctrlKey||t.metaKey,shiftKey:t.shiftKey,altKey:t.altKey,buttons:1}),setTimeout(()=>{this.render()},20)});W(this,"onGesturestart",t=>{t.preventDefault()});W(this,"onMouseDown",t=>{var i,a,s,n,r;if(t.buttons===2&&!this.drawingLine&&(this.mouseRight=Vi.Down),this.hideInput(),this.popconfirm.hide(),this.store.data.locked===Mt.Disable||t.buttons!==1&&t.buttons!==2){this.hoverType=xt.None;return}if(!this.magnifierCanvas.magnifier){if(this.calibrateMouse(t),this.mousePos.x=t.x,this.mousePos.y=t.y,this.mouseDown=t,this.lastMouseTime=performance.now(),this.canvasImage.fitFlag){this.canvasImage.currentFit||this.calcuActiveFit();return}if(this.hotkeyType===Yt.AddAnchor){this.setAnchor(this.store.pointAt);return}if(!this.store.options.autoAnchor&&!this.drawingLine&&t.shiftKey&&t.ctrlKey&&t.altKey){this.setAnchor(this.store.pointAt),this.drawingLineName=this.store.options.drawingLineName;const l=this.store.activeAnchor;if(!l)return;const o={id:St(),x:l.x,y:l.y};this.drawingLine=this.createDrawingLine(o);let u=le(this.drawingLine);this.drawingLine.calculative.activeAnchor=u,we(this.store.hover,l,this.drawingLine,o),this.drawline();return}if(!(this.hotkeyType===Yt.Translate||this.mouseRight===Vi.Down&&!this.store.options.mouseRightActive)){if(this.drawingLine){if(this.store.hoverAnchor){const o=Vt(this.drawingLine);this.store.hoverAnchor.type===$i.Line?mr(o,this.store.hoverAnchor,this.store):(o.x=this.store.hoverAnchor.x,o.y=this.store.hoverAnchor.y),we(this.store.hover,this.store.hoverAnchor,this.drawingLine,o),this.drawline(),this.finishDrawline(!0);return}if(!this.store.options.autoAnchor&&t.shiftKey&&t.altKey&&t.ctrlKey){this.setAnchor(this.store.pointAt);const o=Vt(this.drawingLine),u=this.store.activeAnchor;if(!u)return;o.x=u.x,o.y=u.y,we(this.store.hover,u,this.drawingLine,o),this.drawline(),this.finishDrawline(!0);return}if(t.buttons===2||this.drawingLineName==="mind"&&((i=this.drawingLine)==null?void 0:i.calculative.worldAnchors.length)>1||this.store.options.drawingLineLength&&((a=this.drawingLine)==null?void 0:a.calculative.worldAnchors.length)>this.store.options.drawingLineLength){this.finishDrawline(!0),((s=this.store.active[0])==null?void 0:s.anchors[0].connectTo)||this.store.active.length==0?this.drawingLineName="":this.drawingLineName=this.store.options.drawingLineName;return}if(this.store.options.autoAnchor&&this.hoverType===xt.Node){const o=Vt(this.drawingLine),u=bs(this.store.hover,t);o.x=u.x,o.y=u.y,this.drawingLine.autoTo=!0,we(this.store.hover,u,this.drawingLine,o),this.drawline(),this.finishDrawline(!0);return}const l=Vt(this.drawingLine);l.isTemp?(this.drawingLine.calculative.activeAnchor=this.drawingLine.calculative.worldAnchors[this.drawingLine.calculative.worldAnchors.length-2],l.isTemp=void 0):(this.drawingLine.calculative.activeAnchor=l,this.drawingLine.calculative.worldAnchors.push({x:l.x,y:l.y,penId:l.penId})),this.drawingLine.calculative.drawlineH=void 0,this.drawingLineName!=="polyline"&&this.drawline()}if(this.drawingLineName){if(this.hoverType===xt.Node)if(this.store.options.autoAnchor){this.inactive(!0);const l=bs(this.store.hover,t);this.store.hoverAnchor=l;const o={id:St(),x:l.x,y:l.y};this.drawingLine=this.createDrawingLine(o),this.drawingLine.autoFrom=!0,we(this.store.hover,l,this.drawingLine,o)}else this.inactive(),this.hoverType=xt.None;else if(this.hoverType===xt.NodeAnchor){this.drawingLineName=this.store.options.drawingLineName;const l={id:St(),x:this.store.hoverAnchor.x,y:this.store.hoverAnchor.y};this.drawingLine=this.createDrawingLine(l),this.drawingLine.calculative.activeAnchor=l,we(this.store.hover,this.store.hoverAnchor,this.drawingLine,l)}else if(!this.drawingLine&&this.drawingLineName!=="curve"){this.inactive(!0);const l={id:St(),x:t.x,y:t.y};this.drawingLine=this.createDrawingLine(l),this.drawingLine.calculative.activeAnchor=l}}else if(this.pencil){this.inactive(!0);const l=St(),o={x:t.x,y:t.y,id:St(),penId:l};this.pencilLine=this.getInitPencilLine(o)}else{switch(this.hoverType){case xt.None:(this.store.data.rule||this.store.options.rule)&&!this.store.options.disableRuleLine&&this.addRuleLine(t),this.store.options.resizeMode&&(this.hotkeyType=Yt.None),this.inactive();break;case xt.Node:case xt.Line:if(this.store.hover){if(((n=this.store.active)==null?void 0:n.length)&&this.store.active.length===1&&this.store.hover.id===this.store.active[0].id){this.calcActiveRect();break}const l=ti(this.store.hover,!0);let o=l||this.store.hover;l&&(l.container||((r=this.store.options.containerShapes)==null?void 0:r.includes(l.name)))&&(o=this.store.hover),t.ctrlKey&&!t.shiftKey?(o.calculative.active?this.willInactivePen=o:this.store.active.length>0&&(o.calculative.active=!0,ys(o),this.store.active.push(o),this.store.emitter.emit("active",this.store.active)),this.patchFlags=!0):t.ctrlKey&&t.shiftKey&&this.store.hover.parentId?this.active([this.store.hover]):(!(this.activeRect&&Ui({x:t.x,y:t.y},this.activeRect))||this.store.active.length==1)&&(o.calculative.active||(this.active([o]),this.store.options.resizeMode&&(this.hotkeyType=Yt.Resize))),this.calcActiveRect()}break;case xt.LineAnchor:this.store.activeAnchor=this.store.hoverAnchor,this.store.hover.calculative.activeAnchor=this.store.hoverAnchor,this.active([this.store.hover]);break;case xt.LineAnchorPrev:case xt.LineAnchorNext:this.store.activeAnchor&&(this.prevAnchor={...this.store.activeAnchor.prev},this.nextAnchor={...this.store.activeAnchor.next});break;case xt.Resize:this.activeInitPos=[],this.store.active.forEach(l=>{this.activeInitPos.push({x:(l.calculative.worldRect.x-this.activeRect.x)/this.activeRect.width,y:(l.calculative.worldRect.y-this.activeRect.y)/this.activeRect.height})});break}this.store.hover&&(this.store.hover.calculative.mouseDown=!0),this.store.emitter.emit("mousedown",{x:t.x,y:t.y,pen:this.store.hover})}this.render()}}});W(this,"onMouseMove",t=>{var a,s,n,r,l,o,u,c;if(this.store.data.locked===Mt.Disable){this.hoverType=xt.None;return}if(this.mouseDown&&!this.mouseDown.restore&&t.buttons!==1&&t.buttons!==2){this.onMouseUp(t);return}if(this.lastMouseTime){if(performance.now()-this.lastMouseTime<50){this.lastMouseTime=0;return}this.lastMouseTime=0}if(this.calibrateMouse(t),this.mousePos.x=t.x,this.mousePos.y=t.y,this.magnifierCanvas.magnifier){this.render();return}if(this.canvasImage.fitFlag&&this.canvasImage.activeFit){const f=performance.now();f-this.fitTimer>100&&(this.mouseDown?this.updateFit(t):this.inFitBorder(this.mousePos),this.fitTimer=f);return}if(this.mouseDown&&!this.store.options.disableTranslate&&!this.store.data.disableTranslate){if(this.mouseRight===Vi.Down&&(this.mouseRight=Vi.Translate),this.store.data.locked===Mt.DisableEdit||this.store.data.locked===Mt.DisableScale||this.hotkeyType===Yt.Translate||this.mouseRight===Vi.Translate){const{scale:f}=this.store.data;let g=(t.x-this.mouseDown.x)/f,v=(t.y-this.mouseDown.y)/f;t.shiftKey&&!t.ctrlKey&&(v=0),t.ctrlKey&&(g=0),this.translate(g,v);return}if(this.store.data.locked)return;if(!this.drawingLine&&!this.pencil){if(!this.drawingLineName&&!this.movingAnchor){if(this.hoverType===xt.NodeAnchor){if(!this.store.hoverAnchor)return;this.drawingLineName=this.store.options.drawingLineName;const f={id:St(),x:this.store.hoverAnchor.x,y:this.store.hoverAnchor.y};this.drawingLine=this.createDrawingLine(f),this.drawingLine.calculative.activeAnchor=f,we(this.store.hover,this.store.hoverAnchor,this.drawingLine,f),this.drawline();return}}else if(this.drawingLineName&&this.hoverType===xt.None){const f={id:St(),x:t.x,y:t.y};this.drawingLine=this.createDrawingLine(f),this.drawingLine.calculative.activeAnchor=f,this.drawline();return}if(t.buttons===1&&(t.ctrlKey||!this.hoverType&&!this.hotkeyType)&&!(t.ctrlKey&&(this.store.activeAnchor||((a=this.store.active)==null?void 0:a.length)))){this.dragRect={x:Math.min(this.mouseDown.x,t.x),y:Math.min(this.mouseDown.y,t.y),ex:Math.max(this.mouseDown.x,t.x),ey:Math.max(this.mouseDown.y,t.y),width:Math.abs(t.x-this.mouseDown.x),height:Math.abs(t.y-this.mouseDown.y)},this.render();return}if(this.movingAnchor){const f=t.x-this.movingAnchor.x,g=t.y-this.movingAnchor.y;this.translateAnchor(f,g),this.render();return}else if(!((s=this.store.active[0])!=null&&s.locked)){const f={x:t.x,y:t.y};if(this.hoverType===xt.LineAnchor){(this.dockInAnchor(t)||((n=this.store.active[0])==null?void 0:n.lineName)==="line")&&!this.store.options.disableDock&&!this.store.options.disableLineDock&&(this.clearDock(),this.dock=Ef(this.store,f,this.store.activeAnchor),(r=this.dock)!=null&&r.xDock&&(f.x+=this.dock.xDock.step),(l=this.dock)!=null&&l.yDock&&(f.y+=this.dock.yDock.step)),this.moveLineAnchor(f,t);return}if(this.hoverType===xt.LineAnchorPrev){this.moveLineAnchorPrev(t);return}if(this.hoverType===xt.LineAnchorNext){this.moveLineAnchorNext(t);return}}if(this.hoverType===xt.Rotate){this.rotatePens({x:t.x,y:t.y});return}if(this.hoverType===xt.Resize){this.resizePens(t);return}if(this.hoverType===xt.Node||this.hoverType===xt.Line){const f=t.x-this.mouseDown.x,g=t.y-this.mouseDown.y,v=20;if(t.ctrlKey&&!t.shiftKey&&(Math.abs(f)>=v||Math.abs(g)>=v)&&(this.willInactivePen=void 0),this.store.active.length===1){const m=this.store.active[0];if((m.locked===void 0||m.locked<Mt.DisableMove)&&((o=m==null?void 0:m.onMouseMove)==null||o.call(m,m,this.mousePos)),m.calculative.focus)return}this.movePens(t),this.getContainerHover(t);return}}else if(this.pencil){const{x:f,y:g}=t,v={x:f,y:g};v.id=St(),v.penId=this.pencilLine.id,this.pencilLine.calculative.worldAnchors.push(v),this.store.path2dMap.set(this.pencilLine,Et.path2dDraws[this.pencilLine.name](this.pencilLine)),this.patchFlags=!0}}if(this.drawingLine){const{x:f,y:g}=t,v={x:f,y:g};if(v.id=St(),v.penId=this.drawingLine.id,!this.store.options.disableDock&&!this.store.options.disableLineDock&&(this.clearDock(),this.dock=Ef(this.store,v),(u=this.dock)!=null&&u.xDock&&(v.x+=this.dock.xDock.step),(c=this.dock)!=null&&c.yDock&&(v.y+=this.dock.yDock.step)),this.mouseDown&&this.drawingLineName==="curve"&&!this.drawingLine.calculative.worldAnchors[0].connectTo)this.drawline(v);else{let m;if(this.drawingLine.calculative.worldAnchors.length>1&&(m=Vt(this.drawingLine)),m?(m.prev=void 0,m.next=void 0,m.id||(m.id=St()),m.x=v.x,m.y=v.y,m.connectTo=void 0):(m={...v},this.drawingLine.calculative.worldAnchors.push(m)),(this.hoverType===xt.NodeAnchor||this.hoverType===xt.LineAnchor)&&(this.store.hoverAnchor.type!==$i.Line&&(m.x=this.store.hoverAnchor.x,m.y=this.store.hoverAnchor.y),m.connectTo=this.store.hoverAnchor.penId,this.drawingLineName==="polyline"&&(m.isTemp=!1)),this.drawingLineName==="line"){if(t.ctrlKey&&!t.shiftKey)m.x=this.drawingLine.calculative.worldAnchors[this.drawingLine.calculative.worldAnchors.length-2].x;else if(t.shiftKey&&!t.ctrlKey)m.y=this.drawingLine.calculative.worldAnchors[this.drawingLine.calculative.worldAnchors.length-2].y;else if(t.shiftKey&&t.ctrlKey){let w=this.drawingLine.calculative.worldAnchors[this.drawingLine.calculative.worldAnchors.length-2];this.getSpecialAngle(m,w)}}this.drawline()}}globalThis.debug&&console.time("hover");const i=performance.now();i-this.hoverTimer>50&&(this.hoverTimer=i,this.getHover(t)),globalThis.debug&&console.timeEnd("hover"),this.hotkeyType===Yt.AddAnchor&&(this.patchFlags=!0),this.render(!1)});W(this,"onMouseUp",t=>{if(this.store.data.locked===Mt.Disable){this.hoverType=xt.None;return}if(!!this.mouseDown){if(this.mouseRight===Vi.Down&&(this.store.hover&&this.store.hover.onContextmenu?this.store.hover.onContextmenu(this.store.hover,t):this.store.emitter.emit("contextmenu",{e:t,clientRect:this.clientRect,pen:this.store.hover})),this.mouseRight=Vi.None,this.calibrateMouse(t),this.mousePos.x=t.x,this.mousePos.y=t.y,this.pencil&&this.finishPencil(),this.drawingLine){if(this.store.hoverAnchor){const i=Vt(this.drawingLine);this.store.hoverAnchor.type===$i.Line?mr(i,this.store.hoverAnchor,this.store):(i.x=this.store.hoverAnchor.x,i.y=this.store.hoverAnchor.y),we(this.store.hover,this.store.hoverAnchor,this.drawingLine,i),this.drawline(),this.finishDrawline(!0);return}if(this.store.options.autoAnchor&&this.hoverType===xt.Node){const i=Vt(this.drawingLine),a=bs(this.store.hover,t);i.x=a.x,i.y=a.y,this.drawingLine.autoTo=!0,we(this.store.hover,a,this.drawingLine,i),this.drawline(),this.finishDrawline(!0);return}}if(this.hoverType===xt.LineAnchor&&this.store.hover&&this.store.active[0]&&this.store.active[0].name==="line"&&this.store.active[0]!==this.store.hover){const i=this.store.active[0],a=le(i),s=Vt(i);if(this.store.hoverAnchor){const n=this.store.hover,r=le(n)===this.store.hoverAnchor,l=Vt(n)===this.store.hoverAnchor,o=a===this.store.activeAnchor,u=s===this.store.activeAnchor;if((t.ctrlKey||t.altKey)&&n.type===$t.Line&&(r||l)&&(o||u)){const c=n.calculative.worldAnchors.map(f=>({...f,penId:i.id}));r?c.shift():l&&c.pop(),(r&&o||l&&u)&&c.reverse(),o?(i.calculative.worldAnchors[0].connectTo=void 0,i.calculative.worldAnchors.unshift(...c)):u&&(i.calculative.worldAnchors[i.calculative.worldAnchors.length-1].connectTo=void 0,i.calculative.worldAnchors.push(...c)),this.delete([n]),this.render()}else this.store.activeAnchor&&(this.store.hoverAnchor.type===$i.Line?mr(this.store.activeAnchor,this.store.hoverAnchor,this.store):(this.store.activeAnchor.x=this.store.hoverAnchor.x,this.store.activeAnchor.y=this.store.hoverAnchor.y),we(this.store.hover,this.store.hoverAnchor,i,this.store.activeAnchor));this[i.lineName]&&i.lineName!=="polyline"&&this[i.lineName](this.store,i),this.store.path2dMap.set(i,Et.path2dDraws.line(i)),this.initLineRect(i)}else a===this.store.activeAnchor&&i.autoFrom?this.calcAutoAnchor(i,a,this.store.hover):s===this.store.activeAnchor&&i.autoTo&&this.calcAutoAnchor(i,s,this.store.hover)}if(this.addCaches&&this.addCaches.length){if(!this.store.data.locked){if(this.dragRect&&this.addCaches.length===1){const i=this.addCaches[0];i.width=this.dragRect.width/this.store.data.scale,i.height=this.dragRect.height/this.store.data.scale,t.x=(this.dragRect.x+this.dragRect.ex)/2,t.y=(this.dragRect.y+this.dragRect.ey)/2}this.dropPens(this.addCaches,t)}this.addCaches=void 0}if(this.hoverType===xt.Rotate&&(this.getSizeCPs(),this.store.active.forEach(i=>{i.rotate=i.calculative.rotate})),this.patchFlagsLines.forEach(i=>{i.type&&this.initLineRect(i)}),this.patchFlagsLines.clear(),this.dragRect)if(this.canvasImage.fitFlag)this.makeFit();else{const i=this.store.data.pens.filter(a=>{if(a.visible===!1||a.locked>=Mt.DisableMove||a.parentId||a.isRuleLine)return!1;if(Xi(a.calculative.worldRect,this.dragRect,t.ctrlKey||this.store.options.dragAllIn))return a.type===$t.Line&&!this.store.options.dragAllIn?Il(a,this.dragRect):!0});this.active(i)}if(t.button!==2&&(Qr(this.mouseDown,t)<2&&(this.store.hover&&this.store.hover.input&&(this.store.hover.onShowInput?this.store.hover.onShowInput(this.store.hover,t):(this.store.hover.parentId&&this.active([this.store.hover]),this.showInput(this.store.hover))),this.store.emitter.emit("click",{x:t.x,y:t.y,pen:this.store.hover})),this.store.hover&&(this.store.hover.calculative.mouseDown=!1),this.store.hover!=this.store.hoverContainer&&this.store.emitter.emit("mouseup",{x:t.x,y:t.y,pen:this.store.hover}),this.store.emitter.emit("mouseup",{x:t.x,y:t.y,pen:this.store.hoverContainer})),this.willInactivePen){this.willInactivePen.calculative.active=void 0,ys(this.willInactivePen,!1);const i=this.store.active.findIndex(a=>a===this.willInactivePen);i>=0&&this.store.active.splice(i,1),this.calcActiveRect(),this.willInactivePen=void 0,this.store.emitter.emit("inactive",[this.willInactivePen]),this.render()}this.movingPens&&(t.altKey&&!t.shiftKey?this.copyMovedPens():this.movedActivePens(t.ctrlKey&&t.shiftKey),this.getAllByPens(this.movingPens).forEach(i=>{this.store.pens[i.id]=void 0}),this.movingPens=void 0),this.store.active&&this.store.active[0]&&(this.store.active[0].calculative.h=void 0),this.mouseDown=void 0,this.lastOffsetX=0,this.lastOffsetY=0,this.clearDock(),this.dragRect=void 0,this.initActiveRect=void 0,this.render()}});W(this,"clearDock",()=>{var n,r,l,o;const t=(r=(n=this.dock)==null?void 0:n.xDock)==null?void 0:r.penId,i=(o=(l=this.dock)==null?void 0:l.yDock)==null?void 0:o.penId,a=this.store.pens[t];a&&(a.calculative.isDock=!1);const s=this.store.pens[i];s&&(s.calculative.isDock=!1),this.dock=void 0});W(this,"onResize",()=>{this.timer&&clearTimeout(this.timer),this.timer=setTimeout(()=>{this.resize(),this.timer=void 0},100)});W(this,"onScroll",()=>{this.timer&&clearTimeout(this.timer),this.timer=setTimeout(()=>{this.clientRect=this.canvas.getBoundingClientRect(),this.timer=void 0},100)});W(this,"calibrateMouse",t=>(t.x-=this.store.data.x,t.y-=this.store.data.y,t));W(this,"getContainerHover",t=>{var a;if(this.dragRect)return;this.store.hoverContainer=void 0;const i=this.store.data.pens.filter(s=>{var n;return s.container||((n=this.store.options.containerShapes)==null?void 0:n.includes(s.name))});if(i.length)for(let s=i.length-1;s>=0;--s){const n=i[s];if(!(n.visible==!1||n.calculative.inView==!1||n.locked===Mt.Disable)){if(Ui(t,n.calculative.worldRect))this.store.hoverContainer=n,(a=n==null?void 0:n.onMouseMove)==null||a.call(n,n,t),this.store.lastHoverContainer!==this.store.hoverContainer&&(this.patchFlags=!0,this.store.lastHoverContainer&&(this.store.lastHoverContainer.calculative.containerHover=!1,this.store.emitter.emit("leave",this.store.lastHoverContainer)),this.store.hoverContainer&&(this.store.hoverContainer.calculative.containerHover=!0,this.store.emitter.emit("enter",this.store.hoverContainer)),this.store.lastHoverContainer=this.store.hoverContainer);else if(n===this.store.hoverContainer&&(this.store.hoverContainer=void 0,this.store.lastHoverContainer!==this.store.hoverContainer)){this.patchFlags=!0;const r=this.store.lastHoverContainer.calculative.canvas.store.pens[this.store.lastHoverContainer.id+He];this.store.lastHoverContainer&&!r&&(this.store.lastHoverContainer.calculative.containerHover=!1,this.store.emitter.emit("leave",this.store.lastHoverContainer)),this.store.lastHoverContainer=this.store.hoverContainer}}}});W(this,"getHover",t=>{var s,n;if(this.dragRect||this.canvasImage.fitFlag)return;let i=xt.None;this.store.hover=void 0,this.store.hoverAnchor=void 0,this.title.hide(),this.store.pointAt=void 0,this.store.pointAtIndex=void 0;const a=this.store.active.length===1&&this.store.active[0].type;if(!this.drawingLineName&&this.hotkeyType!==Yt.AddAnchor&&this.activeRect&&!a&&!this.store.data.locked){const r=Pl(this.store.active),l=bf(this.store.active)||this.store.options.disableRotate,o=xf(this.store.active)||this.store.options.disableSize;if(!r&&!l){const u={x:this.activeRect.center.x,y:this.activeRect.y-30};this.activeRect.rotate&&Gt(u,this.activeRect.rotate,this.activeRect.pivot||this.activeRect.center),!this.hotkeyType&&ms(t,u,this.pointSize)&&(i=xt.Rotate,this.externalElements.style.cursor=`url("${this.store.options.rotateCursor}"), auto`)}if(!r&&!o)for(let u=0;u<8;u++){const c=u<4;if((this.hotkeyType===Yt.Resize||c&&!this.hotkeyType)&&ms(t,this.sizeCPs[u],this.pointSize)){let g=c?uf:ff,v=0;Math.abs(this.activeRect.rotate%90-45)<25?(g=c?ff:uf,v=Math.round((this.activeRect.rotate-45)/90)+(c?0:1)):v=Math.round(this.activeRect.rotate/90),i=xt.Resize,this.resizeIndex=u,this.externalElements.style.cursor=g[(u+v)%4];break}}}i===xt.None&&(i=this.inPens(t,this.store.data.pens)),!i&&!a&&Ui(t,this.activeRect)&&(i=xt.Node,this.externalElements.style.cursor="move"),this.hoverType=i,i===xt.None&&(this.drawingLineName||this.pencil?this.externalElements.style.cursor="crosshair":this.mouseDown||(this.externalElements.style.cursor="default"),this.store.hover=void 0),this.store.lastHover!==this.store.hover&&(this.patchFlags=!0,this.store.lastHover&&(this.store.lastHover.calculative.hover=!1,tn(ti(this.store.lastHover,!0)||this.store.lastHover,!1),this.store.emitter.emit("leave",this.store.lastHover),this.tooltip.hide()),this.store.hover&&(this.store.hover.calculative.hover=!0,tn(ti(this.store.hover,!0)||this.store.hover),this.store.emitter.emit("enter",this.store.hover),this.tooltip.show(this.store.hover,t)),this.store.lastHover=this.store.hover),(n=(s=this.store.hover)==null?void 0:s.onMouseMove)==null||n.call(s,this.store.hover,this.mousePos)});W(this,"inPens",(t,i)=>{var s;let a=xt.None;t:for(let n=i.length-1;n>=0;--n){const r=i[n];if(r.visible==!1||r.calculative.inView==!1||r.locked===Mt.Disable)continue;const l=qr(r);if(!(!r.calculative.active&&!Wa(t,r.calculative.worldRect,l)&&!Ui(t,r.calculative.worldRect))){if(!this.store.data.locked&&this.hotkeyType!==Yt.Resize&&r.calculative.worldAnchors){for(const o of r.calculative.worldAnchors)if(a=this.inAnchor(t,r,o),a){let u=ht(o);Object.assign(u,t),this.title.show(u,r);break t}}if(r.type){if(r.isRuleLine){let u=((s=this.store.options.ruleOptions)==null?void 0:s.height)||20;if(t.x+this.store.data.x>u&&t.y+this.store.data.y>u)break}const o=C_(t,r);if(o){!this.store.data.locked&&!r.locked?this.hotkeyType===Yt.AddAnchor?this.externalElements.style.cursor="pointer":this.externalElements.style.cursor="move":this.externalElements.style.cursor=this.store.options.hoverCursor,r.calculative.disabled&&(this.externalElements.style.cursor="not-allowed"),this.store.hover=r,this.store.pointAt=o.point,this.store.pointAtIndex=o.i,this.initTemplateCanvas([this.store.hover]),a=xt.Line;break}}else{if(r.children){const u=[];if(r.children.forEach(c=>{this.store.pens[c]&&u.push(this.store.pens[c])}),a=this.inPens(t,u),a)break}let o=!1;if(r.name==="line"?o=Wa(t,r.calculative.worldRect,r.lineWidth):o=Ui(t,r.calculative.worldRect),o){if(r.type===$t.Node&&r.name==="line"&&!Y2(t,r.calculative.worldAnchors))continue;if(!this.store.data.locked&&!r.locked?this.hotkeyType===Yt.AddAnchor?this.externalElements.style.cursor="pointer":this.externalElements.style.cursor="move":this.externalElements.style.cursor=this.store.options.hoverCursor,r.calculative.disabled&&(this.externalElements.style.cursor="not-allowed"),this.store.hover=r,this.initTemplateCanvas([this.store.hover]),a=xt.Node,this.store.pointAt=t,!t.ctrlKey){let{x:u,y:c,ex:f,ey:g,rotate:v,center:m}=this.store.hover.calculative.worldRect;if(v){const w=[{x:u,y:c},{x:f,y:c},{x:f,y:g},{x:u,y:g}];w.forEach(_=>{Gt(_,v,m)});let y=w[w.length-1];for(const _ of w){if(y.y>t.y!=_.y>t.y){const A=_.x+(t.y-_.y)*(y.x-_.x)/(y.y-_.y);Math.abs(A-this.store.pointAt.x)<10&&(this.store.pointAt.x=A)}y=_}}else this.store.pointAt.x-10<u?this.store.pointAt.x=u:this.store.pointAt.x+10>f&&(this.store.pointAt.x=f),this.store.pointAt.y-10<c?this.store.pointAt.y=c:this.store.pointAt.y+10>g&&(this.store.pointAt.y=g)}break}}}}return a});W(this,"dockInAnchor",t=>{var i,a;this.store.hover=void 0;for(let s=this.store.data.pens.length-1;s>=0;--s){const n=this.store.data.pens[s];if(n.visible==!1||n.locked===Mt.Disable||n===this.store.active[0])continue;let r=qr(n);if(r+=2*this.store.options.anchorRadius,!!Wa(t,n.calculative.worldRect,r)&&(this.store.hover=n,this.hotkeyType!==Yt.Resize&&n.calculative.worldAnchors))for(const l of n.calculative.worldAnchors){if(l.twoWay===Ae.In){const o=Vt(this.store.active[0]);if(this.store.activeAnchor.id!==o.id)continue}if(l.twoWay===Ae.Out){const o=le(this.store.active[0]);if(this.store.activeAnchor.id!==o.id)continue}if(!(l.twoWay===Ae.DisableConnected||l.twoWay===Ae.Disable||((i=this.store.activeAnchor)==null?void 0:i.twoWay)===Ae.DisableConnectTo||((a=this.store.activeAnchor)==null?void 0:a.twoWay)===Ae.Disable)&&(this.title.hide(),this.inAnchor(t,n,l))){let o=ht(l);return Object.assign(o,t),this.title.show(o,n),!0}}}});W(this,"imageTimer");W(this,"templateImageTimer");W(this,"render",t=>{if(t&&(this.opening=!1),this.opening)return;let i;if(t==null||t===!0||t===1/0?(i=performance.now(),this.patchFlags=!0):t>1?i=t:i=performance.now(),!this.patchFlags)return;if(i-this.lastRender<this.store.options.interval){this.renderTimer&&cancelAnimationFrame(this.renderTimer),this.renderTimer=requestAnimationFrame(this.render);return}this.renderTimer=void 0,this.lastRender=i;const a=this.offscreen.getContext("2d");a.clearRect(0,0,this.offscreen.width,this.offscreen.height),a.save(),a.translate(this.store.data.x,this.store.data.y),globalThis.debugRender&&console.time("renderPens"),this.renderPens(),globalThis.debugRender&&console.timeEnd("renderPens"),this.renderBorder(),this.renderHoverPoint(),a.restore(),this.magnifierCanvas.magnifier&&this.magnifierCanvas.render();const s=this.canvas.getContext("2d");s.clearRect(0,0,this.canvas.width,this.canvas.height),s.drawImage(this.offscreen,0,0,this.width,this.height),this.canvasTemplate.render(),this.canvasImageBottom.render(),this.canvasImage.render(),this.patchFlags=!1});W(this,"renderPens",()=>{const t=this.offscreen.getContext("2d");t.strokeStyle=this.store.styles.color;for(const i of this.store.data.pens)!isFinite(i.x)||i.canvasLayer!==zt.CanvasTemplate&&i.calculative.inView&&(i.canvasLayer===zt.CanvasMain&&i.name!=="gif"&&i.image&&i.calculative.img&&(t.save(),za(t,i),i.calculative.rotate&&Gi(t,i),Ha(t,i),Es(t,i),t.restore()),Sa(t,i));this.drawingLine&&Sa(t,this.drawingLine),this.pencilLine&&Sa(t,this.pencilLine),this.movingPens&&this.movingPens.forEach(i=>{this.renderPenContainChild(t,i)})});W(this,"renderPenContainChild",(t,i)=>{var a;i.calculative.inView&&Sa(t,i),(a=i.children)==null||a.forEach(s=>{const n=this.store.pens[s];n&&this.renderPenContainChild(t,n)})});W(this,"renderBorder",()=>{if(!this.store.data.locked&&this.activeRect&&!(this.store.active.length===1&&this.store.active[0].type)&&!this.movingPens){const t=this.offscreen.getContext("2d");t.save(),t.translate(.5,.5);const i=this.activeRect.pivot||this.activeRect.center;if(this.activeRect.rotate&&(t.translate(i.x,i.y),t.rotate(this.activeRect.rotate*Math.PI/180),t.translate(-i.x,-i.y)),t.strokeStyle=this.store.styles.activeColor,t.globalAlpha=this.store.options.activeGlobalAlpha===void 0?.3:this.store.options.activeGlobalAlpha,t.beginPath(),t.lineWidth=this.store.options.activeLineWidth||1,t.setLineDash(this.store.options.activeLineDash||[]),t.strokeRect(this.activeRect.x,this.activeRect.y,this.activeRect.width,this.activeRect.height),t.setLineDash([]),t.lineWidth=1,t.globalAlpha=1,Pl(this.store.active)||bf(this.store.active)||this.store.options.disableRotate){t.restore();return}t.beginPath(),t.moveTo(this.activeRect.center.x,this.activeRect.y),t.lineTo(this.activeRect.center.x,this.activeRect.y-30),t.stroke(),t.beginPath(),t.strokeStyle=this.store.styles.activeColor,t.fillStyle="#ffffff",t.arc(this.activeRect.center.x,this.activeRect.y-30,5,0,Math.PI*2),t.fill(),t.stroke(),t.restore()}});W(this,"renderHoverPoint",()=>{if(this.store.data.locked)return;const t=this.offscreen.getContext("2d");if(t.save(),t.translate(.5,.5),!this.store.options.disableAnchor&&this.store.hover&&!this.store.hover.disableAnchor&&(this.hotkeyType!==Yt.Resize||this.store.active.length!==1||this.store.active[0]!==this.store.hover)){const i=[...this.store.hover.calculative.worldAnchors];this.store.pointAt&&this.hotkeyType===Yt.AddAnchor&&i.push(this.store.pointAt),i&&(t.strokeStyle=this.store.hover.anchorColor||this.store.styles.anchorColor,t.fillStyle=this.store.hover.anchorBackground||this.store.options.anchorBackground,i.forEach(a=>{if(a.hidden&&a.locked>Mt.DisableEdit)return;if(a===this.store.hoverAnchor){t.save();const n=this.store.hover.hoverAnchorColor||this.store.options.hoverAnchorColor;t.strokeStyle=n,t.fillStyle=n}t.beginPath();let s=a.radius||this.store.hover.anchorRadius||this.store.options.anchorRadius;if(this.store.hover.type&&!a.radius&&!this.store.hover.anchorRadius&&(s=3,this.store.hover.calculative.lineWidth>3&&(s=this.store.hover.calculative.lineWidth)),a.type===$i.Line){let n=this.store.pens[a.penId].rotate||0;this.store.pens[a.penId].calculative.flipX&&(n*=-1),this.store.pens[a.penId].calculative.flipY&&(n*=-1);let r=a.rotate+n;this.store.pens[a.penId].calculative.flipX&&(r*=-1),this.store.pens[a.penId].calculative.flipY&&(r*=-1),t.save(),t.translate(a.x,a.y),t.rotate(r*Math.PI/180),t.translate(-a.x,-a.y),t.rect(a.x-a.length*this.store.data.scale/2,a.y-s,a.length*this.store.data.scale,s*2),t.restore()}else t.arc(a.x,a.y,s,0,Math.PI*2);if(this.store.hover.type&&this.store.hoverAnchor===a?(t.save(),t.strokeStyle=this.store.hover.activeColor||this.store.styles.activeColor,t.fillStyle=t.strokeStyle):(a.color||a.background)&&(t.save(),t.strokeStyle=a.color,t.fillStyle=a.background),t.fill(),t.stroke(),a===this.store.hoverAnchor&&t.restore(),(this.store.hover.type&&this.store.hoverAnchor===a||a.color||a.background)&&t.restore(),!this.store.hover.parentId&&this.store.hover.children&&this.store.hover.children.length>0&&a===this.store.hoverAnchor){t.save(),t.beginPath(),t.lineWidth=3;const n=this.store.hover.hoverAnchorColor||this.store.options.hoverAnchorColor;globalThis.pSBC&&(t.strokeStyle=globalThis.pSBC(.5,n)),t.arc(a.x,a.y,s+1.5,0,Math.PI*2),t.stroke(),t.restore()}}))}this.hotkeyType!==Yt.AddAnchor&&!this.movingPens&&this.activeRect&&!(this.store.active.length===1&&this.store.active[0].type)&&!Pl(this.store.active)&&!xf(this.store.active)&&!this.store.options.disableSize&&(t.strokeStyle=this.store.styles.activeColor,t.fillStyle="#ffffff",this.sizeCPs.forEach((i,a)=>{this.activeRect.rotate&&(t.save(),t.translate(i.x,i.y),t.rotate(this.activeRect.rotate*Math.PI/180),t.translate(-i.x,-i.y)),(a<4||this.hotkeyType===Yt.Resize)&&(t.beginPath(),t.fillRect(i.x-4.5,i.y-4.5,8,8),t.strokeRect(i.x-5.5,i.y-5.5,10,10)),this.activeRect.rotate&&t.restore()})),!this.store.data.locked&&this.dragRect&&(t.save(),t.fillStyle=Wr(this.store.options.dragColor,.2),t.strokeStyle=this.store.options.dragColor,t.beginPath(),t.strokeRect(this.dragRect.x,this.dragRect.y,this.dragRect.width,this.dragRect.height),t.fillRect(this.dragRect.x,this.dragRect.y,this.dragRect.width,this.dragRect.height),t.restore()),this.dock&&(t.strokeStyle=this.store.options.dockColor,this.dock.xDock&&(t.beginPath(),t.moveTo(this.dock.xDock.x,this.dock.xDock.y),t.lineTo(this.dock.xDock.x,this.dock.xDock.prev.y),t.stroke()),this.dock.yDock&&(t.beginPath(),t.moveTo(this.dock.yDock.x,this.dock.yDock.y),t.lineTo(this.dock.yDock.prev.x,this.dock.yDock.y),t.stroke())),t.restore()});W(this,"transTimeout");W(this,"pastePen",(t,i)=>{const a=t.id;if(Af(t),t.parentId=i,t.type===$t.Line?this.changeNodeConnectedLine(a,t,this.store.clipboard.pens):this.changeLineAnchors(a,t,this.store.clipboard.pens),!t.parentId){const n=this.getPenRect(t,this.store.clipboard.origin,this.store.clipboard.scale),r=this.getPenRect(this.store.clipboard.initRect,this.store.clipboard.origin,this.store.clipboard.scale),{origin:l,scale:o}=this.store.data;t.x=l.x+n.x*o,t.y=l.y+n.y*o,t.width=n.width*o,t.height=n.height*o,r.x=l.x+r.x*o,r.y=l.y+r.y*o,Qt(r),this.store.clipboard.pos&&(t.x-=r.center.x-this.store.clipboard.pos.x,t.y-=r.center.y-this.store.clipboard.pos.y),this.keyOptions&&this.keyOptions.altKey&&(this.keyOptions.ctrlKey||this.keyOptions.metaKey)?(t.x=-this.store.data.x+this.width/2-t.width/2,t.y=-this.store.data.y+this.height/2-t.height/2):this.keyOptions&&this.keyOptions.shiftKey&&(this.keyOptions.ctrlKey||this.keyOptions.metaKey||this.keyOptions.F)||(t.x+=this.store.clipboard.offset*this.store.data.scale,t.y+=this.store.clipboard.offset*this.store.data.scale)}this.makePen(t);const s=[];if(Array.isArray(t.children))for(const n of t.children){const r=this.store.clipboard.pens.find(l=>l.id===n);r&&s.push(this.pastePen(r,t.id).id)}return t.children=s,Yi(t,!0),t});W(this,"ondblclick",t=>{var i,a,s;if(this.store.hover&&(!this.store.data.locked||this.store.hover.dbInput)&&!this.store.options.disableInput)if(this.store.hover.onShowInput)this.store.hover.onShowInput(this.store.hover,t);else if(this.store.hover&&this.store.hover.parentId)if(((i=this.store.active)==null?void 0:i.length)===1&&this.store.active[0].id===this.store.hover.id)this.showInput(this.store.hover);else{if(this.store.pens[this.store.hover.parentId].children.forEach(n=>{this.store.pens[n].calculative.active=!1,this.store.pens[n].calculative.hover=!1}),this.store.hover.parentId){let n=this.store.hover.id;const r=this.calibrateMouse({x:t.offsetX,y:t.offsetY});let l=1/0;(s=(a=this.store.pens[this.store.hover.parentId])==null?void 0:a.children)==null||s.forEach(o=>{const u=this.store.pens[o];if(Ui(r,u.calculative.worldRect)){const c=Math.sqrt((r.x-u.calculative.worldRect.center.x)**2+(r.y-u.calculative.worldRect.center.y)**2);c<l&&(l=c,n=o)}}),this.store.hover=this.store.pens[n],this.store.pens[n].calculative.hover=!0}this.active([this.store.hover])}else this.showInput(this.store.hover);this.store.emitter.emit("dblclick",{x:t.x,y:t.y,pen:this.store.hover})});W(this,"showInput",(t,i,a="transparent")=>{if(!window||!this.store.hover||this.store.hover.locked||this.store.hover.externElement||this.store.hover.disableInput||this.store.hover.disabled)return;if(this.inputDiv.dataset.penId===t.id){this.inputDiv.dataset.isInput="true",this.inputDiv.contentEditable="true",this.inputDiv.focus();const c=window.getSelection();c.selectAllChildren(this.inputDiv),c.collapseToEnd(),this.inputDiv.scrollTop=this.inputDiv.scrollHeight,this.inputDiv.scrollLeft=this.inputDiv.scrollWidth;return}!i&&!t.dbInput?this.setInputStyle(t):(this.inputDiv.style.width="100%",this.inputDiv.style.height="100%");const s=i||t.calculative.worldTextRect,l=`${(t.calculative.tempText===void 0?t.text+""||"":t.calculative.tempText).replace(/\x20/g,"&nbsp;").split(/[\s\n]/).join("</div><div>")}</div>`.replace("</div>","").replace(/\<div\>\<\/div\>/g,"<div><br></div>");this.inputDiv.innerHTML=l,this.inputParent.style.left=s.x+this.store.data.x-(t.calculative.textLeft||0)+"px",this.inputParent.style.top=s.y+this.store.data.y-(t.calculative.textTop||0)+"px";let o=s.width;this.inputParent.style.width=(o<0?12:o)+"px",this.inputParent.style.height=s.height+(t.textTop||0)+"px",this.inputParent.style.zIndex="9999",this.inputParent.style.background=a,t.rotate%360?this.inputParent.style.transform=`rotate(${t.rotate}deg)`:this.inputParent.style.transform=null,this.inputParent.style.display="flex",this.inputDiv.dataset.penId=t.id,this.inputDiv.contentEditable=t.disableInput==null?"true":t.disableInput.toString(),t.dropdownList&&this.dropdown.style.display!=="block"&&(this.dropdown.style.background=t.dropdownBackground||this.store.styles.popContentBg||"#fff",this.dropdown.style.color=t.dropdownColor||"#bdc7db",this.dropdown.style.width=this.inputParent.style.width,this.dropdown.style.fontSize=(t.fontSize||12)+"px",this.setDropdownList(),this.externalElements.style.zIndex="9999"),this.inputDiv.contentEditable="true",this.inputDiv.focus();const u=window.getSelection();u.selectAllChildren(this.inputDiv),u.collapseToEnd(),this.inputDiv.scrollTop=this.inputDiv.scrollHeight,this.inputDiv.scrollLeft=this.inputDiv.scrollWidth,t.calculative.text=void 0,this.initTemplateCanvas([t]),this.render()});W(this,"setInputStyle",t=>{t.text||(t.text="");let i;for(let o=0;o<document.styleSheets.length;o++)document.styleSheets[o].title==="le5le.com"&&(i=document.styleSheets[o]);let a="overflow: scroll;",s="",n=1;const{scale:r}=this.store.data;if(t.fontSize<12&&(n=12/t.fontSize),t.textAlign?a+=`text-align: ${t.textAlign};`:a+="text-align: center;",t.textAlign&&t.whiteSpace==="pre-line"&&(a+=`align-items: ${{left:"start",center:"center",right:"end"}[t.textAlign]};`),t.textBaseline?a+=`justify-content: ${{top:"start",middle:"center",bottom:"end"}[t.textBaseline]};`:a+="justify-content: center;",t.fontFamily&&(a+=`font-family: ${t.fontFamily};`),t.fontSize&&(t.fontSize*r<12?(a+=`font-size:${t.fontSize}px;`,a+=`zoom:${t.fontSize/12*r};`):a+=`font-size:${t.fontSize*r}px;`),a+=`color:${Ji(t,this.store)};`,t.fontStyle&&(a+=`font-style: ${t.fontStyle};`),t.fontWeight&&(a+=`font-weight: ${t.fontWeight};`),t.textLeft&&(a+=`margin-left:${r>1?t.textLeft*n:t.textLeft*n/r}px;`),t.textTop&&(a+=`margin-top:${r>1?t.textTop*n:t.textTop*n/r}px;`),t.lineHeight&&(a+=`line-height:${r>1?t.fontSize*t.lineHeight*r:t.fontSize*t.lineHeight*n}px;`),t.textHeight)a+=`height:${r>1?t.textHeight*n*r:t.textHeight*n}px;`;else{let o=t.calculative.worldRect.height/r;o<0&&(o=0);let u=t.fontSize*r<12?o*n:o*r*n;u<t.fontSize*t.lineHeight*r&&(u=t.fontSize*t.lineHeight*r,a+=`top:-${u/2}px;`),a+=`height:${u}px;`}let l=null;if(t.textWidth)l=t.textWidth<1&&t.textWidth>-1?t.textWidth*t.calculative.worldRect.width:t.textWidth,t.whiteSpace!=="pre-line"&&(l<t.fontSize?a+=`width:${t.fontSize*1.2*n}px;`:a+=`width:${r>1?l*n*r:l*n}px;`);else if(t.whiteSpace===void 0||t.whiteSpace==="break-all"){let o=(t.calculative.worldTextRect.width||12)/r;o<0&&(o=0),a+=`width:${t.fontSize*r<12?o*n:o*r}px;`}if(t.whiteSpace&&(t.whiteSpace==="pre-line"?a+="white-space:pre;":(a+=`white-space:${t.whiteSpace};`,t.whiteSpace==="nowrap"&&(s+="display:contents;"))),t.whiteSpace!=="nowrap"){let o=t.fontSize*1.2*t.text.length,u=(l||t.calculative.worldRect.width/r)*Math.floor(t.calculative.worldRect.height/r/(t.lineHeight*t.fontSize));o>u&&(a+="justify-content: start;")}i.deleteRule(0),i.deleteRule(0),i.insertRule(`.meta2d-input
  62. .input-div{
  63. 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;${a}}`),i.insertRule(`.input-div div{${s}}`)});W(this,"hideInput",()=>{if(this.externalElements.style.zIndex="5",this.inputParent.style.display==="flex"){this.inputParent.style.display="none";const t=this.store.pens[this.inputDiv.dataset.penId];if(!t)return;if(t.calculative.text=t.text,this.inputDiv.dataset.value=this.inputDiv.innerHTML.replace(/\<div\>/g,`
  64. `).replace(/\<\/div\>/g,"").replace(/\<br\>/g,"").replace(/&nbsp;/g," ").replace(/(<([^>]+)>)/gi,""),this.inputDiv.dataset.value=this.convertSpecialCharacter(this.inputDiv.dataset.value),t.onInput)t.onInput(t,this.inputDiv.dataset.value);else if(t.text!==this.inputDiv.dataset.value){const i=[ht(t,!0)];t.text=this.inputDiv.dataset.value,t.calculative.text=t.text,this.inputDiv.dataset.penId=void 0,t.text&&t.textAutoAdjust&&!t.parentId&&$x(t),Fi(t),this.patchFlags=!0,this.pushHistory({type:bt.Update,pens:[ht(t,!0)],initPens:i}),this.store.emitter.emit("change",t),this.store.emitter.emit("valueUpdate",t)}else t.text===this.inputDiv.dataset.value&&t.calculative.textLines.length==0&&Fi(t);this.initTemplateCanvas([t])}this.inputDiv.dataset.penId=void 0,this.dropdown.style.display="none",this.inputDiv.dataset.isInput="false",this.inputDiv.contentEditable="false",this.render()});W(this,"setDropdownList",t=>{this.clearDropdownList();const i=this.store.pens[this.inputDiv.dataset.penId];if(!this.store.data.locked&&!["tablePlus"].includes(i.name))return;if(this.dropdown.style.display="block",!i||!i.dropdownList){this.dropdown.style.display="none";return}if(!i.dropdownList.length){const n=document.createElement("div");n.innerText="None",n.style.padding="5px 12px",n.style.color="#ddd",this.dropdown.appendChild(n);return}const a=this.inputDiv.innerHTML.replace(/\<div\>/g,`
  65. `).replace(/\<\/div\>/g,"").replace(/\<br\>/g,"");let s=0;for(const n of i.dropdownList){const r=typeof n=="string"?n:n.text;t&&a?r.includes(a)&&this.dropdownAppendOption(r,s):this.dropdownAppendOption(r,s),++s}if(!this.dropdown.hasChildNodes()){const n=document.createElement("div");n.innerText="None",n.style.padding="5px 12px",n.style.color="#ddd",this.dropdown.appendChild(n)}});W(this,"selectDropdown",t=>{const i=t.target,a=this.store.pens[this.inputDiv.dataset.penId];if(!i||!a||!a.dropdownList)return;const s=+i.dataset.i,n=a.dropdownList[s];if(!n)return;const r=[ht(a,!0)];typeof n=="object"?(this.updateValue(a,{...n}),a.calculative.text=void 0,this.calcActiveRect()):a.text=n+"",this.inputDiv.innerText=a.text,this.hideInput(),this.pushHistory({type:bt.Update,pens:[ht(a,!0)],initPens:r}),this.render(),this.store.emitter.emit("change",a),this.store.emitter.emit("valueUpdate",a)});W(this,"inFitBorder",t=>{let i;const a=this.store.data.width||this.store.options.width,s=this.store.data.height||this.store.options.height;let n={x:(t.x-this.store.data.origin.x)/this.store.data.scale,y:(t.y-this.store.data.origin.y)/this.store.data.scale};const r=this.canvasImage.activeFit;this.externalElements.style.cursor="default",n.y>s*r.y-10&&n.y<s*r.y+10&&(i="top",this.externalElements.style.cursor="row-resize"),n.y>s*(r.y+r.height)-10&&n.y<s*(r.y+r.height)+10&&(i="bottom",this.externalElements.style.cursor="row-resize"),n.x>a*r.x-10&&n.x<a*r.x&&(i="left",this.externalElements.style.cursor="col-resize"),n.x>a*(r.x+r.width)-10&&n.x<a*(r.x+r.width)+10&&(i="right",this.externalElements.style.cursor="col-resize"),this.canvasImage.currentFit=i});this.parent=t,this.parentElement=i,this.store=a,this.canvasTemplate=new J_(i,a),this.canvasTemplate.canvas.style.zIndex="1",this.canvasImageBottom=new Mf(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 Mf(i,a),this.canvasImage.canvas.style.zIndex="4",this.magnifierCanvas=new G_(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 on(i,a),this.tooltip.box.onmouseleave=s=>{this.patchFlags=!0,this.store.lastHover&&(this.store.lastHover.calculative.hover=!1);let n=this.store.data.pens.find(r=>r.calculative.hover===!0);tn(n,!1)},this.popconfirm=new tE(i,a),this.dialog=new Z_(i,a),this.title=new Kr(i),this.store.options.scroll&&(this.scroll=new wg(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),window==null||window.addEventListener("message",this.onMessage)}listen(){switch(this.externalElements.addEventListener("gesturestart",this.onGesturestart),this.externalElements.ondragover=t=>t.preventDefault(),this.externalElements.ondrop=this.ondrop,this.externalElements.oncontextmenu=t=>t.preventDefault(),this.store.options.interval=50,this.externalElements.ontouchstart=this.ontouchstart,this.externalElements.ontouchmove=this.ontouchmove,this.externalElements.ontouchend=this.ontouchend,this.externalElements.onmousedown=t=>{this.onMouseDown({x:t.offsetX,y:t.offsetY,clientX:t.clientX,clientY:t.clientY,pageX:t.pageX,pageY:t.pageY,ctrlKey:t.ctrlKey||t.metaKey,shiftKey:t.shiftKey,altKey:t.altKey,buttons:t.buttons})},this.externalElements.onmousemove=t=>{t.target===this.externalElements&&this.onMouseMove({x:t.offsetX,y:t.offsetY,clientX:t.clientX,clientY:t.clientY,pageX:t.pageX,pageY:t.pageY,ctrlKey:t.ctrlKey||t.metaKey,shiftKey:t.shiftKey,altKey:t.altKey,buttons:t.buttons})},this.externalElements.onmouseup=t=>{this.onMouseUp({x:t.offsetX,y:t.offsetY,clientX:t.clientX,clientY:t.clientY,pageX:t.pageX,pageY:t.pageY,ctrlKey:t.ctrlKey||t.metaKey,shiftKey:t.shiftKey,altKey:t.altKey,buttons:t.buttons,button:t.button})},this.externalElements.onmouseleave=t=>{this.store.data.pens.forEach(i=>{i.calculative.hover&&(i.calculative.hover=!1)}),this.store.hover&&(this.store.hover.calculative.hover=!1,this.store.hover=void 0),this.render(),t.toElement!==this.tooltip.box&&t.toElement!==this.tooltip.arrowUp&&t.toElement!==this.tooltip.arrowDown&&(this.tooltip.hide(),this.store.lastHover=void 0)},this.externalElements.ondblclick=this.ondblclick,this.externalElements.tabIndex=0,this.externalElements.onblur=()=>{this.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 Ba.Document:document.addEventListener("keydown",this.onkeydown),document.addEventListener("keyup",this.onkeyup);break;case Ba.Canvas:this.externalElements.addEventListener("keydown",this.onkeydown),this.externalElements.addEventListener("keyup",this.onkeyup);break}}splitLine(t,i){const a=t.calculative.worldAnchors,s=a.findIndex(c=>c===i);if([-1,0,a.length-1].includes(s))return;const n=ht(t,!0),r=ht(t,!0),l=St();r.id=l,r.calculative.canvas=this,r.calculative.active=!1,r.calculative.hover=!1;const o=ht(a.slice(0,s+1)),u=ht(a.slice(s)).map(c=>(c.penId=l,c));t.calculative.worldAnchors=o,r.calculative.worldAnchors=u,this.initLineRect(t),this.initLineRect(r),this.store.data.pens.push(r),this.store.pens[l]=r,this.pushHistory({type:bt.Add,pens:[ht(r,!0)],step:2}),this.pushHistory({type:bt.Update,initPens:[n],pens:[ht(t,!0)],step:2})}translateAnchor(t,i){this.movingAnchor.x+=t,this.movingAnchor.y+=i;const a=this.movingAnchor.penId;if(a){const s=this.store.pens[a],n=s.calculative.worldRect;this.movingAnchor.x<n.x?this.movingAnchor.x=n.x:this.movingAnchor.x>n.ex&&(this.movingAnchor.x=n.ex),this.movingAnchor.y<n.y?this.movingAnchor.y=n.y:this.movingAnchor.y>n.ey&&(this.movingAnchor.y=n.ey);const r=rn(this.movingAnchor,n),l=s.anchors.findIndex(o=>o.id===this.movingAnchor.id);s.anchors[l]=r,this.patchFlags=!0}}async fileToPen(t,i){let a="";return this.store.options.uploadFn?a=await this.store.options.uploadFn(t):this.store.options.uploadUrl?a=await Yx(t,this.store.options.uploadUrl,this.store.options.uploadParams,this.store.options.uploadHeaders):a=await qx(t),new Promise((s,n)=>{const r=new Image;r.onload=()=>{Et.htmlElements[a]=r,s({width:r.width,height:r.height,name:i?"gif":"image",image:a})},r.onerror=l=>{n(l)},r.crossOrigin="anonymous",r.src=a})}async dropPens(t,i){var o,u,c,f;this.randomIdObj={};for(const g of t)!g.parentId&&this.randomCombineId(g,t);if(Object.keys(this.randomIdObj).length!==0){const g=Object.keys(this.randomIdObj).join("|"),v=new RegExp(`(${g})`,"g");for(const m of t){if(m.type?(m.anchors[0].connectTo=this.randomIdObj[m.anchors[0].connectTo],m.anchors[m.anchors.length-1].connectTo=this.randomIdObj[m.anchors[m.anchors.length-1].connectTo]):(o=m.connectedLines)==null||o.forEach(w=>{w.lineAnchor=this.randomIdObj[w.lineAnchor],w.lineId=this.randomIdObj[w.lineId]}),(u=m.animations)!=null&&u.length){const w=JSON.stringify(m.animations).replace(v,y=>this.randomIdObj[y]);m.animations=JSON.parse(w)}if((c=m.triggers)!=null&&c.length){const w=JSON.stringify(m.triggers).replace(v,y=>this.randomIdObj[y]);m.triggers=JSON.parse(w)}if((f=m.events)!=null&&f.length){const w=JSON.stringify(m.events).replace(v,y=>this.randomIdObj[y]);m.events=JSON.parse(w)}}}for(const g of t)g.id||(g.id=St()),!g.calculative&&(g.calculative={canvas:this}),this.store.pens[g.id]=g;let a=0,s=0,n=0;for(const g of t)g.parentId||(g.width*=this.store.data.scale,g.height*=this.store.data.scale,g.x=i.x-g.width/2+n,g.y=i.y-g.height/2+s,g.tags&&g.tags.includes("meta3d")&&(g.x=this.store.data.origin.x,g.y=this.store.data.origin.y),g.dataset&&(a%2===0?n=g.width-40*this.store.data.scale:n=0,a++,a%2===0&&(s+=g.height+10*this.store.data.scale)));const r=this.store.data.width||this.store.options.width,l=this.store.data.height||this.store.options.height;if(r&&l){let g={x:this.store.data.origin.x,y:this.store.data.origin.y,width:r*this.store.data.scale,height:l*this.store.data.scale},v=!0;for(const m of t)if(!m.parentId){let w=[{x:m.x,y:m.y},{x:m.x+m.width,y:m.y},{x:m.x,y:m.y+m.height},{x:m.x+m.width,y:m.y+m.height},{x:m.x+m.width/2,y:m.y+m.height/2}];if(m.x===g.x&&m.y===g.y&&m.width===g.width&&m.height===g.height||w.some(y=>Ui(y,g))){v=!1,this.store.options.strictScope&&(m.x<g.x&&(m.x=g.x),m.y<g.y&&(m.y=g.y),m.x+m.width>g.x+g.width&&(m.x=g.x+g.width-m.width),m.y+m.height>g.y+g.height&&(m.y=g.y+g.height-m.height));break}}if(v){console.info("\u753B\u7B14\u5728\u5927\u5C4F\u8303\u56F4\u5916");return}}await this.addPens(t,!0),this.active(t.filter(g=>!g.parentId)),this.render(),this.externalElements.focus()}randomCombineId(t,i,a){let s=null;t.type?t.anchors[0].connectTo||t.anchors[t.anchors.length-1].connectTo?s=[t.id,t.anchors[0].id,t.anchors[t.anchors.length-1].id]:s=[t.id]:i.length>1&&(s=[t.id]),Af(t),i.length>1&&(s.length===1?this.randomIdObj[s[0]]=t.id:(this.randomIdObj[s[0]]=t.id,this.randomIdObj[s[1]]=t.anchors[0].id,this.randomIdObj[s[2]]=t.anchors[t.anchors.length-1].id)),t.parentId=a;const n=[];if(Array.isArray(t.children))for(const r of t.children){const l=i.find(o=>o.id===r);l&&n.push(this.randomCombineId(l,i,t.id).id)}return t.children=n,t}async addPens(t,i,a){if(this.beforeAddPens&&await this.beforeAddPens(t)!=!0)return[];const s=[];for(const n of t)this.beforeAddPen&&this.beforeAddPen(n)!=!0||(a&&!n.parentId&&(n.x=n.x*this.store.data.scale+this.store.data.origin.x,n.y=n.y*this.store.data.scale+this.store.data.origin.y,n.width=n.width*this.store.data.scale,n.height=n.height*this.store.data.scale),this.makePen(n),s.push(n));return this.render(),this.store.emitter.emit("add",s),i&&this.pushHistory({type:bt.Add,pens:ht(s,!0)}),s}getInitPencilLine(t){const{data:i,options:a}=this.store,s=i.scale,n=i.lineWidth||1;return{id:t.penId,name:"line",x:t.x,y:t.y,type:$t.Line,calculative:{canvas:this,pencil:!0,active:!0,worldAnchors:[t],lineWidth:n*s},fromArrow:i.fromArrow||a.fromArrow,toArrow:i.toArrow||a.toArrow,lineWidth:n}}createDrawingLine(t){this.inactive();const{data:i,options:a}=this.store,s=i.scale,n=i.lineWidth||1;return t.penId=St(),{id:t.penId,name:"line",lineName:this.drawingLineName,x:t.x,y:t.y,type:$t.Line,calculative:{canvas:this,active:!0,worldAnchors:[t],lineWidth:n*s,...a.linePresetStyle},fromArrow:i.fromArrow||a.fromArrow,toArrow:i.toArrow||a.toArrow,lineWidth:n,...a.linePresetStyle}}addRuleLine(t){const{x:i,y:a,scale:s,origin:n}=this.store.data,r=t.x+i,l=t.y+a;let o=t.x,u=t.y,c=0,f=0,g=0,v=0;if(r<=l&&r<20)o=-i,c=this.width,g=1,t.ctrlKey||(u=Math.round((u-n.y)/(s*10))*(s*10)+n.y);else if(l<r&&l<20)u=-a,f=this.height,v=1,t.ctrlKey||(o=Math.round((o-n.x)/(s*10))*(s*10)+n.x);else return;this.addPen({isRuleLine:!0,type:$t.Line,name:"line",lineName:"line",x:o,y:u,width:c,height:f,color:this.store.options.ruleLineColor,anchors:[{x:0,y:0},{x:g,y:v}]})}clearRuleLines(){this.delete(this.ruleLines)}get ruleLines(){return this.store.data.pens.filter(t=>t.isRuleLine)}alignPenToGrid(t){var a;if(this.store.options.autoAlignGrid&&this.store.data.grid&&!t.type){const s=this.store.data.gridSize||this.store.options.gridSize,{origin:n,scale:r}=this.store.data,{x:l,y:o}=t,u={x:l,y:o},c=this.getPenRect(t),f=parseInt((c.x/s).toFixed()),g=parseInt((c.y/s).toFixed()),v=f*s,m=g*s;u.x=n.x+v*r,u.y=n.y+m*r,Object.assign(t,u),(a=t.onMove)==null||a.call(t,t),this.updatePenRect(t),this.calcActiveRect(),this.getSizeCPs()}}movedActivePens(t){let i=this.getAllFollowersByPens(this.store.active,!1);const a=ht(i,!0),s=this.store.data.gridSize||this.store.options.gridSize,{origin:n,scale:r}=this.store.data,l=this.store.options.autoAlignGrid&&(this.store.data.grid||this.store.options.grid);if(i.forEach(g=>{var _;const v=this.movingPens.findIndex(A=>A.id===g.id+He);if(v<0)return;const{x:m,y:w}=this.movingPens[v],y={x:m,y:w};if(l&&!this.movingPens[v].type){const A=this.getPenRect(this.movingPens[v]),x=parseInt((A.x/s).toFixed()),C=parseInt((A.y/s).toFixed()),T=x*s,I=C*s;y.x=n.x+T*r,y.y=n.y+I*r}Object.assign(g,y),(_=g.onMove)==null||_.call(g,g),this.updatePenRect(g),this.updateLines(g),this.store.emitter.emit("updateLines",g),this.patchFlagsLines.forEach(A=>{A.type&&this.initLineRect(A)}),this.patchFlagsLines.clear(),g.calculative.x=g.x,g.calculative.y=g.y,g.calculative.initRect&&(g.calculative.initRect.x=g.calculative.x,g.calculative.initRect.y=g.calculative.y,g.calculative.initRect.ex=g.calculative.x+g.calculative.width,g.calculative.initRect.ey=g.calculative.y+g.calculative.height),sg(g),g.parentId&&this.parent.updateRectbyChild(g.calculative.worldRect,g,this.store.pens[g.parentId])}),this.initImageCanvas(this.store.active),this.initTemplateCanvas(this.store.active),!this.dock)return;const{xDock:o,yDock:u}=this.dock;let c;o&&(c=this.store.pens[o.penId]),!c&&u&&(c=this.store.pens[u.penId]);const f=ht(this.store.active,!0);if(t&&this.store.active.length===1&&(c==null?void 0:c.type)===1&&((o==null?void 0:o.anchorId)||(u==null?void 0:u.anchorId))){const g=le(c),v=Vt(c);if(o!=null&&o.anchorId){const m=this.store.pens[this.store.active[0].id+He].calculative.worldAnchors.find(w=>w.id===o.anchorId);m.x===g.x&&m.y===g.y?(a.push(ht(c,!0)),we(this.store.active[0],m,c,g),f.push(ht(c,!0))):m.x===v.x&&m.y===v.y&&(a.push(ht(c,!0)),we(this.store.active[0],m,c,v),f.push(ht(c,!0)))}else if(u!=null&&u.anchorId){const m=this.store.pens[this.store.active[0].id+He].calculative.worldAnchors.find(w=>w.id===u.anchorId);m.x===g.x&&m.y===g.y?(a.push(ht(c,!0)),we(this.store.active[0],m,c,g),f.push(ht(c,!0))):m.x===v.x&&m.y===v.y&&(a.push(ht(c,!0)),we(this.store.active[0],m,c,v),f.push(ht(c,!0)))}}l&&(this.calcActiveRect(),this.getSizeCPs()),this.pushHistory({type:bt.Update,pens:f,initPens:a}),this.store.emitter.emit("translatePens",f)}copyMovedPens(){this.copy(this.store.active.map((t,i)=>{const{x:a,y:s}=this.movingPens[i];return this.updateLines(t),{...t,x:a,y:s}})),this.pasteOffset=!1,this.paste()}initImageCanvas(t){t.some(i=>this.hasImage(i,!1))&&this.canvasImage.init(),t.some(i=>this.hasImage(i,!0))&&this.canvasImageBottom.init()}initTemplateCanvas(t){t.some(i=>i.canvasLayer===zt.CanvasTemplate)&&this.canvasTemplate.init()}hasImage(t,i){var a;return t.image&&t.name!=="gif"?i?t.canvasLayer===zt.CanvasImageBottom:t.canvasLayer===zt.CanvasImage:(a=t.children)==null?void 0:a.some(s=>{const n=this.store.pens[s];return n&&this.hasImage(n,i)})}inactive(t){!this.store.active.length||(this.initTemplateCanvas(this.store.active),this.store.active.forEach(i=>{i.calculative.active=void 0,i.calculative.activeAnchor=void 0,i.calculative.hover=!1,ys(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)}active(t,i=!0){if(this.store.active){i&&this.store.emitter.emit("inactive",this.store.active);for(const a of this.store.active)a.calculative.active=void 0,a.calculative.hover=!1,ys(a,!1)}this.store.active=[],t.forEach(a=>{a.calculative.active=!0,ys(a)}),this.store.active.push(...t),this.activeRect=void 0,this.calcActiveRect(),this.initTemplateCanvas(t),this.patchFlags=!0,i&&this.store.emitter.emit("active",this.store.active)}getSizeCPs(){this.sizeCPs=Zi(this.activeRect);const t=[{x:.5,y:0},{x:1,y:.5},{x:.5,y:1},{x:0,y:.5}],{x:i,y:a,width:s,height:n,rotate:r,center:l}=this.activeRect;t.forEach(o=>{const u={x:o.x*s+i,y:o.y*n+a};Gt(u,r,l),this.sizeCPs.push(u)})}getSpecialAngle(t,i){let 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;let s=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)*s,t.y=i.y-Math.sin(a/180*Math.PI)*s}clearHover(){this.hoverType=xt.None,this.store.hover=null,this.store.hoverAnchor=null}inAnchor(t,i,a){var s;if(this.store.hoverAnchor=void 0,this.movingAnchor=void 0,!a||a.locked>Mt.DisableEdit||!(i.type&&i.calculative.active)&&this.store.options.disableAnchor||i.disableAnchor)return xt.None;if((this.mouseDown||this.drawingLine)&&i.name==="line"&&a.connectTo){const n=this.findOne(a.connectTo);if((n==null?void 0:n.calculative)&&!(n!=null&&n.calculative.active)){i=n;const r=n.calculative.worldAnchors.find(l=>l.id===a.anchorId);r&&(a=r)}}if(a.twoWay===Ae.Disable&&i.name!=="line")return xt.None;if(i.name==="line"&&a.connectTo){let n=(s=this.findOne(a.connectTo))==null?void 0:s.anchors.find(r=>r.id===a.anchorId);if(n&&n.twoWay)return xt.None}if(this.drawingLine){if(a.twoWay===Ae.Out)return xt.None}else if(!(this.mouseDown&&this.hoverType===xt.LineAnchor)){if(a.twoWay===Ae.In)return xt.None}if(ms(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(n=>n.id===a.anchorId),this.store.hoverAnchor?(this.externalElements.style.cursor="crosshair",xt.NodeAnchor):xt.None):(this.hotkeyType===Yt.AddAnchor?this.externalElements.style.cursor="vertical-text":this.externalElements.style.cursor="pointer",xt.LineAnchor):(this.hotkeyType===Yt.AddAnchor?this.externalElements.style.cursor="vertical-text":this.externalElements.style.cursor="crosshair",xt.NodeAnchor);if(!this.mouseDown&&i.type){if(i.calculative.active&&a.prev&&ms(t,a.prev,this.pointSize))return this.store.hoverAnchor=a,this.store.hover=i,this.externalElements.style.cursor="pointer",xt.LineAnchorPrev;if(i.calculative.active&&a.next&&ms(t,a.next,this.pointSize))return this.store.hoverAnchor=a,this.store.hover=i,this.externalElements.style.cursor="pointer",xt.LineAnchorNext}return xt.None}resize(t,i){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},re(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";for(const a of this.store.data.pens)a.isRuleLine&&(a.width?a.height||(a.width=this.width):a.height=this.height,this.updatePenRect(a)),Yi(a);this.render()}clearCanvas(){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()}async addPen(t,i,a,s){if(!(this.beforeAddPens&&await this.beforeAddPens([t])!=!0)&&!(this.beforeAddPen&&this.beforeAddPen(t)!=!0))return s&&(t.x=t.x*this.store.data.scale+this.store.data.origin.x,t.y=t.y*this.store.data.scale+this.store.data.origin.y,t.width=t.width*this.store.data.scale,t.height=t.height*this.store.data.scale),this.makePen(t),this.active([t]),this.render(),a&&this.store.emitter.emit("add",[t]),i&&this.pushHistory({type:bt.Add,pens:[t]}),t}pushHistory(t){var s;if(this.store.data.locked)return;const{origin:i,scale:a}=this.store.data;t.origin=ht(i),t.scale=a,t.type!==bt.Update&&t.pens&&t.pens.forEach(n=>{n.calculative&&(n.calculative.layer=this.store.data.pens.findIndex(r=>r.id===n.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),(s=t.pens)==null||s.forEach(n=>{let r;if(t.initPens)for(const l of t.initPens)l.id===n.id&&(r=l);if(r)for(const l in n)r[l]==null&&(r[l]=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})}undo(){if(this.store.data.locked||this.store.historyIndex==null||this.store.historyIndex<0)return;const t=this.store.histories[this.store.historyIndex--];this.doEditAction(t,!0);let i=t.step;for(;i>1;){const a=this.store.histories[this.store.historyIndex--];this.doEditAction(a,!0),i--}(t.type==bt.Add||t.type==bt.Delete||t.type==bt.Update)&&this.activeHistory()}redo(){if(this.store.data.locked||this.store.historyIndex==null||this.store.historyIndex>this.store.histories.length-2)return;const t=this.store.histories[++this.store.historyIndex];this.doEditAction(t,!1);let i=t.step;for(;i>1;){const a=this.store.histories[++this.store.historyIndex];this.doEditAction(a,!1),i--}(t.type==bt.Add||t.type==bt.Delete||t.type==bt.Update)&&this.activeHistory()}activeHistory(){let t=this.store.histories[this.store.historyIndex+1];const i=[];if(t&&t.type===bt.Update){t.pens.forEach(s=>{i.push(this.store.pens[s.id])}),this.active(i);return}let a=this.store.histories[this.store.historyIndex];a&&(a.type===bt.Add||a.type===bt.Delete)&&(a.pens.forEach(s=>{i.push(this.store.pens[s.id])}),this.active(i))}doEditAction(t,i){switch(this.inactive(),this.store.hoverAnchor=void 0,this.store.hover=void 0,t.type){case bt.Add:t.pens.forEach(n=>{var o;const r=ht(n,!0),l=this.store.data.pens.findIndex(u=>u.id===r.id);l>-1&&((o=r.onDestroy)==null||o.call(r,this.store.pens[r.id]),this.store.data.pens.splice(l,1),this.store.pens[r.id]=void 0,r.calculative||(r.calculative={}),r.calculative.canvas=this,this.store.animates.delete(r),this.store.animateMap.delete(r))}),t.type=bt.Delete;break;case bt.Update:const a=i?t.initPens:t.pens,s=i?t.pens:t.initPens;a.forEach(n=>{const r=ht(n,!0),l=this.store.data.pens.findIndex(o=>o.id===r.id);if(l>-1){if(r.calculative=this.store.data.pens[l].calculative,this.store.data.pens[l].type&&this.store.data.pens[l].lastConnected){for(let u in this.store.data.pens[l].lastConnected)if(this.store.pens[u]){let c=ht(this.store.data.pens[l].lastConnected[u]);this.store.pens[u].connectedLines=c,r.anchors.forEach(f=>{c.forEach(g=>{f.id===g.lineAnchor&&(f.connectTo=u)})})}}this.store.data.pens[l]=r,this.store.pens[r.id]=r;for(const u in r)(typeof r[u]!="object"||u==="lineDash")&&(r.calculative[u]=r[u]);r.calculative.image=void 0;const o=this.getPenRect(r,t.origin,t.scale);if(this.setPenRect(r,o,!1),this.updateLines(r,!0),r.calculative.canvas.parent.isCombine(r)){let u=s.find(c=>c.id===r.id);Nd.forEach(c=>{r[c]!==u[c]&&this.parent.setValue({id:r.id,[c]:r[c]},{render:!0,doEvent:!1})})}}});break;case bt.Delete:t.pens.reverse().forEach(n=>{var l,o;const r=ht(n,!0);if(r.calculative||(r.calculative={}),this.store.data.pens.splice(((l=r.calculative)==null?void 0:l.layer)!==-1?(o=r.calculative)==null?void 0:o.layer:this.store.data.pens.length,0,r),this.store.pens[r.id]=r,r.type&&r.lastConnected)for(let u in r.lastConnected)this.store.pens[u]&&(this.store.pens[u].connectedLines=r.lastConnected[u]);r.calculative.canvas=this}),t.pens.reverse().forEach(n=>{const r=this.store.pens[n.id],l=this.getPenRect(r,t.origin,t.scale);this.setPenRect(r,l,!1),r.calculative.image=void 0,r.calculative.backgroundImage=void 0,r.calculative.strokeImage=void 0,this.loadImage(r)}),t.type=bt.Add;break;case bt.Replace:{const n=i?t.initPens:t.pens;(i?t.pens:t.initPens).forEach(l=>{var c;const o=ht(l,!0);if(this.store.data.pens.findIndex(f=>f.id===o.id)>-1){(c=o.onDestroy)==null||c.call(o,this.store.data.pens.find(g=>g.id===o.id));const f=this.store.data.pens.findIndex(g=>g.id===o.id);this.store.data.pens.splice(f,1),this.store.pens[o.id]=void 0,o.calculative||(o.calculative={}),o.calculative.canvas=this,this.store.animates.delete(o),this.store.animateMap.delete(o)}}),n.reverse().forEach(l=>{var u,c;const o=ht(l,!0);if(o.calculative||(o.calculative={}),this.store.data.pens.splice(((u=o.calculative)==null?void 0:u.layer)!==-1?(c=o.calculative)==null?void 0:c.layer:this.store.data.pens.length,0,o),this.store.pens[o.id]=o,o.type&&o.lastConnected)for(let f in o.lastConnected)this.store.pens[f]&&(this.store.pens[f].connectedLines=o.lastConnected[f]);o.calculative.canvas=this}),n.reverse().forEach(l=>{const o=this.store.data.pens.find(c=>c.id===l.id),u=this.getPenRect(o,t.origin,t.scale);this.setPenRect(o,u,!1),o.calculative.image=void 0,o.calculative.backgroundImage=void 0,o.calculative.strokeImage=void 0,this.loadImage(o)}),t.type=bt.Replace;break}}if(t.type===bt.Update){let a=[...t.pens,...t.initPens];this.initImageCanvas(a),this.initTemplateCanvas(a)}else this.initImageCanvas(t.pens),this.initTemplateCanvas(t.pens);this.parent.onSizeUpdate(),this.render(),this.store.emitter.emit(i?"undo":"redo",t)}makePen(t){var s,n;if(t.id||(t.id=St()),Math.abs(this.store.lastScale-this.store.data.scale)<1e-4&&this.store.sameTemplate&&this.store.templatePens[t.id]&&t.canvasLayer===zt.CanvasTemplate){t=this.store.templatePens[t.id],this.store.data.pens.push(t),this.updatePenRect(t);return}if(t.copyIndex?(this.store.data.pens.splice(t.copyIndex+1,0,t),delete t.copyIndex):this.store.data.pens.push(t),this.store.pens[t.id]=t,t.path){!t.pathId&&(t.pathId=St());const r=this.store.data.paths;!r[t.pathId]&&(r[t.pathId]=t.path),t.path=void 0}t.lineWidth==null&&(t.lineWidth=1);const{fontSize:i,lineHeight:a}=this.store.options;t.fontSize?t.fontSize<0&&(t.fontSize=0):t.fontSize=i>=0?i:12,t.lineHeight||(t.lineHeight=a),t.image&&t.name!=="gif"&&t.canvasLayer===void 0&&(t.isBottom?t.canvasLayer=zt.CanvasImageBottom:t.canvasLayer=zt.CanvasImage,delete t.isBottom),t.template&&(t.canvasLayer=zt.CanvasTemplate),t.calculative={canvas:this,singleton:(s=t.calculative)==null?void 0:s.singleton},(t.video||t.audio)&&(t.calculative.onended=r=>{this.nextAnimate(r)});for(const r in t)(typeof t[r]!="object"||r==="lineDash")&&(t.calculative[r]=t[r]);if(t.calculative.image=void 0,t.calculative.backgroundImage=void 0,t.calculative.strokeImage=void 0,!t.anchors&&Et.anchors[t.name]&&(t.anchors||(t.anchors=[]),Et.anchors[t.name](t)),!t.anchors){const r=ht(this.store.options.defaultAnchors);r.forEach((l,o)=>{l.id=`${o}`,l.penId=t.id}),t.anchors=r}this.updatePenRect(t),!t.anchors&&t.calculative.worldAnchors&&(t.anchors=t.calculative.worldAnchors.map(r=>rn(r,t.calculative.worldRect))),!t.rotate&&(t.rotate=0),(n=t.lineAnimateImages)!=null||(t.lineAnimateImages=[]),t.lineAnimateImages&&t.lineAnimateImages.forEach(r=>{this.__loadImage(r)}),this.loadImage(t),this.parent.penNetwork(t)}drawline(t){var i;!this.drawingLine||((i=this[this.drawingLineName])==null||i.call(this,this.store,this.drawingLine,t),this.store.path2dMap.set(this.drawingLine,Et.path2dDraws.line(this.drawingLine)),this.patchFlags=!0)}initLineRect(t){var n;if(!t)return;if(!((n=t.calculative.worldAnchors)!=null&&n.length)){this._del([t]);return}if(!isFinite(t.x)||!isFinite(t.x)||t.x==null||t.y==null)return;const i=ic(t);t.parentId||Object.assign(t,i);const{fontSize:a,lineHeight:s}=this.store.options;t.fontSize||(t.fontSize=a>=0?a:12,t.calculative.fontSize=t.fontSize*this.store.data.scale),t.lineHeight||(t.lineHeight=s,t.calculative.lineHeight=t.lineHeight),Qt(i),t.calculative.worldRect=i,wc(t,i),Fi(t),Yi(t),t.calculative&&(t.calculative.gradientAnimatePath=void 0),this.store.path2dMap.set(t,Et.path2dDraws[t.name](t)),t.calculative.worldAnchors&&(t.anchors=t.calculative.worldAnchors.map(r=>rn(r,t.calculative.worldRect)))}drawingPencil(){bg(this.store),this.pencil=!0,this.externalElements.style.cursor="crosshair"}stopPencil(){this.pencil=!1,this.pencilLine=void 0,this.externalElements.style.cursor="default"}async finishDrawline(t){if(!this.drawingLine)return;const i=le(this.drawingLine);let a=Vt(this.drawingLine);if(a.isTemp&&(this.drawingLine.calculative.worldAnchors.pop(),a=Vt(this.drawingLine)),!t&&(!a.connectTo&&this.drawingLine.calculative.worldAnchors.pop(),le(this.drawingLine)===this.drawingLine.calculative.activeAnchor)){this.drawingLine=void 0,this.render();return}if(!i.connectTo||!a.connectTo){if(this.store.options.disableEmptyLine){i.connectTo&&(this.store.pens[i.connectTo].connectedLines=this.store.pens[i.connectTo].connectedLines.filter(r=>r.lineId!==this.drawingLine.id)),this.drawingLine=void 0,this.render();return}}else if(this.store.options.disableRepeatLine&&this.store.data.pens.find(l=>{if(l.type){const o=le(l),u=Vt(l);return df(o,i)&&df(u,a)}})){this.drawingLine=void 0,this.render();return}const s=ic(this.drawingLine);Object.assign(this.drawingLine,s),this.drawingLine.calculative.worldRect=s,this.drawingLine.calculative.activeAnchor=Vt(this.drawingLine),this.store.activeAnchor=this.drawingLine.calculative.activeAnchor,(!this.beforeAddPens||await this.beforeAddPens([this.drawingLine]))&&(!this.beforeAddPen||this.beforeAddPen(this.drawingLine))&&(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:bt.Add,pens:ht([this.drawingLine],!0)})),this.store.path2dMap.set(this.drawingLine,Et.path2dDraws[this.drawingLine.name](this.drawingLine)),this.drawingLine=void 0,this.drawingLineName=void 0,this.render()}async finishPencil(){if(this.pencilLine){const t=ac(this.pencilLine.calculative.worldAnchors,10,0,this.pencilLine.calculative.worldAnchors.length-1);let i=le(this.pencilLine);t.unshift({id:i.id,penId:i.penId,x:i.x,y:i.y}),i=Vt(this.pencilLine),t.push({id:i.id,penId:i.penId,x:i.x,y:i.y}),this.pencilLine.calculative.worldAnchors=O_(t),this.pencilLine.calculative.worldAnchors.length>1&&(this.pencilLine.calculative.pencil=!1,this.store.path2dMap.set(this.pencilLine,Et.path2dDraws[this.pencilLine.name](this.pencilLine)),(!this.beforeAddPens||await this.beforeAddPens([this.pencilLine]))&&(!this.beforeAddPen||this.beforeAddPen(this.pencilLine))&&(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:bt.Add,pens:ht([this.pencilLine],!0)}))),this.pencilLine=void 0,this.render()}}firefoxLoadSvg(t){const i=new Image,a=new XMLHttpRequest;a.open("GET",t.image,!0),a.onload=()=>{const r=new DOMParser().parseFromString(a.responseText,"text/xml").getElementsByTagName("svg")[0],{width:l,height:o}=t.calculative.worldRect;r.setAttribute("width",`${l}px`),r.setAttribute("height",`${o}px`);const c="data:image/svg+xml;base64,"+btoa(unescape(encodeURIComponent(new XMLSerializer().serializeToString(r))));i.src=c,i.onload=()=>{t.calculative.img=i,t.calculative.imgNaturalWidth=i.naturalWidth||t.iconWidth,t.calculative.imgNaturalHeight=i.naturalHeight||t.iconHeight,Et.htmlElements[t.image]=i,this.imageLoaded(),t.canvasLayer===zt.CanvasTemplate&&this.templateImageLoaded()}},a.send()}loadImage(t){if(t.image!==t.calculative.image||!t.calculative.img){if(t.calculative.img=void 0,t.image)if(Et.htmlElements[t.image]){const i=Et.htmlElements[t.image];t.calculative.img=i,t.calculative.imgNaturalWidth=i.naturalWidth||t.iconWidth,t.calculative.imgNaturalHeight=i.naturalHeight||t.iconHeight,this.imageLoaded(),t.canvasLayer===zt.CanvasTemplate&&this.templateImageLoaded()}else if(navigator.userAgent.includes("Firefox")&&t.image.endsWith(".svg"))this.firefoxLoadSvg(t);else{const i=new Image;i.crossOrigin=t.crossOrigin==="undefined"?void 0:t.crossOrigin||"anonymous",i.src=t.image,this.store.options.cdn&&!(t.image.startsWith("http")||t.image.startsWith("//")||t.image.startsWith("data:image"))&&(i.src=this.store.options.cdn+t.image),i.onload=()=>{t.calculative.img=i,t.calculative.imgNaturalWidth=i.naturalWidth||t.iconWidth,t.calculative.imgNaturalHeight=i.naturalHeight||t.iconHeight,Et.htmlElements[t.image]=i,this.imageLoaded(),t.canvasLayer===zt.CanvasTemplate&&this.templateImageLoaded()}}t.calculative.image=t.image}if(t.backgroundImage!==t.calculative.backgroundImage){if(t.calculative.backgroundImg=void 0,t.backgroundImage)if(Et.htmlElements[t.backgroundImage]){const i=Et.htmlElements[t.backgroundImage];t.calculative.backgroundImg=i}else{const i=new Image;i.crossOrigin="anonymous",i.src=t.backgroundImage,this.store.options.cdn&&!(t.backgroundImage.startsWith("http")||t.backgroundImage.startsWith("//")||t.backgroundImage.startsWith("data:image"))&&(i.src=this.store.options.cdn+t.backgroundImage),i.onload=()=>{t.calculative.backgroundImg=i,Et.htmlElements[t.backgroundImage]=i,this.imageLoaded(),t.canvasLayer===zt.CanvasTemplate&&this.templateImageLoaded()}}t.calculative.backgroundImage=t.backgroundImage}if(t.strokeImage!==t.calculative.strokeImage){if(t.calculative.strokeImg=void 0,t.strokeImage)if(Et.htmlElements[t.strokeImage]){const i=Et.htmlElements[t.strokeImage];t.calculative.strokeImg=i}else{const i=new Image;i.crossOrigin="anonymous",i.src=t.strokeImage,this.store.options.cdn&&!(t.strokeImage.startsWith("http")||t.strokeImage.startsWith("//")||t.strokeImage.startsWith("data:image"))&&(i.src=this.store.options.cdn+t.strokeImage),i.onload=()=>{t.calculative.strokeImg=i,Et.htmlElements[t.strokeImage]=i,this.imageLoaded(),t.canvasLayer===zt.CanvasTemplate&&t.name!=="gif"&&this.templateImageLoaded()}}t.calculative.strokeImage=t.strokeImage}}__loadImage(t){return new Promise(i=>{if(Et.htmlElements[t])i(Et.htmlElements[t]);else{const a=new Image;a.crossOrigin="anonymous",a.src=t,this.store.options.cdn&&!(t.startsWith("http")||t.startsWith("//")||t.startsWith("data:image"))&&(a.src=this.store.options.cdn+t),a.onload=()=>{Et.htmlElements[t]=a,i(a)}}})}imageLoaded(){this.imageTimer&&clearTimeout(this.imageTimer),this.imageTimer=setTimeout(()=>{this.canvasImage.init(),this.canvasImageBottom.init(),this.render()},100)}templateImageLoaded(){this.templateImageTimer&&clearTimeout(this.templateImageTimer),this.templateImageTimer=setTimeout(()=>{this.canvasTemplate.init(),this.render()},100)}setCalculativeByScale(t){const i=this.store.data.scale;t.calculative.lineWidth=t.lineWidth*i,t.calculative.fontSize=t.fontSize*i,t.fontSize<1&&t.fontSize>0&&(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.calculative.worldRect.width:t.textLeft*i,t.calculative.textTop=t.textTop<1&&t.textTop>-1?t.textTop*t.calculative.worldRect.height:t.textTop*i,t.type===$t.Line&&t.borderWidth&&(t.calculative.borderWidth=t.borderWidth*i)}updatePenRect(t,{worldRectIsReady:i,playingAnimate:a}={}){i?Ir(t):ag(t),a||this.setCalculativeByScale(t),As(t),mf(this.store.pens,t),Fi(t),Yi(t),Et.path2dDraws[t.name]&&this.store.path2dMap.set(t,Et.path2dDraws[t.name](t)),t.calculative.patchFlags=!0,this.patchFlags=!0,t.children&&t.children.forEach(s=>{const n=this.store.pens[s];n&&this.updatePenRect(n,{worldRectIsReady:!1})}),t.type&&this.initLineRect(t),t.calculative.gradientTimer&&clearTimeout(t.calculative.gradientTimer),t.calculative.gradientTimer=setTimeout(()=>{t.calculative.lineGradient&&(t.calculative.lineGradient=null),t.calculative.gradient&&(t.calculative.gradient=null),t.calculative.radialGradient&&(t.calculative.radialGradient=null),this.patchFlags=!0,t.calculative.gradientTimer=void 0},50)}initGlobalStyle(){if(this.store.options.themeOnlyCanvas||this.store.data.themeOnlyCanvas)return;const t={},i={},a={};Nx.forEach(n=>{var r;if(this.store.options[n]!==void 0&&(t[n]=this.store.options[n]),this.store.data[n]!==void 0&&(i[n]=this.store.data[n]),this.store.data.theme){const l=(r=this.store.theme[this.store.data.theme])==null?void 0:r[n];l!==void 0&&(a[n]=l)}}),this.store.styles={};const s=Qs.getThemeObj(this.store.data.theme);Object.assign(this.store.styles,t,i,a,s)}translate(t=0,i=0){if(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){let a=qi(this.store.options.padding);const s=this.store.data.width||this.store.options.width,n=this.store.data.height||this.store.options.height;this.width<(s+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+s*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+s*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.store.data.asyncTranslate?(clearTimeout(this.transTimeout),this.transTimeout=setTimeout(()=>{this.canvasTemplate.init(),this.canvasImage.init(),this.canvasImageBottom.init(),this.render()},300)):(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()}onMovePens(){var i;const t=this.parent.map;t&&t.isShow&&t.setView();for(const a of this.store.data.pens)Yi(a),(i=a.onMove)==null||i.call(a,a),a.isRuleLine&&(a.width?a.height||(a.x=-this.store.data.x):a.y=-this.store.data.y,this.updatePenRect(a))}scale(t,i={x:0,y:0}){var l;const a=this.store.data.minScale||this.store.options.minScale,s=this.store.data.maxScale||this.store.options.maxScale;if(!(t>=a&&t<=s))return;this.calibrateMouse(i);const n=t/this.store.data.scale;this.store.data.scale=t,this.store.data.center=i,(l=this.store.clipboard)!=null&&l.pos&&Hr(this.store.clipboard.pos,n,i),Hr(this.store.data.origin,n,i),this.store.data.pens.forEach(o=>{if(o.onScale&&o.onScale(o),!o.parentId){if(ds(o,n,i),o.isRuleLine){const u=1/n,c=o.calculative.worldRect.center;o.width&&o.height||ds(o,u,c)}this.updatePenRect(o,{worldRectIsReady:!0}),this.execPenResize(o)}}),this.onMovePens(),this.calcActiveRect(),this.canvasTemplate.init(),this.canvasImage.init(),this.canvasImageBottom.init();const r=this.parent.map;r&&r.isShow&&r.setView(),this.render(),this.store.emitter.emit("scale",this.store.data.scale)}templateScale(t,i={x:0,y:0}){const{minScale:a,maxScale:s}=this.store.options;if(!(t>=a&&t<=s))return;const n=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(r=>{if(!r.parentId){if(ds(r,n,i),r.onScale&&r.onScale(r),r.isRuleLine){const l=n>1?1:1/n/n,o=r.calculative.worldRect.center;r.width&&r.height||ds(r,l,o)}this.execPenResize(r)}}),this.calcActiveRect()}rotatePens(t){this.initPens||(this.initPens=ht(this.getAllByPens(this.store.active))),this.activeRect.rotate=ui(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);const i=this.activeRect.rotate-this.lastRotate;for(const a of this.store.active){if(a.parentId)return;this.rotatePen(a,i,this.activeRect),a.onRotate&&a.onRotate(a),this.updateLines(a)}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(()=>{this.timer=void 0,this.pushHistory({type:bt.Update,pens:ht(this.getAllByPens(this.store.active)),initPens:this.initPens}),this.initPens=void 0},200)}resizePens(t){if(this.initPens||(this.initPens=ht(this.store.active,!0)),!this.initActiveRect){this.initActiveRect=ht(this.activeRect);return}const i={x:this.mouseDown.x,y:this.mouseDown.y},a={x:t.x,y:t.y};let s=a.x-i.x,n=a.y-i.y;const r=ht(this.initActiveRect);if(kf(r,s,n,this.resizeIndex),Qt(r),!this.store.options.disableDock){this.clearDock();const v=this.customResizeDock||O2;this.dock=v(this.store,r,this.store.active,this.resizeIndex);const{xDock:m,yDock:w}=this.dock;if(m){s+=m.step;const y=this.store.pens[m.penId];y.calculative.isDock=!0}if(w){n+=w.step;const y=this.store.pens[w.penId];y.calculative.isDock=!0}}const l=this.activeRect.width,o=this.activeRect.height;let u=s-this.lastOffsetX,c=n-this.lastOffsetY;if(this.lastOffsetX=s,this.lastOffsetY=n,(t.ctrlKey||this.initPens.length===1&&this.initPens[0].ratio)&&(c=([1,3].includes(this.resizeIndex)?-1:1)*(u*o)/l),this.activeRect.ratio=this.initPens[0].ratio,kf(this.activeRect,u,c,this.resizeIndex),this.store.options.strictScope){const v=this.store.data.width||this.store.options.width,m=this.store.data.height||this.store.options.height;if(v&&m){let w={x:this.store.data.origin.x,y:this.store.data.origin.y,width:v*this.store.data.scale,height:m*this.store.data.scale};this.activeRect.x<w.x&&(this.activeRect.width=this.activeRect.width-(w.x-this.activeRect.x),this.activeRect.x=w.x),this.activeRect.y<w.y&&(this.activeRect.height=this.activeRect.height-(w.y-this.activeRect.y),this.activeRect.y=w.y),this.activeRect.x+this.activeRect.width>w.x+w.width&&(this.activeRect.width=this.activeRect.width-(this.activeRect.x+this.activeRect.width-(w.x+w.width)),this.activeRect.x=w.x+w.width-this.activeRect.width,this.activeRect.ex=this.activeRect.x+this.activeRect.width),this.activeRect.y+this.activeRect.height>w.y+w.height&&(this.activeRect.height=this.activeRect.height-(this.activeRect.y+this.activeRect.height-(w.y+w.height)),this.activeRect.y=w.y+w.height-this.activeRect.height,this.activeRect.ey=this.activeRect.y+this.activeRect.height)}}Qt(this.activeRect);const f=this.activeRect.width/l,g=this.activeRect.height/o;this.store.active.forEach((v,m)=>{v.calculative.worldRect.x=this.activeInitPos[m].x*this.activeRect.width+this.activeRect.x,v.calculative.worldRect.y=this.activeInitPos[m].y*this.activeRect.height+this.activeRect.y,v.calculative.worldRect.width*=f,v.calculative.iconWidth&&(v.calculative.iconWidth*=f),v.calculative.worldRect.height*=g,v.calculative.iconHeight&&(v.calculative.iconHeight*=g),re(v.calculative.worldRect),Qt(v.calculative.worldRect),this.updatePenRect(v,{worldRectIsReady:!0}),this.execPenResize(v),this.updateLines(v)}),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(()=>{this.timer=void 0,this.pushHistory({type:bt.Update,pens:ht(this.store.active,!0),initPens:this.initPens}),this.initPens=void 0},200)}movePens(t){var l,o;if(!this.activeRect||this.store.data.locked)return;if(!this.initActiveRect){this.initActiveRect=ht(this.activeRect);return}if(!this.store.options.moveConnectedLine&&!this.canMoveLine&&this.store.active.length===1&&(((l=this.store.active[0].anchors[0])==null?void 0:l.connectTo)||((o=this.store.active[0].anchors[this.store.active[0].anchors.length-1])==null?void 0:o.connectTo))||(this.movingPens||(this.initMovingPens(),this.store.active.forEach(u=>{tn(u,!1)}),this.store.hover=void 0),!this.mouseDown))return;let i=t.x-this.mouseDown.x,a=t.y-this.mouseDown.y;t.shiftKey&&!t.ctrlKey&&(a=0),t.ctrlKey&&(i=0);const s=ht(this.initActiveRect);Da(s,i,a);let n=!1;if(this.store.options.strictScope){const u=this.store.data.width||this.store.options.width,c=this.store.data.height||this.store.options.height;if(u&&c){let f={x:this.store.data.origin.x,y:this.store.data.origin.y,width:u*this.store.data.scale,height:c*this.store.data.scale};s.x<f.x&&(s.x=f.x,n=!0),s.y<f.y&&(s.y=f.y,n=!0),s.x+s.width>f.x+f.width&&(s.x=f.x+f.width-s.width,n=!0),s.y+s.height>f.y+f.height&&(s.y=f.y+f.height-s.height,n=!0)}}const r={x:s.x-this.activeRect.x,y:s.y-this.activeRect.y};if(!this.store.options.disableDock&&!n){this.clearDock();const u=this.customMoveDock||M2;this.dock=u(this.store,s,this.movingPens,r);const{xDock:c,yDock:f}=this.dock;let g;c&&(r.x+=c.step,g=this.store.pens[c.penId],g.calculative.isDock=!0),f&&(r.y+=f.step,g=this.store.pens[f.penId],g.calculative.isDock=!0)}this.translatePens(this.movingPens,r.x,r.y,!0)}changeIdsByMoving(t,i){t.id+=He,t.parentId&&i.find(a=>a.id===t.parentId)&&(t.parentId+=He),t.children&&(t.children=t.children.map(a=>a+He)),t.connectedLines&&(t.connectedLines=t.connectedLines.map(a=>(i.find(s=>s.id===a.lineId)&&(a.lineId+=He),a))),t.type&&t.calculative.worldAnchors&&(t.calculative.worldAnchors=t.calculative.worldAnchors.map(a=>(a.connectTo&&i.find(s=>s.id===a.connectTo)&&(a.connectTo+=He),a)))}initMovingPens(){var a,s;if(!this.store.options.moveConnectedLine&&!this.canMoveLine)for(let n=0;n<this.store.active.length;n++){const r=this.store.active[n];(((a=r.anchors[0])==null?void 0:a.connectTo)||((s=r.anchors[r.anchors.length-1])==null?void 0:s.connectTo))&&(this.store.active.splice(n,1),r.calculative.active=void 0,--n)}this.movingPens=ht(this.store.active,!0),this.movingPens=this.getAllFollowersByPens(this.movingPens);const t=this.getAllByPens(this.movingPens),i=ht(t,!0);t.forEach(n=>{this.changeIdsByMoving(n,i),this.store.pens[n.id]=n,n.calculative.canvas=this;const r={globalAlpha:.5};n.lineWidth===0&&(r.lineWidth=1),(n.name.endsWith("Dom")||Od.includes(n.name)||this.store.options.domShapes.includes(n.name)||n.image)&&(r.name="rectangle",r.onDestroy=void 0),this.updateValue(n,r),n.calculative.image=void 0})}moveLineAnchor(t,i){var l,o,u,c,f;if(!this.activeRect||this.store.data.locked)return;if(this.initPens||(this.initPens=ht(this.store.active,!0)),(l=this.store.activeAnchor)!=null&&l.connectTo){const g=this.store.pens[this.store.activeAnchor.connectTo];xs(g,Ia(g,this.store.activeAnchor.anchorId),this.store.pens[this.store.activeAnchor.penId],this.store.activeAnchor)}let a=(o=this.store.activeAnchor)==null?void 0:o.id,s=(c=(u=this.store.pens[this.store.activeAnchor.penId])==null?void 0:u.connectedLines)==null?void 0:c.filter(g=>g.anchor===a);s&&s.length>0&&s.forEach(g=>{const v=this.store.pens[g.lineId];xs(this.store.pens[this.store.activeAnchor.penId],this.store.activeAnchor,v,Ia(v,g.lineAnchor))});const n=this.store.active[0];le(n);const r=Vt(n);if(n.lineName==="polyline"&&!i.shiftKey)M_(n,this.store.activeAnchor,t);else{let g=0,v=0;if(n.lineName==="line"){let m=n.calculative.worldAnchors.findIndex(y=>y.id===this.store.activeAnchor.id);m===0&&(m=2);let w=n.calculative.worldAnchors[m-1];if(i.ctrlKey&&i.shiftKey){let y=ht(t);this.getSpecialAngle(y,w),g=y.x-this.store.activeAnchor.x,v=y.y-this.store.activeAnchor.y}else if(!i.ctrlKey&&i.shiftKey){let y={x:t.x,y:w.y};g=y.x-this.store.activeAnchor.x,v=y.y-this.store.activeAnchor.y}else if(i.ctrlKey&&!i.shiftKey){let y={x:w.x,y:t.y};g=y.x-this.store.activeAnchor.x,v=y.y-this.store.activeAnchor.y}else g=t.x-this.store.activeAnchor.x,v=t.y-this.store.activeAnchor.y}else!i.ctrlKey&&i.shiftKey?(g=t.x-this.store.activeAnchor.x,v=0):i.ctrlKey&&!i.shiftKey?(g=0,v=t.y-this.store.activeAnchor.y):(g=t.x-this.store.activeAnchor.x,v=t.y-this.store.activeAnchor.y);nn(this.store.activeAnchor,g,v),this.store.hover&&this.store.hoverAnchor&&this.store.hoverAnchor.penId!==this.store.activeAnchor.penId&&(this.store.hoverAnchor.type===$i.Line?(g=t.x-this.store.activeAnchor.x,v=t.y-this.store.activeAnchor.y,mr(this.store.activeAnchor,this.store.hoverAnchor,this.store)):(g=this.store.hoverAnchor.x-this.store.activeAnchor.x,v=this.store.hoverAnchor.y-this.store.activeAnchor.y),nn(this.store.activeAnchor,g,v),r.prev=void 0,n.lineName!=="polyline"&&((f=this[n.lineName])==null||f.call(this,this.store,n)))}this.patchFlagsLines.add(n),this.store.path2dMap.set(n,Et.path2dDraws[n.name](n)),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(()=>{this.timer=void 0,this.pushHistory({type:bt.Update,pens:ht(this.store.active,!0),initPens:this.initPens}),this.initPens=void 0},500)}moveLineAnchorPrev(t){if(!this.activeRect||this.store.data.locked||!this.store.activeAnchor)return;if(this.initPens||(this.initPens=ht(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,Gt(this.store.activeAnchor.next,180,this.store.activeAnchor);else if(this.store.activeAnchor.prevNextType===Na.Bilateral&&this.prevAnchor){const a=ui(t,this.store.activeAnchor),s=ui(this.prevAnchor,this.store.activeAnchor);this.store.activeAnchor.next.x=this.nextAnchor.x,this.store.activeAnchor.next.y=this.nextAnchor.y,Gt(this.store.activeAnchor.next,a-s,this.store.activeAnchor)}}const i=this.store.active[0];this.patchFlagsLines.add(i),this.store.path2dMap.set(i,Et.path2dDraws[i.name](i)),this.render(),this.timer&&clearTimeout(this.timer),this.timer=setTimeout(()=>{this.timer=void 0,this.pushHistory({type:bt.Update,pens:ht(this.store.active,!0),initPens:this.initPens}),this.initPens=void 0},200)}moveLineAnchorNext(t){if(!this.activeRect||this.store.data.locked||!this.store.activeAnchor)return;if(this.initPens||(this.initPens=ht(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,Gt(this.store.activeAnchor.prev,180,this.store.activeAnchor);else if(this.store.activeAnchor.prevNextType===Na.Bilateral&&this.nextAnchor){const a=ui(t,this.store.activeAnchor),s=ui(this.nextAnchor,this.store.activeAnchor);this.store.activeAnchor.prev.x=this.prevAnchor.x,this.store.activeAnchor.prev.y=this.prevAnchor.y,Gt(this.store.activeAnchor.prev,a-s,this.store.activeAnchor)}}const i=this.store.active[0];this.patchFlagsLines.add(i),this.store.path2dMap.set(i,Et.path2dDraws[i.name](i)),this.render(),this.timer&&clearTimeout(this.timer),this.timer=setTimeout(()=>{this.timer=void 0,this.pushHistory({type:bt.Update,pens:ht(this.store.active,!0),initPens:this.initPens}),this.initPens=void 0},200)}async setAnchor(t){var s;const i=[ht(this.store.hover,!0)],a=this.store.hover;if(this.store.hoverAnchor){if(this.beforeRemoveAnchor&&!await this.beforeRemoveAnchor(a,this.store.hoverAnchor))return;a.type===$t.Line&&((s=a.calculative.worldAnchors)==null?void 0:s.length)<=2?this.delete([a]):(A2(a,this.store.hoverAnchor),a.type===$t.Line&&this.initLineRect(a)),this.store.hoverAnchor=void 0,this.store.activeAnchor=void 0,this.externalElements.style.cursor="default"}else if(a){if(this.beforeAddAnchor&&!await this.beforeAddAnchor(a,this.store.pointAt))return;if(a.type===$t.Line){this.store.activeAnchor=E2(a,this.store.pointAt,this.store.pointAtIndex),this.initLineRect(a);const n={x:t.x,y:t.y};this.getHover(n)}else{const n={id:St(),x:t.x,y:t.y};this.store.activeAnchor=_2(a,n)}}this.hotkeyType=Yt.None,this.render(),a&&this.pushHistory({type:bt.Update,pens:[ht(a,!0)],initPens:i})}checkDisconnect(t,i){if(t.id.indexOf(He)>0){const a=t.id;t=this.store.pens[a.replace(He,"")]}t.anchors.forEach(a=>{if(a.connectTo&&!i.find(s=>s.id===a.connectTo||s.id===a.connectTo+He)){const s=this.store.pens[a.connectTo];if(!s||s.type)return;xs(s,Ia(s,a.anchorId),t,a)}})}translatePens(t=this.store.active,i,a,s){if(!t||!t.length||t.some(o=>{if(o.locked>=Mt.DisableMove)return!0}))return;const r=!s&&ht(t,!0);this.activeRect&&Da(this.activeRect,i,a);const l=this.getAllByPens(t);t.forEach(o=>{var u,c;if(!(o.locked>=Mt.DisableMove)){if(o.type===$t.Line){if(!this.store.options.moveConnectedLine&&!this.canMoveLine||o.isRuleLine)return;yf(o,i,a),this.checkDisconnect(o,l),this.store.path2dMap.set(o,Et.path2dDraws[o.name](o)),s||(this.initLineRect(o),(u=o.connectedLines)==null||u.forEach(f=>{const g=this.store.pens[f.lineId];this.initLineRect(g)}))}else Da(o.calculative.worldRect,i,a),this.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);this.updateLines(o),(c=o.onMove)==null||c.call(o,o)}}),this.activeRect&&this.getSizeCPs(),this.render(),this.tooltip.translate(i,a),s||(this.pushHistory({type:bt.Update,pens:ht(t,!0),initPens:r}),this.initImageCanvas(t),this.initTemplateCanvas(t),this.store.emitter.emit("translatePens",t)),this.store.emitter.emit("translatingPens",t)}templateTranslatePens(t=this.store.active,i,a){if(!t||!t.length)return;const s=this.getAllByPens(t);t.forEach(n=>{var r;if(n.type===$t.Line){if(!this.store.options.moveConnectedLine&&!this.canMoveLine)return;yf(n,i,a),this.checkDisconnect(n,s),this.store.path2dMap.set(n,Et.path2dDraws[n.name](n))}else Da(n.calculative.worldRect,i,a),this.updatePenRect(n,{worldRectIsReady:!0}),n.calculative.x=n.x,n.calculative.y=n.y,n.calculative.initRect&&(n.calculative.initRect.x=n.calculative.x,n.calculative.initRect.y=n.calculative.y,n.calculative.initRect.ex=n.calculative.x+n.calculative.width,n.calculative.initRect.ey=n.calculative.y+n.calculative.height);(r=n.onMove)==null||r.call(n,n)})}calcAutoAnchor(t,i,a,s){const n=le(t),r=Vt(t),l=bs(a,i===n?r:n);!l||(i.x=l.x,i.y=l.y,i.prev=void 0,i.next=void 0,s?s.anchor=l.id:we(a,l,t,i),this[t.lineName]&&this[t.lineName](this.store,t),this.store.path2dMap.set(t,Et.path2dDraws.line(t)),this.initLineRect(t))}restoreNodeAnimate(t){var i,a;if(t.calculative.initRect){if(t.keepAnimateState)for(const s in t)t.calculative[s]!==void 0&&s!=="x"&&s!=="y"&&s!=="width"&&s!=="height"&&s!=="initRect"&&(typeof t[s]!="object"||s==="lineDash")&&(s==="fontSize"||s==="lineWidth"?t[s]=t.calculative[s]/t.calculative.canvas.store.data.scale:t[s]=t.calculative[s]);else{const s=t.calculative.initRect.rotate-t.calculative.rotate;for(const 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.length?s&&rg(t,s,t.calculative.worldRect):t.calculative.rotate=t.rotate;const n=ht(this.store.animateMap.get(t));n&&(n.id=t.id,this.parent.setValue(n,{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,_n(t)),(a=this.store.active)!=null&&a.length&&this.calcActiveRect(),t.calculative.initRect=void 0}}updateLines(t,i){var a;(a=t.children)==null||a.forEach(s=>{const n=this.store.pens[s];n&&this.updateLines(n,i)}),t.connectedLines&&t.connectedLines.forEach((s,n)=>{const r=this.store.pens[s.lineId];if(!r||r.calculative.active)return;const l=Ia(r,s.lineAnchor);if(!l)return;if(!l.connectTo){t.connectedLines.splice(n,1);return}if(r.autoFrom){const g=le(r);g.id===l.id&&this.calcAutoAnchor(r,g,t,s)}if(r.autoTo){const g=Vt(r);g.id===l.id&&this.calcAutoAnchor(r,g,t,s)}const o=Ia(t,s.anchor);if(!o)return;let u=t.rotate;t.flipX&&(u*=-1),t.flipY&&(u*=-1);let c=l.distance*this.store.data.scale*Math.cos((u+o.rotate)/180*Math.PI)||0,f=l.distance*this.store.data.scale*Math.sin((u+o.rotate)/180*Math.PI)||0;if(t.flipX&&(c=-c),t.flipY&&(f=-f),nn(l,o.x-l.x+c,o.y-l.y+f),this.store.options.autoPolyline&&!this.autoPolylineFlag&&r.autoPolyline!==!1&&r.lineName==="polyline"){let g=le(r),v=Vt(r),m=!1;g.id===l.id?(g=l,m=!0):v.id===l.id&&(v=l,m=!0),m&&(r.calculative.worldAnchors=[g,v],r.calculative.activeAnchor=g,this.polyline(this.store,r,v),this.initLineRect(r))}this.store.path2dMap.set(r,Et.path2dDraws[r.name](r)),this.patchFlagsLines.add(r),r.calculative.gradientSmooth&&(r.calculative.gradientAnimatePath=pc(r)),i&&Yr(r)})}calcActiveRect(){const t=this.store.active.filter(i=>(!i.locked||i.locked<Mt.DisableMove)&&i.visible!=!1);if(t.length)t.length===1?(this.activeRect=ht(t[0].calculative.worldRect),this.activeRect.rotate=t[0].calculative.rotate||0,Qt(this.activeRect)):(this.activeRect=hi(t),this.activeRect.rotate=0);else return;this.lastRotate=0,this.getSizeCPs()}rotatePen(t,i,a){t.type?(t.calculative.worldAnchors.forEach(s=>{Gt(s,i,a.center)}),this.initLineRect(t),Ir(t)):(t.calculative.rotate?t.calculative.rotate+=i:t.calculative.rotate=i,Gt(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(s=>{const n=this.store.pens[s];this.rotatePen(n,i,t.calculative.worldRect)}))}nextAnimate(t){if(!t)return;this.store.emitter.emit("animateEnd",t);let i;t.nextAnimate&&(i=this.store.data.pens.filter(a=>a.id===t.nextAnimate||a.tags&&a.tags.indexOf(t.nextAnimate)>-1)),i&&(i.forEach(a=>{var s,n,r,l,o;if(a.calculative.pause){const u=Date.now()-a.calculative.pause;a.calculative.pause=void 0,a.calculative.frameStart+=u,a.calculative.frameEnd+=u}else if(a.name==="video")a.calculative.media.currentTime=0,(s=a.calculative.media)==null||s.play(),(n=a.onStartVideo)==null||n.call(a,a);else if(a.type||((r=a.frames)==null?void 0:r.length)||a.animations&&a.animations.length){if(a.type){if((o=a.animations)!=null&&o.length){const u=ht(a.animations[0]);delete u.name,u.currentAnimation=0,this.parent.setValue({id:a.id,...u},{doEvent:!1,history:!1})}}else{if(!a.frames&&a.animations&&a.animations.length){let u=(l=a.animations)==null?void 0:l.findIndex(g=>g.autoPlay),c=u===-1?0:u;const f=ht(a.animations[c]);delete f.name,f.currentAnimation=c,!a.type&&f.frames&&(f.showDuration=this.parent.calcAnimateDuration(f)),this.parent.setValue({id:a.id,...f},{doEvent:!1,history:!1})}this.store.animateMap.set(a,this.getFrameProps(a))}this.store.animates.add(a)}}),this.animate())}getFrameProps(t){let i={};return t.frames&&t.frames.forEach(a=>{for(let s in a)!["duration","x","y","width","height","rotate"].includes(s)&&!i[s]&&(i[s]=t[s])}),i}animate(){this.animateRendering||requestAnimationFrame(()=>{const t=Date.now();if(t-this.lastAnimateRender<this.store.options.animateInterval){this.store.animates.size>0&&this.animate();return}this.lastAnimateRender=t,this.animateRendering=!0;const i=[];let a=!1;for(const s of this.store.animates)if(!s.calculative.pause){if(s.calculative.active&&!s.type&&!this.movingPens&&(a=!0),!s.type)k2(s,t)?s.calculative.patchFlags&&(Qt(s.calculative.worldRect),this.updatePenRect(s,{worldRectIsReady:!0,playingAnimate:!0})):(requestAnimationFrame(()=>{this.restoreNodeAnimate(s)}),i.push(s),this.nextAnimate(s)),this.updateLines(s,!0);else if(!F2(s,t)){if(s.keepAnimateState){for(const n in s)s.calculative[n]!==void 0&&n!=="length"&&(typeof s[n]!="object"||n==="lineDash")&&(n==="lineWidth"?s[n]=s.calculative[n]/s.calculative.canvas.store.data.scale:s[n]=s.calculative[n]);Ir(s)}else for(const n in s)(typeof s[n]!="object"||n==="lineDash")&&(n==="lineWidth"?s.calculative[n]=s[n]*s.calculative.canvas.store.data.scale:s.calculative[n]=s[n]);i.push(s),this.nextAnimate(s)}this.patchFlags=!0}a&&this.calcActiveRect(),i.forEach(s=>{this.store.animates.delete(s)}),this.render(!1),this.animateRendering=!1,this.animate()})}get clipboardName(){return"meta2d-clipboard"}async copy(t,i=!0){const a=St(),{origin:s,scale:n}=this.store.data;this.store.clipboard=void 0,localStorage.removeItem(this.clipboardName),sessionStorage.setItem("page",a);let r=this.getAllByPens(ht(t||this.store.active,!0));r.forEach(o=>{o.copyIndex=this.store.data.pens.findIndex(u=>u.id===o.id),o.pathId&&(o.path=this.store.data.paths[o.pathId])}),r.sort((o,u)=>o.copyIndex-u.copyIndex);const l={meta2d:!0,pens:r,origin:ht(s),scale:n,page:a,initRect:ht(this.activeRect),offset:10,mousePos:ht(this.mousePos)};if(navigator.clipboard&&!this.store.options.disableClipboard&&!navigator.userAgent.includes("Firefox"))try{await navigator.clipboard.writeText(JSON.stringify(l))}catch{localStorage.setItem(this.clipboardName,JSON.stringify(l))}else localStorage.setItem(this.clipboardName,JSON.stringify(l));i&&this.store.emitter.emit("copy",l.pens)}cut(t){this.copy(t,!1),this.delete(t),this.store.emitter.emit("cut",t)}async paste(){var o,u;let t,i;if(navigator.clipboard&&!this.store.options.disableClipboard&&!navigator.userAgent.includes("Firefox"))try{t=await((o=navigator.clipboard)==null?void 0:o.readText())}catch{t=localStorage.getItem(this.clipboardName)}else t=localStorage.getItem(this.clipboardName);if(t){try{i=JSON.parse(t)}catch(c){console.warn("\u526A\u5207\u677F\u6570\u636E\u4E0D\u662Fjson",c.message);return}if(!i||!i.meta2d)return}else return;if(this.beforeAddPens&&await this.beforeAddPens(i.pens)!=!0)return;let a,s;this.store.clipboard&&(a=this.store.clipboard.offset+10,s=this.store.clipboard.pos),this.store.clipboard=ht(i);const n=sessionStorage.getItem("page"),r=this.store.data.scale;if(this.store.clipboard.mousePos&&(Math.abs(this.store.clipboard.mousePos.x-this.mousePos.x)>100*r||Math.abs(this.store.clipboard.mousePos.y-this.mousePos.y)>100*r)){let c=-this.store.clipboard.initRect.width/this.store.clipboard.scale/10/r,f=-this.store.clipboard.initRect.height/this.store.clipboard.scale/10/r,g=(r-this.store.clipboard.scale)*this.store.clipboard.initRect.width/2+c,v=(r-this.store.clipboard.scale)*this.store.clipboard.initRect.height/2+f;r<this.store.clipboard.scale&&(g=(r-this.store.clipboard.scale)/((this.store.clipboard.scale-r)*100)*this.store.clipboard.initRect.width/2+c,v=(r-this.store.clipboard.scale)/((this.store.clipboard.scale-r)*100)*this.store.clipboard.initRect.height/2+f),this.store.clipboard.pens.length>1&&(g=(r-1)*this.store.clipboard.initRect.width/this.store.clipboard.scale/2,v=(r-1)*this.store.clipboard.initRect.height/this.store.clipboard.scale/2),this.store.clipboard.pos={x:this.mousePos.x-g,y:this.mousePos.y-v},this.store.clipboard.offset=0}else n!==i.page?(this.store.clipboard.pos={x:this.mousePos.x,y:this.mousePos.y},this.store.clipboard.offset=0):this.pasteOffset?(a&&(this.store.clipboard.offset=a),s&&(this.store.clipboard.pos=s)):(this.store.clipboard.offset=0,this.pasteOffset=!0);(u=this.keyOptions)!=null&&u.F||this.store.clipboard.pens.forEach(c=>{delete c.copyIndex});const l=this.store.clipboard.pens.filter(c=>!c.parentId);for(const c of l)this.pastePen(c,void 0);sessionStorage.setItem("page",i.page),this.active(l),this.pushHistory({type:bt.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)}getAllByPens(t){const i=[];for(const a of t)i.push(...ht(Qe(a,this.store),!0));return i.concat(t)}getAllFollowersByPens(t,i=!0){const a=t;for(const s of t){let n=mc(s,this.store);i&&(n=ht(n,!0));for(const r of n)a.find(l=>l.id===r.id)||a.push(r)}return a}setFollowers(t=this.store.active){if(!!t)if(t.length<2)t[0].followers=[];else{let i=t.map(s=>s.id);i.pop();const a=t[t.length-1];a.followers?i.forEach(s=>{a.followers.includes(s)||a.followers.push(s)}):a.followers=i}}changeLineAnchors(t,i,a){if(!!Array.isArray(i.connectedLines))for(let s=0;s<i.connectedLines.length;s++){const{lineId:n}=i.connectedLines[s],r=a.find(l=>l.id===n);if(r){const l=r.anchors[0],o=r.anchors[r.anchors.length-1];l.connectTo===t&&(l.connectTo=i.id),o.connectTo===t&&(o.connectTo=i.id)}else i.connectedLines.splice(s,1),s--}}changeNodeConnectedLine(t,i,a){var l;const s=i.anchors[0],n=i.anchors[i.anchors.length-1],r=[s,n];for(const o of r){const u=o.connectTo;if(u){const c=a.find(f=>f.id===u);c?(l=c.connectedLines)==null||l.forEach(f=>{f.lineId===t&&(f.lineId=i.id,f.lineAnchor=o.id)}):(o.connectTo=void 0,o.prev&&(o.prev.connectTo=void 0),o.next&&(o.next.connectTo=void 0))}}}async delete(t=this.store.active,i=!1,a=!0){if(!t||!t.length||this.beforeRemovePens&&await this.beforeRemovePens(t)!=!0||(i||(t=t.filter(n=>!n.locked)),!t||!t.length))return;const s=[];if(this._del(t,s,i),this.initImageCanvas(s),this.initTemplateCanvas(s),this.inactive(),this.clearHover(),this.render(),a){if(s.length===0)return;this.pushHistory({type:bt.Delete,pens:s})}this.store.emitter.emit("delete",t)}_del(t,i,a){!t||t.forEach(s=>{if(s.type&&(s.lastConnected={}),s.parentId)if(this.getLockedParent(s)){console.warn("\u7236\u8282\u70B9\u9501\u5B9A");return}else{const r=ti(s),l=r.children.indexOf(s.id);r.children.splice(l,1),i&&this.getDelPens(s,i),this.delForce(s)}else{if(!a&&s.locked)return;i&&this.getDelPens(s,i),this.delForce(s)}})}getDelPens(t,i){if(!t)return;if(this.store.data.pens.findIndex(s=>s.id===t.id)>-1){const s=this.store.pens[t.id];s&&s.calculative&&(s.calculative.active=void 0),i.push(s)}t.children&&t.children.forEach(s=>{this.getDelPens(this.store.pens[s],i)})}getLockedParent(t){if(!t.parentId)return!1;const i=ti(t);if(i.locked)return i;this.getLockedParent(i)}delForce(t){var a;if(!t)return;const i=this.store.data.pens.findIndex(s=>s.id===t.id);i>-1&&(this.delConnectedLines(this.store.data.pens[i]),this.store.data.pens.splice(i,1),this.store.pens[t.id]=void 0,delete this.store.pens[t.id],t.pathId&&delete this.store.data.paths[t.pathId]),this.store.animates.delete(t),this.store.animateMap.delete(t),t.children&&t.children.forEach(s=>{this.delForce(this.store.pens[s])}),(a=t.onDestroy)==null||a.call(t,t)}delConnectedLines(t){var i;if(t.connectedLines)for(let a=0;a<t.connectedLines.length;a++){const{lineId:s,lineAnchor:n}=t.connectedLines[a],r=this.store.pens[s];if(r){let l=r.anchors.find(o=>o.id===n);(l==null?void 0:l.connectTo)===t.id&&(l.connectTo=void 0,l.anchorId=void 0,l.prev&&(l.prev.connectTo=void 0),l.next&&(l.next.connectTo=void 0)),l=Ia(r,n),l&&(l.connectTo=void 0,l.anchorId=void 0,l.prev&&(l.prev.connectTo=void 0),l.next&&(l.next.connectTo=void 0))}}!t.type||(i=t.calculative.worldAnchors)==null||i.forEach((a,s)=>{var r;if(!a.connectTo)return;const n=this.store.pens[a.connectTo];n&&((r=n.calculative.worldAnchors)==null||r.forEach(l=>{xs(n,l,t,a)}))})}convertSpecialCharacter(t){var i={lt:"<",gt:">",nbsp:" ",amp:"&",quot:'"'};return t.replace(/&(lt|gt|nbsp|amp|quot);/gi,function(a,s){return i[s]})}createInput(){this.inputParent.classList.add("meta2d-input"),this.inputDiv.classList.add("input-div"),this.inputParent.appendChild(this.inputDiv),this.dropdown.onmouseleave=()=>{this.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.dropdown.onmousedown=this.stopPropagation;let t;for(let i=0;i<document.styleSheets.length;i++)document.styleSheets[i].title==="le5le.com"&&(t=document.styleSheets[i]);if(!t){const i=document.createElement("style");i.title="le5le.com",document.head.appendChild(i),t=i.sheet,t.insertRule(".meta2d-input{display:none;position:absolute;outline:none;align-items: center;}"),t.insertRule(".meta2d-input textarea{resize:none;border:none;outline:none;background:transparent;flex-grow:1;height:100%;left:0;top:0}"),t.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;}"),t.insertRule(".meta2d-input ul{position:absolute;top:100%;margin-top:4px; 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;}"),t.insertRule(".meta2d-input ul li{padding: 5px 12px;line-height: 22px;white-space: nowrap;cursor: pointer;}"),t.insertRule(".meta2d-input ul li:hover{background: #eeeeee;}"),t.insertRule(".input-div::-webkit-scrollbar {display:none}"),t.insertRule(".input-div{scrollbar-width: none;}"),t.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;}"),t.insertRule(".input-div div{}")}this.inputDiv.onfocus=i=>{if(navigator.userAgent.includes("Firefox")){if(!i.target.innerText){let a=this.inputDiv.offsetWidth/2;window.getComputedStyle(this.inputDiv,null).textAlign!=="center"&&(a=0),this.inputDiv.innerHTML=`<br style="margin-left:${a}px;margin-top:4px;" />`}}else if(i.target.innerText)this.inputDiv.style.paddingTop="";else{let a=window.getComputedStyle(this.inputDiv,null);a.justifyContent==="center"&&(this.inputDiv.style.paddingTop=` ${this.inputDiv.offsetHeight/2-parseFloat(a.lineHeight)/2}px`)}},this.inputDiv.onblur=()=>{setTimeout(()=>{this.hideInput()},300)},this.inputDiv.oninput=i=>{const a=this.store.pens[this.inputDiv.dataset.penId];if(a&&a.inputType==="number"){const s=i.target.innerText,n=s.replace(/[^0-9]/g,"");s!==n&&(i.preventDefault(),i.target.innerText=n)}if(navigator.userAgent.includes("Firefox")){if(!i.target.innerText.trim()){let s=this.inputDiv.offsetWidth/2;window.getComputedStyle(this.inputDiv,null).textAlign!=="center"&&(s=0),this.inputDiv.innerHTML=`<br style="margin-left:${s}px;margin-top:4px;" />`}}else if(i.target.innerText)this.inputDiv.style.paddingTop="";else{let s=window.getComputedStyle(this.inputDiv,null);s.justifyContent==="center"&&(this.inputDiv.style.paddingTop=` ${this.inputDiv.offsetHeight/2-parseFloat(s.lineHeight)/2}px`)}this.store.emitter.emit("input",a)},this.inputDiv.onclick=i=>{i.stopPropagation();const a=this.store.pens[this.inputDiv.dataset.penId];this.dropdown.style.display==="block"?this.dropdown.style.display="none":(a==null?void 0:a.dropdownList)&&this.store.data.locked&&(this.dropdown.style.display="block"),this.store.emitter.emit("clickInput",a)},this.inputDiv.onkeyup=i=>{this.setDropdownList(!0);const a=this.store.pens[this.inputDiv.dataset.penId];this.store.emitter.emit("input",{pen:a,text:i.key}),i.stopPropagation()},this.inputDiv.onkeydown=i=>{i.stopPropagation()},this.inputDiv.onmousedown=this.stopPropagation,this.inputDiv.onwheel=i=>{i.stopPropagation()},this.inputDiv.onpaste=i=>{i.preventDefault();let a="";i.clipboardData&&i.clipboardData.getData&&(a=i.clipboardData.getData("text/plain")),document.execCommand("insertHTML",!1,a)}}clearDropdownList(){if(this.dropdown.hasChildNodes())for(let t=0;t<this.dropdown.childNodes.length;t++)this.dropdown.childNodes[t].remove(),--t}dropdownAppendOption(t,i){const 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;const s=this.store.pens[this.inputDiv.dataset.penId];a.onmouseenter=()=>{a.style.background=s.dropdownHoverBackground||this.store.styles.activeBg||"#eee",a.style.color=s.dropdownHoverColor||"#bdc7db"},a.onmouseleave=()=>{a.style.background=s.dropdownBackground||this.store.styles.popContentBg||"#fff",a.style.color=s.dropdownColor||"#bdc7db"},this.dropdown.appendChild(a)}find(t){return this.store.data.pens.filter(i=>i.id==t||i.tags&&i.tags.indexOf(t)>-1)}findOne(t){return this.store.data.pens.find(i=>i.id==t||i.tags&&i.tags.indexOf(t)>-1)}changePenId(t,i){var s,n,r,l,o,u,c;if(t===i)return;const a=this.store.pens[t];if(!!a&&!this.store.pens[i]){if(a.id=i,this.store.pens[i]=this.store.pens[t],(s=a.onChangeId)==null||s.call(a,a,t,i),delete this.store.pens[t],a.parentId){const f=this.store.pens[a.parentId],g=(n=f.children)==null?void 0:n.findIndex(v=>v===t);g!==-1&&((r=f.children)==null||r.splice(g,1,i))}(l=a.children)==null||l.forEach(f=>{const g=this.store.pens[f];g.parentId=i}),a.formId&&a.followers.forEach(f=>{const g=this.store.pens[f];g.formId=i}),a.type===$t.Line?this.changeNodeConnectedLine(t,a,this.store.data.pens):(this.changeLineAnchors(t,a,this.store.data.pens),(o=a.connectedLines)==null||o.forEach(({lineId:f})=>{const g=this.store.pens[f];As(g)})),(u=a.anchors)==null||u.forEach(f=>f.penId=i),(c=a.calculative.worldAnchors)==null||c.forEach(f=>f.penId=i)}}updateValue(t,i){var m,w,y,_,A,x;const a=this.getPenRect(t),s=t.name;Object.assign(t,i);const n=s!==t.name;i.newId&&this.changePenId(t.id,i.newId);let r=!1,l=!1,o=!1,u=!1,c=!1,f=!1,g,v=!1;for(const C in i)C.indexOf(".")===-1?(C==="rotate"?t.disableRotate?t.rotate=t.calculative.rotate||0:g=t.calculative.rotate||0:C==="canvasLayer"||C==="isBottom"||C==="showChild"?f=!0:C==="image"&&(v=!0),(typeof t[C]!="object"||C==="lineDash")&&(!t.disableRotate||C!=="rotate")&&(t.calculative[C]=i[C]),hx.includes(C)&&(l=!0),["name","borderRadius","lineSmooth","close"].includes(C)&&(r=!0),ux.includes(C)&&(c=!0),fx.includes(C)&&(o=!0),dx.includes(C)&&(u=!0),t.image&&t.name!=="gif"&&Md.includes(C)&&(v=!0)):(delete t[C],Vr(t,C,i[C])),C.split(".")[0]==="anchors"&&As(t);if(this.setCalculativeByScale(t),n&&((m=t.onDestroy)==null||m.call(t,t),gx(t)),c){const C={x:(w=i.x)!=null?w:a.x,y:(y=i.y)!=null?y:a.y,width:(_=i.width)!=null?_:a.width,height:(A=i.height)!=null?A:a.height};this.setPenRect(t,C,!1),this.updateLines(t,!0),this.store.active&&this.store.active.length&&t.id===this.store.active[0].id&&this.calcActiveRect()}else o?this.updatePenRect(t):(l&&Fi(t),u&&mf(this.store.pens,t),r&&Et.path2dDraws[t.name]&&this.store.path2dMap.set(t,Et.path2dDraws[t.name](t)));if(g!==void 0){const C=t.calculative.rotate;t.calculative.rotate=g,this.rotatePen(t,C-g,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),f?(this.canvasImage.init(),this.canvasImageBottom.init()):v&&(t.canvasLayer===void 0&&(t.canvasLayer=zt.CanvasImageBottom,t.calculative.canvasLayer=zt.CanvasImageBottom),t.canvasLayer===zt.CanvasImageBottom?this.canvasImageBottom.init():t.canvasLayer===zt.CanvasImage&&this.canvasImage.init()),(i.canvasLayer!==void 0||t.canvasLayer===zt.CanvasTemplate)&&this.initTemplateCanvas([t]),i.zIndex!==void 0&&(x=t.calculative.singleton)!=null&&x.div&&Fe(t,t.calculative.singleton.div)}execPenResize(t){var i,a;(i=t.onResize)==null||i.call(t,t),(a=t.children)==null||a.forEach(s=>{const n=this.store.pens[s];n&&this.execPenResize(n)})}setPenRect(t,i,a=!0){if(t.parentId)Object.assign(t,i);else{const{origin:s,scale:n}=this.store.data;t.x=s.x+i.x*n,t.y=s.y+i.y*n,t.width=i.width*n,t.height=i.height*n}this.updatePenRect(t),this.execPenResize(t),a&&this.render()}getPenRect(t,i=this.store.data.origin,a=this.store.data.scale){if(!!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}}toPng(t=2,i,a=!1,s){const n=hi(this.store.data.pens),r=this.store.data.scale;if(!isFinite(n.width))throw new Error("can not to png, because width is not finite");const l=ht(n),o=this.store.data,u=a&&this.store.bkImg;let c=!1,f=!1;if(u){if(n.x+=o.x,n.y+=o.y,re(n),Xi(n,this.canvasRect,!0))Object.assign(n,this.canvasRect);else{const T=En([...Zi(n),...Zi(this.canvasRect)]);Object.assign(n,T)}c=n.x===0,f=n.y===0}const g=this.store.data.width||this.store.options.width,v=this.store.data.height||this.store.options.height;let m=!1;g&&v&&!this.store.data.component&&(m=!0),m&&(n.x=this.store.data.origin.x,n.y=this.store.data.origin.y,n.width=g*this.store.data.scale,n.height=v*this.store.data.scale);const w=ht(n),y=qi(t);n.x-=y[3]*r,n.y-=y[0]*r,n.width+=(y[3]+y[1])*r,n.height+=(y[0]+y[2])*r;const _=(s||1920)/n.width;n.width*=_,n.height*=_,re(n);const A=document.createElement("canvas");if(A.width=n.width,A.height=n.height,A.width>32767||A.height>32767||!navigator.userAgent.includes("Firefox")&&A.height*A.width>268435456||navigator.userAgent.includes("Firefox")&&A.height*A.width>472907776)throw new Error("can not to png, because the size exceeds the browser limit");const x=A.getContext("2d");x.textBaseline="middle",x.scale(_,_);const C=this.store.options.downloadBgTransparent?void 0:this.store.data.background||this.store.styles.background;if(C&&m&&(x.save(),x.fillStyle=C,x.fillRect(0,0,w.width+(y[1]+y[3])*r,w.height+(y[0]+y[2])*r),x.restore()),u)if(m)x.drawImage(this.store.bkImg,y[3]*r||0,y[0]*r||0,w.width,w.height);else{const T=n.x<0?-n.x:0,I=n.y<0?-n.y:0;x.drawImage(this.store.bkImg,T,I,this.canvasRect.width,this.canvasRect.height)}if(C&&!m)if(u){const T=n.x<0?-n.x:0,I=n.y<0?-n.y:0;x.save(),x.fillStyle=C,x.fillRect(T,I,this.canvasRect.width,this.canvasRect.height),x.restore()}else x.save(),x.fillStyle=C,x.fillRect(0,0,l.width+(y[3]+y[1])*r,l.height+(y[0]+y[2])*r),x.restore();u?m?x.translate(-n.x,-n.y):x.translate((c?o.x:-l.x)+y[3]*r||0,(f?o.y:-l.y)+y[0]*r||0):x.translate(-n.x,-n.y);for(const T of this.store.data.pens){if(!jr(T,this.store)||T.visible==!1)continue;const{active:I}=T.calculative;T.calculative.active=!1,T.calculative.img?$r(x,T):Sa(x,T,!0),T.calculative.active=I}if(i){A.toBlob(i);return}return A.toDataURL()}activeToPng(t=2,i){return this.pensToPng(this.store.active,t,i)}pensToPng(t=this.store.active,i=2,a){if(t.length===0)return;const s=this.getAllByPens(t);let n=s.map(v=>v.id);const r=hi(s);if(!isFinite(r.width))throw new Error("can not to png, because width is not finite");const l=ht(r),o=qi(i);r.x-=o[3],r.y-=o[0],r.width+=o[3]+o[1],r.height+=o[0]+o[2],re(r);const u=(a||r.width)/r.width;r.width*=u,r.height*=u;const c=document.createElement("canvas");if(c.width=r.width,c.height=r.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");const f=c.getContext("2d");f.textBaseline="middle",f.scale(u,u);const g=this.store.options.downloadBgTransparent?void 0:this.store.data.background||this.store.styles.background;g&&(f.save(),f.fillStyle=g,f.fillRect(0,0,l.width+(o[3]+o[1]),l.height+(o[0]+o[2])),f.restore()),f.translate(-l.x+o[3],-l.y+o[0]);for(const v of this.store.data.pens)if(n.includes(v.id)){if(!jr(v,this.store)||v.visible==!1)continue;const{active:m}=v.calculative;v.calculative.active=!1,v.calculative.img?$r(f,v):Sa(f,v),v.calculative.active=m}return c.toDataURL()}toggleAnchorMode(){var t;if(this.hotkeyType)this.hotkeyType===Yt.AddAnchor&&(this.hotkeyType=Yt.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?void 0:t.disableAnchor))return;this.hotkeyType=Yt.AddAnchor,this.store.hover&&(this.externalElements.style.cursor="pointer")}this.patchFlags=!0}addAnchorHand(){if(this.store.activeAnchor&&this.store.active&&this.store.active.length===1&&this.store.active[0].type){const t=[ht(this.store.active[0],!0)];this.store.activeAnchor.prev?this.store.activeAnchor.next||(this.store.activeAnchor.next={...this.store.activeAnchor.prev},Gt(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={...this.store.activeAnchor.next},Gt(this.store.activeAnchor.prev,180,this.store.activeAnchor),this.initLineRect(this.store.active[0]),this.patchFlags=!0),this.pushHistory({type:bt.Update,pens:[ht(this.store.active[0],!0)],initPens:t})}}removeAnchorHand(){if(this.store.activeAnchor&&this.store.active&&this.store.active.length===1&&this.store.active[0].type){const t=[ht(this.store.active[0],!0)];this.hoverType===xt.LineAnchorPrev?(this.store.activeAnchor.prev=void 0,this.initLineRect(this.store.active[0]),this.patchFlags=!0):this.hoverType===xt.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:bt.Update,pens:[ht(this.store.active[0])],initPens:t})}}toggleAnchorHand(){this.store.active.length===1&&this.store.active[0].type&&this.store.activeAnchor&&(this.store.activeAnchor.prevNextType||(this.store.activeAnchor.prevNextType=Na.Mirror),this.store.activeAnchor.prevNextType=(this.store.activeAnchor.prevNextType+1)%3)}gotoView(t,i){let a=hi(this.store.data.pens);if(!isFinite(a.width))throw new Error("can not move view, because width is not finite");const s=this.store.data.width||this.store.options.width,n=this.store.data.height||this.store.options.height;s&&n&&(a={x:this.store.data.origin.x,y:this.store.data.origin.y,width:s*this.store.data.scale,height:n*this.store.data.scale}),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()}showMagnifier(){this.magnifierCanvas.canvas.style.zIndex="100",this.externalElements.style.zIndex="101",this.magnifierCanvas.magnifier=!0,this.magnifierCanvas.updateDomOffscreen(),this.externalElements.style.cursor="default",this.render()}hideMagnifier(){this.magnifierCanvas.canvas.style.zIndex="5",this.externalElements.style.zIndex="5",this.magnifierCanvas.magnifier=!1,this.externalElements.style.cursor="default",this.magnifierCanvas.render(),this.render()}showFit(){this.store.data.locked=0,this.canvasImage.fitFlag=!0,this.canvasImage.activeFit=void 0,this.canvasImage.currentFit=void 0,this.store.data.fits||(this.store.data.fits=[]),this.store.data.fits.forEach(t=>t.active=!1),this.canvasImage.init(),this.canvasImage.render()}hideFit(){this.canvasImage.fitFlag=!1,this.canvasImage.activeFit=void 0,this.canvasImage.currentFit=void 0,this.canvasImage.init(),this.canvasImage.render()}makeFit(){if(this.dragRect.width<100&&this.dragRect.height<100)return;const t=this.store.data.pens.filter(u=>{if(u.parentId||u.isRuleLine)return!1;if(Xi(u.calculative.worldRect,this.dragRect,!0))return u.type===$t.Line&&!this.store.options.dragAllIn?Il(u,this.dragRect):!0});if(!t.length)return;const i=this.parent.getRect(t),a=this.store.data.scale,s=this.store.data.width||this.store.options.width,n=this.store.data.height||this.store.options.height;let r=(Math.floor(i.x)-this.store.data.origin.x)/a/s,l=(Math.floor(i.y)-this.store.data.origin.y)/a/n,o={x:r,y:l,width:(Math.ceil(i.width)+1)/a/s,height:(Math.ceil(i.height)+1)/a/n,children:t.map(u=>u.id),id:St(),active:!0};o.x<-.1&&(o.x=-.1),o.y<-.1&&(o.y=-.1),o.width>.5?(o.left=!0,o.right=!0,o.leftValue=(o.x-0)*a*s,o.rightValue=(1-(o.x+o.width))*a*s):o.x<.5?(o.left=!0,o.leftValue=(o.x-0)*a*s):(o.right=!0,o.rightValue=(1-(o.x+o.width))*a*s),o.leftValue<1&&(o.leftValue=0),o.rightValue<1&&(o.rightValue=0),o.height>.5?(o.top=!0,o.bottom=!0,o.topValue=(o.y-0)*a*n,o.bottomValue=(1-(o.y+o.height))*a*n):o.y<.5?(o.top=!0,o.topValue=(o.y-0)*a*n):(o.bottom=!0,o.bottomValue=(1-(o.y+o.height))*a*n),o.topValue<1&&(o.topValue=0),o.bottomValue<1&&(o.bottomValue=0),this.store.data.fits||(this.store.data.fits=[]),this.store.data.fits.forEach(u=>{u.active=!1}),this.store.data.fits.push(o),this.canvasImage.activeFit=o,this.store.emitter.emit("fit",o),this.canvasImage.init(),this.canvasImage.render()}updateFit(t){const i=this.store.data.scale,a=this.store.data.width||this.store.options.width,s=this.store.data.height||this.store.options.height;let n=(t.x-this.store.data.origin.x)/i/a,r=(t.y-this.store.data.origin.y)/i/s;if(this.canvasImage.currentFit){const l=this.canvasImage.activeFit;if(this.canvasImage.currentFit==="top"){r<-.1&&(r=-.1);let c=r-l.y;if(l.height-=c,l.height<.01){l.height=.01;return}l.y=r}if(this.canvasImage.currentFit==="bottom"&&(r>1.1&&(r=1.1),l.height=r-l.y,l.height<=.01&&(l.height=.01)),this.canvasImage.currentFit==="left"){n<-.1&&(n=-.1);let c=n-l.x;if(l.width-=c,l.width<.01){l.width=.01;return}l.x=n}this.canvasImage.currentFit==="right"&&(n>1.1&&(n=1.1),l.width=n-l.x,l.width<=.01&&(l.width=.01));let o={x:l.x*a*i+this.store.data.origin.x,y:l.y*s*i+this.store.data.origin.y,width:l.width*a*i,height:l.height*s*i};re(o);const u=this.store.data.pens.filter(c=>{if(c.parentId||c.isRuleLine)return!1;if(Xi(c.calculative.worldRect,o,!0))return c.type===$t.Line&&!this.store.options.dragAllIn?Il(c,o):!0});l.left=void 0,l.leftValue=void 0,l.right=void 0,l.rightValue=void 0,l.top=void 0,l.topValue=void 0,l.bottom=void 0,l.bottomValue=void 0,l.width>.5?(l.left=!0,l.right=!0,l.leftValue=(l.x-0)*i*a,l.rightValue=(1-(l.x+l.width))*i*a):l.x<.5?(l.left=!0,l.leftValue=(l.x-0)*i*a):(l.right=!0,l.rightValue=(1-(l.x+l.width))*i*a),Math.abs(l.leftValue)<1&&(l.leftValue=0),Math.abs(l.rightValue)<1&&(l.rightValue=0),l.height>.5?(l.top=!0,l.bottom=!0,l.topValue=(l.y-0)*i*s,l.bottomValue=(1-(l.y+l.height))*i*s):l.y<.5?(l.top=!0,l.topValue=(l.y-0)*i*s):(l.bottom=!0,l.bottomValue=(1-(l.y+l.height))*i*s),Math.abs(l.topValue)<1&&(l.topValue=0),Math.abs(l.bottomValue)<1&&(l.bottomValue=0),l.children=u.map(c=>c.id),this.store.emitter.emit("fit",l),this.mouseDown.x=t.x,this.mouseDown.y=t.y,this.canvasImage.init(),this.canvasImage.render()}}updateFitRect(t=this.canvasImage.activeFit){const i=this.store.data.width||this.store.options.width,a=this.store.data.height||this.store.options.height;t.left&&(t.leftValue?t.x=Math.abs(t.leftValue)<1?t.leftValue:t.leftValue/i:t.x=0),t.right&&(t.rightValue?t.width=1-(Math.abs(t.rightValue)<1?t.rightValue:t.rightValue/i)-t.x:t.width=1-t.x),t.top&&(t.topValue?t.y=Math.abs(t.topValue)<1?t.topValue:t.topValue/a:t.y=0),t.bottom&&(t.bottomValue?t.height=1-(Math.abs(t.bottomValue)<1?t.bottomValue:t.bottomValue/a)-t.y:t.height=1-t.y),this.canvasImage.init(),this.canvasImage.render()}deleteFit(t=this.canvasImage.activeFit){if(!t)return;const i=this.store.data.fits.findIndex(a=>a.id===t.id);this.store.data.fits.splice(i,1),this.canvasImage.activeFit=void 0,this.canvasImage.init(),this.canvasImage.render(),this.store.emitter.emit("fit",void 0)}calcuActiveFit(){var l;const t=this.store.data.width||this.store.options.width,i=this.store.data.height||this.store.options.height;let a=(this.mouseDown.x-this.store.data.origin.x)/this.store.data.scale/t,s=(this.mouseDown.y-this.store.data.origin.y)/this.store.data.scale/i,n=-1,r=-1;(l=this.store.data.fits)==null||l.forEach((o,u)=>{o.ex=null,o.ey=null,Ui({x:a,y:s},o)&&(n=u),o.active&&(r=u)}),n!==-1&&n!==r?(this.canvasImage.activeFit=this.store.data.fits[n],this.store.data.fits[n].active=!0,r!==-1&&(this.store.data.fits[r].active=!1),this.store.emitter.emit("fit",this.store.data.fits[n])):n===-1&&r!==-1&&(this.store.data.fits[r].active=!1,this.store.emitter.emit("fit",void 0),this.canvasImage.activeFit=null),this.inactive(),this.canvasImage.init(),this.canvasImage.render()}toggleMagnifier(){this.magnifierCanvas.magnifier=!this.magnifierCanvas.magnifier,this.magnifierCanvas.magnifier&&(this.externalElements.style.cursor="default"),this.render()}destroy(){var t,i,a,s;switch(this.scroll&&this.scroll.destroy(),(t=this.tooltip)==null||t.destroy(),(i=this.dialog)==null||i.destroy(),(a=this.title)==null||a.destroy(),(s=this.popconfirm)==null||s.destroy(),this.externalElements.removeEventListener("gesturestart",this.onGesturestart),this.externalElements.ondragover=n=>n.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 Ba.Document:document.removeEventListener("keydown",this.onkeydown),document.removeEventListener("keyup",this.onkeyup);break;case Ba.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("message",this.onMessage),window&&window.removeEventListener("resize",this.onResize),window&&window.removeEventListener("scroll",this.onScroll),this.parentElement.innerHTML=""}}function eE(e,t){const i=t||new Path2D;e.onDestroy||(e.onDestroy=aE,e.onMove=Hf,e.onRotate=Hf,e.onMouseEnter=sE,e.onMouseLeave=nE,e.onMouseMove=oE,e.onMouseUp=rE,e.onInput=iE),e.formId=e.id;let a=e.calculative.borderRadius||0,s=a;const{x:n,y:r,width:l,height:o,ex:u,ey:c}=e.calculative.worldRect;e.calculative.worldTextRect,a<1&&(a=l*a,s=o*s);let f=a<s?a:s;if(l<2*f&&(f=l/2),o<2*f&&(f=o/2),i.moveTo(n+f,r),i.arcTo(u,r,u,c,f),i.arcTo(u,c,n,c,f),i.arcTo(n,c,n,r,f),i.arcTo(n,r,u,r,f),i instanceof Path2D)return i}function iE(e,t){e.text=t,e.calculative.text=e.text,e.calculative.canvas.updatePenRect(e)}function aE(e){}function Hf(e){}function sE(e){}function nE(e){const t=e.calculative.canvas.store.active;t&&t.length&&t.forEach(i=>{if(e.followers){let a=e.followers.findIndex(s=>s===i.id);if(a!==-1){const s=e.calculative.canvas.store.pens[i.id+He];s&&s.calculative&&(Xi(s.calculative.worldRect,e.calculative.worldRect,!0)||(e.followers.splice(a,1),delete i.formId))}}})}function rE(e){const t=e.calculative.canvas.store.active;t&&t.length&&t.forEach(i=>{const a=e.calculative.canvas.store.pens[i.id+He];if(a&&a.calculative){let s=ht(e.calculative.worldRect);s.x-=1,s.y-=1,s.width+=2,s.height+=2,Xi(a.calculative.worldRect,s,!0)&&(e.followers||(e.followers=[]),e.followers.includes(i.id)||e.followers.push(i.id),i.formId=e.id)}})}function oE(e,t){}function Wf(e,t){if(e.formId&&e.formKey&&e.formValue){const i=e.calculative.canvas.store.pens[e.formId];i&&(i.formData||(i.formData={}),i.formData[e.formKey]=e[e.formValue])}}function lE(e){const t=e.calculative.canvas.store.pens[e.formId];t.followers.forEach(i=>{const a=e.calculative.canvas.store.pens[i];if(a.formId&&a.formKey&&t.formData[a.formKey]){const s=a[a.formValue];let n="";Array.isArray(s)&&(n=[]),e.calculative.canvas.parent.setValue({id:a.id,[a.formValue]:n},{render:!1,doEvent:!1,history:!1})}}),t.formData={},e.calculative.canvas.parent.render()}const ge={};function cE(e){e.onDestroy||(e.onDestroy=hE,e.onMove=Uf,e.onResize=uE,e.onRotate=Uf,e.onValue=fE,e.onChangeId=dE);const t=new Path2D;if(!e.image)return;const a=e.calculative.canvas.store.id+"-"+e.id;if(!ge[a]){const s=new Image;s.crossOrigin="anonymous",s.src=e.image,e.calculative.canvas.parent.store.options.cdn&&!(e.image.startsWith("http")||e.image.startsWith("//")||e.image.startsWith("data:image"))&&(s.src=e.calculative.canvas.parent.store.options.cdn+e.image),ge[a]=s,s.onload=()=>{var n;ge[a]===s&&(e.calculative.img=s,e.calculative.imgNaturalWidth=s.naturalWidth||e.iconWidth,e.calculative.imgNaturalHeight=s.naturalHeight||e.iconHeight,(n=e.calculative.canvas.externalElements)==null||n.parentElement.appendChild(s),mn(e,s))}}return e.calculative.patchFlags&&ge[a]&&mn(e,ge[a]),t}function hE(e){const i=e.calculative.canvas.store.id+"-"+e.id;ge[i]&&(ge[i].remove(),ge[i]=void 0)}function Uf(e){const i=e.calculative.canvas.store.id+"-"+e.id;!ge[i]||mn(e,ge[i])}function uE(e){const i=e.calculative.canvas.store.id+"-"+e.id;!ge[i]||mn(e,ge[i])}function fE(e){const i=e.calculative.canvas.store.id+"-"+e.id;!ge[i]||(mn(e,ge[i]),ge[i].getAttribute("src")!==e.image&&(ge[i].src=e.image))}function dE(e,t,i){const a=e.calculative.canvas.store.id;!ge[a+"-"+t]||(ge[a+"-"+i]=ge[a+"-"+t],delete ge[a+"-"+t])}function mn(e,t){t.style.objectFit=e.imageRatio?"contain":"fill",Fe(e,t)}function gE(e,t){return e.onResize||(e.onResize=xg,e.onValue=vE),Oa(e,t)}function xg(e){const t=e.anchors.filter(i=>i.flag!==1);_g(e),e.anchors=e.anchors.concat(...t)}function vE(e){xg(e),As(e)}function _g(e){const t=[],{x:i,y:a,width:s,height:n}=e,r=mE(e),l=5;for(let f=0;f<l;f++){if(f===2)continue;let g=i+s*(f+1)/(l+1),v=a;g<i+r?v=Ar(i+r,v+r,g,r,-1):g>i+s-r&&(v=Ar(i+s-r,v+r,g,r,-1)),t.push({id:String(t.length),flag:1,penId:e.id,x:(g-i)/s,y:(v-a)/n})}const o=3;for(let f=0;f<o;f++){let g=a+n*(f+1)/(o+1),v=i+s;g<a+r?v=Er(v-r,a+r,g,r):g>a+n-r&&(v=Er(v-r,a+n-r,g,r)),t.push({id:String(t.length),flag:1,penId:e.id,x:(v-i)/s,y:(g-a)/n})}const u=5;for(let f=0;f<u;f++){if(f===2)continue;let g=i+s*(f+1)/(u+1),v=a+n;g<i+r?v=Ar(i+r,v-r,g,r):g>i+s-r&&(v=Ar(i+s-r,v-r,g,r)),t.push({id:String(t.length),flag:1,penId:e.id,x:(g-i)/s,y:(v-a)/n})}const c=3;for(let f=0;f<c;f++){let g=a+n*(f+1)/(c+1),v=i;g<a+r?v=Er(v+r,a+r,g,r,-1):g>a+n-r&&(v=Er(v+r,a+n-r,g,r,-1)),t.push({id:String(t.length),flag:1,penId:e.id,x:(v-i)/s,y:(g-a)/n})}e.anchors=t}function mE(e){let t=e.calculative.borderRadius||0,i=e.calculative.borderRadius||0;const{width:a,height:s}=e;e.calculative.borderRadius<1&&(t=a*e.calculative.borderRadius,i=s*e.calculative.borderRadius);let n=t<i?t:i;return a<2*n&&(n=a/2),s<2*n&&(n=s/2),n}function Er(e,t,i,a,s=1){return s*Math.sqrt(a**2-(i-t)**2)+e}function Ar(e,t,i,a,s=1){return s*Math.sqrt(a**2-(i-e)**2)+t}function yE(e,t){const i=t||new Path2D,{x:a,y:s,width:n,height:r}=e.calculative.worldRect;if(i.moveTo(a,s+r),i.lineTo(a+n,s+r),i.closePath(),i instanceof Path2D)return i}function pE(e){const t=[{x:0,y:1},{x:1,y:1}];e.anchors=t.map(({x:i,y:a},s)=>({id:s+"",x:i,y:a,penId:e.id}))}function wE(){return{rectangle:Oa,square:lx,circle:cx,svgPath:s_,diamond:n_,triangle:r_,pentagon:l_,pentagram:h_,hexagon:f_,leftArrow:d_,rightArrow:g_,twowayArrow:v_,message:m_,cloud:y_,file:p_,people:b_,line:A_,iframe:W_,video:q_,gif:cE,mindNode:gE,mindLine:yE,mindNode2:Oa,form:eE,combine:Oa}}function bE(){return{triangle:o_,pentagon:c_,pentagram:hg,mindNode:_g,mindLine:pE}}var he;(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",e[e.Message=18]="Message"})(he||(he={}));class xE{constructor(t){W(this,"parent");W(this,"box");W(this,"boxWidth",320);W(this,"boxHeight",180);W(this,"ratio",this.boxWidth/this.boxHeight);W(this,"padding",5);W(this,"img");W(this,"isShow");W(this,"isDown");W(this,"view");W(this,"timer");W(this,"onMouseDown",t=>{t.preventDefault(),t.stopPropagation(),this.isDown=!0});W(this,"onMouseMove",t=>{if(t.preventDefault(),t.stopPropagation(),this.isDown)try{this.parent.gotoView(t.offsetX/this.box.clientWidth,t.offsetY/this.box.clientHeight)}catch(i){console.warn(i.message),this.isDown=!1}});W(this,"onMouseUp",t=>{t.preventDefault(),t.stopPropagation();try{this.parent.gotoView(t.offsetX/this.box.clientWidth,t.offsetY/this.box.clientHeight)}catch(i){console.warn(i.message)}finally{this.isDown=!1}});W(this,"onWheel",t=>{let i=.015;if(this.parent.store.options.scaleOff)i=this.parent.store.options.scaleOff,t.deltaY>0&&(i=-this.parent.store.options.scaleOff);else if(/mac os /i.test(navigator.userAgent))t.ctrlKey?t.deltaY>0&&(i*=-1):i*=t.wheelDeltaY/240;else{let o=.2;t.deltaY.toString().indexOf(".")!==-1&&(o=.01),t.deltaY>0?i=-o:i=o}let{offsetX:a,offsetY:s}=t;const n=this.parent.store.data.width||this.parent.store.options.width,r=this.parent.store.data.height||this.parent.store.options.height;if(n&&r)a=a/this.boxWidth*n*this.parent.store.data.scale+this.parent.store.data.origin.x+this.parent.store.data.x,s=s/this.boxHeight*r*this.parent.store.data.scale+this.parent.store.data.origin.y+this.parent.store.data.y;else{const l=this.parent.parent.getRect();a=a/this.boxWidth*l.width+l.x+this.parent.store.data.x,s=s/this.boxHeight*l.height+l.y+this.parent.store.data.y}this.parent.scale(this.parent.store.data.scale+i,{x:a,y:s})});var a;this.parent=t,this.box=document.createElement("div"),this.img=new Image,this.view=document.createElement("div"),this.box.appendChild(this.img),this.box.appendChild(this.view),(a=this.parent.externalElements)==null||a.parentElement.appendChild(this.box),this.box.className="meta2d-map",this.box.onmousedown=this.onMouseDown,this.box.onmousemove=this.onMouseMove,this.box.onmouseup=this.onMouseUp,this.box.onwheel=this.onWheel;let i;for(let s=0;s<document.styleSheets.length;s++)document.styleSheets[s].title==="le5le/map"&&(i=document.styleSheets[s]);if(!i){let s=document.createElement("style");s.type="text/css",s.title="le5le.com/map",document.head.appendChild(s),s=document.createElement("style"),s.type="text/css",document.head.appendChild(s),i=s.sheet,i.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;}`),i.insertRule(".meta2d-map img{max-width:100%;max-height:100%;pointer-events: none;}"),i.insertRule(".meta2d-map div{pointer-events: none;border:1px solid #1890ff;position:absolute}")}}show(){this.box.style.display="flex",this.parent.store.data.pens.length?(this.img.style.display="block",this.img.src=this.parent.toPng(0,void 0,!0),this.setView()):this.img.style.display="none",this.isShow=!0}hide(){this.box.style.display="none",this.isShow=!1}setView(){const t=this.parent.store.data;if(t.pens.length){let i=hi(t.pens);const a=this.parent.store.data.width||this.parent.store.options.width,s=this.parent.store.data.height||this.parent.store.options.height;if(a&&s?i={x:this.parent.store.data.origin.x,y:this.parent.store.data.origin.y,width:a*this.parent.store.data.scale,height:s*this.parent.store.data.scale}:(clearTimeout(this.timer),this.timer=setTimeout(()=>{this.parent.store.bkImg&&(this.img.src=this.parent.toPng(0,void 0,!0))},300)),Da(i,t.x,t.y),i.width/i.height>this.ratio){const f=i.width/this.ratio;i.y-=(f-i.height)/2,i.height=f,re(i)}else{const f=i.height*this.ratio;i.x-=(f-i.width)/2,i.width=f,re(i)}const r=this.parent.canvasRect;let l=0,o=0;if(i.x<0)l=-i.x/i.width;else if(i.x+i.width>r.width){let f=0;r.width>i.width&&(f=r.width-i.width),l=(-i.x+f)/i.width}if(i.y<0)o=-i.y/i.height;else if(i.y+i.height>r.height){let f=0;r.height>i.height&&(f=r.height-i.height),o=(-i.y+f)/i.height}const u=r.width>i.width?1:r.width/i.width,c=r.height>i.height?1:r.height/i.height;this.view.style.left=this.padding+l*this.boxWidth+"px",this.view.style.width=u*this.boxWidth+"px",this.view.style.top=this.padding+o*this.boxHeight+"px",this.view.style.height=c*this.boxHeight+"px"}}}function kr(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 en={exports:{}};(function(e,t){(function(i){e.exports=i()})(function(){return function(){return function i(a,s,n){function r(u,c){if(!s[u]){if(!a[u]){var f=typeof kr=="function"&&kr;if(!c&&f)return f(u,!0);if(l)return l(u,!0);var g=new Error("Cannot find module '"+u+"'");throw g.code="MODULE_NOT_FOUND",g}var v=s[u]={exports:{}};a[u][0].call(v.exports,function(m){return r(a[u][1][m]||m)},v,v.exports,i,a,s,n)}return s[u].exports}for(var l=typeof kr=="function"&&kr,o=0;o<n.length;o++)r(n[o]);return r}}()({1:[function(i,a,s){(function(n,r){(function(){const l=i("events").EventEmitter,o=i("./store"),u=i("./topic-alias-recv"),c=i("./topic-alias-send"),f=i("mqtt-packet"),g=i("./default-message-id-provider"),v=i("readable-stream").Writable,m=i("inherits"),w=i("reinterval"),y=i("rfdc/default"),_=i("./validations"),A=i("xtend"),x=i("debug")("mqttjs:client"),C=n?n.nextTick:function(P){setTimeout(P,0)},T=r.setImmediate||function(P){C(P)},I={keepalive:60,reschedulePings:!0,protocolId:"MQTT",protocolVersion:4,reconnectPeriod:1e3,connectTimeout:3e4,clean:!0,resubscribe:!0},D={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 B(P,M){let Y;M.properties&&(Y=M.properties.topicAlias);let Z=M.topic.toString();if(Z.length===0){if(Y===void 0)return new Error("Unregistered Topic Alias");if((Z=P.topicAliasSend.getTopicByAlias(Y))===void 0)return new Error("Unregistered Topic Alias");M.topic=Z}Y&&delete M.properties.topicAlias}function V(P,M,Y){x("sendPacket :: packet: %O",M),x("sendPacket :: emitting `packetsend`"),P.emit("packetsend",M),x("sendPacket :: writing to stream");const Z=f.writeToStream(M,P.stream,P.options);x("sendPacket :: writeToStream result %s",Z),!Z&&Y&&Y!==F?(x("sendPacket :: handle events on `drain` once through callback."),P.stream.once("drain",Y)):Y&&(x("sendPacket :: invoking cb"),Y())}function Q(P,M,Y,Z){x("storeAndSend :: store packet with cmd %s to outgoingStore",M.cmd);let nt,j=M;if(j.cmd==="publish"&&(j=y(M),nt=B(P,j)))return Y&&Y(nt);P.outgoingStore.put(j,function(H){if(H)return Y&&Y(H);Z(),V(P,M,Y)})}function F(P){x("nop ::",P)}function R(P,M){let Y;const Z=this;if(!(this instanceof R))return new R(P,M);for(Y in this.options=M||{},I)this.options[Y]===void 0?this.options[Y]=I[Y]:this.options[Y]=M[Y];x("MqttClient :: options.protocol",M.protocol),x("MqttClient :: options.protocolVersion",M.protocolVersion),x("MqttClient :: options.username",M.username),x("MqttClient :: options.keepalive",M.keepalive),x("MqttClient :: options.reconnectPeriod",M.reconnectPeriod),x("MqttClient :: options.rejectUnauthorized",M.rejectUnauthorized),x("MqttClient :: options.topicAliasMaximum",M.topicAliasMaximum),this.options.clientId=typeof M.clientId=="string"?M.clientId:"mqttjs_"+Math.random().toString(16).substr(2,8),x("MqttClient :: clientId",this.options.clientId),this.options.customHandleAcks=M.protocolVersion===5&&M.customHandleAcks?M.customHandleAcks:function(){arguments[3](0)},this.streamBuilder=P,this.messageIdProvider=this.options.messageIdProvider===void 0?new g:this.options.messageIdProvider,this.outgoingStore=M.outgoingStore||new o,this.incomingStore=M.incomingStore||new o,this.queueQoSZero=M.queueQoSZero===void 0||M.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,M.topicAliasMaximum>0&&(M.topicAliasMaximum>65535?x("MqttClient :: options.topicAliasMaximum is out of range"):this.topicAliasRecv=new u(M.topicAliasMaximum)),this.on("connect",function(){const nt=this.queue;x("connect :: sending queued packets"),function j(){const H=nt.shift();x("deliver :: entry %o",H);let $=null;if(!H)return void Z._resubscribe();$=H.packet,x("deliver :: call _sendPacket for %o",$);let K=!0;$.messageId&&$.messageId!==0&&(Z.messageIdProvider.register($.messageId)||(K=!1)),K?Z._sendPacket($,function(U){H.cb&&H.cb(U),j()}):(x("messageId: %d has already used. The message is skipped and removed.",$.messageId),j())}()}),this.on("close",function(){x("close :: connected set to `false`"),this.connected=!1,x("close :: clearing connackTimer"),clearTimeout(this.connackTimer),x("close :: clearing ping timer"),Z.pingTimer!==null&&(Z.pingTimer.clear(),Z.pingTimer=null),this.topicAliasRecv&&this.topicAliasRecv.clear(),x("close :: calling _setupReconnect"),this._setupReconnect()}),l.call(this),x("MqttClient :: setting up stream"),this._setupStream()}m(R,l),R.prototype._setupStream=function(){const P=this,M=new v,Y=f.parser(this.options);let Z=null;const nt=[];function j(){if(nt.length)C(H);else{const K=Z;Z=null,K()}}function H(){x("work :: getting next packet in queue");const K=nt.shift();if(K)x("work :: packet pulled from queue"),P._handlePacket(K,j);else{x("work :: no packets in queue");const U=Z;Z=null,x("work :: done flag is %s",!!U),U&&U()}}x("_setupStream :: calling method to clear reconnect"),this._clearReconnect(),x("_setupStream :: using streamBuilder provided to client to create stream"),this.stream=this.streamBuilder(this),Y.on("packet",function(K){x("parser :: on packet push to packets array."),nt.push(K)}),M._write=function(K,U,tt){Z=tt,x("writable stream :: parsing buffer"),Y.parse(K),H()},x("_setupStream :: pipe stream to writable stream"),this.stream.pipe(M),this.stream.on("error",function(K){x("streamErrorHandler :: error",K.message),K.code?(x("streamErrorHandler :: emitting error"),P.emit("error",K)):F(K)}),this.stream.on("close",function(){var K;x("(%s)stream :: on close",P.options.clientId),(K=P.outgoing)&&(x("flushVolatile :: deleting volatile messages from the queue and setting their callbacks as error function"),Object.keys(K).forEach(function(U){K[U].volatile&&typeof K[U].cb=="function"&&(K[U].cb(new Error("Connection closed")),delete K[U])})),x("stream: emit close to MqttClient"),P.emit("close")}),x("_setupStream: sending packet `connect`");const $=Object.create(this.options);if($.cmd="connect",this.topicAliasRecv&&($.properties||($.properties={}),this.topicAliasRecv&&($.properties.topicAliasMaximum=this.topicAliasRecv.max)),V(this,$),Y.on("error",this.emit.bind(this,"error")),this.options.properties){if(!this.options.properties.authenticationMethod&&this.options.properties.authenticationData)return P.end(()=>this.emit("error",new Error("Packet has no Authentication Method"))),this;this.options.properties.authenticationMethod&&this.options.authPacket&&typeof this.options.authPacket=="object"&&V(this,A({cmd:"auth",reasonCode:0},this.options.authPacket))}this.stream.setMaxListeners(1e3),clearTimeout(this.connackTimer),this.connackTimer=setTimeout(function(){x("!!connectTimeout hit!! Calling _cleanUp with force `true`"),P._cleanUp(!0)},this.options.connectTimeout)},R.prototype._handlePacket=function(P,M){const Y=this.options;if(Y.protocolVersion===5&&Y.properties&&Y.properties.maximumPacketSize&&Y.properties.maximumPacketSize<P.length)return this.emit("error",new Error("exceeding packets size "+P.cmd)),this.end({reasonCode:149,properties:{reasonString:"Maximum packet size was exceeded"}}),this;switch(x("_handlePacket :: emitting packetreceive"),this.emit("packetreceive",P),P.cmd){case"publish":this._handlePublish(P,M);break;case"puback":case"pubrec":case"pubcomp":case"suback":case"unsuback":this._handleAck(P),M();break;case"pubrel":this._handlePubrel(P,M);break;case"connack":this._handleConnack(P),M();break;case"auth":this._handleAuth(P),M();break;case"pingresp":this._handlePingresp(P),M();break;case"disconnect":this._handleDisconnect(P),M()}},R.prototype._checkDisconnecting=function(P){return this.disconnecting&&(P&&P!==F?P(new Error("client disconnecting")):this.emit("error",new Error("client disconnecting"))),this.disconnecting},R.prototype.publish=function(P,M,Y,Z){x("publish :: message `%s` to topic `%s`",M,P);const nt=this.options;if(typeof Y=="function"&&(Z=Y,Y=null),Y=A({qos:0,retain:!1,dup:!1},Y),this._checkDisconnecting(Z))return this;const j=this,H=function(){let $=0;if((Y.qos===1||Y.qos===2)&&($=j._nextId())===null)return x("No messageId left"),!1;const K={cmd:"publish",topic:P,payload:M,qos:Y.qos,retain:Y.retain,messageId:$,dup:Y.dup};switch(nt.protocolVersion===5&&(K.properties=Y.properties),x("publish :: qos",Y.qos),Y.qos){case 1:case 2:j.outgoing[K.messageId]={volatile:!1,cb:Z||F},x("MqttClient:publish: packet cmd: %s",K.cmd),j._sendPacket(K,void 0,Y.cbStorePut);break;default:x("MqttClient:publish: packet cmd: %s",K.cmd),j._sendPacket(K,Z,Y.cbStorePut)}return!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!H())&&this._storeProcessingQueue.push({invoke:H,cbStorePut:Y.cbStorePut,callback:Z}),this},R.prototype.subscribe=function(){const P=this,M=new Array(arguments.length);for(let at=0;at<arguments.length;at++)M[at]=arguments[at];const Y=[];let Z=M.shift();const nt=Z.resubscribe;let j=M.pop()||F,H=M.pop();const $=this.options.protocolVersion;delete Z.resubscribe,typeof Z=="string"&&(Z=[Z]),typeof j!="function"&&(H=j,j=F);const K=_.validateTopics(Z);if(K!==null)return T(j,new Error("Invalid topic "+K)),this;if(this._checkDisconnecting(j))return x("subscribe: discconecting true"),this;const U={qos:0};if($===5&&(U.nl=!1,U.rap=!1,U.rh=0),H=A(U,H),Array.isArray(Z)?Z.forEach(function(at){if(x("subscribe: array topic %s",at),!Object.prototype.hasOwnProperty.call(P._resubscribeTopics,at)||P._resubscribeTopics[at].qos<H.qos||nt){const et={topic:at,qos:H.qos};$===5&&(et.nl=H.nl,et.rap=H.rap,et.rh=H.rh,et.properties=H.properties),x("subscribe: pushing topic `%s` and qos `%s` to subs list",et.topic,et.qos),Y.push(et)}}):Object.keys(Z).forEach(function(at){if(x("subscribe: object topic %s",at),!Object.prototype.hasOwnProperty.call(P._resubscribeTopics,at)||P._resubscribeTopics[at].qos<Z[at].qos||nt){const et={topic:at,qos:Z[at].qos};$===5&&(et.nl=Z[at].nl,et.rap=Z[at].rap,et.rh=Z[at].rh,et.properties=H.properties),x("subscribe: pushing `%s` to subs list",et),Y.push(et)}}),!Y.length)return j(null,[]),this;const tt=function(){const at=P._nextId();if(at===null)return x("No messageId left"),!1;const et={cmd:"subscribe",subscriptions:Y,qos:1,retain:!1,dup:!1,messageId:at};if(H.properties&&(et.properties=H.properties),P.options.resubscribe){x("subscribe :: resubscribe true");const ut=[];Y.forEach(function(ct){if(P.options.reconnectPeriod>0){const ot={qos:ct.qos};$===5&&(ot.nl=ct.nl||!1,ot.rap=ct.rap||!1,ot.rh=ct.rh||0,ot.properties=ct.properties),P._resubscribeTopics[ct.topic]=ot,ut.push(ct.topic)}}),P.messageIdToTopic[et.messageId]=ut}return P.outgoing[et.messageId]={volatile:!0,cb:function(ut,ct){if(!ut){const ot=ct.granted;for(let b=0;b<ot.length;b+=1)Y[b].qos=ot[b]}j(ut,Y)}},x("subscribe :: call _sendPacket"),P._sendPacket(et),!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!tt())&&this._storeProcessingQueue.push({invoke:tt,callback:j}),this},R.prototype.unsubscribe=function(){const P=this,M=new Array(arguments.length);for(let $=0;$<arguments.length;$++)M[$]=arguments[$];let Y=M.shift(),Z=M.pop()||F,nt=M.pop();typeof Y=="string"&&(Y=[Y]),typeof Z!="function"&&(nt=Z,Z=F);const j=_.validateTopics(Y);if(j!==null)return T(Z,new Error("Invalid topic "+j)),this;if(P._checkDisconnecting(Z))return this;const H=function(){const $=P._nextId();if($===null)return x("No messageId left"),!1;const K={cmd:"unsubscribe",qos:1,messageId:$};return typeof Y=="string"?K.unsubscriptions=[Y]:Array.isArray(Y)&&(K.unsubscriptions=Y),P.options.resubscribe&&K.unsubscriptions.forEach(function(U){delete P._resubscribeTopics[U]}),typeof nt=="object"&&nt.properties&&(K.properties=nt.properties),P.outgoing[K.messageId]={volatile:!0,cb:Z},x("unsubscribe: call _sendPacket"),P._sendPacket(K),!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!H())&&this._storeProcessingQueue.push({invoke:H,callback:Z}),this},R.prototype.end=function(P,M,Y){const Z=this;function nt(){x("end :: (%s) :: finish :: calling _cleanUp with force %s",Z.options.clientId,P),Z._cleanUp(P,()=>{x("end :: finish :: calling process.nextTick on closeStores"),C(function(){x("end :: closeStores: closing incoming and outgoing stores"),Z.disconnected=!0,Z.incomingStore.close(function(j){Z.outgoingStore.close(function(H){if(x("end :: closeStores: emitting end"),Z.emit("end"),Y){const $=j||H;x("end :: closeStores: invoking callback with args"),Y($)}})}),Z._deferredReconnect&&Z._deferredReconnect()}.bind(Z))},M)}return x("end :: (%s)",this.options.clientId),P!=null&&typeof P=="boolean"||(Y=M||F,M=P,P=!1,typeof M!="object"&&(Y=M,M=null,typeof Y!="function"&&(Y=F))),typeof M!="object"&&(Y=M,M=null),x("end :: cb? %s",!!Y),Y=Y||F,this.disconnecting?(Y(),this):(this._clearReconnect(),this.disconnecting=!0,!P&&Object.keys(this.outgoing).length>0?(x("end :: (%s) :: calling finish in 10ms once outgoing is empty",Z.options.clientId),this.once("outgoingEmpty",setTimeout.bind(null,nt,10))):(x("end :: (%s) :: immediately calling finish",Z.options.clientId),nt()),this)},R.prototype.removeOutgoingMessage=function(P){const M=this.outgoing[P]?this.outgoing[P].cb:null;return delete this.outgoing[P],this.outgoingStore.del({messageId:P},function(){M(new Error("Message removed"))}),this},R.prototype.reconnect=function(P){x("client reconnect");const M=this,Y=function(){P?(M.options.incomingStore=P.incomingStore,M.options.outgoingStore=P.outgoingStore):(M.options.incomingStore=null,M.options.outgoingStore=null),M.incomingStore=M.options.incomingStore||new o,M.outgoingStore=M.options.outgoingStore||new o,M.disconnecting=!1,M.disconnected=!1,M._deferredReconnect=null,M._reconnect()};return this.disconnecting&&!this.disconnected?this._deferredReconnect=Y:Y(),this},R.prototype._reconnect=function(){x("_reconnect: emitting reconnect to client"),this.emit("reconnect"),this.connected?(this.end(()=>{this._setupStream()}),x("client already connected. disconnecting first.")):(x("_reconnect: calling _setupStream"),this._setupStream())},R.prototype._setupReconnect=function(){const P=this;!P.disconnecting&&!P.reconnectTimer&&P.options.reconnectPeriod>0?(this.reconnecting||(x("_setupReconnect :: emit `offline` state"),this.emit("offline"),x("_setupReconnect :: set `reconnecting` to `true`"),this.reconnecting=!0),x("_setupReconnect :: setting reconnectTimer for %d ms",P.options.reconnectPeriod),P.reconnectTimer=setInterval(function(){x("reconnectTimer :: reconnect triggered!"),P._reconnect()},P.options.reconnectPeriod)):x("_setupReconnect :: doing nothing...")},R.prototype._clearReconnect=function(){x("_clearReconnect : clearing reconnect timer"),this.reconnectTimer&&(clearInterval(this.reconnectTimer),this.reconnectTimer=null)},R.prototype._cleanUp=function(P,M){const Y=arguments[2];if(M&&(x("_cleanUp :: done callback provided for on stream close"),this.stream.on("close",M)),x("_cleanUp :: forced? %s",P),P)this.options.reconnectPeriod===0&&this.options.clean&&(Z=this.outgoing)&&(x("flush: queue exists? %b",!!Z),Object.keys(Z).forEach(function(nt){typeof Z[nt].cb=="function"&&(Z[nt].cb(new Error("Connection closed")),delete Z[nt])})),x("_cleanUp :: (%s) :: destroying stream",this.options.clientId),this.stream.destroy();else{const nt=A({cmd:"disconnect"},Y);x("_cleanUp :: (%s) :: call _sendPacket with disconnect packet",this.options.clientId),this._sendPacket(nt,T.bind(null,this.stream.end.bind(this.stream)))}var Z;this.disconnecting||(x("_cleanUp :: client not disconnecting. Clearing and resetting reconnect."),this._clearReconnect(),this._setupReconnect()),this.pingTimer!==null&&(x("_cleanUp :: clearing pingTimer"),this.pingTimer.clear(),this.pingTimer=null),M&&!this.connected&&(x("_cleanUp :: (%s) :: removing stream `done` callback `close` listener",this.options.clientId),this.stream.removeListener("close",M),M())},R.prototype._sendPacket=function(P,M,Y){x("_sendPacket :: (%s) :: start",this.options.clientId),Y=Y||F,M=M||F;const Z=function(nt,j){if(nt.options.protocolVersion===5&&j.cmd==="publish"){let H;j.properties&&(H=j.properties.topicAlias);const $=j.topic.toString();if(nt.topicAliasSend)if(H){if($.length!==0&&(x("applyTopicAlias :: register topic: %s - alias: %d",$,H),!nt.topicAliasSend.put($,H)))return x("applyTopicAlias :: error out of range. topic: %s - alias: %d",$,H),new Error("Sending Topic Alias out of range")}else $.length!==0&&(nt.options.autoAssignTopicAlias?(H=nt.topicAliasSend.getAliasByTopic($))?(j.topic="",j.properties={...j.properties,topicAlias:H},x("applyTopicAlias :: auto assign(use) topic: %s - alias: %d",$,H)):(H=nt.topicAliasSend.getLruAlias(),nt.topicAliasSend.put($,H),j.properties={...j.properties,topicAlias:H},x("applyTopicAlias :: auto assign topic: %s - alias: %d",$,H)):nt.options.autoUseTopicAlias&&(H=nt.topicAliasSend.getAliasByTopic($))&&(j.topic="",j.properties={...j.properties,topicAlias:H},x("applyTopicAlias :: auto use topic: %s - alias: %d",$,H)));else if(H)return x("applyTopicAlias :: error out of range. topic: %s - alias: %d",$,H),new Error("Sending Topic Alias out of range")}}(this,P);if(Z)M(Z);else{if(!this.connected)return P.cmd==="auth"?(this._shiftPingInterval(),void V(this,P,M)):(x("_sendPacket :: client not connected. Storing packet offline."),void this._storePacket(P,M,Y));switch(this._shiftPingInterval(),P.cmd){case"publish":break;case"pubrel":return void Q(this,P,M,Y);default:return void V(this,P,M)}switch(P.qos){case 2:case 1:Q(this,P,M,Y);break;case 0:default:V(this,P,M)}x("_sendPacket :: (%s) :: end",this.options.clientId)}},R.prototype._storePacket=function(P,M,Y){x("_storePacket :: packet: %o",P),x("_storePacket :: cb? %s",!!M),Y=Y||F;let Z=P;if(Z.cmd==="publish"){const nt=B(this,Z=y(P));if(nt)return M&&M(nt)}(Z.qos||0)===0&&this.queueQoSZero||Z.cmd!=="publish"?this.queue.push({packet:Z,cb:M}):Z.qos>0?(M=this.outgoing[Z.messageId]?this.outgoing[Z.messageId].cb:null,this.outgoingStore.put(Z,function(nt){if(nt)return M&&M(nt);Y()})):M&&M(new Error("No connection to broker"))},R.prototype._setupPingTimer=function(){x("_setupPingTimer :: keepalive %d (seconds)",this.options.keepalive);const P=this;!this.pingTimer&&this.options.keepalive&&(this.pingResp=!0,this.pingTimer=w(function(){P._checkPing()},1e3*this.options.keepalive))},R.prototype._shiftPingInterval=function(){this.pingTimer&&this.options.keepalive&&this.options.reschedulePings&&this.pingTimer.reschedule(1e3*this.options.keepalive)},R.prototype._checkPing=function(){x("_checkPing :: checking ping..."),this.pingResp?(x("_checkPing :: ping response received. Clearing flag and sending `pingreq`"),this.pingResp=!1,this._sendPacket({cmd:"pingreq"})):(x("_checkPing :: calling _cleanUp with force true"),this._cleanUp(!0))},R.prototype._handlePingresp=function(){this.pingResp=!0},R.prototype._handleConnack=function(P){x("_handleConnack");const M=this.options,Y=M.protocolVersion===5?P.reasonCode:P.returnCode;if(clearTimeout(this.connackTimer),delete this.topicAliasSend,P.properties){if(P.properties.topicAliasMaximum){if(P.properties.topicAliasMaximum>65535)return void this.emit("error",new Error("topicAliasMaximum from broker is out of range"));P.properties.topicAliasMaximum>0&&(this.topicAliasSend=new c(P.properties.topicAliasMaximum))}P.properties.serverKeepAlive&&M.keepalive&&(M.keepalive=P.properties.serverKeepAlive,this._shiftPingInterval()),P.properties.maximumPacketSize&&(M.properties||(M.properties={}),M.properties.maximumPacketSize=P.properties.maximumPacketSize)}if(Y===0)this.reconnecting=!1,this._onConnect(P);else if(Y>0){const Z=new Error("Connection refused: "+D[Y]);Z.code=Y,this.emit("error",Z)}},R.prototype._handleAuth=function(P){const M=this.options.protocolVersion,Y=M===5?P.reasonCode:P.returnCode;if(M!==5){const nt=new Error("Protocol error: Auth packets are only supported in MQTT 5. Your version:"+M);return nt.code=Y,void this.emit("error",nt)}const Z=this;this.handleAuth(P,function(nt,j){if(nt)Z.emit("error",nt);else if(Y===24)Z.reconnecting=!1,Z._sendPacket(j);else{const H=new Error("Connection refused: "+D[Y]);nt.code=Y,Z.emit("error",H)}})},R.prototype.handleAuth=function(P,M){M()},R.prototype._handlePublish=function(P,M){x("_handlePublish: packet %o",P),M=M!==void 0?M:F;let Y=P.topic.toString();const Z=P.payload,nt=P.qos,j=P.messageId,H=this,$=this.options,K=[0,16,128,131,135,144,145,151,153];if(this.options.protocolVersion===5){let U;if(P.properties&&(U=P.properties.topicAlias),U!==void 0)if(Y.length===0){if(!(U>0&&U<=65535))return x("_handlePublish :: topic alias out of range. alias: %d",U),void this.emit("error",new Error("Received Topic Alias is out of range"));{const tt=this.topicAliasRecv.getTopicByAlias(U);if(!tt)return x("_handlePublish :: unregistered topic alias. alias: %d",U),void this.emit("error",new Error("Received unregistered Topic Alias"));x("_handlePublish :: topic complemented by alias. topic: %s - alias: %d",Y=tt,U)}}else{if(!this.topicAliasRecv.put(Y,U))return x("_handlePublish :: topic alias out of range. alias: %d",U),void this.emit("error",new Error("Received Topic Alias is out of range"));x("_handlePublish :: registered topic: %s - alias: %d",Y,U)}}switch(x("_handlePublish: qos %d",nt),nt){case 2:$.customHandleAcks(Y,Z,P,function(U,tt){return U instanceof Error||(tt=U,U=null),U?H.emit("error",U):K.indexOf(tt)===-1?H.emit("error",new Error("Wrong reason code for pubrec")):void(tt?H._sendPacket({cmd:"pubrec",messageId:j,reasonCode:tt},M):H.incomingStore.put(P,function(){H._sendPacket({cmd:"pubrec",messageId:j},M)}))});break;case 1:$.customHandleAcks(Y,Z,P,function(U,tt){return U instanceof Error||(tt=U,U=null),U?H.emit("error",U):K.indexOf(tt)===-1?H.emit("error",new Error("Wrong reason code for puback")):(tt||H.emit("message",Y,Z,P),void H.handleMessage(P,function(at){if(at)return M&&M(at);H._sendPacket({cmd:"puback",messageId:j,reasonCode:tt},M)}))});break;case 0:this.emit("message",Y,Z,P),this.handleMessage(P,M);break;default:x("_handlePublish: unknown QoS. Doing nothing.")}},R.prototype.handleMessage=function(P,M){M()},R.prototype._handleAck=function(P){const M=P.messageId,Y=P.cmd;let Z=null;const nt=this.outgoing[M]?this.outgoing[M].cb:null,j=this;let H;if(nt){switch(x("_handleAck :: packet type",Y),Y){case"pubcomp":case"puback":{const $=P.reasonCode;$&&$>0&&$!==16&&((H=new Error("Publish error: "+D[$])).code=$,nt(H,P)),delete this.outgoing[M],this.outgoingStore.del(P,nt),this.messageIdProvider.deallocate(M),this._invokeStoreProcessingQueue();break}case"pubrec":{Z={cmd:"pubrel",qos:2,messageId:M};const $=P.reasonCode;$&&$>0&&$!==16?((H=new Error("Publish error: "+D[$])).code=$,nt(H,P)):this._sendPacket(Z);break}case"suback":delete this.outgoing[M],this.messageIdProvider.deallocate(M);for(let $=0;$<P.granted.length;$++)if((128&P.granted[$])!=0){const K=this.messageIdToTopic[M];K&&K.forEach(function(U){delete j._resubscribeTopics[U]})}this._invokeStoreProcessingQueue(),nt(null,P);break;case"unsuback":delete this.outgoing[M],this.messageIdProvider.deallocate(M),this._invokeStoreProcessingQueue(),nt(null);break;default:j.emit("error",new Error("unrecognized packet type"))}this.disconnecting&&Object.keys(this.outgoing).length===0&&this.emit("outgoingEmpty")}else x("_handleAck :: Server sent an ack in error. Ignoring.")},R.prototype._handlePubrel=function(P,M){x("handling pubrel packet"),M=M!==void 0?M:F;const Y=this,Z={cmd:"pubcomp",messageId:P.messageId};Y.incomingStore.get(P,function(nt,j){nt?Y._sendPacket(Z,M):(Y.emit("message",j.topic,j.payload,j),Y.handleMessage(j,function(H){if(H)return M(H);Y.incomingStore.del(j,F),Y._sendPacket(Z,M)}))})},R.prototype._handleDisconnect=function(P){this.emit("disconnect",P)},R.prototype._nextId=function(){return this.messageIdProvider.allocate()},R.prototype.getLastMessageId=function(){return this.messageIdProvider.getLastAllocated()},R.prototype._resubscribe=function(){x("_resubscribe");const P=Object.keys(this._resubscribeTopics);if(!this._firstConnection&&(this.options.clean||this.options.protocolVersion===5&&!this.connackPacket.sessionPresent)&&P.length>0)if(this.options.resubscribe)if(this.options.protocolVersion===5){x("_resubscribe: protocolVersion 5");for(let M=0;M<P.length;M++){const Y={};Y[P[M]]=this._resubscribeTopics[P[M]],Y.resubscribe=!0,this.subscribe(Y,{properties:Y[P[M]].properties})}}else this._resubscribeTopics.resubscribe=!0,this.subscribe(this._resubscribeTopics);else this._resubscribeTopics={};this._firstConnection=!1},R.prototype._onConnect=function(P){if(this.disconnected)return void this.emit("connect",P);const M=this;this.connackPacket=P,this.messageIdProvider.clear(),this._setupPingTimer(),this.connected=!0,function Y(){let Z=M.outgoingStore.createStream();function nt(){M._storeProcessing=!1,M._packetIdsDuringStoreProcessing={}}function j(){Z.destroy(),Z=null,M._flushStoreProcessingQueue(),nt()}M.once("close",j),Z.on("error",function(H){nt(),M._flushStoreProcessingQueue(),M.removeListener("close",j),M.emit("error",H)}),Z.on("end",function(){let H=!0;for(const $ in M._packetIdsDuringStoreProcessing)if(!M._packetIdsDuringStoreProcessing[$]){H=!1;break}H?(nt(),M.removeListener("close",j),M._invokeAllStoreProcessingQueue(),M.emit("connect",P)):Y()}),function H(){if(!Z)return;M._storeProcessing=!0;const $=Z.read(1);let K;$?M._packetIdsDuringStoreProcessing[$.messageId]?H():M.disconnecting||M.reconnectTimer?Z.destroy&&Z.destroy():(K=M.outgoing[$.messageId]?M.outgoing[$.messageId].cb:null,M.outgoing[$.messageId]={volatile:!1,cb:function(U,tt){K&&K(U,tt),H()}},M._packetIdsDuringStoreProcessing[$.messageId]=!0,M.messageIdProvider.register($.messageId)?M._sendPacket($):x("messageId: %d has already used.",$.messageId)):Z.once("readable",H)}()}()},R.prototype._invokeStoreProcessingQueue=function(){if(this._storeProcessingQueue.length>0){const P=this._storeProcessingQueue[0];if(P&&P.invoke())return this._storeProcessingQueue.shift(),!0}return!1},R.prototype._invokeAllStoreProcessingQueue=function(){for(;this._invokeStoreProcessingQueue(););},R.prototype._flushStoreProcessingQueue=function(){for(const P of this._storeProcessingQueue)P.cbStorePut&&P.cbStorePut(new Error("Connection closed")),P.callback&&P.callback(new Error("Connection closed"));this._storeProcessingQueue.splice(0)},a.exports=R}).call(this)}).call(this,i("_process"),typeof Be<"u"?Be: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,s){const{Buffer:n}=i("buffer"),r=i("readable-stream").Transform,l=i("duplexify");let o,u,c,f=!1;a.exports=function(g,v){if(v.hostname=v.hostname||v.host,!v.hostname)throw new Error("Could not determine host. Specify host manually.");const m=v.protocolId==="MQIsdp"&&v.protocolVersion===3?"mqttv3.1":"mqtt";(function(y){y.hostname||(y.hostname="localhost"),y.path||(y.path="/"),y.wsOptions||(y.wsOptions={})})(v);const w=function(y,_){const A=y.protocol==="alis"?"wss":"ws";let x=A+"://"+y.hostname+y.path;return y.port&&y.port!==80&&y.port!==443&&(x=A+"://"+y.hostname+":"+y.port+y.path),typeof y.transformWsUrl=="function"&&(x=y.transformWsUrl(x,y,_)),x}(v,g);return(o=v.my).connectSocket({url:w,protocols:m}),u=function(){const y=new r;return y._write=function(_,A,x){o.sendSocketMessage({data:_.buffer,success:function(){x()},fail:function(){x(new Error)}})},y._flush=function(_){o.closeSocket({success:function(){_()}})},y}(),c=l.obj(),f||(f=!0,o.onSocketOpen(function(){c.setReadable(u),c.setWritable(u),c.emit("connect")}),o.onSocketMessage(function(y){if(typeof y.data=="string"){const _=n.from(y.data,"base64");u.push(_)}else{const _=new FileReader;_.addEventListener("load",function(){let A=_.result;A=A instanceof ArrayBuffer?n.from(A):n.from(A,"utf8"),u.push(A)}),_.readAsArrayBuffer(y.data)}}),o.onSocketClose(function(){c.end(),c.destroy()}),o.onSocketError(function(y){c.destroy(y)})),c}},{buffer:17,duplexify:20,"readable-stream":69}],3:[function(i,a,s){const n=i("net"),r=i("debug")("mqttjs:tcp");a.exports=function(l,o){o.port=o.port||1883,o.hostname=o.hostname||o.host||"localhost";const u=o.port,c=o.hostname;return r("port %d and host %s",u,c),n.createConnection(u,c)}},{debug:18,net:16}],4:[function(i,a,s){const n=i("tls"),r=i("net"),l=i("debug")("mqttjs:tls");a.exports=function(o,u){u.port=u.port||8883,u.host=u.hostname||u.host||"localhost",r.isIP(u.host)===0&&(u.servername=u.host),u.rejectUnauthorized=u.rejectUnauthorized!==!1,delete u.path,l("port %d host %s rejectUnauthorized %b",u.port,u.host,u.rejectUnauthorized);const c=n.connect(u);function f(g){u.rejectUnauthorized&&o.emit("error",g),c.end()}return c.on("secureConnect",function(){u.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,s){(function(n){(function(){const{Buffer:r}=i("buffer"),l=i("ws"),o=i("debug")("mqttjs:ws"),u=i("duplexify"),c=i("readable-stream").Transform,f=["rejectUnauthorized","ca","cert","key","pfx","passphrase"],g=n!==void 0&&n.title==="browser"||typeof __webpack_require__=="function";function v(w,y){let _=w.protocol+"://"+w.hostname+":"+w.port+w.path;return typeof w.transformWsUrl=="function"&&(_=w.transformWsUrl(_,w,y)),_}function m(w){const y=w;return w.hostname||(y.hostname="localhost"),w.port||(w.protocol==="wss"?y.port=443:y.port=80),w.path||(y.path="/"),w.wsOptions||(y.wsOptions={}),g||w.protocol!=="wss"||f.forEach(function(_){Object.prototype.hasOwnProperty.call(w,_)&&!Object.prototype.hasOwnProperty.call(w.wsOptions,_)&&(y.wsOptions[_]=w[_])}),y}a.exports=g?function(w,y){let _;o("browserStreamBuilder");const A=function(P){const M=m(P);if(M.hostname||(M.hostname=M.host),!M.hostname){if(typeof document>"u")throw new Error("Could not determine host. Specify host manually.");const Y=new URL(document.URL);M.hostname=Y.hostname,M.port||(M.port=Y.port)}return M.objectMode===void 0&&(M.objectMode=!(M.binary===!0||M.binary===void 0)),M}(y).browserBufferSize||524288,x=y.browserBufferTimeout||1e3,C=!y.objectMode,T=function(P,M){const Y=M.protocolId==="MQIsdp"&&M.protocolVersion===3?"mqttv3.1":"mqtt",Z=v(M,P),nt=new WebSocket(Z,[Y]);return nt.binaryType="arraybuffer",nt}(w,y),I=function(P,M,Y){const Z=new c({objectModeMode:P.objectMode});return Z._write=M,Z._flush=Y,Z}(y,function P(M,Y,Z){T.bufferedAmount>A&&setTimeout(P,x,M,Y,Z),C&&typeof M=="string"&&(M=r.from(M,"utf8"));try{T.send(M)}catch(nt){return Z(nt)}Z()},function(P){T.close(),P()});y.objectMode||(I._writev=R),I.on("close",()=>{T.close()});const D=T.addEventListener!==void 0;function B(){_.setReadable(I),_.setWritable(I),_.emit("connect")}function V(){_.end(),_.destroy()}function Q(P){_.destroy(P)}function F(P){let M=P.data;M=M instanceof ArrayBuffer?r.from(M):r.from(M,"utf8"),I.push(M)}function R(P,M){const Y=new Array(P.length);for(let Z=0;Z<P.length;Z++)typeof P[Z].chunk=="string"?Y[Z]=r.from(P[Z],"utf8"):Y[Z]=P[Z].chunk;this._write(r.concat(Y),"binary",M)}return T.readyState===T.OPEN?_=I:(_=_=u(void 0,void 0,y),y.objectMode||(_._writev=R),D?T.addEventListener("open",B):T.onopen=B),_.socket=T,D?(T.addEventListener("close",V),T.addEventListener("error",Q),T.addEventListener("message",F)):(T.onclose=V,T.onerror=Q,T.onmessage=F),_}:function(w,y){o("streamBuilder");const _=m(y),A=v(_,w),x=function(T,I,D){o("createWebSocket"),o("protocol: "+D.protocolId+" "+D.protocolVersion);const B=D.protocolId==="MQIsdp"&&D.protocolVersion===3?"mqttv3.1":"mqtt";return o("creating new Websocket for url: "+I+" and protocol: "+B),new l(I,[B],D.wsOptions)}(0,A,_),C=l.createWebSocketStream(x,_.wsOptions);return C.url=A,x.on("close",()=>{C.destroy()}),C}}).call(this)}).call(this,i("_process"))},{_process:50,buffer:17,debug:18,duplexify:20,"readable-stream":69,ws:80}],6:[function(i,a,s){const{Buffer:n}=i("buffer"),r=i("readable-stream").Transform,l=i("duplexify");let o,u,c;a.exports=function(f,g){if(g.hostname=g.hostname||g.host,!g.hostname)throw new Error("Could not determine host. Specify host manually.");const v=g.protocolId==="MQIsdp"&&g.protocolVersion===3?"mqttv3.1":"mqtt";(function(y){y.hostname||(y.hostname="localhost"),y.path||(y.path="/"),y.wsOptions||(y.wsOptions={})})(g);const m=function(y,_){const A=y.protocol==="wxs"?"wss":"ws";let x=A+"://"+y.hostname+y.path;return y.port&&y.port!==80&&y.port!==443&&(x=A+"://"+y.hostname+":"+y.port+y.path),typeof y.transformWsUrl=="function"&&(x=y.transformWsUrl(x,y,_)),x}(g,f);o=wx.connectSocket({url:m,protocols:[v]}),u=function(){const y=new r;return y._write=function(_,A,x){o.send({data:_.buffer,success:function(){x()},fail:function(C){x(new Error(C))}})},y._flush=function(_){o.close({success:function(){_()}})},y}(),(c=l.obj())._destroy=function(y,_){o.close({success:function(){_&&_(y)}})};const w=c.destroy;return c.destroy=function(){c.destroy=w;const y=this;setTimeout(function(){o.close({fail:function(){y._destroy(new Error)}})},0)}.bind(c),o.onOpen(function(){c.setReadable(u),c.setWritable(u),c.emit("connect")}),o.onMessage(function(y){let _=y.data;_=_ instanceof ArrayBuffer?n.from(_):n.from(_,"utf8"),u.push(_)}),o.onClose(function(){c.end(),c.destroy()}),o.onError(function(y){c.destroy(new Error(y.errMsg))}),c}},{buffer:17,duplexify:20,"readable-stream":69}],7:[function(i,a,s){function n(){if(!(this instanceof n))return new n;this.nextId=Math.max(1,Math.floor(65535*Math.random()))}n.prototype.allocate=function(){const r=this.nextId++;return this.nextId===65536&&(this.nextId=1),r},n.prototype.getLastAllocated=function(){return this.nextId===1?65535:this.nextId-1},n.prototype.register=function(r){return!0},n.prototype.deallocate=function(r){},n.prototype.clear=function(){},a.exports=n},{}],8:[function(i,a,s){const n=i("xtend"),r=i("readable-stream").Readable,l={objectMode:!0},o={clean:!0};function u(c){if(!(this instanceof u))return new u(c);this.options=c||{},this.options=n(o,c),this._inflights=new Map}u.prototype.put=function(c,f){return this._inflights.set(c.messageId,c),f&&f(),this},u.prototype.createStream=function(){const c=new r(l),f=[];let g=!1,v=0;return this._inflights.forEach(function(m,w){f.push(m)}),c._read=function(){!g&&v<f.length?this.push(f[v++]):this.push(null)},c.destroy=function(){if(g)return;const m=this;g=!0,setTimeout(function(){m.emit("close")},0)},c},u.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},u.prototype.get=function(c,f){return(c=this._inflights.get(c.messageId))?f(null,c):f&&f(new Error("missing packet")),this},u.prototype.close=function(c){this.options.clean&&(this._inflights=null),c&&c()},a.exports=u},{"readable-stream":69,xtend:81}],9:[function(i,a,s){function n(r){if(!(this instanceof n))return new n(r);this.aliasToTopic={},this.max=r}n.prototype.put=function(r,l){return!(l===0||l>this.max)&&(this.aliasToTopic[l]=r,this.length=Object.keys(this.aliasToTopic).length,!0)},n.prototype.getTopicByAlias=function(r){return this.aliasToTopic[r]},n.prototype.clear=function(){this.aliasToTopic={}},a.exports=n},{}],10:[function(i,a,s){const n=i("lru-cache"),r=i("number-allocator").NumberAllocator;function l(o){if(!(this instanceof l))return new l(o);o>0&&(this.aliasToTopic=new n({max:o}),this.topicToAlias={},this.numberAllocator=new r(1,o),this.max=o,this.length=0)}l.prototype.put=function(o,u){if(u===0||u>this.max)return!1;const c=this.aliasToTopic.get(u);return c&&delete this.topicToAlias[c],this.aliasToTopic.set(u,o),this.topicToAlias[o]=u,this.numberAllocator.use(u),this.length=this.aliasToTopic.length,!0},l.prototype.getTopicByAlias=function(o){return this.aliasToTopic.get(o)},l.prototype.getAliasByTopic=function(o){const u=this.topicToAlias[o];return u!==void 0&&this.aliasToTopic.get(u),u},l.prototype.clear=function(){this.aliasToTopic.reset(),this.topicToAlias={},this.numberAllocator.clear(),this.length=0},l.prototype.getLruAlias=function(){return this.numberAllocator.firstVacant()||this.aliasToTopic.keys()[this.aliasToTopic.length-1]},a.exports=l},{"lru-cache":37,"number-allocator":46}],11:[function(i,a,s){function n(r){const l=r.split("/");for(let o=0;o<l.length;o++)if(l[o]!=="+"){if(l[o]==="#")return o===l.length-1;if(l[o].indexOf("+")!==-1||l[o].indexOf("#")!==-1)return!1}return!0}a.exports={validateTopics:function(r){if(r.length===0)return"empty_topic_list";for(let l=0;l<r.length;l++)if(!n(r[l]))return r[l];return null}}},{}],12:[function(i,a,s){(function(n){(function(){const r=i("../client"),l=i("../store"),o=i("url"),u=i("xtend"),c=i("debug")("mqttjs"),f={};function g(v,m){if(c("connecting to an MQTT broker..."),typeof v!="object"||m||(m=v,v=null),m=m||{},v){const y=o.parse(v,!0);if(y.port!=null&&(y.port=Number(y.port)),(m=u(y,m)).protocol===null)throw new Error("Missing protocol");m.protocol=m.protocol.replace(/:$/,"")}if(function(y){let _;y.auth&&((_=y.auth.match(/^(.+):(.+)$/))?(y.username=_[1],y.password=_[2]):y.username=y.auth)}(m),m.query&&typeof m.query.clientId=="string"&&(m.clientId=m.query.clientId),m.cert&&m.key){if(!m.protocol)throw new Error("Missing secure protocol key");if(["mqtts","wss","wxs","alis"].indexOf(m.protocol)===-1)switch(m.protocol){case"mqtt":m.protocol="mqtts";break;case"ws":m.protocol="wss";break;case"wx":m.protocol="wxs";break;case"ali":m.protocol="alis";break;default:throw new Error('Unknown protocol for secure connection: "'+m.protocol+'"!')}}if(!f[m.protocol]){const y=["mqtts","wss"].indexOf(m.protocol)!==-1;m.protocol=["mqtt","mqtts","ws","wss","wx","wxs","ali","alis"].filter(function(_,A){return(!y||A%2!=0)&&typeof f[_]=="function"})[0]}if(m.clean===!1&&!m.clientId)throw new Error("Missing clientId for unclean clients");m.protocol&&(m.defaultProtocol=m.protocol);const w=new r(function(y){return m.servers&&(y._reconnectCount&&y._reconnectCount!==m.servers.length||(y._reconnectCount=0),m.host=m.servers[y._reconnectCount].host,m.port=m.servers[y._reconnectCount].port,m.protocol=m.servers[y._reconnectCount].protocol?m.servers[y._reconnectCount].protocol:m.defaultProtocol,m.hostname=m.host,y._reconnectCount++),c("calling streambuilder for",m.protocol),f[m.protocol](y,m)},m);return w.on("error",function(){}),w}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=g,a.exports.connect=g,a.exports.MqttClient=r,a.exports.Store=l}).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,s){s.byteLength=function(v){var m=f(v),w=m[0],y=m[1];return 3*(w+y)/4-y},s.toByteArray=function(v){var m,w,y=f(v),_=y[0],A=y[1],x=new l(function(I,D,B){return 3*(D+B)/4-B}(0,_,A)),C=0,T=A>0?_-4:_;for(w=0;w<T;w+=4)m=r[v.charCodeAt(w)]<<18|r[v.charCodeAt(w+1)]<<12|r[v.charCodeAt(w+2)]<<6|r[v.charCodeAt(w+3)],x[C++]=m>>16&255,x[C++]=m>>8&255,x[C++]=255&m;return A===2&&(m=r[v.charCodeAt(w)]<<2|r[v.charCodeAt(w+1)]>>4,x[C++]=255&m),A===1&&(m=r[v.charCodeAt(w)]<<10|r[v.charCodeAt(w+1)]<<4|r[v.charCodeAt(w+2)]>>2,x[C++]=m>>8&255,x[C++]=255&m),x},s.fromByteArray=function(v){for(var m,w=v.length,y=w%3,_=[],A=0,x=w-y;A<x;A+=16383)_.push(g(v,A,A+16383>x?x:A+16383));return y===1?(m=v[w-1],_.push(n[m>>2]+n[m<<4&63]+"==")):y===2&&(m=(v[w-2]<<8)+v[w-1],_.push(n[m>>10]+n[m>>4&63]+n[m<<2&63]+"=")),_.join("")};for(var n=[],r=[],l=typeof Uint8Array<"u"?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",u=0,c=o.length;u<c;++u)n[u]=o[u],r[o.charCodeAt(u)]=u;function f(v){var m=v.length;if(m%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var w=v.indexOf("=");return w===-1&&(w=m),[w,w===m?0:4-w%4]}function g(v,m,w){for(var y,_,A=[],x=m;x<w;x+=3)y=(v[x]<<16&16711680)+(v[x+1]<<8&65280)+(255&v[x+2]),A.push(n[(_=y)>>18&63]+n[_>>12&63]+n[_>>6&63]+n[63&_]);return A.join("")}r["-".charCodeAt(0)]=62,r["_".charCodeAt(0)]=63},{}],14:[function(i,a,s){const{Buffer:n}=i("buffer"),r=Symbol.for("BufferList");function l(o){if(!(this instanceof l))return new l(o);l._init.call(this,o)}l._init=function(o){Object.defineProperty(this,r,{value:!0}),this._bufs=[],this.length=0,o&&this.append(o)},l.prototype._new=function(o){return new l(o)},l.prototype._offset=function(o){if(o===0)return[0,0];let u=0;for(let c=0;c<this._bufs.length;c++){const f=u+this._bufs[c].length;if(o<f||c===this._bufs.length-1)return[c,o-u];u=f}},l.prototype._reverseOffset=function(o){const u=o[0];let c=o[1];for(let f=0;f<u;f++)c+=this._bufs[f].length;return c},l.prototype.get=function(o){if(o>this.length||o<0)return;const u=this._offset(o);return this._bufs[u[0]][u[1]]},l.prototype.slice=function(o,u){return typeof o=="number"&&o<0&&(o+=this.length),typeof u=="number"&&u<0&&(u+=this.length),this.copy(null,0,o,u)},l.prototype.copy=function(o,u,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 o||n.alloc(0);const g=!!o,v=this._offset(c),m=f-c;let w=m,y=g&&u||0,_=v[1];if(c===0&&f===this.length){if(!g)return this._bufs.length===1?this._bufs[0]:n.concat(this._bufs,this.length);for(let A=0;A<this._bufs.length;A++)this._bufs[A].copy(o,y),y+=this._bufs[A].length;return o}if(w<=this._bufs[v[0]].length-_)return g?this._bufs[v[0]].copy(o,u,_,_+w):this._bufs[v[0]].slice(_,_+w);g||(o=n.allocUnsafe(m));for(let A=v[0];A<this._bufs.length;A++){const x=this._bufs[A].length-_;if(!(w>x)){this._bufs[A].copy(o,y,_,_+w),y+=x;break}this._bufs[A].copy(o,y,_),y+=x,w-=x,_&&(_=0)}return o.length>y?o.slice(0,y):o},l.prototype.shallowSlice=function(o,u){if(o=o||0,u=typeof u!="number"?this.length:u,o<0&&(o+=this.length),u<0&&(u+=this.length),o===u)return this._new();const c=this._offset(o),f=this._offset(u),g=this._bufs.slice(c[0],f[0]+1);return f[1]===0?g.pop():g[g.length-1]=g[g.length-1].slice(0,f[1]),c[1]!==0&&(g[0]=g[0].slice(c[1])),this._new(g)},l.prototype.toString=function(o,u,c){return this.slice(u,c).toString(o)},l.prototype.consume=function(o){if(o=Math.trunc(o),Number.isNaN(o)||o<=0)return this;for(;this._bufs.length;){if(!(o>=this._bufs[0].length)){this._bufs[0]=this._bufs[0].slice(o),this.length-=o;break}o-=this._bufs[0].length,this.length-=this._bufs[0].length,this._bufs.shift()}return this},l.prototype.duplicate=function(){const o=this._new();for(let u=0;u<this._bufs.length;u++)o.append(this._bufs[u]);return o},l.prototype.append=function(o){if(o==null)return this;if(o.buffer)this._appendBuffer(n.from(o.buffer,o.byteOffset,o.byteLength));else if(Array.isArray(o))for(let u=0;u<o.length;u++)this.append(o[u]);else if(this._isBufferList(o))for(let u=0;u<o._bufs.length;u++)this.append(o._bufs[u]);else typeof o=="number"&&(o=o.toString()),this._appendBuffer(n.from(o));return this},l.prototype._appendBuffer=function(o){this._bufs.push(o),this.length+=o.length},l.prototype.indexOf=function(o,u,c){if(c===void 0&&typeof u=="string"&&(c=u,u=void 0),typeof o=="function"||Array.isArray(o))throw new TypeError('The "value" argument must be one of type string, Buffer, BufferList, or Uint8Array.');if(typeof o=="number"?o=n.from([o]):typeof o=="string"?o=n.from(o,c):this._isBufferList(o)?o=o.slice():Array.isArray(o.buffer)?o=n.from(o.buffer,o.byteOffset,o.byteLength):n.isBuffer(o)||(o=n.from(o)),u=Number(u||0),isNaN(u)&&(u=0),u<0&&(u=this.length+u),u<0&&(u=0),o.length===0)return u>this.length?this.length:u;const f=this._offset(u);let g=f[0],v=f[1];for(;g<this._bufs.length;g++){const m=this._bufs[g];for(;v<m.length;)if(m.length-v>=o.length){const w=m.indexOf(o,v);if(w!==-1)return this._reverseOffset([g,w]);v=m.length-o.length+1}else{const w=this._reverseOffset([g,v]);if(this._match(w,o))return w;v++}v=0}return-1},l.prototype._match=function(o,u){if(this.length-o<u.length)return!1;for(let c=0;c<u.length;c++)if(this.get(o+c)!==u[c])return!1;return!0},function(){const o={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 u in o)(function(c){l.prototype[c]=o[c]===null?function(f,g){return this.slice(f,f+g)[c](0,g)}:function(f=0){return this.slice(f,f+o[c])[c](0)}})(u)}(),l.prototype._isBufferList=function(o){return o instanceof l||l.isBufferList(o)},l.isBufferList=function(o){return o!=null&&o[r]},a.exports=l},{buffer:17}],15:[function(i,a,s){const n=i("readable-stream").Duplex,r=i("inherits"),l=i("./BufferList");function o(u){if(!(this instanceof o))return new o(u);if(typeof u=="function"){this._callback=u;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)}),u=null}l._init.call(this,u),n.call(this)}r(o,n),Object.assign(o.prototype,l.prototype),o.prototype._new=function(u){return new o(u)},o.prototype._write=function(u,c,f){this._appendBuffer(u),typeof f=="function"&&f()},o.prototype._read=function(u){if(!this.length)return this.push(null);u=Math.min(u,this.length),this.push(this.slice(0,u)),this.consume(u)},o.prototype.end=function(u){n.prototype.end.call(this,u),this._callback&&(this._callback(null,this.slice()),this._callback=null)},o.prototype._destroy=function(u,c){this._bufs.length=0,this.length=0,c(u)},o.prototype._isBufferList=function(u){return u instanceof o||u instanceof l||o.isBufferList(u)},o.isBufferList=l.isBufferList,a.exports=o,a.exports.BufferListStream=o,a.exports.BufferList=l},{"./BufferList":14,inherits:24,"readable-stream":69}],16:[function(i,a,s){},{}],17:[function(i,a,s){(function(n){(function(){var r=i("base64-js"),l=i("ieee754");s.Buffer=c,s.SlowBuffer=function(b){return+b!=b&&(b=0),c.alloc(+b)},s.INSPECT_MAX_BYTES=50;var o=2147483647;function u(b){if(b>o)throw new RangeError('The value "'+b+'" is invalid for option "size"');var E=new Uint8Array(b);return E.__proto__=c.prototype,E}function c(b,E,S){if(typeof b=="number"){if(typeof E=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return v(b)}return f(b,E,S)}function f(b,E,S){if(typeof b=="string")return function(G,rt){if(typeof rt=="string"&&rt!==""||(rt="utf8"),!c.isEncoding(rt))throw new TypeError("Unknown encoding: "+rt);var yt=0|y(G,rt),mt=u(yt),At=mt.write(G,rt);return At!==yt&&(mt=mt.slice(0,At)),mt}(b,E);if(ArrayBuffer.isView(b))return m(b);if(b==null)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof b);if(ct(b,ArrayBuffer)||b&&ct(b.buffer,ArrayBuffer))return function(G,rt,yt){if(rt<0||G.byteLength<rt)throw new RangeError('"offset" is outside of buffer bounds');if(G.byteLength<rt+(yt||0))throw new RangeError('"length" is outside of buffer bounds');var mt;return mt=rt===void 0&&yt===void 0?new Uint8Array(G):yt===void 0?new Uint8Array(G,rt):new Uint8Array(G,rt,yt),mt.__proto__=c.prototype,mt}(b,E,S);if(typeof b=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var N=b.valueOf&&b.valueOf();if(N!=null&&N!==b)return c.from(N,E,S);var X=function(G){if(c.isBuffer(G)){var rt=0|w(G.length),yt=u(rt);return yt.length===0||G.copy(yt,0,0,rt),yt}if(G.length!==void 0)return typeof G.length!="number"||ot(G.length)?u(0):m(G);if(G.type==="Buffer"&&Array.isArray(G.data))return m(G.data)}(b);if(X)return X;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof b[Symbol.toPrimitive]=="function")return c.from(b[Symbol.toPrimitive]("string"),E,S);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof b)}function g(b){if(typeof b!="number")throw new TypeError('"size" argument must be of type number');if(b<0)throw new RangeError('The value "'+b+'" is invalid for option "size"')}function v(b){return g(b),u(b<0?0:0|w(b))}function m(b){for(var E=b.length<0?0:0|w(b.length),S=u(E),N=0;N<E;N+=1)S[N]=255&b[N];return S}function w(b){if(b>=o)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o.toString(16)+" bytes");return 0|b}function y(b,E){if(c.isBuffer(b))return b.length;if(ArrayBuffer.isView(b)||ct(b,ArrayBuffer))return b.byteLength;if(typeof b!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof b);var S=b.length,N=arguments.length>2&&arguments[2]===!0;if(!N&&S===0)return 0;for(var X=!1;;)switch(E){case"ascii":case"latin1":case"binary":return S;case"utf8":case"utf-8":return at(b).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*S;case"hex":return S>>>1;case"base64":return et(b).length;default:if(X)return N?-1:at(b).length;E=(""+E).toLowerCase(),X=!0}}function _(b,E,S){var N=b[E];b[E]=b[S],b[S]=N}function A(b,E,S,N,X){if(b.length===0)return-1;if(typeof S=="string"?(N=S,S=0):S>2147483647?S=2147483647:S<-2147483648&&(S=-2147483648),ot(S=+S)&&(S=X?0:b.length-1),S<0&&(S=b.length+S),S>=b.length){if(X)return-1;S=b.length-1}else if(S<0){if(!X)return-1;S=0}if(typeof E=="string"&&(E=c.from(E,N)),c.isBuffer(E))return E.length===0?-1:x(b,E,S,N,X);if(typeof E=="number")return E&=255,typeof Uint8Array.prototype.indexOf=="function"?X?Uint8Array.prototype.indexOf.call(b,E,S):Uint8Array.prototype.lastIndexOf.call(b,E,S):x(b,[E],S,N,X);throw new TypeError("val must be string, number or Buffer")}function x(b,E,S,N,X){var G,rt=1,yt=b.length,mt=E.length;if(N!==void 0&&((N=String(N).toLowerCase())==="ucs2"||N==="ucs-2"||N==="utf16le"||N==="utf-16le")){if(b.length<2||E.length<2)return-1;rt=2,yt/=2,mt/=2,S/=2}function At(xe,jt){return rt===1?xe[jt]:xe.readUInt16BE(jt*rt)}if(X){var Rt=-1;for(G=S;G<yt;G++)if(At(b,G)===At(E,Rt===-1?0:G-Rt)){if(Rt===-1&&(Rt=G),G-Rt+1===mt)return Rt*rt}else Rt!==-1&&(G-=G-Rt),Rt=-1}else for(S+mt>yt&&(S=yt-mt),G=S;G>=0;G--){for(var be=!0,ae=0;ae<mt;ae++)if(At(b,G+ae)!==At(E,ae)){be=!1;break}if(be)return G}return-1}function C(b,E,S,N){S=Number(S)||0;var X=b.length-S;N?(N=Number(N))>X&&(N=X):N=X;var G=E.length;N>G/2&&(N=G/2);for(var rt=0;rt<N;++rt){var yt=parseInt(E.substr(2*rt,2),16);if(ot(yt))return rt;b[S+rt]=yt}return rt}function T(b,E,S,N){return ut(at(E,b.length-S),b,S,N)}function I(b,E,S,N){return ut(function(X){for(var G=[],rt=0;rt<X.length;++rt)G.push(255&X.charCodeAt(rt));return G}(E),b,S,N)}function D(b,E,S,N){return I(b,E,S,N)}function B(b,E,S,N){return ut(et(E),b,S,N)}function V(b,E,S,N){return ut(function(X,G){for(var rt,yt,mt,At=[],Rt=0;Rt<X.length&&!((G-=2)<0);++Rt)rt=X.charCodeAt(Rt),yt=rt>>8,mt=rt%256,At.push(mt),At.push(yt);return At}(E,b.length-S),b,S,N)}function Q(b,E,S){return E===0&&S===b.length?r.fromByteArray(b):r.fromByteArray(b.slice(E,S))}function F(b,E,S){S=Math.min(b.length,S);for(var N=[],X=E;X<S;){var G,rt,yt,mt,At=b[X],Rt=null,be=At>239?4:At>223?3:At>191?2:1;if(X+be<=S)switch(be){case 1:At<128&&(Rt=At);break;case 2:(192&(G=b[X+1]))==128&&(mt=(31&At)<<6|63&G)>127&&(Rt=mt);break;case 3:G=b[X+1],rt=b[X+2],(192&G)==128&&(192&rt)==128&&(mt=(15&At)<<12|(63&G)<<6|63&rt)>2047&&(mt<55296||mt>57343)&&(Rt=mt);break;case 4:G=b[X+1],rt=b[X+2],yt=b[X+3],(192&G)==128&&(192&rt)==128&&(192&yt)==128&&(mt=(15&At)<<18|(63&G)<<12|(63&rt)<<6|63&yt)>65535&&mt<1114112&&(Rt=mt)}Rt===null?(Rt=65533,be=1):Rt>65535&&(Rt-=65536,N.push(Rt>>>10&1023|55296),Rt=56320|1023&Rt),N.push(Rt),X+=be}return function(ae){var xe=ae.length;if(xe<=R)return String.fromCharCode.apply(String,ae);for(var jt="",te=0;te<xe;)jt+=String.fromCharCode.apply(String,ae.slice(te,te+=R));return jt}(N)}s.kMaxLength=o,c.TYPED_ARRAY_SUPPORT=function(){try{var b=new Uint8Array(1);return b.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},b.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(b,E,S){return f(b,E,S)},c.prototype.__proto__=Uint8Array.prototype,c.__proto__=Uint8Array,c.alloc=function(b,E,S){return function(N,X,G){return g(N),N<=0?u(N):X!==void 0?typeof G=="string"?u(N).fill(X,G):u(N).fill(X):u(N)}(b,E,S)},c.allocUnsafe=function(b){return v(b)},c.allocUnsafeSlow=function(b){return v(b)},c.isBuffer=function(b){return b!=null&&b._isBuffer===!0&&b!==c.prototype},c.compare=function(b,E){if(ct(b,Uint8Array)&&(b=c.from(b,b.offset,b.byteLength)),ct(E,Uint8Array)&&(E=c.from(E,E.offset,E.byteLength)),!c.isBuffer(b)||!c.isBuffer(E))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(b===E)return 0;for(var S=b.length,N=E.length,X=0,G=Math.min(S,N);X<G;++X)if(b[X]!==E[X]){S=b[X],N=E[X];break}return S<N?-1:N<S?1:0},c.isEncoding=function(b){switch(String(b).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(b,E){if(!Array.isArray(b))throw new TypeError('"list" argument must be an Array of Buffers');if(b.length===0)return c.alloc(0);var S;if(E===void 0)for(E=0,S=0;S<b.length;++S)E+=b[S].length;var N=c.allocUnsafe(E),X=0;for(S=0;S<b.length;++S){var G=b[S];if(ct(G,Uint8Array)&&(G=c.from(G)),!c.isBuffer(G))throw new TypeError('"list" argument must be an Array of Buffers');G.copy(N,X),X+=G.length}return N},c.byteLength=y,c.prototype._isBuffer=!0,c.prototype.swap16=function(){var b=this.length;if(b%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var E=0;E<b;E+=2)_(this,E,E+1);return this},c.prototype.swap32=function(){var b=this.length;if(b%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var E=0;E<b;E+=4)_(this,E,E+3),_(this,E+1,E+2);return this},c.prototype.swap64=function(){var b=this.length;if(b%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var E=0;E<b;E+=8)_(this,E,E+7),_(this,E+1,E+6),_(this,E+2,E+5),_(this,E+3,E+4);return this},c.prototype.toString=function(){var b=this.length;return b===0?"":arguments.length===0?F(this,0,b):function(E,S,N){var X=!1;if((S===void 0||S<0)&&(S=0),S>this.length||((N===void 0||N>this.length)&&(N=this.length),N<=0)||(N>>>=0)<=(S>>>=0))return"";for(E||(E="utf8");;)switch(E){case"hex":return Y(this,S,N);case"utf8":case"utf-8":return F(this,S,N);case"ascii":return P(this,S,N);case"latin1":case"binary":return M(this,S,N);case"base64":return Q(this,S,N);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Z(this,S,N);default:if(X)throw new TypeError("Unknown encoding: "+E);E=(E+"").toLowerCase(),X=!0}}.apply(this,arguments)},c.prototype.toLocaleString=c.prototype.toString,c.prototype.equals=function(b){if(!c.isBuffer(b))throw new TypeError("Argument must be a Buffer");return this===b||c.compare(this,b)===0},c.prototype.inspect=function(){var b="",E=s.INSPECT_MAX_BYTES;return b=this.toString("hex",0,E).replace(/(.{2})/g,"$1 ").trim(),this.length>E&&(b+=" ... "),"<Buffer "+b+">"},c.prototype.compare=function(b,E,S,N,X){if(ct(b,Uint8Array)&&(b=c.from(b,b.offset,b.byteLength)),!c.isBuffer(b))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof b);if(E===void 0&&(E=0),S===void 0&&(S=b?b.length:0),N===void 0&&(N=0),X===void 0&&(X=this.length),E<0||S>b.length||N<0||X>this.length)throw new RangeError("out of range index");if(N>=X&&E>=S)return 0;if(N>=X)return-1;if(E>=S)return 1;if(E>>>=0,S>>>=0,N>>>=0,X>>>=0,this===b)return 0;for(var G=X-N,rt=S-E,yt=Math.min(G,rt),mt=this.slice(N,X),At=b.slice(E,S),Rt=0;Rt<yt;++Rt)if(mt[Rt]!==At[Rt]){G=mt[Rt],rt=At[Rt];break}return G<rt?-1:rt<G?1:0},c.prototype.includes=function(b,E,S){return this.indexOf(b,E,S)!==-1},c.prototype.indexOf=function(b,E,S){return A(this,b,E,S,!0)},c.prototype.lastIndexOf=function(b,E,S){return A(this,b,E,S,!1)},c.prototype.write=function(b,E,S,N){if(E===void 0)N="utf8",S=this.length,E=0;else if(S===void 0&&typeof E=="string")N=E,S=this.length,E=0;else{if(!isFinite(E))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");E>>>=0,isFinite(S)?(S>>>=0,N===void 0&&(N="utf8")):(N=S,S=void 0)}var X=this.length-E;if((S===void 0||S>X)&&(S=X),b.length>0&&(S<0||E<0)||E>this.length)throw new RangeError("Attempt to write outside buffer bounds");N||(N="utf8");for(var G=!1;;)switch(N){case"hex":return C(this,b,E,S);case"utf8":case"utf-8":return T(this,b,E,S);case"ascii":return I(this,b,E,S);case"latin1":case"binary":return D(this,b,E,S);case"base64":return B(this,b,E,S);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return V(this,b,E,S);default:if(G)throw new TypeError("Unknown encoding: "+N);N=(""+N).toLowerCase(),G=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var R=4096;function P(b,E,S){var N="";S=Math.min(b.length,S);for(var X=E;X<S;++X)N+=String.fromCharCode(127&b[X]);return N}function M(b,E,S){var N="";S=Math.min(b.length,S);for(var X=E;X<S;++X)N+=String.fromCharCode(b[X]);return N}function Y(b,E,S){var N=b.length;(!E||E<0)&&(E=0),(!S||S<0||S>N)&&(S=N);for(var X="",G=E;G<S;++G)X+=tt(b[G]);return X}function Z(b,E,S){for(var N=b.slice(E,S),X="",G=0;G<N.length;G+=2)X+=String.fromCharCode(N[G]+256*N[G+1]);return X}function nt(b,E,S){if(b%1!=0||b<0)throw new RangeError("offset is not uint");if(b+E>S)throw new RangeError("Trying to access beyond buffer length")}function j(b,E,S,N,X,G){if(!c.isBuffer(b))throw new TypeError('"buffer" argument must be a Buffer instance');if(E>X||E<G)throw new RangeError('"value" argument is out of bounds');if(S+N>b.length)throw new RangeError("Index out of range")}function H(b,E,S,N,X,G){if(S+N>b.length)throw new RangeError("Index out of range");if(S<0)throw new RangeError("Index out of range")}function $(b,E,S,N,X){return E=+E,S>>>=0,X||H(b,0,S,4),l.write(b,E,S,N,23,4),S+4}function K(b,E,S,N,X){return E=+E,S>>>=0,X||H(b,0,S,8),l.write(b,E,S,N,52,8),S+8}c.prototype.slice=function(b,E){var S=this.length;b=~~b,E=E===void 0?S:~~E,b<0?(b+=S)<0&&(b=0):b>S&&(b=S),E<0?(E+=S)<0&&(E=0):E>S&&(E=S),E<b&&(E=b);var N=this.subarray(b,E);return N.__proto__=c.prototype,N},c.prototype.readUIntLE=function(b,E,S){b>>>=0,E>>>=0,S||nt(b,E,this.length);for(var N=this[b],X=1,G=0;++G<E&&(X*=256);)N+=this[b+G]*X;return N},c.prototype.readUIntBE=function(b,E,S){b>>>=0,E>>>=0,S||nt(b,E,this.length);for(var N=this[b+--E],X=1;E>0&&(X*=256);)N+=this[b+--E]*X;return N},c.prototype.readUInt8=function(b,E){return b>>>=0,E||nt(b,1,this.length),this[b]},c.prototype.readUInt16LE=function(b,E){return b>>>=0,E||nt(b,2,this.length),this[b]|this[b+1]<<8},c.prototype.readUInt16BE=function(b,E){return b>>>=0,E||nt(b,2,this.length),this[b]<<8|this[b+1]},c.prototype.readUInt32LE=function(b,E){return b>>>=0,E||nt(b,4,this.length),(this[b]|this[b+1]<<8|this[b+2]<<16)+16777216*this[b+3]},c.prototype.readUInt32BE=function(b,E){return b>>>=0,E||nt(b,4,this.length),16777216*this[b]+(this[b+1]<<16|this[b+2]<<8|this[b+3])},c.prototype.readIntLE=function(b,E,S){b>>>=0,E>>>=0,S||nt(b,E,this.length);for(var N=this[b],X=1,G=0;++G<E&&(X*=256);)N+=this[b+G]*X;return N>=(X*=128)&&(N-=Math.pow(2,8*E)),N},c.prototype.readIntBE=function(b,E,S){b>>>=0,E>>>=0,S||nt(b,E,this.length);for(var N=E,X=1,G=this[b+--N];N>0&&(X*=256);)G+=this[b+--N]*X;return G>=(X*=128)&&(G-=Math.pow(2,8*E)),G},c.prototype.readInt8=function(b,E){return b>>>=0,E||nt(b,1,this.length),128&this[b]?-1*(255-this[b]+1):this[b]},c.prototype.readInt16LE=function(b,E){b>>>=0,E||nt(b,2,this.length);var S=this[b]|this[b+1]<<8;return 32768&S?4294901760|S:S},c.prototype.readInt16BE=function(b,E){b>>>=0,E||nt(b,2,this.length);var S=this[b+1]|this[b]<<8;return 32768&S?4294901760|S:S},c.prototype.readInt32LE=function(b,E){return b>>>=0,E||nt(b,4,this.length),this[b]|this[b+1]<<8|this[b+2]<<16|this[b+3]<<24},c.prototype.readInt32BE=function(b,E){return b>>>=0,E||nt(b,4,this.length),this[b]<<24|this[b+1]<<16|this[b+2]<<8|this[b+3]},c.prototype.readFloatLE=function(b,E){return b>>>=0,E||nt(b,4,this.length),l.read(this,b,!0,23,4)},c.prototype.readFloatBE=function(b,E){return b>>>=0,E||nt(b,4,this.length),l.read(this,b,!1,23,4)},c.prototype.readDoubleLE=function(b,E){return b>>>=0,E||nt(b,8,this.length),l.read(this,b,!0,52,8)},c.prototype.readDoubleBE=function(b,E){return b>>>=0,E||nt(b,8,this.length),l.read(this,b,!1,52,8)},c.prototype.writeUIntLE=function(b,E,S,N){b=+b,E>>>=0,S>>>=0,N||j(this,b,E,S,Math.pow(2,8*S)-1,0);var X=1,G=0;for(this[E]=255&b;++G<S&&(X*=256);)this[E+G]=b/X&255;return E+S},c.prototype.writeUIntBE=function(b,E,S,N){b=+b,E>>>=0,S>>>=0,N||j(this,b,E,S,Math.pow(2,8*S)-1,0);var X=S-1,G=1;for(this[E+X]=255&b;--X>=0&&(G*=256);)this[E+X]=b/G&255;return E+S},c.prototype.writeUInt8=function(b,E,S){return b=+b,E>>>=0,S||j(this,b,E,1,255,0),this[E]=255&b,E+1},c.prototype.writeUInt16LE=function(b,E,S){return b=+b,E>>>=0,S||j(this,b,E,2,65535,0),this[E]=255&b,this[E+1]=b>>>8,E+2},c.prototype.writeUInt16BE=function(b,E,S){return b=+b,E>>>=0,S||j(this,b,E,2,65535,0),this[E]=b>>>8,this[E+1]=255&b,E+2},c.prototype.writeUInt32LE=function(b,E,S){return b=+b,E>>>=0,S||j(this,b,E,4,4294967295,0),this[E+3]=b>>>24,this[E+2]=b>>>16,this[E+1]=b>>>8,this[E]=255&b,E+4},c.prototype.writeUInt32BE=function(b,E,S){return b=+b,E>>>=0,S||j(this,b,E,4,4294967295,0),this[E]=b>>>24,this[E+1]=b>>>16,this[E+2]=b>>>8,this[E+3]=255&b,E+4},c.prototype.writeIntLE=function(b,E,S,N){if(b=+b,E>>>=0,!N){var X=Math.pow(2,8*S-1);j(this,b,E,S,X-1,-X)}var G=0,rt=1,yt=0;for(this[E]=255&b;++G<S&&(rt*=256);)b<0&&yt===0&&this[E+G-1]!==0&&(yt=1),this[E+G]=(b/rt>>0)-yt&255;return E+S},c.prototype.writeIntBE=function(b,E,S,N){if(b=+b,E>>>=0,!N){var X=Math.pow(2,8*S-1);j(this,b,E,S,X-1,-X)}var G=S-1,rt=1,yt=0;for(this[E+G]=255&b;--G>=0&&(rt*=256);)b<0&&yt===0&&this[E+G+1]!==0&&(yt=1),this[E+G]=(b/rt>>0)-yt&255;return E+S},c.prototype.writeInt8=function(b,E,S){return b=+b,E>>>=0,S||j(this,b,E,1,127,-128),b<0&&(b=255+b+1),this[E]=255&b,E+1},c.prototype.writeInt16LE=function(b,E,S){return b=+b,E>>>=0,S||j(this,b,E,2,32767,-32768),this[E]=255&b,this[E+1]=b>>>8,E+2},c.prototype.writeInt16BE=function(b,E,S){return b=+b,E>>>=0,S||j(this,b,E,2,32767,-32768),this[E]=b>>>8,this[E+1]=255&b,E+2},c.prototype.writeInt32LE=function(b,E,S){return b=+b,E>>>=0,S||j(this,b,E,4,2147483647,-2147483648),this[E]=255&b,this[E+1]=b>>>8,this[E+2]=b>>>16,this[E+3]=b>>>24,E+4},c.prototype.writeInt32BE=function(b,E,S){return b=+b,E>>>=0,S||j(this,b,E,4,2147483647,-2147483648),b<0&&(b=4294967295+b+1),this[E]=b>>>24,this[E+1]=b>>>16,this[E+2]=b>>>8,this[E+3]=255&b,E+4},c.prototype.writeFloatLE=function(b,E,S){return $(this,b,E,!0,S)},c.prototype.writeFloatBE=function(b,E,S){return $(this,b,E,!1,S)},c.prototype.writeDoubleLE=function(b,E,S){return K(this,b,E,!0,S)},c.prototype.writeDoubleBE=function(b,E,S){return K(this,b,E,!1,S)},c.prototype.copy=function(b,E,S,N){if(!c.isBuffer(b))throw new TypeError("argument should be a Buffer");if(S||(S=0),N||N===0||(N=this.length),E>=b.length&&(E=b.length),E||(E=0),N>0&&N<S&&(N=S),N===S||b.length===0||this.length===0)return 0;if(E<0)throw new RangeError("targetStart out of bounds");if(S<0||S>=this.length)throw new RangeError("Index out of range");if(N<0)throw new RangeError("sourceEnd out of bounds");N>this.length&&(N=this.length),b.length-E<N-S&&(N=b.length-E+S);var X=N-S;if(this===b&&typeof Uint8Array.prototype.copyWithin=="function")this.copyWithin(E,S,N);else if(this===b&&S<E&&E<N)for(var G=X-1;G>=0;--G)b[G+E]=this[G+S];else Uint8Array.prototype.set.call(b,this.subarray(S,N),E);return X},c.prototype.fill=function(b,E,S,N){if(typeof b=="string"){if(typeof E=="string"?(N=E,E=0,S=this.length):typeof S=="string"&&(N=S,S=this.length),N!==void 0&&typeof N!="string")throw new TypeError("encoding must be a string");if(typeof N=="string"&&!c.isEncoding(N))throw new TypeError("Unknown encoding: "+N);if(b.length===1){var X=b.charCodeAt(0);(N==="utf8"&&X<128||N==="latin1")&&(b=X)}}else typeof b=="number"&&(b&=255);if(E<0||this.length<E||this.length<S)throw new RangeError("Out of range index");if(S<=E)return this;var G;if(E>>>=0,S=S===void 0?this.length:S>>>0,b||(b=0),typeof b=="number")for(G=E;G<S;++G)this[G]=b;else{var rt=c.isBuffer(b)?b:c.from(b,N),yt=rt.length;if(yt===0)throw new TypeError('The value "'+b+'" is invalid for argument "value"');for(G=0;G<S-E;++G)this[G+E]=rt[G%yt]}return this};var U=/[^+/0-9A-Za-z-_]/g;function tt(b){return b<16?"0"+b.toString(16):b.toString(16)}function at(b,E){var S;E=E||1/0;for(var N=b.length,X=null,G=[],rt=0;rt<N;++rt){if((S=b.charCodeAt(rt))>55295&&S<57344){if(!X){if(S>56319){(E-=3)>-1&&G.push(239,191,189);continue}if(rt+1===N){(E-=3)>-1&&G.push(239,191,189);continue}X=S;continue}if(S<56320){(E-=3)>-1&&G.push(239,191,189),X=S;continue}S=65536+(X-55296<<10|S-56320)}else X&&(E-=3)>-1&&G.push(239,191,189);if(X=null,S<128){if((E-=1)<0)break;G.push(S)}else if(S<2048){if((E-=2)<0)break;G.push(S>>6|192,63&S|128)}else if(S<65536){if((E-=3)<0)break;G.push(S>>12|224,S>>6&63|128,63&S|128)}else{if(!(S<1114112))throw new Error("Invalid code point");if((E-=4)<0)break;G.push(S>>18|240,S>>12&63|128,S>>6&63|128,63&S|128)}}return G}function et(b){return r.toByteArray(function(E){if((E=(E=E.split("=")[0]).trim().replace(U,"")).length<2)return"";for(;E.length%4!=0;)E+="=";return E}(b))}function ut(b,E,S,N){for(var X=0;X<N&&!(X+S>=E.length||X>=b.length);++X)E[X+S]=b[X];return X}function ct(b,E){return b instanceof E||b!=null&&b.constructor!=null&&b.constructor.name!=null&&b.constructor.name===E.name}function ot(b){return b!=b}}).call(this)}).call(this,i("buffer").Buffer)},{"base64-js":13,buffer:17,ieee754:23}],18:[function(i,a,s){(function(n){(function(){s.formatArgs=function(l){if(l[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+l[0]+(this.useColors?"%c ":" ")+"+"+a.exports.humanize(this.diff),!this.useColors)return;const o="color: "+this.color;l.splice(1,0,o,"color: inherit");let u=0,c=0;l[0].replace(/%[a-zA-Z%]/g,f=>{f!=="%%"&&f==="%c"&&(c=++u)}),l.splice(c,0,o)},s.save=function(l){try{l?s.storage.setItem("debug",l):s.storage.removeItem("debug")}catch{}},s.load=function(){let l;try{l=s.storage.getItem("debug")}catch{}return!l&&n!==void 0&&"env"in n&&(l=n.env.DEBUG),l},s.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+)/)},s.storage=function(){try{return localStorage}catch{}}(),s.destroy=(()=>{let l=!1;return()=>{l||(l=!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`."))}})(),s.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"],s.log=console.debug||console.log||(()=>{}),a.exports=i("./common")(s);const{formatters:r}=a.exports;r.j=function(l){try{return JSON.stringify(l)}catch(o){return"[UnexpectedJSONParseError]: "+o.message}}}).call(this)}).call(this,i("_process"))},{"./common":19,_process:50}],19:[function(i,a,s){a.exports=function(n){function r(u){let c,f,g,v=null;function m(...w){if(!m.enabled)return;const y=m,_=Number(new Date),A=_-(c||_);y.diff=A,y.prev=c,y.curr=_,c=_,w[0]=r.coerce(w[0]),typeof w[0]!="string"&&w.unshift("%O");let x=0;w[0]=w[0].replace(/%([a-zA-Z%])/g,(C,T)=>{if(C==="%%")return"%";x++;const I=r.formatters[T];if(typeof I=="function"){const D=w[x];C=I.call(y,D),w.splice(x,1),x--}return C}),r.formatArgs.call(y,w),(y.log||r.log).apply(y,w)}return m.namespace=u,m.useColors=r.useColors(),m.color=r.selectColor(u),m.extend=l,m.destroy=r.destroy,Object.defineProperty(m,"enabled",{enumerable:!0,configurable:!1,get:()=>v!==null?v:(f!==r.namespaces&&(f=r.namespaces,g=r.enabled(u)),g),set:w=>{v=w}}),typeof r.init=="function"&&r.init(m),m}function l(u,c){const f=r(this.namespace+(c===void 0?":":c)+u);return f.log=this.log,f}function o(u){return u.toString().substring(2,u.toString().length-2).replace(/\.\*\?$/,"*")}return r.debug=r,r.default=r,r.coerce=function(u){return u instanceof Error?u.stack||u.message:u},r.disable=function(){const u=[...r.names.map(o),...r.skips.map(o).map(c=>"-"+c)].join(",");return r.enable(""),u},r.enable=function(u){let c;r.save(u),r.namespaces=u,r.names=[],r.skips=[];const f=(typeof u=="string"?u:"").split(/[\s,]+/),g=f.length;for(c=0;c<g;c++)f[c]&&((u=f[c].replace(/\*/g,".*?"))[0]==="-"?r.skips.push(new RegExp("^"+u.substr(1)+"$")):r.names.push(new RegExp("^"+u+"$")))},r.enabled=function(u){if(u[u.length-1]==="*")return!0;let c,f;for(c=0,f=r.skips.length;c<f;c++)if(r.skips[c].test(u))return!1;for(c=0,f=r.names.length;c<f;c++)if(r.names[c].test(u))return!0;return!1},r.humanize=i("ms"),r.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(u=>{r[u]=n[u]}),r.names=[],r.skips=[],r.formatters={},r.selectColor=function(u){let c=0;for(let f=0;f<u.length;f++)c=(c<<5)-c+u.charCodeAt(f),c|=0;return r.colors[Math.abs(c)%r.colors.length]},r.enable(r.load()),r}},{ms:45}],20:[function(i,a,s){(function(n,r){(function(){var l=i("readable-stream"),o=i("end-of-stream"),u=i("inherits"),c=i("stream-shift"),f=r.from&&r.from!==Uint8Array.from?r.from([0]):new r([0]),g=function(y,_){y._corked?y.once("uncork",_):_()},v=function(y,_){return function(A){A?function(x,C){x._autoDestroy&&x.destroy(C)}(y,A.message==="premature close"?null:A):_&&!y._ended&&y.end()}},m=function(){},w=function(y,_,A){if(!(this instanceof w))return new w(y,_,A);l.Duplex.call(this,A),this._writable=null,this._readable=null,this._readable2=null,this._autoDestroy=!A||A.autoDestroy!==!1,this._forwardDestroy=!A||A.destroy!==!1,this._forwardEnd=!A||A.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,y&&this.setWritable(y),_&&this.setReadable(_)};u(w,l.Duplex),w.obj=function(y,_,A){return A||(A={}),A.objectMode=!0,A.highWaterMark=16,new w(y,_,A)},w.prototype.cork=function(){++this._corked==1&&this.emit("cork")},w.prototype.uncork=function(){this._corked&&--this._corked==0&&this.emit("uncork")},w.prototype.setWritable=function(y){if(this._unwrite&&this._unwrite(),this.destroyed)y&&y.destroy&&y.destroy();else if(y!==null&&y!==!1){var _=this,A=o(y,{writable:!0,readable:!1},v(this,this._forwardEnd)),x=function(){var C=_._ondrain;_._ondrain=null,C&&C()};this._unwrite&&n.nextTick(x),this._writable=y,this._writable.on("drain",x),this._unwrite=function(){_._writable.removeListener("drain",x),A()},this.uncork()}else this.end()},w.prototype.setReadable=function(y){if(this._unread&&this._unread(),this.destroyed)y&&y.destroy&&y.destroy();else{if(y===null||y===!1)return this.push(null),void this.resume();var _,A=this,x=o(y,{writable:!1,readable:!0},v(this)),C=function(){A._forward()},T=function(){A.push(null)};this._drained=!0,this._readable=y,this._readable2=y._readableState?y:(_=y,new l.Readable({objectMode:!0,highWaterMark:16}).wrap(_)),this._readable2.on("readable",C),this._readable2.on("end",T),this._unread=function(){A._readable2.removeListener("readable",C),A._readable2.removeListener("end",T),x()},this._forward()}},w.prototype._read=function(){this._drained=!0,this._forward()},w.prototype._forward=function(){if(!this._forwarding&&this._readable2&&this._drained){var y;for(this._forwarding=!0;this._drained&&(y=c(this._readable2))!==null;)this.destroyed||(this._drained=this.push(y));this._forwarding=!1}},w.prototype.destroy=function(y,_){if(_||(_=m),this.destroyed)return _(null);this.destroyed=!0;var A=this;n.nextTick(function(){A._destroy(y),_(null)})},w.prototype._destroy=function(y){if(y){var _=this._ondrain;this._ondrain=null,_?_(y):this.emit("error",y)}this._forwardDestroy&&(this._readable&&this._readable.destroy&&this._readable.destroy(),this._writable&&this._writable.destroy&&this._writable.destroy()),this.emit("close")},w.prototype._write=function(y,_,A){if(!this.destroyed)return this._corked?g(this,this._write.bind(this,y,_,A)):y===f?this._finish(A):this._writable?void(this._writable.write(y)===!1?this._ondrain=A:this.destroyed||A()):A()},w.prototype._finish=function(y){var _=this;this.emit("preend"),g(this,function(){var A,x;A=_._forwardEnd&&_._writable,x=function(){_._writableState.prefinished===!1&&(_._writableState.prefinished=!0),_.emit("prefinish"),g(_,y)},A?A._writableState&&A._writableState.finished?x():A._writableState?A.end(x):(A.end(),x()):x()})},w.prototype.end=function(y,_,A){return typeof y=="function"?this.end(null,null,y):typeof _=="function"?this.end(y,null,_):(this._ended=!0,y&&this.write(y),this._writableState.ending||this._writableState.destroyed||this.write(f),l.Writable.prototype.end.call(this,A))},a.exports=w}).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,s){(function(n){(function(){var r=i("once"),l=function(){},o=function(u,c,f){if(typeof c=="function")return o(u,null,c);c||(c={}),f=r(f||l);var g=u._writableState,v=u._readableState,m=c.readable||c.readable!==!1&&u.readable,w=c.writable||c.writable!==!1&&u.writable,y=!1,_=function(){u.writable||A()},A=function(){w=!1,m||f.call(u)},x=function(){m=!1,w||f.call(u)},C=function(V){f.call(u,V?new Error("exited with error code: "+V):null)},T=function(V){f.call(u,V)},I=function(){n.nextTick(D)},D=function(){if(!y)return(!m||v&&v.ended&&!v.destroyed)&&(!w||g&&g.ended&&!g.destroyed)?void 0:f.call(u,new Error("premature close"))},B=function(){u.req.on("finish",A)};return function(V){return V.setHeader&&typeof V.abort=="function"}(u)?(u.on("complete",A),u.on("abort",I),u.req?B():u.on("request",B)):w&&!g&&(u.on("end",_),u.on("close",_)),function(V){return V.stdio&&Array.isArray(V.stdio)&&V.stdio.length===3}(u)&&u.on("exit",C),u.on("end",x),u.on("finish",A),c.error!==!1&&u.on("error",T),u.on("close",I),function(){y=!0,u.removeListener("complete",A),u.removeListener("abort",I),u.removeListener("request",B),u.req&&u.req.removeListener("finish",A),u.removeListener("end",_),u.removeListener("close",_),u.removeListener("finish",A),u.removeListener("exit",C),u.removeListener("end",x),u.removeListener("error",T),u.removeListener("close",I)}};a.exports=o}).call(this)}).call(this,i("_process"))},{_process:50,once:48}],22:[function(i,a,s){var n=Object.create||function(x){var C=function(){};return C.prototype=x,new C},r=Object.keys||function(x){var C=[];for(var T in x)Object.prototype.hasOwnProperty.call(x,T)&&C.push(T);return T},l=Function.prototype.bind||function(x){var C=this;return function(){return C.apply(x,arguments)}};function o(){this._events&&Object.prototype.hasOwnProperty.call(this,"_events")||(this._events=n(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0}a.exports=o,o.EventEmitter=o,o.prototype._events=void 0,o.prototype._maxListeners=void 0;var u,c=10;try{var f={};Object.defineProperty&&Object.defineProperty(f,"x",{value:0}),u=f.x===0}catch{u=!1}function g(x){return x._maxListeners===void 0?o.defaultMaxListeners:x._maxListeners}function v(x,C,T,I){var D,B,V;if(typeof T!="function")throw new TypeError('"listener" argument must be a function');if((B=x._events)?(B.newListener&&(x.emit("newListener",C,T.listener?T.listener:T),B=x._events),V=B[C]):(B=x._events=n(null),x._eventsCount=0),V){if(typeof V=="function"?V=B[C]=I?[T,V]:[V,T]:I?V.unshift(T):V.push(T),!V.warned&&(D=g(x))&&D>0&&V.length>D){V.warned=!0;var Q=new Error("Possible EventEmitter memory leak detected. "+V.length+' "'+String(C)+'" listeners added. Use emitter.setMaxListeners() to increase limit.');Q.name="MaxListenersExceededWarning",Q.emitter=x,Q.type=C,Q.count=V.length,typeof console=="object"&&console.warn&&console.warn("%s: %s",Q.name,Q.message)}}else V=B[C]=T,++x._eventsCount;return x}function m(){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 x=new Array(arguments.length),C=0;C<x.length;++C)x[C]=arguments[C];this.listener.apply(this.target,x)}}function w(x,C,T){var I={fired:!1,wrapFn:void 0,target:x,type:C,listener:T},D=l.call(m,I);return D.listener=T,I.wrapFn=D,D}function y(x,C,T){var I=x._events;if(!I)return[];var D=I[C];return D?typeof D=="function"?T?[D.listener||D]:[D]:T?function(B){for(var V=new Array(B.length),Q=0;Q<V.length;++Q)V[Q]=B[Q].listener||B[Q];return V}(D):A(D,D.length):[]}function _(x){var C=this._events;if(C){var T=C[x];if(typeof T=="function")return 1;if(T)return T.length}return 0}function A(x,C){for(var T=new Array(C),I=0;I<C;++I)T[I]=x[I];return T}u?Object.defineProperty(o,"defaultMaxListeners",{enumerable:!0,get:function(){return c},set:function(x){if(typeof x!="number"||x<0||x!=x)throw new TypeError('"defaultMaxListeners" must be a positive number');c=x}}):o.defaultMaxListeners=c,o.prototype.setMaxListeners=function(x){if(typeof x!="number"||x<0||isNaN(x))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=x,this},o.prototype.getMaxListeners=function(){return g(this)},o.prototype.emit=function(x){var C,T,I,D,B,V,Q=x==="error";if(V=this._events)Q=Q&&V.error==null;else if(!Q)return!1;if(Q){if(arguments.length>1&&(C=arguments[1]),C instanceof Error)throw C;var F=new Error('Unhandled "error" event. ('+C+")");throw F.context=C,F}if(!(T=V[x]))return!1;var R=typeof T=="function";switch(I=arguments.length){case 1:(function(P,M,Y){if(M)P.call(Y);else for(var Z=P.length,nt=A(P,Z),j=0;j<Z;++j)nt[j].call(Y)})(T,R,this);break;case 2:(function(P,M,Y,Z){if(M)P.call(Y,Z);else for(var nt=P.length,j=A(P,nt),H=0;H<nt;++H)j[H].call(Y,Z)})(T,R,this,arguments[1]);break;case 3:(function(P,M,Y,Z,nt){if(M)P.call(Y,Z,nt);else for(var j=P.length,H=A(P,j),$=0;$<j;++$)H[$].call(Y,Z,nt)})(T,R,this,arguments[1],arguments[2]);break;case 4:(function(P,M,Y,Z,nt,j){if(M)P.call(Y,Z,nt,j);else for(var H=P.length,$=A(P,H),K=0;K<H;++K)$[K].call(Y,Z,nt,j)})(T,R,this,arguments[1],arguments[2],arguments[3]);break;default:for(D=new Array(I-1),B=1;B<I;B++)D[B-1]=arguments[B];(function(P,M,Y,Z){if(M)P.apply(Y,Z);else for(var nt=P.length,j=A(P,nt),H=0;H<nt;++H)j[H].apply(Y,Z)})(T,R,this,D)}return!0},o.prototype.addListener=function(x,C){return v(this,x,C,!1)},o.prototype.on=o.prototype.addListener,o.prototype.prependListener=function(x,C){return v(this,x,C,!0)},o.prototype.once=function(x,C){if(typeof C!="function")throw new TypeError('"listener" argument must be a function');return this.on(x,w(this,x,C)),this},o.prototype.prependOnceListener=function(x,C){if(typeof C!="function")throw new TypeError('"listener" argument must be a function');return this.prependListener(x,w(this,x,C)),this},o.prototype.removeListener=function(x,C){var T,I,D,B,V;if(typeof C!="function")throw new TypeError('"listener" argument must be a function');if(!(I=this._events))return this;if(!(T=I[x]))return this;if(T===C||T.listener===C)--this._eventsCount==0?this._events=n(null):(delete I[x],I.removeListener&&this.emit("removeListener",x,T.listener||C));else if(typeof T!="function"){for(D=-1,B=T.length-1;B>=0;B--)if(T[B]===C||T[B].listener===C){V=T[B].listener,D=B;break}if(D<0)return this;D===0?T.shift():function(Q,F){for(var R=F,P=R+1,M=Q.length;P<M;R+=1,P+=1)Q[R]=Q[P];Q.pop()}(T,D),T.length===1&&(I[x]=T[0]),I.removeListener&&this.emit("removeListener",x,V||C)}return this},o.prototype.removeAllListeners=function(x){var C,T,I;if(!(T=this._events))return this;if(!T.removeListener)return arguments.length===0?(this._events=n(null),this._eventsCount=0):T[x]&&(--this._eventsCount==0?this._events=n(null):delete T[x]),this;if(arguments.length===0){var D,B=r(T);for(I=0;I<B.length;++I)(D=B[I])!=="removeListener"&&this.removeAllListeners(D);return this.removeAllListeners("removeListener"),this._events=n(null),this._eventsCount=0,this}if(typeof(C=T[x])=="function")this.removeListener(x,C);else if(C)for(I=C.length-1;I>=0;I--)this.removeListener(x,C[I]);return this},o.prototype.listeners=function(x){return y(this,x,!0)},o.prototype.rawListeners=function(x){return y(this,x,!1)},o.listenerCount=function(x,C){return typeof x.listenerCount=="function"?x.listenerCount(C):_.call(x,C)},o.prototype.listenerCount=_,o.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]}},{}],23:[function(i,a,s){s.read=function(n,r,l,o,u){var c,f,g=8*u-o-1,v=(1<<g)-1,m=v>>1,w=-7,y=l?u-1:0,_=l?-1:1,A=n[r+y];for(y+=_,c=A&(1<<-w)-1,A>>=-w,w+=g;w>0;c=256*c+n[r+y],y+=_,w-=8);for(f=c&(1<<-w)-1,c>>=-w,w+=o;w>0;f=256*f+n[r+y],y+=_,w-=8);if(c===0)c=1-m;else{if(c===v)return f?NaN:1/0*(A?-1:1);f+=Math.pow(2,o),c-=m}return(A?-1:1)*f*Math.pow(2,c-o)},s.write=function(n,r,l,o,u,c){var f,g,v,m=8*c-u-1,w=(1<<m)-1,y=w>>1,_=u===23?Math.pow(2,-24)-Math.pow(2,-77):0,A=o?0:c-1,x=o?1:-1,C=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(g=isNaN(r)?1:0,f=w):(f=Math.floor(Math.log(r)/Math.LN2),r*(v=Math.pow(2,-f))<1&&(f--,v*=2),(r+=f+y>=1?_/v:_*Math.pow(2,1-y))*v>=2&&(f++,v/=2),f+y>=w?(g=0,f=w):f+y>=1?(g=(r*v-1)*Math.pow(2,u),f+=y):(g=r*Math.pow(2,y-1)*Math.pow(2,u),f=0));u>=8;n[l+A]=255&g,A+=x,g/=256,u-=8);for(f=f<<u|g,m+=u;m>0;n[l+A]=255&f,A+=x,f/=256,m-=8);n[l+A-x]|=128*C}},{}],24:[function(i,a,s){typeof Object.create=="function"?a.exports=function(n,r){r&&(n.super_=r,n.prototype=Object.create(r.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}))}:a.exports=function(n,r){if(r){n.super_=r;var l=function(){};l.prototype=r.prototype,n.prototype=new l,n.prototype.constructor=n}}},{}],25:[function(i,a,s){Object.defineProperty(s,"__esModule",{value:!0});var n=function(){function r(l,o){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=l,this.value=o}return r.prototype.rotateLeft=function(){var l=this.parent,o=this.brother,u=this.leftChild,c=this.rightChild;if(!c)throw new Error("unknown error");var f=c.leftChild,g=c.rightChild;return l&&(l.leftChild===this?l.leftChild=c:l.rightChild===this&&(l.rightChild=c)),c.parent=l,c.brother=o,c.leftChild=this,c.rightChild=g,o&&(o.brother=c),this.parent=c,this.brother=g,this.leftChild=u,this.rightChild=f,g&&(g.parent=c,g.brother=this),u&&(u.parent=this,u.brother=f),f&&(f.parent=this,f.brother=u),c},r.prototype.rotateRight=function(){var l=this.parent,o=this.brother,u=this.leftChild;if(!u)throw new Error("unknown error");var c=this.rightChild,f=u.leftChild,g=u.rightChild;return l&&(l.leftChild===this?l.leftChild=u:l.rightChild===this&&(l.rightChild=u)),u.parent=l,u.brother=o,u.leftChild=f,u.rightChild=this,o&&(o.brother=u),f&&(f.parent=u,f.brother=this),this.parent=u,this.brother=f,this.leftChild=g,this.rightChild=c,g&&(g.parent=this,g.brother=c),c&&(c.parent=this,c.brother=g),u},r.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},r.TreeNodeColorType={red:!0,black:!1},r}();Object.freeze(n),s.default=n},{}],26:[function(i,a,s){var n=this&&this.__generator||function(l,o){var u,c,f,g,v={label:0,sent:function(){if(1&f[0])throw f[1];return f[1]},trys:[],ops:[]};return g={next:m(0),throw:m(1),return:m(2)},typeof Symbol=="function"&&(g[Symbol.iterator]=function(){return this}),g;function m(w){return function(y){return function(_){if(u)throw new TypeError("Generator is already executing.");for(;v;)try{if(u=1,c&&(f=2&_[0]?c.return:_[0]?c.throw||((f=c.return)&&f.call(c),0):c.next)&&!(f=f.call(c,_[1])).done)return f;switch(c=0,f&&(_=[2&_[0],f.value]),_[0]){case 0:case 1:f=_;break;case 4:return v.label++,{value:_[1],done:!1};case 5:v.label++,c=_[1],_=[0];continue;case 7:_=v.ops.pop(),v.trys.pop();continue;default:if(!(f=(f=v.trys).length>0&&f[f.length-1])&&(_[0]===6||_[0]===2)){v=0;continue}if(_[0]===3&&(!f||_[1]>f[0]&&_[1]<f[3])){v.label=_[1];break}if(_[0]===6&&v.label<f[1]){v.label=f[1],f=_;break}if(f&&v.label<f[2]){v.label=f[2],v.ops.push(_);break}f[2]&&v.ops.pop(),v.trys.pop();continue}_=o.call(l,v)}catch(A){_=[6,A],c=0}finally{u=f=0}if(5&_[0])throw _[1];return{value:_[0]?_[1]:void 0,done:!0}}([w,y])}}};function r(l){var o=this;l===void 0&&(l=[]);var u=[],c=0,f=0,g=0,v=0,m=0,w=0;this.size=function(){return w},this.empty=function(){return w===0},this.clear=function(){c=g=f=v=m=w=0,_.call(this,r.bucketSize),w=0},this.front=function(){return u[c][f]},this.back=function(){return u[g][v]},this.forEach=function(A){if(!this.empty()){var x=0;if(c!==g){for(T=f;T<r.bucketSize;++T)A(u[c][T],x++);for(T=c+1;T<g;++T)for(var C=0;C<r.bucketSize;++C)A(u[T][C],x++);for(T=0;T<=v;++T)A(u[g][T],x++)}else for(var T=f;T<=v;++T)A(u[c][T],x++)}};var y=function(A){var x=c*r.bucketSize+f,C=x+A,T=g*r.bucketSize+v;if(C<x||C>T)throw new Error("pos should more than 0 and less than queue's size");return{curNodeBucketIndex:Math.floor(C/r.bucketSize),curNodePointerIndex:C%r.bucketSize}};this.getElementByPos=function(A){var x=y(A),C=x.curNodeBucketIndex,T=x.curNodePointerIndex;return u[C][T]},this.eraseElementByPos=function(A){var x=this;if(A<0||A>w)throw new Error("pos should more than 0 and less than queue's size");if(A===0)this.popFront();else if(A===this.size())this.popBack();else{for(var C=[],T=A+1;T<w;++T)C.push(this.getElementByPos(T));this.cut(A),this.popBack(),C.forEach(function(I){return x.pushBack(I)})}},this.eraseElementByValue=function(A){if(!this.empty()){var x=[];this.forEach(function(I){I!==A&&x.push(I)});for(var C=x.length,T=0;T<C;++T)this.setElementByPos(T,x[T]);this.cut(C-1)}};var _=function(A){for(var x=[],C=A*r.sigma,T=Math.max(Math.ceil(C/r.bucketSize),2),I=0;I<T;++I)x.push(new Array(r.bucketSize));var D=Math.ceil(A/r.bucketSize),B=Math.floor(T/2)-Math.floor(D/2),V=B,Q=0;if(this.size())for(I=0;I<D;++I){for(var F=0;F<r.bucketSize;++F)if(x[B+I][F]=this.front(),this.popFront(),this.empty()){V=B+I,Q=F;break}if(this.empty())break}u=x,c=B,f=0,g=V,v=Q,m=T,w=A};this.pushBack=function(A){this.empty()||(g===m-1&&v===r.bucketSize-1&&_.call(this,this.size()),v<r.bucketSize-1?++v:g<m-1&&(++g,v=0)),++w,u[g][v]=A},this.popBack=function(){this.empty()||(this.size()!==1&&(v>0?--v:c<g&&(--g,v=r.bucketSize-1)),w>0&&--w)},this.setElementByPos=function(A,x){var C=y(A),T=C.curNodeBucketIndex,I=C.curNodePointerIndex;u[T][I]=x},this.insert=function(A,x,C){var T=this;if(C===void 0&&(C=1),A===0)for(;C--;)this.pushFront(x);else if(A===this.size())for(;C--;)this.pushBack(x);else{for(var I=[],D=A;D<w;++D)I.push(this.getElementByPos(D));for(this.cut(A-1),D=0;D<C;++D)this.pushBack(x);I.forEach(function(B){return T.pushBack(B)})}},this.find=function(A){if(c===g){for(var x=f;x<=v;++x)if(u[c][x]===A)return!0;return!1}for(x=f;x<r.bucketSize;++x)if(u[c][x]===A)return!0;for(x=c+1;x<g;++x)for(var C=0;C<r.bucketSize;++C)if(u[x][C]===A)return!0;for(x=0;x<=v;++x)if(u[g][x]===A)return!0;return!1},this.reverse=function(){for(var A=0,x=w-1;A<x;){var C=this.getElementByPos(A);this.setElementByPos(A,this.getElementByPos(x)),this.setElementByPos(x,C),++A,--x}},this.unique=function(){if(!this.empty()){var A=[],x=this.front();this.forEach(function(T,I){I!==0&&T===x||(A.push(T),x=T)});for(var C=0;C<w;++C)this.setElementByPos(C,A[C]);this.cut(A.length-1)}},this.sort=function(A){var x=[];this.forEach(function(T){x.push(T)}),x.sort(A);for(var C=0;C<w;++C)this.setElementByPos(C,x[C])},this.pushFront=function(A){this.empty()||(c===0&&f===0&&_.call(this,this.size()),f>0?--f:c>0&&(--c,f=r.bucketSize-1)),++w,u[c][f]=A},this.popFront=function(){this.empty()||(this.size()!==1&&(f<r.bucketSize-1?++f:c<g&&(++c,f=0)),w>0&&--w)},this.shrinkToFit=function(){var A=this,x=[];this.forEach(function(D){x.push(D)});var C=x.length;u=[];for(var T=Math.ceil(C/r.bucketSize),I=0;I<T;++I)u.push(new Array(r.bucketSize));this.clear(),x.forEach(function(D){return A.pushBack(D)})},this.cut=function(A){if(A<0)this.clear();else{var x=y(A),C=x.curNodeBucketIndex,T=x.curNodePointerIndex;g=C,v=T,w=A+1}},this[Symbol.iterator]=function(){return function(){var A,x;return n(this,function(C){switch(C.label){case 0:if(w===0)return[2];if(c!==g)return[3,5];x=f,C.label=1;case 1:return x<=v?[4,u[c][x]]:[3,4];case 2:C.sent(),C.label=3;case 3:return++x,[3,1];case 4:return[2];case 5:x=f,C.label=6;case 6:return x<r.bucketSize?[4,u[c][x]]:[3,9];case 7:C.sent(),C.label=8;case 8:return++x,[3,6];case 9:x=c+1,C.label=10;case 10:if(!(x<g))return[3,15];A=0,C.label=11;case 11:return A<r.bucketSize?[4,u[x][A]]:[3,14];case 12:C.sent(),C.label=13;case 13:return++A,[3,11];case 14:return++x,[3,10];case 15:x=0,C.label=16;case 16:return x<=v?[4,u[g][x]]:[3,19];case 17:C.sent(),C.label=18;case 18:return++x,[3,16];case 19:return[2]}})}()},function(){var A=r.bucketSize;l.size?A=l.size():l.length&&(A=l.length);var x=A*r.sigma;m=Math.ceil(x/r.bucketSize),m=Math.max(m,3);for(var C=0;C<m;++C)u.push(new Array(r.bucketSize));var T=Math.ceil(A/r.bucketSize);c=Math.floor(m/2)-Math.floor(T/2),g=c,l.forEach(function(I){return o.pushBack(I)})}(),Object.freeze(this)}Object.defineProperty(s,"__esModule",{value:!0}),r.sigma=3,r.bucketSize=5e3,Object.freeze(r),s.default=r},{}],27:[function(i,a,s){var n=this&&this.__generator||function(c,f){var g,v,m,w,y={label:0,sent:function(){if(1&m[0])throw m[1];return m[1]},trys:[],ops:[]};return w={next:_(0),throw:_(1),return:_(2)},typeof Symbol=="function"&&(w[Symbol.iterator]=function(){return this}),w;function _(A){return function(x){return function(C){if(g)throw new TypeError("Generator is already executing.");for(;y;)try{if(g=1,v&&(m=2&C[0]?v.return:C[0]?v.throw||((m=v.return)&&m.call(v),0):v.next)&&!(m=m.call(v,C[1])).done)return m;switch(v=0,m&&(C=[2&C[0],m.value]),C[0]){case 0:case 1:m=C;break;case 4:return y.label++,{value:C[1],done:!1};case 5:y.label++,v=C[1],C=[0];continue;case 7:C=y.ops.pop(),y.trys.pop();continue;default:if(!(m=(m=y.trys).length>0&&m[m.length-1])&&(C[0]===6||C[0]===2)){y=0;continue}if(C[0]===3&&(!m||C[1]>m[0]&&C[1]<m[3])){y.label=C[1];break}if(C[0]===6&&y.label<m[1]){y.label=m[1],m=C;break}if(m&&y.label<m[2]){y.label=m[2],y.ops.push(C);break}m[2]&&y.ops.pop(),y.trys.pop();continue}C=f.call(c,y)}catch(T){C=[6,T],v=0}finally{g=m=0}if(5&C[0])throw C[1];return{value:C[0]?C[1]:void 0,done:!0}}([A,x])}}},r=this&&this.__values||function(c){var f=typeof Symbol=="function"&&Symbol.iterator,g=f&&c[f],v=0;if(g)return g.call(c);if(c&&typeof c.length=="number")return{next:function(){return c&&v>=c.length&&(c=void 0),{value:c&&c[v++],done:!c}}};throw new TypeError(f?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(s,"__esModule",{value:!0});var l=i("../LinkList/LinkList"),o=i("../Map/Map");function u(c,f,g){var v=this;if(c===void 0&&(c=[]),f===void 0&&(f=u.initSize),g=g||function(_){var A,x,C=0,T="";if(typeof _=="number")C=((C=Math.floor(_))<<5)-C,C&=C;else{T=typeof _!="string"?JSON.stringify(_):_;try{for(var I=r(T),D=I.next();!D.done;D=I.next())C=(C<<5)-C+D.value.charCodeAt(0),C&=C}catch(B){A={error:B}}finally{try{D&&!D.done&&(x=I.return)&&x.call(I)}finally{if(A)throw A.error}}}return C^=C>>>16},(f&f-1)!=0)throw new Error("initBucketNum must be 2 to the power of n");var m=0,w=[],y=Math.max(u.initSize,Math.min(u.maxSize,f));this.size=function(){return m},this.empty=function(){return m===0},this.clear=function(){m=0,y=f,w=[]},this.forEach=function(_){var A=0;w.forEach(function(x){x.forEach(function(C){_(C,A++)})})},this.setElement=function(_,A){var x,C;if(_==null)throw new Error("to avoid some unnecessary errors, we don't suggest you insert null or undefined here");if(A!=null){var T=g(_)&y-1;if(w[T]){var I=w[T].size();if(w[T]instanceof l.default){try{for(var D=r(w[T]),B=D.next();!B.done;B=D.next()){var V=B.value;if(V.key===_)return void(V.value=A)}}catch(F){x={error:F}}finally{try{B&&!B.done&&(C=D.return)&&C.call(D)}finally{if(x)throw x.error}}w[T].pushBack({key:_,value:A}),w[T].size()>=u.treeifyThreshold&&(w[T]=new o.default(w[T]))}else w[T].setElement(_,A);var Q=w[T].size();m+=Q-I}else++m,w[T]=new l.default([{key:_,value:A}]);m>y*u.sigma&&function(F){if(!(F>=u.maxSize)){y=2*F;var R=[];w.forEach(function(P,M){if(!P.empty()){if(P instanceof l.default&&P.size()===1){var Y=P.front(),Z=Y.key,nt=Y.value;R[g(Z)&y-1]=new l.default([{key:Z,value:nt}])}else if(P instanceof o.default){var j=new l.default,H=new l.default;P.forEach(function(U){(g(U.key)&F)==0?j.pushBack(U):H.pushBack(U)}),j.size()>u.untreeifyThreshold?R[M]=new o.default(j):j.size()&&(R[M]=j),H.size()>u.untreeifyThreshold?R[M+F]=new o.default(H):H.size()&&(R[M+F]=H)}else{var $=new l.default,K=new l.default;P.forEach(function(U){(g(U.key)&F)==0?$.pushBack(U):K.pushBack(U)}),$.size()&&(R[M]=$),K.size()&&(R[M+F]=K)}w[M].clear()}}),w=R}}.call(this,y)}else this.eraseElementByKey(_)},this.getElementByKey=function(_){var A,x,C=g(_)&y-1;if(w[C]){if(w[C]instanceof o.default)return w[C].getElementByKey(_);try{for(var T=r(w[C]),I=T.next();!I.done;I=T.next()){var D=I.value;if(D.key===_)return D.value}}catch(B){A={error:B}}finally{try{I&&!I.done&&(x=T.return)&&x.call(T)}finally{if(A)throw A.error}}}},this.eraseElementByKey=function(_){var A,x,C=g(_)&y-1;if(w[C]){var T=w[C].size();if(w[C]instanceof o.default)w[C].eraseElementByKey(_),w[C].size()<=u.untreeifyThreshold&&(w[C]=new l.default(w[C]));else{var I=-1;try{for(var D=r(w[C]),B=D.next();!B.done;B=D.next())if(++I,B.value.key===_){w[C].eraseElementByPos(I);break}}catch(Q){A={error:Q}}finally{try{B&&!B.done&&(x=D.return)&&x.call(D)}finally{if(A)throw A.error}}}var V=w[C].size();m+=V-T}},this.find=function(_){var A,x,C=g(_)&y-1;if(!w[C])return!1;if(w[C]instanceof o.default)return w[C].find(_);try{for(var T=r(w[C]),I=T.next();!I.done;I=T.next())if(I.value.key===_)return!0}catch(D){A={error:D}}finally{try{I&&!I.done&&(x=T.return)&&x.call(T)}finally{if(A)throw A.error}}return!1},this[Symbol.iterator]=function(){return function(){var _,A,x,C,T,I;return n(this,function(D){switch(D.label){case 0:_=0,D.label=1;case 1:if(!(_<y))return[3,10];for(;_<y&&!w[_];)++_;if(_>=y)return[3,10];D.label=2;case 2:D.trys.push([2,7,8,9]),T=void 0,A=r(w[_]),x=A.next(),D.label=3;case 3:return x.done?[3,6]:[4,x.value];case 4:D.sent(),D.label=5;case 5:return x=A.next(),[3,3];case 6:return[3,9];case 7:return C=D.sent(),T={error:C},[3,9];case 8:try{x&&!x.done&&(I=A.return)&&I.call(A)}finally{if(T)throw T.error}return[7];case 9:return++_,[3,1];case 10:return[2]}})}()},c.forEach(function(_){var A=_.key,x=_.value;return v.setElement(A,x)}),Object.freeze(this)}u.initSize=16,u.maxSize=1<<30,u.sigma=.75,u.treeifyThreshold=8,u.untreeifyThreshold=6,u.minTreeifySize=64,Object.freeze(u),s.default=u},{"../LinkList/LinkList":29,"../Map/Map":30}],28:[function(i,a,s){var n=this&&this.__generator||function(c,f){var g,v,m,w,y={label:0,sent:function(){if(1&m[0])throw m[1];return m[1]},trys:[],ops:[]};return w={next:_(0),throw:_(1),return:_(2)},typeof Symbol=="function"&&(w[Symbol.iterator]=function(){return this}),w;function _(A){return function(x){return function(C){if(g)throw new TypeError("Generator is already executing.");for(;y;)try{if(g=1,v&&(m=2&C[0]?v.return:C[0]?v.throw||((m=v.return)&&m.call(v),0):v.next)&&!(m=m.call(v,C[1])).done)return m;switch(v=0,m&&(C=[2&C[0],m.value]),C[0]){case 0:case 1:m=C;break;case 4:return y.label++,{value:C[1],done:!1};case 5:y.label++,v=C[1],C=[0];continue;case 7:C=y.ops.pop(),y.trys.pop();continue;default:if(!(m=(m=y.trys).length>0&&m[m.length-1])&&(C[0]===6||C[0]===2)){y=0;continue}if(C[0]===3&&(!m||C[1]>m[0]&&C[1]<m[3])){y.label=C[1];break}if(C[0]===6&&y.label<m[1]){y.label=m[1],m=C;break}if(m&&y.label<m[2]){y.label=m[2],y.ops.push(C);break}m[2]&&y.ops.pop(),y.trys.pop();continue}C=f.call(c,y)}catch(T){C=[6,T],v=0}finally{g=m=0}if(5&C[0])throw C[1];return{value:C[0]?C[1]:void 0,done:!0}}([A,x])}}},r=this&&this.__values||function(c){var f=typeof Symbol=="function"&&Symbol.iterator,g=f&&c[f],v=0;if(g)return g.call(c);if(c&&typeof c.length=="number")return{next:function(){return c&&v>=c.length&&(c=void 0),{value:c&&c[v++],done:!c}}};throw new TypeError(f?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(s,"__esModule",{value:!0});var l=i("../Set/Set"),o=i("../LinkList/LinkList");function u(c,f,g){var v=this;if(c===void 0&&(c=[]),f===void 0&&(f=u.initSize),g=g||function(_){var A=0,x="";if(typeof _=="number")A=((A=Math.floor(_))<<5)-A,A&=A;else{x=typeof _!="string"?JSON.stringify(_):_;for(var C=0;C<x.length;C++)A=(A<<5)-A+x.charCodeAt(C),A&=A}return A^=A>>>16},(f&f-1)!=0)throw new Error("initBucketNum must be 2 to the power of n");var m=0,w=[],y=Math.max(u.initSize,Math.min(u.maxSize,f));this.size=function(){return m},this.empty=function(){return m===0},this.clear=function(){m=0,y=f,w=[]},this.forEach=function(_){var A=0;w.forEach(function(x){x.forEach(function(C){_(C,A++)})})},this.insert=function(_){if(_==null)throw new Error("to avoid some unnecessary errors, we don't suggest you insert null or undefined here");var A=g(_)&y-1;if(w[A]){var x=w[A].size();if(w[A]instanceof o.default){if(w[A].find(_))return;w[A].pushBack(_),w[A].size()>=u.treeifyThreshold&&(w[A]=new l.default(w[A]))}else w[A].insert(_);var C=w[A].size();m+=C-x}else w[A]=new o.default([_]),++m;m>y*u.sigma&&function(T){if(!(T>=u.maxSize)){y=2*T;var I=[];w.forEach(function(D,B){if(!D.empty()){if(D instanceof o.default&&D.size()===1){var V=D.front();if(V===void 0)throw new Error("unknown error");I[g(V)&y-1]=new o.default([V])}else if(D instanceof l.default){var Q=new o.default,F=new o.default;D.forEach(function(M){(g(M)&T)==0?Q.pushBack(M):F.pushBack(M)}),Q.size()>u.untreeifyThreshold?I[B]=new l.default(Q):Q.size()&&(I[B]=Q),F.size()>u.untreeifyThreshold?I[B+T]=new l.default(F):F.size()&&(I[B+T]=F)}else{var R=new o.default,P=new o.default;D.forEach(function(M){(g(M)&T)==0?R.pushBack(M):P.pushBack(M)}),R.size()&&(I[B]=R),P.size()&&(I[B+T]=P)}w[B].clear()}}),w=I}}.call(this,y)},this.eraseElementByValue=function(_){var A=g(_)&y-1;if(w[A]){var x=w[A].size();w[A].eraseElementByValue(_),w[A]instanceof l.default&&w[A].size()<=u.untreeifyThreshold&&(w[A]=new o.default(w[A]));var C=w[A].size();m+=C-x}},this.find=function(_){var A=g(_)&y-1;return!!w[A]&&w[A].find(_)},this[Symbol.iterator]=function(){return function(){var _,A,x,C,T,I;return n(this,function(D){switch(D.label){case 0:_=0,D.label=1;case 1:if(!(_<y))return[3,10];for(;_<y&&!w[_];)++_;if(_>=y)return[3,10];D.label=2;case 2:D.trys.push([2,7,8,9]),T=void 0,A=r(w[_]),x=A.next(),D.label=3;case 3:return x.done?[3,6]:[4,x.value];case 4:D.sent(),D.label=5;case 5:return x=A.next(),[3,3];case 6:return[3,9];case 7:return C=D.sent(),T={error:C},[3,9];case 8:try{x&&!x.done&&(I=A.return)&&I.call(A)}finally{if(T)throw T.error}return[7];case 9:return++_,[3,1];case 10:return[2]}})}()},c.forEach(function(_){return v.insert(_)}),Object.freeze(this)}u.initSize=16,u.maxSize=1<<30,u.sigma=.75,u.treeifyThreshold=8,u.untreeifyThreshold=6,u.minTreeifySize=64,Object.freeze(u),s.default=u},{"../LinkList/LinkList":29,"../Set/Set":33}],29:[function(i,a,s){var n=this&&this.__generator||function(o,u){var c,f,g,v,m={label:0,sent:function(){if(1&g[0])throw g[1];return g[1]},trys:[],ops:[]};return v={next:w(0),throw:w(1),return:w(2)},typeof Symbol=="function"&&(v[Symbol.iterator]=function(){return this}),v;function w(y){return function(_){return function(A){if(c)throw new TypeError("Generator is already executing.");for(;m;)try{if(c=1,f&&(g=2&A[0]?f.return:A[0]?f.throw||((g=f.return)&&g.call(f),0):f.next)&&!(g=g.call(f,A[1])).done)return g;switch(f=0,g&&(A=[2&A[0],g.value]),A[0]){case 0:case 1:g=A;break;case 4:return m.label++,{value:A[1],done:!1};case 5:m.label++,f=A[1],A=[0];continue;case 7:A=m.ops.pop(),m.trys.pop();continue;default:if(!(g=(g=m.trys).length>0&&g[g.length-1])&&(A[0]===6||A[0]===2)){m=0;continue}if(A[0]===3&&(!g||A[1]>g[0]&&A[1]<g[3])){m.label=A[1];break}if(A[0]===6&&m.label<g[1]){m.label=g[1],g=A;break}if(g&&m.label<g[2]){m.label=g[2],m.ops.push(A);break}g[2]&&m.ops.pop(),m.trys.pop();continue}A=u.call(o,m)}catch(x){A=[6,x],f=0}finally{c=g=0}if(5&A[0])throw A[1];return{value:A[0]?A[1]:void 0,done:!0}}([y,_])}}};Object.defineProperty(s,"__esModule",{value:!0});var r=function(){return function(o){this.value=void 0,this.pre=void 0,this.next=void 0,this.value=o}}();function l(o){var u=this;o===void 0&&(o=[]);var c=0,f=void 0,g=void 0;this.size=function(){return c},this.empty=function(){return c===0},this.clear=function(){f=g=void 0,c=0},this.front=function(){return f==null?void 0:f.value},this.back=function(){return g==null?void 0:g.value},this.forEach=function(v){for(var m=f,w=0;m;){if(m.value===void 0)throw new Error("unknown error");v(m.value,w++),m=m.next}},this.getElementByPos=function(v){if(v<0||v>=c)throw new Error("pos must more then 0 and less then the list length");for(var m=f;v--&&m;)m=m.next;if(!m||m.value===void 0)throw new Error("unknown error");return m.value},this.eraseElementByPos=function(v){if(v<0||v>=c)throw new Error("erase pos must more then 0 and less then the list length");if(v===0)this.popFront();else if(v===c-1)this.popBack();else{for(var m=f;v--;){if(!(m!=null&&m.next))throw new Error("unknown error");m=m.next}if(!m||!m.pre||!m.next)throw new Error("unknown error");var w=m.pre,y=m.next;y.pre=w,w.next=y,c>0&&--c}},this.eraseElementByValue=function(v){for(;f&&f.value===v;)this.popFront();for(;g&&g.value===v;)this.popBack();if(f)for(var m=f;m;){if(m.value===v){var w=m.pre,y=m.next;y&&(y.pre=w),w&&(w.next=y),c>0&&--c}m=m.next}},this.pushBack=function(v){if(v==null)throw new Error("you can't push null or undefined here");++c;var m=new r(v);g?(g.next=m,m.pre=g,g=m):f=g=m},this.popBack=function(){g&&(c>0&&--c,g&&(f===g?f=g=void 0:(g=g.pre)&&(g.next=void 0)))},this.setElementByPos=function(v,m){if(m==null)throw new Error("you can't set null or undefined here");if(v<0||v>=c)throw new Error("pos must more then 0 and less then the list length");for(var w=f;v--;){if(!w)throw new Error("unknown error");w=w.next}w&&(w.value=m)},this.insert=function(v,m,w){if(w===void 0&&(w=1),m==null)throw new Error("you can't insert null or undefined here");if(v<0||v>c)throw new Error("insert pos must more then 0 and less then or equal to the list length");if(w<0)throw new Error("insert size must more than 0");if(v===0)for(;w--;)this.pushFront(m);else if(v===c)for(;w--;)this.pushBack(m);else{for(var y=f,_=1;_<v;++_){if(!(y!=null&&y.next))throw new Error("unknown error");y=y==null?void 0:y.next}if(!y)throw new Error("unknown error");var A=y.next;for(c+=w;w--;)y.next=new r(m),y.next.pre=y,y=y.next;y.next=A,A&&(A.pre=y)}},this.find=function(v){for(var m=f;m;){if(m.value===v)return!0;m=m.next}return!1},this.reverse=function(){for(var v=f,m=g,w=0;v&&m&&2*w<c;){var y=v.value;v.value=m.value,m.value=y,v=v.next,m=m.pre,++w}},this.unique=function(){for(var v=f;v;){for(var m=v;m&&m.next&&m.value===m.next.value;)m=m.next,c>0&&--c;v.next=m.next,v.next&&(v.next.pre=v),v=v.next}},this.sort=function(v){var m=[];this.forEach(function(y){m.push(y)}),m.sort(v);var w=f;m.forEach(function(y){w&&(w.value=y,w=w.next)})},this.pushFront=function(v){if(v==null)throw new Error("you can't push null or undefined here");++c;var m=new r(v);f?(m.next=f,f.pre=m,f=m):f=g=m},this.popFront=function(){f&&(c>0&&--c,f&&(f===g?f=g=void 0:(f=f.next)&&(f.pre=void 0)))},this.merge=function(v){var m=this,w=f;v.forEach(function(y){for(;w&&w.value!==void 0&&w.value<=y;)w=w.next;if(w===void 0)m.pushBack(y),w=g;else if(w===f)m.pushFront(y),w=f;else{++c;var _=w.pre;_&&(_.next=new r(y),_.next.pre=_,_.next.next=w,w&&(w.pre=_.next))}})},this[Symbol.iterator]=function(){return function(){var v;return n(this,function(m){switch(m.label){case 0:v=f,m.label=1;case 1:if(v===void 0)return[3,3];if(!v.value)throw new Error("unknown error");return[4,v.value];case 2:return m.sent(),v=v.next,[3,1];case 3:return[2]}})}()},o.forEach(function(v){return u.pushBack(v)}),Object.freeze(this)}Object.freeze(l),s.default=l},{}],30:[function(i,a,s){var n=this&&this.__generator||function(u,c){var f,g,v,m,w={label:0,sent:function(){if(1&v[0])throw v[1];return v[1]},trys:[],ops:[]};return m={next:y(0),throw:y(1),return:y(2)},typeof Symbol=="function"&&(m[Symbol.iterator]=function(){return this}),m;function y(_){return function(A){return function(x){if(f)throw new TypeError("Generator is already executing.");for(;w;)try{if(f=1,g&&(v=2&x[0]?g.return:x[0]?g.throw||((v=g.return)&&v.call(g),0):g.next)&&!(v=v.call(g,x[1])).done)return v;switch(g=0,v&&(x=[2&x[0],v.value]),x[0]){case 0:case 1:v=x;break;case 4:return w.label++,{value:x[1],done:!1};case 5:w.label++,g=x[1],x=[0];continue;case 7:x=w.ops.pop(),w.trys.pop();continue;default:if(!(v=(v=w.trys).length>0&&v[v.length-1])&&(x[0]===6||x[0]===2)){w=0;continue}if(x[0]===3&&(!v||x[1]>v[0]&&x[1]<v[3])){w.label=x[1];break}if(x[0]===6&&w.label<v[1]){w.label=v[1],v=x;break}if(v&&w.label<v[2]){w.label=v[2],w.ops.push(x);break}v[2]&&w.ops.pop(),w.trys.pop();continue}x=c.call(u,w)}catch(C){x=[6,C],g=0}finally{f=v=0}if(5&x[0])throw x[1];return{value:x[0]?x[1]:void 0,done:!0}}([_,A])}}},r=this&&this.__values||function(u){var c=typeof Symbol=="function"&&Symbol.iterator,f=c&&u[c],g=0;if(f)return f.call(u);if(u&&typeof u.length=="number")return{next:function(){return u&&g>=u.length&&(u=void 0),{value:u&&u[g++],done:!u}}};throw new TypeError(c?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(s,"__esModule",{value:!0});var l=i("../Base/TreeNode");function o(u,c){var f=this;u===void 0&&(u=[]),c=c||function(F,R){return F<R?-1:F>R?1:0};var g=0,v=new l.default;v.color=l.default.TreeNodeColorType.black,this.size=function(){return g},this.empty=function(){return g===0},this.clear=function(){g=0,v.key=v.value=void 0,v.leftChild=v.rightChild=v.brother=void 0};var m=function(F){if(!F||F.key===void 0)throw new Error("unknown error");return F.leftChild?m(F.leftChild):F},w=function(F){if(!F||F.key===void 0)throw new Error("unknown error");return F.rightChild?w(F.rightChild):F};this.front=function(){if(!this.empty()){var F=m(v);if(F.key===void 0||F.value===void 0)throw new Error("unknown error");return{key:F.key,value:F.value}}},this.back=function(){if(!this.empty()){var F=w(v);if(F.key===void 0||F.value===void 0)throw new Error("unknown error");return{key:F.key,value:F.value}}},this.forEach=function(F){var R,P,M=0;try{for(var Y=r(this),Z=Y.next();!Z.done;Z=Y.next())F(Z.value,M++)}catch(nt){R={error:nt}}finally{try{Z&&!Z.done&&(P=Y.return)&&P.call(Y)}finally{if(R)throw R.error}}},this.getElementByPos=function(F){var R,P;if(F<0||F>=this.size())throw new Error("pos must more than 0 and less than set's size");var M=0;try{for(var Y=r(this),Z=Y.next();!Z.done;Z=Y.next()){var nt=Z.value;if(M===F)return nt;++M}}catch(j){R={error:j}}finally{try{Z&&!Z.done&&(P=Y.return)&&P.call(Y)}finally{if(R)throw R.error}}throw new Error("unknown Error")};var y=function(F,R){if(F&&F.key!==void 0&&F.value!==void 0){var P=c(F.key,R);return P===0?{key:F.key,value:F.value}:P<0?y(F.rightChild,R):y(F.leftChild,R)||{key:F.key,value:F.value}}};this.lowerBound=function(F){return y(v,F)};var _=function(F,R){if(F&&F.key!==void 0&&F.value!==void 0)return c(F.key,R)<=0?_(F.rightChild,R):_(F.leftChild,R)||{key:F.key,value:F.value}};this.upperBound=function(F){return _(v,F)};var A=function(F,R){if(F&&F.key!==void 0&&F.value!==void 0){var P=c(F.key,R);return P===0?{key:F.key,value:F.value}:P>0?A(F.leftChild,R):A(F.rightChild,R)||{key:F.key,value:F.value}}};this.reverseLowerBound=function(F){return A(v,F)};var x=function(F,R){if(F&&F.key!==void 0&&F.value!==void 0)return c(F.key,R)>=0?x(F.leftChild,R):x(F.rightChild,R)||{key:F.key,value:F.value}};this.reverseUpperBound=function(F){return x(v,F)};var C=function(F){var R=F.parent;if(!R){if(F===v)return;throw new Error("unknown error")}if(F.color!==l.default.TreeNodeColorType.red){var P=F.brother;if(!P)throw new Error("unknown error");if(F===R.leftChild)if(P.color===l.default.TreeNodeColorType.red){P.color=l.default.TreeNodeColorType.black,R.color=l.default.TreeNodeColorType.red;var M=R.rotateLeft();v===R&&(v=M),C(F)}else P.color===l.default.TreeNodeColorType.black&&(P.rightChild&&P.rightChild.color===l.default.TreeNodeColorType.red?(P.color=R.color,R.color=l.default.TreeNodeColorType.black,P.rightChild&&(P.rightChild.color=l.default.TreeNodeColorType.black),M=R.rotateLeft(),v===R&&(v=M),F.color=l.default.TreeNodeColorType.black):P.rightChild&&P.rightChild.color!==l.default.TreeNodeColorType.black||!P.leftChild||P.leftChild.color!==l.default.TreeNodeColorType.red?P.leftChild&&P.leftChild.color!==l.default.TreeNodeColorType.black||P.rightChild&&P.rightChild.color!==l.default.TreeNodeColorType.black||(P.color=l.default.TreeNodeColorType.red,C(R)):(P.color=l.default.TreeNodeColorType.red,P.leftChild&&(P.leftChild.color=l.default.TreeNodeColorType.black),M=P.rotateRight(),v===P&&(v=M),C(F)));else F===R.rightChild&&(P.color===l.default.TreeNodeColorType.red?(P.color=l.default.TreeNodeColorType.black,R.color=l.default.TreeNodeColorType.red,M=R.rotateRight(),v===R&&(v=M),C(F)):P.color===l.default.TreeNodeColorType.black&&(P.leftChild&&P.leftChild.color===l.default.TreeNodeColorType.red?(P.color=R.color,R.color=l.default.TreeNodeColorType.black,P.leftChild&&(P.leftChild.color=l.default.TreeNodeColorType.black),M=R.rotateRight(),v===R&&(v=M),F.color=l.default.TreeNodeColorType.black):P.leftChild&&P.leftChild.color!==l.default.TreeNodeColorType.black||!P.rightChild||P.rightChild.color!==l.default.TreeNodeColorType.red?P.leftChild&&P.leftChild.color!==l.default.TreeNodeColorType.black||P.rightChild&&P.rightChild.color!==l.default.TreeNodeColorType.black||(P.color=l.default.TreeNodeColorType.red,C(R)):(P.color=l.default.TreeNodeColorType.red,P.rightChild&&(P.rightChild.color=l.default.TreeNodeColorType.black),M=P.rotateLeft(),v===P&&(v=M),C(F))))}else F.color=l.default.TreeNodeColorType.black},T=function(F){for(var R=F;R.leftChild||R.rightChild;){if(R.rightChild){R=m(R.rightChild);var P=F.key;F.key=R.key,R.key=P;var M=F.value;F.value=R.value,R.value=M,F=R}R.leftChild&&(R=w(R.leftChild),P=F.key,F.key=R.key,R.key=P,M=F.value,F.value=R.value,R.value=M,F=R)}C(R),R&&R.remove(),--g,v.color=l.default.TreeNodeColorType.black},I=function(F,R){return!(!F||F.key===void 0)&&(!!I(F.leftChild,R)||!!R(F)||I(F.rightChild,R))};this.eraseElementByPos=function(F){if(F<0||F>=g)throw new Error("pos must more than 0 and less than set's size");var R=0;I(v,function(P){return F===R?(T(P),!0):(++R,!1)})},this.eraseElementByKey=function(F){if(!this.empty()){var R=V(v,F);R!==void 0&&R.key!==void 0&&c(R.key,F)===0&&T(R)}};var D=function(F,R){if(!F||F.key===void 0)throw new Error("unknown error");var P=c(R,F.key);return P<0?F.leftChild?D(F.leftChild,R):(F.leftChild=new l.default,F.leftChild.parent=F,F.leftChild.brother=F.rightChild,F.rightChild&&(F.rightChild.brother=F.leftChild),F.leftChild):P>0?F.rightChild?D(F.rightChild,R):(F.rightChild=new l.default,F.rightChild.parent=F,F.rightChild.brother=F.leftChild,F.leftChild&&(F.leftChild.brother=F.rightChild),F.rightChild):F},B=function(F){var R=F.parent;if(!R){if(F===v)return;throw new Error("unknown error")}if(R.color!==l.default.TreeNodeColorType.black&&R.color===l.default.TreeNodeColorType.red){var P=R.brother,M=R.parent;if(!M)throw new Error("unknown error");if(P&&P.color===l.default.TreeNodeColorType.red)P.color=R.color=l.default.TreeNodeColorType.black,M.color=l.default.TreeNodeColorType.red,B(M);else if(!P||P.color===l.default.TreeNodeColorType.black)if(R===M.leftChild)if(F===R.leftChild){R.color=l.default.TreeNodeColorType.black,M.color=l.default.TreeNodeColorType.red;var Y=M.rotateRight();M===v&&(v=Y)}else F===R.rightChild&&(Y=R.rotateLeft(),M===v&&(v=Y),B(R));else R===M.rightChild&&(F===R.leftChild?(Y=R.rotateRight(),M===v&&(v=Y),B(R)):F===R.rightChild&&(R.color=l.default.TreeNodeColorType.black,M.color=l.default.TreeNodeColorType.red,Y=M.rotateLeft(),M===v&&(v=Y)))}};this.setElement=function(F,R){if(F==null)throw new Error("to avoid some unnecessary errors, we don't suggest you insert null or undefined here");if(R!=null){if(this.empty())return++g,v.key=F,v.value=R,void(v.color=l.default.TreeNodeColorType.black);var P=D(v,F);P.key===void 0||c(P.key,F)!==0?(++g,P.key=F,P.value=R,B(P),v.color=l.default.TreeNodeColorType.black):P.value=R}else this.eraseElementByKey(F)};var V=function(F,R){if(F&&F.key!==void 0){var P=c(R,F.key);return P<0?V(F.leftChild,R):P>0?V(F.rightChild,R):F}};this.find=function(F){return!!V(v,F)},this.getElementByKey=function(F){var R=V(v,F);if((R==null?void 0:R.key)===void 0||(R==null?void 0:R.value)===void 0)throw new Error("unknown error");return R.value},this.union=function(F){var R=this;F.forEach(function(P){var M=P.key,Y=P.value;return R.setElement(M,Y)})},this.getHeight=function(){if(this.empty())return 0;var F=function(R){return R?Math.max(F(R.leftChild),F(R.rightChild))+1:1};return F(v)};var Q=function(F){return n(this,function(R){switch(R.label){case 0:return F&&F.key!==void 0&&F.value!==void 0?[5,r(Q(F.leftChild))]:[2];case 1:return R.sent(),[4,{key:F.key,value:F.value}];case 2:return R.sent(),[5,r(Q(F.rightChild))];case 3:return R.sent(),[2]}})};this[Symbol.iterator]=function(){return Q(v)},u.forEach(function(F){var R=F.key,P=F.value;return f.setElement(R,P)}),Object.freeze(this)}Object.freeze(o),s.default=o},{"../Base/TreeNode":25}],31:[function(i,a,s){function n(r,l){r===void 0&&(r=[]),l=l||function(g,v){return g>v?-1:g<v?1:0};var o=[];r.forEach(function(g){return o.push(g)});var u=o.length,c=function(g,v){if(g<0||g>=u)throw new Error("unknown error");if(v<0||v>=u)throw new Error("unknown error");var m=o[g];o[g]=o[v],o[v]=m},f=function(g){if(g<0||g>=u)throw new Error("unknown error");var v=2*g+1,m=2*g+2;v<u&&l(o[g],o[v])>0&&c(g,v),m<u&&l(o[g],o[m])>0&&c(g,m)};(function(){for(var g=Math.floor((u-1)/2);g>=0;--g)for(var v=g,m=2*v+1;m<u;){var w=m+1,y=m;if(w<u&&l(o[m],o[w])>0&&(y=w),l(o[v],o[y])<=0)break;c(v,y),m=2*(v=y)+1}})(),this.size=function(){return u},this.empty=function(){return u===0},this.clear=function(){u=0,o.length=0},this.push=function(g){if(o.push(g),++u!==1)for(var v=u-1;v>0;){var m=Math.floor((v-1)/2);if(l(o[m],g)<=0)break;f(m),v=m}},this.pop=function(){if(!this.empty())if(this.size()!==1){var g=o[u-1];--u;for(var v=0;v<this.size();){var m=2*v+1,w=2*v+2;if(m>=this.size())break;var y=m;if(w<this.size()&&l(o[m],o[w])>0&&(y=w),l(o[y],g)>=0)break;o[v]=o[y],v=y}o[v]=g}else--u},this.top=function(){return o[0]},Object.freeze(this)}Object.defineProperty(s,"__esModule",{value:!0}),Object.freeze(n),s.default=n},{}],32:[function(i,a,s){Object.defineProperty(s,"__esModule",{value:!0});var n=i("../LinkList/LinkList");function r(l){l===void 0&&(l=[]);var o=new n.default(l);this.size=function(){return o.size()},this.empty=function(){return o.empty()},this.clear=function(){o.clear()},this.push=function(u){o.pushBack(u)},this.pop=function(){o.popFront()},this.front=function(){return o.front()},Object.freeze(this)}Object.freeze(r),s.default=r},{"../LinkList/LinkList":29}],33:[function(i,a,s){var n=this&&this.__generator||function(u,c){var f,g,v,m,w={label:0,sent:function(){if(1&v[0])throw v[1];return v[1]},trys:[],ops:[]};return m={next:y(0),throw:y(1),return:y(2)},typeof Symbol=="function"&&(m[Symbol.iterator]=function(){return this}),m;function y(_){return function(A){return function(x){if(f)throw new TypeError("Generator is already executing.");for(;w;)try{if(f=1,g&&(v=2&x[0]?g.return:x[0]?g.throw||((v=g.return)&&v.call(g),0):g.next)&&!(v=v.call(g,x[1])).done)return v;switch(g=0,v&&(x=[2&x[0],v.value]),x[0]){case 0:case 1:v=x;break;case 4:return w.label++,{value:x[1],done:!1};case 5:w.label++,g=x[1],x=[0];continue;case 7:x=w.ops.pop(),w.trys.pop();continue;default:if(!(v=(v=w.trys).length>0&&v[v.length-1])&&(x[0]===6||x[0]===2)){w=0;continue}if(x[0]===3&&(!v||x[1]>v[0]&&x[1]<v[3])){w.label=x[1];break}if(x[0]===6&&w.label<v[1]){w.label=v[1],v=x;break}if(v&&w.label<v[2]){w.label=v[2],w.ops.push(x);break}v[2]&&w.ops.pop(),w.trys.pop();continue}x=c.call(u,w)}catch(C){x=[6,C],g=0}finally{f=v=0}if(5&x[0])throw x[1];return{value:x[0]?x[1]:void 0,done:!0}}([_,A])}}},r=this&&this.__values||function(u){var c=typeof Symbol=="function"&&Symbol.iterator,f=c&&u[c],g=0;if(f)return f.call(u);if(u&&typeof u.length=="number")return{next:function(){return u&&g>=u.length&&(u=void 0),{value:u&&u[g++],done:!u}}};throw new TypeError(c?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(s,"__esModule",{value:!0});var l=i("../Base/TreeNode");function o(u,c){var f=this;u===void 0&&(u=[]),c=c||function(F,R){return F<R?-1:F>R?1:0};var g=0,v=new l.default;v.color=l.default.TreeNodeColorType.black,this.size=function(){return g},this.empty=function(){return g===0},this.clear=function(){g=0,v.key=void 0,v.leftChild=v.rightChild=v.brother=v.parent=void 0,v.color=l.default.TreeNodeColorType.black};var m=function(F){if(!F||F.key===void 0)throw new Error("unknown error");return F.leftChild?m(F.leftChild):F},w=function(F){if(!F||F.key===void 0)throw new Error("unknown error");return F.rightChild?w(F.rightChild):F};this.front=function(){if(!this.empty())return m(v).key},this.back=function(){if(!this.empty())return w(v).key},this.forEach=function(F){var R,P,M=0;try{for(var Y=r(this),Z=Y.next();!Z.done;Z=Y.next())F(Z.value,M++)}catch(nt){R={error:nt}}finally{try{Z&&!Z.done&&(P=Y.return)&&P.call(Y)}finally{if(R)throw R.error}}},this.getElementByPos=function(F){var R,P;if(F<0||F>=this.size())throw new Error("pos must more than 0 and less than set's size");var M=0;try{for(var Y=r(this),Z=Y.next();!Z.done;Z=Y.next()){var nt=Z.value;if(M===F)return nt;++M}}catch(j){R={error:j}}finally{try{Z&&!Z.done&&(P=Y.return)&&P.call(Y)}finally{if(R)throw R.error}}throw new Error("unknown error")};var y=function(F){var R=F.parent;if(!R){if(F===v)return;throw new Error("unknown error")}if(F.color!==l.default.TreeNodeColorType.red){var P=F.brother;if(!P)throw new Error("unknown error");if(F===R.leftChild)if(P.color===l.default.TreeNodeColorType.red){P.color=l.default.TreeNodeColorType.black,R.color=l.default.TreeNodeColorType.red;var M=R.rotateLeft();v===R&&(v=M),y(F)}else P.color===l.default.TreeNodeColorType.black&&(P.rightChild&&P.rightChild.color===l.default.TreeNodeColorType.red?(P.color=R.color,R.color=l.default.TreeNodeColorType.black,P.rightChild&&(P.rightChild.color=l.default.TreeNodeColorType.black),M=R.rotateLeft(),v===R&&(v=M),F.color=l.default.TreeNodeColorType.black):P.rightChild&&P.rightChild.color!==l.default.TreeNodeColorType.black||!P.leftChild||P.leftChild.color!==l.default.TreeNodeColorType.red?P.leftChild&&P.leftChild.color!==l.default.TreeNodeColorType.black||P.rightChild&&P.rightChild.color!==l.default.TreeNodeColorType.black||(P.color=l.default.TreeNodeColorType.red,y(R)):(P.color=l.default.TreeNodeColorType.red,P.leftChild&&(P.leftChild.color=l.default.TreeNodeColorType.black),M=P.rotateRight(),v===P&&(v=M),y(F)));else F===R.rightChild&&(P.color===l.default.TreeNodeColorType.red?(P.color=l.default.TreeNodeColorType.black,R.color=l.default.TreeNodeColorType.red,M=R.rotateRight(),v===R&&(v=M),y(F)):P.color===l.default.TreeNodeColorType.black&&(P.leftChild&&P.leftChild.color===l.default.TreeNodeColorType.red?(P.color=R.color,R.color=l.default.TreeNodeColorType.black,P.leftChild&&(P.leftChild.color=l.default.TreeNodeColorType.black),M=R.rotateRight(),v===R&&(v=M),F.color=l.default.TreeNodeColorType.black):P.leftChild&&P.leftChild.color!==l.default.TreeNodeColorType.black||!P.rightChild||P.rightChild.color!==l.default.TreeNodeColorType.red?P.leftChild&&P.leftChild.color!==l.default.TreeNodeColorType.black||P.rightChild&&P.rightChild.color!==l.default.TreeNodeColorType.black||(P.color=l.default.TreeNodeColorType.red,y(R)):(P.color=l.default.TreeNodeColorType.red,P.rightChild&&(P.rightChild.color=l.default.TreeNodeColorType.black),M=P.rotateLeft(),v===P&&(v=M),y(F))))}else F.color=l.default.TreeNodeColorType.black},_=function(F){for(var R=F;R.leftChild||R.rightChild;){if(R.rightChild){R=m(R.rightChild);var P=F.key;F.key=R.key,R.key=P,F=R}R.leftChild&&(R=w(R.leftChild),P=F.key,F.key=R.key,R.key=P,F=R)}y(R),R&&R.remove(),--g,v.color=l.default.TreeNodeColorType.black},A=function(F,R){return!(!F||F.key===void 0)&&(!!A(F.leftChild,R)||!!R(F)||A(F.rightChild,R))};this.eraseElementByPos=function(F){if(F<0||F>=g)throw new Error("pos must more than 0 and less than set's size");var R=0;A(v,function(P){return F===R?(_(P),!0):(++R,!1)})},this.eraseElementByValue=function(F){if(!this.empty()){var R=T(v,F);R!==void 0&&R.key!==void 0&&c(R.key,F)===0&&_(R)}};var x=function(F,R){if(!F||F.key===void 0)throw new Error("unknown error");var P=c(R,F.key);return P<0?F.leftChild?x(F.leftChild,R):(F.leftChild=new l.default,F.leftChild.parent=F,F.leftChild.brother=F.rightChild,F.rightChild&&(F.rightChild.brother=F.leftChild),F.leftChild):P>0?F.rightChild?x(F.rightChild,R):(F.rightChild=new l.default,F.rightChild.parent=F,F.rightChild.brother=F.leftChild,F.leftChild&&(F.leftChild.brother=F.rightChild),F.rightChild):F},C=function(F){var R=F.parent;if(!R){if(F===v)return;throw new Error("unknown error")}if(R.color!==l.default.TreeNodeColorType.black&&R.color===l.default.TreeNodeColorType.red){var P=R.brother,M=R.parent;if(!M)throw new Error("unknown error");if(P&&P.color===l.default.TreeNodeColorType.red)P.color=R.color=l.default.TreeNodeColorType.black,M.color=l.default.TreeNodeColorType.red,C(M);else if(!P||P.color===l.default.TreeNodeColorType.black)if(R===M.leftChild)if(F===R.leftChild){R.color=l.default.TreeNodeColorType.black,M.color=l.default.TreeNodeColorType.red;var Y=M.rotateRight();M===v&&(v=Y)}else F===R.rightChild&&(Y=R.rotateLeft(),M===v&&(v=Y),C(R));else R===M.rightChild&&(F===R.leftChild?(Y=R.rotateRight(),M===v&&(v=Y),C(R)):F===R.rightChild&&(R.color=l.default.TreeNodeColorType.black,M.color=l.default.TreeNodeColorType.red,Y=M.rotateLeft(),M===v&&(v=Y)))}};this.insert=function(F){if(F==null)throw new Error("to avoid some unnecessary errors, we don't suggest you insert null or undefined here");if(this.empty())return++g,v.key=F,void(v.color=l.default.TreeNodeColorType.black);var R=x(v,F);R.key!==void 0&&c(R.key,F)===0||(++g,R.key=F,C(R),v.color=l.default.TreeNodeColorType.black)};var T=function(F,R){if(F&&F.key!==void 0){var P=c(R,F.key);return P<0?T(F.leftChild,R):P>0?T(F.rightChild,R):F}};this.find=function(F){var R=T(v,F);return R!==void 0&&R.key!==void 0&&c(R.key,F)===0};var I=function(F,R){if(F&&F.key!==void 0){var P=c(F.key,R);if(P===0)return F.key;if(P<0)return I(F.rightChild,R);var M=I(F.leftChild,R);return M!==void 0?M:F.key}};this.lowerBound=function(F){return I(v,F)};var D=function(F,R){if(F&&F.key!==void 0){if(c(F.key,R)<=0)return D(F.rightChild,R);var P=D(F.leftChild,R);return P!==void 0?P:F.key}};this.upperBound=function(F){return D(v,F)};var B=function(F,R){if(F&&F.key!==void 0){var P=c(F.key,R);if(P===0)return F.key;if(P>0)return B(F.leftChild,R);var M=B(F.rightChild,R);return M!==void 0?M:F.key}};this.reverseLowerBound=function(F){return B(v,F)};var V=function(F,R){if(F&&F.key!==void 0){if(c(F.key,R)>=0)return V(F.leftChild,R);var P=V(F.rightChild,R);return P!==void 0?P:F.key}};this.reverseUpperBound=function(F){return V(v,F)},this.union=function(F){var R=this;F.forEach(function(P){return R.insert(P)})},this.getHeight=function(){if(this.empty())return 0;var F=function(R){return R?Math.max(F(R.leftChild),F(R.rightChild))+1:1};return F(v)};var Q=function(F){return n(this,function(R){switch(R.label){case 0:return F&&F.key!==void 0?[5,r(Q(F.leftChild))]:[2];case 1:return R.sent(),[4,F.key];case 2:return R.sent(),[5,r(Q(F.rightChild))];case 3:return R.sent(),[2]}})};this[Symbol.iterator]=function(){return Q(v)},u.forEach(function(F){return f.insert(F)}),Object.freeze(this)}Object.freeze(o),s.default=o},{"../Base/TreeNode":25}],34:[function(i,a,s){function n(r){var l=this;r===void 0&&(r=[]);var o=0,u=[];this.size=function(){return o},this.empty=function(){return o===0},this.clear=function(){o=0,u.length=0},this.push=function(c){u.push(c),++o},this.pop=function(){u.pop(),o>0&&--o},this.top=function(){return u[o-1]},r.forEach(function(c){return l.push(c)}),Object.freeze(this)}Object.defineProperty(s,"__esModule",{value:!0}),Object.freeze(n),s.default=n},{}],35:[function(i,a,s){var n=this&&this.__generator||function(c,f){var g,v,m,w,y={label:0,sent:function(){if(1&m[0])throw m[1];return m[1]},trys:[],ops:[]};return w={next:_(0),throw:_(1),return:_(2)},typeof Symbol=="function"&&(w[Symbol.iterator]=function(){return this}),w;function _(A){return function(x){return function(C){if(g)throw new TypeError("Generator is already executing.");for(;y;)try{if(g=1,v&&(m=2&C[0]?v.return:C[0]?v.throw||((m=v.return)&&m.call(v),0):v.next)&&!(m=m.call(v,C[1])).done)return m;switch(v=0,m&&(C=[2&C[0],m.value]),C[0]){case 0:case 1:m=C;break;case 4:return y.label++,{value:C[1],done:!1};case 5:y.label++,v=C[1],C=[0];continue;case 7:C=y.ops.pop(),y.trys.pop();continue;default:if(!(m=(m=y.trys).length>0&&m[m.length-1])&&(C[0]===6||C[0]===2)){y=0;continue}if(C[0]===3&&(!m||C[1]>m[0]&&C[1]<m[3])){y.label=C[1];break}if(C[0]===6&&y.label<m[1]){y.label=m[1],m=C;break}if(m&&y.label<m[2]){y.label=m[2],y.ops.push(C);break}m[2]&&y.ops.pop(),y.trys.pop();continue}C=f.call(c,y)}catch(T){C=[6,T],v=0}finally{g=m=0}if(5&C[0])throw C[1];return{value:C[0]?C[1]:void 0,done:!0}}([A,x])}}},r=this&&this.__read||function(c,f){var g=typeof Symbol=="function"&&c[Symbol.iterator];if(!g)return c;var v,m,w=g.call(c),y=[];try{for(;(f===void 0||f-- >0)&&!(v=w.next()).done;)y.push(v.value)}catch(_){m={error:_}}finally{try{v&&!v.done&&(g=w.return)&&g.call(w)}finally{if(m)throw m.error}}return y},l=this&&this.__spreadArray||function(c,f,g){if(g||arguments.length===2)for(var v,m=0,w=f.length;m<w;m++)!v&&m in f||(v||(v=Array.prototype.slice.call(f,0,m)),v[m]=f[m]);return c.concat(v||Array.prototype.slice.call(f))},o=this&&this.__values||function(c){var f=typeof Symbol=="function"&&Symbol.iterator,g=f&&c[f],v=0;if(g)return g.call(c);if(c&&typeof c.length=="number")return{next:function(){return c&&v>=c.length&&(c=void 0),{value:c&&c[v++],done:!c}}};throw new TypeError(f?"Object is not iterable.":"Symbol.iterator is not defined.")};function u(c){var f=this;c===void 0&&(c=[]);var g=0,v=[];this.size=function(){return g},this.empty=function(){return g===0},this.clear=function(){g=0,v.length=0},this.front=function(){if(!this.empty())return v[0]},this.back=function(){if(!this.empty())return v[g-1]},this.forEach=function(m){v.forEach(m)},this.getElementByPos=function(m){if(m<0||m>=g)throw new Error("pos must more than 0 and less than vector's size");return v[m]},this.eraseElementByPos=function(m){if(m<0||m>=g)throw new Error("pos must more than 0 and less than vector's size");for(var w=m;w<g-1;++w)v[w]=v[w+1];this.popBack()},this.eraseElementByValue=function(m){var w=[];this.forEach(function(_){_!==m&&w.push(_)}),w.forEach(function(_,A){v[A]=_});for(var y=w.length;g>y;)this.popBack()},this.pushBack=function(m){v.push(m),++g},this.popBack=function(){v.pop(),g>0&&--g},this.setElementByPos=function(m,w){if(m<0||m>=g)throw new Error("pos must more than 0 and less than vector's size");v[m]=w},this.insert=function(m,w,y){if(y===void 0&&(y=1),m<0||m>g)throw new Error("pos must more than 0 and less than or equal to vector's size");v.splice.apply(v,l([m,0],r(new Array(y).fill(w)),!1)),g+=y},this.find=function(m){return v.includes(m)},this.reverse=function(){v.reverse()},this.unique=function(){var m,w=[];this.forEach(function(_,A){A!==0&&_===m||(w.push(_),m=_)}),w.forEach(function(_,A){v[A]=_});for(var y=w.length;g>y;)this.popBack()},this.sort=function(m){v.sort(m)},this[Symbol.iterator]=function(){return function(){return n(this,function(m){switch(m.label){case 0:return[5,o(v)];case 1:return[2,m.sent()]}})}()},c.forEach(function(m){return f.pushBack(m)}),Object.freeze(this)}Object.defineProperty(s,"__esModule",{value:!0}),Object.freeze(u),s.default=u},{}],36:[function(i,a,s){Object.defineProperty(s,"__esModule",{value:!0}),s.HashMap=s.HashSet=s.Map=s.Set=s.PriorityQueue=s.Deque=s.LinkList=s.Queue=s.Stack=s.Vector=void 0;var n=i("./Vector/Vector");s.Vector=n.default;var r=i("./Stack/Stack");s.Stack=r.default;var l=i("./Queue/Queue");s.Queue=l.default;var o=i("./LinkList/LinkList");s.LinkList=o.default;var u=i("./Deque/Deque");s.Deque=u.default;var c=i("./PriorityQueue/PriorityQueue");s.PriorityQueue=c.default;var f=i("./Set/Set");s.Set=f.default;var g=i("./Map/Map");s.Map=g.default;var v=i("./HashSet/HashSet");s.HashSet=v.default;var m=i("./HashMap/HashMap");s.HashMap=m.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,s){const n=i("yallist"),r=Symbol("max"),l=Symbol("length"),o=Symbol("lengthCalculator"),u=Symbol("allowStale"),c=Symbol("maxAge"),f=Symbol("dispose"),g=Symbol("noDisposeOnSet"),v=Symbol("lruList"),m=Symbol("cache"),w=Symbol("updateAgeOnGet"),y=()=>1,_=(D,B,V)=>{const Q=D[m].get(B);if(Q){const F=Q.value;if(A(D,F)){if(C(D,Q),!D[u])return}else V&&(D[w]&&(Q.value.now=Date.now()),D[v].unshiftNode(Q));return F.value}},A=(D,B)=>{if(!B||!B.maxAge&&!D[c])return!1;const V=Date.now()-B.now;return B.maxAge?V>B.maxAge:D[c]&&V>D[c]},x=D=>{if(D[l]>D[r])for(let B=D[v].tail;D[l]>D[r]&&B!==null;){const V=B.prev;C(D,B),B=V}},C=(D,B)=>{if(B){const V=B.value;D[f]&&D[f](V.key,V.value),D[l]-=V.length,D[m].delete(V.key),D[v].removeNode(B)}};class T{constructor(B,V,Q,F,R){this.key=B,this.value=V,this.length=Q,this.now=F,this.maxAge=R||0}}const I=(D,B,V,Q)=>{let F=V.value;A(D,F)&&(C(D,V),D[u]||(F=void 0)),F&&B.call(Q,F.value,F.key,D)};a.exports=class{constructor(D){if(typeof D=="number"&&(D={max:D}),D||(D={}),D.max&&(typeof D.max!="number"||D.max<0))throw new TypeError("max must be a non-negative number");this[r]=D.max||1/0;const B=D.length||y;if(this[o]=typeof B!="function"?y:B,this[u]=D.stale||!1,D.maxAge&&typeof D.maxAge!="number")throw new TypeError("maxAge must be a number");this[c]=D.maxAge||0,this[f]=D.dispose,this[g]=D.noDisposeOnSet||!1,this[w]=D.updateAgeOnGet||!1,this.reset()}set max(D){if(typeof D!="number"||D<0)throw new TypeError("max must be a non-negative number");this[r]=D||1/0,x(this)}get max(){return this[r]}set allowStale(D){this[u]=!!D}get allowStale(){return this[u]}set maxAge(D){if(typeof D!="number")throw new TypeError("maxAge must be a non-negative number");this[c]=D,x(this)}get maxAge(){return this[c]}set lengthCalculator(D){typeof D!="function"&&(D=y),D!==this[o]&&(this[o]=D,this[l]=0,this[v].forEach(B=>{B.length=this[o](B.value,B.key),this[l]+=B.length})),x(this)}get lengthCalculator(){return this[o]}get length(){return this[l]}get itemCount(){return this[v].length}rforEach(D,B){B=B||this;for(let V=this[v].tail;V!==null;){const Q=V.prev;I(this,D,V,B),V=Q}}forEach(D,B){B=B||this;for(let V=this[v].head;V!==null;){const Q=V.next;I(this,D,V,B),V=Q}}keys(){return this[v].toArray().map(D=>D.key)}values(){return this[v].toArray().map(D=>D.value)}reset(){this[f]&&this[v]&&this[v].length&&this[v].forEach(D=>this[f](D.key,D.value)),this[m]=new Map,this[v]=new n,this[l]=0}dump(){return this[v].map(D=>!A(this,D)&&{k:D.key,v:D.value,e:D.now+(D.maxAge||0)}).toArray().filter(D=>D)}dumpLru(){return this[v]}set(D,B,V){if((V=V||this[c])&&typeof V!="number")throw new TypeError("maxAge must be a number");const Q=V?Date.now():0,F=this[o](B,D);if(this[m].has(D)){if(F>this[r])return C(this,this[m].get(D)),!1;const P=this[m].get(D).value;return this[f]&&(this[g]||this[f](D,P.value)),P.now=Q,P.maxAge=V,P.value=B,this[l]+=F-P.length,P.length=F,this.get(D),x(this),!0}const R=new T(D,B,F,Q,V);return R.length>this[r]?(this[f]&&this[f](D,B),!1):(this[l]+=R.length,this[v].unshift(R),this[m].set(D,this[v].head),x(this),!0)}has(D){if(!this[m].has(D))return!1;const B=this[m].get(D).value;return!A(this,B)}get(D){return _(this,D,!0)}peek(D){return _(this,D,!1)}pop(){const D=this[v].tail;return D?(C(this,D),D.value):null}del(D){C(this,this[m].get(D))}load(D){this.reset();const B=Date.now();for(let V=D.length-1;V>=0;V--){const Q=D[V],F=Q.e||0;if(F===0)this.set(Q.k,Q.v);else{const R=F-B;R>0&&this.set(Q.k,Q.v,R)}}}prune(){this[m].forEach((D,B)=>_(this,B,!1))}}},{yallist:83}],38:[function(i,a,s){(function(n){(function(){const r=a.exports;r.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"},r.codes={};for(const o in r.types){const u=r.types[o];r.codes[u]=o}r.CMD_SHIFT=4,r.CMD_MASK=240,r.DUP_MASK=8,r.QOS_MASK=3,r.QOS_SHIFT=1,r.RETAIN_MASK=1,r.VARBYTEINT_MASK=127,r.VARBYTEINT_FIN_MASK=128,r.VARBYTEINT_MAX=268435455,r.SESSIONPRESENT_MASK=1,r.SESSIONPRESENT_HEADER=n.from([r.SESSIONPRESENT_MASK]),r.CONNACK_HEADER=n.from([r.codes.connack<<r.CMD_SHIFT]),r.USERNAME_MASK=128,r.PASSWORD_MASK=64,r.WILL_RETAIN_MASK=32,r.WILL_QOS_MASK=24,r.WILL_QOS_SHIFT=3,r.WILL_FLAG_MASK=4,r.CLEAN_SESSION_MASK=2,r.CONNECT_HEADER=n.from([r.codes.connect<<r.CMD_SHIFT]),r.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},r.propertiesCodes={};for(const o in r.properties){const u=r.properties[o];r.propertiesCodes[u]=o}function l(o){return[0,1,2].map(u=>[0,1].map(c=>[0,1].map(f=>{const g=n.alloc(1);return g.writeUInt8(r.codes[o]<<r.CMD_SHIFT|(c?r.DUP_MASK:0)|u<<r.QOS_SHIFT|f,0,!0),g})))}r.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"},r.PUBLISH_HEADER=l("publish"),r.SUBSCRIBE_HEADER=l("subscribe"),r.SUBSCRIBE_OPTIONS_QOS_MASK=3,r.SUBSCRIBE_OPTIONS_NL_MASK=1,r.SUBSCRIBE_OPTIONS_NL_SHIFT=2,r.SUBSCRIBE_OPTIONS_RAP_MASK=1,r.SUBSCRIBE_OPTIONS_RAP_SHIFT=3,r.SUBSCRIBE_OPTIONS_RH_MASK=3,r.SUBSCRIBE_OPTIONS_RH_SHIFT=4,r.SUBSCRIBE_OPTIONS_RH=[0,16,32],r.SUBSCRIBE_OPTIONS_NL=4,r.SUBSCRIBE_OPTIONS_RAP=8,r.SUBSCRIBE_OPTIONS_QOS=[0,1,2],r.UNSUBSCRIBE_HEADER=l("unsubscribe"),r.ACKS={unsuback:l("unsuback"),puback:l("puback"),pubcomp:l("pubcomp"),pubrel:l("pubrel"),pubrec:l("pubrec")},r.SUBACK_HEADER=n.from([r.codes.suback<<r.CMD_SHIFT]),r.VERSION3=n.from([3]),r.VERSION4=n.from([4]),r.VERSION5=n.from([5]),r.VERSION131=n.from([131]),r.VERSION132=n.from([132]),r.QOS=[0,1,2].map(o=>n.from([o])),r.EMPTY={pingreq:n.from([r.codes.pingreq<<4,0]),pingresp:n.from([r.codes.pingresp<<4,0]),disconnect:n.from([r.codes.disconnect<<4,0])}}).call(this)}).call(this,i("buffer").Buffer)},{buffer:17}],39:[function(i,a,s){(function(n){(function(){const r=i("./writeToStream"),l=i("events");class o extends l{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),g=this._array;let v,m=0;for(v=0;v<g.length&&g[v]!==void 0;v++)typeof g[v]!="string"?f[v]=g[v].length:f[v]=n.byteLength(g[v]),c+=f[v];const w=n.allocUnsafe(c);for(v=0;v<g.length&&g[v]!==void 0;v++)typeof g[v]!="string"?(g[v].copy(w,m),m+=f[v]):(w.write(g[v],m),m+=f[v]);return w}}a.exports=function(u,c){const f=new o;return r(u,f,c),f.concat()}}).call(this)}).call(this,i("buffer").Buffer)},{"./writeToStream":44,buffer:17,events:22}],40:[function(i,a,s){s.parser=i("./parser").parser,s.generate=i("./generate"),s.writeToStream=i("./writeToStream")},{"./generate":39,"./parser":43,"./writeToStream":44}],41:[function(i,a,s){(function(n){(function(){const l={},o=n.isBuffer(n.from([1,2]).subarray(0,1));function u(c){const f=n.allocUnsafe(2);return f.writeUInt8(c>>8,0),f.writeUInt8(255&c,1),f}a.exports={cache:l,generateCache:function(){for(let c=0;c<65536;c++)l[c]=u(c)},generateNumber:u,genBufVariableByteInt:function(c){let f=0,g=0;const v=n.allocUnsafe(4);do f=c%128|0,(c=c/128|0)>0&&(f|=128),v.writeUInt8(f,g++);while(c>0&&g<4);return c>0&&(g=0),o?v.subarray(0,g):v.slice(0,g)},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,s){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,s){const n=i("bl"),r=i("events"),l=i("./packet"),o=i("./constants"),u=i("debug")("mqtt-packet:parser");class c extends r{constructor(){super(),this.parser=this.constructor.parser}static parser(g){return this instanceof c?(this.settings=g||{},this._states=["_parseHeader","_parseLength","_parsePayload","_newPacket"],this._resetState(),this):new c().parser(g)}_resetState(){u("_resetState: resetting packet, error, _list, and _stateCounter"),this.packet=new l,this.error=null,this._list=n(),this._stateCounter=0}parse(g){for(this.error&&this._resetState(),this._list.append(g),u("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++,u("parse: state complete. _stateCounter is now: %d",this._stateCounter),u("parse: packet.length: %d, buffer list length: %d",this.packet.length,this._list.length),this._stateCounter>=this._states.length&&(this._stateCounter=0);return u("parse: exited while loop. packet: %d, buffer list length: %d",this.packet.length,this._list.length),this._list.length}_parseHeader(){const g=this._list.readUInt8(0);return this.packet.cmd=o.types[g>>o.CMD_SHIFT],this.packet.retain=(g&o.RETAIN_MASK)!=0,this.packet.qos=g>>o.QOS_SHIFT&o.QOS_MASK,this.packet.dup=(g&o.DUP_MASK)!=0,u("_parseHeader: packet: %o",this.packet),this._list.consume(1),!0}_parseLength(){const g=this._parseVarByteNum(!0);return g&&(this.packet.length=g.value,this._list.consume(g.bytes)),u("_parseLength %d",g.value),!!g}_parsePayload(){u("_parsePayload: payload %O",this._list);let g=!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"))}g=!0}return u("_parsePayload complete result: %s",g),g}_parseConnect(){let g,v,m,w;u("_parseConnect");const y={},_=this.packet,A=this._parseString();if(A===null)return this._emitError(new Error("Cannot parse protocolId"));if(A!=="MQTT"&&A!=="MQIsdp")return this._emitError(new Error("Invalid protocolId"));if(_.protocolId=A,this._pos>=this._list.length)return this._emitError(new Error("Packet too short"));if(_.protocolVersion=this._list.readUInt8(this._pos),_.protocolVersion>=128&&(_.bridgeMode=!0,_.protocolVersion=_.protocolVersion-128),_.protocolVersion!==3&&_.protocolVersion!==4&&_.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(y.username=this._list.readUInt8(this._pos)&o.USERNAME_MASK,y.password=this._list.readUInt8(this._pos)&o.PASSWORD_MASK,y.will=this._list.readUInt8(this._pos)&o.WILL_FLAG_MASK,y.will&&(_.will={},_.will.retain=(this._list.readUInt8(this._pos)&o.WILL_RETAIN_MASK)!=0,_.will.qos=(this._list.readUInt8(this._pos)&o.WILL_QOS_MASK)>>o.WILL_QOS_SHIFT),_.clean=(this._list.readUInt8(this._pos)&o.CLEAN_SESSION_MASK)!=0,this._pos++,_.keepalive=this._parseNum(),_.keepalive===-1)return this._emitError(new Error("Packet too short"));if(_.protocolVersion===5){const C=this._parseProperties();Object.getOwnPropertyNames(C).length&&(_.properties=C)}const x=this._parseString();if(x===null)return this._emitError(new Error("Packet too short"));if(_.clientId=x,u("_parseConnect: packet.clientId: %s",_.clientId),y.will){if(_.protocolVersion===5){const C=this._parseProperties();Object.getOwnPropertyNames(C).length&&(_.will.properties=C)}if((g=this._parseString())===null)return this._emitError(new Error("Cannot parse will topic"));if(_.will.topic=g,u("_parseConnect: packet.will.topic: %s",_.will.topic),(v=this._parseBuffer())===null)return this._emitError(new Error("Cannot parse will payload"));_.will.payload=v,u("_parseConnect: packet.will.paylaod: %s",_.will.payload)}if(y.username){if((w=this._parseString())===null)return this._emitError(new Error("Cannot parse username"));_.username=w,u("_parseConnect: packet.username: %s",_.username)}if(y.password){if((m=this._parseBuffer())===null)return this._emitError(new Error("Cannot parse password"));_.password=m}return this.settings=_,u("_parseConnect: complete"),_}_parseConnack(){u("_parseConnack");const g=this.packet;if(this._list.length<1)return null;if(g.sessionPresent=!!(this._list.readUInt8(this._pos++)&o.SESSIONPRESENT_MASK),this.settings.protocolVersion===5)this._list.length>=2?g.reasonCode=this._list.readUInt8(this._pos++):g.reasonCode=0;else{if(this._list.length<2)return null;g.returnCode=this._list.readUInt8(this._pos++)}if(g.returnCode===-1||g.reasonCode===-1)return this._emitError(new Error("Cannot parse return code"));if(this.settings.protocolVersion===5){const v=this._parseProperties();Object.getOwnPropertyNames(v).length&&(g.properties=v)}u("_parseConnack: complete")}_parsePublish(){u("_parsePublish");const g=this.packet;if(g.topic=this._parseString(),g.topic===null)return this._emitError(new Error("Cannot parse topic"));if(!(g.qos>0)||this._parseMessageId()){if(this.settings.protocolVersion===5){const v=this._parseProperties();Object.getOwnPropertyNames(v).length&&(g.properties=v)}g.payload=this._list.slice(this._pos,g.length),u("_parsePublish: payload from buffer list: %o",g.payload)}}_parseSubscribe(){u("_parseSubscribe");const g=this.packet;let v,m,w,y,_,A,x;if(g.qos!==1)return this._emitError(new Error("Wrong subscribe header"));if(g.subscriptions=[],this._parseMessageId()){if(this.settings.protocolVersion===5){const C=this._parseProperties();Object.getOwnPropertyNames(C).length&&(g.properties=C)}for(;this._pos<g.length;){if((v=this._parseString())===null)return this._emitError(new Error("Cannot parse topic"));if(this._pos>=g.length)return this._emitError(new Error("Malformed Subscribe Payload"));w=(m=this._parseByte())&o.SUBSCRIBE_OPTIONS_QOS_MASK,A=(m>>o.SUBSCRIBE_OPTIONS_NL_SHIFT&o.SUBSCRIBE_OPTIONS_NL_MASK)!=0,_=(m>>o.SUBSCRIBE_OPTIONS_RAP_SHIFT&o.SUBSCRIBE_OPTIONS_RAP_MASK)!=0,y=m>>o.SUBSCRIBE_OPTIONS_RH_SHIFT&o.SUBSCRIBE_OPTIONS_RH_MASK,x={topic:v,qos:w},this.settings.protocolVersion===5?(x.nl=A,x.rap=_,x.rh=y):this.settings.bridgeMode&&(x.rh=0,x.rap=!0,x.nl=!0),u("_parseSubscribe: push subscription `%s` to subscription",x),g.subscriptions.push(x)}}}_parseSuback(){u("_parseSuback");const g=this.packet;if(this.packet.granted=[],this._parseMessageId()){if(this.settings.protocolVersion===5){const v=this._parseProperties();Object.getOwnPropertyNames(v).length&&(g.properties=v)}for(;this._pos<this.packet.length;)this.packet.granted.push(this._list.readUInt8(this._pos++))}}_parseUnsubscribe(){u("_parseUnsubscribe");const g=this.packet;if(g.unsubscriptions=[],this._parseMessageId()){if(this.settings.protocolVersion===5){const v=this._parseProperties();Object.getOwnPropertyNames(v).length&&(g.properties=v)}for(;this._pos<g.length;){const v=this._parseString();if(v===null)return this._emitError(new Error("Cannot parse topic"));u("_parseUnsubscribe: push topic `%s` to unsubscriptions",v),g.unsubscriptions.push(v)}}}_parseUnsuback(){u("_parseUnsuback");const g=this.packet;if(!this._parseMessageId())return this._emitError(new Error("Cannot parse messageId"));if(this.settings.protocolVersion===5){const v=this._parseProperties();for(Object.getOwnPropertyNames(v).length&&(g.properties=v),g.granted=[];this._pos<this.packet.length;)this.packet.granted.push(this._list.readUInt8(this._pos++))}}_parseConfirmation(){u("_parseConfirmation: packet.cmd: `%s`",this.packet.cmd);const g=this.packet;if(this._parseMessageId(),this.settings.protocolVersion===5&&(g.length>2?(g.reasonCode=this._parseByte(),u("_parseConfirmation: packet.reasonCode `%d`",g.reasonCode)):g.reasonCode=0,g.length>3)){const v=this._parseProperties();Object.getOwnPropertyNames(v).length&&(g.properties=v)}return!0}_parseDisconnect(){const g=this.packet;if(u("_parseDisconnect"),this.settings.protocolVersion===5){this._list.length>0?g.reasonCode=this._parseByte():g.reasonCode=0;const v=this._parseProperties();Object.getOwnPropertyNames(v).length&&(g.properties=v)}return u("_parseDisconnect result: true"),!0}_parseAuth(){u("_parseAuth");const g=this.packet;if(this.settings.protocolVersion!==5)return this._emitError(new Error("Not supported auth packet for this version MQTT"));g.reasonCode=this._parseByte();const v=this._parseProperties();return Object.getOwnPropertyNames(v).length&&(g.properties=v),u("_parseAuth: result: true"),!0}_parseMessageId(){const g=this.packet;return g.messageId=this._parseNum(),g.messageId===null?(this._emitError(new Error("Cannot parse messageId")),!1):(u("_parseMessageId: packet.messageId %d",g.messageId),!0)}_parseString(g){const v=this._parseNum(),m=v+this._pos;if(v===-1||m>this._list.length||m>this.packet.length)return null;const w=this._list.toString("utf8",this._pos,m);return this._pos+=v,u("_parseString: result: %s",w),w}_parseStringPair(){return u("_parseStringPair"),{name:this._parseString(),value:this._parseString()}}_parseBuffer(){const g=this._parseNum(),v=g+this._pos;if(g===-1||v>this._list.length||v>this.packet.length)return null;const m=this._list.slice(this._pos,v);return this._pos+=g,u("_parseBuffer: result: %o",m),m}_parseNum(){if(this._list.length-this._pos<2)return-1;const g=this._list.readUInt16BE(this._pos);return this._pos+=2,u("_parseNum: result: %s",g),g}_parse4ByteNum(){if(this._list.length-this._pos<4)return-1;const g=this._list.readUInt32BE(this._pos);return this._pos+=4,u("_parse4ByteNum: result: %s",g),g}_parseVarByteNum(g){u("_parseVarByteNum");let v,m=0,w=1,y=0,_=!1;const A=this._pos?this._pos:0;for(;m<4&&A+m<this._list.length;){if(y+=w*((v=this._list.readUInt8(A+m++))&o.VARBYTEINT_MASK),w*=128,(v&o.VARBYTEINT_FIN_MASK)==0){_=!0;break}if(this._list.length<=m)break}return!_&&m===4&&this._list.length>=m&&this._emitError(new Error("Invalid variable byte integer")),A&&(this._pos+=m),u("_parseVarByteNum: result: %o",_=!!_&&(g?{bytes:m,value:y}:y)),_}_parseByte(){let g;return this._pos<this._list.length&&(g=this._list.readUInt8(this._pos),this._pos++),u("_parseByte: result: %o",g),g}_parseByType(g){switch(u("_parseByType: type: %s",g),g){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(){u("_parseProperties");const g=this._parseVarByteNum(),v=this._pos+g,m={};for(;this._pos<v;){const w=this._parseByte();if(!w)return this._emitError(new Error("Cannot parse property code type")),!1;const y=o.propertiesCodes[w];if(!y)return this._emitError(new Error("Unknown property")),!1;if(y!=="userProperties")m[y]?Array.isArray(m[y])?m[y].push(this._parseByType(o.propertiesTypes[y])):(m[y]=[m[y]],m[y].push(this._parseByType(o.propertiesTypes[y]))):m[y]=this._parseByType(o.propertiesTypes[y]);else{m[y]||(m[y]=Object.create(null));const _=this._parseByType(o.propertiesTypes[y]);if(m[y][_.name])if(Array.isArray(m[y][_.name]))m[y][_.name].push(_.value);else{const A=m[y][_.name];m[y][_.name]=[A],m[y][_.name].push(_.value)}else m[y][_.name]=_.value}}return m}_newPacket(){return u("_newPacket"),this.packet&&(this._list.consume(this.packet.length),u("_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)),u("_newPacket: new packet"),this.packet=new l,this._pos=0,!0}_emitError(g){u("_emitError"),this.error=g,this.emit("error",g)}}a.exports=c},{"./constants":38,"./packet":42,bl:15,debug:18,events:22}],44:[function(i,a,s){(function(n){(function(){const r=i("./constants"),l=n.allocUnsafe(0),o=n.from([0]),u=i("./numbers"),c=i("process-nextick-args").nextTick,f=i("debug")("mqtt-packet:writeToStream"),g=u.cache,v=u.generateNumber,m=u.generateCache,w=u.genBufVariableByteInt,y=u.generate4ByteBuffer;let _=V,A=!0;function x(j,H,$){switch(f("generate called"),H.cork&&(H.cork(),c(C,H)),A&&(A=!1,m()),f("generate: packet.cmd: %s",j.cmd),j.cmd){case"connect":return function(K,U,tt){const at=K||{},et=at.protocolId||"MQTT";let ut=at.protocolVersion||4;const ct=at.will;let ot=at.clean;const b=at.keepalive||0,E=at.clientId||"",S=at.username,N=at.password,X=at.properties;ot===void 0&&(ot=!0);let G=0;if(!et||typeof et!="string"&&!n.isBuffer(et))return U.emit("error",new Error("Invalid protocolId")),!1;if(G+=et.length+2,ut!==3&&ut!==4&&ut!==5)return U.emit("error",new Error("Invalid protocol version")),!1;if(G+=1,(typeof E=="string"||n.isBuffer(E))&&(E||ut>=4)&&(E||ot))G+=n.byteLength(E)+2;else{if(ut<4)return U.emit("error",new Error("clientId must be supplied before 3.1.1")),!1;if(1*ot==0)return U.emit("error",new Error("clientId must be given if cleanSession set to 0")),!1}if(typeof b!="number"||b<0||b>65535||b%1!=0)return U.emit("error",new Error("Invalid keepalive")),!1;if(G+=2,G+=1,ut===5){var rt=R(U,X);if(!rt)return!1;G+=rt.length}if(ct){if(typeof ct!="object")return U.emit("error",new Error("Invalid will")),!1;if(!ct.topic||typeof ct.topic!="string")return U.emit("error",new Error("Invalid will topic")),!1;if(G+=n.byteLength(ct.topic)+2,G+=2,ct.payload){if(!(ct.payload.length>=0))return U.emit("error",new Error("Invalid will payload")),!1;typeof ct.payload=="string"?G+=n.byteLength(ct.payload):G+=ct.payload.length}var yt={};if(ut===5){if(!(yt=R(U,ct.properties)))return!1;G+=yt.length}}let mt=!1;if(S!=null){if(!nt(S))return U.emit("error",new Error("Invalid username")),!1;mt=!0,G+=n.byteLength(S)+2}if(N!=null){if(!mt)return U.emit("error",new Error("Username is required to use password")),!1;if(!nt(N))return U.emit("error",new Error("Invalid password")),!1;G+=Z(N)+2}U.write(r.CONNECT_HEADER),I(U,G),F(U,et),at.bridgeMode&&(ut+=128),U.write(ut===131?r.VERSION131:ut===132?r.VERSION132:ut===4?r.VERSION4:ut===5?r.VERSION5:r.VERSION3);let At=0;return At|=S!=null?r.USERNAME_MASK:0,At|=N!=null?r.PASSWORD_MASK:0,At|=ct&&ct.retain?r.WILL_RETAIN_MASK:0,At|=ct&&ct.qos?ct.qos<<r.WILL_QOS_SHIFT:0,At|=ct?r.WILL_FLAG_MASK:0,At|=ot?r.CLEAN_SESSION_MASK:0,U.write(n.from([At])),_(U,b),ut===5&&rt.write(),F(U,E),ct&&(ut===5&&yt.write(),D(U,ct.topic),F(U,ct.payload)),S!=null&&F(U,S),N!=null&&F(U,N),!0}(j,H);case"connack":return function(K,U,tt){const at=tt?tt.protocolVersion:4,et=K||{},ut=at===5?et.reasonCode:et.returnCode,ct=et.properties;let ot=2;if(typeof ut!="number")return U.emit("error",new Error("Invalid return code")),!1;let b=null;if(at===5){if(!(b=R(U,ct)))return!1;ot+=b.length}return U.write(r.CONNACK_HEADER),I(U,ot),U.write(et.sessionPresent?r.SESSIONPRESENT_HEADER:o),U.write(n.from([ut])),b!=null&&b.write(),!0}(j,H,$);case"publish":return function(K,U,tt){f("publish: packet: %o",K);const at=tt?tt.protocolVersion:4,et=K||{},ut=et.qos||0,ct=et.retain?r.RETAIN_MASK:0,ot=et.topic,b=et.payload||l,E=et.messageId,S=et.properties;let N=0;if(typeof ot=="string")N+=n.byteLength(ot)+2;else{if(!n.isBuffer(ot))return U.emit("error",new Error("Invalid topic")),!1;N+=ot.length+2}if(n.isBuffer(b)?N+=b.length:N+=n.byteLength(b),ut&&typeof E!="number")return U.emit("error",new Error("Invalid messageId")),!1;ut&&(N+=2);let X=null;if(at===5){if(!(X=R(U,S)))return!1;N+=X.length}return U.write(r.PUBLISH_HEADER[ut][et.dup?1:0][ct?1:0]),I(U,N),_(U,Z(ot)),U.write(ot),ut>0&&_(U,E),X!=null&&X.write(),f("publish: payload: %o",b),U.write(b)}(j,H,$);case"puback":case"pubrec":case"pubrel":case"pubcomp":return function(K,U,tt){const at=tt?tt.protocolVersion:4,et=K||{},ut=et.cmd||"puback",ct=et.messageId,ot=et.dup&&ut==="pubrel"?r.DUP_MASK:0;let b=0;const E=et.reasonCode,S=et.properties;let N=at===5?3:2;if(ut==="pubrel"&&(b=1),typeof ct!="number")return U.emit("error",new Error("Invalid messageId")),!1;let X=null;if(at===5&&typeof S=="object"){if(!(X=P(U,S,tt,N)))return!1;N+=X.length}return U.write(r.ACKS[ut][b][ot][0]),I(U,N),_(U,ct),at===5&&U.write(n.from([E])),X!==null&&X.write(),!0}(j,H,$);case"subscribe":return function(K,U,tt){f("subscribe: packet: ");const at=tt?tt.protocolVersion:4,et=K||{},ut=et.dup?r.DUP_MASK:0,ct=et.messageId,ot=et.subscriptions,b=et.properties;let E=0;if(typeof ct!="number")return U.emit("error",new Error("Invalid messageId")),!1;E+=2;let S=null;if(at===5){if(!(S=R(U,b)))return!1;E+=S.length}if(typeof ot!="object"||!ot.length)return U.emit("error",new Error("Invalid subscriptions")),!1;for(let X=0;X<ot.length;X+=1){const G=ot[X].topic,rt=ot[X].qos;if(typeof G!="string")return U.emit("error",new Error("Invalid subscriptions - invalid topic")),!1;if(typeof rt!="number")return U.emit("error",new Error("Invalid subscriptions - invalid qos")),!1;if(at===5){if(typeof(ot[X].nl||!1)!="boolean")return U.emit("error",new Error("Invalid subscriptions - invalid No Local")),!1;if(typeof(ot[X].rap||!1)!="boolean")return U.emit("error",new Error("Invalid subscriptions - invalid Retain as Published")),!1;const At=ot[X].rh||0;if(typeof At!="number"||At>2)return U.emit("error",new Error("Invalid subscriptions - invalid Retain Handling")),!1}E+=n.byteLength(G)+2+1}f("subscribe: writing to stream: %o",r.SUBSCRIBE_HEADER),U.write(r.SUBSCRIBE_HEADER[1][ut?1:0][0]),I(U,E),_(U,ct),S!==null&&S.write();let N=!0;for(const X of ot){const G=X.topic,rt=X.qos,yt=+X.nl,mt=+X.rap,At=X.rh;let Rt;D(U,G),Rt=r.SUBSCRIBE_OPTIONS_QOS[rt],at===5&&(Rt|=yt?r.SUBSCRIBE_OPTIONS_NL:0,Rt|=mt?r.SUBSCRIBE_OPTIONS_RAP:0,Rt|=At?r.SUBSCRIBE_OPTIONS_RH[At]:0),N=U.write(n.from([Rt]))}return N}(j,H,$);case"suback":return function(K,U,tt){const at=tt?tt.protocolVersion:4,et=K||{},ut=et.messageId,ct=et.granted,ot=et.properties;let b=0;if(typeof ut!="number")return U.emit("error",new Error("Invalid messageId")),!1;if(b+=2,typeof ct!="object"||!ct.length)return U.emit("error",new Error("Invalid qos vector")),!1;for(let S=0;S<ct.length;S+=1){if(typeof ct[S]!="number")return U.emit("error",new Error("Invalid qos vector")),!1;b+=1}let E=null;if(at===5){if(!(E=P(U,ot,tt,b)))return!1;b+=E.length}return U.write(r.SUBACK_HEADER),I(U,b),_(U,ut),E!==null&&E.write(),U.write(n.from(ct))}(j,H,$);case"unsubscribe":return function(K,U,tt){const at=tt?tt.protocolVersion:4,et=K||{},ut=et.messageId,ct=et.dup?r.DUP_MASK:0,ot=et.unsubscriptions,b=et.properties;let E=0;if(typeof ut!="number")return U.emit("error",new Error("Invalid messageId")),!1;if(E+=2,typeof ot!="object"||!ot.length)return U.emit("error",new Error("Invalid unsubscriptions")),!1;for(let X=0;X<ot.length;X+=1){if(typeof ot[X]!="string")return U.emit("error",new Error("Invalid unsubscriptions")),!1;E+=n.byteLength(ot[X])+2}let S=null;if(at===5){if(!(S=R(U,b)))return!1;E+=S.length}U.write(r.UNSUBSCRIBE_HEADER[1][ct?1:0][0]),I(U,E),_(U,ut),S!==null&&S.write();let N=!0;for(let X=0;X<ot.length;X++)N=D(U,ot[X]);return N}(j,H,$);case"unsuback":return function(K,U,tt){const at=tt?tt.protocolVersion:4,et=K||{},ut=et.messageId,ct=et.dup?r.DUP_MASK:0,ot=et.granted,b=et.properties,E=et.cmd;let S=2;if(typeof ut!="number")return U.emit("error",new Error("Invalid messageId")),!1;if(at===5){if(typeof ot!="object"||!ot.length)return U.emit("error",new Error("Invalid qos vector")),!1;for(let X=0;X<ot.length;X+=1){if(typeof ot[X]!="number")return U.emit("error",new Error("Invalid qos vector")),!1;S+=1}}let N=null;if(at===5){if(!(N=P(U,b,tt,S)))return!1;S+=N.length}return U.write(r.ACKS[E][0][ct][0]),I(U,S),_(U,ut),N!==null&&N.write(),at===5&&U.write(n.from(ot)),!0}(j,H,$);case"pingreq":case"pingresp":return function(K,U,tt){return U.write(r.EMPTY[K.cmd])}(j,H);case"disconnect":return function(K,U,tt){const at=tt?tt.protocolVersion:4,et=K||{},ut=et.reasonCode,ct=et.properties;let ot=at===5?1:0,b=null;if(at===5){if(!(b=P(U,ct,tt,ot)))return!1;ot+=b.length}return U.write(n.from([r.codes.disconnect<<4])),I(U,ot),at===5&&U.write(n.from([ut])),b!==null&&b.write(),!0}(j,H,$);case"auth":return function(K,U,tt){const at=tt?tt.protocolVersion:4,et=K||{},ut=et.reasonCode,ct=et.properties;let ot=at===5?1:0;at!==5&&U.emit("error",new Error("Invalid mqtt version for auth packet"));const b=P(U,ct,tt,ot);return b?(ot+=b.length,U.write(n.from([r.codes.auth<<4])),I(U,ot),U.write(n.from([ut])),b!==null&&b.write(),!0):!1}(j,H,$);default:return H.emit("error",new Error("Unknown command")),!1}}function C(j){j.uncork()}Object.defineProperty(x,"cacheNumbers",{get:()=>_===V,set(j){j?(g&&Object.keys(g).length!==0||(A=!0),_=V):(A=!1,_=Q)}});const T={};function I(j,H){if(H>r.VARBYTEINT_MAX)return j.emit("error",new Error(`Invalid variable byte integer: ${H}`)),!1;let $=T[H];return $||($=w(H),H<16384&&(T[H]=$)),f("writeVarByteInt: writing to stream: %o",$),j.write($)}function D(j,H){const $=n.byteLength(H);return _(j,$),f("writeString: %s",H),j.write(H,"utf8")}function B(j,H,$){D(j,H),D(j,$)}function V(j,H){return f("writeNumberCached: number: %d",H),f("writeNumberCached: %o",g[H]),j.write(g[H])}function Q(j,H){const $=v(H);return f("writeNumberGenerated: %o",$),j.write($)}function F(j,H){typeof H=="string"?D(j,H):H?(_(j,H.length),j.write(H)):_(j,0)}function R(j,H){if(typeof H!="object"||H.length!=null)return{length:1,write(){Y(j,{},0)}};let $=0;function K(U,tt){let at=0;switch(r.propertiesTypes[U]){case"byte":if(typeof tt!="boolean")return j.emit("error",new Error(`Invalid ${U}: ${tt}`)),!1;at+=2;break;case"int8":if(typeof tt!="number"||tt<0||tt>255)return j.emit("error",new Error(`Invalid ${U}: ${tt}`)),!1;at+=2;break;case"binary":if(tt&&tt===null)return j.emit("error",new Error(`Invalid ${U}: ${tt}`)),!1;at+=1+n.byteLength(tt)+2;break;case"int16":if(typeof tt!="number"||tt<0||tt>65535)return j.emit("error",new Error(`Invalid ${U}: ${tt}`)),!1;at+=3;break;case"int32":if(typeof tt!="number"||tt<0||tt>4294967295)return j.emit("error",new Error(`Invalid ${U}: ${tt}`)),!1;at+=5;break;case"var":if(typeof tt!="number"||tt<0||tt>268435455)return j.emit("error",new Error(`Invalid ${U}: ${tt}`)),!1;at+=1+n.byteLength(w(tt));break;case"string":if(typeof tt!="string")return j.emit("error",new Error(`Invalid ${U}: ${tt}`)),!1;at+=3+n.byteLength(tt.toString());break;case"pair":if(typeof tt!="object")return j.emit("error",new Error(`Invalid ${U}: ${tt}`)),!1;at+=Object.getOwnPropertyNames(tt).reduce((et,ut)=>{const ct=tt[ut];return Array.isArray(ct)?et+=ct.reduce((ot,b)=>ot+=3+n.byteLength(ut.toString())+2+n.byteLength(b.toString()),0):et+=3+n.byteLength(ut.toString())+2+n.byteLength(tt[ut].toString()),et},0);break;default:return j.emit("error",new Error(`Invalid property ${U}: ${tt}`)),!1}return at}if(H)for(const U in H){let tt=0,at=0;const et=H[U];if(Array.isArray(et))for(let ut=0;ut<et.length;ut++){if(!(at=K(U,et[ut])))return!1;tt+=at}else{if(!(at=K(U,et)))return!1;tt=at}if(!tt)return!1;$+=tt}return{length:n.byteLength(w($))+$,write(){Y(j,H,$)}}}function P(j,H,$,K){const U=["reasonString","userProperties"],tt=$&&$.properties&&$.properties.maximumPacketSize?$.properties.maximumPacketSize:0;let at=R(j,H);if(tt)for(;K+at.length>tt;){const et=U.shift();if(!et||!H[et])return!1;delete H[et],at=R(j,H)}return at}function M(j,H,$){switch(r.propertiesTypes[H]){case"byte":j.write(n.from([r.properties[H]])),j.write(n.from([+$]));break;case"int8":j.write(n.from([r.properties[H]])),j.write(n.from([$]));break;case"binary":j.write(n.from([r.properties[H]])),F(j,$);break;case"int16":j.write(n.from([r.properties[H]])),_(j,$);break;case"int32":j.write(n.from([r.properties[H]])),function(K,U){const tt=y(U);f("write4ByteNumber: %o",tt),K.write(tt)}(j,$);break;case"var":j.write(n.from([r.properties[H]])),I(j,$);break;case"string":j.write(n.from([r.properties[H]])),D(j,$);break;case"pair":Object.getOwnPropertyNames($).forEach(K=>{const U=$[K];Array.isArray(U)?U.forEach(tt=>{j.write(n.from([r.properties[H]])),B(j,K.toString(),tt.toString())}):(j.write(n.from([r.properties[H]])),B(j,K.toString(),U.toString()))});break;default:return j.emit("error",new Error(`Invalid property ${H} value: ${$}`)),!1}}function Y(j,H,$){I(j,$);for(const K in H)if(Object.prototype.hasOwnProperty.call(H,K)&&H[K]!==null){const U=H[K];if(Array.isArray(U))for(let tt=0;tt<U.length;tt++)M(j,K,U[tt]);else M(j,K,U)}}function Z(j){return j?j instanceof n?j.length:n.byteLength(j):0}function nt(j){return typeof j=="string"||j instanceof n}a.exports=x}).call(this)}).call(this,i("buffer").Buffer)},{"./constants":38,"./numbers":41,buffer:17,debug:18,"process-nextick-args":49}],45:[function(i,a,s){var n=1e3,r=60*n,l=60*r,o=24*l,u=7*o,c=365.25*o;function f(g,v,m,w){var y=v>=1.5*m;return Math.round(g/m)+" "+w+(y?"s":"")}a.exports=function(g,v){v=v||{};var m=typeof g;if(m==="string"&&g.length>0)return function(w){if(!((w=String(w)).length>100)){var y=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(w);if(!!y){var _=parseFloat(y[1]);switch((y[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return _*c;case"weeks":case"week":case"w":return _*u;case"days":case"day":case"d":return _*o;case"hours":case"hour":case"hrs":case"hr":case"h":return _*l;case"minutes":case"minute":case"mins":case"min":case"m":return _*r;case"seconds":case"second":case"secs":case"sec":case"s":return _*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return _;default:return}}}}(g);if(m==="number"&&isFinite(g))return v.long?function(w){var y=Math.abs(w);return y>=o?f(w,y,o,"day"):y>=l?f(w,y,l,"hour"):y>=r?f(w,y,r,"minute"):y>=n?f(w,y,n,"second"):w+" ms"}(g):function(w){var y=Math.abs(w);return y>=o?Math.round(w/o)+"d":y>=l?Math.round(w/l)+"h":y>=r?Math.round(w/r)+"m":y>=n?Math.round(w/n)+"s":w+"ms"}(g);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(g))}},{}],46:[function(i,a,s){const n=i("./lib/number-allocator.js");a.exports.NumberAllocator=n},{"./lib/number-allocator.js":47}],47:[function(i,a,s){const n=i("js-sdsl").Set,r=i("debug")("number-allocator:trace"),l=i("debug")("number-allocator:error");function o(c,f){this.low=c,this.high=f}function u(c,f){if(!(this instanceof u))return new u(c,f);this.min=c,this.max=f,this.ss=new n([],(g,v)=>g.compare(v)),r("Create"),this.clear()}o.prototype.equals=function(c){return this.low===c.low&&this.high===c.high},o.prototype.compare=function(c){return this.low<c.low&&this.high<c.low?-1:c.low<this.low&&c.high<this.low?1:0},u.prototype.firstVacant=function(){return this.ss.size()===0?null:this.ss.front().low},u.prototype.alloc=function(){if(this.ss.size()===0)return r("alloc():empty"),null;const c=this.ss.front(),f=c.low;return f+1<=c.high?++c.low:this.ss.eraseElementByPos(0),r("alloc():"+f),f},u.prototype.use=function(c){const f=new o(c,c),g=this.ss.lowerBound(f);if(g){if(g.equals(f))return this.ss.eraseElementByValue(g),r("use():"+c),!0;if(g.low>c)return!1;if(g.low===c)return++g.low,r("use():"+c),!0;if(g.high===c)return--g.high,r("use():"+c),!0;const v=g.low;return g.low=c+1,this.ss.insert(new o(v,c-1)),r("use():"+c),!0}return r("use():failed"),!1},u.prototype.free=function(c){if(c<this.min||c>this.max)return void l("free():"+c+" is out of range");const f=new o(c,c),g=this.ss.lowerBound(f);if(g){if(g.low<=c&&c<=g.high)return void l("free():"+c+" has already been vacant");if(g===this.ss.front())c+1===g.low?--g.low:this.ss.insert(f);else{const v=this.ss.reverseLowerBound(f);v.high+1===c?c+1===g.low?(this.ss.eraseElementByValue(v),g.low=v.low):v.high=c:c+1===g.low?g.low=c:this.ss.insert(f)}}else{if(g===this.ss.front())return void this.ss.insert(f);const v=this.ss.reverseLowerBound(f);v.high+1===c?v.high=c:this.ss.insert(f)}r("free():"+c)},u.prototype.clear=function(){r("clear()"),this.ss.clear(),this.ss.insert(new o(this.min,this.max))},u.prototype.intervalCount=function(){return this.ss.size()},u.prototype.dump=function(){console.log("length:"+this.ss.size());for(const c of this.ss)console.log(c)},a.exports=u},{debug:18,"js-sdsl":36}],48:[function(i,a,s){var n=i("wrappy");function r(o){var u=function(){return u.called?u.value:(u.called=!0,u.value=o.apply(this,arguments))};return u.called=!1,u}function l(o){var u=function(){if(u.called)throw new Error(u.onceError);return u.called=!0,u.value=o.apply(this,arguments)},c=o.name||"Function wrapped with `once`";return u.onceError=c+" shouldn't be called more than once",u.called=!1,u}a.exports=n(r),a.exports.strict=n(l),r.proto=r(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return r(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return l(this)},configurable:!0})})},{wrappy:79}],49:[function(i,a,s){(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(r,l,o,u){if(typeof r!="function")throw new TypeError('"callback" argument must be a function');var c,f,g=arguments.length;switch(g){case 0:case 1:return n.nextTick(r);case 2:return n.nextTick(function(){r.call(null,l)});case 3:return n.nextTick(function(){r.call(null,l,o)});case 4:return n.nextTick(function(){r.call(null,l,o,u)});default:for(c=new Array(g-1),f=0;f<c.length;)c[f++]=arguments[f];return n.nextTick(function(){r.apply(null,c)})}}}:a.exports=n}).call(this)}).call(this,i("_process"))},{_process:50}],50:[function(i,a,s){var n,r,l=a.exports={};function o(){throw new Error("setTimeout has not been defined")}function u(){throw new Error("clearTimeout has not been defined")}function c(x){if(n===setTimeout)return setTimeout(x,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(x,0);try{return n(x,0)}catch{try{return n.call(null,x,0)}catch{return n.call(this,x,0)}}}(function(){try{n=typeof setTimeout=="function"?setTimeout:o}catch{n=o}try{r=typeof clearTimeout=="function"?clearTimeout:u}catch{r=u}})();var f,g=[],v=!1,m=-1;function w(){v&&f&&(v=!1,f.length?g=f.concat(g):m=-1,g.length&&y())}function y(){if(!v){var x=c(w);v=!0;for(var C=g.length;C;){for(f=g,g=[];++m<C;)f&&f[m].run();m=-1,C=g.length}f=null,v=!1,function(T){if(r===clearTimeout)return clearTimeout(T);if((r===u||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(T);try{r(T)}catch{try{return r.call(null,T)}catch{return r.call(this,T)}}}(x)}}function _(x,C){this.fun=x,this.array=C}function A(){}l.nextTick=function(x){var C=new Array(arguments.length-1);if(arguments.length>1)for(var T=1;T<arguments.length;T++)C[T-1]=arguments[T];g.push(new _(x,C)),g.length!==1||v||c(y)},_.prototype.run=function(){this.fun.apply(null,this.array)},l.title="browser",l.browser=!0,l.env={},l.argv=[],l.version="",l.versions={},l.on=A,l.addListener=A,l.once=A,l.off=A,l.removeListener=A,l.removeAllListeners=A,l.emit=A,l.prependListener=A,l.prependOnceListener=A,l.listeners=function(x){return[]},l.binding=function(x){throw new Error("process.binding is not supported")},l.cwd=function(){return"/"},l.chdir=function(x){throw new Error("process.chdir is not supported")},l.umask=function(){return 0}},{}],51:[function(i,a,s){(function(n){(function(){(function(r){var l=typeof s=="object"&&s&&!s.nodeType&&s,o=typeof a=="object"&&a&&!a.nodeType&&a,u=typeof n=="object"&&n;u.global!==u&&u.window!==u&&u.self!==u||(r=u);var c,f,g=2147483647,v=36,m=1,w=26,y=38,_=700,A=72,x=128,C="-",T=/^xn--/,I=/[^\x20-\x7E]/,D=/[\x2E\u3002\uFF0E\uFF61]/g,B={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},V=v-m,Q=Math.floor,F=String.fromCharCode;function R(K){throw new RangeError(B[K])}function P(K,U){for(var tt=K.length,at=[];tt--;)at[tt]=U(K[tt]);return at}function M(K,U){var tt=K.split("@"),at="";return tt.length>1&&(at=tt[0]+"@",K=tt[1]),at+P((K=K.replace(D,".")).split("."),U).join(".")}function Y(K){for(var U,tt,at=[],et=0,ut=K.length;et<ut;)(U=K.charCodeAt(et++))>=55296&&U<=56319&&et<ut?(64512&(tt=K.charCodeAt(et++)))==56320?at.push(((1023&U)<<10)+(1023&tt)+65536):(at.push(U),et--):at.push(U);return at}function Z(K){return P(K,function(U){var tt="";return U>65535&&(tt+=F((U-=65536)>>>10&1023|55296),U=56320|1023&U),tt+=F(U)}).join("")}function nt(K,U){return K+22+75*(K<26)-((U!=0)<<5)}function j(K,U,tt){var at=0;for(K=tt?Q(K/_):K>>1,K+=Q(K/U);K>V*w>>1;at+=v)K=Q(K/V);return Q(at+(V+1)*K/(K+y))}function H(K){var U,tt,at,et,ut,ct,ot,b,E,S,N,X=[],G=K.length,rt=0,yt=x,mt=A;for((tt=K.lastIndexOf(C))<0&&(tt=0),at=0;at<tt;++at)K.charCodeAt(at)>=128&&R("not-basic"),X.push(K.charCodeAt(at));for(et=tt>0?tt+1:0;et<G;){for(ut=rt,ct=1,ot=v;et>=G&&R("invalid-input"),((b=(N=K.charCodeAt(et++))-48<10?N-22:N-65<26?N-65:N-97<26?N-97:v)>=v||b>Q((g-rt)/ct))&&R("overflow"),rt+=b*ct,!(b<(E=ot<=mt?m:ot>=mt+w?w:ot-mt));ot+=v)ct>Q(g/(S=v-E))&&R("overflow"),ct*=S;mt=j(rt-ut,U=X.length+1,ut==0),Q(rt/U)>g-yt&&R("overflow"),yt+=Q(rt/U),rt%=U,X.splice(rt++,0,yt)}return Z(X)}function $(K){var U,tt,at,et,ut,ct,ot,b,E,S,N,X,G,rt,yt,mt=[];for(X=(K=Y(K)).length,U=x,tt=0,ut=A,ct=0;ct<X;++ct)(N=K[ct])<128&&mt.push(F(N));for(at=et=mt.length,et&&mt.push(C);at<X;){for(ot=g,ct=0;ct<X;++ct)(N=K[ct])>=U&&N<ot&&(ot=N);for(ot-U>Q((g-tt)/(G=at+1))&&R("overflow"),tt+=(ot-U)*G,U=ot,ct=0;ct<X;++ct)if((N=K[ct])<U&&++tt>g&&R("overflow"),N==U){for(b=tt,E=v;!(b<(S=E<=ut?m:E>=ut+w?w:E-ut));E+=v)yt=b-S,rt=v-S,mt.push(F(nt(S+yt%rt,0))),b=Q(yt/rt);mt.push(F(nt(b,0))),ut=j(tt,G,at==et),tt=0,++at}++tt,++U}return mt.join("")}if(c={version:"1.4.1",ucs2:{decode:Y,encode:Z},decode:H,encode:$,toASCII:function(K){return M(K,function(U){return I.test(U)?"xn--"+$(U):U})},toUnicode:function(K){return M(K,function(U){return T.test(U)?H(U.slice(4).toLowerCase()):U})}},l&&o)if(a.exports==l)o.exports=c;else for(f in c)c.hasOwnProperty(f)&&(l[f]=c[f]);else r.punycode=c})(this)}).call(this)}).call(this,typeof Be<"u"?Be:typeof self<"u"?self:typeof window<"u"?window:{})},{}],52:[function(i,a,s){function n(l,o){return Object.prototype.hasOwnProperty.call(l,o)}a.exports=function(l,o,u,c){o=o||"&",u=u||"=";var f={};if(typeof l!="string"||l.length===0)return f;var g=/\+/g;l=l.split(o);var v=1e3;c&&typeof c.maxKeys=="number"&&(v=c.maxKeys);var m=l.length;v>0&&m>v&&(m=v);for(var w=0;w<m;++w){var y,_,A,x,C=l[w].replace(g,"%20"),T=C.indexOf(u);T>=0?(y=C.substr(0,T),_=C.substr(T+1)):(y=C,_=""),A=decodeURIComponent(y),x=decodeURIComponent(_),n(f,A)?r(f[A])?f[A].push(x):f[A]=[f[A],x]:f[A]=x}return f};var r=Array.isArray||function(l){return Object.prototype.toString.call(l)==="[object Array]"}},{}],53:[function(i,a,s){var n=function(u){switch(typeof u){case"string":return u;case"boolean":return u?"true":"false";case"number":return isFinite(u)?u:"";default:return""}};a.exports=function(u,c,f,g){return c=c||"&",f=f||"=",u===null&&(u=void 0),typeof u=="object"?l(o(u),function(v){var m=encodeURIComponent(n(v))+f;return r(u[v])?l(u[v],function(w){return m+encodeURIComponent(n(w))}).join(c):m+encodeURIComponent(n(u[v]))}).join(c):g?encodeURIComponent(n(g))+f+encodeURIComponent(n(u)):""};var r=Array.isArray||function(u){return Object.prototype.toString.call(u)==="[object Array]"};function l(u,c){if(u.map)return u.map(c);for(var f=[],g=0;g<u.length;g++)f.push(c(u[g],g));return f}var o=Object.keys||function(u){var c=[];for(var f in u)Object.prototype.hasOwnProperty.call(u,f)&&c.push(f);return c}},{}],54:[function(i,a,s){s.decode=s.parse=i("./decode"),s.encode=s.stringify=i("./encode")},{"./decode":52,"./encode":53}],55:[function(i,a,s){var n={};function r(o,u,c){c||(c=Error);var f=function(g){var v,m;function w(y,_,A){return g.call(this,function(x,C,T){return typeof u=="string"?u:u(x,C,T)}(y,_,A))||this}return m=g,(v=w).prototype=Object.create(m.prototype),v.prototype.constructor=v,v.__proto__=m,w}(c);f.prototype.name=c.name,f.prototype.code=o,n[o]=f}function l(o,u){if(Array.isArray(o)){var c=o.length;return o=o.map(function(f){return String(f)}),c>2?"one of ".concat(u," ").concat(o.slice(0,c-1).join(", "),", or ")+o[c-1]:c===2?"one of ".concat(u," ").concat(o[0]," or ").concat(o[1]):"of ".concat(u," ").concat(o[0])}return"of ".concat(u," ").concat(String(o))}r("ERR_INVALID_OPT_VALUE",function(o,u){return'The value "'+u+'" is invalid for option "'+o+'"'},TypeError),r("ERR_INVALID_ARG_TYPE",function(o,u,c){var f,g,v;if(typeof u=="string"&&(g="not ",u.substr(0,g.length)===g)?(f="must not be",u=u.replace(/^not /,"")):f="must be",function(w,y,_){return(_===void 0||_>w.length)&&(_=w.length),w.substring(_-y.length,_)===y}(o," argument"))v="The ".concat(o," ").concat(f," ").concat(l(u,"type"));else{var m=function(w,y,_){return typeof _!="number"&&(_=0),!(_+y.length>w.length)&&w.indexOf(y,_)!==-1}(o,".")?"property":"argument";v='The "'.concat(o,'" ').concat(m," ").concat(f," ").concat(l(u,"type"))}return v+=". Received type ".concat(typeof c)},TypeError),r("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),r("ERR_METHOD_NOT_IMPLEMENTED",function(o){return"The "+o+" method is not implemented"}),r("ERR_STREAM_PREMATURE_CLOSE","Premature close"),r("ERR_STREAM_DESTROYED",function(o){return"Cannot call "+o+" after a stream was destroyed"}),r("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),r("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),r("ERR_STREAM_WRITE_AFTER_END","write after end"),r("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),r("ERR_UNKNOWN_ENCODING",function(o){return"Unknown encoding: "+o},TypeError),r("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),a.exports.codes=n},{}],56:[function(i,a,s){(function(n){(function(){var r=Object.keys||function(w){var y=[];for(var _ in w)y.push(_);return y};a.exports=g;var l=i("./_stream_readable"),o=i("./_stream_writable");i("inherits")(g,l);for(var u=r(o.prototype),c=0;c<u.length;c++){var f=u[c];g.prototype[f]||(g.prototype[f]=o.prototype[f])}function g(w){if(!(this instanceof g))return new g(w);l.call(this,w),o.call(this,w),this.allowHalfOpen=!0,w&&(w.readable===!1&&(this.readable=!1),w.writable===!1&&(this.writable=!1),w.allowHalfOpen===!1&&(this.allowHalfOpen=!1,this.once("end",v)))}function v(){this._writableState.ended||n.nextTick(m,this)}function m(w){w.end()}Object.defineProperty(g.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(g.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(g.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(g.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState!==void 0&&this._writableState!==void 0&&this._readableState.destroyed&&this._writableState.destroyed},set:function(w){this._readableState!==void 0&&this._writableState!==void 0&&(this._readableState.destroyed=w,this._writableState.destroyed=w)}})}).call(this)}).call(this,i("_process"))},{"./_stream_readable":58,"./_stream_writable":60,_process:50,inherits:24}],57:[function(i,a,s){a.exports=r;var n=i("./_stream_transform");function r(l){if(!(this instanceof r))return new r(l);n.call(this,l)}i("inherits")(r,n),r.prototype._transform=function(l,o,u){u(null,l)}},{"./_stream_transform":59,inherits:24}],58:[function(i,a,s){(function(n,r){(function(){var l;a.exports=R,R.ReadableState=F,i("events").EventEmitter;var o=function(b,E){return b.listeners(E).length},u=i("./internal/streams/stream"),c=i("buffer").Buffer,f=r.Uint8Array||function(){},g,v=i("util");g=v&&v.debuglog?v.debuglog("stream"):function(){};var m,w,y,_=i("./internal/streams/buffer_list"),A=i("./internal/streams/destroy"),x=i("./internal/streams/state").getHighWaterMark,C=i("../errors").codes,T=C.ERR_INVALID_ARG_TYPE,I=C.ERR_STREAM_PUSH_AFTER_EOF,D=C.ERR_METHOD_NOT_IMPLEMENTED,B=C.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;i("inherits")(R,u);var V=A.errorOrDestroy,Q=["error","close","destroy","pause","resume"];function F(b,E,S){l=l||i("./_stream_duplex"),b=b||{},typeof S!="boolean"&&(S=E instanceof l),this.objectMode=!!b.objectMode,S&&(this.objectMode=this.objectMode||!!b.readableObjectMode),this.highWaterMark=x(this,b,"readableHighWaterMark",S),this.buffer=new _,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=b.emitClose!==!1,this.autoDestroy=!!b.autoDestroy,this.destroyed=!1,this.defaultEncoding=b.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,b.encoding&&(m||(m=i("string_decoder/").StringDecoder),this.decoder=new m(b.encoding),this.encoding=b.encoding)}function R(b){if(l=l||i("./_stream_duplex"),!(this instanceof R))return new R(b);var E=this instanceof l;this._readableState=new F(b,this,E),this.readable=!0,b&&(typeof b.read=="function"&&(this._read=b.read),typeof b.destroy=="function"&&(this._destroy=b.destroy)),u.call(this)}function P(b,E,S,N,X){g("readableAddChunk",E);var G,rt=b._readableState;if(E===null)rt.reading=!1,function(yt,mt){if(g("onEofChunk"),!mt.ended){if(mt.decoder){var At=mt.decoder.end();At&&At.length&&(mt.buffer.push(At),mt.length+=mt.objectMode?1:At.length)}mt.ended=!0,mt.sync?nt(yt):(mt.needReadable=!1,mt.emittedReadable||(mt.emittedReadable=!0,j(yt)))}}(b,rt);else if(X||(G=function(yt,mt){var At;Rt=mt,c.isBuffer(Rt)||Rt instanceof f||typeof mt=="string"||mt===void 0||yt.objectMode||(At=new T("chunk",["string","Buffer","Uint8Array"],mt));var Rt;return At}(rt,E)),G)V(b,G);else if(rt.objectMode||E&&E.length>0)if(typeof E=="string"||rt.objectMode||Object.getPrototypeOf(E)===c.prototype||(E=function(yt){return c.from(yt)}(E)),N)rt.endEmitted?V(b,new B):M(b,rt,E,!0);else if(rt.ended)V(b,new I);else{if(rt.destroyed)return!1;rt.reading=!1,rt.decoder&&!S?(E=rt.decoder.write(E),rt.objectMode||E.length!==0?M(b,rt,E,!1):H(b,rt)):M(b,rt,E,!1)}else N||(rt.reading=!1,H(b,rt));return!rt.ended&&(rt.length<rt.highWaterMark||rt.length===0)}function M(b,E,S,N){E.flowing&&E.length===0&&!E.sync?(E.awaitDrain=0,b.emit("data",S)):(E.length+=E.objectMode?1:S.length,N?E.buffer.unshift(S):E.buffer.push(S),E.needReadable&&nt(b)),H(b,E)}Object.defineProperty(R.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState!==void 0&&this._readableState.destroyed},set:function(b){this._readableState&&(this._readableState.destroyed=b)}}),R.prototype.destroy=A.destroy,R.prototype._undestroy=A.undestroy,R.prototype._destroy=function(b,E){E(b)},R.prototype.push=function(b,E){var S,N=this._readableState;return N.objectMode?S=!0:typeof b=="string"&&((E=E||N.defaultEncoding)!==N.encoding&&(b=c.from(b,E),E=""),S=!0),P(this,b,E,!1,S)},R.prototype.unshift=function(b){return P(this,b,null,!0,!1)},R.prototype.isPaused=function(){return this._readableState.flowing===!1},R.prototype.setEncoding=function(b){m||(m=i("string_decoder/").StringDecoder);var E=new m(b);this._readableState.decoder=E,this._readableState.encoding=this._readableState.decoder.encoding;for(var S=this._readableState.buffer.head,N="";S!==null;)N+=E.write(S.data),S=S.next;return this._readableState.buffer.clear(),N!==""&&this._readableState.buffer.push(N),this._readableState.length=N.length,this};var Y=1073741824;function Z(b,E){return b<=0||E.length===0&&E.ended?0:E.objectMode?1:b!=b?E.flowing&&E.length?E.buffer.head.data.length:E.length:(b>E.highWaterMark&&(E.highWaterMark=function(S){return S>=Y?S=Y:(S--,S|=S>>>1,S|=S>>>2,S|=S>>>4,S|=S>>>8,S|=S>>>16,S++),S}(b)),b<=E.length?b:E.ended?E.length:(E.needReadable=!0,0))}function nt(b){var E=b._readableState;g("emitReadable",E.needReadable,E.emittedReadable),E.needReadable=!1,E.emittedReadable||(g("emitReadable",E.flowing),E.emittedReadable=!0,n.nextTick(j,b))}function j(b){var E=b._readableState;g("emitReadable_",E.destroyed,E.length,E.ended),E.destroyed||!E.length&&!E.ended||(b.emit("readable"),E.emittedReadable=!1),E.needReadable=!E.flowing&&!E.ended&&E.length<=E.highWaterMark,at(b)}function H(b,E){E.readingMore||(E.readingMore=!0,n.nextTick($,b,E))}function $(b,E){for(;!E.reading&&!E.ended&&(E.length<E.highWaterMark||E.flowing&&E.length===0);){var S=E.length;if(g("maybeReadMore read 0"),b.read(0),S===E.length)break}E.readingMore=!1}function K(b){var E=b._readableState;E.readableListening=b.listenerCount("readable")>0,E.resumeScheduled&&!E.paused?E.flowing=!0:b.listenerCount("data")>0&&b.resume()}function U(b){g("readable nexttick read 0"),b.read(0)}function tt(b,E){g("resume",E.reading),E.reading||b.read(0),E.resumeScheduled=!1,b.emit("resume"),at(b),E.flowing&&!E.reading&&b.read(0)}function at(b){var E=b._readableState;for(g("flow",E.flowing);E.flowing&&b.read()!==null;);}function et(b,E){return E.length===0?null:(E.objectMode?S=E.buffer.shift():!b||b>=E.length?(S=E.decoder?E.buffer.join(""):E.buffer.length===1?E.buffer.first():E.buffer.concat(E.length),E.buffer.clear()):S=E.buffer.consume(b,E.decoder),S);var S}function ut(b){var E=b._readableState;g("endReadable",E.endEmitted),E.endEmitted||(E.ended=!0,n.nextTick(ct,E,b))}function ct(b,E){if(g("endReadableNT",b.endEmitted,b.length),!b.endEmitted&&b.length===0&&(b.endEmitted=!0,E.readable=!1,E.emit("end"),b.autoDestroy)){var S=E._writableState;(!S||S.autoDestroy&&S.finished)&&E.destroy()}}function ot(b,E){for(var S=0,N=b.length;S<N;S++)if(b[S]===E)return S;return-1}R.prototype.read=function(b){g("read",b),b=parseInt(b,10);var E=this._readableState,S=b;if(b!==0&&(E.emittedReadable=!1),b===0&&E.needReadable&&((E.highWaterMark!==0?E.length>=E.highWaterMark:E.length>0)||E.ended))return g("read: emitReadable",E.length,E.ended),E.length===0&&E.ended?ut(this):nt(this),null;if((b=Z(b,E))===0&&E.ended)return E.length===0&&ut(this),null;var N,X=E.needReadable;return g("need readable",X),(E.length===0||E.length-b<E.highWaterMark)&&g("length less than watermark",X=!0),E.ended||E.reading?g("reading or ended",X=!1):X&&(g("do read"),E.reading=!0,E.sync=!0,E.length===0&&(E.needReadable=!0),this._read(E.highWaterMark),E.sync=!1,E.reading||(b=Z(S,E))),(N=b>0?et(b,E):null)===null?(E.needReadable=E.length<=E.highWaterMark,b=0):(E.length-=b,E.awaitDrain=0),E.length===0&&(E.ended||(E.needReadable=!0),S!==b&&E.ended&&ut(this)),N!==null&&this.emit("data",N),N},R.prototype._read=function(b){V(this,new D("_read()"))},R.prototype.pipe=function(b,E){var S=this,N=this._readableState;switch(N.pipesCount){case 0:N.pipes=b;break;case 1:N.pipes=[N.pipes,b];break;default:N.pipes.push(b)}N.pipesCount+=1,g("pipe count=%d opts=%j",N.pipesCount,E);var X=(!E||E.end!==!1)&&b!==n.stdout&&b!==n.stderr?rt:xe;function G(jt,te){g("onunpipe"),jt===S&&te&&te.hasUnpiped===!1&&(te.hasUnpiped=!0,g("cleanup"),b.removeListener("close",be),b.removeListener("finish",ae),b.removeListener("drain",yt),b.removeListener("error",Rt),b.removeListener("unpipe",G),S.removeListener("end",rt),S.removeListener("end",xe),S.removeListener("data",At),mt=!0,!N.awaitDrain||b._writableState&&!b._writableState.needDrain||yt())}function rt(){g("onend"),b.end()}N.endEmitted?n.nextTick(X):S.once("end",X),b.on("unpipe",G);var yt=function(jt){return function(){var te=jt._readableState;g("pipeOnDrain",te.awaitDrain),te.awaitDrain&&te.awaitDrain--,te.awaitDrain===0&&o(jt,"data")&&(te.flowing=!0,at(jt))}}(S);b.on("drain",yt);var mt=!1;function At(jt){g("ondata");var te=b.write(jt);g("dest.write",te),te===!1&&((N.pipesCount===1&&N.pipes===b||N.pipesCount>1&&ot(N.pipes,b)!==-1)&&!mt&&(g("false write response, pause",N.awaitDrain),N.awaitDrain++),S.pause())}function Rt(jt){g("onerror",jt),xe(),b.removeListener("error",Rt),o(b,"error")===0&&V(b,jt)}function be(){b.removeListener("finish",ae),xe()}function ae(){g("onfinish"),b.removeListener("close",be),xe()}function xe(){g("unpipe"),S.unpipe(b)}return S.on("data",At),function(jt,te,xi){if(typeof jt.prependListener=="function")return jt.prependListener(te,xi);jt._events&&jt._events[te]?Array.isArray(jt._events[te])?jt._events[te].unshift(xi):jt._events[te]=[xi,jt._events[te]]:jt.on(te,xi)}(b,"error",Rt),b.once("close",be),b.once("finish",ae),b.emit("pipe",S),N.flowing||(g("pipe resume"),S.resume()),b},R.prototype.unpipe=function(b){var E=this._readableState,S={hasUnpiped:!1};if(E.pipesCount===0)return this;if(E.pipesCount===1)return b&&b!==E.pipes?this:(b||(b=E.pipes),E.pipes=null,E.pipesCount=0,E.flowing=!1,b&&b.emit("unpipe",this,S),this);if(!b){var N=E.pipes,X=E.pipesCount;E.pipes=null,E.pipesCount=0,E.flowing=!1;for(var G=0;G<X;G++)N[G].emit("unpipe",this,{hasUnpiped:!1});return this}var rt=ot(E.pipes,b);return rt===-1?this:(E.pipes.splice(rt,1),E.pipesCount-=1,E.pipesCount===1&&(E.pipes=E.pipes[0]),b.emit("unpipe",this,S),this)},R.prototype.on=function(b,E){var S=u.prototype.on.call(this,b,E),N=this._readableState;return b==="data"?(N.readableListening=this.listenerCount("readable")>0,N.flowing!==!1&&this.resume()):b==="readable"&&(N.endEmitted||N.readableListening||(N.readableListening=N.needReadable=!0,N.flowing=!1,N.emittedReadable=!1,g("on readable",N.length,N.reading),N.length?nt(this):N.reading||n.nextTick(U,this))),S},R.prototype.addListener=R.prototype.on,R.prototype.removeListener=function(b,E){var S=u.prototype.removeListener.call(this,b,E);return b==="readable"&&n.nextTick(K,this),S},R.prototype.removeAllListeners=function(b){var E=u.prototype.removeAllListeners.apply(this,arguments);return b!=="readable"&&b!==void 0||n.nextTick(K,this),E},R.prototype.resume=function(){var b=this._readableState;return b.flowing||(g("resume"),b.flowing=!b.readableListening,function(E,S){S.resumeScheduled||(S.resumeScheduled=!0,n.nextTick(tt,E,S))}(this,b)),b.paused=!1,this},R.prototype.pause=function(){return g("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(g("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},R.prototype.wrap=function(b){var E=this,S=this._readableState,N=!1;for(var X in b.on("end",function(){if(g("wrapped end"),S.decoder&&!S.ended){var rt=S.decoder.end();rt&&rt.length&&E.push(rt)}E.push(null)}),b.on("data",function(rt){g("wrapped data"),S.decoder&&(rt=S.decoder.write(rt)),(!S.objectMode||rt!=null)&&(S.objectMode||rt&&rt.length)&&(E.push(rt)||(N=!0,b.pause()))}),b)this[X]===void 0&&typeof b[X]=="function"&&(this[X]=function(rt){return function(){return b[rt].apply(b,arguments)}}(X));for(var G=0;G<Q.length;G++)b.on(Q[G],this.emit.bind(this,Q[G]));return this._read=function(rt){g("wrapped _read",rt),N&&(N=!1,b.resume())},this},typeof Symbol=="function"&&(R.prototype[Symbol.asyncIterator]=function(){return w===void 0&&(w=i("./internal/streams/async_iterator")),w(this)}),Object.defineProperty(R.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(R.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(R.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(b){this._readableState&&(this._readableState.flowing=b)}}),R._fromList=et,Object.defineProperty(R.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),typeof Symbol=="function"&&(R.from=function(b,E){return y===void 0&&(y=i("./internal/streams/from")),y(R,b,E)})}).call(this)}).call(this,i("_process"),typeof Be<"u"?Be: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,s){a.exports=f;var n=i("../errors").codes,r=n.ERR_METHOD_NOT_IMPLEMENTED,l=n.ERR_MULTIPLE_CALLBACK,o=n.ERR_TRANSFORM_ALREADY_TRANSFORMING,u=n.ERR_TRANSFORM_WITH_LENGTH_0,c=i("./_stream_duplex");function f(m){if(!(this instanceof f))return new f(m);c.call(this,m),this._transformState={afterTransform:function(w,y){var _=this._transformState;_.transforming=!1;var A=_.writecb;if(A===null)return this.emit("error",new l);_.writechunk=null,_.writecb=null,y!=null&&this.push(y),A(w);var x=this._readableState;x.reading=!1,(x.needReadable||x.length<x.highWaterMark)&&this._read(x.highWaterMark)}.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,m&&(typeof m.transform=="function"&&(this._transform=m.transform),typeof m.flush=="function"&&(this._flush=m.flush)),this.on("prefinish",g)}function g(){var m=this;typeof this._flush!="function"||this._readableState.destroyed?v(this,null,null):this._flush(function(w,y){v(m,w,y)})}function v(m,w,y){if(w)return m.emit("error",w);if(y!=null&&m.push(y),m._writableState.length)throw new u;if(m._transformState.transforming)throw new o;return m.push(null)}i("inherits")(f,c),f.prototype.push=function(m,w){return this._transformState.needTransform=!1,c.prototype.push.call(this,m,w)},f.prototype._transform=function(m,w,y){y(new r("_transform()"))},f.prototype._write=function(m,w,y){var _=this._transformState;if(_.writecb=y,_.writechunk=m,_.writeencoding=w,!_.transforming){var A=this._readableState;(_.needTransform||A.needReadable||A.length<A.highWaterMark)&&this._read(A.highWaterMark)}},f.prototype._read=function(m){var w=this._transformState;w.writechunk===null||w.transforming?w.needTransform=!0:(w.transforming=!0,this._transform(w.writechunk,w.writeencoding,w.afterTransform))},f.prototype._destroy=function(m,w){c.prototype._destroy.call(this,m,function(y){w(y)})}},{"../errors":55,"./_stream_duplex":56,inherits:24}],60:[function(i,a,s){(function(n,r){(function(){function l(H){var $=this;this.next=null,this.entry=null,this.finish=function(){(function(K,U,tt){var at=K.entry;for(K.entry=null;at;){var et=at.callback;U.pendingcb--,et(tt),at=at.next}U.corkedRequestsFree.next=K})($,H)}}var o;a.exports=R,R.WritableState=F;var u={deprecate:i("util-deprecate")},c=i("./internal/streams/stream"),f=i("buffer").Buffer,g=r.Uint8Array||function(){},v,m=i("./internal/streams/destroy"),w=i("./internal/streams/state").getHighWaterMark,y=i("../errors").codes,_=y.ERR_INVALID_ARG_TYPE,A=y.ERR_METHOD_NOT_IMPLEMENTED,x=y.ERR_MULTIPLE_CALLBACK,C=y.ERR_STREAM_CANNOT_PIPE,T=y.ERR_STREAM_DESTROYED,I=y.ERR_STREAM_NULL_VALUES,D=y.ERR_STREAM_WRITE_AFTER_END,B=y.ERR_UNKNOWN_ENCODING,V=m.errorOrDestroy;function Q(){}function F(H,$,K){o=o||i("./_stream_duplex"),H=H||{},typeof K!="boolean"&&(K=$ instanceof o),this.objectMode=!!H.objectMode,K&&(this.objectMode=this.objectMode||!!H.writableObjectMode),this.highWaterMark=w(this,H,"writableHighWaterMark",K),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var U=H.decodeStrings===!1;this.decodeStrings=!U,this.defaultEncoding=H.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(tt){(function(at,et){var ut=at._writableState,ct=ut.sync,ot=ut.writecb;if(typeof ot!="function")throw new x;if(function(E){E.writing=!1,E.writecb=null,E.length-=E.writelen,E.writelen=0}(ut),et)(function(E,S,N,X,G){--S.pendingcb,N?(n.nextTick(G,X),n.nextTick(j,E,S),E._writableState.errorEmitted=!0,V(E,X)):(G(X),E._writableState.errorEmitted=!0,V(E,X),j(E,S))})(at,ut,ct,et,ot);else{var b=Z(ut)||at.destroyed;b||ut.corked||ut.bufferProcessing||!ut.bufferedRequest||Y(at,ut),ct?n.nextTick(M,at,ut,b,ot):M(at,ut,b,ot)}})($,tt)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=H.emitClose!==!1,this.autoDestroy=!!H.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new l(this)}function R(H){var $=this instanceof(o=o||i("./_stream_duplex"));if(!$&&!v.call(R,this))return new R(H);this._writableState=new F(H,this,$),this.writable=!0,H&&(typeof H.write=="function"&&(this._write=H.write),typeof H.writev=="function"&&(this._writev=H.writev),typeof H.destroy=="function"&&(this._destroy=H.destroy),typeof H.final=="function"&&(this._final=H.final)),c.call(this)}function P(H,$,K,U,tt,at,et){$.writelen=U,$.writecb=et,$.writing=!0,$.sync=!0,$.destroyed?$.onwrite(new T("write")):K?H._writev(tt,$.onwrite):H._write(tt,at,$.onwrite),$.sync=!1}function M(H,$,K,U){K||function(tt,at){at.length===0&&at.needDrain&&(at.needDrain=!1,tt.emit("drain"))}(H,$),$.pendingcb--,U(),j(H,$)}function Y(H,$){$.bufferProcessing=!0;var K=$.bufferedRequest;if(H._writev&&K&&K.next){var U=$.bufferedRequestCount,tt=new Array(U),at=$.corkedRequestsFree;at.entry=K;for(var et=0,ut=!0;K;)tt[et]=K,K.isBuf||(ut=!1),K=K.next,et+=1;tt.allBuffers=ut,P(H,$,!0,$.length,tt,"",at.finish),$.pendingcb++,$.lastBufferedRequest=null,at.next?($.corkedRequestsFree=at.next,at.next=null):$.corkedRequestsFree=new l($),$.bufferedRequestCount=0}else{for(;K;){var ct=K.chunk,ot=K.encoding,b=K.callback;if(P(H,$,!1,$.objectMode?1:ct.length,ct,ot,b),K=K.next,$.bufferedRequestCount--,$.writing)break}K===null&&($.lastBufferedRequest=null)}$.bufferedRequest=K,$.bufferProcessing=!1}function Z(H){return H.ending&&H.length===0&&H.bufferedRequest===null&&!H.finished&&!H.writing}function nt(H,$){H._final(function(K){$.pendingcb--,K&&V(H,K),$.prefinished=!0,H.emit("prefinish"),j(H,$)})}function j(H,$){var K=Z($);if(K&&(function(tt,at){at.prefinished||at.finalCalled||(typeof tt._final!="function"||at.destroyed?(at.prefinished=!0,tt.emit("prefinish")):(at.pendingcb++,at.finalCalled=!0,n.nextTick(nt,tt,at)))}(H,$),$.pendingcb===0&&($.finished=!0,H.emit("finish"),$.autoDestroy))){var U=H._readableState;(!U||U.autoDestroy&&U.endEmitted)&&H.destroy()}return K}i("inherits")(R,c),F.prototype.getBuffer=function(){for(var H=this.bufferedRequest,$=[];H;)$.push(H),H=H.next;return $},function(){try{Object.defineProperty(F.prototype,"buffer",{get:u.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"?(v=Function.prototype[Symbol.hasInstance],Object.defineProperty(R,Symbol.hasInstance,{value:function(H){return!!v.call(this,H)||this===R&&H&&H._writableState instanceof F}})):v=function(H){return H instanceof this},R.prototype.pipe=function(){V(this,new C)},R.prototype.write=function(H,$,K){var U,tt=this._writableState,at=!1,et=!tt.objectMode&&(U=H,f.isBuffer(U)||U instanceof g);return et&&!f.isBuffer(H)&&(H=function(ut){return f.from(ut)}(H)),typeof $=="function"&&(K=$,$=null),et?$="buffer":$||($=tt.defaultEncoding),typeof K!="function"&&(K=Q),tt.ending?function(ut,ct){var ot=new D;V(ut,ot),n.nextTick(ct,ot)}(this,K):(et||function(ut,ct,ot,b){var E;return ot===null?E=new I:typeof ot=="string"||ct.objectMode||(E=new _("chunk",["string","Buffer"],ot)),!E||(V(ut,E),n.nextTick(b,E),!1)}(this,tt,H,K))&&(tt.pendingcb++,at=function(ut,ct,ot,b,E,S){if(!ot){var N=function(yt,mt,At){return yt.objectMode||yt.decodeStrings===!1||typeof mt!="string"||(mt=f.from(mt,At)),mt}(ct,b,E);b!==N&&(ot=!0,E="buffer",b=N)}var X=ct.objectMode?1:b.length;ct.length+=X;var G=ct.length<ct.highWaterMark;if(G||(ct.needDrain=!0),ct.writing||ct.corked){var rt=ct.lastBufferedRequest;ct.lastBufferedRequest={chunk:b,encoding:E,isBuf:ot,callback:S,next:null},rt?rt.next=ct.lastBufferedRequest:ct.bufferedRequest=ct.lastBufferedRequest,ct.bufferedRequestCount+=1}else P(ut,ct,!1,X,b,E,S);return G}(this,tt,et,H,$,K)),at},R.prototype.cork=function(){this._writableState.corked++},R.prototype.uncork=function(){var H=this._writableState;H.corked&&(H.corked--,H.writing||H.corked||H.bufferProcessing||!H.bufferedRequest||Y(this,H))},R.prototype.setDefaultEncoding=function(H){if(typeof H=="string"&&(H=H.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((H+"").toLowerCase())>-1))throw new B(H);return this._writableState.defaultEncoding=H,this},Object.defineProperty(R.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(R.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),R.prototype._write=function(H,$,K){K(new A("_write()"))},R.prototype._writev=null,R.prototype.end=function(H,$,K){var U=this._writableState;return typeof H=="function"?(K=H,H=null,$=null):typeof $=="function"&&(K=$,$=null),H!=null&&this.write(H,$),U.corked&&(U.corked=1,this.uncork()),U.ending||function(tt,at,et){at.ending=!0,j(tt,at),et&&(at.finished?n.nextTick(et):tt.once("finish",et)),at.ended=!0,tt.writable=!1}(this,U,K),this},Object.defineProperty(R.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(R.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState!==void 0&&this._writableState.destroyed},set:function(H){this._writableState&&(this._writableState.destroyed=H)}}),R.prototype.destroy=m.destroy,R.prototype._undestroy=m.undestroy,R.prototype._destroy=function(H,$){$(H)}}).call(this)}).call(this,i("_process"),typeof Be<"u"?Be: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,s){(function(n){(function(){var r;function l(C,T,I){return T in C?Object.defineProperty(C,T,{value:I,enumerable:!0,configurable:!0,writable:!0}):C[T]=I,C}var o=i("./end-of-stream"),u=Symbol("lastResolve"),c=Symbol("lastReject"),f=Symbol("error"),g=Symbol("ended"),v=Symbol("lastPromise"),m=Symbol("handlePromise"),w=Symbol("stream");function y(C,T){return{value:C,done:T}}function _(C){var T=C[u];if(T!==null){var I=C[w].read();I!==null&&(C[v]=null,C[u]=null,C[c]=null,T(y(I,!1)))}}var A=Object.getPrototypeOf(function(){}),x=Object.setPrototypeOf((l(r={get stream(){return this[w]},next:function(){var C=this,T=this[f];if(T!==null)return Promise.reject(T);if(this[g])return Promise.resolve(y(void 0,!0));if(this[w].destroyed)return new Promise(function(V,Q){n.nextTick(function(){C[f]?Q(C[f]):V(y(void 0,!0))})});var I,D=this[v];if(D)I=new Promise(function(V,Q){return function(F,R){V.then(function(){Q[g]?F(y(void 0,!0)):Q[m](F,R)},R)}}(D,this));else{var B=this[w].read();if(B!==null)return Promise.resolve(y(B,!1));I=new Promise(this[m])}return this[v]=I,I}},Symbol.asyncIterator,function(){return this}),l(r,"return",function(){var C=this;return new Promise(function(T,I){C[w].destroy(null,function(D){D?I(D):T(y(void 0,!0))})})}),r),A);a.exports=function(C){var T,I=Object.create(x,(l(T={},w,{value:C,writable:!0}),l(T,u,{value:null,writable:!0}),l(T,c,{value:null,writable:!0}),l(T,f,{value:null,writable:!0}),l(T,g,{value:C._readableState.endEmitted,writable:!0}),l(T,m,{value:function(D,B){var V=I[w].read();V?(I[v]=null,I[u]=null,I[c]=null,D(y(V,!1))):(I[u]=D,I[c]=B)},writable:!0}),T));return I[v]=null,o(C,function(D){if(D&&D.code!=="ERR_STREAM_PREMATURE_CLOSE"){var B=I[c];return B!==null&&(I[v]=null,I[u]=null,I[c]=null,B(D)),void(I[f]=D)}var V=I[u];V!==null&&(I[v]=null,I[u]=null,I[c]=null,V(y(void 0,!0))),I[g]=!0}),C.on("readable",function(D){n.nextTick(_,D)}.bind(null,I)),I}}).call(this)}).call(this,i("_process"))},{"./end-of-stream":64,_process:50}],62:[function(i,a,s){function n(f,g){var v=Object.keys(f);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(f);g&&(m=m.filter(function(w){return Object.getOwnPropertyDescriptor(f,w).enumerable})),v.push.apply(v,m)}return v}function r(f,g,v){return g in f?Object.defineProperty(f,g,{value:v,enumerable:!0,configurable:!0,writable:!0}):f[g]=v,f}function l(f,g){for(var v=0;v<g.length;v++){var m=g[v];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Object.defineProperty(f,m.key,m)}}var o=i("buffer").Buffer,u=i("util").inspect,c=u&&u.custom||"inspect";a.exports=function(){function f(){(function(m,w){if(!(m instanceof w))throw new TypeError("Cannot call a class as a function")})(this,f),this.head=null,this.tail=null,this.length=0}var g,v;return g=f,(v=[{key:"push",value:function(m){var w={data:m,next:null};this.length>0?this.tail.next=w:this.head=w,this.tail=w,++this.length}},{key:"unshift",value:function(m){var w={data:m,next:this.head};this.length===0&&(this.tail=w),this.head=w,++this.length}},{key:"shift",value:function(){if(this.length!==0){var m=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,m}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(m){if(this.length===0)return"";for(var w=this.head,y=""+w.data;w=w.next;)y+=m+w.data;return y}},{key:"concat",value:function(m){if(this.length===0)return o.alloc(0);for(var w,y,_,A=o.allocUnsafe(m>>>0),x=this.head,C=0;x;)w=x.data,y=A,_=C,o.prototype.copy.call(w,y,_),C+=x.data.length,x=x.next;return A}},{key:"consume",value:function(m,w){var y;return m<this.head.data.length?(y=this.head.data.slice(0,m),this.head.data=this.head.data.slice(m)):y=m===this.head.data.length?this.shift():w?this._getString(m):this._getBuffer(m),y}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(m){var w=this.head,y=1,_=w.data;for(m-=_.length;w=w.next;){var A=w.data,x=m>A.length?A.length:m;if(x===A.length?_+=A:_+=A.slice(0,m),(m-=x)===0){x===A.length?(++y,w.next?this.head=w.next:this.head=this.tail=null):(this.head=w,w.data=A.slice(x));break}++y}return this.length-=y,_}},{key:"_getBuffer",value:function(m){var w=o.allocUnsafe(m),y=this.head,_=1;for(y.data.copy(w),m-=y.data.length;y=y.next;){var A=y.data,x=m>A.length?A.length:m;if(A.copy(w,w.length-m,0,x),(m-=x)===0){x===A.length?(++_,y.next?this.head=y.next:this.head=this.tail=null):(this.head=y,y.data=A.slice(x));break}++_}return this.length-=_,w}},{key:c,value:function(m,w){return u(this,function(y){for(var _=1;_<arguments.length;_++){var A=arguments[_]!=null?arguments[_]:{};_%2?n(Object(A),!0).forEach(function(x){r(y,x,A[x])}):Object.getOwnPropertyDescriptors?Object.defineProperties(y,Object.getOwnPropertyDescriptors(A)):n(Object(A)).forEach(function(x){Object.defineProperty(y,x,Object.getOwnPropertyDescriptor(A,x))})}return y}({},w,{depth:0,customInspect:!1}))}}])&&l(g.prototype,v),f}()},{buffer:17,util:16}],63:[function(i,a,s){(function(n){(function(){function r(u,c){o(u,c),l(u)}function l(u){u._writableState&&!u._writableState.emitClose||u._readableState&&!u._readableState.emitClose||u.emit("close")}function o(u,c){u.emit("error",c)}a.exports={destroy:function(u,c){var f=this,g=this._readableState&&this._readableState.destroyed,v=this._writableState&&this._writableState.destroyed;return g||v?(c?c(u):u&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,n.nextTick(o,this,u)):n.nextTick(o,this,u)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(u||null,function(m){!c&&m?f._writableState?f._writableState.errorEmitted?n.nextTick(l,f):(f._writableState.errorEmitted=!0,n.nextTick(r,f,m)):n.nextTick(r,f,m):c?(n.nextTick(l,f),c(m)):n.nextTick(l,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(u,c){var f=u._readableState,g=u._writableState;f&&f.autoDestroy||g&&g.autoDestroy?u.destroy(c):u.emit("error",c)}}}).call(this)}).call(this,i("_process"))},{_process:50}],64:[function(i,a,s){var n=i("../../../errors").codes.ERR_STREAM_PREMATURE_CLOSE;function r(){}a.exports=function l(o,u,c){if(typeof u=="function")return l(o,null,u);u||(u={}),c=function(T){var I=!1;return function(){if(!I){I=!0;for(var D=arguments.length,B=new Array(D),V=0;V<D;V++)B[V]=arguments[V];T.apply(this,B)}}}(c||r);var f=u.readable||u.readable!==!1&&o.readable,g=u.writable||u.writable!==!1&&o.writable,v=function(){o.writable||w()},m=o._writableState&&o._writableState.finished,w=function(){g=!1,m=!0,f||c.call(o)},y=o._readableState&&o._readableState.endEmitted,_=function(){f=!1,y=!0,g||c.call(o)},A=function(T){c.call(o,T)},x=function(){var T;return f&&!y?(o._readableState&&o._readableState.ended||(T=new n),c.call(o,T)):g&&!m?(o._writableState&&o._writableState.ended||(T=new n),c.call(o,T)):void 0},C=function(){o.req.on("finish",w)};return function(T){return T.setHeader&&typeof T.abort=="function"}(o)?(o.on("complete",w),o.on("abort",x),o.req?C():o.on("request",C)):g&&!o._writableState&&(o.on("end",v),o.on("close",v)),o.on("end",_),o.on("finish",w),u.error!==!1&&o.on("error",A),o.on("close",x),function(){o.removeListener("complete",w),o.removeListener("abort",x),o.removeListener("request",C),o.req&&o.req.removeListener("finish",w),o.removeListener("end",v),o.removeListener("close",v),o.removeListener("finish",w),o.removeListener("end",_),o.removeListener("error",A),o.removeListener("close",x)}}},{"../../../errors":55}],65:[function(i,a,s){a.exports=function(){throw new Error("Readable.from is not available in the browser")}},{}],66:[function(i,a,s){var n,r=i("../../../errors").codes,l=r.ERR_MISSING_ARGS,o=r.ERR_STREAM_DESTROYED;function u(g){if(g)throw g}function c(g){g()}function f(g,v){return g.pipe(v)}a.exports=function(){for(var g=arguments.length,v=new Array(g),m=0;m<g;m++)v[m]=arguments[m];var w,y=function(A){return A.length?typeof A[A.length-1]!="function"?u:A.pop():u}(v);if(Array.isArray(v[0])&&(v=v[0]),v.length<2)throw new l("streams");var _=v.map(function(A,x){var C=x<v.length-1;return function(T,I,D,B){B=function(F){var R=!1;return function(){R||(R=!0,F.apply(void 0,arguments))}}(B);var V=!1;T.on("close",function(){V=!0}),n===void 0&&(n=i("./end-of-stream")),n(T,{readable:I,writable:D},function(F){if(F)return B(F);V=!0,B()});var Q=!1;return function(F){if(!V&&!Q)return Q=!0,function(R){return R.setHeader&&typeof R.abort=="function"}(T)?T.abort():typeof T.destroy=="function"?T.destroy():void B(F||new o("pipe"))}}(A,C,x>0,function(T){w||(w=T),T&&_.forEach(c),C||(_.forEach(c),y(w))})});return v.reduce(f)}},{"../../../errors":55,"./end-of-stream":64}],67:[function(i,a,s){var n=i("../../../errors").codes.ERR_INVALID_OPT_VALUE;a.exports={getHighWaterMark:function(r,l,o,u){var c=function(f,g,v){return f.highWaterMark!=null?f.highWaterMark:g?f[v]:null}(l,u,o);if(c!=null){if(!isFinite(c)||Math.floor(c)!==c||c<0)throw new n(u?o:"highWaterMark",c);return Math.floor(c)}return r.objectMode?16:16384}}},{"../../../errors":55}],68:[function(i,a,s){a.exports=i("events").EventEmitter},{events:22}],69:[function(i,a,s){(s=a.exports=i("./lib/_stream_readable.js")).Stream=s,s.Readable=s,s.Writable=i("./lib/_stream_writable.js"),s.Duplex=i("./lib/_stream_duplex.js"),s.Transform=i("./lib/_stream_transform.js"),s.PassThrough=i("./lib/_stream_passthrough.js"),s.finished=i("./lib/internal/streams/end-of-stream.js"),s.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,s){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 r=0;r<n.length;r++)n[r]=arguments[r+2]}return new function(l,o,u){var c=this;this._callback=l,this._args=u,this._interval=setInterval(l,o,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,s){a.exports=i("./index.js")()},{"./index.js":72}],72:[function(i,a,s){(function(n){(function(){function r(l){return l instanceof n?n.from(l):new l.constructor(l.buffer.slice(),l.byteOffset,l.length)}a.exports=function(l){return(l=l||{}).circles?function(u){var c=[],f=[];return u.proto?function v(m){if(typeof m!="object"||m===null)return m;if(m instanceof Date)return new Date(m);if(Array.isArray(m))return g(m,v);if(m instanceof Map)return new Map(g(Array.from(m),v));if(m instanceof Set)return new Set(g(Array.from(m),v));var w={};for(var y in c.push(m),f.push(w),m){var _=m[y];if(typeof _!="object"||_===null)w[y]=_;else if(_ instanceof Date)w[y]=new Date(_);else if(_ instanceof Map)w[y]=new Map(g(Array.from(_),v));else if(_ instanceof Set)w[y]=new Set(g(Array.from(_),v));else if(ArrayBuffer.isView(_))w[y]=r(_);else{var A=c.indexOf(_);w[y]=A!==-1?f[A]:v(_)}}return c.pop(),f.pop(),w}:function v(m){if(typeof m!="object"||m===null)return m;if(m instanceof Date)return new Date(m);if(Array.isArray(m))return g(m,v);if(m instanceof Map)return new Map(g(Array.from(m),v));if(m instanceof Set)return new Set(g(Array.from(m),v));var w={};for(var y in c.push(m),f.push(w),m)if(Object.hasOwnProperty.call(m,y)!==!1){var _=m[y];if(typeof _!="object"||_===null)w[y]=_;else if(_ instanceof Date)w[y]=new Date(_);else if(_ instanceof Map)w[y]=new Map(g(Array.from(_),v));else if(_ instanceof Set)w[y]=new Set(g(Array.from(_),v));else if(ArrayBuffer.isView(_))w[y]=r(_);else{var A=c.indexOf(_);w[y]=A!==-1?f[A]:v(_)}}return c.pop(),f.pop(),w};function g(v,m){for(var w=Object.keys(v),y=new Array(w.length),_=0;_<w.length;_++){var A=w[_],x=v[A];if(typeof x!="object"||x===null)y[A]=x;else if(x instanceof Date)y[A]=new Date(x);else if(ArrayBuffer.isView(x))y[A]=r(x);else{var C=c.indexOf(x);y[A]=C!==-1?f[C]:m(x)}}return y}}(l):l.proto?function u(c){if(typeof c!="object"||c===null)return c;if(c instanceof Date)return new Date(c);if(Array.isArray(c))return o(c,u);if(c instanceof Map)return new Map(o(Array.from(c),u));if(c instanceof Set)return new Set(o(Array.from(c),u));var f={};for(var g in c){var v=c[g];typeof v!="object"||v===null?f[g]=v:v instanceof Date?f[g]=new Date(v):v instanceof Map?f[g]=new Map(o(Array.from(v),u)):v instanceof Set?f[g]=new Set(o(Array.from(v),u)):ArrayBuffer.isView(v)?f[g]=r(v):f[g]=u(v)}return f}:function u(c){if(typeof c!="object"||c===null)return c;if(c instanceof Date)return new Date(c);if(Array.isArray(c))return o(c,u);if(c instanceof Map)return new Map(o(Array.from(c),u));if(c instanceof Set)return new Set(o(Array.from(c),u));var f={};for(var g in c)if(Object.hasOwnProperty.call(c,g)!==!1){var v=c[g];typeof v!="object"||v===null?f[g]=v:v instanceof Date?f[g]=new Date(v):v instanceof Map?f[g]=new Map(o(Array.from(v),u)):v instanceof Set?f[g]=new Set(o(Array.from(v),u)):ArrayBuffer.isView(v)?f[g]=r(v):f[g]=u(v)}return f};function o(u,c){for(var f=Object.keys(u),g=new Array(f.length),v=0;v<f.length;v++){var m=f[v],w=u[m];typeof w!="object"||w===null?g[m]=w:w instanceof Date?g[m]=new Date(w):ArrayBuffer.isView(w)?g[m]=r(w):g[m]=c(w)}return g}}}).call(this)}).call(this,i("buffer").Buffer)},{buffer:17}],73:[function(i,a,s){var n=i("buffer"),r=n.Buffer;function l(u,c){for(var f in u)c[f]=u[f]}function o(u,c,f){return r(u,c,f)}r.from&&r.alloc&&r.allocUnsafe&&r.allocUnsafeSlow?a.exports=n:(l(n,s),s.Buffer=o),o.prototype=Object.create(r.prototype),l(r,o),o.from=function(u,c,f){if(typeof u=="number")throw new TypeError("Argument must not be a number");return r(u,c,f)},o.alloc=function(u,c,f){if(typeof u!="number")throw new TypeError("Argument must be a number");var g=r(u);return c!==void 0?typeof f=="string"?g.fill(c,f):g.fill(c):g.fill(0),g},o.allocUnsafe=function(u){if(typeof u!="number")throw new TypeError("Argument must be a number");return r(u)},o.allocUnsafeSlow=function(u){if(typeof u!="number")throw new TypeError("Argument must be a number");return n.SlowBuffer(u)}},{buffer:17}],74:[function(i,a,s){a.exports=function(n){var r=n._readableState;return r?r.objectMode||typeof n._duplexState=="number"?n.read():n.read((l=r,l.buffer.length?l.buffer.head?l.buffer.head.data.length:l.buffer[0].length:l.length)):null;var l}},{}],75:[function(i,a,s){var n=i("safe-buffer").Buffer,r=n.isEncoding||function(y){switch((y=""+y)&&y.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 l(y){var _;switch(this.encoding=function(A){var x=function(C){if(!C)return"utf8";for(var T;;)switch(C){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 C;default:if(T)return;C=(""+C).toLowerCase(),T=!0}}(A);if(typeof x!="string"&&(n.isEncoding===r||!r(A)))throw new Error("Unknown encoding: "+A);return x||A}(y),this.encoding){case"utf16le":this.text=c,this.end=f,_=4;break;case"utf8":this.fillLast=u,_=4;break;case"base64":this.text=g,this.end=v,_=3;break;default:return this.write=m,void(this.end=w)}this.lastNeed=0,this.lastTotal=0,this.lastChar=n.allocUnsafe(_)}function o(y){return y<=127?0:y>>5==6?2:y>>4==14?3:y>>3==30?4:y>>6==2?-1:-2}function u(y){var _=this.lastTotal-this.lastNeed,A=function(x,C,T){if((192&C[0])!=128)return x.lastNeed=0,"\uFFFD";if(x.lastNeed>1&&C.length>1){if((192&C[1])!=128)return x.lastNeed=1,"\uFFFD";if(x.lastNeed>2&&C.length>2&&(192&C[2])!=128)return x.lastNeed=2,"\uFFFD"}}(this,y);return A!==void 0?A:this.lastNeed<=y.length?(y.copy(this.lastChar,_,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(y.copy(this.lastChar,_,0,y.length),void(this.lastNeed-=y.length))}function c(y,_){if((y.length-_)%2==0){var A=y.toString("utf16le",_);if(A){var x=A.charCodeAt(A.length-1);if(x>=55296&&x<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=y[y.length-2],this.lastChar[1]=y[y.length-1],A.slice(0,-1)}return A}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=y[y.length-1],y.toString("utf16le",_,y.length-1)}function f(y){var _=y&&y.length?this.write(y):"";if(this.lastNeed){var A=this.lastTotal-this.lastNeed;return _+this.lastChar.toString("utf16le",0,A)}return _}function g(y,_){var A=(y.length-_)%3;return A===0?y.toString("base64",_):(this.lastNeed=3-A,this.lastTotal=3,A===1?this.lastChar[0]=y[y.length-1]:(this.lastChar[0]=y[y.length-2],this.lastChar[1]=y[y.length-1]),y.toString("base64",_,y.length-A))}function v(y){var _=y&&y.length?this.write(y):"";return this.lastNeed?_+this.lastChar.toString("base64",0,3-this.lastNeed):_}function m(y){return y.toString(this.encoding)}function w(y){return y&&y.length?this.write(y):""}s.StringDecoder=l,l.prototype.write=function(y){if(y.length===0)return"";var _,A;if(this.lastNeed){if((_=this.fillLast(y))===void 0)return"";A=this.lastNeed,this.lastNeed=0}else A=0;return A<y.length?_?_+this.text(y,A):this.text(y,A):_||""},l.prototype.end=function(y){var _=y&&y.length?this.write(y):"";return this.lastNeed?_+"\uFFFD":_},l.prototype.text=function(y,_){var A=function(C,T,I){var D=T.length-1;if(D<I)return 0;var B=o(T[D]);return B>=0?(B>0&&(C.lastNeed=B-1),B):--D<I||B===-2?0:(B=o(T[D]))>=0?(B>0&&(C.lastNeed=B-2),B):--D<I||B===-2?0:(B=o(T[D]))>=0?(B>0&&(B===2?B=0:C.lastNeed=B-3),B):0}(this,y,_);if(!this.lastNeed)return y.toString("utf8",_);this.lastTotal=A;var x=y.length-(A-this.lastNeed);return y.copy(this.lastChar,0,x),y.toString("utf8",_,x)},l.prototype.fillLast=function(y){if(this.lastNeed<=y.length)return y.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);y.copy(this.lastChar,this.lastTotal-this.lastNeed,0,y.length),this.lastNeed-=y.length}},{"safe-buffer":73}],76:[function(i,a,s){var n=i("punycode"),r=i("./util");function l(){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}s.parse=T,s.resolve=function(I,D){return T(I,!1,!0).resolve(D)},s.resolveObject=function(I,D){return I?T(I,!1,!0).resolveObject(D):D},s.format=function(I){return r.isString(I)&&(I=T(I)),I instanceof l?I.format():l.prototype.format.call(I)},s.Url=l;var o=/^([a-z0-9.+-]+:)/i,u=/:[0-9]*$/,c=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,f=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r",`
  66. `," "]),g=["'"].concat(f),v=["%","/","?",";","#"].concat(g),m=["/","?","#"],w=/^[+a-z0-9A-Z_-]{0,63}$/,y=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,_={javascript:!0,"javascript:":!0},A={javascript:!0,"javascript:":!0},x={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},C=i("querystring");function T(I,D,B){if(I&&r.isObject(I)&&I instanceof l)return I;var V=new l;return V.parse(I,D,B),V}l.prototype.parse=function(I,D,B){if(!r.isString(I))throw new TypeError("Parameter 'url' must be a string, not "+typeof I);var V=I.indexOf("?"),Q=V!==-1&&V<I.indexOf("#")?"?":"#",F=I.split(Q);F[0]=F[0].replace(/\\/g,"/");var R=I=F.join(Q);if(R=R.trim(),!B&&I.split("#").length===1){var P=c.exec(R);if(P)return this.path=R,this.href=R,this.pathname=P[1],P[2]?(this.search=P[2],this.query=D?C.parse(this.search.substr(1)):this.search.substr(1)):D&&(this.search="",this.query={}),this}var M=o.exec(R);if(M){var Y=(M=M[0]).toLowerCase();this.protocol=Y,R=R.substr(M.length)}if(B||M||R.match(/^\/\/[^@\/]+@[^@\/]+/)){var Z=R.substr(0,2)==="//";!Z||M&&A[M]||(R=R.substr(2),this.slashes=!0)}if(!A[M]&&(Z||M&&!x[M])){for(var nt,j,H=-1,$=0;$<m.length;$++)(K=R.indexOf(m[$]))!==-1&&(H===-1||K<H)&&(H=K);for((j=H===-1?R.lastIndexOf("@"):R.lastIndexOf("@",H))!==-1&&(nt=R.slice(0,j),R=R.slice(j+1),this.auth=decodeURIComponent(nt)),H=-1,$=0;$<v.length;$++){var K;(K=R.indexOf(v[$]))!==-1&&(H===-1||K<H)&&(H=K)}H===-1&&(H=R.length),this.host=R.slice(0,H),R=R.slice(H),this.parseHost(),this.hostname=this.hostname||"";var U=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!U)for(var tt=this.hostname.split(/\./),at=($=0,tt.length);$<at;$++){var et=tt[$];if(et&&!et.match(w)){for(var ut="",ct=0,ot=et.length;ct<ot;ct++)et.charCodeAt(ct)>127?ut+="x":ut+=et[ct];if(!ut.match(w)){var b=tt.slice(0,$),E=tt.slice($+1),S=et.match(y);S&&(b.push(S[1]),E.unshift(S[2])),E.length&&(R="/"+E.join(".")+R),this.hostname=b.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),U||(this.hostname=n.toASCII(this.hostname));var N=this.port?":"+this.port:"",X=this.hostname||"";this.host=X+N,this.href+=this.host,U&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),R[0]!=="/"&&(R="/"+R))}if(!_[Y])for($=0,at=g.length;$<at;$++){var G=g[$];if(R.indexOf(G)!==-1){var rt=encodeURIComponent(G);rt===G&&(rt=escape(G)),R=R.split(G).join(rt)}}var yt=R.indexOf("#");yt!==-1&&(this.hash=R.substr(yt),R=R.slice(0,yt));var mt=R.indexOf("?");if(mt!==-1?(this.search=R.substr(mt),this.query=R.substr(mt+1),D&&(this.query=C.parse(this.query)),R=R.slice(0,mt)):D&&(this.search="",this.query={}),R&&(this.pathname=R),x[Y]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){N=this.pathname||"";var At=this.search||"";this.path=N+At}return this.href=this.format(),this},l.prototype.format=function(){var I=this.auth||"";I&&(I=(I=encodeURIComponent(I)).replace(/%3A/i,":"),I+="@");var D=this.protocol||"",B=this.pathname||"",V=this.hash||"",Q=!1,F="";this.host?Q=I+this.host:this.hostname&&(Q=I+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(Q+=":"+this.port)),this.query&&r.isObject(this.query)&&Object.keys(this.query).length&&(F=C.stringify(this.query));var R=this.search||F&&"?"+F||"";return D&&D.substr(-1)!==":"&&(D+=":"),this.slashes||(!D||x[D])&&Q!==!1?(Q="//"+(Q||""),B&&B.charAt(0)!=="/"&&(B="/"+B)):Q||(Q=""),V&&V.charAt(0)!=="#"&&(V="#"+V),R&&R.charAt(0)!=="?"&&(R="?"+R),D+Q+(B=B.replace(/[?#]/g,function(P){return encodeURIComponent(P)}))+(R=R.replace("#","%23"))+V},l.prototype.resolve=function(I){return this.resolveObject(T(I,!1,!0)).format()},l.prototype.resolveObject=function(I){if(r.isString(I)){var D=new l;D.parse(I,!1,!0),I=D}for(var B=new l,V=Object.keys(this),Q=0;Q<V.length;Q++){var F=V[Q];B[F]=this[F]}if(B.hash=I.hash,I.href==="")return B.href=B.format(),B;if(I.slashes&&!I.protocol){for(var R=Object.keys(I),P=0;P<R.length;P++){var M=R[P];M!=="protocol"&&(B[M]=I[M])}return x[B.protocol]&&B.hostname&&!B.pathname&&(B.path=B.pathname="/"),B.href=B.format(),B}if(I.protocol&&I.protocol!==B.protocol){if(!x[I.protocol]){for(var Y=Object.keys(I),Z=0;Z<Y.length;Z++){var nt=Y[Z];B[nt]=I[nt]}return B.href=B.format(),B}if(B.protocol=I.protocol,I.host||A[I.protocol])B.pathname=I.pathname;else{for(var j=(I.pathname||"").split("/");j.length&&!(I.host=j.shift()););I.host||(I.host=""),I.hostname||(I.hostname=""),j[0]!==""&&j.unshift(""),j.length<2&&j.unshift(""),B.pathname=j.join("/")}if(B.search=I.search,B.query=I.query,B.host=I.host||"",B.auth=I.auth,B.hostname=I.hostname||I.host,B.port=I.port,B.pathname||B.search){var H=B.pathname||"",$=B.search||"";B.path=H+$}return B.slashes=B.slashes||I.slashes,B.href=B.format(),B}var K=B.pathname&&B.pathname.charAt(0)==="/",U=I.host||I.pathname&&I.pathname.charAt(0)==="/",tt=U||K||B.host&&I.pathname,at=tt,et=B.pathname&&B.pathname.split("/")||[],ut=(j=I.pathname&&I.pathname.split("/")||[],B.protocol&&!x[B.protocol]);if(ut&&(B.hostname="",B.port=null,B.host&&(et[0]===""?et[0]=B.host:et.unshift(B.host)),B.host="",I.protocol&&(I.hostname=null,I.port=null,I.host&&(j[0]===""?j[0]=I.host:j.unshift(I.host)),I.host=null),tt=tt&&(j[0]===""||et[0]==="")),U)B.host=I.host||I.host===""?I.host:B.host,B.hostname=I.hostname||I.hostname===""?I.hostname:B.hostname,B.search=I.search,B.query=I.query,et=j;else if(j.length)et||(et=[]),et.pop(),et=et.concat(j),B.search=I.search,B.query=I.query;else if(!r.isNullOrUndefined(I.search))return ut&&(B.hostname=B.host=et.shift(),(S=!!(B.host&&B.host.indexOf("@")>0)&&B.host.split("@"))&&(B.auth=S.shift(),B.host=B.hostname=S.shift())),B.search=I.search,B.query=I.query,r.isNull(B.pathname)&&r.isNull(B.search)||(B.path=(B.pathname?B.pathname:"")+(B.search?B.search:"")),B.href=B.format(),B;if(!et.length)return B.pathname=null,B.search?B.path="/"+B.search:B.path=null,B.href=B.format(),B;for(var ct=et.slice(-1)[0],ot=(B.host||I.host||et.length>1)&&(ct==="."||ct==="..")||ct==="",b=0,E=et.length;E>=0;E--)(ct=et[E])==="."?et.splice(E,1):ct===".."?(et.splice(E,1),b++):b&&(et.splice(E,1),b--);if(!tt&&!at)for(;b--;b)et.unshift("..");!tt||et[0]===""||et[0]&&et[0].charAt(0)==="/"||et.unshift(""),ot&&et.join("/").substr(-1)!=="/"&&et.push("");var S,N=et[0]===""||et[0]&&et[0].charAt(0)==="/";return ut&&(B.hostname=B.host=N?"":et.length?et.shift():"",(S=!!(B.host&&B.host.indexOf("@")>0)&&B.host.split("@"))&&(B.auth=S.shift(),B.host=B.hostname=S.shift())),(tt=tt||B.host&&et.length)&&!N&&et.unshift(""),et.length?B.pathname=et.join("/"):(B.pathname=null,B.path=null),r.isNull(B.pathname)&&r.isNull(B.search)||(B.path=(B.pathname?B.pathname:"")+(B.search?B.search:"")),B.auth=I.auth||B.auth,B.slashes=B.slashes||I.slashes,B.href=B.format(),B},l.prototype.parseHost=function(){var I=this.host,D=u.exec(I);D&&((D=D[0])!==":"&&(this.port=D.substr(1)),I=I.substr(0,I.length-D.length)),I&&(this.hostname=I)}},{"./util":77,punycode:51,querystring:54}],77:[function(i,a,s){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,s){(function(n){(function(){function r(l){try{if(!n.localStorage)return!1}catch{return!1}var o=n.localStorage[l];return o!=null&&String(o).toLowerCase()==="true"}a.exports=function(l,o){if(r("noDeprecation"))return l;var u=!1;return function(){if(!u){if(r("throwDeprecation"))throw new Error(o);r("traceDeprecation")?console.trace(o):console.warn(o),u=!0}return l.apply(this,arguments)}}}).call(this)}).call(this,typeof Be<"u"?Be:typeof self<"u"?self:typeof window<"u"?window:{})},{}],79:[function(i,a,s){a.exports=function n(r,l){if(r&&l)return n(r)(l);if(typeof r!="function")throw new TypeError("need wrapper function");return Object.keys(r).forEach(function(u){o[u]=r[u]}),o;function o(){for(var u=new Array(arguments.length),c=0;c<u.length;c++)u[c]=arguments[c];var f=r.apply(this,u),g=u[u.length-1];return typeof f=="function"&&f!==g&&Object.keys(g).forEach(function(v){f[v]=g[v]}),f}}},{}],80:[function(i,a,s){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,s){a.exports=function(){for(var r={},l=0;l<arguments.length;l++){var o=arguments[l];for(var u in o)n.call(o,u)&&(r[u]=o[u])}return r};var n=Object.prototype.hasOwnProperty},{}],82:[function(i,a,s){a.exports=function(n){n.prototype[Symbol.iterator]=function*(){for(let r=this.head;r;r=r.next)yield r.value}}},{}],83:[function(i,a,s){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(m){f.push(m)});else if(arguments.length>0)for(var g=0,v=arguments.length;g<v;g++)f.push(arguments[g]);return f}function r(c,f,g){var v=f===c.head?new u(g,null,f,c):new u(g,f,f.next,c);return v.next===null&&(c.tail=v),v.prev===null&&(c.head=v),c.length++,v}function l(c,f){c.tail=new u(f,c.tail,null,c),c.head||(c.head=c.tail),c.length++}function o(c,f){c.head=new u(f,null,c.head,c),c.tail||(c.tail=c.head),c.length++}function u(c,f,g,v){if(!(this instanceof u))return new u(c,f,g,v);this.list=v,this.value=c,f?(f.next=this,this.prev=f):this.prev=null,g?(g.prev=this,this.next=g):this.next=null}a.exports=n,n.Node=u,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,g=c.prev;return f&&(f.prev=g),g&&(g.next=f),c===this.head&&(this.head=f),c===this.tail&&(this.tail=g),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++)l(this,arguments[c]);return this.length},n.prototype.unshift=function(){for(var c=0,f=arguments.length;c<f;c++)o(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 g=this.head,v=0;g!==null;v++)c.call(f,g.value,v,this),g=g.next},n.prototype.forEachReverse=function(c,f){f=f||this;for(var g=this.tail,v=this.length-1;g!==null;v--)c.call(f,g.value,v,this),g=g.prev},n.prototype.get=function(c){for(var f=0,g=this.head;g!==null&&f<c;f++)g=g.next;if(f===c&&g!==null)return g.value},n.prototype.getReverse=function(c){for(var f=0,g=this.tail;g!==null&&f<c;f++)g=g.prev;if(f===c&&g!==null)return g.value},n.prototype.map=function(c,f){f=f||this;for(var g=new n,v=this.head;v!==null;)g.push(c.call(f,v.value,this)),v=v.next;return g},n.prototype.mapReverse=function(c,f){f=f||this;for(var g=new n,v=this.tail;v!==null;)g.push(c.call(f,v.value,this)),v=v.prev;return g},n.prototype.reduce=function(c,f){var g,v=this.head;if(arguments.length>1)g=f;else{if(!this.head)throw new TypeError("Reduce of empty list with no initial value");v=this.head.next,g=this.head.value}for(var m=0;v!==null;m++)g=c(g,v.value,m),v=v.next;return g},n.prototype.reduceReverse=function(c,f){var g,v=this.tail;if(arguments.length>1)g=f;else{if(!this.tail)throw new TypeError("Reduce of empty list with no initial value");v=this.tail.prev,g=this.tail.value}for(var m=this.length-1;v!==null;m--)g=c(g,v.value,m),v=v.prev;return g},n.prototype.toArray=function(){for(var c=new Array(this.length),f=0,g=this.head;g!==null;f++)c[f]=g.value,g=g.next;return c},n.prototype.toArrayReverse=function(){for(var c=new Array(this.length),f=0,g=this.tail;g!==null;f++)c[f]=g.value,g=g.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 g=new n;if(f<c||f<0)return g;c<0&&(c=0),f>this.length&&(f=this.length);for(var v=0,m=this.head;m!==null&&v<c;v++)m=m.next;for(;m!==null&&v<f;v++,m=m.next)g.push(m.value);return g},n.prototype.sliceReverse=function(c,f){(f=f||this.length)<0&&(f+=this.length),(c=c||0)<0&&(c+=this.length);var g=new n;if(f<c||f<0)return g;c<0&&(c=0),f>this.length&&(f=this.length);for(var v=this.length,m=this.tail;m!==null&&v>f;v--)m=m.prev;for(;m!==null&&v>c;v--,m=m.prev)g.push(m.value);return g},n.prototype.splice=function(c,f,...g){c>this.length&&(c=this.length-1),c<0&&(c=this.length+c);for(var v=0,m=this.head;m!==null&&v<c;v++)m=m.next;var w=[];for(v=0;m&&v<f;v++)w.push(m.value),m=this.removeNode(m);for(m===null&&(m=this.tail),m!==this.head&&m!==this.tail&&(m=m.prev),v=0;v<g.length;v++)m=r(this,m,g[v]);return w},n.prototype.reverse=function(){for(var c=this.head,f=this.tail,g=c;g!==null;g=g.prev){var v=g.prev;g.prev=g.next,g.next=v}return this.head=f,this.tail=c,this};try{i("./iterator.js")(n)}catch{}},{"./iterator.js":82}]},{},[12])(12)})})(en);const Vf={success:{color:"#2ba471",icon:'<svg fill="none" viewBox="0 0 24 24"><path d="M12 23a11 11 0 100-22 11 11 0 000 22zM7.5 10.59l3 3 6-6L17.91 9l-7.41 7.41L6.09 12l1.41-1.41z"></path></svg>'},info:{color:"#0052d9",icon:'<svg fill="none" viewBox="0 0 24 24"><path d="M12 23a11 11 0 100-22 11 11 0 000 22zM11 8.5v-2h2v2h-2zm2 1.5v7.5h-2V10h2z"></path></svg>'},warning:{color:"#e37318",icon:'<svg fill="none" viewBox="0 0 24 24"><path d="M12 1a11 11 0 110 22 11 11 0 010-22zm-1 13h2V6.5h-2V14zm2 1.5h-2v2h2v-2z"></path></svg>'},error:{color:"#d54941",icon:'<svg fill="none" viewBox="0 0 24 24"><path d="M12 1a11 11 0 110 22 11 11 0 010-22zm-1 13h2V6.5h-2V14zm2 1.5h-2v2h2v-2z"></path></svg>'},question:{color:"#0052d9",icon:'<svg fill="none" viewBox="0 0 24 24"><path d="M12 23a11 11 0 100-22 11 11 0 000 22zm-.17-11.11c.43-.53.97-.97 1.4-1.32A2 2 0 0012 7a2 2 0 00-1.89 1.33l-.33.95L7.9 8.6l.34-.94a4 4 0 116.24 4.47 7 7 0 00-1.1 1.01c-.27.34-.37.61-.37.85v1.25h-2V14c0-.87.39-1.57.83-2.11zM11 18.25v-2h2v2h-2z"></path></svg>'}},Je={};class _E{constructor(t,i){W(this,"parentElement");W(this,"box");W(this,"icon");W(this,"text");W(this,"closeBtn");W(this,"duration");W(this,"content");W(this,"theme");W(this,"placement");W(this,"height");W(this,"id");var s;this.parentElement=t,this.box=document.createElement("div"),this.icon=document.createElement("div"),this.text=document.createElement("div"),this.box.className="meta2d-message",this.icon.className="icon",this.text.className="text",this.icon.innerHTML=Vf[i.theme||"info"].icon,this.text.innerHTML=i.content,this.box.appendChild(this.icon),this.box.appendChild(this.text),i.closeBtn&&(this.closeBtn=document.createElement("div"),this.closeBtn.className="close",this.closeBtn.innerHTML="x",this.closeBtn.onclick=()=>{this.close()},this.box.appendChild(this.closeBtn)),t.appendChild(this.box);let a;for(let n=0;n<document.styleSheets.length;n++)document.styleSheets[n].title==="le5le.com/message"&&(a=document.styleSheets[n]);if(!a){let n=document.createElement("style");n.type="text/css",n.title="le5le.com/message",document.head.appendChild(n),n=document.createElement("style"),n.type="text/css",document.head.appendChild(n),a=n.sheet,a.insertRule(`.meta2d-message{
  67. position:absolute;
  68. z-index:999;
  69. transform: translateX(-50%);
  70. padding:12px 16px;
  71. max-width:400px;
  72. background:#fff;
  73. border-radius:6px;
  74. box-shadow:0 3px 14px 2px rgba(0, 0, 0, .05),0 8px 10px 1px rgba(0, 0, 0, 6%),0 5px 5px -3px rgba(0, 0, 0, 10%);
  75. display:flex;
  76. animation: fadein .5s;}`),a.insertRule(`
  77. @keyframes fadein {
  78. 0% {
  79. transform: translate(-50%, -100%);
  80. }
  81. 100% {
  82. transform: translate(-50%,0);
  83. }
  84. }`),a.insertRule(".meta2d-message .icon{width:20px;height:20px;}"),a.insertRule(".meta2d-message .text{color:rgba(0, 0, 0, 0.9);font-size:12px;margin-left:8px;line-height:20px;}"),a.insertRule(".meta2d-message .close{width:20px;height:20px;padding-left: 16px; cursor: pointer;}")}this.id=i.id||St(),this.duration=(s=i.duration)!=null?s:3e3,this.placement=i.placement||"top",this.theme=i.theme||"info",this.height=i.height}init(){Je[this.id]=this,this.duration&&setTimeout(()=>{this.close()},this.duration);let t=-1;Object.keys(Je).forEach(i=>{var a;((a=Je[i])==null?void 0:a.placement)===this.placement&&t++}),this.setPosition(this.placement,t),this.icon.children[0].style.fill=Vf[this.theme].color}setPosition(t,i=0){switch(t){case"top":this.box.style.top=`${30+i*(this.height||60)}px`,this.box.style.left="50%";break;case"bottom":this.box.style.bottom=`${30+i*(this.height||60)}px`,this.box.style.left="50%";break;case"left":this.box.style.top=`${30+i*(this.height||60)}px`,this.box.style.left="30px";break;case"right":this.box.style.top=`${30+i*(this.height||60)}px`,this.box.style.right="30px";break}}close(){Object.keys(Je).forEach(t=>{var i;if(((i=Je[t])==null?void 0:i.placement)===this.placement)switch(this.placement){case"top":case"left":case"right":Je[t].box.style.top=parseInt(Je[t].box.style.top)-60+"px";break;case"bottom":Je[t].box.style.bottom=parseInt(Je[t].box.style.bottom)-60+"px";break}}),Je[this.id]=null,delete Je[this.id],this.box.remove()}}function EE(e,t){if(e.jetLinksList.length){let i=t.url;i.startsWith("/")&&(i=(location.protocol==="https:"?"wss://":"ws://")+window.location.host+i),e.jetLinksClient=new WebSocket(`${i}/${localStorage.getItem("X-Access-Token")||gn("X-Access-Token")||new URLSearchParams(location.search).get("X-Access-Token")||""}`),e.jetLinksClient.onmessage=a=>{var n;const s=JSON.parse(a.data);if(!!s.payload)if((n=s.payload)!=null&&n.properties){const r=[];for(let l in s.payload.properties)r.push({id:`${s.payload.headers.productId}#${s.payload.deviceId}#${l}`,value:s.payload.properties[l]});e.setDatas(r,{history:!1})}else s.topic.startsWith("/notifications")&&Eg(e,s)},e.jetLinksClient.onopen=()=>{e.jetLinksList.forEach(a=>{e.jetLinksClient.send(JSON.stringify({type:"sub",topic:`/device${a.topic}/message/property/report`,parameter:{deviceId:a.deviceId,properties:a.properties,history:1},id:a.topic+"-"+St()}))}),t.notification&&e.jetLinksClient.send(JSON.stringify({type:"sub",topic:"/notifications",id:"notification",parameter:{}}))}}}function Eg(e,t){var r,l;let i=t.payload.topicName,a=t.payload.message,s=t.payload.notifyTime,n=`<div style="padding:0px 12px 0px 0px;width:300px;">
  85. <div style="display:flex;height: 20px;justify-content: space-between">
  86. <div style="color: #000000d9;
  87. font-size: 14px;
  88. font-weight: 700;">${i}</div><div style="color: #00000073;">${AE(s)}</div>
  89. </div>
  90. <span>${a}</span>
  91. </div>`;e.message({content:n,duration:0,closeBtn:!0,placement:"right",height:75}),(r=t.payload.detail)!=null&&r.alarmConfigId&&RE(e,(l=t.payload.detail)==null?void 0:l.alarmConfigId)}globalThis.doWarning=Eg;function AE(e){const t=new Date(e),i=t.getFullYear(),a=(t.getMonth()+1+"").padStart(2,"0"),s=(t.getDate()+"").padStart(2,"0"),n=(t.getHours()+"").padStart(2,"0"),r=(t.getMinutes()+"").padStart(2,"0"),l=(t.getSeconds()+"").padStart(2,"0");return i+"-"+a+"-"+s+" "+n+":"+r+":"+l}function kE(e){e.jetLinksClient&&(e.jetLinksClient.close(),e.jetLinksClient=void 0)}function CE(e,t,i){const a=[];return i.list.forEach((s,n)=>{var l,o,u;const r=s.params?e.findOne(s.params):t;a[n]={deviceId:r.deviceId,productId:r.productId,properties:{}};for(let c in s.value)if(s.value[c]===void 0||s.value[c]===""){const f=(l=r.realTimes)==null?void 0:l.find(g=>g.propertyId===c);f&&(a[n].properties[c]=r[f.key])}else if(typeof s.value[c]=="string"&&((o=s.value[c])==null?void 0:o.indexOf("${"))>-1){let f=s.value[c].match(new RegExp("(?<=\\$\\{).*?(?=\\})","g"));f!=null&&f.length&&(a[n].properties[c]=(u=r[f[0]])!=null?u:e.getDynamicParam(f[0]))}else a[n].properties[c]=s.value[c]}),a}async function FE(e,t){t.forEach(async i=>{let a=i.deviceId;if(a&&a.indexOf("${")>-1){let n=a.match(new RegExp("(?<=\\$\\{).*?(?=\\})","g"));n!=null&&n.length&&(a=e.getDynamicParam(n[0])||a)}(await fetch(`/api/device-instance/${a}/property`,{headers:{"X-Access-Token":localStorage.getItem("X-Access-Token")||new URLSearchParams(location.search).get("X-Access-Token")||"","Content-Type":"application/json"},method:"put",body:JSON.stringify(i.properties)})).ok?(console.info("\u53D1\u9001\u6210\u529F"),e.message({theme:"success",content:"\u4E0B\u53D1\u6210\u529F"})):e.message({theme:"error",content:"\u4E0B\u53D1\u5931\u8D25"})})}async function RE(e,t){const i=await fetch(`/api/alarm/config/${t}`,{headers:{"X-Access-Token":localStorage.getItem("X-Access-Token")||new URLSearchParams(location.search).get("X-Access-Token")||"","Content-Type":"application/json"},method:"GET"});if(i.ok){let a=await i.json();a.result.media&&Ag(e,a.result.media,a.result.playTimes)}}function Ag(e,t,i){if(e.store.globalAudio||(e.store.globalAudio=document.createElement("audio")),e.store.globalAudio.src=t,e.store.globalAudio.play(),i===-1)e.store.globalAudio.loop=!0;else{e.store.globalAudio.loop=!1;let a=0;e.store.globalAudio.onended=()=>{a++,a<i&&e.store.globalAudio.play()}}}globalThis.createAudio=Ag;class TE{constructor(t,i={}){W(this,"store");W(this,"canvas");W(this,"websocket");W(this,"mqttClient");W(this,"websockets");W(this,"mqttClients");W(this,"eventSources");W(this,"penPluginMap",new Map);W(this,"socketFn");W(this,"events",{});W(this,"map");W(this,"mapTimer");W(this,"facePen",Ts);W(this,"getWords",Wd);W(this,"calcTextLines",_n);W(this,"calcTextRect",Fi);W(this,"calcTextDrawRect",vc);W(this,"jetLinksList",[]);W(this,"jetLinksClient");W(this,"register",Hd);W(this,"registerCanvasDraw",Dx);W(this,"registerAnchors",Lx);W(this,"registerLineAnimateDraws",(t,i)=>{this.store.data.lineAnimateDraws[t]=i,Et.lineAnimateDraws[t]=new Function("ctx","pen","state","index",i)});W(this,"websocketTimes",0);W(this,"mqttTimes",0);W(this,"httpTimer");W(this,"httpTimerList",[]);W(this,"updateTimer");W(this,"updateTimerList",[]);W(this,"sqlTimerList",[]);W(this,"iotMqttClient");W(this,"iotTimer");W(this,"iotWebsocketClient");W(this,"onEvent",(t,i)=>{switch(t){case"add":i.forEach(a=>{var s;(s=a.onAdd)==null||s.call(a,a)}),this.onSizeUpdate();break;case"enter":i&&i.onMouseEnter&&i.onMouseEnter(i,this.canvas.mousePos),this.store.data.locked&&this.doEvent(i,t);break;case"leave":i&&i.onMouseLeave&&i.onMouseLeave(i,this.canvas.mousePos),this.store.data.locked&&this.doEvent(i,t);break;case"active":case"inactive":this.store.data.locked&&i.forEach(a=>{this.doEvent(a,t)});break;case"click":if(this.store.data.locked&&i.pen&&!i.pen.disabled&&i.pen.switch&&(i.pen.checked=!i.pen.checked,i.pen.calculative.checked=i.pen.checked,i.pen.calculative.gradient=void 0,i.pen.calculative.radialGradient=void 0),i.pen&&i.pen.formId){const a=this.store.pens[i.pen.formId];i.pen.formType==="submit"?this.store.data.locked&&a&&!a.disabled&&this.doEvent(a,"submit"):i.pen.formType==="reset"&&(lE(i.pen),this.store.data.locked&&a&&!a.disabled&&this.doEvent(a,"reset"))}i.pen&&i.pen.onClick&&!i.pen.disabled&&i.pen.onClick(i.pen,this.canvas.mousePos),this.store.data.locked&&i.pen&&!i.pen.disabled&&this.doEvent(i.pen,t);break;case"contextmenu":i.pen&&i.pen.onContextmenu&&!i.pen.disabled&&i.pen.onContextmenu(i.pen,this.canvas.mousePos),this.store.data.locked&&i.pen&&!i.pen.disabled&&this.doEvent(i.pen,t);break;case"mousedown":i.pen&&i.pen.onMouseDown&&!i.pen.disabled&&i.pen.onMouseDown(i.pen,this.canvas.mousePos),this.store.data.locked&&i.pen&&!i.pen.disabled&&this.doEvent(i.pen,t);break;case"mouseup":i.pen&&i.pen.onMouseUp&&!i.pen.disabled&&i.pen.onMouseUp(i.pen,this.canvas.mousePos),this.store.data.locked&&i.pen&&!i.pen.disabled&&this.doEvent(i.pen,t);break;case"dblclick":this.store.data.locked&&i.pen&&!i.pen.disabled&&this.doEvent(i.pen,t);break;case"valueUpdate":i&&Wf(i,i.formValue),this.store.data.locked&&this.doEvent(i,t),this.canvas.tooltip.updateText(i);break;case"update":case"delete":case"translatePens":case"rotatePens":case"resizePens":this.onSizeUpdate();break;case"navigator":this.store.data.id||console.warn("\u8BF7\u5148\u4FDD\u5B58\u5F53\u524D\u56FE\u7EB8"),this.navigatorTo(i.params);break;case"input":this.store.data.locked&&i&&!i.disabled&&this.doEvent(i,t);break;case"change":i.pen&&Wf(i.pen),i.pen?this.store.data.locked&&!i.pen.disabled&&this.doEvent(i.pen,t):this.store.data.locked&&i&&!i.disabled&&this.doEvent(i,t);break}this.doMessageEvent(t,i)});W(this,"doEvent",(t,i)=>{var n,r,l,o,u,c,f,g,v,m;if(!t)return;let a=!1,s=[];if((n=t.events)==null||n.forEach((w,y)=>{var _;if(w.actions&&w.actions.length){if(w.name===i){let A=!1;w.conditions&&w.conditions.length?w.conditionType==="and"?A=w.conditions.every(x=>this.judgeCondition(t,x.key,x)):w.conditionType==="or"&&(A=w.conditions.some(x=>this.judgeCondition(t,x.key,x))):A=!0,A&&s.push(y)}}else if(a=!0,this.events[w.action]&&w.name===i){let A=!((_=w.where)!=null&&_.type);if(w.where){const{fn:x,fnJs:C,comparison:T,key:I,value:D}=w.where;if(x)A=x(t,{meta2d:this});else if(C){try{w.where.fn=new Function("pen","context",C)}catch(B){console.error("Error: make function:",B)}w.where.fn&&(A=w.where.fn(t,{meta2d:this}))}else{let B=t[I];switch(["x","y","width","height"].includes(I)&&(B=this.getPenRect(t)[I]),T){case">":A=B>+D;break;case">=":A=B>=+D;break;case"<":A=B<+D;break;case"<=":A=B<=+D;break;case"=":case"==":A=B==D;break;case"!=":A=B!=D;break;case"[)":A=us(+B,D);break;case"![)":A=!us(+B,D);break;case"[]":A=fs(B,D);break;case"![]":A=!fs(B,D);break}}}A&&s.push(y)}}),a?(r=t.events)==null||r.forEach((w,y)=>{s.includes(y)&&this.events[w.action](t,w)}):(l=t.events)==null||l.forEach(async(w,y)=>{if(s.includes(y)){if(w.confirm&&!await this.canvas.popconfirm.showModal(t,this.canvas.mousePos,w.confirmTitle))return;w.actions.forEach(_=>{if(_.timeout){let A=setTimeout(()=>{this.events[_.action]&&(this.events[_.action](t,_),clearTimeout(A),A=null)},_.timeout)}else this.events[_.action]&&this.events[_.action](t,_)})}}),i==="valueUpdate"){(o=t.realTimes)==null||o.forEach(y=>{var A,x;let _=[];(A=y.triggers)==null||A.forEach((C,T)=>{var D;let I=!1;(D=C.conditions)!=null&&D.length?C.conditionType==="and"?I=C.conditions.every(B=>this.judgeCondition(t,y.key,B)):C.conditionType==="or"&&(I=C.conditions.some(B=>this.judgeCondition(t,y.key,B))):I=!0,I&&_.push(T)}),(x=y.triggers)==null||x.forEach((C,T)=>{var I;_.includes(T)&&((I=C.actions)==null||I.forEach(D=>{if(D.timeout){let B=setTimeout(()=>{this.events[D.action]&&(this.events[D.action](t,D),clearTimeout(B),B=null)},D.timeout)}else this.events[D.action](t,D)}))})});let w=[];if((u=this.store.globalTriggers[t.id])==null||u.forEach((y,_)=>{var x;let A=!1;(x=y.conditions)!=null&&x.length?y.conditionType==="and"?A=y.conditions.every(C=>this.judgeCondition(this.store.pens[C.source],C.key,C)):y.conditionType==="or"&&(A=y.conditions.some(C=>this.judgeCondition(this.store.pens[C.source],C.key,C))):A=!0,A&&w.push(_)}),(c=this.store.globalTriggers[t.id])==null||c.forEach((y,_)=>{var A;w.includes(_)&&((A=y.actions)==null||A.forEach(x=>{if(x.timeout){let C=setTimeout(()=>{this.events[x.action]&&(this.events[x.action](t,x),clearTimeout(C),C=null)},x.timeout)}else this.events[x.action](t,x)}))}),(f=t.triggers)!=null&&f.length){for(let y of t.triggers)if((g=y.status)!=null&&g.length)for(let _ of y.status){let A=!1;if((v=_.conditions)!=null&&v.length?_.conditionType==="and"?A=_.conditions.every(x=>this.judgeCondition(t,x.key,x)):_.conditionType==="or"&&(A=_.conditions.some(x=>this.judgeCondition(t,x.key,x))):A=!0,A){(m=_.actions)==null||m.forEach(x=>{if(x.timeout){let C=setTimeout(()=>{this.events[x.action]&&(this.events[x.action](t,x),clearTimeout(C),C=null)},x.timeout)}else this.events[x.action](t,x)});break}}}}this.doEvent(this.store.pens[t.parentId],i)});W(this,"doDataEvent",t=>{var s,n,r;if(!((s=this.store.data.dataEvents)!=null&&s.length))return;const i=t.reduce((l,{dataId:o,id:u,value:c})=>(l[u||o]=c,l),{});let a=[];(n=this.store.data.dataEvents)==null||n.forEach((l,o)=>{let u=!1;l.conditions&&l.conditions.length?l.conditionType==="and"?u=l.conditions.every(c=>this.dataJudegeCondition(i,c.key,c)):l.conditionType==="or"&&(u=l.conditions.some(c=>this.dataJudegeCondition(i,c.key,c))):u=!0,u&&a.push(o)}),(r=this.store.data.dataEvents)==null||r.forEach((l,o)=>{var u;a.includes(o)&&((u=l.actions)==null||u.forEach(c=>{this.events[c.action](i,c)}))})});W(this,"renderPenRaw",$r);W(this,"setElemPosition",Fe);W(this,"setLifeCycleFunc",H2);this.store=Wx(St()),this.setOptions(i),this.setDatabyOptions(i),this.init(t),this.register(wE()),this.registerCanvasDraw({cube:w_}),this.registerAnchors(bE()),globalThis.meta2d=this,this.initEventFns(),this.store.emitter.on("*",this.onEvent)}get beforeAddPen(){return this.canvas.beforeAddPen}set beforeAddPen(t){this.canvas.beforeAddPen=t}get beforeAddPens(){return this.canvas.beforeAddPens}set beforeAddPens(t){this.canvas.beforeAddPens=t}get beforeAddAnchor(){return this.canvas.beforeAddAnchor}set beforeAddAnchor(t){this.canvas.beforeAddAnchor=t}get beforeRemovePens(){return this.canvas.beforeRemovePens}set beforeRemovePens(t){this.canvas.beforeRemovePens=t}get beforeRemoveAnchor(){return this.canvas.beforeRemoveAnchor}set beforeRemoveAnchor(t){this.canvas.beforeRemoveAnchor=t}setOptions(t={}){var i,a;(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.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=Yt.None)),(t.width!==void 0||t.height!==void 0)&&(this.canvas&&(this.canvas.canvasTemplate.bgPatchFlags=!0),this.canvas&&this.canvas.canvasTemplate.canvas.style.backgroundImage&&(this.canvas.canvasTemplate.canvas.style.backgroundImage="")),this.store.options=Object.assign(this.store.options,t),this.canvas&&t.scroll!==void 0&&(t.scroll?(!this.canvas.scroll&&(this.canvas.scroll=new wg(this.canvas)),this.canvas.scroll.show()):this.canvas.scroll&&this.canvas.scroll.hide()),(a=this.canvas)==null||a.initGlobalStyle()}getOptions(){return this.store.options}registerTheme(t,i){if(!Array.isArray(i))return;const a=/^\s*\S+\s*:\s*\S+\s*$/;if(!i.every(l=>a.test(l)))return;const n={},r=[];for(let l=0;l<i.length;l++){const u=i[l].split(":"),c=u[0].trim(),f=u[1].trim();r.push([c,f].join(":")),n[c]=f}Qs.addTheme(t,r),this.store.theme[t]=n}setTheme(t){if(this.store.data.theme=t,this.setBackgroundColor(this.store.theme[t].background),this.canvas.parentElement.style.background=this.store.theme[t].parentBackground,this.setOptions({ruleColor:this.store.theme[t].ruleColor,ruleOptions:this.store.theme[t].ruleOptions}),!(this.store.options.themeOnlyCanvas||this.store.data.themeOnlyCanvas)){this.store.data.color=this.store.theme[t].color,Qs.updateCssRule(this.store.id,t),this.canvas.initGlobalStyle();for(let i=0;i<this.store.data.pens.length;i++){const a=this.store.data.pens[i];a.setTheme&&a.setTheme(a,this.store.styles)}}this.render()}setDatabyOptions(t={}){const{color:i,activeColor:a,activeBackground:s,grid:n,gridColor:r,gridSize:l,fromArrow:o,toArrow:u,rule:c,ruleColor:f,textColor:g,x:v=0,y:m=0}=t;this.setRule({rule:c,ruleColor:f}),this.setGrid({grid:n,gridColor:r,gridSize:l}),this.store.data=Object.assign(this.store.data,{textColor:g,color:i,activeColor:a,activeBackground:s,fromArrow:o,toArrow:u,x:v,y:m})}init(t){typeof t=="string"?this.canvas=new zf(this,document.getElementById(t),this.store):this.canvas=new zf(this,t,this.store),this.canvas.initGlobalStyle(),this.resize(),this.canvas.listen(),Qs.createThemeSheet(this.store.data.theme,this.store.id)}initEventFns(){this.events[he.Link]=(t,i)=>{var a,s;if(window&&i.value&&typeof i.value=="string"){let n=i.value;if(n.includes("${")){let r=(a=n.match(/\$\{([^}]+)\}/g))==null?void 0:a.map(l=>l.slice(2,-1));r&&(r==null||r.forEach(l=>{n=n.replace(`\${${l}}`,t[l]||this.getDynamicParam(l))}))}window.open(n,(s=i.params)!=null?s:"_blank");return}console.warn("[meta2d] Link param is not a string")},this.events[he.SetProps]=(t,i)=>{var s,n,r;const a=i.value;if(a&&typeof a=="object"){const l=i.params?this.find(i.params):this.find(t.id),o={};for(let u in a)if((s=a[u])!=null&&s.id)o[u]=(n=this.store.pens[a[u].id])==null?void 0:n[a[u].key];else if(typeof a[u]=="string"&&a[u].includes("${")){let c=a[u],f=(r=c.match(/\$\{([^}]+)\}/g))==null?void 0:r.map(g=>g.slice(2,-1));f&&f.forEach(g=>{c=c.replace(`\${${g}}`,t[g]||this.getDynamicParam(g))}),o[u]=c}else o[u]=a[u];l.forEach(u=>{o.hasOwnProperty("visible")&&u.visible!==o.visible&&this.setVisible(u,o.visible),this.setValue({id:u.id,...o},{render:!1,doEvent:!1})}),this.render();return}console.warn("[meta2d] SetProps value is not an object")},this.events[he.StartAnimate]=(t,i)=>{let a=t;if(i.value&&(a=this.findOne(i.value)),!(this.store.animates.has(a)&&!a.calculative.pause&&a.animateName===i.params)){if(i.targetType&&i.params){this.startAnimate(i.value||[t],i.params);return}if(!i.value||typeof i.value=="string"){this.startAnimate(i.value||[t]);return}console.warn("[meta2d] StartAnimate value is not a string")}},this.events[he.PauseAnimate]=(t,i)=>{if(!i.value||typeof i.value=="string"){this.pauseAnimate(i.value||[t]);return}console.warn("[meta2d] PauseAnimate value is not a string")},this.events[he.StopAnimate]=(t,i)=>{if(!i.value||typeof i.value=="string"){if(i.value){let a=this.findOne(i.value);if(!this.store.animates.has(a))return}else if(!this.store.animates.has(t))return;this.stopAnimate(i.value||[t]);return}console.warn("[meta2d] StopAnimate event value is not a string")},this.events[he.StartVideo]=(t,i)=>{if(!i.value||typeof i.value=="string"){this.startVideo(i.value||[t]);return}console.warn("[meta2d] StartVideo value is not a string")},this.events[he.PauseVideo]=(t,i)=>{if(!i.value||typeof i.value=="string"){this.pauseVideo(i.value||[t]);return}console.warn("[meta2d] PauseVideo value is not a string")},this.events[he.StopVideo]=(t,i)=>{if(!i.value||typeof i.value=="string"){this.stopVideo(i.value||[t]);return}console.warn("[meta2d] StopVideo event value is not a string")},this.events[he.JS]=(t,i,a)=>{var s;if(i.value&&!i.fn)try{if(typeof i.value!="string")throw new Error("[meta2d] Function value must be string");const n=i.value;i.fn=new Function("pen","params","context",n)}catch(n){console.error("[meta2d]: Error on make a function:",n)}(s=i.fn)==null||s.call(i,t,a||i.params,{meta2d:this,eventName:i.name})},this.events[he.GlobalFn]=(t,i)=>{if(typeof i.value!="string"){console.warn("[meta2d] GlobalFn value must be a string");return}globalThis[i.value]&&globalThis[i.value](t,i.params)},this.events[he.Emit]=(t,i)=>{if(typeof i.value!="string"){console.warn("[meta2d] Emit value must be a string");return}this.store.emitter.emit(i.value,{pen:t,params:i.params,eventName:i.name})},this.events[he.SendPropData]=(t,i)=>{const a=ht(i.value);if(a&&typeof a=="object"){const s=i.params?this.findOne(i.params):t;for(let n in a)(a[n]===void 0||a[n]==="")&&(a[n]=s[n]);a.id=s.id,this.doSendDataEvent(a,i.extend);return}console.warn("[meta2d] SendPropData value is not an object")},this.events[he.SendVarData]=(t,i)=>{const a=ht(i.value);if(a&&typeof a=="object"){const s=i.params?this.findOne(i.params):t;let n=[];for(let r in a){let l={dataId:r,value:a[r]};if(!l.value){let o=s.form.find(u=>u.dataIds&&u.dataIds.dataId===l.dataId);o&&(l.value=s[o.key])}n.push(l)}this.doSendDataEvent(n,i.extend);return}console.warn("[meta2d] SendVarData value is not an object")},this.events[he.Navigator]=(t,i)=>{i.value&&typeof i.value=="string"&&this.navigatorTo(i.value)},this.events[he.Dialog]=(t,i)=>{var a;if(i.params&&typeof i.params=="string"){let s=i.params;if(i.params.includes("${")){let r=(a=i.params.match(/\$\{([^}]+)\}/g))==null?void 0:a.map(l=>l.slice(2,-1));r&&(r==null||r.forEach(l=>{s=s.replace(`\${${l}}`,t[l]||this.getDynamicParam(l))}))}Object.keys(i.extend).forEach(r=>{["x","y","width","height"].includes(r)||(s.indexOf("?")!==-1?s+=`&${r}=${i.extend[r]}`:s+=`?${r}=${i.extend[r]}`)});let n=this.getEventData(i.list,t);Object.keys(n).length&&(n=null),this.canvas.dialog.show(i.value,s,i.extend,n)}},this.events[he.SendData]=(t,i)=>{var s,n,r,l,o;if((s=i.data)!=null&&s.length){const u=this.getSendData(i.data);t.formId&&t.formData&&Object.assign(u,t.formData),this.sendDataToNetWork(u,t,i);return}if((n=i.list)!=null&&n.length){if(i.network&&i.network.protocol==="ADIIOT"){const c=CE(this,t,i);c.length&&FE(this,c);return}const u=this.getEventData(i.list,t);t.deviceId&&(u.deviceId=t.deviceId),t.formId&&t.formData&&Object.assign(u,t.formData),this.sendDataToNetWork(u,t,i);return}const a=ht(i.value);if(a&&typeof a=="object"&&i.targetType==="id"){const u=i.params?this.findOne(i.params):t;for(let c in a)if(a[c]===void 0||a[c]==="")a[c]=u[c];else if(typeof a[c]=="string"&&((r=a[c])==null?void 0:r.indexOf("${"))>-1){let f=(l=a[c].match(/\$\{([^}]+)\}/g))==null?void 0:l.map(g=>g.slice(2,-1));f!=null&&f.length&&(a[c]=(o=u[f[0]])!=null?o:this.getDynamicParam(f[0]))}u.deviceId&&(a.deviceId=u.deviceId),this.sendDataToNetWork(a,t,i);return}},this.events[he.PostMessage]=(t,i)=>{if(typeof i.value!="string"){console.warn("[meta2d] Emit value must be a string");return}const a=i.params?this.findOne(i.params):t;if(a.name!=="iframe"||!a.iframe){console.warn("\u4E0D\u662F\u5D4C\u5165\u9875\u9762");return}let s=ws(a.iframe.split("?")[1]);const n=this.getEventData(i.list,a);a.calculative.singleton.div.children[0].contentWindow.postMessage(JSON.stringify({name:i.value,id:s.id,data:n}),"*")},this.events[he.PostMessageToParent]=(t,i)=>{if(typeof i.value!="string"){console.warn("[meta2d] Emit value must be a string");return}const a=this.getEventData(i.list,t);window.parent.postMessage(JSON.stringify({name:i.value,data:a}),"*")},this.events[he.Message]=(t,i)=>{this.message({theme:i.params,content:i.value,...i.extend})}}getSendData(t){const i={};return t.forEach(a=>{var s;if(a.prop)if(a.id&&a.id!=="\u56FA\u5B9A\u503C"){const n=this.findOne(a.id);i[a.prop]=n[a.key]}else if(typeof a.value=="string"&&a.value.includes("${")){let n=a.value,r=(s=n.match(/\$\{([^}]+)\}/g))==null?void 0:s.map(l=>l.slice(2,-1));r&&r.forEach(l=>{n=n.replace(`\${${l}}`,this.getDynamicParam(l))}),i[a.prop]=n}else i[a.prop]=this.convertType(a.value,a.type)}),i}convertType(t,i){if(typeof t=="string"){if(["switch","bool","boolean"].includes(i)){if(t==="false")return!1;if(t==="true")return!0}else if(["integer","number","int","enum","double","float"].includes(i)&&!isNaN(Number(t)))return Number(t)}return t}getEventData(t,i){const a={};return t!=null&&t.length&&t.forEach(s=>{var r,l,o;const n=s.params?this.findOne(s.params):i;for(let u in s.value)if(s.value[u]===void 0||s.value[u]==="")a[u]=n[u];else if(typeof s.value[u]=="string"&&((r=s.value[u])==null?void 0:r.indexOf("${"))>-1){let c=(l=s.value[u].match(/\$\{([^}]+)\}/g))==null?void 0:l.map(f=>f.slice(2,-1));c!=null&&c.length&&(a[u]=(o=n[c[0]])!=null?o:this.getDynamicParam(c[0]))}else a[u]=s.value[u]}),Object.keys(a).length?a:{}}message(t){new _E(this.canvas.parentElement,t).init()}closeAll(){for(let t in Je)Je[t].close()}async navigatorTo(t){var s;if(!t)return;if((s=ws())==null?void 0:s.id){const n=new URL(window.location);n.searchParams.set("id",t),history.pushState({},"",n)}const a=await $d(this.store,t);a&&(this.open(a),this.lock(1),this.fitView(!0,10))}doSendDataEvent(t,i){let a=JSON.stringify(t);this.mqttClient&&this.mqttClient.connected&&(i?i.split(",").forEach(s=>{this.mqttClient.publish(s,a)}):this.store.data.mqttTopics&&this.store.data.mqttTopics.split(",").forEach(s=>{this.mqttClient.publish(s,a)})),this.websocket&&this.websocket.readyState===1&&this.websocket.send(a),(this.store.data.https||this.store.data.http)&&this.sendDatabyHttp(a),this.store.emitter.emit("sendData",a)}async sendDataToNetWork(t,i,a){var n,r,l,o,u,c;const s=ht(a.network);if(s.data&&(Object.assign(s,s.data),delete s.data),s.protocol==="iot"){this.iotMqttClient&&this.iotMqttClient.publish(`le5le-iot/property/set/${(n=this.store.data.iot)==null?void 0:n.token}`,JSON.stringify(t));return}if(!!s.url){if(s.protocol==="http"){if(typeof s.headers=="object"){let m=JSON.stringify(s.headers),w=(r=m.match(/\$\{([^}]+)\}/g))==null?void 0:r.map(y=>y.slice(2,-1));if(w!=null&&w.length)for(let y=0;y<w.length;y++)m=m.replace(`\${${w[y]}}`,this.getDynamicParam(w[y]));s.headers=JSON.parse(m)}let f,g=s.url;if(s.method==="GET"&&(f="?"+Object.keys(t).map(m=>m+"="+t[m]).join("&")),s.method==="POST"&&g.indexOf("${")>-1){let m=(l=g.match(/\$\{([^}]+)\}/g))==null?void 0:l.map(w=>w.slice(2,-1));m&&m.forEach(w=>{g=g.replace(`\${${w}}`,ya(i,w)||this.getDynamicParam(w))})}const v=await fetch(g+(f||""),{headers:s.headers||{},method:s.method,body:s.method==="POST"?JSON.stringify(t):void 0});if(v.ok){if(a.callback){const m=await v.text();if(!a.fn)try{if(typeof a.callback!="string")throw new Error("[meta2d] Function callback must be string");const w=a.callback;a.fn=new Function("pen","data","context",w)}catch(w){console.error("[meta2d]: Error on make a function:",w)}(o=a.fn)==null||o.call(a,i,m,{meta2d:this,e:a})}console.info("http\u6D88\u606F\u53D1\u9001\u6210\u529F")}}else if(s.protocol==="mqtt"){const f=(u=this.mqttClients)==null?void 0:u.filter(g=>g.options.href===s.url);if(f&&f.length)f[0].connected&&s.topics.split(",").forEach(g=>{f[0].publish(g,JSON.stringify(t))});else{let g=en.exports.connect(s.url,s.options);g.on("connect",()=>{console.info("mqtt\u8FDE\u63A5\u6210\u529F"),s.topics.split(",").forEach(v=>{g.publish(v,JSON.stringify(t)),setTimeout(()=>{g==null||g.end()},1e3)})})}}else if(s.protocol==="websocket"){const f=(c=this.websockets)==null?void 0:c.filter(g=>g.url===s.url);if(f&&f.length)f[0].readyState===1&&f[0].send(JSON.stringify(t));else{let g=new WebSocket(s.url,s.protocols||void 0);g.onopen=function(){console.info("websocket\u8FDE\u63A5\u6210\u529F"),g.send(JSON.stringify(t)),setTimeout(()=>{g.close()},100)}}}}}resize(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()}async addPen(t,i,a=!0,s=!1){return await this.canvas.addPen(t,i,a,s)}async addPens(t,i,a=!1){return await this.canvas.addPens(t,i,a)}render(t){var i;(i=this.canvas)==null||i.render(t)}async setBackgroundImage(t,i){var l,o,u,c;let a=this;async function s(f){return new Promise(g=>{const v=new Image;v.src=f,a.store.options.cdn&&!(f.startsWith("http")||f.startsWith("//")||f.startsWith("data:image"))&&(v.src=a.store.options.cdn+f),v.crossOrigin="anonymous",v.onload=()=>{g(v)}})}this.store.data.bkImage=t;const n=(i==null?void 0:i.width)||((l=this.store.data)==null?void 0:l.width)||((o=this.store.options)==null?void 0:o.width),r=(i==null?void 0:i.height)||((u=this.store.data)==null?void 0:u.height)||((c=this.store.options)==null?void 0:c.height);if(n&&r?(this.canvas.canvasTemplate.canvas.style.backgroundImage=null,this.canvas&&(this.canvas.canvasTemplate.bgPatchFlags=!0)):this.canvas.canvasTemplate.canvas.style.backgroundImage=t?`url('${t}')`:"",t){const f=await s(t);this.store.bkImg=f,n&&r&&this.canvas&&(this.canvas.canvasTemplate.init(),this.render())}else this.store.bkImg=null}setBackgroundColor(t=this.store.data.background){this.store.data.background=t,this.canvas&&(this.canvas.canvasTemplate.bgPatchFlags=!0)}setGrid({grid:t=this.store.data.grid,gridColor:i=this.store.data.gridColor,gridSize:a=this.store.data.gridSize,gridRotate:s=this.store.data.gridRotate}={}){this.store.data.grid=t,this.store.data.gridColor=i,this.store.data.gridSize=a<0?0:a,this.store.data.gridRotate=s,this.canvas&&(this.canvas.canvasTemplate.bgPatchFlags=!0)}setRule({rule:t=this.store.data.rule,ruleColor:i=this.store.data.ruleColor}={}){this.store.data.rule=t,this.store.data.ruleColor=i,this.store.patchFlagsTop=!0}open(t,i=!0){if(this.clear(!1,t==null?void 0:t.template),this.canvas.autoPolylineFlag=!0,t){t.theme&&this.setTheme(t.theme),this.setBackgroundImage(t.bkImage,t),Object.assign(this.store.data,t),this.store.data.pens=[];for(const a of t.pens)a.id||(a.id=St()),!a.calculative&&(a.calculative={canvas:this.canvas}),this.store.pens[a.id]=a;for(const a of t.pens)this.canvas.makePen(a)}if(this.canvas.patchFlagsLines.forEach(a=>{a.type&&this.canvas.initLineRect(a)}),this.store.data.template||(this.store.data.template=St()),i||(this.canvas.opening=!0),this.doInitJS(),this.initBindDatas(),this.initBinds(),this.doInitFn(),this.loadLineAnimateDraws(),this.initMessageEvents(),this.initGlobalTriggers(),this.startAnimate(),this.startVideo(),this.listenSocket(),this.connectSocket(),this.connectNetwork(),this.startDataMock(),this.canvas.initGlobalStyle(),this.render(),setTimeout(()=>{const a=this.store.data.pens.find(s=>s.autofocus);a&&this.focus(a.id)},100),this.store.data.iconUrls)for(const a of this.store.data.iconUrls)Kx(a,()=>{this.render()});this.canvas.autoPolylineFlag=!1,this.store.emitter.emit("opened"),this.canvas.scroll&&this.canvas.scroll.isShow&&this.canvas.scroll.init()}dirtyData(t){const i=this.store.data.pens,a=this.store.data.width||this.store.options.width,s=this.store.data.height||this.store.options.height,n=[];for(let r=i.length-1;r>=0;r--){let l=i[r];if(l.parentId){const o=this.store.pens[l.parentId];(l.x>10||l.y>10||l.width>10||l.height>10||!o.children||!o.children.includes(l.id))&&n.push(l)}if(a&&s){let o=this.getPenRect(l);(o.x<-10||o.y<-10||o.x+o.width>a||o.y+o.height>s)&&n.push(l)}}return(!a||!s)&&N2(i).forEach(l=>{n.filter(u=>u.id===l.id).length||n.push(l)}),t&&this.active(n),n}clearDirtyData(){let t=this.dirtyData();this.delete(t,!0)}cacheData(t){if(t&&this.store.options.cacheLength){let i=this.store.cacheDatas.findIndex(a=>a.data&&a.data._id===t);if(i===-1)this.store.cacheDatas.push({data:ht(this.store.data,!0)}),this.store.cacheDatas.length>this.store.options.cacheLength&&this.store.cacheDatas.shift();else{let a=this.store.cacheDatas.splice(i,1)[0];this.store.cacheDatas.push(a)}}}loadCacheData(t){let i=this.store.cacheDatas.findIndex(a=>a.data&&a.data._id===t);i!==-1&&(this.store.data=this.store.cacheDatas[i].data,this.setBackgroundImage(this.store.data.bkImage),this.store.pens={},this.store.data.pens.forEach(a=>{a.calculative.canvas=this.canvas,this.store.pens[a.id]=a,Et.path2dDraws[a.name]&&this.store.path2dMap.set(a,Et.path2dDraws[a.name](a)),a.type&&this.store.path2dMap.set(a,Et.path2dDraws[a.name](a)),a.image&&(a.calculative.imageDrawed=!1,this.canvas.loadImage(a))}),this.render())}loadLineAnimateDraws(){Et.lineAnimateDraws={},Object.entries(this.store.data.lineAnimateDraws).forEach(([t,i])=>{Et.lineAnimateDraws[t]=new Function("ctx","pen","state","index",i)})}statistics(){const t=this.store.data.pens.length,i=this.store.data.pens.filter(l=>l.image).length,a=this.store.data.pens.filter(l=>l.image&&l.calculative.inView).length,s=this.store.data.pens.filter(l=>l.name.endsWith("Dom")||Od.includes(l.name)||this.store.options.domShapes.includes(l.name)||l.externElement).length,n=this.store.animates.size;let r=0;return Object.keys(this.store.bind).forEach(l=>{r+=this.store.bind[l].length}),Object.keys(this.store.bindDatas).forEach(l=>{r+=this.store.bindDatas[l].length}),{\u56FE\u5143\u603B\u6570\u91CF:t,\u56FE\u7247\u56FE\u5143\u6570\u91CF:i,\u56FE\u7247\u56FE\u5143\u7ED8\u5236\u6570\u91CF:a,dom\u56FE\u5143\u6570\u91CF:s,\u6B63\u5728\u6267\u884C\u7684\u52A8\u753B\u6570\u91CF:n,\u6570\u636E\u70B9\u6570\u91CF:r}}initBindDatas(){this.store.bindDatas={},this.store.data.pens.forEach(t=>{var i;(i=t.form)==null||i.forEach(a=>{let s;a.dataIds&&(Array.isArray(a.dataIds)?s=a.dataIds:s=[a.dataIds]),s==null||s.forEach(n=>{this.store.bindDatas[n.dataId]||(this.store.bindDatas[n.dataId]=[]),this.store.bindDatas[n.dataId].push({id:t.id,formItem:a})})})})}initBinds(){this.jetLinksList=[],this.store.bind={};const t=[],i=[];this.store.data.pens.forEach(a=>{var s,n;(s=a.realTimes)==null||s.forEach(r=>{if(r.bind&&r.bind.id){let l=r.productId||a.productId,o=r.deviceId||a.deviceId,u=r.propertyId,c=!1;if(l&&l.indexOf("${")>-1){let f=l.match(new RegExp("(?<=\\$\\{).*?(?=\\})","g"));f!=null&&f.length&&(l=this.getDynamicParam(f[0])||l),c=!0}if(o&&o.indexOf("${")>-1){let f=o.match(new RegExp("(?<=\\$\\{).*?(?=\\})","g"));f!=null&&f.length&&(o=this.getDynamicParam(f[0])||o),c=!0}if(u&&u.indexOf("${")>-1){let f=u.match(new RegExp("(?<=\\$\\{).*?(?=\\})","g"));f!=null&&f.length&&(u=this.getDynamicParam(f[0])||u),c=!0}if(c&&r.bind&&(r.bind.id=l+"#"+o+"#"+u),this.store.bind[r.bind.id]||(this.store.bind[r.bind.id]=[]),this.store.bind[r.bind.id].push({id:a.id,key:r.key}),l&&o&&u){const f=this.jetLinksList.findIndex(g=>g.topic.startsWith(`/${l}/${o}`));f>-1?this.jetLinksList[f].properties.includes(r.propertyId)||this.jetLinksList[f].properties.push(r.propertyId):this.jetLinksList.push({topic:`/${l}/${o}`,deviceId:o,properties:[r.propertyId]})}if(r.bind.class==="iot"){let f=r.bind.id.split("#"),g=t.findIndex(m=>m.deviceId===f[0]);g>-1?t[g].properties.includes(f[1])||t[g].properties.push(f[1]):t.push({deviceId:f[0],properties:[f[1]],token:r.bind.token}),i.findIndex(m=>m.key===r.bind.id)===-1&&i.push({key:r.bind.id,label:r.bind.label})}else if(r.bind.class==="sql"){let f=r.bind.id.split("#");const g=this.store.data.sqls.find(v=>v.bindId===f[0]);if(g){g.keys||(g.keys=[]),f.shift();const v=f.join("#");g.keys.includes(v)||g.keys.push(v)}}}}),(n=a.events)==null||n.forEach(r=>{var o;const l=(o=r.actions)==null?void 0:o.filter(u=>u.action===he.SendData);l==null||l.forEach(u=>{var c;(c=u.data)==null||c.forEach(f=>{if(f.class==="iot"){let g=f.prop.split("#"),v=t.findIndex(m=>m.deviceId===g[0]);v>-1?t[v].properties.includes(g[1])||t[v].properties.push(g[1]):t.push({deviceId:g[0],properties:[g[1]],token:f.token})}})})})}),t.length&&(this.store.data.iot||(this.store.data.iot={}),this.store.data.iot.devices=t),i.length&&(this.store.data.iot.list=i)}connectSocket(){this.connectWebsocket(),this.connectMqtt(),this.connectHttp()}doInitJS(){const t=this.store.data.initJs;if(t&&t.trim())try{new Function("context",t)({meta2d:this})}catch(i){console.warn("initJs error",i)}}doInitFn(){let t=ws(),i=[];for(let a in t)t.hasOwnProperty(a)&&a.startsWith("bind-")&&i.push({id:a.replace("bind-",""),dataId:a.replace("bind-",""),value:t[a]});i.length&&this.setDatas(i,{history:!1})}drawLine(t){t&&bg(this.store),this.canvas.drawingLineName=t}alignPenToGrid(t){this.canvas.alignPenToGrid(t)}drawingPencil(){this.canvas.drawingPencil()}stopPencil(){this.canvas.stopPencil()}lock(t){this.store.data.locked=t,this.finishDrawLine(!0),this.canvas.drawingLineName="",this.stopPencil(),this.store.data.pens.forEach(i=>{var a;i.externElement===!0&&(a=i.calculative.singleton)!=null&&a.div&&Fe(i,i.calculative.singleton.div)}),t>0&&this.initMessageEvents()}async finishDrawLine(t){await this.canvas.finishDrawline(t)}async finishPencil(){await this.canvas.finishPencil()}updateLineType(t,i){if(!t||t.name!="line"||!i||!this.canvas[i])return;t.lineName=i;const a=le(t),s=Vt(t);a.prev=void 0,a.next=void 0,s.prev=void 0,s.next=void 0,t.calculative.worldAnchors=[a,s],t.calculative.activeAnchor=a,this.canvas[i](this.store,t,s),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},s.prev={penId:s.penId,x:s.x-50,y:s.y},s.next={penId:s.penId,x:s.x+50,y:s.y}),t.calculative.activeAnchor=void 0,this.canvas.initLineRect(t),this.render()}addDrawLineFn(t,i){this.canvas[t]=i,this.canvas.drawLineFns.push(t)}removeDrawLineFn(t){const i=this.canvas.drawLineFns.indexOf(t);i>-1&&this.canvas.drawLineFns.splice(i,1)}showMagnifier(){this.canvas.showMagnifier()}hideMagnifier(){this.canvas.hideMagnifier()}toggleMagnifier(){this.canvas.toggleMagnifier()}clear(t=!0,i){var a;for(const s of this.store.data.pens)(a=s.onDestroy)==null||a.call(s,s);Ux(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()}emit(t,i){this.store.emitter.emit(t,i)}on(t,i){return this.store.emitter.on(t,i),this}off(t,i){return this.store.emitter.off(t,i),this}updateLineAnimateDraws(t,i){!i||(delete this.store.data.lineAnimateDraws[t],delete Et.lineAnimateDraws[t],i!==-1&&this.registerLineAnimateDraws(i.name||t,i.code))}registerMoveDock(t){this.canvas.customMoveDock=t}registerResizeDock(t){this.canvas.customResizeDock=t}find(t){return this.canvas.find(t)}findOne(t){return this.canvas.findOne(t)}getPenRect(t){return this.canvas.getPenRect(t)}setPenRect(t,i,a=!0){this.canvas.setPenRect(t,i,a)}startAnimate(t,i){this.stopAnimate(t);let a;t?typeof t=="string"?a=this.find(t):a=t:a=this.store.data.pens.filter(s=>(s.type||s.frames)&&s.autoPlay||s.animations&&s.animations.length&&s.animations.findIndex(n=>n.autoPlay)!==-1),a.length&&(a.forEach(s=>{var n,r;if(s.calculative.pause){const l=Date.now()-s.calculative.pause;s.calculative.pause=void 0,s.calculative.frameStart+=l,s.calculative.frameEnd+=l}else{let l=-1;if(i!==void 0&&s.animations){if(typeof i=="string"){if(l=s.animations.findIndex(o=>o.name===i),l===-1)return}else if(typeof i=="number")if(s.animations.length>i)l=i;else return}else i===void 0&&(l=(n=s.animations)==null?void 0:n.findIndex(o=>o.autoPlay),l===-1&&((r=s.animations)==null?void 0:r.length)&&(l=0));if(l!==-1&&l!==void 0){const o=ht(s.animations[l]);o.animateName=o.name,delete o.name,o.currentAnimation=l,!s.type&&o.frames&&(o.showDuration=this.calcAnimateDuration(o)),this.setValue({id:s.id,...o},{doEvent:!1,history:!1})}this.store.animates.add(s),s.type||this.store.animateMap.set(s,s.calculative.canvas.getFrameProps(s))}}),this.initImageCanvas(a),this.canvas.animate())}pauseAnimate(t){let i=[];t?typeof t=="string"?i=this.find(t):i=t:this.store.animates.forEach(a=>{i.push(a)}),i.forEach(a=>{a.calculative.pause||(a.calculative.pause=Date.now())})}stopAnimate(t){let i=[];t?typeof t=="string"?i=this.find(t):i=t:this.store.animates.forEach(a=>{i.push(a)}),i.forEach(a=>{a.currentAnimation=void 0,a.calculative.pause=void 0,a.calculative.start=void 0,a.calculative.cycleStart=void 0,a.calculative.duration=void 0,a.calculative.animatePos=0,this.store.animates.delete(a),this.canvas.restoreNodeAnimate(a),this.canvas.updateLines(a),this.store.animateMap.delete(a)}),this.initImageCanvas(i),setTimeout(()=>{var a;(a=this.canvas)==null||a.calcActiveRect(),this.render()},20)}startVideo(t){let i;t?typeof t=="string"?i=this.find(t):i=t:i=this.store.data.pens.filter(a=>(a.video||a.audio)&&a.autoPlay),i.forEach(a=>{var s,n;(s=a.calculative.media)==null||s.play(),(n=a.onStartVideo)==null||n.call(a,a)})}pauseVideo(t){let i=[];t?typeof t=="string"?i=this.find(t):i=t:i=this.store.data.pens.filter(a=>(a.video||a.audio)&&a.autoPlay),i.forEach(a=>{var s,n;(s=a.calculative.media)==null||s.pause(),(n=a.onPauseVideo)==null||n.call(a,a)})}stopVideo(t){let i=[];t?typeof t=="string"?i=this.find(t):i=t:i=this.store.data.pens.filter(a=>(a.video||a.audio)&&a.autoPlay),i.forEach(a=>{var s;a.calculative.media&&(a.calculative.media.currentTime=0,a.calculative.media.pause()),(s=a.onStopVideo)==null||s.call(a,a)})}calcAnimateDuration(t){return t.frames.reduce((i,a)=>i+a.duration,0)}combine(t=this.store.active,i,a=!0){if(!t||!t.length)return;const s=ht(t);if(t.length===1&&t[0].type){t[0].type=$t.Node,this.canvas.active(t),this.pushHistory({type:bt.Update,initPens:s,pens:ht(t,!0)}),this.render();return}const n=hi(t);let r={id:St(),name:"combine",...n,children:[],showChild:i};this.canvas.makePen(r);const l=ht(r);let o=1/0;return t.forEach(u=>{var g;const c=this.store.data.pens.findIndex(v=>v.id===u.id);if(c<o&&(o=c),u===r||u.parentId===r.id||u.id===r.id)return;r.children.push(u.id),u.parentId=r.id;const f=fa(u.calculative.worldRect,n);Object.assign(u,f),u.locked=(g=u.lockedOnCombine)!=null?g:Mt.None,u.locked=u.interaction||Cl.includes(u.name)?0:u.locked}),this.store.data.pens.splice(o,0,r),this.store.data.pens.pop(),a&&this.canvas.active([r]),this.pushHistory({type:bt.Add,pens:[l],step:3}),this.pushHistory({type:bt.Update,initPens:[l],pens:[r],step:3}),this.pushHistory({type:bt.Update,initPens:s,pens:t,step:3}),i!=null&&(t.forEach(u=>{Yi(u,!0)}),this.initImageCanvas([r])),this.store.emitter.emit("combine",[r]),this.render(),r}uncombine(t){if(!t&&this.store.active&&(t=this.store.active[0]),!t||!t.children)return;const i=t.children.map(n=>this.store.pens[n]);let a=ht(i);i.forEach(n=>{n.parentId=void 0,n.x=n.calculative.worldRect.x,n.y=n.calculative.worldRect.y,n.width=n.calculative.worldRect.width,n.height=n.calculative.worldRect.height,n.locked=Mt.None,n.calculative.active=void 0,n.calculative.hover=!1,this.setVisible(n,!0)});const s=this.isCombine(t)?3:2;this.pushHistory({type:bt.Update,initPens:a,pens:i,step:s}),a=[ht(t)],t.children=void 0,this.pushHistory({type:bt.Update,initPens:a,pens:[t],step:s}),this.isCombine(t)&&(this.delete([t]),this.store.histories[this.store.histories.length-1].step=s),this.inactive()}clearCombine(t){if(!t&&this.store.active&&(t=this.store.active[0]),!t||!t.children)return;const i=Qe(t,this.store);i.forEach(s=>{s.parentId=void 0,s.x=s.calculative.worldRect.x,s.y=s.calculative.worldRect.y,s.width=s.calculative.worldRect.width,s.height=s.calculative.worldRect.height,s.locked=Mt.None,s.calculative.active=void 0,s.calculative.hover=!1,s.showChild!==void 0&&this.setVisible(s,!0),s.children=void 0});const a=[];i.forEach((s,n)=>{s.name==="combine"&&(s.children=void 0,a.push(s))}),this.delete(a,!0,!1),t.children=void 0,this.isCombine(t)&&this.delete([t],!0,!1),this.inactive()}appendChild(t=this.store.active){if(!t||t.length<2)return;const i=t.findIndex(a=>a.name==="combine"&&a.showChild!==void 0);if(i!==-1){let a=t[i];const s=hi(t);Object.assign(a,s),Object.assign(a.calculative.worldRect,s),As(a),a.children.forEach(n=>{const r=this.store.pens[n],l=fa(r.calculative.worldRect,s);Object.assign(r,l)}),t.forEach(n=>{var r;if(n.id!==a.id){a.children.push(n.id),n.parentId=a.id;const l=fa(n.calculative.worldRect,s);Object.assign(n,l),n.locked=(r=n.lockedOnCombine)!=null?r:Mt.DisableMove,n.locked=n.interaction||Cl.includes(n.name)?0:n.locked,Yi(n,!0)}}),this.initImageCanvas(t),this.render()}else console.warn("Invalid operation!")}updateRectbyChild(t,i,a){if(re(t),Qt(t),i.calculative.worldRect=t,a.container&&Xi(t,a.calculative.worldRect,!0)){const s=fa(t,a.calculative.worldRect);Object.assign(i,s)}else{if(a.container){let s=Math.min(t.x,a.calculative.worldRect.x),n=Math.min(t.y,a.calculative.worldRect.y),r=Math.max(t.ex,a.calculative.worldRect.ex),l=Math.max(t.ey,a.calculative.worldRect.ey);a.calculative.worldRect={x:s,y:n,width:r-s,height:l-n,ex:r,ey:l},Qt(a.calculative.worldRect)}else{const s=a.children.map(n=>this.store.pens[n]);a.calculative.worldRect=hi(s)}a.parentId||Object.assign(a,a.calculative.worldRect),a.children.forEach(s=>{const n=this.store.pens[s],r=fa(n.calculative.worldRect,a.calculative.worldRect);Object.assign(n,r)}),a.parentId&&this.updateRectbyChild(a.calculative.worldRect,a,this.store.pens[a.parentId])}this.canvas.updatePenRect(a),this.render()}isCombine(t){return!!(t.name==="combine"||t.children&&t.children.length>0)}active(t,i=!0){this.canvas.active(t,i)}inactive(){this.canvas.inactive()}activeAll(){this.canvas.active(this.store.data.pens.filter(t=>!t.parentId&&t.locked!==Mt.Disable)),this.render()}focus(t){const i=this.findOne(t);i&&(this.store.hover=i,this.store.hover.calculative.hover=!0,this.showInput(i))}delete(t,i=!1,a=!0){this.canvas.delete(t,i,a)}scale(t,i={x:0,y:0}){this.canvas.scale(t,i)}translate(t,i){this.canvas.translate(t,i)}translatePens(t,i,a){this.canvas.translatePens(t,i,a)}getParent(t,i){return ti(t,i)}getAllChildren(t){return Qe(t,this.store)}getAllFollowers(t){return mc(t,this.store)}data(){const t=ht(this.store.data),{pens:i,paths:a}=this.store.data;t.version=zd.version,t.paths={};for(const s in a)Object.prototype.hasOwnProperty.call(a,s)&&i.find(n=>n.pathId===s)&&(t.paths[s]=a[s]);return t.dataPoints=[...Object.keys(this.store.bind),...Object.keys(this.store.bindDatas)],t}copy(t){this.canvas.copy(t)}cut(t){this.canvas.cut(t)}paste(){this.canvas.paste()}undo(){this.canvas.undo()}redo(){this.canvas.redo()}listenSocket(){try{let t;const i=this.store.data.socketCbJs;if(i&&(t=new Function("e","context",i)),!t)return this.socketFn=null,!1;this.socketFn=t}catch(t){return console.error("Create the function for socket:",t),!1}return!0}connectWebsocket(t){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=i=>{this.socketCallback(i.data,{type:"websocket",url:this.store.data.websocket})},this.websocket.onerror=i=>{this.store.emitter.emit("error",{type:"websocket",error:i})},this.websocket.onclose=()=>{if(this.store.options.reconnetTimes&&(this.websocketTimes++,this.websocketTimes>=this.store.options.reconnetTimes)){this.websocketTimes=0,this.closeWebsocket();return}console.info("Canvas websocket closed and reconneting..."),this.connectWebsocket()})}closeWebsocket(){this.websocket&&(this.websocket.onclose=void 0,this.websocket.close(),this.websocket=void 0)}connectMqtt(t){if(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=St());const i={...this.store.data.mqttOptions};i.username||delete i.username,i.password||delete i.password;const{username:a,password:s}=i;a&&s||!a&&!s?(this.mqttClient=en.exports.connect(this.store.data.mqtt,i),this.mqttClient.on("message",(n,r)=>{this.socketCallback(r.toString(),{topic:n,type:"mqtt",url:this.store.data.mqtt})}),this.mqttClient.on("error",n=>{this.store.emitter.emit("error",{type:"mqtt",error:n})}),this.mqttClient.on("close",()=>{this.store.options.reconnetTimes&&(this.mqttTimes++,this.mqttTimes>=this.store.options.reconnetTimes&&(this.mqttTimes=0,this.closeMqtt()))}),this.store.data.mqttTopics&&this.mqttClient.subscribe(this.store.data.mqttTopics.split(","))):console.warn("\u7F3A\u5C11\u7528\u6237\u540D\u6216\u5BC6\u7801")}}closeMqtt(){var t;(t=this.mqttClient)==null||t.end()}connectHttp(){this.closeHttp();const{https:t}=this.store.data;if(t)this.store.data.cancelFirstConnect||t.forEach(async i=>{this.oldRequestHttp(i)}),t.forEach((i,a)=>{i.http&&i.httpTimeInterval!==0&&(i.times=0,this.httpTimerList[a]=setInterval(async()=>{this.oldRequestHttp(i),this.store.options.reconnetTimes&&i.times>=this.store.options.reconnetTimes&&(i.times=0,clearInterval(this.httpTimerList[a]),this.httpTimerList[a]=void 0)},i.httpTimeInterval||1e3))});else{const{http:i,httpTimeInterval:a,httpHeaders:s}=this.store.data;i&&(this.httpTimer=setInterval(async()=>{const n=await fetch(i,{headers:s});if(n.ok){const r=await n.text();this.socketCallback(r,{type:"http",url:i})}},a||1e3))}}async oldRequestHttp(t){let i=ht(t);if(i.http){const a=await fetch(i.http,{headers:i.httpHeaders,method:i.method||"GET",body:i.method==="POST"?JSON.stringify(i.body):void 0});if(a.ok){const s=await a.text();this.socketCallback(s,{type:"http",url:i.http})}else t.times++,this.store.emitter.emit("error",{type:"http",error:a})}}async sendDatabyHttp(t){const{https:i}=this.store.data;if(i)i.forEach(async a=>{a.http&&(await fetch(a.http,{method:"post",body:t,headers:a.httpHeaders})).ok&&console.info("http\u6D88\u606F\u53D1\u9001\u6210\u529F")});else{const{http:a,httpHeaders:s}=this.store.data;a&&(await fetch(a,{method:"post",body:t,headers:s})).ok&&console.info("http\u6D88\u606F\u53D1\u9001\u6210\u529F")}}closeHttp(){clearInterval(this.httpTimer),this.httpTimer=void 0,this.httpTimerList&&this.httpTimerList.forEach(t=>{clearInterval(t),t=void 0})}connectNetwork(){this.closeNetwork();const{networks:t}=this.store.data,i=[];if(t){let a=0,s=0,n=0,r=0;this.mqttClients=[],this.websockets=[],this.eventSources=[],t.forEach(async l=>{l.protocol==="mqtt"?(l.index=a,this.connectNetMqtt(l),a+=1):l.protocol==="websocket"?(l.index=n,this.connectNetWebSocket(l),n+=1):l.protocol==="http"?(l.index=s,i.push({url:l.url,interval:l.interval,headers:l.headers||void 0,method:l.method,body:l.body,enable:l.enable,index:l.index,once:l.once}),s+=1):l.protocol==="ADIIOT"?EE(this,l):l.protocol==="SSE"&&(l.index=r,this.connectSSE(l),r+=1)})}this.onNetworkConnect(i),this.connectIot(),this.connectSqls()}reconnectNetwork(t){var a,s;const i=this.store.data.networks[t];if(i.protocol==="mqtt")this.mqttClients&&((a=this.mqttClients[i.index])==null||a.end()),this.connectNetMqtt(i);else if(i.protocol==="websocket")this.websockets&&this.websockets[i.index]&&(this.websockets[i.index].onclose=void 0,this.websockets[i.index].close(),this.websockets[i.index]=void 0),this.connectNetWebSocket(i);else if(i.protocol==="http"){this.updateTimerList&&(clearInterval(this.updateTimerList[i.index]),this.updateTimerList[i.index]=void 0);const n=ht(i);this.store.data.cancelFirstConnect||this.requestHttp(n),this.updateTimerList[i.index]=setInterval(async()=>{this.requestHttp(n)},n.interval||1e3)}else i.protocol==="SSE"&&(this.eventSources&&((s=this.eventSources[i.index])==null||s.close(),this.eventSources[i.index]=void 0),this.connectSSE(i))}async connectIot(){var s;const{iot:t}=this.store.data;if(!(t&&((s=t==null?void 0:t.devices)==null?void 0:s.length))||t&&t.enable===!1)return;const i=globalThis.iotUrl||await this.getMqttUrl();if(!i){console.warn("iot Request address error");return}const a=await this.getIotToken(t.devices,t.protocol==="websocket"?1:void 0);t.token=a,this.iotMqttClient=en.exports.connect(i),this.iotMqttClient.on("message",(n,r)=>{this.socketCallback(r.toString(),{topic:`le5le-iot/properties/${a}`,type:"iot",url:i,method:"mqtt"})}),this.iotMqttClient.on("error",n=>{this.store.emitter.emit("error",{type:"mqtt",error:n})}),this.iotMqttClient.subscribe(`le5le-iot/properties/${a}`),this.iotTimer=setInterval(()=>{this.iotMqttClient&&this.iotMqttClient.publish("le5le-iot/subscribe/ping",a)},3e5)}closeIot(){if(this.iotMqttClient){const{iot:t}=this.store.data;t!=null&&t.token&&this.unsubscribeIot(t.token),this.iotMqttClient.end(),this.iotMqttClient=void 0}clearInterval(this.iotTimer),this.iotTimer=void 0}connectSqls(){const{sqls:t}=this.store.data;t&&t.length&&t.forEach(async(i,a)=>{i.enable!==!1&&(await this.doSqlCode(i),i.interval&&(i.index=a,this.sqlTimerList[a]=setInterval(async()=>{await this.doSqlCode(i)},i.interval)))})}connectSSE(t){t.enable!==!1&&(this.eventSources[t.index]=new EventSource(t.url,{withCredentials:t.withCredentials}),this.eventSources[t.index].onmessage=i=>{this.socketCallback(i.data,{type:"SSE",url:t.url,name:t.name,net:t})},this.eventSources[t.index].onerror=i=>{this.store.emitter.emit("error",{type:"SSE",error:i})})}closeSSE(){this.eventSources&&this.eventSources.forEach(t=>{t&&(t.close(),t=void 0)})}connectNetMqtt(t){var s,n,r,l;if(t.enable===!1)return;t.options.clientId&&!t.options.customClientId&&(t.options.clientId=St());let i=t.url;if(i.indexOf("${")>-1){let o=(s=i.match(/\$\{([^}]+)\}/g))==null?void 0:s.map(u=>u.slice(2,-1));o&&o.forEach(u=>{i=i.replace(`\${${u}}`,this.getDynamicParam(u))})}t.times=0;let a=ht(t.options);if((a==null?void 0:a.username)&&a.username.includes("${")){let o=(n=a.username.match(/\$\{([^}]+)\}/g))==null?void 0:n.map(u=>u.slice(2,-1));o&&o.forEach(u=>{a.username=a.username.replace(`\${${u}}`,this.getDynamicParam(u))})}if((a==null?void 0:a.password)&&a.password.includes("${")){let o=(r=a.password.match(/\$\{([^}]+)\}/g))==null?void 0:r.map(u=>u.slice(2,-1));o&&o.forEach(u=>{a.password=a.password.replace(`\${${u}}`,this.getDynamicParam(u))})}if(this.mqttClients[t.index]=en.exports.connect(i,a),this.mqttClients[t.index].on("message",(o,u)=>{this.socketCallback(u.toString(),{topic:o,type:"mqtt",url:t.url,name:t.name,net:t})}),this.mqttClients[t.index].on("error",o=>{this.store.emitter.emit("error",{type:"mqtt",error:o})}),this.mqttClients[t.index].on("close",()=>{var o;this.store.options.reconnetTimes&&(t.times++,t.times>=this.store.options.reconnetTimes&&(t.times=0,this.mqttClients&&((o=this.mqttClients[t.index])==null||o.end())))}),t.topics){let o=t.topics;if(o.indexOf("${")>-1){let u=(l=o.match(/\$\{([^}]+)\}/g))==null?void 0:l.map(c=>c.slice(2,-1));u&&u.forEach(c=>{o=o.replace(`\${${c}}`,this.getDynamicParam(c))})}this.mqttClients[t.index].subscribe(o.split(","))}}connectNetWebSocket(t){var a,s;if(this.websockets[t.index]&&(this.websockets[t.index].onclose=void 0,(a=this.websockets[t.index])==null||a.close(),this.websockets[t.index]=void 0),t.enable===!1)return;let i=t.url;if(i.indexOf("${")>-1){let n=(s=i.match(/\$\{([^}]+)\}/g))==null?void 0:s.map(r=>r.slice(2,-1));n&&n.forEach(r=>{i=i.replace(`\${${r}}`,this.getDynamicParam(r))})}this.websockets[t.index]=new WebSocket(i,t.protocols||void 0),this.websockets[t.index].onmessage=n=>{this.socketCallback(n.data,{type:"websocket",url:t.url,name:t.name,net:t})},this.websockets[t.index].onerror=n=>{this.store.emitter.emit("error",{type:"websocket",error:n})},this.websockets[t.index].onclose=()=>{var n;if(this.store.options.reconnetTimes&&(t.times++,t.times>=this.store.options.reconnetTimes)){t.times=0,this.websockets[t.index].onclose=void 0,(n=this.websockets[t.index])==null||n.close(),this.websockets[t.index]=void 0;return}setTimeout(()=>{console.info("Canvas websocket closed and reconneting..."),this.connectNetWebSocket(t)},2e3)}}async getMqttUrl(){const t=await fetch("/api/iot/app/mqtt",{method:"GET",headers:{Authorization:`Bearer ${Sr()}`}});if(t.ok){const i=await t.text();let a=JSON.parse(i);return a.wssPort||a.wsPort?`${location.protocol==="https:"?"wss":"ws"}://${a.host}:${location.protocol==="https:"?a.wssPort:a.wsPort}${a.path}`:void 0}}async getIotToken(t,i){const a=await fetch("/api/iot/subscribe/properties",{method:"POST",headers:{Authorization:`Bearer ${Sr()}`},body:JSON.stringify({devices:t,type:i})});if(a.ok){const s=await a.text();return JSON.parse(s).token}}async unsubscribeIot(t){return await fetch("/api/iot/unsubscribe/properties",{method:"POST",headers:{Authorization:`Bearer ${Sr()}`},body:JSON.stringify({token:t})})}async doSqlCode(t){var n;const i=t.method||"get";let a=t.sql;i==="list"&&(t.dbType==="oracle"?a.includes("OFFSET")||(a+=` OFFSET ${(t.current||1-1)*(t.pageSize||20)} ROWS FETCH NEXT ${t.pageSize||20} ROWS ONLY`):a.includes("LIMIT")||(a+=` LIMIT ${t.pageSize||20}`+(t.current>1?" OFFSET "+(t.current-1)*(t.pageSize||20):"")));const s=await fetch(`/api/iot/data/sql/${i}`,{method:"POST",headers:{Authorization:`Bearer ${gn("token")||localStorage.getItem("token")||new URLSearchParams(location.search).get("token")||""}`},body:JSON.stringify({dbId:t.dbId||t.dbid,sql:a})});if(s.ok){let r=await s.text();if(r){const l=[];if(r=JSON.parse(r),r.error){this.store.emitter.emit("error",{type:"sql",error:r.error});return}(n=t.keys)==null||n.forEach(o=>{l.push({id:t.bindId+"#"+o,value:ya(r,o.split("#").join("."))})}),l.push({id:t.bindId,value:r}),this.socketCallback(JSON.stringify(l),{type:"sql",url:`/api/iot/data/sql/${i}`,method:i})}}}randomString(t){t=t||32;let i="ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678",a=i.length,s="";for(let n=0;n<t;n++)s+=i.charAt(Math.floor(Math.random()*a));return s}mockValue(t){let i;if(t.enableMock&&t.mock!==void 0)if(t.type==="float")if(t.mock&&t.mock.indexOf(",")!==-1){let a=t.mock.split(","),s=Math.floor(Math.random()*a.length);i=parseFloat(a[s])}else if(t.mock&&t.mock.indexOf("-")!==-1){let a,s,n,r=t.mock.split("-");if(t.mock.charAt(0)==="-"?r.length===4?(a=-parseFloat(r[3]),s=-parseFloat(r[1]),n=r[3]):(a=parseFloat(r[2]),s=-parseFloat(r[1]),n=r[2]):(a=parseFloat(r[1]),s=parseFloat(r[0]),n=r[1]),(n+"").indexOf(".")!==-1){let l=(n+"").split(".")[1].length;i=(Math.random()*(a-s)+s).toFixed(l)}else i=Math.random()*(a-s)+s}else i=parseFloat(t.mock);else if(t.type==="integer")if(t.mock&&t.mock.indexOf(",")!==-1){let a=t.mock.split(","),s=Math.floor(Math.random()*a.length);i=parseInt(a[s])}else if(t.mock&&t.mock.indexOf("-")!==-1){let a,s,n=t.mock.split("-");t.mock.charAt(0)==="-"?n.length===4?(a=-parseFloat(n[3]),s=-parseFloat(n[1])):(a=parseFloat(n[2]),s=-parseFloat(n[1])):(a=parseInt(n[1]),s=parseInt(n[0])),i=parseInt(Math.random()*(a-s)+s+"")}else i=parseInt(t.mock);else if(t.type==="bool")typeof t.mock=="boolean"?i=t.mock:t.mock==="true"?i=!0:t.mock==="false"?i=!1:i=Math.random()<.5;else if(t.type==="object"||t.type==="array")t.mock;else if(t.mock&&t.mock.indexOf(",")!==-1){let a=t.mock.split(","),s=Math.floor(Math.random()*a.length);i=a[s]}else if(t.mock&&t.mock.startsWith("[")&&t.mock.endsWith("]")){let a=parseInt(t.mock.substring(1,t.mock.length-1));i=this.randomString(a)}else i=t.mock;return i}dataMock(){var i,a;let t=[];(a=(i=this.store.data.dataset)==null?void 0:i.devices)==null||a.forEach(s=>{let n=this.mockValue(s);n!==void 0&&t.push({id:s.id,value:n})}),t.length&&this.setDatas(t,{render:!0,doEvent:!0,history:!1})}networkMock(){if(this.store.data.networks&&this.store.data.networks.length){let t=[];this.store.data.networks.forEach(i=>{var a;i.enable===!1&&((a=i.children)==null||a.forEach(s=>{let n=ht(s);n.enableMock=!0;let r=this.mockValue(n);r!==void 0&&t.push({id:s.id,value:r})}))}),t.length&&this.setDatas(t,{render:!0,doEvent:!0,history:!1})}}startDataMock(){this.store.data.enableMock?(this.stopDataMock(),this.initBinds(),this.updateTimer=setInterval(()=>{this.store.data.pens.forEach(i=>{this.penMock(i)}),this.networkMock(),this.render()},this.store.data.networkInterval||1e3)):this.stopDataMock()}stopDataMock(){clearInterval(this.updateTimer),this.updateTimer=void 0}penMock(t){var i;if(t.realTimes){let a={};if(t.realTimes.forEach(s=>{let n=this.mockValue(s);n!==void 0&&(a[s.key]=n)}),Object.keys(a).length){let s=t.onBeforeValue?t.onBeforeValue(t,a):a;this.canvas.updateValue(t,s),(i=t.onValue)==null||i.call(t,t),this.store.emitter.emit("valueUpdate",t)}}}penNetwork(t){const 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]}getDynamicParam(t){return ws()[t]||localStorage[t]||gn(t)||globalThis[t]||""}onNetworkConnect(t){if(!!(t&&t.length)){if(this.store.pensNetwork)for(let i in this.store.pensNetwork)t.push(this.store.pensNetwork[i]);this.store.data.cancelFirstConnect||t.forEach(async i=>{i.enable!==!1&&this.requestHttp(i)}),t.forEach((i,a)=>{i.times=0,i.interval!==0&&i.enable!==!1&&(i.once?setTimeout(async()=>{this.requestHttp(i)},i.interval||1e3):this.updateTimerList[a]=setInterval(async()=>{this.requestHttp(i),this.store.options.reconnetTimes&&i.times>=this.store.options.reconnetTimes&&(i.times=0,clearInterval(this.updateTimerList[a]),this.updateTimerList[a]=void 0)},i.interval||1e3))})}}async requestHttp(t){var a,s,n;let i=ht(t);if(i.url){if(i.url.indexOf("${")>-1){let l=(a=i.url.match(/\$\{([^}]+)\}/g))==null?void 0:a.map(o=>o.slice(2,-1));l&&l.forEach(o=>{i.url=i.url.replace(`\${${o}}`,this.getDynamicParam(o))})}if(typeof i.headers=="object"){let l=JSON.stringify(i.headers),o=(s=l.match(/\$\{([^}]+)\}/g))==null?void 0:s.map(u=>u.slice(2,-1));if(o!=null&&o.length)for(let u=0;u<o.length;u++)l=l.replace(`\${${o[u]}}`,this.getDynamicParam(o[u]));i.headers=JSON.parse(l)}if(typeof i.body=="object"){let l=JSON.stringify(i.body),o=(n=l.match(/\$\{([^}]+)\}/g))==null?void 0:n.map(u=>u.slice(2,-1));if(o!=null&&o.length)for(let u=0;u<o.length;u++)l=l.replace(`\${${o[u]}}`,this.getDynamicParam(o[u]));i.body=JSON.parse(l)}const r=await fetch(i.url,{headers:i.headers,method:i.method,body:i.method==="GET"?void 0:JSON.stringify(i.body)});if(r.ok){const l=await r.text(),o=this.store.data.networks.filter(u=>u.protocol==="http")[i.index];this.socketCallback(l,{type:"http",url:i.url,name:i.name,net:o})}else t.times++,this.store.emitter.emit("error",{type:"http",error:r})}}closeNetwork(){this.mqttClients&&this.mqttClients.forEach(t=>{t.end()}),this.websockets&&this.websockets.forEach(t=>{t&&(t.onclose=void 0,t.close(),t=void 0)}),this.mqttClients=void 0,this.websockets=void 0,this.updateTimerList&&this.updateTimerList.forEach(t=>{clearInterval(t),t=void 0}),this.sqlTimerList&&this.sqlTimerList.forEach(t=>{clearInterval(t),t=void 0}),this.closeIot(),kE(this),this.closeSSE()}socketCallback(t,i){var n,r;this.store.emitter.emit("socket",{message:t,context:i});let a=t;if((n=i.net)!=null&&n.socketCbJs&&((r=i.net)!=null&&r.socketFn||(i.net.socketFn=new Function("e","context",i.net.socketCbJs)),i.net.socketFn)){if(a=i.net.socketFn(t,{meta2d:this,type:i.type,topic:i.topic,url:i.url,method:i.method}),!a)return;a&&a!==!0&&(t=a)}if(this.socketFn&&(a=this.socketFn(t,{meta2d:this,type:i.type,topic:i.topic,url:i.url,method:i.method}),!a))return;a===!0&&(a=t);let s;if(a.constructor===Object||a.constructor===Array)s=a;else if(typeof a=="string")try{s=JSON.parse(a)}catch(l){console.warn("Invalid socket data:",s,l)}else return;!s||(Array.isArray(s)||(s=[s]),s.length&&(s[0].dataId?this.setDatas(s):s.forEach(l=>{this.setValue(l)})))}setDatas(t,{render:i=!0,doEvent:a=!0,history:s}={}){const n=new Map;t.forEach(o=>{var u,c;(u=this.store.bindDatas[o.dataId])==null||u.forEach(f=>{const g=this.store.pens[f.id];if(!g)return;let v=n.get(g);if(!g.noOnBinds&&typeof g.onBinds=="function"){if(v)return;n.set(g,g.onBinds(g,t,f.formItem));return}v?v[f.formItem.key]=o.value:(v={id:f.id,[f.formItem.key]:o.value},n.set(g,v))}),(c=this.store.bind[o.id||o.dataId])==null||c.forEach(f=>{const g=this.store.pens[f.id];if(!g)return;let v=n.get(g);v?v[f.key]=o.value:(v={id:f.id,[f.key]:o.value},n.set(g,v))})}),this.store.data.locked&&this.doDataEvent(t);let r,l;s&&(r=[]),n.forEach((o,u)=>{this.setValue(o,{render:!1,doEvent:a,history:!1}),s&&(r.push(ht(u,!0)),l.push(u))}),i&&this.render(),s&&this.pushHistory({type:bt.Update,initPens:r,pens:l})}setValue(t,{render:i=!0,doEvent:a=!0,history:s}={}){let n=[];if(!t)return;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}const l=this.store.pens[t.id];if(l)n=[l];else{let o=this.store.bind[t.id];if(o&&o.length){n=[],this.setDatas([t],{render:i,doEvent:a,history:s});return}}}else if(t.dataId){n=[],this.setDatas([t],{render:i,doEvent:a,history:s});return}else if(t.tag)n=this.find(t.tag);else{let l=[];for(let o in t)l.push({dataId:o,id:o,value:t[o]});l.length&&this.setDatas(l,{render:i,doEvent:a,history:s});return}s=s&&!this.store.data.locked;let r;if(s&&(r=ht(n)),n.forEach(l=>{var u;const o=l.onBeforeValue?l.onBeforeValue(l,t):t;t.frames&&(this.stopAnimate([l]),t.showDuration||(t.showDuration=t.frames.reduce((c,f)=>c+f.duration,0))),xc(l,o),this.canvas.updateValue(l,o),(u=l.onValue)==null||u.call(l,l)}),!this.store.data.locked&&this.store.active.length&&!this.canvas.movingPens&&this.canvas.calcActiveRect(),s){let l=ht(n);this.pushHistory({type:bt.Update,initPens:r,pens:l})}a&&n.forEach(l=>{this.store.emitter.emit("valueUpdate",l)}),i&&this.render()}_setValue(t,i=!1){this.setValue(t,{history:i,render:!1,doEvent:!1})}pushHistory(t){this.canvas.pushHistory(t)}showInput(t,i){this.canvas.showInput(t,i)}hideInput(){this.canvas.hideInput()}clearDropdownList(){this.canvas.clearDropdownList()}clearRuleLines(){this.canvas.clearRuleLines()}doMessageEvent(t,i){this.store.messageEvents[t]&&this.store.messageEvents[t].forEach(a=>{let s=!1;a.event.conditions&&a.event.conditions.length?a.event.conditionType==="and"?s=a.event.conditions.every(n=>this.judgeCondition(a.pen,n.key,n)):a.event.conditionType==="or"&&(s=a.event.conditions.some(n=>this.judgeCondition(a.pen,n.key,n))):s=!0,s&&a.event.actions.forEach(n=>{this.events[n.action](a.pen,n,i)})})}initGlobalTriggers(){var t;this.store.globalTriggers={},(t=this.store.data.triggers)==null||t.forEach(i=>{i.conditions.forEach(a=>{a.source&&(this.store.globalTriggers[a.source]||(this.store.globalTriggers[a.source]=[]),this.store.globalTriggers[a.source].includes(i)||this.store.globalTriggers[a.source].push(i))})})}initMessageEvents(){this.store.messageEvents={},this.store.data.pens.forEach(t=>{var i;(i=t.events)==null||i.forEach(a=>{a.name==="message"&&a.message&&(this.store.messageEvents[a.message]||(this.store.messageEvents[a.message]=[]),this.store.messageEvents[a.message].push({pen:t,event:a}))})})}dataJudegeCondition(t,i,a){const{type:s,target:n,fnJs:r,fn:l,operator:o,valueType:u}=a;let c=!1;if(s==="fn"){if(l)c=l(t,{meta2d:this});else if(r){try{a.fn=new Function("data","context",r)}catch(f){console.error("Error: make function:",f)}a.fn&&(c=a.fn(t,{meta2d:this}))}}else{let f=a.value;u==="prop"&&(f=t[a.value]);let g=t[i];switch(o){case">":c=g>+f;break;case">=":c=g>=+f;break;case"<":c=g<+f;break;case"<=":c=g<=+f;break;case"=":case"==":c=g==f;break;case"!=":c=g!=f;break;case"[)":c=us(+g,f);break;case"![)":c=!us(+g,f);break;case"[]":c=fs(g,f);break;case"![]":c=!fs(g,f);break}}return c}judgeCondition(t,i,a){const{type:s,target:n,fnJs:r,fn:l,operator:o,valueType:u}=a;let c=!1;if(s==="fn"){if(l)c=l(t,{meta2d:this});else if(r){try{a.fn=new Function("pen","context",r)}catch(f){console.error("Error: make function:",f)}a.fn&&(c=a.fn(t,{meta2d:this}))}}else{let f=a.value;u==="prop"&&(f=this.store.pens[n][a.value]);let g=ya(t,i);switch(["x","y","width","height"].includes(i)&&(g=this.getPenRect(t)[i]),o){case">":c=g>+f;break;case">=":c=g>=+f;break;case"<":c=g<+f;break;case"<=":c=g<=+f;break;case"=":case"==":c=g==f;break;case"!=":c=g!=f;break;case"[)":c=us(+g,f);break;case"![)":c=!us(+g,f);break;case"[]":c=fs(g,f);break;case"![]":c=!fs(g,f);break}}return c}pushChildren(t,i){const a=[ht(t,!0)],s=[];t.children||(t.children=[]);const n=[];i.forEach(l=>{var c;let o=ht(l,!0);if((!l.id||!this.store.pens[l.id])&&(this.canvas.makePen(l),o=null),l.parentId){const f=this.store.pens[l.parentId],g=f.children.findIndex(v=>v===l.id);a.push(ht(f,!0)),f.children.splice(g,1),n.push(ht(f,!0))}t.children.push(l.id),l.parentId=t.id;const u=fa(l.calculative.worldRect,t.calculative.worldRect);Object.assign(l,u),l.locked=(c=l.lockedOnCombine)!=null?c:Mt.DisableMove,l.locked=l.interaction||Cl.includes(l.name)?0:l.locked,o?(a.push(o),n.push(ht(l,!0))):s.push(ht(l,!0))}),n.push(ht(t,!0));let r=1;s.length&&(r=2,this.pushHistory({type:bt.Add,pens:s,step:r})),this.pushHistory({type:bt.Update,initPens:a,pens:n,step:r})}toPng(t,i,a=!1,s){return this.canvas.toPng(t,i,a,s)}activeToPng(t,i){return this.canvas.activeToPng(t,i)}pensToPng(t=this.store.active,i,a){return this.canvas.pensToPng(t,i,a)}downloadPng(t,i,a){var s;for(const n of this.store.data.pens)(n.calculative.img||["iframe"].includes(n.name))&&((s=n.onRenderPenRaw)==null||s.call(n,n));setTimeout(()=>{const n=document.createElement("a");n.setAttribute("download",(t||this.store.data.name||"le5le.meta2d")+".png"),n.setAttribute("href",this.toPng(i,void 0,!0,a));const r=document.createEvent("MouseEvents");r.initEvent("click",!0,!0),n.dispatchEvent(r)},1e3)}downloadSvg(t){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");let i=!1;const a=this.store.data.width||this.store.options.width,s=this.store.data.height||this.store.options.height;a&&s&&!this.store.data.component&&(i=!0);const n=this.getRect();i&&(n.x=this.store.data.origin.x,n.y=this.store.data.origin.y,n.width=a*this.store.data.scale,n.height=s*this.store.data.scale),n.x-=10,n.y-=10;const r=new window.C2S(n.width+20,n.height+20);r.textBaseline="middle",r.strokeStyle=this.store.styles.color;const l=this.store.options.downloadBgTransparent?void 0:this.store.data.background||this.store.styles.background;l&&i&&(r.save(),r.fillStyle=l,r.fillRect(0,0,n.width,n.height),r.restore()),this.store.bkImg&&i&&r.drawImage(this.store.bkImg,0,0,n.width,n.height),l&&!i&&(r.save(),r.fillStyle=l,r.fillRect(0,0,n.width+20,n.height+20),r.restore());for(const m of this.store.data.pens)m.visible==!1||!jr(m,this.store)||$r(r,m,n,!0);let o=r.getSerializedSvg();t!=null&&t.length&&(o=o.replace("<defs/>",`<defs>
  92. <style type="text/css">
  93. ${t.join(`
  94. `)}
  95. </style>
  96. {{bk}}
  97. </defs>
  98. {{bkRect}}`)),l?(o=o.replace("{{bk}}",""),o=o.replace("{{bkRect}}",`<rect x="0" y="0" width="100%" height="100%" fill="${l}"></rect>`)):(o=o.replace("{{bk}}",""),o=o.replace("{{bkRect}}","")),o=o.replace(/--le5le--/g,"&#x");const u=window.URL,c=new Blob([o]),f=u.createObjectURL(c),g=document.createElement("a");g.setAttribute("download",`${this.store.data.name||"le5le.meta2d"}.svg`),g.setAttribute("href",f);const v=document.createEvent("MouseEvents");v.initEvent("click",!0,!0),g.dispatchEvent(v)}getRect(t=this.store.data.pens){return hi(t)}hiddenTemplate(){this.canvas.canvasTemplate.hidden()}showTemplate(){this.canvas.canvasTemplate.show()}lockTemplate(t){this.store.data.pens.forEach(i=>{i.canvasLayer===zt.CanvasTemplate&&(i.locked=t)})}fitView(t=!0,i=10){var f,g;if(!this.hasView())return;const{canvas:a}=this.canvas,{offsetWidth:s,offsetHeight:n}=a;this.resize(s,n);const r=qi(i),l=this.getRect(),o=(s-r[1]-r[3])/l.width,u=(n-r[0]-r[2])/l.height;let c=o;t?c=o>u?u:o:c=o>u?o:u,(f=this.store.data.fits)!=null&&f.length&&(this.canvas.opening=!0),this.scale(c*this.store.data.scale),this.centerView(),(g=this.store.data.fits)!=null&&g.length&&this.fillView()}fillView(){var s,n;const t=this.getRect(),i=this.canvas.width-t.width,a=this.canvas.height-t.height;if(Math.abs(i)>10){(s=this.store.data.fits)==null||s.forEach(o=>{let u=[];o.children.forEach(f=>{this.store.pens[f]&&(this.store.pens[f].locked=Mt.None,u.push(this.store.pens[f]))});let c=i/2;if(o.left&&o.right){let f=o.leftValue,g=o.rightValue;f?f=Math.abs(f)<1?f*this.canvas.width:f:f=0,g?g=Math.abs(g)<1?g*this.canvas.width:g:g=0;let v=(this.canvas.width-f-g)/(t.width-f-g);u.forEach(m=>{var w,y;m.image&&m.imageRatio&&m.calculative.worldRect.width/this.canvas.width>.1&&(m.imageRatio=!1),m.calculative.worldRect.x=t.x-i/2+f+(m.calculative.worldRect.x-t.x)*v,m.calculative.worldRect.width*=v,m.calculative.worldRect.ex=m.calculative.worldRect.x+m.calculative.worldRect.width,m.calculative.width=m.calculative.worldRect.width,m.calculative.x=m.calculative.worldRect.x,m.width=m.calculative.worldRect.width,m.x=m.calculative.worldRect.x,this.canvas.updatePenRect(m,{worldRectIsReady:!1}),m.externElement&&((w=m.onResize)==null||w.call(m,m)),(y=m.children)!=null&&y.length&&Qe(m,this.store).forEach(A=>{var x;A.externElement&&((x=A.onResize)==null||x.call(A,A))})})}else o.left?(c=-c,o.leftValue&&(c+=Math.abs(o.leftValue)<1?o.leftValue*this.canvas.width:o.leftValue),this.translatePens(u,c,0)):o.right&&(o.rightValue&&(c=c-(Math.abs(o.rightValue)<1?o.rightValue*this.canvas.width:o.rightValue)),this.translatePens(u,c,0))});const r=this.store.data.pens.filter(o=>o.name==="iframe");r==null||r.forEach(o=>{var c,f;const u=o.calculative.worldRect;if(u.width/this.store.data.scale>t.width*.8){let g=u.width;o.calculative.worldRect.x=u.x-i/2,o.calculative.worldRect.width=u.width+i,o.calculative.worldRect.ex=u.ex+i,o.operationalRect.x=o.operationalRect.x*g/o.calculative.worldRect.width,o.operationalRect.width=(o.calculative.worldRect.width-(1-o.operationalRect.width)*g)/o.calculative.worldRect.width,(c=o.onBeforeValue)==null||c.call(o,o,{operationalRect:o.operationalRect}),(f=o.onResize)==null||f.call(o,o)}});const l=this.store.data.pens.filter(o=>o.name==="video");l==null||l.forEach(o=>{var c;const u=o.calculative.worldRect;u.width/this.store.data.scale>t.width*.8&&(o.calculative.worldRect.x=u.x-i/2,o.calculative.worldRect.width=u.width+i,o.calculative.worldRect.ex=u.ex+i,(c=o.onResize)==null||c.call(o,o))})}if(Math.abs(a)>10){(n=this.store.data.fits)==null||n.forEach(o=>{let u=[];o.children.forEach(f=>{this.store.pens[f]&&(this.store.pens[f].locked=Mt.None,u.push(this.store.pens[f]))});let c=a/2;if(o.top&&o.bottom){let f=o.topValue,g=o.bottomValue;f?f=Math.abs(f)<1?f*this.canvas.height:f:f=0,g?g=Math.abs(g)<1?g*this.canvas.height:g:g=0;let v=(this.canvas.height-f-g)/t.height;u.forEach(m=>{var w,y;m.image&&m.imageRatio&&m.calculative.worldRect.height/this.canvas.height>.1&&(m.imageRatio=!1),m.calculative.worldRect.y=t.y-a/2+f+(m.calculative.worldRect.y-t.y)*v,m.calculative.worldRect.height*=v,m.calculative.worldRect.ey=m.calculative.worldRect.y+m.calculative.worldRect.height,m.calculative.height=m.calculative.worldRect.height,m.calculative.y=m.calculative.worldRect.y,m.height=m.calculative.worldRect.height,m.y=m.calculative.worldRect.y,this.canvas.updatePenRect(m,{worldRectIsReady:!1}),m.externElement&&((w=m.onResize)==null||w.call(m,m)),(y=m.children)!=null&&y.length&&Qe(m,this.store).forEach(A=>{var x;A.externElement&&((x=A.onResize)==null||x.call(A,A))})})}else o.top?(c=-c,o.topValue&&(c+=Math.abs(o.topValue)<1?o.topValue*this.canvas.height:o.topValue),this.translatePens(u,0,c)):o.bottom&&(o.bottomValue&&(c=c-(Math.abs(o.bottomValue)<1?o.bottomValue*this.canvas.height:o.bottomValue)),this.translatePens(u,0,c))});const r=this.store.data.pens.filter(o=>o.name==="iframe");r==null||r.forEach(o=>{var c,f;const u=o.calculative.worldRect;if(u.height/this.store.data.scale>t.height*.8){let g=u.height;o.calculative.worldRect.y=u.y-a/2,o.calculative.worldRect.height=u.height+a,o.calculative.worldRect.ey=u.ey+a,o.operationalRect.y=o.operationalRect.y*g/o.calculative.worldRect.width,o.operationalRect.height=(o.calculative.worldRect.height-(1-o.operationalRect.height)*g)/o.calculative.worldRect.height,(c=o.onBeforeValue)==null||c.call(o,o,{operationalRect:o.operationalRect}),(f=o.onResize)==null||f.call(o,o)}});const l=this.store.data.pens.filter(o=>o.name==="video");l==null||l.forEach(o=>{var c;const u=o.calculative.worldRect;u.height/this.store.data.scale>t.height*.8&&(o.calculative.worldRect.y=u.y-a/2,o.calculative.worldRect.height=u.height+a,o.calculative.worldRect.ey=u.ey+a,(c=o.onResize)==null||c.call(o,o))})}this.canvas.canvasTemplate.fit=!0,this.canvas.canvasTemplate.init(),this.canvas.canvasImage.init(),this.canvas.canvasImageBottom.init(),this.render(!0)}trimPens(){let t=this.store.data.pens.filter(i=>i.name==="line"&&i.anchors.length<2);this.delete(t)}fitTemplateView(t=!0,i=10){if(!this.hasView())return;const{canvas:a}=this.canvas,{offsetWidth:s,offsetHeight:n}=a,r=qi(i),l=this.getRect(),o=(s-r[1]-r[3])/l.width,u=(n-r[0]-r[2])/l.height;let c=o;t?c=o>u?u:o:c=o>u?o:u,this.canvas.templateScale(c*this.store.data.scale);let f=this.getRect(),g=this.store.data.pens.filter(v=>!v.parentId);this.canvas.templateTranslatePens(g,-f.x,-f.y),this.store.data.pens.forEach(v=>{v.type?this.canvas.initLineRect(v):this.canvas.updateLines(v)}),this.centerView()}fitSizeView(t=!0,i=10){var g,v;const{canvas:a}=this.canvas,{offsetWidth:s,offsetHeight:n}=a;this.resize(s,n);const r=qi(i),l=(this.store.data.width||this.store.options.width)*this.store.data.scale,o=(this.store.data.height||this.store.options.height)*this.store.data.scale,u=(s-r[1]-r[3])/l,c=(n-r[0]-r[2])/o;let f=u;t==="width"?f=u:t==="height"?f=c:t?f=u>c?c:u:f=u>c?u:c,(g=this.store.data.fits)!=null&&g.length&&(this.canvas.opening=!0),this.scale(f*this.store.data.scale),this.centerSizeView(),(v=this.store.data.fits)!=null&&v.length&&this.fillView()}centerSizeView(){const t=this.getViewCenter(),i=this.store.data.width||this.store.options.width,a=this.store.data.height||this.store.options.height,s={x:0,y:0,width:i,height:a};Qt(s);const{center:n}=s,{scale:r,origin:l,x:o,y:u}=this.store.data;this.translate((t.x-l.x)/r-n.x-o/r,(t.y-l.y)/r-n.y-u/r);const{canvas:c}=this.canvas,f=(c.scrollWidth-c.offsetWidth)/2,g=(c.scrollHeight-c.offsetHeight)/2;c.scrollTo(f,g)}scrollView(t=10,i=!1){if(!this.hasView()||!this.canvas.scroll)return;const{canvas:a}=this.canvas,{offsetWidth:s,offsetHeight:n}=a;this.resize(s,n);const r=qi(t),l=this.getRect(),o=(s-r[1]-r[3])/l.width;this.scale(o*this.store.data.scale),this.topView(r[0]),i&&this.canvas.scroll.changeMode()}screenView(t=10,i=!0){if(!this.hasView())return;const{canvas:a}=this.canvas,{offsetWidth:s,offsetHeight:n}=a;this.resize(s,n);const r=qi(t),l=this.getRect();let o=(s-r[1]-r[3])/l.width;i||(o=(n-r[0]-r[2])/l.height),this.scale(o*this.store.data.scale),this.topView(r[0])}topView(t=10){if(!this.hasView())return;const i=this.getRect(),a=this.getViewCenter(),s=this.getPenRect(i);Qt(s);const{center:n}=s,{scale:r,origin:l,x:o,y:u}=this.store.data;this.translate((a.x-l.x)/r-n.x-o/r,(t-l.y)/r-s.y-u/r);const{canvas:c}=this.canvas,f=(c.scrollWidth-c.offsetWidth)/2,g=(c.scrollHeight-c.offsetHeight)/2;c.scrollTo(f,g)}centerView(){if(!this.hasView())return;const t=this.getRect(),i=this.getViewCenter(),a=this.getPenRect(t);Qt(a);const{center:s}=a,{scale:n,origin:r,x:l,y:o}=this.store.data;this.translate((i.x-r.x)/n-s.x-l/n,(i.y-r.y)/n-s.y-o/n);const{canvas:u}=this.canvas,c=(u.scrollWidth-u.offsetWidth)/2,f=(u.scrollHeight-u.offsetHeight)/2;u.scrollTo(c,f)}hasView(){return!!this.store.data.pens.filter(t=>!t.isRuleLine).length}getViewCenter(){const{width:t,height:i}=this.canvas;return{x:t/2,y:i/2}}beSameByFirst(t=this.store.data.pens,i){const a=ht(t),s=t[0],{width:n,height:r}=this.getPenRect(s);for(let l=1;l<t.length;l++){const o=t[l];i==="width"?this.setValue({id:o.id,width:n},{render:!1,doEvent:!1}):i==="height"?this.setValue({id:o.id,height:r},{render:!1,doEvent:!1}):this.setValue({id:o.id,width:n,height:r},{render:!1,doEvent:!1})}this.render(),this.pushHistory({type:bt.Update,initPens:a,pens:t})}beSameByLast(t=this.store.data.pens,i){const a=ht(t),s=t[t.length-1],{width:n,height:r}=this.getPenRect(s);for(let l=0;l<t.length-1;l++){const o=t[l];i==="width"?this.setValue({id:o.id,width:n},{render:!1,doEvent:!1}):i==="height"?this.setValue({id:o.id,height:r},{render:!1,doEvent:!1}):this.setValue({id:o.id,width:n,height:r},{render:!1,doEvent:!1})}this.render(),this.pushHistory({type:bt.Update,initPens:a,pens:t})}formatPainterByFirst(t=this.store.data.pens){const i=ht(t),a=t[0],s={};Gs.forEach(n=>{s[n]=a[n]});for(let n=1;n<t.length;n++){const r=t[n];this.setValue({id:r.id,...Fl,...s},{render:!1,doEvent:!1})}this.render(),this.pushHistory({type:bt.Update,initPens:i,pens:t})}formatPainterByLast(t=this.store.data.pens){const i=ht(t),a=t[t.length-1],s={};Gs.forEach(n=>{s[n]=a[n]});for(let n=0;n<t.length-1;n++){const r=t[n];this.setValue({id:r.id,...Fl,...s},{render:!1,doEvent:!1})}this.render(),this.pushHistory({type:bt.Update,initPens:i,pens:t})}setFormatPainter(){const t=this.store.active,i={};if(t.length>0){const a=t[0];Gs.forEach(s=>{i[s]=a[s]!==void 0?a[s]:this.store.options.defaultFormat[s]||this.store.data[s]||this.store.options[s]})}else Gs.forEach(a=>{this.store.options.defaultFormat[a]||this.store.data[a]||this.store.options[a]});localStorage.setItem("meta2d-formatPainter",JSON.stringify(i))}formatPainter(){const t=this.store.active,i=ht(t),a=JSON.parse(localStorage.getItem("meta2d-formatPainter"));for(let s=0;s<t.length;s++){const n=t[s];this.setValue({id:n.id,...Fl,...a},{render:!1,doEvent:!1})}this.render(),this.pushHistory({type:bt.Update,initPens:i,pens:t})}clearFormatPainter(){const t=this.store.active,i=ht(t);Gs.forEach(a=>{for(let s=0;s<t.length;s++){const n=t[s],{fontSize:r,lineHeight:l}=this.store.options;a==="lineWidth"?(n.lineWidth=1,n.calculative.lineWidth=1):a==="fontSize"?(n.fontSize=r,n.calculative.fontSize=r):a==="lineHeight"?(n.lineHeight=l,n.calculative.lineHeight=l):(delete n[a],delete n.calculative[a])}}),this.render(),this.pushHistory({type:bt.Update,initPens:i,pens:t})}alignNodes(t,i=this.store.data.pens,a){!a&&(a=this.getPenRect(this.getRect(i)));const s=ht(i);for(const n of i)this.alignPen(t,n,a);this.initImageCanvas(i),this.initTemplateCanvas(i),this.render(),this.pushHistory({type:bt.Update,initPens:s,pens:i})}alignNodesV(t,i=this.store.data.pens,a=!1){const s=this.store.data.width||this.store.options.width,n=this.store.data.height||this.store.options.height;let r={x:0,y:0,width:s,height:n};const l=ht(i);if(a){const o=this.store.data.scale,u=this.getRect(i),c=(u.x-this.store.data.origin.x)/o,f=(u.y-this.store.data.origin.y)/o,g=u.width/o,v=u.height/o;let m=0,w=0;switch(t){case"left":m=-c;break;case"right":m=s-(c+g);break;case"top":w=-f;break;case"bottom":w=n-(f+v);break;case"center":m=s/2-(c+g/2);break;case"middle":w=n/2-(f+v/2);break}this.translatePens(i,m*o,w*o)}else for(const o of i)this.alignPen(t,o,r);this.initImageCanvas(i),this.initTemplateCanvas(i),this.render(),this.pushHistory({type:bt.Update,initPens:l,pens:i})}alignNodesByFirst(t,i=this.store.data.pens){const a=ht(i),s=i[0],n=this.getPenRect(s);for(let r=1;r<i.length;r++){const l=i[r];this.alignPen(t,l,n)}this.initImageCanvas(i),this.initTemplateCanvas(i),this.render(),this.pushHistory({type:bt.Update,initPens:a,pens:i})}alignNodesByLast(t,i=this.store.data.pens){const a=ht(i),s=i[i.length-1],n=this.getPenRect(s);for(let r=0;r<i.length-1;r++){const l=i[r];this.alignPen(t,l,n)}this.initImageCanvas(i),this.initTemplateCanvas(i),this.render(),this.pushHistory({type:bt.Update,initPens:a,pens:i})}alignPen(t,i,a){const s=this.getPenRect(i);switch(t){case"left":s.x=a.x;break;case"right":s.x=a.x+a.width-s.width;break;case"top":s.y=a.y;break;case"bottom":s.y=a.y+a.height-s.height;break;case"center":s.x=a.x+a.width/2-s.width/2;break;case"middle":s.y=a.y+a.height/2-s.height/2;break}this.setValue({id:i.id,...s},{render:!1,doEvent:!1})}spaceBetweenByDirection(t,i=this.store.data.pens,a){if(!a){let u=1/0,c=-1/0,f=t==="width"?"x":"y";i.forEach(g=>{u=Math.min(u,g.calculative.worldRect[f]),c=Math.max(c,g.calculative.worldRect["e"+f])}),a=(c-u)/this.store.data.scale}if(i=i.filter(u=>!u.parentId),i.length<=2)return;const s=ht(i),n=i.reduce((u,c)=>{const f=this.getPenRect(c);return u+f[t]},0),r=(a-n)/(i.length-1);i=i.sort((u,c)=>t==="width"?u.x-c.x:u.y-c.y);const l=this.getPenRect(i[0]);let o=t==="width"?l.x:l.y;for(const u of i){const c=this.getPenRect(u);t==="width"?c.x=o:c.y=o,o+=c[t]+r,this.setValue({id:u.id,...c},{render:!1,doEvent:!1})}this.initImageCanvas(i),this.initTemplateCanvas(i),this.render(),this.pushHistory({type:bt.Update,initPens:s,pens:i})}spaceBetween(t,i){this.spaceBetweenByDirection("width",t,i)}spaceBetweenColumn(t,i){this.spaceBetweenByDirection("height",t,i)}layout(t=this.store.data.pens,i,a=30){const s=this.getPenRect(hi(t));!i&&(i=s.width),t=t.filter(u=>!u.type&&!u.parentId);const n=ht(t);let r=0;t.forEach(u=>{const c=this.getPenRect(u);c.height>r&&(r=c.height)});let l=s.x,o=s.y;t.forEach((u,c)=>{const f=this.getPenRect(u);if(f.x=l,f.y=o+r/2-f.height/2,this.setValue({id:u.id,...f},{render:!1,doEvent:!1}),c===t.length-1)return;const g=l+f.width-s.x,v=this.getPenRect(t[c+1]);Math.round(i-g)>=Math.round(v.width+a)?l+=f.width+a:(l=s.x,o+=r+a)}),this.initImageCanvas(t),this.initTemplateCanvas(t),this.render(),this.pushHistory({type:bt.Update,initPens:n,pens:t})}gotoView(t){const i=this.getViewCenter(),a=i.x-t.calculative.worldRect.x-t.calculative.worldRect.width/2,s=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,s-this.store.data.y),this.store.data.x=a,this.store.data.y=s;for(const n of this.store.data.pens)Yi(n);this.canvas.canvasImage.init(),this.canvas.canvasImageBottom.init(),this.render()}showMap(){this.map||(this.map=new xE(this.canvas)),this.map.show()}hideMap(){this.map.hide()}onSizeUpdate(){this.mapTimer&&(clearTimeout(this.mapTimer),this.mapTimer=void 0),this.mapTimer=setTimeout(()=>{this.map&&this.map.isShow&&this.map.show(),this.canvas&&this.canvas.scroll&&this.canvas.scroll.isShow&&this.canvas.scroll.resize()},500)}toggleAnchorMode(){this.canvas.toggleAnchorMode()}addAnchorHand(){this.canvas.addAnchorHand()}removeAnchorHand(){this.canvas.removeAnchorHand()}toggleAnchorHand(){this.canvas.toggleAnchorHand()}top(t){t||(t=this.store.active),Array.isArray(t)||(t=[t]);for(const i of t){const a=this.store.data.pens,s=[...Qe(i,this.store),i].map(r=>r.id);a.filter(r=>s.includes(r.id)).forEach(r=>{const l=a.findIndex(o=>o.id===r.id);l>-1&&(a.push(a[l]),a.splice(l,1),this.initTemplateCanvas([r]),this.initImageCanvas([r])),this.specificLayerMove(r,"top")})}this.store.emitter.emit("layer",{type:"top",pens:t})}initImageCanvas(t){this.canvas&&this.canvas.initImageCanvas(t)}initTemplateCanvas(t){this.canvas&&this.canvas.initTemplateCanvas(t)}bottom(t){t||(t=this.store.active),Array.isArray(t)||(t=[t]);for(const i of t){const a=this.store.data.pens,s=[...Qe(i,this.store),i].map(r=>r.id),n=a.filter(r=>s.includes(r.id));for(let r=n.length-1;r>=0;r--){const l=n[r],o=a.findIndex(u=>u.id===l.id);o>-1&&(a.unshift(a[o]),a.splice(o+1,1),this.initTemplateCanvas([l]),this.initImageCanvas([l])),this.specificLayerMove(l,"bottom")}}this.store.emitter.emit("layer",{type:"bottom",pens:t})}upByArea(t){if(this.store.data.pens.findIndex(o=>o.id===t.id)===-1){console.warn("upByArea: pen not in canvas");return}const a=[t,...Qe(t,this.store)];let s=a.map(o=>this.store.data.pens.findIndex(u=>u.id===o.id));s.includes(-1)&&(console.warn("upByArea: pen children not in canvas"),s=s.filter(o=>o!==-1));const n=Math.min(...s),r=t.calculative.worldRect,l=this.store.data.pens.findIndex((o,u)=>{if(u<=n||o.id===t.id||Gx(o,t))return!1;const c=o.calculative.worldRect;return Xi(r,c)});if(l===-1){this.up(t);return}this.store.data.pens.splice(l+1,0,...a);for(const o of a){const u=this.store.data.pens.findIndex(c=>c.id===o.id);u>-1&&this.store.data.pens.splice(u,1)}this.initImageCanvas([t])}specificLayerMove(t,i){var a;if(t.image&&t.name!=="gif"){let s=zt.CanvasImageBottom;i==="top"?s=zt.CanvasImage:(i==="up"||i==="down")&&(s=zt.CanvasMain),this.setValue({id:t.id,canvasLayer:s},{render:!1,doEvent:!1,history:!1})}else if(t.externElement||t.name==="gif"){let s=0;i==="top"?(t.calculative.canvas.maxZindex+=1,s=t.calculative.canvas.maxZindex):i==="up"?s=t.calculative.zIndex===void 0?6:t.calculative.zIndex+1:i==="down"&&(s=t.calculative.zIndex===void 0?3:t.calculative.zIndex-1,s<0&&(s=0)),this.setValue({id:t.id,zIndex:s},{render:!1,doEvent:!1,history:!1}),(a=t.calculative.singleton)!=null&&a.div&&Fe(t,t.calculative.singleton.div)}}up(t){t||(t=this.store.active),Array.isArray(t)||(t=[t]);for(const i of t){const a=this.store.data.pens;if(i.children&&i.children.length){const s=[...Qe(i,this.store),i],n=[];for(let o=0;o<a.length;o++){const u=a[o];s.findIndex(c=>c.id===u.id)!==-1&&(u.temIndex=o,n.push(u))}let r=-1,l=0;n.forEach(o=>{o.temIndex-=l,a.splice(o.temIndex,1),l+=1,r=o.temIndex,delete o.temIndex,this.specificLayerMove(o,"up")}),a.splice(r+1,0,...n),this.initTemplateCanvas(n),this.initImageCanvas(n)}else{const s=a.findIndex(n=>n.id===i.id);s>-1&&s!==a.length-1&&(a.splice(s+2,0,a[s]),a.splice(s,1),this.initTemplateCanvas([i]),this.initImageCanvas([i])),this.specificLayerMove(i,"up")}}this.store.emitter.emit("layer",{type:"up",pens:t})}down(t){t||(t=this.store.active),Array.isArray(t)||(t=[t]);for(const i of t){const a=this.store.data.pens;if(i.children&&i.children.length){const s=[...Qe(i,this.store),i],n=[];for(let o=0;o<a.length;o++){const u=a[o];s.findIndex(c=>c.id===u.id)!==-1&&(u.temIndex=o,n.push(u))}let r=-1,l=0;n.forEach((o,u)=>{o.temIndex-=l,a.splice(o.temIndex,1),l+=1,u===0&&(r=o.temIndex),delete o.temIndex,this.specificLayerMove(o,"down")}),a.splice(r-1,0,...n),this.initTemplateCanvas(n),this.initImageCanvas(n)}else{const s=a.findIndex(n=>n.id===i.id);s>-1&&s!==0&&(a.splice(s-1,0,a[s]),a.splice(s+1,1),this.initTemplateCanvas([i]),this.initImageCanvas([i])),this.specificLayerMove(i,"down")}}this.store.emitter.emit("layer",{type:"down",pens:t})}setLayer(t,i,a=this.store.data.pens){const s=a.findIndex(n=>n.id===t.id);s>-1&&(s>i?(a.splice(i,0,a[s]),a.splice(s+1,1)):s<i&&(a.splice(i,0,a[s]),a.splice(s,1)))}changePenId(t,i){this.canvas.changePenId(t,i)}getLines(t,i="all"){var s;if(t.type===$t.Line)return[];const a=[];return(s=t.connectedLines)==null||s.forEach(({lineId:n})=>{const r=this.store.pens[n];if(!r){console.warn(t,"node contain a error connectedLine");return}if(!a.find(l=>l.id===r.id))switch(i){case"all":a.push(r);break;case"in":Vt(r).connectTo===t.id&&a.push(r);break;case"out":le(r).connectTo===t.id&&a.push(r);break}}),a}nextNode(t){if(t.type===$t.Line){const i=this.store.pens[Vt(t).connectTo];return i?[i]:[]}else{const i=this.getLines(t,"out"),a=[];return i.forEach(s=>{const n=this.nextNode(s);for(const r of n)!a.find(o=>o.id===r.id)&&a.push(r)}),a}}previousNode(t){if(t.type===$t.Line){const i=this.store.pens[le(t).connectTo];return i?[i]:[]}else{const i=this.getLines(t,"in"),a=[];return i.forEach(s=>{const n=this.previousNode(s);for(const r of n)!a.find(o=>o.id===r.id)&&a.push(r)}),a}}getNext(t){var a;if(t.type===$t.Line){console.warn("\u975E\u8FDE\u7EBF\u8282\u70B9");return}const i=[];return(a=t.connectedLines)==null||a.forEach(({lineId:s,anchor:n})=>{var o,u;const r=(o=t.anchors)==null?void 0:o.filter(c=>c.id===n)[0],l=this.findOne(s);if(l.anchors[0].connectTo==t.id){const c=l.anchors[l.anchors.length-1].connectTo;if(c){const f=this.findOne(c),g=(u=f.connectedLines)==null?void 0:u.filter(m=>m.lineId===l.id)[0],v=f.anchors.filter(m=>m.id===g.anchor)[0];i.push({from:t,fromAnchor:r,line:l,to:f,toAnchor:v})}}}),i}addAnchor(t,i,a){if(!t)return;if(t.anchors||(t.anchors=[]),t.calculative.worldAnchors||(t.calculative.worldAnchors=[]),t.type===$t.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}let s=null,n=null;i.x<=1&&i.x>=0&&i.y<=1&&i.y>=0?(n={id:i.id||St(),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&&Gt(n,t.rotate,t.calculative.worldRect.center),s={id:n.id,penId:t.id,x:i.x,y:i.y}):(n={id:i.id||St(),penId:t.id,x:i.x,y:i.y},t.calculative.worldRect&&(t.rotate%360&&Gt(i,-t.rotate,t.calculative.worldRect.center),s={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===$t.Line?(t.calculative.worldAnchors.splice(a,0,n),t.anchors.splice(a,0,s),this.canvas.updateLines(t),this.canvas.initLineRect(t),this.render()):(t.calculative.worldAnchors.push(n),t.anchors.push(s))}connectLine(t,i,a,s,n=!0){if(!a){const u=i.calculative.worldRect;a=bs(t,{x:u.x+u.width/2,y:u.y+u.height/2})}if(!s){const u=t.calculative.worldRect;s=bs(i,{x:u.x+u.width/2,y:u.y+u.height/2})}const r=Math.abs(a.x-s.x),o={height:Math.abs(a.y-s.y),lineName:"line",lineWidth:1,name:"line",type:1,width:r,x:Math.min(a.x,s.x),y:Math.min(a.y,s.y),anchors:[{x:a.x>s.x?1:0,y:a.y>s.y?1:0,id:St()},{x:a.x>s.x?0:1,y:a.x>s.x?0:1,id:St()}]};return this.addPens([o]),we(t,a,o,o.calculative.worldAnchors[0]),we(i,s,o,o.calculative.worldAnchors[1]),o.calculative.active=!1,this.canvas.updateLines(o),this.canvas.updateLines(t),this.canvas.updateLines(i),this.canvas.initLineRect(o),n&&this.render(),o}toComponent(t=this.store.data.pens,i,a){if(t.length===1){const c=ht(t[0]);return c.type=$t.Node,c.id=void 0,[c]}const s=ht(t,!0),n=hi(s);let r={id:St(),name:"combine",...n,children:[],showChild:i};a&&(r.anchors=[{id:"0",penId:r.id,x:.5,y:0},{id:"1",penId:r.id,x:1,y:.5},{id:"2",penId:r.id,x:.5,y:1},{id:"3",penId:r.id,x:0,y:.5}]);const l=s.filter(c=>!c.parentId),o=s.find(c=>c.width===n.width&&c.height===n.height),u=o&&i===void 0;return l.length===1?r=l[0]:u&&(o.children||(o.children=[]),r=o),s.forEach(c=>{var g;if(c===r||c.parentId===r.id||c.parentId)return;r.children.push(c.id),c.parentId=r.id;const f=fa(c.calculative.worldRect,n);Object.assign(c,f),c.locked=(g=c.lockedOnCombine)!=null?g:Mt.DisableMove}),u||l.length===1?ht(s):ht([r,...s])}installPenPlugins(t,i){if(!t.tag&&!t.name&&!t.id)return;let a;t.id?a="id":t.tag?a="tag":t.name&&(a="name"),i.forEach(s=>{let n=s.plugin,r=s.options;if(!!n&&W2(n)&&a)if(n.install(t,r),!this.penPluginMap.has(n))this.penPluginMap.set(n,[{[a]:t[a],option:r}]);else{let l=this.penPluginMap.get(n).find(o=>o[a]===t[a]);l?l.option=r:this.penPluginMap.get(n).push({[a]:t[a],option:r})}})}uninstallPenPlugins(t,i){let a;t.id?a="id":t.tag?a="tag":t.name&&(a="name"),a&&i.forEach(s=>{let n=s.plugin;n.uninstall(t,s.options);let r=this.penPluginMap.get(n),l=r.findIndex(o=>o[a]===t[a]);l!==-1&&(r.splice(l,1),r.length===0&&this.penPluginMap.delete(n))})}setVisible(t,i,a=!0){if(this.onSizeUpdate(),this.setValue({id:t.id,visible:i},{render:!1,doEvent:!1}),t.children)for(const n of t.children){const r=this.store.pens[n];r&&this.setVisible(r,i,!1)}let s=Qe(t,this.store);s.push(t),this.initImageCanvas(s),a&&this.render()}clearHover(){this.canvas.clearHover()}closeSocket(){this.closeWebsocket(),this.closeMqtt(),this.closeHttp()}destroy(t){if(this.clear(!1),this.stopDataMock(),this.closeSocket(),this.closeNetwork(),this.closeAll(),Qs.destroyThemeSheet(this.store.id),this.store.emitter.all.clear(),this.canvas.destroy(),this.canvas=void 0,Et[this.store.id]=void 0,!t){for(const i in Et)delete Et[i];Et.path2dDraws={},Et.canvasDraws={},Et.anchors={},Et.htmlElements={}}}}function PE(e,t){const i=t||new Path2D,{x:a,y:s,width:n,ey:r}=e.calculative.worldRect,l=n/4;if(i.moveTo(a+l,s),i.lineTo(a,s),i.lineTo(a,r),i.lineTo(a+l,r),i instanceof Path2D)return i}function SE(e){const t=[{x:.25,y:0},{x:.25,y:1},{x:0,y:.5}];e.anchors=t.map(({x:i,y:a},s)=>({id:s+"",x:i,y:a,penId:e.id}))}function IE(e,t){const i=t||new Path2D,{x:a,y:s,width:n,ex:r,ey:l}=e.calculative.worldRect,o=e.offsetX;let u=n/7;if(o>1?u=o:o>0&&(u=n*o),i.moveTo(a+u,s),i.lineTo(r,s),i.lineTo(a+n-u,l),i.lineTo(a,l),i.closePath(),i instanceof Path2D)return i}function BE(e){const t=[{x:.5,y:0},{x:.9285714285714286,y:.5},{x:.5,y:1},{x:.07142857142857142,y:.5}];e.anchors=t.map(({x:i,y:a},s)=>({id:`${s}`,penId:e.id,x:i,y:a}))}function DE(e,t){const i=t||new Path2D,{x:a,y:s,width:n,height:r,ex:l,ey:o}=e.calculative.worldRect,u=n/8;if(i.moveTo(a+u,s),i.lineTo(l-u,s),i.bezierCurveTo(l+u/3,s,l+u/3,o,l-u,o),i.lineTo(a+u,o),i.lineTo(a,s+r/2),i.closePath(),i instanceof Path2D)return i}function LE(e,t){const i=t||new Path2D,{x:a,y:s,width:n,height:r,ex:l,center:o}=e.calculative.worldRect,u=o.x,c=s+r*6/7,f=r/6;if(i.moveTo(a,s),i.lineTo(l,s),i.lineTo(l,c),i.bezierCurveTo(l-20,c-f,u+n/5,c-f,u,c),i.bezierCurveTo(u-n/5,c+f,a,c+f,a,c),i.closePath(),i instanceof Path2D)return i}function ME(e){const t=[{x:.5,y:0},{x:1,y:.5},{x:.5,y:.8571428571428571},{x:0,y:.5}];e.anchors=t.map(({x:i,y:a},s)=>({id:`${s}`,penId:e.id,x:i,y:a}))}function OE(e,t){const i=t||new Path2D,{x:a,y:s,width:n,ex:r,ey:l}=e.calculative.worldRect,o=n/10;if(i.moveTo(a+o*2,s),i.bezierCurveTo(a-o*2/3,s,a-o*2/3,l,a+o*2,l),i.lineTo(r,l),i.bezierCurveTo(r-o,l,r-o,s,r,s),i.closePath(),i instanceof Path2D)return i}function NE(e,t){const i=t||new Path2D,{x:a,y:s,width:n,ex:r,ey:l}=e.calculative.worldRect;i.moveTo(a,s),i.lineTo(r,s),i.lineTo(r,l),i.lineTo(a,l),i.closePath();const o=n/7;if(i.moveTo(a,s+o),i.lineTo(r,s+o),i.moveTo(a+o,s),i.lineTo(a+o,l),i instanceof Path2D)return i}function zE(e,t){const i=t||new Path2D,{x:a,y:s,height:n,ex:r,ey:l}=e.calculative.worldRect,o=n/4;if(i.moveTo(a,s+o),i.lineTo(r,s),i.lineTo(r,l),i.lineTo(a,l),i.closePath(),i instanceof Path2D)return i}function HE(e){const t=[{x:.5,y:.125},{x:1,y:.5},{x:.5,y:1},{x:0,y:.5}];e.anchors=t.map(({x:i,y:a},s)=>({id:`${s}`,penId:e.id,x:i,y:a}))}function WE(e,t){const i=t||new Path2D,{x:a,y:s,ex:n,ey:r}=e.calculative.worldRect;if(i.moveTo(a,s),i.lineTo(n,s),i.moveTo(a,r),i.lineTo(n,r),i instanceof Path2D)return i}function UE(e){const t=[{x:.5,y:0},{x:.5,y:1}];e.anchors=t.map(({x:i,y:a},s)=>({id:s+"",x:i,y:a,penId:e.id}))}function VE(e,t){const i=t||new Path2D,{x:a,y:s,width:n,height:r,ex:l,ey:o}=e.calculative.worldRect;if(i.ellipse(a+n/2,s+r/2,n/2,r/2,0,0,Math.PI*2),i.moveTo(a+n/2,o),i.lineTo(l,o),i.closePath(),i instanceof Path2D)return i}function $E(e,t){const i=t||new Path2D,{x:a,y:s,width:n,ex:r,ey:l}=e.calculative.worldRect,o=n/7;if(i.moveTo(a,s),i.lineTo(r,s),i.lineTo(r,l),i.lineTo(a,l),i.closePath(),i.moveTo(a+o,s),i.lineTo(a+o,l),i.moveTo(r-o,s),i.lineTo(r-o,l),i instanceof Path2D)return i}function jE(e,t){const i=t||new Path2D,{x:a,y:s,height:n,ex:r,ey:l}=e.calculative.worldRect,o=n/7;if(i.moveTo(a,s+o),i.bezierCurveTo(a,s-o/2|0,r,s-o/2|0,r,s+o),i.lineTo(r,l-o),i.bezierCurveTo(r,l+o/2|0,a,l+o/2|0,a,l-o),i.closePath(),i.moveTo(a,l-o),i.bezierCurveTo(a,l-o*2|0,r,l-o*2|0,r,l-o),i instanceof Path2D)return i}function v5(){return{flowComment:PE,flowData:IE,flowDb:jE,flowDisplay:DE,flowDocument:LE,flowExternStorage:OE,flowInternalStorage:NE,flowManually:zE,flowParallel:WE,flowQueue:VE,flowSubprocess:$E}}function m5(){return{flowDocument:ME,flowManually:HE,flowParallel:UE,flowComment:SE,flowData:BE}}var Xr;(function(e){e[e.Add=0]="Add",e[e.Replace=1]="Replace",e[e.ReplaceAll=2]="ReplaceAll"})(Xr||(Xr={}));function kg(e,t){const i=t.calculative.worldRect.height*14/16,s=(e.match(/[\u4e00-\u9fa5]/g)||"").length;return(e.length-s)*i*.6+s*i}function Cg(e){if(e.direction=="horizontal"){const t=[];let i=0;const a=e.height;e.checkboxHeight=a,e.options.forEach((n,r)=>{t.push(r*(40+a)+i),i+=kg(n.text,e)}),e.optionPos=t;const s=t.length*(40+a)+i;e.checkboxWidth=s,e.width=s,e.calculative.width=s,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}},re(e.calculative.worldRect)}else if(e.direction=="vertical"){e.optionInterval==null&&(e.optionInterval=20),e.optionHeight||(e.optionHeight=20);const t=[];e.options.forEach((a,s)=>{t.push(s*(e.optionInterval+e.optionHeight))}),e.optionPos=t;const i=t[t.length-1]+e.optionHeight;e.checkboxHeight=i,e.width||(e.height=i,e.calculative.height=i,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}},re(e.calculative.worldRect))}}function $f(e,t){t.onAdd||(t.onAdd=Fg,(!t.rowPos||!t.colPos||!t.calculative.maxOffsetY)&&t.onAdd(t),t.onMouseMove=JE,t.onMouseLeave=QE,t.onMouseDown=tA,t.onShowInput=GE,t.onInput=ZE,t.onValue=aA,t.onBeforeValue=sA,t.onMouseEnter=cA,t.onWheel=nA,t.onDestroy=oA),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));const i=t.calculative.canvas.store;if(t.calculative.canvas.store.data,t.calculative.canvas.store.options,t.color=t.color||i.styles.color,t.textColor=t.textColor||t.color||i.styles.textColor,t.activeColor=t.activeColor||i.styles.activeColor,t.hoverColor=t.hoverColor||i.styles.hoverColor,t.activeBackground=t.activeBackground||i.styles.activeBackground,t.hoverBackground=t.hoverBackground||i.styles.hoverBackground,!t.hasHeader){e.save(),e.beginPath();const{x:a,y:s,width:n,height:r}=t.calculative.worldRect;e.fillStyle="#fff0",e.rect(a-1,s-1,n+2,r+2),e.fill(),e.clip()}KE(e,t),XE(e,t),qE(e,t),e.restore(),t.isFirstTime=!1}function qE(e,t){if(!t.calculative.hover||!t.calculative.hoverCell||t.calculative.isInput||!t.calculative.isHover)return;let 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}const{row:s,col:n}=t.calculative.hoverCell,{x:r,y:l}=t.calculative.canvas.mousePos;if(!t.data[s])return;let o=t.data[s][n];if(typeof o=="object"||!o)return;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;const u=e.measureText(o).width;e.beginPath(),e.fillStyle="#fff",e.strokeStyle="#000",e.moveTo(r,l),e.rect(r-10,l,u+20,20),e.fill(),e.stroke(),e.beginPath(),e.fillStyle="#000",e.fillText(o,r,l+10),e.restore()}function YE(e){const t=[],i=[],a={};e.rowHeight||(e.rowHeight=40),e.colWidth||(e.colWidth=150);let s=0;const n=e.styles&&e.styles.filter(v=>v.col!==void 0&&v.row===void 0&&v.width);let r={};n&&n.forEach(v=>{r[v.col]=v.width});for(let v=0;v<e.data[0].length;v++){s+=(r[v]||e.colWidth)*e.calculative.canvas.store.data.scale,t.push(s);let m=e.styles&&e.styles.filter(w=>w.col===v&&w.row===void 0);m&&(a[v]=m[0])}let l=0;const o=e.styles&&e.styles.filter(v=>v.col===void 0&&v.row!==void 0&&v.height);let u={};o&&o.forEach(v=>{u[v.row]=v.height});let c=l;for(let v=0;v<e.data.length;v++)l+=(u[v]||e.rowHeight)*e.calculative.canvas.store.data.scale,i.push(l),v<e.maxNum&&(c=l);if(e.calculative.maxOffsetY=(l-c)/e.calculative.canvas.store.data.scale,e.initWorldRect)return;e.colPos=t,e.rowPos=i,e.colStyle=a,e.initScale=e.calculative.canvas.store.data.scale,e.tableWidth=s,e.tableHeight=c||l,e.calculative.width=s,e.calculative.height=c||l,e.calculative.width=s,e.calculative.height=c||l,e.height||(e.height=e.calculative.height),e.width||(e.width=e.calculative.width);let f=e.x,g=e.y;if(e.parentId){let v=e.calculative.canvas.store.pens[e.parentId];f=v.calculative.worldRect.x+v.calculative.worldRect.width*e.x,g=v.calculative.worldRect.y+v.calculative.worldRect.height*e.y}e.calculative.worldRect={x:f,y:g,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}),re(e.calculative.worldRect)}function KE(e,t){if(!t.colPos)return;const{x:i,y:a,width:s,height:n,ex:r,ey:l}=t.calculative.worldRect;e.save(),e.beginPath(),e.strokeStyle=t.color;let o=t.calculative.borderRadius||0,u=o;o<1&&(o=s*o,u=n*u);let c=o<u?o:u;if(s<2*c&&(c=s/2),n<2*c&&(c=n/2),e.moveTo(i+c,a),e.arcTo(r,a,r,l,c),e.arcTo(r,l,i,l,c),e.arcTo(i,l,i,a,c),e.arcTo(i,a,r,a,c),t.background&&(e.fillStyle=t.background,e.fill()),t.bordered!==!1&&(e.strokeStyle=t.borderColor||t.color||"#424B61",e.stroke()),t.hLine!==!1){let f=t.rowPos[t.rowPos.length-1];t.hasHeader&&(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||t.color||"#424B61",e.stroke());for(const g of t.rowPos){if(g===f)continue;const v=g*t.calculative.worldRect.height/t.tableHeight-t.offsetY*t.calculative.canvas.store.data.scale;if(t.hasHeader){if(v<0+t.rowPos[0]||v>t.calculative.worldRect.height)continue}else if(v<0||v>t.calculative.worldRect.height)continue;e.beginPath(),e.moveTo(t.calculative.worldRect.x,t.calculative.worldRect.y+v),e.lineTo(t.calculative.worldRect.ex,t.calculative.worldRect.y+v),e.strokeStyle=t.borderColor||t.color||"#424B61",e.stroke()}}if(t.vLine!==!1){let f=t.colPos[t.colPos.length-1];t.colPos.forEach((g,v)=>{if(g===f)return;const m=g*t.calculative.worldRect.width/t.tableWidth;e.beginPath(),e.moveTo(t.calculative.worldRect.x+m,t.calculative.worldRect.y),e.lineTo(t.calculative.worldRect.x+m,t.calculative.worldRect.ey),e.strokeStyle=t.borderColor||t.color||"#424B61",e.stroke()})}e.restore()}function XE(e,t){var a,s,n,r,l;if(!t.colPos)return;t.calculative.texts||(t.calculative.texts=[]);const i=1;for(let o=0;o<t.rowPos.length;o++){if(t.hasHeader&&o===1){e.save(),e.beginPath();const{x:c,y:f,width:g,height:v}=t.calculative.worldRect;e.fillStyle="#fff0",e.rect(c-1,f+t.rowPos[0]*t.calculative.worldRect.height/t.tableHeight-1,g+2,v-t.rowPos[0]*t.calculative.worldRect.height/t.tableHeight+2),e.fill(),e.clip()}let{style:u}=eA(t,o);for(let c=0;c<t.colPos.length;c++){let{value:f,style:g}=Tg(t,o,c),v=!0;if(Array.isArray(g)&&g.length>0){let B=0;g.forEach((V,Q)=>{V.wheres&&V.wheres.every(R=>new Function("attr",`return attr ${R.comparison} ${R.value}`)(f))&&(B=Q)}),g=g[B]}else g.wheres&&Array.isArray(g.wheres)&&(v=!1,v=g.wheres.every(function(B){return new Function("attr",`return attr ${B.comparison} ${B.value}`)(f)}));let m=t.color,w=t.textColor||t.color,y=null,_=null,A=null,x=null;v&&(m=g.color||u.color||t.color,w=g.textColor||u.textColor||t.textColor,y=g.background||u.background,_=(g.fontSize||u.fontSize||0)*t.calculative.canvas.store.data.scale,A=g.fontWeight||u.fontWeight,x=g.fontStyle||u.fontStyle);let C;t.stripe&&(t.hasHeader!==!1?o%2===1&&(y=y||t.stripeColor||"#407FFF1F"):o%2===0&&(y=y||t.stripeColor||"#407FFF1F")),t.calculative.active&&((a=t.calculative.activeCell)==null?void 0:a.row)===o&&((s=t.calculative.activeCell)==null?void 0:s.col)===c&&(m=t.activeColor,y=t.activeBackground,C=m,w=t.activeTextColor||t.activeColor),t.calculative.hover&&((n=t.calculative.hoverCell)==null?void 0:n.row)===o&&((r=t.calculative.hoverCell)==null?void 0:r.col)===c&&(m=t.hoverColor,y=t.hoverBackground,w=t.hoverTextColor||t.hoverColor,C=m);const T=Sg(t,o,c);if(T.y+T.height<t.calculative.worldRect.y||T.y>t.calculative.worldRect.height+t.calculative.worldRect.y)continue;y&&(e.save(),e.beginPath(),e.fillStyle=y,e.fillRect(T.x,T.y,T.width+.25*t.calculative.canvas.store.data.scale,T.height),e.restore()),C&&(e.save(),e.beginPath(),e.strokeStyle=C,e.strokeRect(T.x,T.y,T.width,T.height),e.restore()),t.calculative.worldTextRect=T;let I=t.calculative.texts[o];if(t.calculative.texts[o]||(I=[],t.calculative.texts.push(I)),I[c]==null){if(typeof f=="object"){const B=t.styles&&t.styles.filter(V=>V.col===c&&V.row===void 0&&V.pens);if(B.length>0){if(I[c]="",t.isFirstTime){t.maxNum&&t.hasHeader&&o>=t.maxNum&&(f.visible=!1);let V=JSON.parse(JSON.stringify(B[0].pens));V.forEach(Q=>{Object.assign(Q,{row:o,col:c},f),Q.activeBackground=Q.background,Q.hoverBackground=Q.background,Q.activeColor=Q.color,Q.hoverColor=Q.color,Q.activeTextColor=Q.textColor,Q.hoverTextColor=Q.textColor,Q.height*=t.calculative.canvas.store.data.scale,Q.width*=t.calculative.canvas.store.data.scale}),iA(t,T,V),t.calculative.canvas.parent.pushChildren(t,V)}continue}}else f===void 0?I[c]="":I[c]=f.text||f+"";if(!I[c])continue;I[c]=_n(t,I[c])}if(!I[c])continue;e.save(),e.beginPath(),e.fillStyle=w,e.textAlign="center",e.textBaseline="middle",e.font=(x||t.calculative.fontStyle||"")+" normal "+(A||t.calculative.fontWeight||"")+" "+(_||t.calculative.fontSize||12)*i+"px "+t.calculative.fontFamily;let D=t.colStyle&&((l=t.colStyle[c])==null?void 0:l.textAlign);if(D&&(e.textAlign=D),I[c].length===1)D==="left"?e.fillText(I[c][0],T.x,T.y+T.height/2):D==="right"?e.fillText(I[c][0],T.x+T.width,T.y+T.height/2):e.fillText(I[c][0],T.x+T.width/2,T.y+T.height/2);else{const V=(_||t.calculative.fontSize)*t.calculative.lineHeight*i,Q=I[c].length*V;let F=(T.height-Q)/2;D==="left"?I[c].forEach((R,P)=>{e.fillText(R,T.x,T.y+F+(P+.55)*V)}):D==="right"?I[c].forEach((R,P)=>{e.fillText(R,T.x+T.width,T.y+F+(P+.55)*V)}):I[c].forEach((R,P)=>{e.fillText(R,T.x+T.width/2,T.y+F+(P+.55)*V)})}e.restore()}}}function Fg(e){var t;Ac(e),(t=e.children)!=null&&t.length||(e.isFirstTime=!0),e.offsetY||(e.offsetY=0),YE(e)}function GE(e,t){if(!e.calculative.hoverCell)return;const{value:i}=Tg(e,e.calculative.hoverCell.row,e.calculative.hoverCell.col);if(typeof i=="object")return;e.calculative.isHover=!1,e.calculative.isInput=!0,e.calculative.canvas.render(),e.calculative.inputCell=e.calculative.hoverCell;const a=Sg(e,e.calculative.hoverCell.row,e.calculative.hoverCell.col);e.calculative.tempText=i.text||i+"",e.calculative.canvas.showInput(e,a,"#ffffff")}function ZE(e,t){!e.calculative.inputCell||(Pg(e,e.calculative.inputCell.row,e.calculative.inputCell.col,t),e.calculative.isInput=!1,e.calculative.isHover=!0,e.calculative.canvas.render())}function JE(e,t){e.timer&&(e.calculative.isHover=!1,clearTimeout(e.timer)),e.timer=setTimeout(()=>{e.calculative.isHover=!0,e.calculative.canvas.render()},500),e.calculative.hoverCell=Rg(e,t),e.calculative.canvas.render()}function QE(e,t){Ac(e),e.calculative.hoverCell=void 0,e.calculative.canvas.render()}function tA(e,t){e.calculative.activeCell=Rg(e,t),e.calculative.canvas.render()}function Rg(e,t){const i=e.calculative.worldRect.width/e.tableWidth,a=e.calculative.worldRect.height/e.tableHeight,s={row:0,col:0};for(let n=0;n<e.colPos.length;n++)t.x>e.calculative.worldRect.x+e.colPos[n]*i&&(s.col=n+1);for(let n=0;n<e.rowPos.length;n++)t.y>e.calculative.worldRect.y+e.rowPos[n]*a-e.offsetY*e.calculative.canvas.store.data.scale&&(s.row=n+1);return s}function Tg(e,t,i){if(!e.data||!Array.isArray(e.data))return;const a=e.data[t],s=e.styles&&e.styles.filter(n=>n.row===t&&n.col===i);if(Array.isArray(a))return{value:a[i],style:(s==null?void 0:s.length)>0?s.length>1?s:s[0]:{}};if(!a.data||!Array.isArray(a.data))return}function eA(e,t){if(!e.data||!Array.isArray(e.data))return;const i=e.data[t],a=e.styles&&e.styles.filter(s=>s.row===t&&s.col===void 0);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 Pg(e,t,i,a){if(!e.data||!Array.isArray(e.data))return;e.isFirstTime=!1,e.calculative.texts=void 0;let s=e.data[t];!s||(s[i]instanceof Object||(s[i]=a),e.calculative.canvas.store.emitter.emit("valueUpdate",e))}function Sg(e,t,i){const a=e.calculative.worldRect.width/e.tableWidth,s=e.calculative.worldRect.height/e.tableHeight;let n=0,r=e.colPos[i]*a;i>0&&(n=e.colPos[i-1]*a);let l=0,o=e.rowPos[t]*s;t>0&&(l=e.rowPos[t-1]*s);let u=e.offsetY*e.calculative.canvas.store.data.scale;return t===0&&e.hasHeader&&(u=0),{x:e.calculative.worldRect.x+n,y:e.calculative.worldRect.y+l-u,ex:e.calculative.worldRect.x+r,ey:e.calculative.worldRect.y+o-u,width:r-n,height:o-l}}function iA(e,t,i){if(!(i&&i.length))return;const a=e.calculative.worldRect.width/e.tableWidth,s=e.calculative.worldRect.height/e.tableHeight;let n=1,r=1;e.initWorldRect&&(e.calculative.worldRect.width!==e.initWorldRect.width&&(n=e.calculative.worldRect.width/e.initWorldRect.width),e.calculative.worldRect.height!==e.initWorldRect.height&&(r=e.calculative.worldRect.height/e.initWorldRect.height));let l=0,o=0,u=0;const c=e.calculative.canvas.store.data.scale;if(i.length>1){for(const f of i)o+f.width*a+20*c*a<t.width?(f.x=t.x+o+10*c*a,f.y=t.y+u+10*c*s,o+=(f.width+10*c)*a,l=Math.max(l,u+(f.height+10*c)*s)):(o=0,u=l,f.x=t.x+o+10*c*a,f.y=t.y+u+10*c*s,l+=(f.height+10*c)*s);if(l+20*c*s<t.height){const f=(t.height-l-10*c*s)/2;for(const g of i)g.y+=f}}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(f=>{f.width=f.width*n,f.height=f.height*r})}function aA(e){if(e.calculative.isUpdateData){delete e.calculative.isUpdateData;let t=ht(e.children);e.children=[],Fg(e),t&&t.forEach(i=>{e.calculative.canvas.delForce(e.calculative.canvas.findOne(i))}),e.calculative.texts=void 0}}function sA(e,t){if(e.calculative.isUpdateData=!1,e.swiper!==void 0&&(e.swiper?Ac(e):Ec(e)),t.styles&&(e.initWorldRect=void 0),t.table||t.col==null&&t.row==null){if(t.dataY){const a=e.replaceMode;let s=[];return a?a===Xr.Replace?(s=e.data,t.dataX&&t.dataX.forEach((n,r)=>{s[n]=t.dataY[r]})):a===Xr.ReplaceAll&&(t.dataX?s[0]=t.dataX:s[0]=e.data[0],s=s.concat(t.dataY)):s=e.data.concat(t.dataY),delete t.dataX,delete t.dataY,e.calculative.isUpdateData=!0,Object.assign(t,{data:s})}(t.data||t.styles||t.maxNum||t.rowHeight||t.colWidth)&&(e.calculative.isUpdateData=!0,e.initWorldRect=null);for(let a of Object.keys(t))a.includes("data.")&&(e.calculative.isUpdateData=!0);return t}let i=e.data[t.row];return i&&(i[t.col]instanceof Object||(i[t.col]=t.value),Pg(e,t.row,t.col,t.value),e.calculative.canvas.render(),delete t.col,delete t.row),t}function nA(e,t){if(!e.locked&&!e.calculative.canvas.store.data.locked||!e.maxNum)return;let i=0;t.deltaY>0?i=4:i=-4,sc(e,i)}function sc(e,t){var i;e.offsetY||(e.offsetY=0),e.offsetY+=t,e.offsetY>e.calculative.maxOffsetY&&(e.offsetY=e.calculative.maxOffsetY),e.offsetY<0&&(e.offsetY=0),(i=e.children)==null||i.forEach(a=>{const s=e.calculative.canvas.store.pens[a];rA(e,s)}),e.calculative.canvas.render()}function rA(e,t){if(!t)return;t.oldY||(t.oldY=t.y),t.calculative.worldRect,e.calculative.worldRect;const i=e.calculative.canvas.store.data.scale;e.calculative.worldRect.height/e.tableHeight;const a=e.rowHeight;t.y=t.oldY-e.offsetY*i/e.calculative.worldRect.height;const s=a*(e.initScale||1)/e.tableHeight*e.maxNum;if(e.calculative.canvas.updatePenRect(t),e.hasHeader)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+=s;let n=t.row+e.maxNum;if(!e.data[n])return;let r=ht(e.data[n][t.col]);r.background&&(r.activeBackground=r.background,r.hoverBackground=r.background),r.color&&(r.hoverColor=r.color,r.activeColor=r.color),r.textColor&&(r.activeTextColor=r.textColor,r.hoverTextColor=r.textColor),Object.assign(t,r,{row:n}),Object.assign(t.calculative,r,{row:n})}}else if(t.y+t.height>1){if(t.calculative.visible=!1,t.visible=!1,t.y+t.height/2>1){t.oldY-=s;let n=t.row-e.maxNum;if(!e.data[n])return;let r=ht(e.data[n][t.col]);r.background&&(r.activeBackground=r.background,r.hoverBackground=r.background),r.color&&(r.hoverColor=r.color,r.activeColor=r.color),r.textColor&&(r.activeTextColor=r.textColor,r.hoverTextColor=r.textColor),Object.assign(t,r,{row:n}),Object.assign(t.calculative,r,{row:n})}}else t.visible=!0,t.calculative.visible=!0;else if(t.y<0){if(t.calculative.visible=!1,t.visible=!1,t.y<-a/e.tableHeight/2){t.oldY+=s;let n=t.row+e.maxNum;if(!e.data[n])return;let r=ht(e.data[n][t.col]);r.background&&(r.activeBackground=r.background,r.hoverBackground=r.background),r.color&&(r.hoverColor=r.color,r.activeColor=r.color),r.textColor&&(r.activeTextColor=r.textColor,r.hoverTextColor=r.textColor),Object.assign(t,r,{row:n}),Object.assign(t.calculative,r,{row:n})}}else if(t.y+t.height>1){if(t.calculative.visible=!1,t.visible=!1,t.y+t.height/2>1){t.oldY-=s;let n=t.row-e.maxNum;if(!e.data[n])return;let r=ht(e.data[n][t.col]);r.background&&(r.activeBackground=r.background,r.hoverBackground=r.background),r.color&&(r.hoverColor=r.color,r.activeColor=r.color),r.textColor&&(r.activeTextColor=r.textColor,r.hoverTextColor=r.textColor),Object.assign(t,r,{row:n}),Object.assign(t.calculative,r,{row:n})}}else t.calculative.visible=!0,t.visible=!0}function oA(e){Ec(e)}function Ec(e){e.interval&&(globalThis.clearInterval(e.interval),e.interval=null)}function Ac(e){if(e.maxNum&&e.swiper){if(e.interval)return;e.interval=globalThis.setInterval(()=>{e.offsetY>=e.calculative.maxOffsetY?(e.offsetY=0,lA(e)):e.offsetY%e.rowHeight?sc(e,1):(e.calculative.stap||(e.calculative.stap=0),e.calculative.stap+=1,e.calculative.stap==12&&(e.calculative.stap=0,sc(e,1)))},50)}}function lA(e){var t;(t=e.children)==null||t.forEach(i=>{const a=e.rowHeight,s=e.calculative.canvas.store.pens[i];if(!s)return;const n=a*(e.initScale||1)/e.tableHeight*e.maxNum;s.oldY-=n;const r=s.row-e.maxNum;if(!e.data[r])return;let l=ht(e.data[r][s.col]);l.background&&(l.activeBackground=l.background,l.hoverBackground=l.background),l.color&&(l.hoverColor=l.color,l.activeColor=l.color),l.textColor&&(l.activeTextColor=l.textColor,l.hoverTextColor=l.textColor),s.calculative.visible=!0,s.visible=!0,Object.assign(s,l,{row:r}),Object.assign(s.calculative,l,{row:r})}),e.calculative.canvas.render()}function cA(e){Ec(e)}function hA(e,t){t.onClick||(t.onClick=uA,t.setTheme=fA);let i=t.calculative.worldRect.x,a=t.calculative.worldRect.y,s=t.calculative.worldRect.width,n=t.calculative.worldRect.height;s<n*1.5&&(s=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+s-n/2,a),e.arc(i+s-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||ke(.6,t.onColor)),t.lineWidth&&(e.strokeStyle=t.onStrokeColor,e.stroke()),e.fill(),e.closePath(),e.beginPath(),e.fillStyle="#ffffff",e.moveTo(i+n*2,a+n/2),e.arc(i+s-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||ke(.6,t.offColor)),t.lineWidth&&(e.strokeStyle=t.offStrokeColor,e.stroke()),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 uA(e){e.disableDefaultClick||e.disabled||e.disable||(e.checked=!e.checked,e.calculative.canvas.store.emitter.emit("valueUpdate",e),e.calculative.canvas.render())}function fA(e,t){for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){const a=t[i];e.hasOwnProperty(i)&&(e[i]=a),e.calculative.hasOwnProperty(i)&&(e.calculative[i]=a)}e.onStrokeColor=t.borderColor,e.offStrokeColor=t.borderColor}function dA(e,t){t.onAdd||(t.onAdd=an,t.onResize=an,t.onMove=an,t.onMouseMove=gA,t.onMouseDown=Ig,t.onValue=vA,t.onBeforeValue=mA,t.setTheme=yA),t.calculative.barRect||an(t);const i=t.calculative.canvas.store;t.calculative.canvas.store.options;let a=t.background;t.disabled&&(a=t.disabledBackground||ke(.6,a)),e.fillStyle=a,e.beginPath();let s=t.calculative.worldRect.x+t.calculative.barRect.x,n=t.calculative.worldRect.y+t.calculative.barRect.y,r=t.calculative.barRect.width,l=t.calculative.barRect.height,o=l/2;e.moveTo(s+o,n),e.arcTo(s+r,n,s+r,n+l,o),e.arcTo(s+r,n+l,s,n+l,o),e.arcTo(s,n+l,t.x,t.y,o),e.arcTo(s,n,s+r,n,o),e.fill();let u=t.activeColor||i.styles.activeColor;t.disabled&&(u=t.disabledColor||ke(.6,u)),e.fillStyle=u,e.beginPath(),r=t.calculative.ballRect.x,e.moveTo(s+o,n),e.arcTo(s+r,n,s+r,n+l,o),e.arcTo(s+r,n+l,s,n+l,o),e.arcTo(s,n+l,t.x,t.y,o),e.arcTo(s,n,s+r,n,o),e.fill(),e.fillStyle=t.btnBackground||"#fff",e.strokeStyle=u,e.lineWidth=2,e.beginPath(),s=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(s,n,t.calculative.ballRect.width/2,0,Math.PI*2),e.fill(),e.stroke()}function an(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)return;const t=e.calculative.worldRect.width/e.sliderWidth,i=e.calculative.worldRect.height/e.sliderHeight,a=Math.min(t,i);e.fontSize=e._fontSize*a;const s=e.calculative.worldRect.width-e._textWidth*a;e.textLeft=s+10*a,e.calculative.textLeft=e.textLeft,e.calculative.barRect={x:0,y:(e.calculative.worldRect.height-e.barHeight*i)/2,width:s,height:e.barHeight*i},re(e.calculative.barRect),kc(e)}function kc(e){const 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},re(e.calculative.ballRect),e.calculative.text=e.value+e.unit,Fi(e)}function Ig(e,t){if(e.disabled)return;const i=t.x-e.calculative.worldRect.x;if(i>e.calculative.barRect.width)return;let a=Math.round(i/e.calculative.barRect.width*100);a<e.min||a>e.max||a<0||a>100||(e.value=a,kc(e),e.calculative.text=e.value+e.unit,Fi(e),e.calculative.canvas.store.emitter.emit("valueUpdate",e),e.calculative.canvas.render())}function gA(e,t){e.calculative.canvas.mouseDown&&Ig(e,t)}function vA(e){e.calculative.isUpdateData&&(delete e.calculative.isUpdateData,an(e)),kc(e)}function mA(e,t){return e.calculative.isUpdateData=!1,(t.textWidth||t.barHeight)&&(t.textWidth&&(e._textWidth=0),e.calculative.isUpdateData=!0),t}function yA(e,t){for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){const a=t[i];e.hasOwnProperty(i)&&(e[i]=a),e.calculative.hasOwnProperty(i)&&(e.calculative[i]=a)}e.background=t.sliderBg,e.calculative.background=t.sliderBg,e.btnBackground=t.sliderBtnBg,e.calculative.btnBackground=t.sliderBtnBg,e.activeColor=t.tabActiveBg,e.calculative.activeColor=t.tabActiveBg}function pA(e,t){t.onMouseDown||(t.onMouseDown=wA),t.options||(t.options=t.data);let i=t.calculative.worldRect.x,a=t.calculative.worldRect.y,s=t.calculative.worldRect.height;t.calculative.worldRect.width;const{fontStyle:n,fontWeight:r,fontSize:l,fontFamily:o,lineHeight:u}=t.calculative;let c=2;e.beginPath(),e.moveTo(i,a),e.arcTo(i+s,a,i+s,a+s,c),e.arcTo(i+s,a+s,i,a+s,c),e.arcTo(i,a+s,i,a,c),e.arcTo(i,a,i+s,a,c),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||ke(.6,t.background)||"#ebebeb",e.strokeStyle=t.disabledColor||ke(.6,t.color)||"#d9d9d9"),e.closePath(),e.fill(),e.stroke(),e.save(),t.checked&&(e.beginPath(),e.lineWidth=s/10,e.strokeStyle="#ffffff",e.moveTo(i+102/506*s,a+s/2),e.lineTo(i+220/506*s,a+346/460*s),e.lineTo(i+404/506*s,a+142/460*s),e.stroke()),e.restore(),e.save(),e.fillStyle=t.disabled||t.isForbidden?t.disabledTextColor||ke(.6,t.textColor||t.color)||"#00000040":Ji(t,t.calculative.canvas.parent.store)||"#000000d9",e.textAlign="start",e.textBaseline="middle",e.font=Le({fontStyle:n,fontWeight:r,fontFamily:o||t.calculative.canvas.parent.store.options.fontFamily,fontSize:l,lineHeight:u}),e.fillText(t.value+"",i+s+10,a+s/2),e.restore()}function wA(e,t){e.isForbidden||(e.checked=!e.checked,e.calculative.canvas.store.emitter.emit("valueUpdate",e),e.calculative.canvas.render())}function bA(e,t){t.options||(t.options=t.data),t.onAdd||(t.onAdd=xA,t.optionPos||(t.onAdd(t),t.calculative.canvas.parent.active([t])),t.onMouseDown=_A,t.onValue=EA,t.onBeforeValue=AA);let i=t.calculative.worldRect.x,a=t.calculative.worldRect.y,s=t.calculative.worldRect.height,n=t.calculative.worldRect.width;if(!t.optionPos)return;const{fontStyle:r,fontWeight:l,fontSize:o,fontFamily:u,lineHeight:c}=t.calculative;if(t.direction=="horizontal")for(let f=0;f<t.optionPos.length;f++){const g=t.optionPos[f]*n/t.checkboxWidth,v=t.options[f].isForbidden||t.disabled;e.beginPath(),e.arc(i+g+s/2,a+s/2,s/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"),v&&(e.fillStyle=t.disabledBackground||ke(.6,t.background)||"#ebebeb",e.strokeStyle=t.disabledColor||ke(.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",v&&(e.strokeStyle=t.disabledBackground||ke(.6,t.background)||"#ebebeb"),e.arc(i+s/2+g,a+s/2,s/2+1.5,0,Math.PI*2),e.stroke(),e.closePath(),e.beginPath(),e.fillStyle=t.options[f].background||t.background||"#1890ff",v&&(e.fillStyle=t.disabledBackground||ke(.6,t.background)||"#ebebeb"),e.arc(i+s/2+g,a+s/2,s/4,0,Math.PI*2),e.fill(),e.closePath()),e.restore(),e.save(),e.fillStyle=v?t.disabledTextColor||"#00000040":Ji(t,t.calculative.canvas.parent.store)||"#000000d9";const m=t.calculative.worldRect.height*14/16;e.textAlign="start",e.textBaseline="middle",e.font=Le({fontStyle:r,fontWeight:l,fontFamily:u||t.calculative.canvas.parent.store.options.fontFamily,fontSize:m,lineHeight:c}),e.fillText(t.options[f].text,i+s+g+10/t.checkboxWidth*n,a+s/2),e.restore()}else if(t.direction=="vertical"){const f=t.optionHeight*s/t.checkboxHeight;for(let g=0;g<t.optionPos.length;g++){const v=t.optionPos[g]*s/t.checkboxHeight,m=t.options[g].isForbidden;e.beginPath(),e.arc(i+f/2,a+f/2+v,f/2,0,Math.PI*2),e.strokeStyle="#d9d9d9",e.fillStyle="#ffffff00",t.options[g].text===t.checked&&(e.strokeStyle=t.options[g].background||"#1890ff"),m&&(e.fillStyle="#ebebeb",e.strokeStyle="#d9d9d9"),e.closePath(),e.fill(),e.stroke(),e.save(),!m&&t.options[g].text===t.checked&&(e.beginPath(),e.strokeStyle=t.options[g].background?t.options[g].background+"20":"#1890ff20",e.arc(i+f/2,a+f/2+v,f/2+1.5,0,Math.PI*2),e.stroke(),e.closePath(),e.beginPath(),e.fillStyle=t.options[g].background||"#1890ff",e.arc(i+f/2,a+f/2+v,f/4,0,Math.PI*2),e.fill(),e.closePath()),e.restore(),e.save(),e.fillStyle=m?"#00000040":Ji(t,t.calculative.canvas.parent.store)||"#000000d9";const w=14*t.calculative.worldRect.height/t.checkboxHeight;e.textAlign="start",e.textBaseline="middle",e.font=Le({fontStyle:r,fontWeight:l,fontFamily:u||t.calculative.canvas.parent.store.options.fontFamily,fontSize:w,lineHeight:c}),e.fillText(t.options[g].text,i+f+10,a+f/2+v),e.restore()}}}function xA(e){Cg(e)}function _A(e,t){if(e.direction=="horizontal")for(let 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+kg(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"){const i=e.calculative.worldRect.height/e.checkboxHeight;for(let a=0;a<e.optionPos.length;a++)!e.options[a].isForbidden&&t.y>e.calculative.worldRect.y+e.optionPos[a]*i&&t.y<e.calculative.worldRect.y+(e.optionPos[a]+e.optionHeight)*i&&(e.checked=e.options[a].text,e.calculative.canvas.store.emitter.emit("valueUpdate",e))}e.calculative.canvas.render()}function EA(e){e.calculative.flag&&Cg(e)}function AA(e,t){return e.calculative.flag=!1,(t.options!==void 0||t.direction!==void 0||t.optionInterval!==void 0||t.optionHeight!==void 0)&&(e.calculative.flag=!0),t}function y5(){return{radio:bA,switch:hA,slider:dA,checkbox:pA,table:$f,table2:$f}}function kA(e,t){const{x:i,y:a,width:s,height:n}=t.calculative.worldRect;e.beginPath(),e.ellipse(i+s/2,a+n/2,s/2,n/2,0,0,Math.PI*2),e.stroke(),e.beginPath(),e.fillStyle=e.strokeStyle,e.ellipse(i+s/2,a+n/2,s/4,n/4,0,0,Math.PI*2),e.fill()}function CA(e,t){const i=t||new Path2D,{x:a,y:s,width:n,height:r,ey:l}=e.calculative.worldRect,o=e.calculative.lineLeft||.08;let u=e.calculative.borderRadius||0,c=u;u<1&&(u=n*u,c=r*u);let f=u<c?u:c;if(n<2*f&&(f=n/2),r<2*f&&(f=r/2),i.moveTo(a+f,s),i.arcTo(a+n,s,a+n,s+r,f),i.arcTo(a+n,s+r,a,s+r,f),i.arcTo(a,s+r,a,s,f),i.arcTo(a,s,a+n,s,f),i.closePath(),i.moveTo(a+o*n,s),i.lineTo(a+o*n,l),i instanceof Path2D)return i}function FA(e,t){const i=t||new Path2D,{x:a,y:s,width:n,height:r,ex:l}=e.calculative.worldRect,o=e.calculative.lineTop||.08;let u=e.calculative.borderRadius||0,c=u;u<1&&(u=n*u,c=r*c);let f=u<c?u:c;if(n<2*f&&(f=n/2),r<2*f&&(f=r/2),i.moveTo(a+f,s),i.arcTo(a+n,s,a+n,s+r,f),i.arcTo(a+n,s+r,a,s+r,f),i.arcTo(a,s+r,a,s,f),i.arcTo(a,s,a+n,s,f),i.closePath(),i.moveTo(a,s+o*r),i.lineTo(l,s+o*r),i instanceof Path2D)return i}function p5(){return{forkV:Oa,forkH:Oa,swimlaneH:CA,swimlaneV:FA}}function w5(){return{activityFinal:kA}}function RA(e,t){e.onDestroy||(e.onDestroy=PA,e.onAdd=TA);const i=t||new Path2D,{x:a,y:s,width:n,height:r,ex:l}=e.calculative.worldRect;let o=e.calculative.borderRadius||0,u=o;o<1&&(o*=n,u*=r);let c=o<u?o:u;n<2*c&&(c=n/2),r<2*c&&(c=r/2),i.moveTo(a+c,s),i.arcTo(a+n,s,a+n,s+r,c),i.arcTo(a+n,s+r,a,s+r,c),i.arcTo(a,s+r,a,s,c),i.arcTo(a,s,a+n,s,c);const f=.2*r;i.moveTo(a,s+f),i.lineTo(l,s+f);const g=s+f+(r-f)/2;if(i.moveTo(a,g),i.lineTo(l,g),i.closePath(),i instanceof Path2D)return i}function TA(e){const{x:t,y:i,width:a,height:s}=e.calculative.worldRect,n=e.list,r={name:"text",x:t,y:i+.2*s,width:a,height:.4*s,textAlign:"left",textBaseline:"top",textLeft:10,textTop:10},l={name:"text",x:t,y:i+.6*s,width:a,height:.4*s,textAlign:"left",textBaseline:"top",textLeft:10,textTop:10};Object.assign(r,n[0]),Object.assign(l,n[1]),e.calculative.canvas.makePen(r),e.calculative.canvas.makePen(l),e.calculative.canvas.parent.pushChildren(e,[r]),e.calculative.canvas.parent.pushChildren(e,[l])}function PA(e){const t=e.calculative.canvas.store;e.children.forEach(i=>{const a=t.data.pens.findIndex(s=>s.id===i);a>-1&&(t.data.pens.splice(a,1),t.pens[i]=void 0)}),e.children=void 0}function SA(e,t){e.onDestroy||(e.onDestroy=BA,e.onAdd=IA);const i=t||new Path2D,{x:a,y:s,width:n,height:r,ex:l}=e.calculative.worldRect;let o=e.calculative.borderRadius||0,u=o;o<1&&(o=n*o,u=r*u);let c=o<u?o:u;n<2*c&&(c=n/2),r<2*c&&(c=r/2),i.moveTo(a+c,s),i.arcTo(a+n,s,a+n,s+r,c),i.lineTo(a+n,s+r-c),i.arcTo(a+n,s+r,a,s+r,c),i.arcTo(a,s+r,a,s,c),i.arcTo(a,s,a+n,s,c);const f=.2*r;if(i.moveTo(a,s+f),i.lineTo(l,s+f),i.closePath(),i instanceof Path2D)return i}function IA(e){const{x:t,y:i,width:a,height:s}=e.calculative.worldRect,n=e.list;let r={name:"text",x:t,y:i+.2*s,width:a,height:.8*s,textAlign:"left",textBaseline:"top",textLeft:10,textTop:10};Object.assign(r,n[0]),e.calculative.canvas.makePen(r),e.calculative.canvas.parent.pushChildren(e,[r])}function BA(e){const t=e.calculative.canvas.store;e.children.forEach(i=>{const a=t.data.pens.findIndex(s=>s.id===i);a>-1&&(t.data.pens.splice(a,1),t.pens[i]=void 0)}),e.children=[]}function b5(){return{interfaceClass:RA,simpleClass:SA}}var ln;(function(e){e[e.Add=0]="Add",e[e.Replace=1]="Replace",e[e.ReplaceAll=2]="ReplaceAll"})(ln||(ln={}));let nc=["fontSize","nameGap","margin","width","symbolSize","itemWidth","itemHeight","fontWeight","top","left","right","bottom","zoom","edgeSymbolSize","nodeWidth","nodeGap","distance","length","length2","offsetCenter","size","symbolOffset","padding","barWidth","symbolOffset","shadowOffsetY","shadowOffsetX"];function DA(e){var s,n;let t=globalThis.echarts;if(!e.echarts||!t)return;if(typeof e.echarts=="string")try{e.echarts=JSON.parse(e.echarts)}catch{}nc=((s=e.calculative.canvas.store.options.diagramOptions.chart)==null?void 0:s.keyWords)||nc,e.onDestroy||(e.onDestroy=MA,e.onMove=Dr,e.onResize=OA,e.onRotate=Dr,e.onValue=zA,e.onBeforeValue=HA,e.onBinds=UA,e.onMouseEnter=Dr,e.onRenderPenRaw=Dl,e.onScale=NA),e.calculative.singleton||(e.calculative.singleton={});const i=new Path2D,a=e.calculative.worldRect;if(!e.calculative.singleton.div){const r=document.createElement("div");r.style.position="absolute",r.style.outline="none",r.style.left="-9999px",r.style.top="-9999px",r.style.width=a.width+"px",r.style.height=a.height+"px",document.body.appendChild(r),(n=e.calculative.canvas.externalElements)==null||n.parentElement.appendChild(r),Fe(e,r),e.calculative.singleton.div=r,e.calculative.singleton.echart=t.init(r,e.echarts.theme),LA(e),e.calculative.singleton.echartsReady=!0,e.echarts.geoName&&!t.getMap(e.echarts.geoName)&&(e.echarts.geoJson?t.registerMap(e.echarts.geoName,e.echarts.geoJson):e.echarts.geoUrl&&(e.calculative.singleton.echartsReady=!1,fetch(e.echarts.geoUrl).then(l=>{l.text().then(o=>{if(typeof o=="string")try{o=JSON.parse(o)}catch{}if(o.constructor!==Object&&o.constructor!==Array){console.warn("Invalid data:",o);return}t.registerMap(e.echarts.geoName,o),e.calculative.singleton.echartsReady=!0,e.calculative.singleton.echart.setOption(Gr(e.echarts.option,e.calculative.canvas.store.data.scale),!0),e.calculative.singleton.echart.resize(),setTimeout(()=>{Dl(e)},300)})}))),e.calculative.singleton.echartsReady&&setTimeout(()=>{e.calculative.singleton.echart.setOption(Gr(e.echarts.option,e.calculative.canvas.store.data.scale),!0),setTimeout(()=>Dl(e),300)})}return i}function LA(e){var a;const t=e.calculative.singleton.echart,i=["click","dblclick","mousedown","mousemove","mouseup","mouseover","mouseout","globalout","contextmenu"];i.forEach(s=>{t.off(s)}),(a=e.events)==null||a.forEach(s=>{s.actions&&s.actions.length&&i.includes(s.name)&&t.on(s.name,n=>{let r=!1;s.conditions&&s.conditions.length?s.conditionType==="and"?r=s.conditions.every(l=>e.calculative.canvas.parent.judgeCondition(e,l.key,l)):s.conditionType==="or"&&(r=s.conditions.some(l=>e.calculative.canvas.parent.judgeCondition(e,l.key,l))):r=!0,r&&s.actions.forEach(l=>{if(l.timeout){let o=setTimeout(()=>{e.calculative.canvas.parent.events[l.action]&&(e.calculative.canvas.parent.events[l.action](e,l,n),clearTimeout(o),o=null)},l.timeout)}else e.calculative.canvas.parent.events[l.action]&&e.calculative.canvas.parent.events[l.action](e,l,n)})})})}function MA(e){if(e.calculative.singleton&&e.calculative.singleton.div){e.calculative.singleton.div.remove();let t=globalThis.echarts;t&&t.dispose(e.calculative.singleton.echart),delete e.calculative.singleton.div,delete e.calculative.singleton.echart}}function Dr(e){e.calculative.singleton.div&&Fe(e,e.calculative.singleton.div)}function OA(e){var t;Dr(e),(t=e.calculative.singleton)!=null&&t.echart&&e.calculative.singleton.echart.resize()}function NA(e){var i,a;if(!e.calculative.singleton.echart)return;let t=globalThis.echarts;if(Fe(e,e.calculative.singleton.div),!(e.echarts.geoName&&!t.getMap(e.echarts.geoName))){if(!e.echarts.diabled){if((i=e.echarts.option)!=null&&i.dataZoom){const n=e.calculative.singleton.echart.getOption().dataZoom;(a=e.echarts.option.dataZoom)==null||a.forEach((r,l)=>{n[l]&&(r.start=n[l].start,r.end=n[l].end)})}e.calculative.singleton.echart.setOption(Gr(e.echarts.option,e.calculative.canvas.store.data.scale),!0)}e.calculative.singleton.echart.resize()}}function zA(e){var t,i;if(!!e.calculative.singleton.echart&&(Fe(e,e.calculative.singleton.div),e.calculative.singleton.echartsReady))if(e.calculative.partialOption){const a=e.calculative.partialOption.echarts.option;(Array.isArray((t=e.echarts)==null?void 0:t.replaceMerge)?(i=e.echarts)==null?void 0:i.replaceMerge.some(n=>a[n]):!1)?e.calculative.singleton.echart.setOption(ht(a),{replaceMerge:e.echarts.replaceMerge}):e.calculative.singleton.echart.setOption(ht(a))}else e.calculative.singleton.echart.setOption(Gr(e.echarts.option,e.calculative.canvas.store.data.scale),!0)}function HA(e,t){if(e.calculative.partialOption=null,t.echarts){let m=globalThis.echarts;return t.echarts.geoName&&!m.getMap(t.echarts.geoName)&&(t.echarts.geoJson?m.registerMap(t.echarts.geoName,t.echarts.geoJson):t.echarts.geoUrl&&(e.calculative.singleton.echartsReady=!1,fetch(t.echarts.geoUrl).then(w=>{w.text().then(y=>{if(typeof y=="string")try{y=JSON.parse(y)}catch{}if(y.constructor!==Object&&y.constructor!==Array){console.warn("Invalid data:",y);return}return m.registerMap(t.echarts.geoName,y),e.calculative.singleton.echartsReady=!0,e.onValue(e),!1})}))),t}if(e.realTimes&&e.realTimes.length){e.echarts.dataMap&&t.data&&(t=WA(e,t));let m=Object.keys(t);const{xAxis:w,yAxis:y}=e.echarts.option,{max:_,replaceMode:A,timeFormat:x}=e.echarts;let C=[],T=!1;for(let I in t)if(I.includes("echarts.option")){T=!0;let D=ya(e,I);if(Array.isArray(D)&&A===ln.Add&&(D.push(t[I]),_&&D.splice(0,D.length-_),t[I]=D,!m.includes("echarts.option.xAxis.data"))){let B="echarts.option.xAxis.data";Array.isArray(w)&&w.length&&(B="echarts.option.xAxis.0.data");let V=ya(e,B),Q=Zl(x||"`${hours}:${minutes}:${seconds}`");V.push(Q),_&&V.splice(0,V.length-_),t[B]=V}if(I.includes(".data.")){let B=I.substring(0,I.indexOf(".data.")+5);C.includes(B)||C.push(B)}}if(T){const I=ht(t);e.calculative.partialOption=VA(I,e),C.forEach(D=>{let B=ya(e,D);Vr(e.calculative.partialOption,D,B)})}return t}if(!t.dataX&&!t.dataY)return t;const i=e.echarts,{max:a,replaceMode:s}=i;let n=t.dataX,r=t.dataY,l=[];r&&l.push("echarts.option.series");const o=i.option.series,u=o.length,{xAxis:c,yAxis:f}=i.option;Array.isArray(c)&&c.length>1&&console.warn("echarts \u53EA\u652F\u6301\u5355 x \u8F74\uFF0C\u591A x \u8F74\u5C06\u88AB\u5FFD\u7565");const g=Array.isArray(c)?c[0]:c,v=Array.isArray(f)?f[0]:f;if(s)if(s===ln.Replace){if(!g&&!v)r&&(u===1?(!Array.isArray(r)&&(r=[r]),r.forEach((m,w)=>{const y=o[0].data.find(_=>_.name===m.name);y&&(y.value=m.value)})):o.forEach((m,w)=>{Array.isArray(r[w])||(r[w]=[r[w]]),r[w].forEach((y,_)=>{const A=m.data.find(x=>x.name===y.name);A&&(A.value=y.value)})}));else if((g.type==="category"||v.type==="category")&&n&&r){const m=g.type==="category"?g.data:v.data;!Array.isArray(n)&&(n=[n]),!Array.isArray(r)&&(r=[r]),g.type==="category"?l.push("echarts.option.xAxis"):l.push("echarts.option.yAxis"),u===1?r.forEach((w,y)=>{const _=m.indexOf(n[y]);o[0].data[_]=w}):o.forEach((w,y)=>{r[y].forEach((_,A)=>{const x=m.indexOf(n[A]);w.data[x]=_})})}}else s===ln.ReplaceAll&&(n&&(g.data=n,g.data.splice(0,g.data.length-a),l.push("echarts.option.xAxis")),r&&(u===1?(o[0].data=r,o[0].data.splice(0,o[0].data.length-a)):o.forEach((m,w)=>{m.data=r[w],m.data.splice(0,m.data.length-a)})));else{if(n){!Array.isArray(n)&&(n=[n]);const m=g.data;m.push(...n),m.splice(0,m.length-a),l.push("echarts.option.xAxis")}if(r)if(u===1){!Array.isArray(r)&&(r=[r]);const m=o[0].data;m.push(...r),m.splice(0,m.length-a)}else o.forEach((m,w)=>{Array.isArray(r[w])||(r[w]=[r[w]]);const y=m.data;y.push(...r[w]),y.splice(0,y.length-a)})}return e.calculative.partialOption={},l.forEach(m=>{let w=ya(e,m);Vr(e.calculative.partialOption,m,w)}),delete t.dataX,delete t.dataY,Object.assign(t,{echarts:i})}function WA(e,t){var i,a;if(!e.echarts.dataMap||!t.data)return t;if(t.data){let s={};if(Array.isArray(t.data))for(const n in e.echarts.dataMap)e.echarts.dataMap.hasOwnProperty(n)&&(((i=e.echarts.timeKeys)==null?void 0:i.length)&&e.echarts.timeKeys.includes(e.echarts.dataMap[n])?s[n]=t.data.map(r=>Zl(e.echarts.timeFormat,r[e.echarts.dataMap[n]])):s[n]=t.data.map(r=>r[e.echarts.dataMap[n]]));else for(const n in e.echarts.dataMap)e.echarts.dataMap.hasOwnProperty(n)&&(((a=e.echarts.timeKeys)==null?void 0:a.length)&&e.echarts.timeKeys.includes(e.echarts.dataMap[n])?s[n]=Zl(e.echarts.timeFormat,t.data[e.echarts.dataMap[n]]):s[n]=t.data[e.echarts.dataMap[n]]);return delete t.data,Object.assign(t,s),t}}function UA(e,t,i){if(i.key!=="dataY")return;const a=e.echarts,{xAxis:s,yAxis:n}=a.option;Array.isArray(s)&&s.length>1&&console.warn("echarts \u53EA\u652F\u6301\u5355 x \u8F74\uFF0C\u591A x \u8F74\u5C06\u88AB\u5FFD\u7565");const r=Array.isArray(s)?s[0]:s,l=Array.isArray(n)?n[0]:n,o=a.option.series;if(!r&&!l){const u=[];if(Array.isArray(o)&&o.length===1)return o[0].data.forEach(c=>{const{dataId:f}=i.dataIds.find(g=>g.name===c.name);if(f){const g=t.find(v=>v.dataId===f);g&&u.push({name:c.name,value:g.value})}}),{id:e.id,dataY:u}}else if(r.type==="category"||l.type==="category"){const u=[],c=[],f=r.type==="category"?r.data:l.data;return f==null||f.forEach(g=>{const{dataId:v}=i.dataIds.find(m=>m.name===g);if(v){const m=t.find(w=>w.dataId===v);m&&(c.push(g),u.push(m.value))}}),{id:e.id,dataY:u,dataX:c}}else if(r.type==="time"){const u=[],c=+new Date;let f=!1;if(o.forEach((g,v)=>{const m=[],{dataId:w}=i.dataIds.find(y=>y.name===g.name);if(w){const y=t.find(_=>_.dataId===w);y&&(m.push([c,y.value]),f=!0)}u[v]=m}),f)u.forEach((g,v)=>{if(!g||g.length===0){const m=o[v].data[o[v].data.length-1];u[v]=[[c,m[1]]]}});else return;return{id:e.id,dataY:u.length===1?u[0]:u}}}function Dl(e){var i,a;const t=new Image;t.src=(a=(i=e.calculative.singleton)==null?void 0:i.echart)==null?void 0:a.getDataURL({pixelRatio:2}),e.calculative.img=t}function Gr(e,t){const i=ht(e);if(i.dataZoom){let a=["right","top","width","height","left","bottom"];for(let s=0;s<a.length;s++)i.dataZoom.forEach(n=>{isNaN(n[a[s]])||(n[a[s]]*=t)})}return Xl(i,nc,t),i}function VA(e,t){const i={};return Object.keys(e).forEach(a=>{const s=a.split(".");let n=i;s.forEach((r,l)=>{const o=!isNaN(parseInt(r));if(l===6){let u=s.slice(0,7).join(".");Vr(t,a,e[a]);let c=ya(t,u);n[s[l]]=c}else{if(l>6)return;if(l===s.length-1)o?(Array.isArray(n)||(n=[]),n[parseInt(r)]=e[a]):n[r]=e[a];else if(o){const u=parseInt(r);if(Array.isArray(n)||n[s[l-1]],n[u]||(n[u]={}),Array.isArray(n))for(let c=0;c<parseInt(r);c++)n[c]||(n[c]={});n=n[u]}else n[r]||(r==="series"?n[r]=[]:n[r]={}),n=n[r]}})}),i}function x5(e){e&&(globalThis.echarts=e),Hd({echarts:DA})}const $A=15;function Pa(e,t=$A){let i=""+e;return i.indexOf(".")>=0&&(i=Number.parseFloat(i).toFixed(t)),Number.parseFloat(i)}function Ll(e){return typeof e=="number"&&Number.isFinite(e)}function jA(e){e={max:null,min:null,splitNumber:4,symmetrical:!1,deviation:!1,preferZero:!1,...e};const t=[10,15,20,25,30,40,50,60,70,80,90,100,150];let{max:i,min:a,splitNumber:s,symmetrical:n,deviation:r,preferZero:l}=e;if(!Ll(i)||!Ll(a)||i<a)return{splitNumber:s};if(i===a&&i===0)return{max:Pa(t[0]*s),min:a,interval:t[0],splitNumber:s};i===a&&(l=!0),(!Ll(s)||s<=0)&&(s=4),l&&i*a>0&&(i<0?i=0:a=0);const o=(i-a)/s;let u=Math.floor(Math.log10(o)-1);u=Math.pow(10,u);const c=o/u;let f=t[0]*u,g=-1,v;for(v=0;v<t.length;v++)if(t[v]>c){f=t[v]*u;break}let m=i,w=a;function y(A){if(m=parseInt(""+(i/A+1))*A,w=parseInt(""+(a/A-1))*A,i===0&&(m=0),a===0&&(w=0),n&&m*w<0){const x=Math.max(Math.abs(m),Math.abs(w));m=x,w=-x}}if(y(f),r)return{max:Pa(m),min:Pa(w),interval:Pa(f),splitNumber:Math.round((m-w)/f)};if(!n||m*w>0){let A;t:do{if(A=Math.round((m-w)/f),(v-g)*(A-s)<0){for(;A<s;)if(w-a<=m-i&&w!==0||m===0?w-=f:m+=f,A++,A===s)break t}if(v>=t.length-1||v<=0||A===s)break;g=v,A>s?f=t[++v]*u:f=t[--v]*u,y(f)}while(A!==s)}m=Pa(m),w=Pa(w);const _=Pa((m-w)/s);return{max:m,min:w,interval:_,splitNumber:s}}function Bg(e,t){var y,_,A,x,C,T,I,D,B,V,Q,F,R,P,M,Y,Z,nt,j,H,$,K,U,tt,at,et,ut,ct;const i=t.calculative.worldRect.x,a=t.calculative.worldRect.y,s=t.calculative.worldRect.width,n=t.calculative.worldRect.height;let r=t.calculative.canvas.store.data.scale,l=[];if(t.echarts)for(let ot=0;ot<t.echarts.option.series.length;ot++)l.push(t.echarts.option.series[ot].data);else l=t.data;let o=[];for(let ot=0;ot<l.length;ot++)o=o.concat(l[ot]);let u={max:Math.max.apply(null,o),min:Math.min.apply(null,o),splitNumber:5},c=jA(u),f=t.echarts?t.echarts.option.xAxis.data.length:t.xAxisData.length;e.beginPath(),e.strokeStyle="#BFBFBF",e.lineWidth=6*r,e.lineCap="butt";let g=(s-1*(f+1))/f;e.setLineDash([1,g]),e.moveTo(i,a+n+3*r),e.lineTo(i+s,a+n+3*r),e.stroke(),e.closePath(),e.beginPath(),e.lineWidth=1*r,e.setLineDash([]),e.moveTo(i,a+n),e.lineTo(i+s,a+n),e.stroke(),e.closePath(),e.beginPath(),e.fillStyle="#BFBFBF",e.strokeStyle="#E9E9E9",e.setLineDash([2,2]);let v={fontStyle:((_=(y=t.yAxis)==null?void 0:y.axisLabel)==null?void 0:_.fontStyle)||t.fontStyle,textDecoration:(x=(A=t.yAxis)==null?void 0:A.axisLabel)==null?void 0:x.textDecoration,fontWeight:((T=(C=t.yAxis)==null?void 0:C.axisLabel)==null?void 0:T.fontWeight)||t.fontWeight,fontFamily:((D=(I=t.yAxis)==null?void 0:I.axisLabel)==null?void 0:D.fontFamily)||t.fontFamily,fontSize:((V=(B=t.yAxis)==null?void 0:B.axisLabel)==null?void 0:V.fontSize)||t.fontSize,lineHeight:((F=(Q=t.yAxis)==null?void 0:Q.axisLabel)==null?void 0:F.lineHeight)||t.lineHeight};e.fillStyle=((P=(R=t.yAxis)==null?void 0:R.axisLabel)==null?void 0:P.fontColor)||t.color;for(let ot=0;ot<c.splitNumber+1;ot++){let b=ot*n/c.splitNumber;e.textAlign="right",e.textBaseline="middle",e.font=Le(v),e.fillText(c.max-ot*c.interval+"",i-10*r,a+b),e.fill(),ot<c.splitNumber&&(e.beginPath(),e.moveTo(i,a+b),e.lineTo(i+s,a+b),e.stroke())}e.closePath(),e.beginPath(),e.strokeStyle="#BFBFBF";let m=t.echarts?t.echarts.option.xAxis.data:t.xAxisData,w=0;for(let ot=0;ot<m.length;ot++){w=i+(1+g/2)+(g+1)*ot,e.textAlign="center",e.textBaseline="top";let b={fontStyle:((Y=(M=t.xAxis)==null?void 0:M.axisLabel)==null?void 0:Y.fontStyle)||t.calculative.fontStyle,textDecoration:(nt=(Z=t.xAxis)==null?void 0:Z.axisLabel)==null?void 0:nt.textDecoration,fontWeight:((H=(j=t.xAxis)==null?void 0:j.axisLabel)==null?void 0:H.fontWeight)||t.calculative.fontWeight,fontFamily:((K=($=t.xAxis)==null?void 0:$.axisLabel)==null?void 0:K.fontFamily)||t.calculative.fontFamily,fontSize:((tt=(U=t.xAxis)==null?void 0:U.axisLabel)==null?void 0:tt.fontSize)||t.calculative.fontSize,lineHeight:((et=(at=t.xAxis)==null?void 0:at.axisLabel)==null?void 0:et.lineHeight)||t.calculative.lineHeight};e.font=Le(b),e.fillStyle=((ct=(ut=t.xAxis)==null?void 0:ut.axisLabel)==null?void 0:ct.fontColor)||t.calculative.color,e.fillText(m[ot],w,a+n+10*r),e.fill()}return e.closePath(),e.setLineDash([]),{dash:g,normalizedOption:c}}function qA(e,t){if(!isNaN(e))return t===-1?e:Math.round(Number(e)*1e3)/1e3}var Ps;(function(e){e[e.Add=0]="Add",e[e.Replace=1]="Replace",e[e.ReplaceAll=2]="ReplaceAll"})(Ps||(Ps={}));function YA(e,t){t.onBeforeValue||(t.onBeforeValue=Dg);const i=t.calculative.worldRect.x,a=t.calculative.worldRect.y;t.calculative.worldRect.width;const s=t.calculative.worldRect.height;let n=t.calculative.canvas.store.data.scale,r=[];t.echarts&&!t.echarts.option.color&&(t.echarts.option.color=["#1890ff","#2FC25B","#FACC14","#c23531","#2f4554","#61a0a8","#d48265"]);let l=Bg(e,t),o=l.dash,u=l.normalizedOption;const c=!!(t.echarts?t.echarts.option.series[0].smooth:t.smooth);let f=[];if(t.echarts)for(let g=0;g<t.echarts.option.series.length;g++)r.push(t.echarts.option.series[g].data);else r=t.data;for(let g=0;g<r.length;g++){e.beginPath();let v=r[g];e.strokeStyle=t.echarts?t.echarts.option.color[g]:t.chartsColor[g],e.fillStyle=t.echarts?t.echarts.option.color[g]:t.chartsColor[g];let m=i+(1+o/2),w=a+s-(v[0]-u.min)/(u.max-u.min)*s;if(e.moveTo(m,w),f.push({x:m,y:w}),c)if(v.length<=2)for(let y=1;y<v.length;y++)m=i+(1+o/2)+(o+1)*y,w=a+s-(v[y]-u.min)/(u.max-u.min)*s,e.lineTo(m,w),f.push({x:m,y:w});else{let y,_,A,x;v.forEach((C,T)=>{m=i+(1+o/2)+(o+1)*T,w=a+s-(v[T]-u.min)/(u.max-u.min)*s;let I=i+(1+o/2)+(o+1)*(T+1),D=a+s-(v[T+1]-u.min)/(u.max-u.min)*s,B=i+(1+o/2)+(o+1)*(T-1),V=a+s-(v[T-1]-u.min)/(u.max-u.min)*s,Q=i+(1+o/2)+(o+1)*(T+2),F=a+s-(v[T+2]-u.min)/(u.max-u.min)*s;T===0?(B=i+(1+o/2)+(o+1)*T,V=a+s-(v[T]-u.min)/(u.max-u.min)*s):T===v.length-2&&(Q=i+(1+o/2)+(o+1)*(T+1),F=a+s-(v[T+1]-u.min)/(u.max-u.min)*s),f.push({x:m,y:w}),y=m+(I-B)/4,_=w+(D-V)/4,A=I-(Q-m)/4,x=D-(F-w)/4,e.bezierCurveTo(y,_,A,x,I,D)})}else for(let y=1;y<v.length;y++)m=i+(1+o/2)+(o+1)*y,w=a+s-(v[y]-u.min)/(u.max-u.min)*s,e.lineTo(m,w),f.push({x:m,y:w});e.stroke(),e.closePath(),e.save(),f.forEach((y,_)=>{e.beginPath(),e.strokeStyle="#fff",e.lineWidth=2*n,e.arc(y.x,y.y,4*n,0,Math.PI*2),e.stroke(),e.fill(),e.closePath()}),e.restore(),f=[]}}function Dg(e,t){if(t.xAxisData||t.data||!t.dataX&&!t.dataY)return t;const i=e.xAxisData,a=e.data,s=e.replaceMode;let n=[],r=[];return s?s===Ps.Replace?(t.dataX.forEach((l,o)=>{let u=i.indexOf(l);a.forEach((c,f)=>{c[u]=t.dataY[f][o]})}),n=i,r=a):s===Ps.ReplaceAll&&(n=t.dataX,r=t.dataY):(n=[...i,...t.dataX],a.forEach((l,o)=>{let u=[...l,...t.dataY[o]];r.push(u)})),delete t.dataX,delete t.dataY,Object.assign(t,{xAxisData:n,data:r})}function KA(e,t){var c,f;t.onBeforeValue||(t.onBeforeValue=XA);let i=t.calculative.canvas.store.data.scale;const a=t.calculative.worldRect.x,s=t.calculative.worldRect.y,n=t.calculative.worldRect.width,r=t.calculative.worldRect.height,l=!!t.echarts;t.echarts?(t.echarts.option.color||(t.echarts.option.color=["#1890ff","#2FC25B","#FACC14","#c23531","#2f4554","#61a0a8","#d48265"]),t.chartsColor=t.echarts.option.color):t.chartsColor||(t.chartsColor=["#1890ff","#2FC25B","#FACC14","#c23531","#2f4554","#61a0a8","#d48265"]);const o=l?t.echarts.option.series:t.data;let u=0;for(let g=0;g<o.length;g++){let v=o[g],m=n/2;r<n&&(m=r/2);const w=a+n/2,y=s+r/2;let _=0;l?_=v.data.reduce((D,B)=>D+B.value,0):_=v.reduce((D,B)=>D+B.value,0);const A=m*parseFloat(l?v.radius[0]:t.chartsRadius[g][0])/100,x=m*parseFloat(l?v.radius[1]:t.chartsRadius[g][1])/100;if(A>x)return;let C=0,T=0;e.strokeStyle=l&&((c=v.itemStyle)==null?void 0:c.borderColor)||"#fff",e.lineWidth=(l&&((f=v.itemStyle)==null?void 0:f.borderWidth)||2)*i;const I=l?v.data:v;I.forEach((D,B)=>{var Y,Z,nt,j,H,$,K,U,tt,at,et,ut,ct;T+=Math.PI*2*D.value/_,e.beginPath();let V=u+B;V>=t.chartsColor.length&&(V=V%t.chartsColor.length),e.fillStyle=l?t.echarts.option.color[V]:t.chartsColor[V],e.moveTo(w+A*Math.sin(T),y-A*Math.cos(T)),e.arc(w,y,A,-Math.PI/2+T,-Math.PI/2+C,!0),e.lineTo(w+x*Math.sin(C),y-x*Math.cos(C)),e.arc(w,y,x,-Math.PI/2+C,-Math.PI/2+T),e.lineTo(w+A*Math.sin(T),y-A*Math.cos(T)),e.stroke(),e.fill(),e.closePath();let Q=(C+T)/2,F=w+(x+10*i)*Math.sin(Q),R=y-(x+10*i)*Math.cos(Q),P=e.fillStyle;v.label||(v.label={position:"outside",show:!0}),l&&["inner","inside"].includes(v.label.position)?(e.fillStyle="#ffffff",F=w+(x-A)/2*Math.sin(Q),R=y-(x-A)/2*Math.cos(Q)):l&&v.label.position=="outside",v.labelLine||(v.labelLine={show:!0}),(l&&v.labelLine.show!==!1||!l)&&(e.beginPath(),e.strokeStyle=l?t.echarts.option.color[u+B]:t.chartsColor[u+B],e.moveTo(w+x*Math.sin(Q),y-x*Math.cos(Q)),e.lineTo(F,R));let M={fontStyle:((Y=t.tickLabel)==null?void 0:Y.fontStyle)||t.calculative.fontStyle,fontWeight:((Z=t.tickLabel)==null?void 0:Z.fontWeight)||t.calculative.fontWeight,fontFamily:((nt=t.tickLabel)==null?void 0:nt.fontFamily)||t.calculative.fontFamily,lineHeight:((j=t.tickLabel)==null?void 0:j.lineHeight)||t.calculative.lineHeight,fontSize:(((H=t.tickLabel)==null?void 0:H.fontSize)||t.calculative.fontSize)*i};e.font=Le(M),e.textBaseline="middle",e.textAlign="center",Q>Math.PI?((l&&v.label.position==="outside"||!l)&&(e.textAlign="end"),(l&&v.labelLine.show!==!1||!l&&((U=(K=($=t.tickLabel)==null?void 0:$.labelLine)==null?void 0:K.show)!=null?U:!0))&&e.lineTo(F-5*i,R),(l&&v.label.show!==!1||!l&&((at=(tt=t.tickLabel)==null?void 0:tt.show)!=null?at:!0))&&e.fillText(D.name,F-5*i,R)):((l&&v.label.position==="outside"||!l)&&(e.textAlign="start"),(l&&v.labelLine.show!==!1||!l)&&e.lineTo(F+5*i,R),(l&&v.label.show!==!1||!l&&((ut=(et=t.tickLabel)==null?void 0:et.show)!=null?ut:!0))&&e.fillText(D.name,F+5*i,R)),e.stroke(),e.closePath(),e.fillStyle=P,e.strokeStyle=l&&((ct=v.itemStyle)==null?void 0:ct.borderColor)||"#fff",C=T}),u+=I.length}}function XA(e,t){if(t.data||!t.dataX&&!t.dataY)return t;const i=e.data,a=e.replaceMode;let s=[];return a?a===Ps.Replace?(t.dataY.forEach((n,r)=>{n.forEach((l,o)=>{let u=i[r].filter(c=>c.name===l.name);u.length>0&&(u[0].value=l.value)})}),s=i):a===Ps.ReplaceAll&&(s=t.dataY):i.forEach((n,r)=>{let l=[...n,...t.dataY[r]];s.push(l)}),delete t.dataX,delete t.dataY,Object.assign(t,{data:s})}function GA(e,t){t.onBeforeValue||(t.onBeforeValue=Dg);let i=t.calculative.canvas.store.data.scale;const a=t.calculative.worldRect.x,s=t.calculative.worldRect.y;t.calculative.worldRect.width;const n=t.calculative.worldRect.height;let r=[];if(t.echarts&&!t.echarts.option.color&&(t.echarts.option.color=["#1890ff","#2FC25B","#FACC14","#c23531","#2f4554","#61a0a8","#d48265"]),t.echarts)for(let f=0;f<t.echarts.option.series.length;f++)r.push(t.echarts.option.series[f].data);else r=t.data;let l=Bg(e,t),o=l.dash,u=l.normalizedOption,c=o*4/5/r.length;for(let f=0;f<r.length;f++){e.beginPath();let g=r[f];e.fillStyle=t.echarts?t.echarts.option.color[f]:t.chartsColor[f],e.strokeStyle="#ffffff",e.lineWidth=1*i;let v=0,m=0,w=0;for(let y=0;y<g.length;y++)v=a+(1+.1*o)+(o+1)*y+c*f,w=(g[y]-u.min)/(u.max-u.min)*n,m=s+n-w,e.rect(v,m,c-1,w-1),e.stroke(),e.fill();e.closePath()}}function ZA(e,t){var j,H,$,K,U,tt,at,et,ut,ct,ot,b,E,S;t.onAdd||(t.onAdd=JA,t.onDestroy=QA,t.onClick=tk,t.clockInterval&&(t.onDestroy(t),t.onAdd(t)));const i=t.calculative.worldRect.x,a=t.calculative.worldRect.y,s=t.calculative.worldRect.width,n=t.calculative.worldRect.height;let r=t.calculative.canvas.store.data.scale,l={startAngle:225,endAngle:-45,min:0,max:100,splitNumber:10};if(t.echarts&&t.echarts.option){let N=t.echarts.option.series[0];t.startAngle=N.startAngle||l.startAngle,t.endAngle=N.endAngle||l.endAngle,t.min=N.min||l.min,t.max=N.max||l.max,t.axisLine=N.axisLine.lineStyle.color,t.unit=N.detail.formatter.replace("{value}",""),t.value=N.data[0].value,t.splitNumber=N.splitNumber||l.splitNumber}t={...l,...t};let o=s>n?n/2*9/10:s/2*9/10,u=i+s/2,c=a+n/2,f=t.echarts?t.echarts.option.series[0].data[0].value:t.value,g,v=t.startAngle-t.endAngle,m=t.background||"#E6EBF8";e.strokeStyle=m;let w=o/10;e.lineWidth=w,e.beginPath(),e.lineCap="round",e.arc(u,c,o,-t.startAngle/180*Math.PI,-t.endAngle/180*Math.PI),e.stroke(),e.closePath();let y=0;if(t.axisLine&&!t.isClock)for(let N=t.axisLine.length-1;N>=0;N--)t.axisLine[N][0]*(t.max-t.min)<f?y=t.axisLine[N][0]:(y=(f-t.min)/(t.max-t.min),g=t.axisLine[N][1]),e.beginPath(),e.strokeStyle=t.axisLine[N][1],e.arc(u,c,o,-t.startAngle/180*Math.PI,(-t.startAngle+y*v)/180*Math.PI),e.stroke(),e.closePath();e.lineCap="butt";let _=2*r,A=o-w;A<0&&(A=0);let x=v/180*Math.PI*A,C=(x-_*t.splitNumber)/t.splitNumber,T=v/180*Math.PI*_/2/x;e.beginPath(),e.strokeStyle=t.color||"#999999",e.lineWidth=o/20,e.setLineDash([_,C]),e.arc(u,c,A,-t.startAngle/180*Math.PI-T,-t.endAngle/180*Math.PI+T),e.stroke(),e.closePath();let I=1*r,D=o-w;D<0&&(D=0);let B=v/180*Math.PI*D,V=(B-I*5*t.splitNumber)/5/t.splitNumber,Q=v/180*Math.PI*I/2/B;e.beginPath(),e.strokeStyle=t.color||"#999999",e.lineWidth=o/40,e.setLineDash([I,V]),e.arc(u,c,D,-t.startAngle/180*Math.PI-Q,-t.endAngle/180*Math.PI+Q),e.stroke(),e.closePath(),e.beginPath();let F=t.max-t.min,R=F/t.splitNumber,P={fontStyle:((j=t.tickLabel)==null?void 0:j.fontStyle)||t.calculative.fontStyle,textDecoration:((H=t.tickLabel)==null?void 0:H.textDecoration)||t.textDecoration,fontWeight:(($=t.tickLabel)==null?void 0:$.fontWeight)||t.calculative.fontWeight,fontFamily:((K=t.tickLabel)==null?void 0:K.fontFamily)||t.calculative.fontFamily,fontSize:(((U=t.tickLabel)==null?void 0:U.fontSize)||t.calculative.fontSize)*r,lineHeight:((tt=t.tickLabel)==null?void 0:tt.lineHeight)||t.calculative.lineHeight};e.font=Le(P);let M=o-w-o/20;for(let N=0;N<=t.splitNumber;N++){if(Math.abs(t.startAngle)+Math.abs(t.endAngle)===360&&N==0)continue;let X=t.startAngle-R*N/F*v,G=Math.cos(X/180*Math.PI),rt=Math.sin(X/180*Math.PI);e.fillStyle=((at=t.tickLabel)==null?void 0:at.color)||"#999999",G>.02?e.textAlign="end":G<-.02?e.textAlign="start":e.textAlign="center",rt>.02?e.textBaseline="top":rt<-.02?e.textBaseline="bottom":e.textBaseline="middle",e.fillText(qA(R*N+t.min,1),u+M*G,c-M*rt),e.fill()}e.closePath();let Y=1,Z=["value"];if(t.isClock&&(Y=3,Z=["hourvalue","minutevalue","secondvalue"]),t.isClock)for(let N=0;N<Y;N++){let X=(t.startAngle-(t[Z[N]]-t.min)/(t.max-t.min)*v)/180*Math.PI;N>0&&(X=(t.startAngle-(t[Z[N]]-t.min)/(t.max*5-t.min)*v)/180*Math.PI);let G=4/5*o;Z[N]==="hourvalue"&&(G=3/5*o),Z[N]==="minutevalue"&&(G=3.5/5*o);let rt=o*1/40;e.beginPath(),e.setLineDash([]),e.lineWidth=o/(N+1)/20,e.strokeStyle=t.color||"#999999",e.moveTo(u-rt*3*Math.cos(X),c+rt*3*Math.sin(X)),e.lineTo(u+G*Math.cos(X),c-G*Math.sin(X)),e.stroke()}else{let N=(t.startAngle-(f-t.min)/(t.max-t.min)*v)/180*Math.PI,X=4/5*o,G=o*1/40;e.beginPath(),e.setLineDash([]),e.lineWidth=2,e.fillStyle=g,e.moveTo(u-G*3*Math.cos(N),c+G*3*Math.sin(N)),e.lineTo(u+G*Math.cos(N-Math.PI/2),c-G*Math.sin(N-Math.PI/2)),e.lineTo(u+X*Math.cos(N),c-X*Math.sin(N)),e.lineTo(u+G*Math.cos(N+Math.PI/2),c-G*Math.sin(N+Math.PI/2)),e.lineTo(u-G*3*Math.cos(N),c+G*3*Math.sin(N)),e.fill()}e.beginPath(),e.textAlign="center",e.textBaseline="middle";let nt={fontStyle:((et=t.titleLabel)==null?void 0:et.fontStyle)||t.calculative.fontStyle,textDecoration:((ut=t.titleLabel)==null?void 0:ut.textDecoration)||t.textDecoration,fontWeight:((ct=t.titleLabel)==null?void 0:ct.fontWeight)||t.calculative.fontWeight,fontFamily:((ot=t.titleLabel)==null?void 0:ot.fontFamily)||t.calculative.fontFamily,fontSize:(((b=t.titleLabel)==null?void 0:b.fontSize)||t.calculative.fontSize)*r,lineHeight:((E=t.titleLabel)==null?void 0:E.lineHeight)||t.calculative.lineHeight};e.font=Le(nt),e.fillStyle=((S=t.titleLabel)==null?void 0:S.color)||g,t.isClock?e.fillText(("0"+parseInt(t.hourvalue)).slice(-2)+":"+("0"+parseInt(t.minutevalue)).slice(-2)+":"+("0"+parseInt(t.secondvalue)).slice(-2),u,c+o/2):e.fillText(f+" "+(t.unit||""),u,c+o/2),e.fill(),t.isClock&&(e.beginPath(),e.fillStyle=t.color||"#999999",e.strokeStyle="#ffffff",e.arc(u,c,o/20,0,Math.PI*2),e.stroke(),e.fill(),e.closePath())}function JA(e){if(e.isClock)e.clockInterval=setInterval(()=>{let t=new Date,i=t.getSeconds(),a=t.getMinutes()+i/60,s=t.getHours()%12+a/60;e.calculative.canvas.parent.setValue({id:e.id,hourvalue:s,minutevalue:a,secondvalue:i},{render:!0,doEvent:!1})},1e3);else{const t=e.value;e.value=0,e.frames=[{duration:2e3,value:t}],e.calculative.canvas.parent.startAnimate(e.id),setTimeout(()=>{e.value=t},1e3)}}function QA(e){e.clockInterval&&(clearInterval(e.clockInterval),e.clockInterval=void 0)}function tk(e){e.isClock&&(e.onDestroy(e),e.onAdd(e))}function _5(){return{lineChart:YA,histogram:GA,pieChart:KA,gauge:ZA}}function ek(e,t){const i=t||new Path2D,{x:a,y:s,width:n,height:r}=e.calculative.worldRect;if(i.rect(a,s,n,r),i.closePath(),i instanceof Path2D)return i}function ik(e,t){var g;const i=(g=t.headHeight)!=null?g:50,{x:a,y:s,width:n,height:r,ey:l}=t.calculative.worldRect;let o=t.calculative.borderRadius||0,u=o;t.calculative.borderRadius<1&&(o*=n,u*=r);let c=o<u?o:u;n<2*c&&(c=n/2),i<2*c&&(c=i/2),e.beginPath(),e.moveTo(a+c,s),e.arcTo(a+n,s,a+n,s+i,c),e.arcTo(a+n,s+i,a,s+i,c),e.arcTo(a,s+i,a,s,c),e.arcTo(a,s,a+n,s,c),e.closePath(),e.stroke(),e.save(),e.beginPath(),e.lineWidth=1,e.setLineDash([7,7]);const f=a+n/2;e.moveTo(f,s+i+1),e.lineTo(f,l),e.stroke(),e.restore()}function E5(){return{sequenceFocus:ek}}function A5(){return{lifeline:ik}}function ak(e,t){const i=t||new Path2D,{x:a,y:s,width:n,height:r}=e.calculative.worldRect,l=r/6,o=n/4;if(i.moveTo(a+o*2,s+0),i.lineTo(a+o*2,s+l),i.moveTo(a,s+l+o*2),i.arc(a+o*2,s+l+o*2,o*2,Math.PI*1,Math.PI*2,!1),i.lineTo(a+o*4,s+l*5),i.lineTo(a,s+l*5),i.lineTo(a,s+l+o*2),i.moveTo(a+o,s+l*5),i.lineTo(a+o,s+l*6),i.moveTo(a+o*2,s+l*5),i.lineTo(a+o*2,s+l*6),i.moveTo(a+o*3,s+l*5),i.lineTo(a+o*3,s+l*6),i.closePath(),i instanceof Path2D)return i}function jf(e){const t=[{x:.5,y:0},{x:.25,y:1},{x:.5,y:1},{x:.75,y:1}];e.anchors=t.map(({x:i,y:a},s)=>({id:`${s}`,penId:e.id,x:i,y:a}))}function sk(e,t){const i=t||new Path2D,{x:a,y:s,width:n,height:r}=e.calculative.worldRect,l=r-n,o=.5*n;if(i.moveTo(a+n/2,s),i.lineTo(a+n/2,s+l),i.moveTo(a+n,s+o+l),i.arc(a+n/2,s+o+l,o,0,Math.PI*2,!1),i.closePath(),i instanceof Path2D)return i}function qf(e){const t=[{x:.5,y:0},{x:.5,y:1}];e.anchors=t.map(({x:i,y:a},s)=>({id:`${s}`,penId:e.id,x:i,y:a}))}function nk(e,t){const i=t||new Path2D,{x:a,y:s,width:n,height:r}=e.calculative.worldRect,l=r/2,o=n/5;if(i.moveTo(a,s+l),i.lineTo(a+o,s+l),i.moveTo(a+o*5,s+l),i.ellipse(a+o*3,s+l,2*o,l,0,0,Math.PI*2),i.closePath(),i instanceof Path2D)return i}function rk(e){const t=[{x:.6,y:0},{x:1,y:.5},{x:.6,y:1},{x:0,y:.5}];e.anchors=t.map(({x:i,y:a},s)=>({id:`${s}`,penId:e.id,x:i,y:a}))}function ok(e,t){const i=t||new Path2D,{x:a,y:s,width:n,height:r}=e.calculative.worldRect,l=r/4,o=.5*n;if(i.moveTo(a+o,s),i.lineTo(a+o,s+l),i.moveTo(a,s+l),i.rect(a,s+l,o*2,l*2),i.moveTo(a+o,s+3*l),i.lineTo(a+o,s+4*l),i.closePath(),i instanceof Path2D)return i}function lk(e,t){const i=t||new Path2D,{x:a,y:s,width:n,height:r}=e.calculative.worldRect,l=r/8,o=.25*n;if(i.moveTo(a+o*2,s),i.lineTo(a+o*2,s+l*2),i.lineTo(a+o*3,s+l*3),i.lineTo(a+o*3,s+l*5),i.lineTo(a+o*2,s+l*6),i.lineTo(a+o*1,s+l*5),i.lineTo(a+o*1,s+l*3),i.lineTo(a+o*2,s+l*2),i.moveTo(a+o*3,s+l*4),i.lineTo(a+o*4,s+l*4),i.moveTo(a+o*2,s+l*6),i.lineTo(a+o*2,s+l*8),i.closePath(),i instanceof Path2D)return i}function ck(e){const t=[{x:.5,y:0},{x:1,y:.5},{x:.5,y:1}];e.anchors=t.map(({x:i,y:a},s)=>({id:`${s}`,penId:e.id,x:i,y:a}))}function hk(e,t){const i=t||new Path2D,{x:a,y:s,width:n,height:r}=e.calculative.worldRect,l=n/2,o=r/10;if(i.moveTo(a+l,s),i.lineTo(a+l,s+o),i.moveTo(a+l,s+o),i.quadraticCurveTo(a+l*2,s+o,a+l*2,s+o*9),i.moveTo(a+l,s+o),i.quadraticCurveTo(a,s+o,a,s+o*9),i.quadraticCurveTo(a+l,s+o*6,a+l*2,s+o*9),i.moveTo(a+l,s+r*3/4),i.lineTo(a+l,s+r),i.moveTo(a+l*2/5,s+r*201/250),i.lineTo(a+l*2/5,s+r),i.moveTo(a+l*8/5,s+r*201/250),i.lineTo(a+l*8/5,s+r),i.closePath(),i instanceof Path2D)return i}function Yf(e){const t=[{x:.5,y:0},{x:.2,y:1},{x:.5,y:1},{x:.8,y:1}];e.anchors=t.map(({x:i,y:a},s)=>({id:`${s}`,penId:e.id,x:i,y:a}))}function uk(e,t){const i=t||new Path2D,{x:a,y:s,width:n,height:r}=e.calculative.worldRect,l=r/6,o=n/4;if(i.moveTo(a+o*2,s+0),i.lineTo(a+o*2,s+l),i.moveTo(a,s+l+o*2),i.arc(a+o*2,s+l+o*2,o*2,Math.PI*1,Math.PI*2,!1),i.lineTo(a+o*4,s+l*5),i.lineTo(a,s+l*5),i.lineTo(a,s+l+o*2),i.moveTo(a,s+l*5-l/3),i.lineTo(a+o*4,s+l*5-l/3),i.moveTo(a+o,s+l*5),i.lineTo(a+o,s+l*6),i.moveTo(a+o*2,s+l*5),i.lineTo(a+o*2,s+l*6),i.moveTo(a+o*3,s+l*5),i.lineTo(a+o*3,s+l*6),i.closePath(),i instanceof Path2D)return i}function fk(e,t){const i=t||new Path2D,{x:a,y:s,width:n,height:r}=e.calculative.worldRect,l=r/4,o=.5*n;if(i.moveTo(a+o,s),i.lineTo(a+o,s+l),i.lineTo(a+o*2,s+l*2),i.lineTo(a+o*2,s+l*4),i.lineTo(a,s+l*4),i.lineTo(a,s+l*2),i.lineTo(a+o,s+l),i.closePath(),i instanceof Path2D)return i}function dk(e,t){const i=t||new Path2D,{x:a,y:s,width:n,height:r}=e.calculative.worldRect,l=r/4,o=n/2;if(i.moveTo(a+o,s),i.lineTo(a+o,s+l),i.lineTo(a+o*2,s+l*4),i.lineTo(a,s+l*4),i.lineTo(a+o,s+l),i.closePath(),i instanceof Path2D)return i}function gk(e,t){const i=t||new Path2D,{x:a,y:s,width:n,height:r}=e.calculative.worldRect,l=r/3,o=.5*n;if(i.moveTo(a+o,s),i.lineTo(a+o,s+l),i.lineTo(a+n,s+2*l),i.lineTo(a+o,s+r),i.lineTo(a,s+2*l),i.lineTo(a+o,s+l),i.closePath(),i instanceof Path2D)return i}function vk(e){const t=[{x:.5,y:0},{x:1,y:.6666666666666666},{x:.5,y:1},{x:0,y:.6666666666666666}];e.anchors=t.map(({x:i,y:a},s)=>({id:`${s}`,penId:e.id,x:i,y:a}))}function mk(e,t){const i=t||new Path2D,{x:a,y:s,width:n,height:r}=e.calculative.worldRect;let l=n/2,o=r/10;if(i.moveTo(a+l,s),i.lineTo(a+l,s+o),i.moveTo(a+l,s+o),i.quadraticCurveTo(a+l*2,s+o,a+l*2,s+o*9),i.moveTo(a+l,s+o),i.quadraticCurveTo(a,s+o,a,s+o*9),i.quadraticCurveTo(a+l,s+o*6,a+l*2,s+o*9),i.moveTo(a,s+o*10),i.quadraticCurveTo(a+l,s+o*7,a+l*2,s+o*10),i.moveTo(a+l*2/5,s+r*201/250+o),i.lineTo(a+l*2/5,s+r),i.moveTo(a+l*8/5,s+r*201/250+o),i.lineTo(a+l*8/5,s+r),i.closePath(),i instanceof Path2D)return i}function yk(e){const t=[{x:.5,y:0},{x:.2,y:1},{x:.8,y:1}];e.anchors=t.map(({x:i,y:a},s)=>({id:`${s}`,penId:e.id,x:i,y:a}))}function pk(e,t){const{x:i,y:a,width:s,height:n}=t.calculative.worldRect,r=s/2,l=n/10;e.beginPath(),e.moveTo(i+r,a),e.lineTo(i+r,a+l),e.moveTo(i+r,a+l),e.quadraticCurveTo(i+r*2,a+l,i+r*2,a+l*9),e.moveTo(i+r,a+l),e.quadraticCurveTo(i,a+l,i,a+l*9),e.quadraticCurveTo(i+r,a+l*6,i+r*2,a+l*9),e.moveTo(i+r,a+n*3/4),e.lineTo(i+r,a+n*9/10),e.moveTo(i+r*2/5,a+n*201/250),e.lineTo(i+r*2/5,a+n*9/10),e.moveTo(i+r*8/5,a+n*201/250),e.lineTo(i+r*8/5,a+n*9/10),e.stroke(),e.closePath(),e.beginPath();const o=r*2>l*10?l:r/5;e.fillStyle="#333333",e.font=o+"px Arial",e.textBaseline="bottom",e.textAlign="center",e.fillText("o",i+r,a+n),e.fillText("m",i+r*2/5,a+n),e.fillText("o",i+r*8/5,a+n),e.closePath()}function k5(){return{andGate:ak,basicEvent:sk,conditionalEvent:nk,event:ok,forbiddenGate:lk,orGate:hk,priorityAndGate:uk,switchEvent:fk,transferSymbol:dk,unexpandedEvent:gk,xorGate:mk}}function C5(){return{votingGate:pk}}function F5(){return{andGate:jf,orGate:Yf,priorityAndGate:jf,votingGate:Yf,xorGate:yk,forbiddenGate:ck,basicEvent:qf,unexpandedEvent:vk,conditionalEvent:rk,transferSymbol:qf}}const R5={background:"#ECE5E5",color:"#fff",textColor:"#fff",anchorColor:"#f90",gridSize:30,grid:!1,gridColor:"rgba(255,255,255,0.1)",drawingLineName:"line"},T5=[{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"}],P5=["triangle","diamond","circle","lineDown","lineUp","triangleSolid","diamondSolid","circleSolid","line"],S5=["#000","#fff","#f00","#0f0","rgba(255,255,255,0.5)"],Lg={name:"\u6309\u94AE\u5F00\u5173",show:!0,list:[{name:"Lifter\uFF08\u5347\u964D\u673A\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6309\u94AE\u5F00\u5173/Lifter\uFF08\u5347\u964D\u673A\uFF09.svg"}},{name:"Light- green\uFF08\u7EFF\u706F\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6309\u94AE\u5F00\u5173/Light- green\uFF08\u7EFF\u706F\uFF09.svg"}},{name:"Light- red\uFF08\u7EA2\u706F\uFF09 (2).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6309\u94AE\u5F00\u5173/Light- red\uFF08\u7EA2\u706F\uFF09 (2).svg"}},{name:"iot-\u6309\u94AE_3-D black button(3d\u9ED1\u8272\u6309\u94AE).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6309\u94AE\u5F00\u5173/iot-\u6309\u94AE_3-D black button(3d\u9ED1\u8272\u6309\u94AE).svg"}},{name:"iot-\u6309\u94AE_3-D blue button\uFF083d\u84DD\u8272\u6309\u94AE\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6309\u94AE\u5F00\u5173/iot-\u6309\u94AE_3-D blue button\uFF083d\u84DD\u8272\u6309\u94AE\uFF09.svg"}},{name:"iot-\u6309\u94AE_3-D green button\uFF083d\u7EFF\u8272\u6309\u94AE\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6309\u94AE\u5F00\u5173/iot-\u6309\u94AE_3-D green button\uFF083d\u7EFF\u8272\u6309\u94AE\uFF09.svg"}},{name:"iot-\u6309\u94AE_3-D red button\uFF083d\u7EA2\u8272\u6309\u94AE\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6309\u94AE\u5F00\u5173/iot-\u6309\u94AE_3-D red button\uFF083d\u7EA2\u8272\u6309\u94AE\uFF09.svg"}},{name:"iot-\u6309\u94AE_3-D yellow button\uFF083d\u9EC4\u8272\u6309\u94AE\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6309\u94AE\u5F00\u5173/iot-\u6309\u94AE_3-D yellow button\uFF083d\u9EC4\u8272\u6309\u94AE\uFF09.svg"}},{name:"iot-\u6309\u94AE_Blue pilot light\uFF08\u84DD\u8272\u6307\u793A\u706F\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6309\u94AE\u5F00\u5173/iot-\u6309\u94AE_Blue pilot light\uFF08\u84DD\u8272\u6307\u793A\u706F\uFF09.svg"}},{name:"iot-\u6309\u94AE_Button \uFF08\u6309\u94AE\uFF09-10.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6309\u94AE\u5F00\u5173/iot-\u6309\u94AE_Button \uFF08\u6309\u94AE\uFF09-10.svg"}},{name:"iot-\u6309\u94AE_Button \uFF08\u6309\u94AE\uFF09-13.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6309\u94AE\u5F00\u5173/iot-\u6309\u94AE_Button \uFF08\u6309\u94AE\uFF09-13.svg"}},{name:"iot-\u6309\u94AE_Dark green pilot light\uFF08\u6DF1\u7EFF\u8272\u6307\u793A\u706F\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6309\u94AE\u5F00\u5173/iot-\u6309\u94AE_Dark green pilot light\uFF08\u6DF1\u7EFF\u8272\u6307\u793A\u706F\uFF09.svg"}},{name:"iot-\u6309\u94AE_Dial \uFF08\u8868\u76D8\uFF09-15.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6309\u94AE\u5F00\u5173/iot-\u6309\u94AE_Dial \uFF08\u8868\u76D8\uFF09-15.svg"}},{name:"iot-\u6309\u94AE_Dial \uFF08\u8868\u76D8\uFF09-16.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6309\u94AE\u5F00\u5173/iot-\u6309\u94AE_Dial \uFF08\u8868\u76D8\uFF09-16.svg"}},{name:"iot-\u6309\u94AE_Dial \uFF08\u8868\u76D8\uFF09-17.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6309\u94AE\u5F00\u5173/iot-\u6309\u94AE_Dial \uFF08\u8868\u76D8\uFF09-17.svg"}},{name:"iot-\u6309\u94AE_Dial \uFF08\u8868\u76D8\uFF09-18.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6309\u94AE\u5F00\u5173/iot-\u6309\u94AE_Dial \uFF08\u8868\u76D8\uFF09-18.svg"}},{name:"iot-\u6309\u94AE_Long flip switch (\u957F\u7FFB\u8F6C\u5F00\u5173\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6309\u94AE\u5F00\u5173/iot-\u6309\u94AE_Long flip switch (\u957F\u7FFB\u8F6C\u5F00\u5173\uFF09.svg"}},{name:"iot-\u6309\u94AE_Navy pilot light\uFF08\u6D77\u519B\u9886\u822A\u706F\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6309\u94AE\u5F00\u5173/iot-\u6309\u94AE_Navy pilot light\uFF08\u6D77\u519B\u9886\u822A\u706F\uFF09.svg"}},{name:"iot-\u6309\u94AE_Pilot light (off)\uFF08\u6307\u793A\u706F\uFF08\u5173\uFF09\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6309\u94AE\u5F00\u5173/iot-\u6309\u94AE_Pilot light (off)\uFF08\u6307\u793A\u706F\uFF08\u5173\uFF09\uFF09.svg"}},{name:"iot-\u6309\u94AE_Rectangular pushbutton\uFF08\u77E9\u5F62\u6309\u94AE\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6309\u94AE\u5F00\u5173/iot-\u6309\u94AE_Rectangular pushbutton\uFF08\u77E9\u5F62\u6309\u94AE\uFF09.svg"}},{name:"iot-\u6309\u94AE_Red pilot light\uFF08\u7EA2\u8272\u4FE1\u53F7\u706F\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6309\u94AE\u5F00\u5173/iot-\u6309\u94AE_Red pilot light\uFF08\u7EA2\u8272\u4FE1\u53F7\u706F\uFF09.svg"}},{name:"iot-\u6309\u94AE_Red pushbutton\uFF08\u7EA2\u8272\u6309\u94AE\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6309\u94AE\u5F00\u5173/iot-\u6309\u94AE_Red pushbutton\uFF08\u7EA2\u8272\u6309\u94AE\uFF09.svg"}},{name:"iot-\u6309\u94AE_Rocker switch\uFF08\u7FD8\u677F\u5F00\u5173\uFF09-27.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6309\u94AE\u5F00\u5173/iot-\u6309\u94AE_Rocker switch\uFF08\u7FD8\u677F\u5F00\u5173\uFF09-27.svg"}},{name:"iot-\u6309\u94AE_Slider \uFF08\u6ED1\u5757\uFF09-40.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6309\u94AE\u5F00\u5173/iot-\u6309\u94AE_Slider \uFF08\u6ED1\u5757\uFF09-40.svg"}},{name:"iot-\u6309\u94AE_Slider \uFF08\u6ED1\u5757\uFF09-41.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6309\u94AE\u5F00\u5173/iot-\u6309\u94AE_Slider \uFF08\u6ED1\u5757\uFF09-41.svg"}},{name:"iot-\u6309\u94AE_Start button \uFF08\u542F\u52A8\u6309\u94AE\uFF09-47.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6309\u94AE\u5F00\u5173/iot-\u6309\u94AE_Start button \uFF08\u542F\u52A8\u6309\u94AE\uFF09-47.svg"}},{name:"iot-\u6309\u94AE_Throw switch (\u8F6C\u6362\u5F00\u5173\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6309\u94AE\u5F00\u5173/iot-\u6309\u94AE_Throw switch (\u8F6C\u6362\u5F00\u5173\uFF09.svg"}},{name:"iot-\u6309\u94AE_White pilot light\uFF08\u767D\u8272\u6307\u793A\u706F\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6309\u94AE\u5F00\u5173/iot-\u6309\u94AE_White pilot light\uFF08\u767D\u8272\u6307\u793A\u706F\uFF09.svg"}},{name:"iot-\u6309\u94AE_Yellow pushbutton(\u9EC4\u8272\u6309\u94AE).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6309\u94AE\u5F00\u5173/iot-\u6309\u94AE_Yellow pushbutton(\u9EC4\u8272\u6309\u94AE).svg"}},{name:"iot-\u6309\u94AE_pilot light\uFF08\u6307\u793A\u706F\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6309\u94AE\u5F00\u5173/iot-\u6309\u94AE_pilot light\uFF08\u6307\u793A\u706F\uFF09.svg"}}]},Mg={name:"\u673A\u68B0\u8BBE\u5907",show:!0,list:[{name:"AGI mixer(AGI\u6DF7\u5408\u5668).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/AGI mixer(AGI\u6DF7\u5408\u5668).svg"}},{name:"Airswept tubular dryer(\u6C14\u6D41\u7BA1\u5F0F\u5E72\u71E5\u673A).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Airswept tubular dryer(\u6C14\u6D41\u7BA1\u5F0F\u5E72\u71E5\u673A).svg"}},{name:"Bag dump station(\u5378\u888B\u7AD9).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Bag dump station(\u5378\u888B\u7AD9).svg"}},{name:"Baghouse dust collector\uFF08\u888B\u5F0F\u9664\u5C18\u5668\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Baghouse dust collector\uFF08\u888B\u5F0F\u9664\u5C18\u5668\uFF09.svg"}},{name:"Ball mill(\u7403\u78E8\u673A).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Ball mill(\u7403\u78E8\u673A).svg"}},{name:"Cartridge dust collector\uFF08\u7B80\u5F0F\u9664\u5C18\u5668\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Cartridge dust collector\uFF08\u7B80\u5F0F\u9664\u5C18\u5668\uFF09.svg"}},{name:"Centrifugal type sifter(\u79BB\u5FC3\u5F0F\u7B5B).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Centrifugal type sifter(\u79BB\u5FC3\u5F0F\u7B5B).svg"}},{name:"Centrifuge(\u79BB\u5FC3\u673A).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Centrifuge(\u79BB\u5FC3\u673A).svg"}},{name:"Clarifier(\u6F84\u6E05\u5668).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Clarifier(\u6F84\u6E05\u5668).svg"}},{name:"Colloid mixer\uFF08\u80F6\u4F53\u6DF7\u5408\u5668\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Colloid mixer\uFF08\u80F6\u4F53\u6DF7\u5408\u5668\uFF09.svg"}},{name:"Compact spray dryer\uFF08\u7D27\u51D1\u578B\u55B7\u96FE\u5E72\u71E5\u5668 \uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Compact spray dryer\uFF08\u7D27\u51D1\u578B\u55B7\u96FE\u5E72\u71E5\u5668 \uFF09.svg"}},{name:"Cone crusher\uFF08\u5706\u9525\u7834\u788E\u673A\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Cone crusher\uFF08\u5706\u9525\u7834\u788E\u673A\uFF09.svg"}},{name:"Conical screw processor\uFF08\u9525\u5F62\u87BA\u6746\u5904\u7406\u673A\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Conical screw processor\uFF08\u9525\u5F62\u87BA\u6746\u5904\u7406\u673A\uFF09.svg"}},{name:"Cyclone \uFF08\u65CB\u98CE\u5206\u79BB\u5668\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Cyclone \uFF08\u65CB\u98CE\u5206\u79BB\u5668\uFF09.svg"}},{name:"Double roll crusher(\u53CC\u8F8A\u7834\u788E\u673A)-27.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Double roll crusher(\u53CC\u8F8A\u7834\u788E\u673A)-27.svg"}},{name:"Dryer-cooler\uFF08\u5E72\u71E5\u51B7\u5374\u5668\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Dryer-cooler\uFF08\u5E72\u71E5\u51B7\u5374\u5668\uFF09.svg"}},{name:"Dust collector (\u9664\u5C18\u5668).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Dust collector (\u9664\u5C18\u5668).svg"}},{name:"Dust reclaim\uFF08\u7C89\u5C18\u56DE\u6536\u5668\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Dust reclaim\uFF08\u7C89\u5C18\u56DE\u6536\u5668\uFF09.svg"}},{name:"Feeder\uFF08\u8FDB\u6599\u5668\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Feeder\uFF08\u8FDB\u6599\u5668\uFF09.svg"}},{name:"Flow meter\uFF08\u6D41\u91CF\u8BA1\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Flow meter\uFF08\u6D41\u91CF\u8BA1\uFF09.svg"}},{name:"Fluidizing conveyor\uFF08\u6DB2\u5316\u8F93\u9001\u673A\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Fluidizing conveyor\uFF08\u6DB2\u5316\u8F93\u9001\u673A\uFF09.svg"}},{name:"Gravimetric feeder (\u91CD\u529B\u7ED9\u6599\u673A).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Gravimetric feeder (\u91CD\u529B\u7ED9\u6599\u673A).svg"}},{name:"Hammermill \uFF08\u9524\u78E8\u673A\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Hammermill \uFF08\u9524\u78E8\u673A\uFF09.svg"}},{name:"Homomixer\uFF08\u5747\u8D28\u6DF7\u5408\u5668\uFF09 (1).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Homomixer\uFF08\u5747\u8D28\u6DF7\u5408\u5668\uFF09 (1).svg"}},{name:"Loss-in-weight feeder(\u5931\u91CD\u7ED9\u6599\u673A) .svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Loss-in-weight feeder(\u5931\u91CD\u7ED9\u6599\u673A) .svg"}},{name:"Loss-in-weight feeder(\u5931\u91CD\u7ED9\u6599\u673A).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Loss-in-weight feeder(\u5931\u91CD\u7ED9\u6599\u673A).svg"}},{name:"Meter 1(\u4EEA\u88681).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Meter 1(\u4EEA\u88681).svg"}},{name:"Meter 10(\u4EEA\u886810).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Meter 10(\u4EEA\u886810).svg"}},{name:"Meter 11(\u4EEA\u886811).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Meter 11(\u4EEA\u886811).svg"}},{name:"Meter 12(\u4EEA\u886812).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Meter 12(\u4EEA\u886812).svg"}},{name:"Meter 2(\u4EEA\u88682).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Meter 2(\u4EEA\u88682).svg"}},{name:"Meter 4(\u4EEA\u88684).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Meter 4(\u4EEA\u88684).svg"}},{name:"Meter 6(\u4EEA\u88686).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Meter 6(\u4EEA\u88686).svg"}},{name:"Meter 7(\u4EEA\u88687).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Meter 7(\u4EEA\u88687).svg"}},{name:"Meter 8(\u4EEA\u88688).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Meter 8(\u4EEA\u88688).svg"}},{name:"Meter 9(\u4EEA\u88689).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Meter 9(\u4EEA\u88689).svg"}},{name:"Meter3(\u4EEA\u88683).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Meter3(\u4EEA\u88683).svg"}},{name:"Meter5(\u4EEA\u88685).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Meter5(\u4EEA\u88685).svg"}},{name:"Mill classification system(\u78E8\u673A\u5206\u7EA7\u7CFB\u7EDF).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Mill classification system(\u78E8\u673A\u5206\u7EA7\u7CFB\u7EDF).svg"}},{name:"Particles(\u7C92\u5B50).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Particles(\u7C92\u5B50).svg"}},{name:"Silo \uFF08\u7B52\u4ED3\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Silo \uFF08\u7B52\u4ED3\uFF09.svg"}},{name:"Spiral conveyor with hopper(\u5E26\u6599\u6597\u7684\u87BA\u65CB\u8F93\u9001\u673A).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Spiral conveyor with hopper(\u5E26\u6599\u6597\u7684\u87BA\u65CB\u8F93\u9001\u673A).svg"}},{name:"Stainless steel heavy-duty mixer(\u4E0D\u9508\u94A2\u91CD\u578B\u6405\u62CC\u673A).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Stainless steel heavy-duty mixer(\u4E0D\u9508\u94A2\u91CD\u578B\u6405\u62CC\u673A).svg"}},{name:"Steam boiler 1(\u84B8\u6C7D\u9505\u70891).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Steam boiler 1(\u84B8\u6C7D\u9505\u70891).svg"}},{name:"Three-stage wet collector\uFF08\u4E09\u7EA7\u6E7F\u5F0F\u6536\u96C6\u5668\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Three-stage wet collector\uFF08\u4E09\u7EA7\u6E7F\u5F0F\u6536\u96C6\u5668\uFF09.svg"}},{name:"Truck loader(\u6C7D\u8F66\u88C5\u8F7D\u673A).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Truck loader(\u6C7D\u8F66\u88C5\u8F7D\u673A).svg"}},{name:"Vacuum pressure unloader\uFF08\u771F\u7A7A\u51CF\u538B\u5668\uFF09-53.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Vacuum pressure unloader\uFF08\u771F\u7A7A\u51CF\u538B\u5668\uFF09-53.svg"}},{name:"Vertical shaft impactor\u7ACB\u8F74\u51B2\u51FB\u5668).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Vertical shaft impactor\u7ACB\u8F74\u51B2\u51FB\u5668).svg"}},{name:"Vibrating bin discharger with dual outlets\uFF08\u53CC\u51FA\u53E3\u632F\u52A8\u6599\u4ED3\u5378\u6599\u5668\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Vibrating bin discharger with dual outlets\uFF08\u53CC\u51FA\u53E3\u632F\u52A8\u6599\u4ED3\u5378\u6599\u5668\uFF09.svg"}},{name:"Volumatic feeder machine\uFF08\u5BB9\u79EF\u5F0F\u7ED9\u6599\u673A\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Volumatic feeder machine\uFF08\u5BB9\u79EF\u5F0F\u7ED9\u6599\u673A\uFF09.svg"}},{name:"Volumetric feeder(\u5BB9\u91CF\u7ED9\u6599\u673A).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Volumetric feeder(\u5BB9\u91CF\u7ED9\u6599\u673A).svg"}},{name:"Wire mesh container(\u91D1\u5C5E\u4E1D\u7F51\u5BB9\u5668).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Wire mesh container(\u91D1\u5C5E\u4E1D\u7F51\u5BB9\u5668).svg"}},{name:"hopper(\u6F0F\u6597).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/hopper(\u6F0F\u6597).svg"}},{name:"truck(\u5361\u8F66).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/truck(\u5361\u8F66).svg"}}]},Og={name:"\u6C34\u5229\u8BBE\u5907",show:!0,list:[{name:"3-D 3-way solenoid valve with reset(\u5E26\u590D\u4F4D\u529F\u80FD\u76843d\u4E09\u901A\u7535\u78C1\u9600).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/3-D 3-way solenoid valve with reset(\u5E26\u590D\u4F4D\u529F\u80FD\u76843d\u4E09\u901A\u7535\u78C1\u9600).svg"}},{name:"3-D 3-way solenoid valve\uFF083d\u4E09\u901A\u7535\u78C1\u9600\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/3-D 3-way solenoid valve\uFF083d\u4E09\u901A\u7535\u78C1\u9600\uFF09.svg"}},{name:"3-D 3-way valve\uFF083d\u4E09\u901A\u9600\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/3-D 3-way valve\uFF083d\u4E09\u901A\u9600\uFF09.svg"}},{name:"3-D 4-way valve\uFF083d\u56DB\u901A\u9600\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/3-D 4-way valve\uFF083d\u56DB\u901A\u9600\uFF09.svg"}},{name:"3-D Angle blowdown valve\uFF08\u4E09\u7EF4\u89D2\u6392\u6C61\u9600\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/3-D Angle blowdown valve\uFF08\u4E09\u7EF4\u89D2\u6392\u6C61\u9600\uFF09.svg"}},{name:"3-D Plug valve\uFF083d\u65CB\u585E\u9600\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/3-D Plug valve\uFF083d\u65CB\u585E\u9600\uFF09.svg"}},{name:"3-D Regulator with external pressure tap\uFF08\u5E26\u5916\u90E8\u6D4B\u538B\u53E3\u76843d\u8C03\u8282\u5668\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/3-D Regulator with external pressure tap\uFF08\u5E26\u5916\u90E8\u6D4B\u538B\u53E3\u76843d\u8C03\u8282\u5668\uFF09.svg"}},{name:"3-D Stop check valve\uFF083d\u622A\u6B62\u6B62\u56DE\u9600\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/3-D Stop check valve\uFF083d\u622A\u6B62\u6B62\u56DE\u9600\uFF09.svg"}},{name:"3-D Valve,fail locked\uFF083d\u9600 \u6545\u969C\u9501\u5B9A\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/3-D Valve,fail locked\uFF083d\u9600 \u6545\u969C\u9501\u5B9A\uFF09.svg"}},{name:"3-D Valve\uFF083d\u9600\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/3-D Valve\uFF083d\u9600\uFF09.svg"}},{name:"3-d pump(3d\u6CF5).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/3-d pump(3d\u6CF5).svg"}},{name:"Aeration basin 1\uFF08\u66DD\u6C14\u6C60\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Aeration basin 1\uFF08\u66DD\u6C14\u6C60\uFF09.svg"}},{name:"Aeration basin 2\uFF08\u66DD\u6C14\u6C60\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Aeration basin 2\uFF08\u66DD\u6C14\u6C60\uFF09.svg"}},{name:"Aeration digester \uFF08\u66DD\u6C14\u6C60).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Aeration digester \uFF08\u66DD\u6C14\u6C60).svg"}},{name:"Air diffuser system(\u7A7A\u6C14\u6269\u6563\u7CFB\u7EDF).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Air diffuser system(\u7A7A\u6C14\u6269\u6563\u7CFB\u7EDF).svg"}},{name:"Anaerobic sequencing batch reactor\uFF08\u538C\u6C27\u5E8F\u6279\u5F0F\u53CD\u5E94\u5668\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Anaerobic sequencing batch reactor\uFF08\u538C\u6C27\u5E8F\u6279\u5F0F\u53CD\u5E94\u5668\uFF09.svg"}},{name:"Ash disposal pond\uFF08\u7070\u6E23\u5904\u7406\u6C60\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Ash disposal pond\uFF08\u7070\u6E23\u5904\u7406\u6C60\uFF09.svg"}},{name:"Asphalt filter\uFF08\u6CA5\u9752\u8FC7\u6EE4\u5668\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Asphalt filter\uFF08\u6CA5\u9752\u8FC7\u6EE4\u5668\uFF09.svg"}},{name:"Bag filtration system\uFF08\u888B\u5F0F\u8FC7\u6EE4\u7CFB\u7EDF\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Bag filtration system\uFF08\u888B\u5F0F\u8FC7\u6EE4\u7CFB\u7EDF\uFF09.svg"}},{name:"Ball valve \uFF08\u7403\u5F62\u9600\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Ball valve \uFF08\u7403\u5F62\u9600\uFF09.svg"}},{name:"Belt filter press\uFF08\u5E26\u5F0F\u8FC7\u6EE4\u5668\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Belt filter press\uFF08\u5E26\u5F0F\u8FC7\u6EE4\u5668\uFF09.svg"}},{name:"Biological treatment plant\uFF08\u751F\u7269\u5904\u7406\u5382\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Biological treatment plant\uFF08\u751F\u7269\u5904\u7406\u5382\uFF09.svg"}},{name:"Blue control valve with no flange\uFF08\u6CD5\u5170\u63A7\u5236\u9600\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Blue control valve with no flange\uFF08\u6CD5\u5170\u63A7\u5236\u9600\uFF09.svg"}},{name:"Carbon absorber\uFF08\u78B3\u5438\u6536\u5668\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Carbon absorber\uFF08\u78B3\u5438\u6536\u5668\uFF09.svg"}},{name:"Central Water Purifier\uFF08\u4E2D\u592E\u51C0\u6C34\u5668\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Central Water Purifier\uFF08\u4E2D\u592E\u51C0\u6C34\u5668\uFF09.svg"}},{name:"Central Water Softener\uFF08\u4E2D\u592E\u8F6F\u6C34\u5668\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Central Water Softener\uFF08\u4E2D\u592E\u8F6F\u6C34\u5668\uFF09.svg"}},{name:"Centrifugal pump (\u79BB\u5FC3\u6CF5).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Centrifugal pump (\u79BB\u5FC3\u6CF5).svg"}},{name:"Centrifugal pump with integral pump-motor shaft\uFF08\u6574\u4F53\u6CF5\u7535\u673A\u8F74\u79BB\u5FC3\u6CF5\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Centrifugal pump with integral pump-motor shaft\uFF08\u6574\u4F53\u6CF5\u7535\u673A\u8F74\u79BB\u5FC3\u6CF5\uFF09.svg"}},{name:"Centrifugal thermoplastic pump(\u79BB\u5FC3\u70ED\u5851\u6027\u5851\u6599\u6CF5).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Centrifugal thermoplastic pump(\u79BB\u5FC3\u70ED\u5851\u6027\u5851\u6599\u6CF5).svg"}},{name:"Check valve - Vertical\uFF08\u5782\u76F4\u5355\u5411\u9600\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Check valve - Vertical\uFF08\u5782\u76F4\u5355\u5411\u9600\uFF09.svg"}},{name:"Check valve - horizontal\uFF08\u6C34\u5E73\u5355\u5411\u9600\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Check valve - horizontal\uFF08\u6C34\u5E73\u5355\u5411\u9600\uFF09.svg"}},{name:"Chemical feeder\uFF08\u5316\u5B66\u52A0\u6599\u5668\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Chemical feeder\uFF08\u5316\u5B66\u52A0\u6599\u5668\uFF09.svg"}},{name:"Chemical pump (\u5316\u5B66\u6CF5).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Chemical pump (\u5316\u5B66\u6CF5).svg"}},{name:"Chlorinator\uFF08\u6C2F\u5316\u5668\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Chlorinator\uFF08\u6C2F\u5316\u5668\uFF09.svg"}},{name:"Civic Tap Water\uFF08\u57CE\u5E02\u81EA\u6765\u6C34\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Civic Tap Water\uFF08\u57CE\u5E02\u81EA\u6765\u6C34\uFF09.svg"}},{name:"Clarifier\uFF08\u6F84\u6E05\u6C60\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Clarifier\uFF08\u6F84\u6E05\u6C60\uFF09.svg"}},{name:"Combustion turbine\uFF08\u71C3\u70E7\u5F0F\u6DA1\u8F6E\u673A\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Combustion turbine\uFF08\u71C3\u70E7\u5F0F\u6DA1\u8F6E\u673A\uFF09.svg"}},{name:"Container\uFF08\u5BB9\u5668\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Container\uFF08\u5BB9\u5668\uFF09.svg"}},{name:"Control value\uFF08\u63A7\u5236\u9600\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Control value\uFF08\u63A7\u5236\u9600\uFF09.svg"}},{name:"Control valve - horizontal\uFF08\u6C34\u5E73\u63A7\u5236\u9600\uFF09 (2).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Control valve - horizontal\uFF08\u6C34\u5E73\u63A7\u5236\u9600\uFF09 (2).svg"}},{name:"Control valve - horizontal\uFF08\u6C34\u5E73\u63A7\u5236\u9600\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Control valve - horizontal\uFF08\u6C34\u5E73\u63A7\u5236\u9600\uFF09.svg"}},{name:"Corrosion resistant submersible pump(\u8010\u8150\u8680\u6F5C\u6C34\u6CF5).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Corrosion resistant submersible pump(\u8010\u8150\u8680\u6F5C\u6C34\u6CF5).svg"}},{name:"Covered dome tank(\u6709\u76D6\u62F1\u9876\u7F50).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Covered dome tank(\u6709\u76D6\u62F1\u9876\u7F50).svg"}},{name:"Dewatering system\uFF08\u8131\u6C34\u7CFB\u7EDF\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Dewatering system\uFF08\u8131\u6C34\u7CFB\u7EDF\uFF09.svg"}},{name:"Diaphragm pump(\u9694\u819C\u6CF5).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Diaphragm pump(\u9694\u819C\u6CF5).svg"}},{name:"Digester gas tanks\uFF08\u6CBC\u6C14\u6C60\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Digester gas tanks\uFF08\u6CBC\u6C14\u6C60\uFF09.svg"}},{name:"Digester\uFF08\u84B8\u716E\u5668\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Digester\uFF08\u84B8\u716E\u5668\uFF09.svg"}},{name:"Digestion Reaction Tank\uFF08\u6D88\u5316\u53CD\u5E94\u7F50\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Digestion Reaction Tank\uFF08\u6D88\u5316\u53CD\u5E94\u7F50\uFF09.svg"}},{name:"Disc and drum filter\uFF08\u76D8\u5F0F\u9F13\u5F0F\u8FC7\u6EE4\u5668\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Disc and drum filter\uFF08\u76D8\u5F0F\u9F13\u5F0F\u8FC7\u6EE4\u5668\uFF09.svg"}},{name:"Drain\uFF08\u6392\u6C34\u7BA1\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Drain\uFF08\u6392\u6C34\u7BA1\uFF09.svg"}},{name:"Environmental gas process\uFF08\u73AF\u5883\u6C14\u4F53\u5DE5\u827A\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Environmental gas process\uFF08\u73AF\u5883\u6C14\u4F53\u5DE5\u827A\uFF09.svg"}},{name:"Evaporation\uFF08\u84B8\u53D1\u5668\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Evaporation\uFF08\u84B8\u53D1\u5668\uFF09.svg"}},{name:"Evaporator\uFF08\u84B8\u53D1\u5668\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Evaporator\uFF08\u84B8\u53D1\u5668\uFF09.svg"}},{name:"Explosion-proof pump\uFF08\u9632\u7206\u6CF5\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Explosion-proof pump\uFF08\u9632\u7206\u6CF5\uFF09.svg"}},{name:"Flanged pump \uFF08\u6CD5\u5170\u6CF5\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Flanged pump \uFF08\u6CD5\u5170\u6CF5\uFF09.svg"}},{name:"Flat vessel 1\uFF08\u6241\u5E73\u5BB9\u5668\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Flat vessel 1\uFF08\u6241\u5E73\u5BB9\u5668\uFF09.svg"}},{name:"Flex-mounted centrifugal pump(\u6320\u6027\u79BB\u5FC3\u6CF5).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Flex-mounted centrifugal pump(\u6320\u6027\u79BB\u5FC3\u6CF5).svg"}},{name:"Gravity belt thickener(\u91CD\u529B\u76AE\u5E26\u6D53\u7F29\u673A).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Gravity belt thickener(\u91CD\u529B\u76AE\u5E26\u6D53\u7F29\u673A).svg"}},{name:"Hand valve \uFF08\u624B\u52A8\u9600\uFF09 (3).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Hand valve \uFF08\u624B\u52A8\u9600\uFF09 (3).svg"}},{name:"Hand valve \uFF08\u624B\u52A8\u9600\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Hand valve \uFF08\u624B\u52A8\u9600\uFF09.svg"}},{name:"High temp heat trans pump\uFF08\u9AD8\u6E29\u70ED\u6CF5\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/High temp heat trans pump\uFF08\u9AD8\u6E29\u70ED\u6CF5\uFF09.svg"}},{name:"Hot Living Water Tank\uFF08\u70ED\u751F\u6D3B\u6C34\u7BB1\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Hot Living Water Tank\uFF08\u70ED\u751F\u6D3B\u6C34\u7BB1\uFF09.svg"}},{name:"Inclined plate clarifier \uFF08\u659C\u677F\u6F84\u6E05\u6C60\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Inclined plate clarifier \uFF08\u659C\u677F\u6F84\u6E05\u6C60\uFF09.svg"}},{name:"Metering pump \uFF08\u8BA1\u91CF\u6CF5\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Metering pump \uFF08\u8BA1\u91CF\u6CF5\uFF09.svg"}},{name:"Motor valve(\u7535\u52A8\u9600).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Motor valve(\u7535\u52A8\u9600).svg"}},{name:"Oil pump\uFF08\u6CB9\u6CF5\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Oil pump\uFF08\u6CB9\u6CF5\uFF09.svg"}},{name:"PVC two-way ball valve\uFF08\u53CC\u901A\u9600\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/PVC two-way ball valve\uFF08\u53CC\u901A\u9600\uFF09.svg"}},{name:"Pinch valve\uFF08\u5939\u7BA1\u9600\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Pinch valve\uFF08\u5939\u7BA1\u9600\uFF09.svg"}},{name:"Positive displacement gear pump\uFF08\u5BB9\u79EF\u5F0F\u9F7F\u8F6E\u6CF5\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Positive displacement gear pump\uFF08\u5BB9\u79EF\u5F0F\u9F7F\u8F6E\u6CF5\uFF09.svg"}},{name:"Pressure vessel\uFF08\u538B\u529B\u5BB9\u5668\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Pressure vessel\uFF08\u538B\u529B\u5BB9\u5668\uFF09.svg"}},{name:"Pump station\uFF08\u6CF5\u7AD9\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Pump station\uFF08\u6CF5\u7AD9\uFF09.svg"}},{name:"Pumping trap\uFF08\u62BD\u6C34\u84C4\u80FD\u5668\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Pumping trap\uFF08\u62BD\u6C34\u84C4\u80FD\u5668\uFF09.svg"}},{name:"Rotary valve\uFF08\u65CB\u8F6C\u9600\uFF09 (2).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Rotary valve\uFF08\u65CB\u8F6C\u9600\uFF09 (2).svg"}},{name:"Rotary valve\uFF08\u65CB\u8F6C\u9600\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Rotary valve\uFF08\u65CB\u8F6C\u9600\uFF09.svg"}},{name:"Running state\uFF08\u8FD0\u884C\u72B6\u6001\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Running state\uFF08\u8FD0\u884C\u72B6\u6001\uFF09.svg"}},{name:"Safety valve\uFF08\u5B89\u5168\u9600\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Safety valve\uFF08\u5B89\u5168\u9600\uFF09.svg"}},{name:"Self-priming centrifugal pump\uFF08\u81EA\u5438\u79BB\u5FC3\u6CF5\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Self-priming centrifugal pump\uFF08\u81EA\u5438\u79BB\u5FC3\u6CF5\uFF09.svg"}},{name:"Sewage pump(\u6C61\u6C34\u6CF5).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Sewage pump(\u6C61\u6C34\u6CF5).svg"}},{name:"Simple tank\uFF08\u7B80\u6613\u7F50\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Simple tank\uFF08\u7B80\u6613\u7F50\uFF09.svg"}},{name:"Solids-handling self-priming pump(\u56FA\u4F53\u8F93\u9001\u81EA\u5438\u6CF5).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Solids-handling self-priming pump(\u56FA\u4F53\u8F93\u9001\u81EA\u5438\u6CF5).svg"}},{name:"Spherical tank\uFF08\u7403\u7F50\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Spherical tank\uFF08\u7403\u7F50\uFF09.svg"}},{name:"Standard-flange positive displacement pump(\u6807\u51C6\u6CD5\u5170\u5BB9\u79EF\u6CF5).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Standard-flange positive displacement pump(\u6807\u51C6\u6CD5\u5170\u5BB9\u79EF\u6CF5).svg"}},{name:"Submersible sump pump\uFF08\u6F5C\u6C34\u96C6\u6C34\u5751\u6CF5\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Submersible sump pump\uFF08\u6F5C\u6C34\u96C6\u6C34\u5751\u6CF5\uFF09.svg"}},{name:"Tank with hatch\uFF08\u5E26\u8231\u53E3\u7684\u6C34\u7BB1\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Tank with hatch\uFF08\u5E26\u8231\u53E3\u7684\u6C34\u7BB1\uFF09.svg"}},{name:"Threaded gear\uFF08\u87BA\u7EB9\u9F7F\u8F6E\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Threaded gear\uFF08\u87BA\u7EB9\u9F7F\u8F6E\uFF09.svg"}},{name:"Valve wheel\uFF08\u9600\u8F6E\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Valve wheel\uFF08\u9600\u8F6E\uFF09.svg"}},{name:"Vertical pump \uFF08\u7ACB\u5F0F\u6CF5\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Vertical pump \uFF08\u7ACB\u5F0F\u6CF5\uFF09.svg"}},{name:"cool pump(\u51B7\u5374\u6CF5).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/cool pump(\u51B7\u5374\u6CF5).svg"}},{name:"heavy-duty plastic centrifugal pump\uFF08\u91CD\u578B\u5851\u6599\u79BB\u5FC3\u6CF5\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/heavy-duty plastic centrifugal pump\uFF08\u91CD\u578B\u5851\u6599\u79BB\u5FC3\u6CF5\uFF09.svg"}},{name:"iot-\u7BA1\u9053(21)-02.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/iot-\u7BA1\u9053(21)-02.svg"}},{name:"iot-\u7BA1\u9053(21)-03.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/iot-\u7BA1\u9053(21)-03.svg"}},{name:"iot-\u7BA1\u9053(21)-04.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/iot-\u7BA1\u9053(21)-04.svg"}},{name:"iot-\u7BA1\u9053(21)-05.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/iot-\u7BA1\u9053(21)-05.svg"}},{name:"iot-\u7BA1\u9053(21)-06.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/iot-\u7BA1\u9053(21)-06.svg"}},{name:"iot-\u7BA1\u9053(21)-07.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/iot-\u7BA1\u9053(21)-07.svg"}},{name:"iot-\u7BA1\u9053(21)-08.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/iot-\u7BA1\u9053(21)-08.svg"}},{name:"iot-\u7BA1\u9053(21)-09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/iot-\u7BA1\u9053(21)-09.svg"}},{name:"iot-\u7BA1\u9053(21)-10.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/iot-\u7BA1\u9053(21)-10.svg"}},{name:"iot-\u7BA1\u9053(21)-11.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/iot-\u7BA1\u9053(21)-11.svg"}},{name:"iot-\u7BA1\u9053(21)-12.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/iot-\u7BA1\u9053(21)-12.svg"}},{name:"iot-\u7BA1\u9053(21)-13.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/iot-\u7BA1\u9053(21)-13.svg"}},{name:"iot-\u7BA1\u9053(21)-14.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/iot-\u7BA1\u9053(21)-14.svg"}},{name:"iot-\u7BA1\u9053(21)-15.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/iot-\u7BA1\u9053(21)-15.svg"}},{name:"iot-\u7BA1\u9053(21)-16.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/iot-\u7BA1\u9053(21)-16.svg"}},{name:"iot-\u7BA1\u9053(21)-17.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/iot-\u7BA1\u9053(21)-17.svg"}},{name:"iot-\u7BA1\u9053(21)-18.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/iot-\u7BA1\u9053(21)-18.svg"}},{name:"iot-\u7BA1\u9053(21)-19.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/iot-\u7BA1\u9053(21)-19.svg"}},{name:"iot-\u7BA1\u9053(21)-20.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/iot-\u7BA1\u9053(21)-20.svg"}},{name:"iot-\u7BA1\u9053(21)-21.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/iot-\u7BA1\u9053(21)-21.svg"}},{name:"iot-\u7BA1\u9053(21)_\u753B\u677F 1.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/iot-\u7BA1\u9053(21)_\u753B\u677F 1.svg"}},{name:"oil well pump\uFF08\u6CB9\u4E95\u6CF5\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/oil well pump\uFF08\u6CB9\u4E95\u6CF5\uFF09.svg"}},{name:"simple Vertical pump \uFF08\u7B80\u6613\u7ACB\u5F0F\u6CF5\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/simple Vertical pump \uFF08\u7B80\u6613\u7ACB\u5F0F\u6CF5\uFF09.svg"}},{name:"sump pump\uFF08\u6C61\u6C34\u6CF5\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/sump pump\uFF08\u6C61\u6C34\u6CF5\uFF09.svg"}},{name:"tube pump\uFF08\u7BA1\u5F0F\u6CF5\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/tube pump\uFF08\u7BA1\u5F0F\u6CF5\uFF09.svg"}},{name:"\u706B.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/\u706B.svg"}},{name:"\u9600\u95E8-01.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/\u9600\u95E8-01.svg"}},{name:"\u71C3\u8102.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/\u71C3\u8102.svg"}},{name:"\u9505\u7089.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/\u9505\u7089.svg"}},{name:"\u84C4\u6C34\u6C60 (1).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/\u84C4\u6C34\u6C60 (1).svg"}},{name:"\u84C4\u6C34\u6C60.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/\u84C4\u6C34\u6C60.svg"}},{name:"\u6C34\u5229\u4F01\u4E1A.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/\u6C34\u5229\u4F01\u4E1A.svg"}},{name:"\u6C34\u5229\u8BBE\u65BD.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/\u6C34\u5229\u8BBE\u65BD.svg"}}]},wk={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"}}]},bk={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"}}]},xk={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"}}]},I5=["time-comp"],Cc=window.allEnv.topo.showAllMenu||!1;Lg.show=Cc;Mg.show=Cc;Og.show=Cc;const B5=[{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:"rectangle",icon:"t-icon t-shurukuang",id:2,data:{width:200,height:50,borderRadius:.1,input:!0,name:"rectangle",activeTextColor:"#000000FF",color:"#D9D9D9FF",hoverTextColor:"#000000FF",lineHeight:1.5,lineWidth:1,text:"\u8F93\u5165\u6570\u636E",textAlign:"left",textColor:"#000000FF",textLeft:10}}]},{name:"Echarts\u56FE\u5F62",show:!0,list:[{name:"\u6298\u7EBF\u56FE",icon:"t-icon t-line-chart",data:{name:"echarts",width:400,height:300,externElement:!0,disableAnchor:!0,canDataBind:!0,echarts:{option:{grid:{top:10,bottom:30,left:40,right:50},xAxis:{type:"category",data:["Mon","Tue","Wed","Thu","Fri","Sat","Sun"]},yAxis:{type:"value"},series:[{data:[820,932,901,934,1290,1330,1320],type:"line"}]}}}},{name:"\u67F1\u72B6\u56FE",icon:"t-icon t-bar-chart",data:{width:300,height:200,disableAnchor:!0,externElement:!0,name:"echarts",canDataBind:!0,echarts:{option:{tooltip:{trigger:"axis",axisPointer:{type:"shadow"}},grid:{left:"3%",right:"4%",bottom:"3%",containLabel:!0},xAxis:{type:"category",data:["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],axisTick:{alignWithLabel:!0}},yAxis:[{type:"value"}],series:[{name:"\u76F4\u63A5\u8BBF\u95EE",type:"bar",barWidth:"60%",data:[10,52,200,334,390,330,220]}]},max:100}}},{name:"\u997C\u56FE",icon:"t-icon t-pie-chart",data:{width:200,height:200,disableAnchor:!0,externElement:!0,name:"echarts",canDataBind:!1,echarts:{option:{tooltip:{trigger:"item",formatter:"{a} <br/>{b}: {c} ({d}%)"},legend:{},series:[{name:"\u8BBF\u95EE\u6765\u6E90",type:"pie",radius:["50%","70%"],avoidLabelOverlap:!1,label:{normal:{show:!1,position:"center"},emphasis:{show:!0,textStyle:{fontSize:"30",fontWeight:"bold"}}},labelLine:{normal:{show:!1}},data:[{value:335,name:"\u76F4\u63A5\u8BBF\u95EE"},{value:310,name:"\u90AE\u4EF6\u8425\u9500"},{value:234,name:"\u8054\u76DF\u5E7F\u544A"},{value:135,name:"\u89C6\u9891\u5E7F\u544A"},{value:1548,name:"\u641C\u7D22\u5F15\u64CE"}]}]}}}},{name:"\u4EEA\u8868\u76D8",icon:"t-icon t-dashboard-chart",data:{width:300,height:300,disableAnchor:!0,externElement:!0,name:"echarts",canDataBind:!0,echarts:{option:{series:[{name:"\u4E1A\u52A1\u6307\u6807",type:"gauge",min:0,max:100,detail:{formatter:"{value}%"},data:[{value:50,name:"\u5B8C\u6210\u7387"}]}]}}}}]},{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:"",activeColor:"",background:"#1890ff",color:"#1890ff",hoverBackground:"",hoverColor:"",textColor:"#ffffff",hoverTextColor:"#ffffff",activeTextColor:"#ffffff"}}]},{...wk},{...bk},{...xk},{...Lg},{...Mg},{...Og},{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
  99. + 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 Qi={};(function(e){var t=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";function i(n,r){return Object.prototype.hasOwnProperty.call(n,r)}e.assign=function(n){for(var r=Array.prototype.slice.call(arguments,1);r.length;){var l=r.shift();if(!!l){if(typeof l!="object")throw new TypeError(l+"must be non-object");for(var o in l)i(l,o)&&(n[o]=l[o])}}return n},e.shrinkBuf=function(n,r){return n.length===r?n:n.subarray?n.subarray(0,r):(n.length=r,n)};var a={arraySet:function(n,r,l,o,u){if(r.subarray&&n.subarray){n.set(r.subarray(l,l+o),u);return}for(var c=0;c<o;c++)n[u+c]=r[l+c]},flattenChunks:function(n){var r,l,o,u,c,f;for(o=0,r=0,l=n.length;r<l;r++)o+=n[r].length;for(f=new Uint8Array(o),u=0,r=0,l=n.length;r<l;r++)c=n[r],f.set(c,u),u+=c.length;return f}},s={arraySet:function(n,r,l,o,u){for(var c=0;c<o;c++)n[u+c]=r[l+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,s))},e.setTyped(t)})(Qi);var An={},Si={},Ss={},_k=Qi,Ek=4,Kf=0,Xf=1,Ak=2;function Is(e){for(var t=e.length;--t>=0;)e[t]=0}var kk=0,Ng=1,Ck=2,Fk=3,Rk=258,Fc=29,kn=256,yn=kn+1+Fc,ks=30,Rc=19,zg=2*yn+1,La=15,Ml=16,Tk=7,Tc=256,Hg=16,Wg=17,Ug=18,rc=[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],Lr=[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],Pk=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],Vg=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],Sk=512,ji=new Array((yn+2)*2);Is(ji);var cn=new Array(ks*2);Is(cn);var pn=new Array(Sk);Is(pn);var wn=new Array(Rk-Fk+1);Is(wn);var Pc=new Array(Fc);Is(Pc);var Zr=new Array(ks);Is(Zr);function Ol(e,t,i,a,s){this.static_tree=e,this.extra_bits=t,this.extra_base=i,this.elems=a,this.max_length=s,this.has_stree=e&&e.length}var $g,jg,qg;function Nl(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function Yg(e){return e<256?pn[e]:pn[256+(e>>>7)]}function bn(e,t){e.pending_buf[e.pending++]=t&255,e.pending_buf[e.pending++]=t>>>8&255}function $e(e,t,i){e.bi_valid>Ml-i?(e.bi_buf|=t<<e.bi_valid&65535,bn(e,e.bi_buf),e.bi_buf=t>>Ml-e.bi_valid,e.bi_valid+=i-Ml):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=i)}function Ri(e,t,i){$e(e,i[t*2],i[t*2+1])}function Kg(e,t){var i=0;do i|=e&1,e>>>=1,i<<=1;while(--t>0);return i>>>1}function Ik(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 Bk(e,t){var i=t.dyn_tree,a=t.max_code,s=t.stat_desc.static_tree,n=t.stat_desc.has_stree,r=t.stat_desc.extra_bits,l=t.stat_desc.extra_base,o=t.stat_desc.max_length,u,c,f,g,v,m,w=0;for(g=0;g<=La;g++)e.bl_count[g]=0;for(i[e.heap[e.heap_max]*2+1]=0,u=e.heap_max+1;u<zg;u++)c=e.heap[u],g=i[i[c*2+1]*2+1]+1,g>o&&(g=o,w++),i[c*2+1]=g,!(c>a)&&(e.bl_count[g]++,v=0,c>=l&&(v=r[c-l]),m=i[c*2],e.opt_len+=m*(g+v),n&&(e.static_len+=m*(s[c*2+1]+v)));if(w!==0){do{for(g=o-1;e.bl_count[g]===0;)g--;e.bl_count[g]--,e.bl_count[g+1]+=2,e.bl_count[o]--,w-=2}while(w>0);for(g=o;g!==0;g--)for(c=e.bl_count[g];c!==0;)f=e.heap[--u],!(f>a)&&(i[f*2+1]!==g&&(e.opt_len+=(g-i[f*2+1])*i[f*2],i[f*2+1]=g),c--)}}function Xg(e,t,i){var a=new Array(La+1),s=0,n,r;for(n=1;n<=La;n++)a[n]=s=s+i[n-1]<<1;for(r=0;r<=t;r++){var l=e[r*2+1];l!==0&&(e[r*2]=Kg(a[l]++,l))}}function Dk(){var e,t,i,a,s,n=new Array(La+1);for(i=0,a=0;a<Fc-1;a++)for(Pc[a]=i,e=0;e<1<<rc[a];e++)wn[i++]=a;for(wn[i-1]=a,s=0,a=0;a<16;a++)for(Zr[a]=s,e=0;e<1<<Lr[a];e++)pn[s++]=a;for(s>>=7;a<ks;a++)for(Zr[a]=s<<7,e=0;e<1<<Lr[a]-7;e++)pn[256+s++]=a;for(t=0;t<=La;t++)n[t]=0;for(e=0;e<=143;)ji[e*2+1]=8,e++,n[8]++;for(;e<=255;)ji[e*2+1]=9,e++,n[9]++;for(;e<=279;)ji[e*2+1]=7,e++,n[7]++;for(;e<=287;)ji[e*2+1]=8,e++,n[8]++;for(Xg(ji,yn+1,n),e=0;e<ks;e++)cn[e*2+1]=5,cn[e*2]=Kg(e,5);$g=new Ol(ji,rc,kn+1,yn,La),jg=new Ol(cn,Lr,0,ks,La),qg=new Ol(new Array(0),Pk,0,Rc,Tk)}function Gg(e){var t;for(t=0;t<yn;t++)e.dyn_ltree[t*2]=0;for(t=0;t<ks;t++)e.dyn_dtree[t*2]=0;for(t=0;t<Rc;t++)e.bl_tree[t*2]=0;e.dyn_ltree[Tc*2]=1,e.opt_len=e.static_len=0,e.last_lit=e.matches=0}function Zg(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 Lk(e,t,i,a){Zg(e),a&&(bn(e,i),bn(e,~i)),_k.arraySet(e.pending_buf,e.window,t,i,e.pending),e.pending+=i}function Gf(e,t,i,a){var s=t*2,n=i*2;return e[s]<e[n]||e[s]===e[n]&&a[t]<=a[i]}function zl(e,t,i){for(var a=e.heap[i],s=i<<1;s<=e.heap_len&&(s<e.heap_len&&Gf(t,e.heap[s+1],e.heap[s],e.depth)&&s++,!Gf(t,a,e.heap[s],e.depth));)e.heap[i]=e.heap[s],i=s,s<<=1;e.heap[i]=a}function Zf(e,t,i){var a,s,n=0,r,l;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],s=e.pending_buf[e.l_buf+n],n++,a===0?Ri(e,s,t):(r=wn[s],Ri(e,r+kn+1,t),l=rc[r],l!==0&&(s-=Pc[r],$e(e,s,l)),a--,r=Yg(a),Ri(e,r,i),l=Lr[r],l!==0&&(a-=Zr[r],$e(e,a,l)));while(n<e.last_lit);Ri(e,Tc,t)}function oc(e,t){var i=t.dyn_tree,a=t.stat_desc.static_tree,s=t.stat_desc.has_stree,n=t.stat_desc.elems,r,l,o=-1,u;for(e.heap_len=0,e.heap_max=zg,r=0;r<n;r++)i[r*2]!==0?(e.heap[++e.heap_len]=o=r,e.depth[r]=0):i[r*2+1]=0;for(;e.heap_len<2;)u=e.heap[++e.heap_len]=o<2?++o:0,i[u*2]=1,e.depth[u]=0,e.opt_len--,s&&(e.static_len-=a[u*2+1]);for(t.max_code=o,r=e.heap_len>>1;r>=1;r--)zl(e,i,r);u=n;do r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],zl(e,i,1),l=e.heap[1],e.heap[--e.heap_max]=r,e.heap[--e.heap_max]=l,i[u*2]=i[r*2]+i[l*2],e.depth[u]=(e.depth[r]>=e.depth[l]?e.depth[r]:e.depth[l])+1,i[r*2+1]=i[l*2+1]=u,e.heap[1]=u++,zl(e,i,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],Bk(e,t),Xg(i,o,e.bl_count)}function Jf(e,t,i){var a,s=-1,n,r=t[0*2+1],l=0,o=7,u=4;for(r===0&&(o=138,u=3),t[(i+1)*2+1]=65535,a=0;a<=i;a++)n=r,r=t[(a+1)*2+1],!(++l<o&&n===r)&&(l<u?e.bl_tree[n*2]+=l:n!==0?(n!==s&&e.bl_tree[n*2]++,e.bl_tree[Hg*2]++):l<=10?e.bl_tree[Wg*2]++:e.bl_tree[Ug*2]++,l=0,s=n,r===0?(o=138,u=3):n===r?(o=6,u=3):(o=7,u=4))}function Qf(e,t,i){var a,s=-1,n,r=t[0*2+1],l=0,o=7,u=4;for(r===0&&(o=138,u=3),a=0;a<=i;a++)if(n=r,r=t[(a+1)*2+1],!(++l<o&&n===r)){if(l<u)do Ri(e,n,e.bl_tree);while(--l!==0);else n!==0?(n!==s&&(Ri(e,n,e.bl_tree),l--),Ri(e,Hg,e.bl_tree),$e(e,l-3,2)):l<=10?(Ri(e,Wg,e.bl_tree),$e(e,l-3,3)):(Ri(e,Ug,e.bl_tree),$e(e,l-11,7));l=0,s=n,r===0?(o=138,u=3):n===r?(o=6,u=3):(o=7,u=4)}}function Mk(e){var t;for(Jf(e,e.dyn_ltree,e.l_desc.max_code),Jf(e,e.dyn_dtree,e.d_desc.max_code),oc(e,e.bl_desc),t=Rc-1;t>=3&&e.bl_tree[Vg[t]*2+1]===0;t--);return e.opt_len+=3*(t+1)+5+5+4,t}function Ok(e,t,i,a){var s;for($e(e,t-257,5),$e(e,i-1,5),$e(e,a-4,4),s=0;s<a;s++)$e(e,e.bl_tree[Vg[s]*2+1],3);Qf(e,e.dyn_ltree,t-1),Qf(e,e.dyn_dtree,i-1)}function Nk(e){var t=4093624447,i;for(i=0;i<=31;i++,t>>>=1)if(t&1&&e.dyn_ltree[i*2]!==0)return Kf;if(e.dyn_ltree[9*2]!==0||e.dyn_ltree[10*2]!==0||e.dyn_ltree[13*2]!==0)return Xf;for(i=32;i<kn;i++)if(e.dyn_ltree[i*2]!==0)return Xf;return Kf}var td=!1;function zk(e){td||(Dk(),td=!0),e.l_desc=new Nl(e.dyn_ltree,$g),e.d_desc=new Nl(e.dyn_dtree,jg),e.bl_desc=new Nl(e.bl_tree,qg),e.bi_buf=0,e.bi_valid=0,Gg(e)}function Jg(e,t,i,a){$e(e,(kk<<1)+(a?1:0),3),Lk(e,t,i,!0)}function Hk(e){$e(e,Ng<<1,3),Ri(e,Tc,ji),Ik(e)}function Wk(e,t,i,a){var s,n,r=0;e.level>0?(e.strm.data_type===Ak&&(e.strm.data_type=Nk(e)),oc(e,e.l_desc),oc(e,e.d_desc),r=Mk(e),s=e.opt_len+3+7>>>3,n=e.static_len+3+7>>>3,n<=s&&(s=n)):s=n=i+5,i+4<=s&&t!==-1?Jg(e,t,i,a):e.strategy===Ek||n===s?($e(e,(Ng<<1)+(a?1:0),3),Zf(e,ji,cn)):($e(e,(Ck<<1)+(a?1:0),3),Ok(e,e.l_desc.max_code+1,e.d_desc.max_code+1,r+1),Zf(e,e.dyn_ltree,e.dyn_dtree)),Gg(e),a&&Zg(e)}function Uk(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[(wn[i]+kn+1)*2]++,e.dyn_dtree[Yg(t)*2]++),e.last_lit===e.lit_bufsize-1}Ss._tr_init=zk;Ss._tr_stored_block=Jg;Ss._tr_flush_block=Wk;Ss._tr_tally=Uk;Ss._tr_align=Hk;function Vk(e,t,i,a){for(var s=e&65535|0,n=e>>>16&65535|0,r=0;i!==0;){r=i>2e3?2e3:i,i-=r;do s=s+t[a++]|0,n=n+s|0;while(--r);s%=65521,n%=65521}return s|n<<16|0}var Qg=Vk;function $k(){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 jk=$k();function qk(e,t,i,a){var s=jk,n=a+i;e^=-1;for(var r=a;r<n;r++)e=e>>>8^s[(e^t[r])&255];return e^-1}var tv=qk,Sc={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"},De=Qi,fi=Ss,ev=Qg,da=tv,Yk=Sc,Ka=0,Kk=1,Xk=3,ba=4,ed=5,Ti=0,id=1,di=-2,Gk=-3,Hl=-5,Zk=-1,Jk=1,Cr=2,Qk=3,tC=4,eC=0,iC=2,eo=8,aC=9,sC=15,nC=8,rC=29,oC=256,lc=oC+1+rC,lC=30,cC=19,hC=2*lc+1,uC=15,Wt=3,pa=258,wi=pa+Wt+1,fC=32,io=42,cc=69,Mr=73,Or=91,Nr=103,Ma=113,sn=666,ye=1,Cn=2,Ua=3,Bs=4,dC=3;function wa(e,t){return e.msg=Yk[t],t}function ad(e){return(e<<1)-(e>4?9:0)}function ma(e){for(var t=e.length;--t>=0;)e[t]=0}function ga(e){var t=e.state,i=t.pending;i>e.avail_out&&(i=e.avail_out),i!==0&&(De.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 Ce(e,t){fi._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,ga(e.strm)}function Ut(e,t){e.pending_buf[e.pending++]=t}function Js(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=t&255}function gC(e,t,i,a){var s=e.avail_in;return s>a&&(s=a),s===0?0:(e.avail_in-=s,De.arraySet(t,e.input,e.next_in,s,i),e.state.wrap===1?e.adler=ev(e.adler,t,s,i):e.state.wrap===2&&(e.adler=da(e.adler,t,s,i)),e.next_in+=s,e.total_in+=s,s)}function iv(e,t){var i=e.max_chain_length,a=e.strstart,s,n,r=e.prev_length,l=e.nice_match,o=e.strstart>e.w_size-wi?e.strstart-(e.w_size-wi):0,u=e.window,c=e.w_mask,f=e.prev,g=e.strstart+pa,v=u[a+r-1],m=u[a+r];e.prev_length>=e.good_match&&(i>>=2),l>e.lookahead&&(l=e.lookahead);do if(s=t,!(u[s+r]!==m||u[s+r-1]!==v||u[s]!==u[a]||u[++s]!==u[a+1])){a+=2,s++;do;while(u[++a]===u[++s]&&u[++a]===u[++s]&&u[++a]===u[++s]&&u[++a]===u[++s]&&u[++a]===u[++s]&&u[++a]===u[++s]&&u[++a]===u[++s]&&u[++a]===u[++s]&&a<g);if(n=pa-(g-a),a=g-pa,n>r){if(e.match_start=t,r=n,n>=l)break;v=u[a+r-1],m=u[a+r]}}while((t=f[t&c])>o&&--i!==0);return r<=e.lookahead?r:e.lookahead}function Va(e){var t=e.w_size,i,a,s,n,r;do{if(n=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-wi)){De.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 s=e.head[--i],e.head[i]=s>=t?s-t:0;while(--a);a=t,i=a;do s=e.prev[--i],e.prev[i]=s>=t?s-t:0;while(--a);n+=t}if(e.strm.avail_in===0)break;if(a=gC(e.strm,e.window,e.strstart+e.lookahead,n),e.lookahead+=a,e.lookahead+e.insert>=Wt)for(r=e.strstart-e.insert,e.ins_h=e.window[r],e.ins_h=(e.ins_h<<e.hash_shift^e.window[r+1])&e.hash_mask;e.insert&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[r+Wt-1])&e.hash_mask,e.prev[r&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=r,r++,e.insert--,!(e.lookahead+e.insert<Wt)););}while(e.lookahead<wi&&e.strm.avail_in!==0)}function vC(e,t){var i=65535;for(i>e.pending_buf_size-5&&(i=e.pending_buf_size-5);;){if(e.lookahead<=1){if(Va(e),e.lookahead===0&&t===Ka)return ye;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,Ce(e,!1),e.strm.avail_out===0)||e.strstart-e.block_start>=e.w_size-wi&&(Ce(e,!1),e.strm.avail_out===0))return ye}return e.insert=0,t===ba?(Ce(e,!0),e.strm.avail_out===0?Ua:Bs):(e.strstart>e.block_start&&(Ce(e,!1),e.strm.avail_out===0),ye)}function Wl(e,t){for(var i,a;;){if(e.lookahead<wi){if(Va(e),e.lookahead<wi&&t===Ka)return ye;if(e.lookahead===0)break}if(i=0,e.lookahead>=Wt&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+Wt-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-wi&&(e.match_length=iv(e,i)),e.match_length>=Wt)if(a=fi._tr_tally(e,e.strstart-e.match_start,e.match_length-Wt),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=Wt){e.match_length--;do e.strstart++,e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+Wt-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=fi._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(a&&(Ce(e,!1),e.strm.avail_out===0))return ye}return e.insert=e.strstart<Wt-1?e.strstart:Wt-1,t===ba?(Ce(e,!0),e.strm.avail_out===0?Ua:Bs):e.last_lit&&(Ce(e,!1),e.strm.avail_out===0)?ye:Cn}function gs(e,t){for(var i,a,s;;){if(e.lookahead<wi){if(Va(e),e.lookahead<wi&&t===Ka)return ye;if(e.lookahead===0)break}if(i=0,e.lookahead>=Wt&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+Wt-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=Wt-1,i!==0&&e.prev_length<e.max_lazy_match&&e.strstart-i<=e.w_size-wi&&(e.match_length=iv(e,i),e.match_length<=5&&(e.strategy===Jk||e.match_length===Wt&&e.strstart-e.match_start>4096)&&(e.match_length=Wt-1)),e.prev_length>=Wt&&e.match_length<=e.prev_length){s=e.strstart+e.lookahead-Wt,a=fi._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-Wt),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=s&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+Wt-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=Wt-1,e.strstart++,a&&(Ce(e,!1),e.strm.avail_out===0))return ye}else if(e.match_available){if(a=fi._tr_tally(e,0,e.window[e.strstart-1]),a&&Ce(e,!1),e.strstart++,e.lookahead--,e.strm.avail_out===0)return ye}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(a=fi._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<Wt-1?e.strstart:Wt-1,t===ba?(Ce(e,!0),e.strm.avail_out===0?Ua:Bs):e.last_lit&&(Ce(e,!1),e.strm.avail_out===0)?ye:Cn}function mC(e,t){for(var i,a,s,n,r=e.window;;){if(e.lookahead<=pa){if(Va(e),e.lookahead<=pa&&t===Ka)return ye;if(e.lookahead===0)break}if(e.match_length=0,e.lookahead>=Wt&&e.strstart>0&&(s=e.strstart-1,a=r[s],a===r[++s]&&a===r[++s]&&a===r[++s])){n=e.strstart+pa;do;while(a===r[++s]&&a===r[++s]&&a===r[++s]&&a===r[++s]&&a===r[++s]&&a===r[++s]&&a===r[++s]&&a===r[++s]&&s<n);e.match_length=pa-(n-s),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=Wt?(i=fi._tr_tally(e,1,e.match_length-Wt),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(i=fi._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),i&&(Ce(e,!1),e.strm.avail_out===0))return ye}return e.insert=0,t===ba?(Ce(e,!0),e.strm.avail_out===0?Ua:Bs):e.last_lit&&(Ce(e,!1),e.strm.avail_out===0)?ye:Cn}function yC(e,t){for(var i;;){if(e.lookahead===0&&(Va(e),e.lookahead===0)){if(t===Ka)return ye;break}if(e.match_length=0,i=fi._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,i&&(Ce(e,!1),e.strm.avail_out===0))return ye}return e.insert=0,t===ba?(Ce(e,!0),e.strm.avail_out===0?Ua:Bs):e.last_lit&&(Ce(e,!1),e.strm.avail_out===0)?ye:Cn}function ki(e,t,i,a,s){this.good_length=e,this.max_lazy=t,this.nice_length=i,this.max_chain=a,this.func=s}var _s;_s=[new ki(0,0,0,0,vC),new ki(4,4,8,4,Wl),new ki(4,5,16,8,Wl),new ki(4,6,32,32,Wl),new ki(4,4,16,16,gs),new ki(8,16,32,32,gs),new ki(8,16,128,128,gs),new ki(8,32,128,256,gs),new ki(32,128,258,1024,gs),new ki(32,258,258,4096,gs)];function pC(e){e.window_size=2*e.w_size,ma(e.head),e.max_lazy_match=_s[e.level].max_lazy,e.good_match=_s[e.level].good_length,e.nice_match=_s[e.level].nice_length,e.max_chain_length=_s[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=Wt-1,e.match_available=0,e.ins_h=0}function wC(){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=eo,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 De.Buf16(hC*2),this.dyn_dtree=new De.Buf16((2*lC+1)*2),this.bl_tree=new De.Buf16((2*cC+1)*2),ma(this.dyn_ltree),ma(this.dyn_dtree),ma(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new De.Buf16(uC+1),this.heap=new De.Buf16(2*lc+1),ma(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new De.Buf16(2*lc+1),ma(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 av(e){var t;return!e||!e.state?wa(e,di):(e.total_in=e.total_out=0,e.data_type=iC,t=e.state,t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?io:Ma,e.adler=t.wrap===2?0:1,t.last_flush=Ka,fi._tr_init(t),Ti)}function sv(e){var t=av(e);return t===Ti&&pC(e.state),t}function bC(e,t){return!e||!e.state||e.state.wrap!==2?di:(e.state.gzhead=t,Ti)}function nv(e,t,i,a,s,n){if(!e)return di;var r=1;if(t===Zk&&(t=6),a<0?(r=0,a=-a):a>15&&(r=2,a-=16),s<1||s>aC||i!==eo||a<8||a>15||t<0||t>9||n<0||n>tC)return wa(e,di);a===8&&(a=9);var l=new wC;return e.state=l,l.strm=e,l.wrap=r,l.gzhead=null,l.w_bits=a,l.w_size=1<<l.w_bits,l.w_mask=l.w_size-1,l.hash_bits=s+7,l.hash_size=1<<l.hash_bits,l.hash_mask=l.hash_size-1,l.hash_shift=~~((l.hash_bits+Wt-1)/Wt),l.window=new De.Buf8(l.w_size*2),l.head=new De.Buf16(l.hash_size),l.prev=new De.Buf16(l.w_size),l.lit_bufsize=1<<s+6,l.pending_buf_size=l.lit_bufsize*4,l.pending_buf=new De.Buf8(l.pending_buf_size),l.d_buf=1*l.lit_bufsize,l.l_buf=(1+2)*l.lit_bufsize,l.level=t,l.strategy=n,l.method=i,sv(e)}function xC(e,t){return nv(e,t,eo,sC,nC,eC)}function _C(e,t){var i,a,s,n;if(!e||!e.state||t>ed||t<0)return e?wa(e,di):di;if(a=e.state,!e.output||!e.input&&e.avail_in!==0||a.status===sn&&t!==ba)return wa(e,e.avail_out===0?Hl:di);if(a.strm=e,i=a.last_flush,a.last_flush=t,a.status===io)if(a.wrap===2)e.adler=0,Ut(a,31),Ut(a,139),Ut(a,8),a.gzhead?(Ut(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)),Ut(a,a.gzhead.time&255),Ut(a,a.gzhead.time>>8&255),Ut(a,a.gzhead.time>>16&255),Ut(a,a.gzhead.time>>24&255),Ut(a,a.level===9?2:a.strategy>=Cr||a.level<2?4:0),Ut(a,a.gzhead.os&255),a.gzhead.extra&&a.gzhead.extra.length&&(Ut(a,a.gzhead.extra.length&255),Ut(a,a.gzhead.extra.length>>8&255)),a.gzhead.hcrc&&(e.adler=da(e.adler,a.pending_buf,a.pending,0)),a.gzindex=0,a.status=cc):(Ut(a,0),Ut(a,0),Ut(a,0),Ut(a,0),Ut(a,0),Ut(a,a.level===9?2:a.strategy>=Cr||a.level<2?4:0),Ut(a,dC),a.status=Ma);else{var r=eo+(a.w_bits-8<<4)<<8,l=-1;a.strategy>=Cr||a.level<2?l=0:a.level<6?l=1:a.level===6?l=2:l=3,r|=l<<6,a.strstart!==0&&(r|=fC),r+=31-r%31,a.status=Ma,Js(a,r),a.strstart!==0&&(Js(a,e.adler>>>16),Js(a,e.adler&65535)),e.adler=1}if(a.status===cc)if(a.gzhead.extra){for(s=a.pending;a.gzindex<(a.gzhead.extra.length&65535)&&!(a.pending===a.pending_buf_size&&(a.gzhead.hcrc&&a.pending>s&&(e.adler=da(e.adler,a.pending_buf,a.pending-s,s)),ga(e),s=a.pending,a.pending===a.pending_buf_size));)Ut(a,a.gzhead.extra[a.gzindex]&255),a.gzindex++;a.gzhead.hcrc&&a.pending>s&&(e.adler=da(e.adler,a.pending_buf,a.pending-s,s)),a.gzindex===a.gzhead.extra.length&&(a.gzindex=0,a.status=Mr)}else a.status=Mr;if(a.status===Mr)if(a.gzhead.name){s=a.pending;do{if(a.pending===a.pending_buf_size&&(a.gzhead.hcrc&&a.pending>s&&(e.adler=da(e.adler,a.pending_buf,a.pending-s,s)),ga(e),s=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,Ut(a,n)}while(n!==0);a.gzhead.hcrc&&a.pending>s&&(e.adler=da(e.adler,a.pending_buf,a.pending-s,s)),n===0&&(a.gzindex=0,a.status=Or)}else a.status=Or;if(a.status===Or)if(a.gzhead.comment){s=a.pending;do{if(a.pending===a.pending_buf_size&&(a.gzhead.hcrc&&a.pending>s&&(e.adler=da(e.adler,a.pending_buf,a.pending-s,s)),ga(e),s=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,Ut(a,n)}while(n!==0);a.gzhead.hcrc&&a.pending>s&&(e.adler=da(e.adler,a.pending_buf,a.pending-s,s)),n===0&&(a.status=Nr)}else a.status=Nr;if(a.status===Nr&&(a.gzhead.hcrc?(a.pending+2>a.pending_buf_size&&ga(e),a.pending+2<=a.pending_buf_size&&(Ut(a,e.adler&255),Ut(a,e.adler>>8&255),e.adler=0,a.status=Ma)):a.status=Ma),a.pending!==0){if(ga(e),e.avail_out===0)return a.last_flush=-1,Ti}else if(e.avail_in===0&&ad(t)<=ad(i)&&t!==ba)return wa(e,Hl);if(a.status===sn&&e.avail_in!==0)return wa(e,Hl);if(e.avail_in!==0||a.lookahead!==0||t!==Ka&&a.status!==sn){var o=a.strategy===Cr?yC(a,t):a.strategy===Qk?mC(a,t):_s[a.level].func(a,t);if((o===Ua||o===Bs)&&(a.status=sn),o===ye||o===Ua)return e.avail_out===0&&(a.last_flush=-1),Ti;if(o===Cn&&(t===Kk?fi._tr_align(a):t!==ed&&(fi._tr_stored_block(a,0,0,!1),t===Xk&&(ma(a.head),a.lookahead===0&&(a.strstart=0,a.block_start=0,a.insert=0))),ga(e),e.avail_out===0))return a.last_flush=-1,Ti}return t!==ba?Ti:a.wrap<=0?id:(a.wrap===2?(Ut(a,e.adler&255),Ut(a,e.adler>>8&255),Ut(a,e.adler>>16&255),Ut(a,e.adler>>24&255),Ut(a,e.total_in&255),Ut(a,e.total_in>>8&255),Ut(a,e.total_in>>16&255),Ut(a,e.total_in>>24&255)):(Js(a,e.adler>>>16),Js(a,e.adler&65535)),ga(e),a.wrap>0&&(a.wrap=-a.wrap),a.pending!==0?Ti:id)}function EC(e){var t;return!e||!e.state?di:(t=e.state.status,t!==io&&t!==cc&&t!==Mr&&t!==Or&&t!==Nr&&t!==Ma&&t!==sn?wa(e,di):(e.state=null,t===Ma?wa(e,Gk):Ti))}function AC(e,t){var i=t.length,a,s,n,r,l,o,u,c;if(!e||!e.state||(a=e.state,r=a.wrap,r===2||r===1&&a.status!==io||a.lookahead))return di;for(r===1&&(e.adler=ev(e.adler,t,i,0)),a.wrap=0,i>=a.w_size&&(r===0&&(ma(a.head),a.strstart=0,a.block_start=0,a.insert=0),c=new De.Buf8(a.w_size),De.arraySet(c,t,i-a.w_size,a.w_size,0),t=c,i=a.w_size),l=e.avail_in,o=e.next_in,u=e.input,e.avail_in=i,e.next_in=0,e.input=t,Va(a);a.lookahead>=Wt;){s=a.strstart,n=a.lookahead-(Wt-1);do a.ins_h=(a.ins_h<<a.hash_shift^a.window[s+Wt-1])&a.hash_mask,a.prev[s&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=s,s++;while(--n);a.strstart=s,a.lookahead=Wt-1,Va(a)}return a.strstart+=a.lookahead,a.block_start=a.strstart,a.insert=a.lookahead,a.lookahead=0,a.match_length=a.prev_length=Wt-1,a.match_available=0,e.next_in=o,e.input=u,e.avail_in=l,a.wrap=r,Ti}Si.deflateInit=xC;Si.deflateInit2=nv;Si.deflateReset=sv;Si.deflateResetKeep=av;Si.deflateSetHeader=bC;Si.deflate=_C;Si.deflateEnd=EC;Si.deflateSetDictionary=AC;Si.deflateInfo="pako deflate (from Nodeca project)";var Xa={},ao=Qi,rv=!0,ov=!0;try{String.fromCharCode.apply(null,[0])}catch{rv=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{ov=!1}var xn=new ao.Buf8(256);for(var ha=0;ha<256;ha++)xn[ha]=ha>=252?6:ha>=248?5:ha>=240?4:ha>=224?3:ha>=192?2:1;xn[254]=xn[254]=1;Xa.string2buf=function(e){var t,i,a,s,n,r=e.length,l=0;for(s=0;s<r;s++)i=e.charCodeAt(s),(i&64512)===55296&&s+1<r&&(a=e.charCodeAt(s+1),(a&64512)===56320&&(i=65536+(i-55296<<10)+(a-56320),s++)),l+=i<128?1:i<2048?2:i<65536?3:4;for(t=new ao.Buf8(l),n=0,s=0;n<l;s++)i=e.charCodeAt(s),(i&64512)===55296&&s+1<r&&(a=e.charCodeAt(s+1),(a&64512)===56320&&(i=65536+(i-55296<<10)+(a-56320),s++)),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 lv(e,t){if(t<65534&&(e.subarray&&ov||!e.subarray&&rv))return String.fromCharCode.apply(null,ao.shrinkBuf(e,t));for(var i="",a=0;a<t;a++)i+=String.fromCharCode(e[a]);return i}Xa.buf2binstring=function(e){return lv(e,e.length)};Xa.binstring2buf=function(e){for(var t=new ao.Buf8(e.length),i=0,a=t.length;i<a;i++)t[i]=e.charCodeAt(i);return t};Xa.buf2string=function(e,t){var i,a,s,n,r=t||e.length,l=new Array(r*2);for(a=0,i=0;i<r;){if(s=e[i++],s<128){l[a++]=s;continue}if(n=xn[s],n>4){l[a++]=65533,i+=n-1;continue}for(s&=n===2?31:n===3?15:7;n>1&&i<r;)s=s<<6|e[i++]&63,n--;if(n>1){l[a++]=65533;continue}s<65536?l[a++]=s:(s-=65536,l[a++]=55296|s>>10&1023,l[a++]=56320|s&1023)}return lv(l,a)};Xa.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+xn[e[i]]>t?i:t};function kC(){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 cv=kC,hn=Si,un=Qi,hc=Xa,uc=Sc,CC=cv,hv=Object.prototype.toString,FC=0,Ul=4,Cs=0,sd=1,nd=2,RC=-1,TC=0,PC=8;function $a(e){if(!(this instanceof $a))return new $a(e);this.options=un.assign({level:RC,method:PC,chunkSize:16384,windowBits:15,memLevel:8,strategy:TC,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 CC,this.strm.avail_out=0;var i=hn.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(i!==Cs)throw new Error(uc[i]);if(t.header&&hn.deflateSetHeader(this.strm,t.header),t.dictionary){var a;if(typeof t.dictionary=="string"?a=hc.string2buf(t.dictionary):hv.call(t.dictionary)==="[object ArrayBuffer]"?a=new Uint8Array(t.dictionary):a=t.dictionary,i=hn.deflateSetDictionary(this.strm,a),i!==Cs)throw new Error(uc[i]);this._dict_set=!0}}$a.prototype.push=function(e,t){var i=this.strm,a=this.options.chunkSize,s,n;if(this.ended)return!1;n=t===~~t?t:t===!0?Ul:FC,typeof e=="string"?i.input=hc.string2buf(e):hv.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 un.Buf8(a),i.next_out=0,i.avail_out=a),s=hn.deflate(i,n),s!==sd&&s!==Cs)return this.onEnd(s),this.ended=!0,!1;(i.avail_out===0||i.avail_in===0&&(n===Ul||n===nd))&&(this.options.to==="string"?this.onData(hc.buf2binstring(un.shrinkBuf(i.output,i.next_out))):this.onData(un.shrinkBuf(i.output,i.next_out)))}while((i.avail_in>0||i.avail_out===0)&&s!==sd);return n===Ul?(s=hn.deflateEnd(this.strm),this.onEnd(s),this.ended=!0,s===Cs):(n===nd&&(this.onEnd(Cs),i.avail_out=0),!0)};$a.prototype.onData=function(e){this.chunks.push(e)};$a.prototype.onEnd=function(e){e===Cs&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=un.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function Ic(e,t){var i=new $a(t);if(i.push(e,!0),i.err)throw i.msg||uc[i.err];return i.result}function SC(e,t){return t=t||{},t.raw=!0,Ic(e,t)}function IC(e,t){return t=t||{},t.gzip=!0,Ic(e,t)}An.Deflate=$a;An.deflate=Ic;An.deflateRaw=SC;An.gzip=IC;var Fn={},bi={},Fr=30,BC=12,DC=function(t,i){var a,s,n,r,l,o,u,c,f,g,v,m,w,y,_,A,x,C,T,I,D,B,V,Q,F;a=t.state,s=t.next_in,Q=t.input,n=s+(t.avail_in-5),r=t.next_out,F=t.output,l=r-(i-t.avail_out),o=r+(t.avail_out-257),u=a.dmax,c=a.wsize,f=a.whave,g=a.wnext,v=a.window,m=a.hold,w=a.bits,y=a.lencode,_=a.distcode,A=(1<<a.lenbits)-1,x=(1<<a.distbits)-1;t:do{w<15&&(m+=Q[s++]<<w,w+=8,m+=Q[s++]<<w,w+=8),C=y[m&A];e:for(;;){if(T=C>>>24,m>>>=T,w-=T,T=C>>>16&255,T===0)F[r++]=C&65535;else if(T&16){I=C&65535,T&=15,T&&(w<T&&(m+=Q[s++]<<w,w+=8),I+=m&(1<<T)-1,m>>>=T,w-=T),w<15&&(m+=Q[s++]<<w,w+=8,m+=Q[s++]<<w,w+=8),C=_[m&x];i:for(;;){if(T=C>>>24,m>>>=T,w-=T,T=C>>>16&255,T&16){if(D=C&65535,T&=15,w<T&&(m+=Q[s++]<<w,w+=8,w<T&&(m+=Q[s++]<<w,w+=8)),D+=m&(1<<T)-1,D>u){t.msg="invalid distance too far back",a.mode=Fr;break t}if(m>>>=T,w-=T,T=r-l,D>T){if(T=D-T,T>f&&a.sane){t.msg="invalid distance too far back",a.mode=Fr;break t}if(B=0,V=v,g===0){if(B+=c-T,T<I){I-=T;do F[r++]=v[B++];while(--T);B=r-D,V=F}}else if(g<T){if(B+=c+g-T,T-=g,T<I){I-=T;do F[r++]=v[B++];while(--T);if(B=0,g<I){T=g,I-=T;do F[r++]=v[B++];while(--T);B=r-D,V=F}}}else if(B+=g-T,T<I){I-=T;do F[r++]=v[B++];while(--T);B=r-D,V=F}for(;I>2;)F[r++]=V[B++],F[r++]=V[B++],F[r++]=V[B++],I-=3;I&&(F[r++]=V[B++],I>1&&(F[r++]=V[B++]))}else{B=r-D;do F[r++]=F[B++],F[r++]=F[B++],F[r++]=F[B++],I-=3;while(I>2);I&&(F[r++]=F[B++],I>1&&(F[r++]=F[B++]))}}else if((T&64)===0){C=_[(C&65535)+(m&(1<<T)-1)];continue i}else{t.msg="invalid distance code",a.mode=Fr;break t}break}}else if((T&64)===0){C=y[(C&65535)+(m&(1<<T)-1)];continue e}else if(T&32){a.mode=BC;break t}else{t.msg="invalid literal/length code",a.mode=Fr;break t}break}}while(s<n&&r<o);I=w>>3,s-=I,w-=I<<3,m&=(1<<w)-1,t.next_in=s,t.next_out=r,t.avail_in=s<n?5+(n-s):5-(s-n),t.avail_out=r<o?257+(o-r):257-(r-o),a.hold=m,a.bits=w},rd=Qi,vs=15,od=852,ld=592,cd=0,Vl=1,hd=2,LC=[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],MC=[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],OC=[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],NC=[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],zC=function(t,i,a,s,n,r,l,o){var u=o.bits,c=0,f=0,g=0,v=0,m=0,w=0,y=0,_=0,A=0,x=0,C,T,I,D,B,V=null,Q=0,F,R=new rd.Buf16(vs+1),P=new rd.Buf16(vs+1),M=null,Y=0,Z,nt,j;for(c=0;c<=vs;c++)R[c]=0;for(f=0;f<s;f++)R[i[a+f]]++;for(m=u,v=vs;v>=1&&R[v]===0;v--);if(m>v&&(m=v),v===0)return n[r++]=1<<24|64<<16|0,n[r++]=1<<24|64<<16|0,o.bits=1,0;for(g=1;g<v&&R[g]===0;g++);for(m<g&&(m=g),_=1,c=1;c<=vs;c++)if(_<<=1,_-=R[c],_<0)return-1;if(_>0&&(t===cd||v!==1))return-1;for(P[1]=0,c=1;c<vs;c++)P[c+1]=P[c]+R[c];for(f=0;f<s;f++)i[a+f]!==0&&(l[P[i[a+f]]++]=f);if(t===cd?(V=M=l,F=19):t===Vl?(V=LC,Q-=257,M=MC,Y-=257,F=256):(V=OC,M=NC,F=-1),x=0,f=0,c=g,B=r,w=m,y=0,I=-1,A=1<<m,D=A-1,t===Vl&&A>od||t===hd&&A>ld)return 1;for(;;){Z=c-y,l[f]<F?(nt=0,j=l[f]):l[f]>F?(nt=M[Y+l[f]],j=V[Q+l[f]]):(nt=32+64,j=0),C=1<<c-y,T=1<<w,g=T;do T-=C,n[B+(x>>y)+T]=Z<<24|nt<<16|j|0;while(T!==0);for(C=1<<c-1;x&C;)C>>=1;if(C!==0?(x&=C-1,x+=C):x=0,f++,--R[c]===0){if(c===v)break;c=i[a+l[f]]}if(c>m&&(x&D)!==I){for(y===0&&(y=m),B+=g,w=c-y,_=1<<w;w+y<v&&(_-=R[w+y],!(_<=0));)w++,_<<=1;if(A+=1<<w,t===Vl&&A>od||t===hd&&A>ld)return 1;I=x&D,n[I]=m<<24|w<<16|B-r|0}}return x!==0&&(n[B+x]=c-y<<24|64<<16|0),o.bits=m,0},ei=Qi,fc=Qg,Ci=tv,HC=DC,fn=zC,WC=0,uv=1,fv=2,ud=4,UC=5,Rr=6,ja=0,VC=1,$C=2,gi=-2,dv=-3,gv=-4,jC=-5,fd=8,vv=1,dd=2,gd=3,vd=4,md=5,yd=6,pd=7,wd=8,bd=9,xd=10,Jr=11,Wi=12,$l=13,_d=14,jl=15,Ed=16,Ad=17,kd=18,Cd=19,Tr=20,Pr=21,Fd=22,Rd=23,Td=24,Pd=25,Sd=26,ql=27,Id=28,Bd=29,ne=30,mv=31,qC=32,YC=852,KC=592,XC=15,GC=XC;function Dd(e){return(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24)}function ZC(){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 ei.Buf16(320),this.work=new ei.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function yv(e){var t;return!e||!e.state?gi:(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=t.wrap&1),t.mode=vv,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new ei.Buf32(YC),t.distcode=t.distdyn=new ei.Buf32(KC),t.sane=1,t.back=-1,ja)}function pv(e){var t;return!e||!e.state?gi:(t=e.state,t.wsize=0,t.whave=0,t.wnext=0,yv(e))}function wv(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))?gi:(a.window!==null&&a.wbits!==t&&(a.window=null),a.wrap=i,a.wbits=t,pv(e))}function bv(e,t){var i,a;return e?(a=new ZC,e.state=a,a.window=null,i=wv(e,t),i!==ja&&(e.state=null),i):gi}function JC(e){return bv(e,GC)}var Ld=!0,Yl,Kl;function QC(e){if(Ld){var t;for(Yl=new ei.Buf32(512),Kl=new ei.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(fn(uv,e.lens,0,288,Yl,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;fn(fv,e.lens,0,32,Kl,0,e.work,{bits:5}),Ld=!1}e.lencode=Yl,e.lenbits=9,e.distcode=Kl,e.distbits=5}function xv(e,t,i,a){var s,n=e.state;return n.window===null&&(n.wsize=1<<n.wbits,n.wnext=0,n.whave=0,n.window=new ei.Buf8(n.wsize)),a>=n.wsize?(ei.arraySet(n.window,t,i-n.wsize,n.wsize,0),n.wnext=0,n.whave=n.wsize):(s=n.wsize-n.wnext,s>a&&(s=a),ei.arraySet(n.window,t,i-a,s,n.wnext),a-=s,a?(ei.arraySet(n.window,t,i-a,a,0),n.wnext=a,n.whave=n.wsize):(n.wnext+=s,n.wnext===n.wsize&&(n.wnext=0),n.whave<n.wsize&&(n.whave+=s))),0}function t5(e,t){var i,a,s,n,r,l,o,u,c,f,g,v,m,w,y=0,_,A,x,C,T,I,D,B,V=new ei.Buf8(4),Q,F,R=[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 gi;i=e.state,i.mode===Wi&&(i.mode=$l),r=e.next_out,s=e.output,o=e.avail_out,n=e.next_in,a=e.input,l=e.avail_in,u=i.hold,c=i.bits,f=l,g=o,B=ja;t:for(;;)switch(i.mode){case vv:if(i.wrap===0){i.mode=$l;break}for(;c<16;){if(l===0)break t;l--,u+=a[n++]<<c,c+=8}if(i.wrap&2&&u===35615){i.check=0,V[0]=u&255,V[1]=u>>>8&255,i.check=Ci(i.check,V,2,0),u=0,c=0,i.mode=dd;break}if(i.flags=0,i.head&&(i.head.done=!1),!(i.wrap&1)||(((u&255)<<8)+(u>>8))%31){e.msg="incorrect header check",i.mode=ne;break}if((u&15)!==fd){e.msg="unknown compression method",i.mode=ne;break}if(u>>>=4,c-=4,D=(u&15)+8,i.wbits===0)i.wbits=D;else if(D>i.wbits){e.msg="invalid window size",i.mode=ne;break}i.dmax=1<<D,e.adler=i.check=1,i.mode=u&512?xd:Wi,u=0,c=0;break;case dd:for(;c<16;){if(l===0)break t;l--,u+=a[n++]<<c,c+=8}if(i.flags=u,(i.flags&255)!==fd){e.msg="unknown compression method",i.mode=ne;break}if(i.flags&57344){e.msg="unknown header flags set",i.mode=ne;break}i.head&&(i.head.text=u>>8&1),i.flags&512&&(V[0]=u&255,V[1]=u>>>8&255,i.check=Ci(i.check,V,2,0)),u=0,c=0,i.mode=gd;case gd:for(;c<32;){if(l===0)break t;l--,u+=a[n++]<<c,c+=8}i.head&&(i.head.time=u),i.flags&512&&(V[0]=u&255,V[1]=u>>>8&255,V[2]=u>>>16&255,V[3]=u>>>24&255,i.check=Ci(i.check,V,4,0)),u=0,c=0,i.mode=vd;case vd:for(;c<16;){if(l===0)break t;l--,u+=a[n++]<<c,c+=8}i.head&&(i.head.xflags=u&255,i.head.os=u>>8),i.flags&512&&(V[0]=u&255,V[1]=u>>>8&255,i.check=Ci(i.check,V,2,0)),u=0,c=0,i.mode=md;case md:if(i.flags&1024){for(;c<16;){if(l===0)break t;l--,u+=a[n++]<<c,c+=8}i.length=u,i.head&&(i.head.extra_len=u),i.flags&512&&(V[0]=u&255,V[1]=u>>>8&255,i.check=Ci(i.check,V,2,0)),u=0,c=0}else i.head&&(i.head.extra=null);i.mode=yd;case yd:if(i.flags&1024&&(v=i.length,v>l&&(v=l),v&&(i.head&&(D=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Array(i.head.extra_len)),ei.arraySet(i.head.extra,a,n,v,D)),i.flags&512&&(i.check=Ci(i.check,a,v,n)),l-=v,n+=v,i.length-=v),i.length))break t;i.length=0,i.mode=pd;case pd:if(i.flags&2048){if(l===0)break t;v=0;do D=a[n+v++],i.head&&D&&i.length<65536&&(i.head.name+=String.fromCharCode(D));while(D&&v<l);if(i.flags&512&&(i.check=Ci(i.check,a,v,n)),l-=v,n+=v,D)break t}else i.head&&(i.head.name=null);i.length=0,i.mode=wd;case wd:if(i.flags&4096){if(l===0)break t;v=0;do D=a[n+v++],i.head&&D&&i.length<65536&&(i.head.comment+=String.fromCharCode(D));while(D&&v<l);if(i.flags&512&&(i.check=Ci(i.check,a,v,n)),l-=v,n+=v,D)break t}else i.head&&(i.head.comment=null);i.mode=bd;case bd:if(i.flags&512){for(;c<16;){if(l===0)break t;l--,u+=a[n++]<<c,c+=8}if(u!==(i.check&65535)){e.msg="header crc mismatch",i.mode=ne;break}u=0,c=0}i.head&&(i.head.hcrc=i.flags>>9&1,i.head.done=!0),e.adler=i.check=0,i.mode=Wi;break;case xd:for(;c<32;){if(l===0)break t;l--,u+=a[n++]<<c,c+=8}e.adler=i.check=Dd(u),u=0,c=0,i.mode=Jr;case Jr:if(i.havedict===0)return e.next_out=r,e.avail_out=o,e.next_in=n,e.avail_in=l,i.hold=u,i.bits=c,$C;e.adler=i.check=1,i.mode=Wi;case Wi:if(t===UC||t===Rr)break t;case $l:if(i.last){u>>>=c&7,c-=c&7,i.mode=ql;break}for(;c<3;){if(l===0)break t;l--,u+=a[n++]<<c,c+=8}switch(i.last=u&1,u>>>=1,c-=1,u&3){case 0:i.mode=_d;break;case 1:if(QC(i),i.mode=Tr,t===Rr){u>>>=2,c-=2;break t}break;case 2:i.mode=Ad;break;case 3:e.msg="invalid block type",i.mode=ne}u>>>=2,c-=2;break;case _d:for(u>>>=c&7,c-=c&7;c<32;){if(l===0)break t;l--,u+=a[n++]<<c,c+=8}if((u&65535)!==(u>>>16^65535)){e.msg="invalid stored block lengths",i.mode=ne;break}if(i.length=u&65535,u=0,c=0,i.mode=jl,t===Rr)break t;case jl:i.mode=Ed;case Ed:if(v=i.length,v){if(v>l&&(v=l),v>o&&(v=o),v===0)break t;ei.arraySet(s,a,n,v,r),l-=v,n+=v,o-=v,r+=v,i.length-=v;break}i.mode=Wi;break;case Ad:for(;c<14;){if(l===0)break t;l--,u+=a[n++]<<c,c+=8}if(i.nlen=(u&31)+257,u>>>=5,c-=5,i.ndist=(u&31)+1,u>>>=5,c-=5,i.ncode=(u&15)+4,u>>>=4,c-=4,i.nlen>286||i.ndist>30){e.msg="too many length or distance symbols",i.mode=ne;break}i.have=0,i.mode=kd;case kd:for(;i.have<i.ncode;){for(;c<3;){if(l===0)break t;l--,u+=a[n++]<<c,c+=8}i.lens[R[i.have++]]=u&7,u>>>=3,c-=3}for(;i.have<19;)i.lens[R[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,Q={bits:i.lenbits},B=fn(WC,i.lens,0,19,i.lencode,0,i.work,Q),i.lenbits=Q.bits,B){e.msg="invalid code lengths set",i.mode=ne;break}i.have=0,i.mode=Cd;case Cd:for(;i.have<i.nlen+i.ndist;){for(;y=i.lencode[u&(1<<i.lenbits)-1],_=y>>>24,A=y>>>16&255,x=y&65535,!(_<=c);){if(l===0)break t;l--,u+=a[n++]<<c,c+=8}if(x<16)u>>>=_,c-=_,i.lens[i.have++]=x;else{if(x===16){for(F=_+2;c<F;){if(l===0)break t;l--,u+=a[n++]<<c,c+=8}if(u>>>=_,c-=_,i.have===0){e.msg="invalid bit length repeat",i.mode=ne;break}D=i.lens[i.have-1],v=3+(u&3),u>>>=2,c-=2}else if(x===17){for(F=_+3;c<F;){if(l===0)break t;l--,u+=a[n++]<<c,c+=8}u>>>=_,c-=_,D=0,v=3+(u&7),u>>>=3,c-=3}else{for(F=_+7;c<F;){if(l===0)break t;l--,u+=a[n++]<<c,c+=8}u>>>=_,c-=_,D=0,v=11+(u&127),u>>>=7,c-=7}if(i.have+v>i.nlen+i.ndist){e.msg="invalid bit length repeat",i.mode=ne;break}for(;v--;)i.lens[i.have++]=D}}if(i.mode===ne)break;if(i.lens[256]===0){e.msg="invalid code -- missing end-of-block",i.mode=ne;break}if(i.lenbits=9,Q={bits:i.lenbits},B=fn(uv,i.lens,0,i.nlen,i.lencode,0,i.work,Q),i.lenbits=Q.bits,B){e.msg="invalid literal/lengths set",i.mode=ne;break}if(i.distbits=6,i.distcode=i.distdyn,Q={bits:i.distbits},B=fn(fv,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,Q),i.distbits=Q.bits,B){e.msg="invalid distances set",i.mode=ne;break}if(i.mode=Tr,t===Rr)break t;case Tr:i.mode=Pr;case Pr:if(l>=6&&o>=258){e.next_out=r,e.avail_out=o,e.next_in=n,e.avail_in=l,i.hold=u,i.bits=c,HC(e,g),r=e.next_out,s=e.output,o=e.avail_out,n=e.next_in,a=e.input,l=e.avail_in,u=i.hold,c=i.bits,i.mode===Wi&&(i.back=-1);break}for(i.back=0;y=i.lencode[u&(1<<i.lenbits)-1],_=y>>>24,A=y>>>16&255,x=y&65535,!(_<=c);){if(l===0)break t;l--,u+=a[n++]<<c,c+=8}if(A&&(A&240)===0){for(C=_,T=A,I=x;y=i.lencode[I+((u&(1<<C+T)-1)>>C)],_=y>>>24,A=y>>>16&255,x=y&65535,!(C+_<=c);){if(l===0)break t;l--,u+=a[n++]<<c,c+=8}u>>>=C,c-=C,i.back+=C}if(u>>>=_,c-=_,i.back+=_,i.length=x,A===0){i.mode=Sd;break}if(A&32){i.back=-1,i.mode=Wi;break}if(A&64){e.msg="invalid literal/length code",i.mode=ne;break}i.extra=A&15,i.mode=Fd;case Fd:if(i.extra){for(F=i.extra;c<F;){if(l===0)break t;l--,u+=a[n++]<<c,c+=8}i.length+=u&(1<<i.extra)-1,u>>>=i.extra,c-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=Rd;case Rd:for(;y=i.distcode[u&(1<<i.distbits)-1],_=y>>>24,A=y>>>16&255,x=y&65535,!(_<=c);){if(l===0)break t;l--,u+=a[n++]<<c,c+=8}if((A&240)===0){for(C=_,T=A,I=x;y=i.distcode[I+((u&(1<<C+T)-1)>>C)],_=y>>>24,A=y>>>16&255,x=y&65535,!(C+_<=c);){if(l===0)break t;l--,u+=a[n++]<<c,c+=8}u>>>=C,c-=C,i.back+=C}if(u>>>=_,c-=_,i.back+=_,A&64){e.msg="invalid distance code",i.mode=ne;break}i.offset=x,i.extra=A&15,i.mode=Td;case Td:if(i.extra){for(F=i.extra;c<F;){if(l===0)break t;l--,u+=a[n++]<<c,c+=8}i.offset+=u&(1<<i.extra)-1,u>>>=i.extra,c-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){e.msg="invalid distance too far back",i.mode=ne;break}i.mode=Pd;case Pd:if(o===0)break t;if(v=g-o,i.offset>v){if(v=i.offset-v,v>i.whave&&i.sane){e.msg="invalid distance too far back",i.mode=ne;break}v>i.wnext?(v-=i.wnext,m=i.wsize-v):m=i.wnext-v,v>i.length&&(v=i.length),w=i.window}else w=s,m=r-i.offset,v=i.length;v>o&&(v=o),o-=v,i.length-=v;do s[r++]=w[m++];while(--v);i.length===0&&(i.mode=Pr);break;case Sd:if(o===0)break t;s[r++]=i.length,o--,i.mode=Pr;break;case ql:if(i.wrap){for(;c<32;){if(l===0)break t;l--,u|=a[n++]<<c,c+=8}if(g-=o,e.total_out+=g,i.total+=g,g&&(e.adler=i.check=i.flags?Ci(i.check,s,g,r-g):fc(i.check,s,g,r-g)),g=o,(i.flags?u:Dd(u))!==i.check){e.msg="incorrect data check",i.mode=ne;break}u=0,c=0}i.mode=Id;case Id:if(i.wrap&&i.flags){for(;c<32;){if(l===0)break t;l--,u+=a[n++]<<c,c+=8}if(u!==(i.total&4294967295)){e.msg="incorrect length check",i.mode=ne;break}u=0,c=0}i.mode=Bd;case Bd:B=VC;break t;case ne:B=dv;break t;case mv:return gv;case qC:default:return gi}return e.next_out=r,e.avail_out=o,e.next_in=n,e.avail_in=l,i.hold=u,i.bits=c,(i.wsize||g!==e.avail_out&&i.mode<ne&&(i.mode<ql||t!==ud))&&xv(e,e.output,e.next_out,g-e.avail_out),f-=e.avail_in,g-=e.avail_out,e.total_in+=f,e.total_out+=g,i.total+=g,i.wrap&&g&&(e.adler=i.check=i.flags?Ci(i.check,s,g,e.next_out-g):fc(i.check,s,g,e.next_out-g)),e.data_type=i.bits+(i.last?64:0)+(i.mode===Wi?128:0)+(i.mode===Tr||i.mode===jl?256:0),(f===0&&g===0||t===ud)&&B===ja&&(B=jC),B}function e5(e){if(!e||!e.state)return gi;var t=e.state;return t.window&&(t.window=null),e.state=null,ja}function i5(e,t){var i;return!e||!e.state||(i=e.state,(i.wrap&2)===0)?gi:(i.head=t,t.done=!1,ja)}function a5(e,t){var i=t.length,a,s,n;return!e||!e.state||(a=e.state,a.wrap!==0&&a.mode!==Jr)?gi:a.mode===Jr&&(s=1,s=fc(s,t,i,0),s!==a.check)?dv:(n=xv(e,t,i,i),n?(a.mode=mv,gv):(a.havedict=1,ja))}bi.inflateReset=pv;bi.inflateReset2=wv;bi.inflateResetKeep=yv;bi.inflateInit=JC;bi.inflateInit2=bv;bi.inflate=t5;bi.inflateEnd=e5;bi.inflateGetHeader=i5;bi.inflateSetDictionary=a5;bi.inflateInfo="pako inflate (from Nodeca project)";var _v={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 s5(){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 n5=s5,Fs=bi,dn=Qi,zr=Xa,de=_v,dc=Sc,r5=cv,o5=n5,Ev=Object.prototype.toString;function qa(e){if(!(this instanceof qa))return new qa(e);this.options=dn.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 r5,this.strm.avail_out=0;var i=Fs.inflateInit2(this.strm,t.windowBits);if(i!==de.Z_OK)throw new Error(dc[i]);if(this.header=new o5,Fs.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=zr.string2buf(t.dictionary):Ev.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(i=Fs.inflateSetDictionary(this.strm,t.dictionary),i!==de.Z_OK)))throw new Error(dc[i])}qa.prototype.push=function(e,t){var i=this.strm,a=this.options.chunkSize,s=this.options.dictionary,n,r,l,o,u,c=!1;if(this.ended)return!1;r=t===~~t?t:t===!0?de.Z_FINISH:de.Z_NO_FLUSH,typeof e=="string"?i.input=zr.binstring2buf(e):Ev.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 dn.Buf8(a),i.next_out=0,i.avail_out=a),n=Fs.inflate(i,de.Z_NO_FLUSH),n===de.Z_NEED_DICT&&s&&(n=Fs.inflateSetDictionary(this.strm,s)),n===de.Z_BUF_ERROR&&c===!0&&(n=de.Z_OK,c=!1),n!==de.Z_STREAM_END&&n!==de.Z_OK)return this.onEnd(n),this.ended=!0,!1;i.next_out&&(i.avail_out===0||n===de.Z_STREAM_END||i.avail_in===0&&(r===de.Z_FINISH||r===de.Z_SYNC_FLUSH))&&(this.options.to==="string"?(l=zr.utf8border(i.output,i.next_out),o=i.next_out-l,u=zr.buf2string(i.output,l),i.next_out=o,i.avail_out=a-o,o&&dn.arraySet(i.output,i.output,l,o,0),this.onData(u)):this.onData(dn.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!==de.Z_STREAM_END);return n===de.Z_STREAM_END&&(r=de.Z_FINISH),r===de.Z_FINISH?(n=Fs.inflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===de.Z_OK):(r===de.Z_SYNC_FLUSH&&(this.onEnd(de.Z_OK),i.avail_out=0),!0)};qa.prototype.onData=function(e){this.chunks.push(e)};qa.prototype.onEnd=function(e){e===de.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=dn.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function Bc(e,t){var i=new qa(t);if(i.push(e,!0),i.err)throw i.msg||dc[i.err];return i.result}function l5(e,t){return t=t||{},t.raw=!0,Bc(e,t)}Fn.Inflate=qa;Fn.inflate=Bc;Fn.inflateRaw=l5;Fn.ungzip=Bc;var c5=Qi.assign,h5=An,u5=Fn,f5=_v,Av={};c5(Av,h5,u5,f5);var D5=Av,gc={exports:{}};/**
  100. * @license
  101. * Lodash <https://lodash.com/>
  102. * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
  103. * Released under MIT license <https://lodash.com/license>
  104. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  105. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  106. */(function(e,t){(function(){var i,a="4.17.21",s=200,n="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",r="Expected a function",l="Invalid `variable` option passed into `_.template`",o="__lodash_hash_undefined__",u=500,c="__lodash_placeholder__",f=1,g=2,v=4,m=1,w=2,y=1,_=2,A=4,x=8,C=16,T=32,I=64,D=128,B=256,V=512,Q=30,F="...",R=800,P=16,M=1,Y=2,Z=3,nt=1/0,j=9007199254740991,H=17976931348623157e292,$=0/0,K=4294967295,U=K-1,tt=K>>>1,at=[["ary",D],["bind",y],["bindKey",_],["curry",x],["curryRight",C],["flip",V],["partial",T],["partialRight",I],["rearg",B]],et="[object Arguments]",ut="[object Array]",ct="[object AsyncFunction]",ot="[object Boolean]",b="[object Date]",E="[object DOMException]",S="[object Error]",N="[object Function]",X="[object GeneratorFunction]",G="[object Map]",rt="[object Number]",yt="[object Null]",mt="[object Object]",At="[object Promise]",Rt="[object Proxy]",be="[object RegExp]",ae="[object Set]",xe="[object String]",jt="[object Symbol]",te="[object Undefined]",xi="[object WeakMap]",kv="[object WeakSet]",Ds="[object ArrayBuffer]",Ga="[object DataView]",so="[object Float32Array]",no="[object Float64Array]",ro="[object Int8Array]",oo="[object Int16Array]",lo="[object Int32Array]",co="[object Uint8Array]",ho="[object Uint8ClampedArray]",uo="[object Uint16Array]",fo="[object Uint32Array]",Cv=/\b__p \+= '';/g,Fv=/\b(__p \+=) '' \+/g,Rv=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Dc=/&(?:amp|lt|gt|quot|#39);/g,Lc=/[&<>"']/g,Tv=RegExp(Dc.source),Pv=RegExp(Lc.source),Sv=/<%-([\s\S]+?)%>/g,Iv=/<%([\s\S]+?)%>/g,Mc=/<%=([\s\S]+?)%>/g,Bv=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Dv=/^\w*$/,Lv=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,go=/[\\^$.*+?()[\]{}|]/g,Mv=RegExp(go.source),vo=/^\s+/,Ov=/\s/,Nv=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,zv=/\{\n\/\* \[wrapped with (.+)\] \*/,Hv=/,? & /,Wv=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Uv=/[()=,{}\[\]\/\s]/,Vv=/\\(\\)?/g,$v=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Oc=/\w*$/,jv=/^[-+]0x[0-9a-f]+$/i,qv=/^0b[01]+$/i,Yv=/^\[object .+?Constructor\]$/,Kv=/^0o[0-7]+$/i,Xv=/^(?:0|[1-9]\d*)$/,Gv=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Rn=/($^)/,Zv=/['\n\r\u2028\u2029\\]/g,Tn="\\ud800-\\udfff",Jv="\\u0300-\\u036f",Qv="\\ufe20-\\ufe2f",t0="\\u20d0-\\u20ff",Nc=Jv+Qv+t0,zc="\\u2700-\\u27bf",Hc="a-z\\xdf-\\xf6\\xf8-\\xff",e0="\\xac\\xb1\\xd7\\xf7",i0="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",a0="\\u2000-\\u206f",s0=" \\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",Wc="A-Z\\xc0-\\xd6\\xd8-\\xde",Uc="\\ufe0e\\ufe0f",Vc=e0+i0+a0+s0,mo="['\u2019]",n0="["+Tn+"]",$c="["+Vc+"]",Pn="["+Nc+"]",jc="\\d+",r0="["+zc+"]",qc="["+Hc+"]",Yc="[^"+Tn+Vc+jc+zc+Hc+Wc+"]",yo="\\ud83c[\\udffb-\\udfff]",o0="(?:"+Pn+"|"+yo+")",Kc="[^"+Tn+"]",po="(?:\\ud83c[\\udde6-\\uddff]){2}",wo="[\\ud800-\\udbff][\\udc00-\\udfff]",Za="["+Wc+"]",Xc="\\u200d",Gc="(?:"+qc+"|"+Yc+")",l0="(?:"+Za+"|"+Yc+")",Zc="(?:"+mo+"(?:d|ll|m|re|s|t|ve))?",Jc="(?:"+mo+"(?:D|LL|M|RE|S|T|VE))?",Qc=o0+"?",th="["+Uc+"]?",c0="(?:"+Xc+"(?:"+[Kc,po,wo].join("|")+")"+th+Qc+")*",h0="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",u0="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",eh=th+Qc+c0,f0="(?:"+[r0,po,wo].join("|")+")"+eh,d0="(?:"+[Kc+Pn+"?",Pn,po,wo,n0].join("|")+")",g0=RegExp(mo,"g"),v0=RegExp(Pn,"g"),bo=RegExp(yo+"(?="+yo+")|"+d0+eh,"g"),m0=RegExp([Za+"?"+qc+"+"+Zc+"(?="+[$c,Za,"$"].join("|")+")",l0+"+"+Jc+"(?="+[$c,Za+Gc,"$"].join("|")+")",Za+"?"+Gc+"+"+Zc,Za+"+"+Jc,u0,h0,jc,f0].join("|"),"g"),y0=RegExp("["+Xc+Tn+Nc+Uc+"]"),p0=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,w0=["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"],b0=-1,ie={};ie[so]=ie[no]=ie[ro]=ie[oo]=ie[lo]=ie[co]=ie[ho]=ie[uo]=ie[fo]=!0,ie[et]=ie[ut]=ie[Ds]=ie[ot]=ie[Ga]=ie[b]=ie[S]=ie[N]=ie[G]=ie[rt]=ie[mt]=ie[be]=ie[ae]=ie[xe]=ie[xi]=!1;var ee={};ee[et]=ee[ut]=ee[Ds]=ee[Ga]=ee[ot]=ee[b]=ee[so]=ee[no]=ee[ro]=ee[oo]=ee[lo]=ee[G]=ee[rt]=ee[mt]=ee[be]=ee[ae]=ee[xe]=ee[jt]=ee[co]=ee[ho]=ee[uo]=ee[fo]=!0,ee[S]=ee[N]=ee[xi]=!1;var x0={\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"},_0={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},E0={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"},A0={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},k0=parseFloat,C0=parseInt,ih=typeof Be=="object"&&Be&&Be.Object===Object&&Be,F0=typeof self=="object"&&self&&self.Object===Object&&self,_e=ih||F0||Function("return this")(),xo=t&&!t.nodeType&&t,xa=xo&&!0&&e&&!e.nodeType&&e,ah=xa&&xa.exports===xo,_o=ah&&ih.process,ii=function(){try{var it=xa&&xa.require&&xa.require("util").types;return it||_o&&_o.binding&&_o.binding("util")}catch{}}(),sh=ii&&ii.isArrayBuffer,nh=ii&&ii.isDate,rh=ii&&ii.isMap,oh=ii&&ii.isRegExp,lh=ii&&ii.isSet,ch=ii&&ii.isTypedArray;function qe(it,ft,lt){switch(lt.length){case 0:return it.call(ft);case 1:return it.call(ft,lt[0]);case 2:return it.call(ft,lt[0],lt[1]);case 3:return it.call(ft,lt[0],lt[1],lt[2])}return it.apply(ft,lt)}function R0(it,ft,lt,wt){for(var Tt=-1,qt=it==null?0:it.length;++Tt<qt;){var ve=it[Tt];ft(wt,ve,lt(ve),it)}return wt}function ai(it,ft){for(var lt=-1,wt=it==null?0:it.length;++lt<wt&&ft(it[lt],lt,it)!==!1;);return it}function T0(it,ft){for(var lt=it==null?0:it.length;lt--&&ft(it[lt],lt,it)!==!1;);return it}function hh(it,ft){for(var lt=-1,wt=it==null?0:it.length;++lt<wt;)if(!ft(it[lt],lt,it))return!1;return!0}function ta(it,ft){for(var lt=-1,wt=it==null?0:it.length,Tt=0,qt=[];++lt<wt;){var ve=it[lt];ft(ve,lt,it)&&(qt[Tt++]=ve)}return qt}function Sn(it,ft){var lt=it==null?0:it.length;return!!lt&&Ja(it,ft,0)>-1}function Eo(it,ft,lt){for(var wt=-1,Tt=it==null?0:it.length;++wt<Tt;)if(lt(ft,it[wt]))return!0;return!1}function se(it,ft){for(var lt=-1,wt=it==null?0:it.length,Tt=Array(wt);++lt<wt;)Tt[lt]=ft(it[lt],lt,it);return Tt}function ea(it,ft){for(var lt=-1,wt=ft.length,Tt=it.length;++lt<wt;)it[Tt+lt]=ft[lt];return it}function Ao(it,ft,lt,wt){var Tt=-1,qt=it==null?0:it.length;for(wt&&qt&&(lt=it[++Tt]);++Tt<qt;)lt=ft(lt,it[Tt],Tt,it);return lt}function P0(it,ft,lt,wt){var Tt=it==null?0:it.length;for(wt&&Tt&&(lt=it[--Tt]);Tt--;)lt=ft(lt,it[Tt],Tt,it);return lt}function ko(it,ft){for(var lt=-1,wt=it==null?0:it.length;++lt<wt;)if(ft(it[lt],lt,it))return!0;return!1}var S0=Co("length");function I0(it){return it.split("")}function B0(it){return it.match(Wv)||[]}function uh(it,ft,lt){var wt;return lt(it,function(Tt,qt,ve){if(ft(Tt,qt,ve))return wt=qt,!1}),wt}function In(it,ft,lt,wt){for(var Tt=it.length,qt=lt+(wt?1:-1);wt?qt--:++qt<Tt;)if(ft(it[qt],qt,it))return qt;return-1}function Ja(it,ft,lt){return ft===ft?j0(it,ft,lt):In(it,fh,lt)}function D0(it,ft,lt,wt){for(var Tt=lt-1,qt=it.length;++Tt<qt;)if(wt(it[Tt],ft))return Tt;return-1}function fh(it){return it!==it}function dh(it,ft){var lt=it==null?0:it.length;return lt?Ro(it,ft)/lt:$}function Co(it){return function(ft){return ft==null?i:ft[it]}}function Fo(it){return function(ft){return it==null?i:it[ft]}}function gh(it,ft,lt,wt,Tt){return Tt(it,function(qt,ve,Zt){lt=wt?(wt=!1,qt):ft(lt,qt,ve,Zt)}),lt}function L0(it,ft){var lt=it.length;for(it.sort(ft);lt--;)it[lt]=it[lt].value;return it}function Ro(it,ft){for(var lt,wt=-1,Tt=it.length;++wt<Tt;){var qt=ft(it[wt]);qt!==i&&(lt=lt===i?qt:lt+qt)}return lt}function To(it,ft){for(var lt=-1,wt=Array(it);++lt<it;)wt[lt]=ft(lt);return wt}function M0(it,ft){return se(ft,function(lt){return[lt,it[lt]]})}function vh(it){return it&&it.slice(0,wh(it)+1).replace(vo,"")}function Ye(it){return function(ft){return it(ft)}}function Po(it,ft){return se(ft,function(lt){return it[lt]})}function Ls(it,ft){return it.has(ft)}function mh(it,ft){for(var lt=-1,wt=it.length;++lt<wt&&Ja(ft,it[lt],0)>-1;);return lt}function yh(it,ft){for(var lt=it.length;lt--&&Ja(ft,it[lt],0)>-1;);return lt}function O0(it,ft){for(var lt=it.length,wt=0;lt--;)it[lt]===ft&&++wt;return wt}var N0=Fo(x0),z0=Fo(_0);function H0(it){return"\\"+A0[it]}function W0(it,ft){return it==null?i:it[ft]}function Qa(it){return y0.test(it)}function U0(it){return p0.test(it)}function V0(it){for(var ft,lt=[];!(ft=it.next()).done;)lt.push(ft.value);return lt}function So(it){var ft=-1,lt=Array(it.size);return it.forEach(function(wt,Tt){lt[++ft]=[Tt,wt]}),lt}function ph(it,ft){return function(lt){return it(ft(lt))}}function ia(it,ft){for(var lt=-1,wt=it.length,Tt=0,qt=[];++lt<wt;){var ve=it[lt];(ve===ft||ve===c)&&(it[lt]=c,qt[Tt++]=lt)}return qt}function Bn(it){var ft=-1,lt=Array(it.size);return it.forEach(function(wt){lt[++ft]=wt}),lt}function $0(it){var ft=-1,lt=Array(it.size);return it.forEach(function(wt){lt[++ft]=[wt,wt]}),lt}function j0(it,ft,lt){for(var wt=lt-1,Tt=it.length;++wt<Tt;)if(it[wt]===ft)return wt;return-1}function q0(it,ft,lt){for(var wt=lt+1;wt--;)if(it[wt]===ft)return wt;return wt}function ts(it){return Qa(it)?K0(it):S0(it)}function vi(it){return Qa(it)?X0(it):I0(it)}function wh(it){for(var ft=it.length;ft--&&Ov.test(it.charAt(ft)););return ft}var Y0=Fo(E0);function K0(it){for(var ft=bo.lastIndex=0;bo.test(it);)++ft;return ft}function X0(it){return it.match(bo)||[]}function G0(it){return it.match(m0)||[]}var Z0=function it(ft){ft=ft==null?_e:es.defaults(_e.Object(),ft,es.pick(_e,w0));var lt=ft.Array,wt=ft.Date,Tt=ft.Error,qt=ft.Function,ve=ft.Math,Zt=ft.Object,Io=ft.RegExp,J0=ft.String,si=ft.TypeError,Dn=lt.prototype,Q0=qt.prototype,is=Zt.prototype,Ln=ft["__core-js_shared__"],Mn=Q0.toString,Xt=is.hasOwnProperty,tm=0,bh=function(){var h=/[^.]+$/.exec(Ln&&Ln.keys&&Ln.keys.IE_PROTO||"");return h?"Symbol(src)_1."+h:""}(),On=is.toString,em=Mn.call(Zt),im=_e._,am=Io("^"+Mn.call(Xt).replace(go,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Nn=ah?ft.Buffer:i,aa=ft.Symbol,zn=ft.Uint8Array,xh=Nn?Nn.allocUnsafe:i,Hn=ph(Zt.getPrototypeOf,Zt),_h=Zt.create,Eh=is.propertyIsEnumerable,Wn=Dn.splice,Ah=aa?aa.isConcatSpreadable:i,Ms=aa?aa.iterator:i,_a=aa?aa.toStringTag:i,Un=function(){try{var h=Fa(Zt,"defineProperty");return h({},"",{}),h}catch{}}(),sm=ft.clearTimeout!==_e.clearTimeout&&ft.clearTimeout,nm=wt&&wt.now!==_e.Date.now&&wt.now,rm=ft.setTimeout!==_e.setTimeout&&ft.setTimeout,Vn=ve.ceil,$n=ve.floor,Bo=Zt.getOwnPropertySymbols,om=Nn?Nn.isBuffer:i,kh=ft.isFinite,lm=Dn.join,cm=ph(Zt.keys,Zt),me=ve.max,Re=ve.min,hm=wt.now,um=ft.parseInt,Ch=ve.random,fm=Dn.reverse,Do=Fa(ft,"DataView"),Os=Fa(ft,"Map"),Lo=Fa(ft,"Promise"),as=Fa(ft,"Set"),Ns=Fa(ft,"WeakMap"),zs=Fa(Zt,"create"),jn=Ns&&new Ns,ss={},dm=Ra(Do),gm=Ra(Os),vm=Ra(Lo),mm=Ra(as),ym=Ra(Ns),qn=aa?aa.prototype:i,Hs=qn?qn.valueOf:i,Fh=qn?qn.toString:i;function O(h){if(ce(h)&&!Pt(h)&&!(h instanceof Nt)){if(h instanceof ni)return h;if(Xt.call(h,"__wrapped__"))return Ru(h)}return new ni(h)}var ns=function(){function h(){}return function(d){if(!oe(d))return{};if(_h)return _h(d);h.prototype=d;var p=new h;return h.prototype=i,p}}();function Yn(){}function ni(h,d){this.__wrapped__=h,this.__actions__=[],this.__chain__=!!d,this.__index__=0,this.__values__=i}O.templateSettings={escape:Sv,evaluate:Iv,interpolate:Mc,variable:"",imports:{_:O}},O.prototype=Yn.prototype,O.prototype.constructor=O,ni.prototype=ns(Yn.prototype),ni.prototype.constructor=ni;function Nt(h){this.__wrapped__=h,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=K,this.__views__=[]}function pm(){var h=new Nt(this.__wrapped__);return h.__actions__=Me(this.__actions__),h.__dir__=this.__dir__,h.__filtered__=this.__filtered__,h.__iteratees__=Me(this.__iteratees__),h.__takeCount__=this.__takeCount__,h.__views__=Me(this.__views__),h}function wm(){if(this.__filtered__){var h=new Nt(this);h.__dir__=-1,h.__filtered__=!0}else h=this.clone(),h.__dir__*=-1;return h}function bm(){var h=this.__wrapped__.value(),d=this.__dir__,p=Pt(h),k=d<0,L=p?h.length:0,z=Iy(0,L,this.__views__),q=z.start,J=z.end,st=J-q,dt=k?J:q-1,gt=this.__iteratees__,vt=gt.length,pt=0,_t=Re(st,this.__takeCount__);if(!p||!k&&L==st&&_t==st)return Zh(h,this.__actions__);var Ct=[];t:for(;st--&&pt<_t;){dt+=d;for(var Dt=-1,Ft=h[dt];++Dt<vt;){var Ot=gt[Dt],Ht=Ot.iteratee,Ge=Ot.type,Ie=Ht(Ft);if(Ge==Y)Ft=Ie;else if(!Ie){if(Ge==M)continue t;break t}}Ct[pt++]=Ft}return Ct}Nt.prototype=ns(Yn.prototype),Nt.prototype.constructor=Nt;function Ea(h){var d=-1,p=h==null?0:h.length;for(this.clear();++d<p;){var k=h[d];this.set(k[0],k[1])}}function xm(){this.__data__=zs?zs(null):{},this.size=0}function _m(h){var d=this.has(h)&&delete this.__data__[h];return this.size-=d?1:0,d}function Em(h){var d=this.__data__;if(zs){var p=d[h];return p===o?i:p}return Xt.call(d,h)?d[h]:i}function Am(h){var d=this.__data__;return zs?d[h]!==i:Xt.call(d,h)}function km(h,d){var p=this.__data__;return this.size+=this.has(h)?0:1,p[h]=zs&&d===i?o:d,this}Ea.prototype.clear=xm,Ea.prototype.delete=_m,Ea.prototype.get=Em,Ea.prototype.has=Am,Ea.prototype.set=km;function Ii(h){var d=-1,p=h==null?0:h.length;for(this.clear();++d<p;){var k=h[d];this.set(k[0],k[1])}}function Cm(){this.__data__=[],this.size=0}function Fm(h){var d=this.__data__,p=Kn(d,h);if(p<0)return!1;var k=d.length-1;return p==k?d.pop():Wn.call(d,p,1),--this.size,!0}function Rm(h){var d=this.__data__,p=Kn(d,h);return p<0?i:d[p][1]}function Tm(h){return Kn(this.__data__,h)>-1}function Pm(h,d){var p=this.__data__,k=Kn(p,h);return k<0?(++this.size,p.push([h,d])):p[k][1]=d,this}Ii.prototype.clear=Cm,Ii.prototype.delete=Fm,Ii.prototype.get=Rm,Ii.prototype.has=Tm,Ii.prototype.set=Pm;function Bi(h){var d=-1,p=h==null?0:h.length;for(this.clear();++d<p;){var k=h[d];this.set(k[0],k[1])}}function Sm(){this.size=0,this.__data__={hash:new Ea,map:new(Os||Ii),string:new Ea}}function Im(h){var d=rr(this,h).delete(h);return this.size-=d?1:0,d}function Bm(h){return rr(this,h).get(h)}function Dm(h){return rr(this,h).has(h)}function Lm(h,d){var p=rr(this,h),k=p.size;return p.set(h,d),this.size+=p.size==k?0:1,this}Bi.prototype.clear=Sm,Bi.prototype.delete=Im,Bi.prototype.get=Bm,Bi.prototype.has=Dm,Bi.prototype.set=Lm;function Aa(h){var d=-1,p=h==null?0:h.length;for(this.__data__=new Bi;++d<p;)this.add(h[d])}function Mm(h){return this.__data__.set(h,o),this}function Om(h){return this.__data__.has(h)}Aa.prototype.add=Aa.prototype.push=Mm,Aa.prototype.has=Om;function mi(h){var d=this.__data__=new Ii(h);this.size=d.size}function Nm(){this.__data__=new Ii,this.size=0}function zm(h){var d=this.__data__,p=d.delete(h);return this.size=d.size,p}function Hm(h){return this.__data__.get(h)}function Wm(h){return this.__data__.has(h)}function Um(h,d){var p=this.__data__;if(p instanceof Ii){var k=p.__data__;if(!Os||k.length<s-1)return k.push([h,d]),this.size=++p.size,this;p=this.__data__=new Bi(k)}return p.set(h,d),this.size=p.size,this}mi.prototype.clear=Nm,mi.prototype.delete=zm,mi.prototype.get=Hm,mi.prototype.has=Wm,mi.prototype.set=Um;function Rh(h,d){var p=Pt(h),k=!p&&Ta(h),L=!p&&!k&&la(h),z=!p&&!k&&!L&&cs(h),q=p||k||L||z,J=q?To(h.length,J0):[],st=J.length;for(var dt in h)(d||Xt.call(h,dt))&&!(q&&(dt=="length"||L&&(dt=="offset"||dt=="parent")||z&&(dt=="buffer"||dt=="byteLength"||dt=="byteOffset")||Oi(dt,st)))&&J.push(dt);return J}function Th(h){var d=h.length;return d?h[qo(0,d-1)]:i}function Vm(h,d){return or(Me(h),ka(d,0,h.length))}function $m(h){return or(Me(h))}function Mo(h,d,p){(p!==i&&!yi(h[d],p)||p===i&&!(d in h))&&Di(h,d,p)}function Ws(h,d,p){var k=h[d];(!(Xt.call(h,d)&&yi(k,p))||p===i&&!(d in h))&&Di(h,d,p)}function Kn(h,d){for(var p=h.length;p--;)if(yi(h[p][0],d))return p;return-1}function jm(h,d,p,k){return sa(h,function(L,z,q){d(k,L,p(L),q)}),k}function Ph(h,d){return h&&Ei(d,pe(d),h)}function qm(h,d){return h&&Ei(d,Ne(d),h)}function Di(h,d,p){d=="__proto__"&&Un?Un(h,d,{configurable:!0,enumerable:!0,value:p,writable:!0}):h[d]=p}function Oo(h,d){for(var p=-1,k=d.length,L=lt(k),z=h==null;++p<k;)L[p]=z?i:yl(h,d[p]);return L}function ka(h,d,p){return h===h&&(p!==i&&(h=h<=p?h:p),d!==i&&(h=h>=d?h:d)),h}function ri(h,d,p,k,L,z){var q,J=d&f,st=d&g,dt=d&v;if(p&&(q=L?p(h,k,L,z):p(h)),q!==i)return q;if(!oe(h))return h;var gt=Pt(h);if(gt){if(q=Dy(h),!J)return Me(h,q)}else{var vt=Te(h),pt=vt==N||vt==X;if(la(h))return tu(h,J);if(vt==mt||vt==et||pt&&!L){if(q=st||pt?{}:wu(h),!J)return st?Ey(h,qm(q,h)):_y(h,Ph(q,h))}else{if(!ee[vt])return L?h:{};q=Ly(h,vt,J)}}z||(z=new mi);var _t=z.get(h);if(_t)return _t;z.set(h,q),Ku(h)?h.forEach(function(Ft){q.add(ri(Ft,d,p,Ft,h,z))}):qu(h)&&h.forEach(function(Ft,Ot){q.set(Ot,ri(Ft,d,p,Ot,h,z))});var Ct=dt?st?al:il:st?Ne:pe,Dt=gt?i:Ct(h);return ai(Dt||h,function(Ft,Ot){Dt&&(Ot=Ft,Ft=h[Ot]),Ws(q,Ot,ri(Ft,d,p,Ot,h,z))}),q}function Ym(h){var d=pe(h);return function(p){return Sh(p,h,d)}}function Sh(h,d,p){var k=p.length;if(h==null)return!k;for(h=Zt(h);k--;){var L=p[k],z=d[L],q=h[L];if(q===i&&!(L in h)||!z(q))return!1}return!0}function Ih(h,d,p){if(typeof h!="function")throw new si(r);return Ks(function(){h.apply(i,p)},d)}function Us(h,d,p,k){var L=-1,z=Sn,q=!0,J=h.length,st=[],dt=d.length;if(!J)return st;p&&(d=se(d,Ye(p))),k?(z=Eo,q=!1):d.length>=s&&(z=Ls,q=!1,d=new Aa(d));t:for(;++L<J;){var gt=h[L],vt=p==null?gt:p(gt);if(gt=k||gt!==0?gt:0,q&&vt===vt){for(var pt=dt;pt--;)if(d[pt]===vt)continue t;st.push(gt)}else z(d,vt,k)||st.push(gt)}return st}var sa=nu(_i),Bh=nu(zo,!0);function Km(h,d){var p=!0;return sa(h,function(k,L,z){return p=!!d(k,L,z),p}),p}function Xn(h,d,p){for(var k=-1,L=h.length;++k<L;){var z=h[k],q=d(z);if(q!=null&&(J===i?q===q&&!Xe(q):p(q,J)))var J=q,st=z}return st}function Xm(h,d,p,k){var L=h.length;for(p=Bt(p),p<0&&(p=-p>L?0:L+p),k=k===i||k>L?L:Bt(k),k<0&&(k+=L),k=p>k?0:Gu(k);p<k;)h[p++]=d;return h}function Dh(h,d){var p=[];return sa(h,function(k,L,z){d(k,L,z)&&p.push(k)}),p}function Ee(h,d,p,k,L){var z=-1,q=h.length;for(p||(p=Oy),L||(L=[]);++z<q;){var J=h[z];d>0&&p(J)?d>1?Ee(J,d-1,p,k,L):ea(L,J):k||(L[L.length]=J)}return L}var No=ru(),Lh=ru(!0);function _i(h,d){return h&&No(h,d,pe)}function zo(h,d){return h&&Lh(h,d,pe)}function Gn(h,d){return ta(d,function(p){return Ni(h[p])})}function Ca(h,d){d=ra(d,h);for(var p=0,k=d.length;h!=null&&p<k;)h=h[Ai(d[p++])];return p&&p==k?h:i}function Mh(h,d,p){var k=d(h);return Pt(h)?k:ea(k,p(h))}function Pe(h){return h==null?h===i?te:yt:_a&&_a in Zt(h)?Sy(h):$y(h)}function Ho(h,d){return h>d}function Gm(h,d){return h!=null&&Xt.call(h,d)}function Zm(h,d){return h!=null&&d in Zt(h)}function Jm(h,d,p){return h>=Re(d,p)&&h<me(d,p)}function Wo(h,d,p){for(var k=p?Eo:Sn,L=h[0].length,z=h.length,q=z,J=lt(z),st=1/0,dt=[];q--;){var gt=h[q];q&&d&&(gt=se(gt,Ye(d))),st=Re(gt.length,st),J[q]=!p&&(d||L>=120&&gt.length>=120)?new Aa(q&&gt):i}gt=h[0];var vt=-1,pt=J[0];t:for(;++vt<L&&dt.length<st;){var _t=gt[vt],Ct=d?d(_t):_t;if(_t=p||_t!==0?_t:0,!(pt?Ls(pt,Ct):k(dt,Ct,p))){for(q=z;--q;){var Dt=J[q];if(!(Dt?Ls(Dt,Ct):k(h[q],Ct,p)))continue t}pt&&pt.push(Ct),dt.push(_t)}}return dt}function Qm(h,d,p,k){return _i(h,function(L,z,q){d(k,p(L),z,q)}),k}function Vs(h,d,p){d=ra(d,h),h=Eu(h,d);var k=h==null?h:h[Ai(li(d))];return k==null?i:qe(k,h,p)}function Oh(h){return ce(h)&&Pe(h)==et}function ty(h){return ce(h)&&Pe(h)==Ds}function ey(h){return ce(h)&&Pe(h)==b}function $s(h,d,p,k,L){return h===d?!0:h==null||d==null||!ce(h)&&!ce(d)?h!==h&&d!==d:iy(h,d,p,k,$s,L)}function iy(h,d,p,k,L,z){var q=Pt(h),J=Pt(d),st=q?ut:Te(h),dt=J?ut:Te(d);st=st==et?mt:st,dt=dt==et?mt:dt;var gt=st==mt,vt=dt==mt,pt=st==dt;if(pt&&la(h)){if(!la(d))return!1;q=!0,gt=!1}if(pt&&!gt)return z||(z=new mi),q||cs(h)?mu(h,d,p,k,L,z):Ty(h,d,st,p,k,L,z);if(!(p&m)){var _t=gt&&Xt.call(h,"__wrapped__"),Ct=vt&&Xt.call(d,"__wrapped__");if(_t||Ct){var Dt=_t?h.value():h,Ft=Ct?d.value():d;return z||(z=new mi),L(Dt,Ft,p,k,z)}}return pt?(z||(z=new mi),Py(h,d,p,k,L,z)):!1}function ay(h){return ce(h)&&Te(h)==G}function Uo(h,d,p,k){var L=p.length,z=L,q=!k;if(h==null)return!z;for(h=Zt(h);L--;){var J=p[L];if(q&&J[2]?J[1]!==h[J[0]]:!(J[0]in h))return!1}for(;++L<z;){J=p[L];var st=J[0],dt=h[st],gt=J[1];if(q&&J[2]){if(dt===i&&!(st in h))return!1}else{var vt=new mi;if(k)var pt=k(dt,gt,st,h,d,vt);if(!(pt===i?$s(gt,dt,m|w,k,vt):pt))return!1}}return!0}function Nh(h){if(!oe(h)||zy(h))return!1;var d=Ni(h)?am:Yv;return d.test(Ra(h))}function sy(h){return ce(h)&&Pe(h)==be}function ny(h){return ce(h)&&Te(h)==ae}function ry(h){return ce(h)&&dr(h.length)&&!!ie[Pe(h)]}function zh(h){return typeof h=="function"?h:h==null?ze:typeof h=="object"?Pt(h)?Uh(h[0],h[1]):Wh(h):lf(h)}function Vo(h){if(!Ys(h))return cm(h);var d=[];for(var p in Zt(h))Xt.call(h,p)&&p!="constructor"&&d.push(p);return d}function oy(h){if(!oe(h))return Vy(h);var d=Ys(h),p=[];for(var k in h)k=="constructor"&&(d||!Xt.call(h,k))||p.push(k);return p}function $o(h,d){return h<d}function Hh(h,d){var p=-1,k=Oe(h)?lt(h.length):[];return sa(h,function(L,z,q){k[++p]=d(L,z,q)}),k}function Wh(h){var d=nl(h);return d.length==1&&d[0][2]?xu(d[0][0],d[0][1]):function(p){return p===h||Uo(p,h,d)}}function Uh(h,d){return ol(h)&&bu(d)?xu(Ai(h),d):function(p){var k=yl(p,h);return k===i&&k===d?pl(p,h):$s(d,k,m|w)}}function Zn(h,d,p,k,L){h!==d&&No(d,function(z,q){if(L||(L=new mi),oe(z))ly(h,d,q,p,Zn,k,L);else{var J=k?k(cl(h,q),z,q+"",h,d,L):i;J===i&&(J=z),Mo(h,q,J)}},Ne)}function ly(h,d,p,k,L,z,q){var J=cl(h,p),st=cl(d,p),dt=q.get(st);if(dt){Mo(h,p,dt);return}var gt=z?z(J,st,p+"",h,d,q):i,vt=gt===i;if(vt){var pt=Pt(st),_t=!pt&&la(st),Ct=!pt&&!_t&&cs(st);gt=st,pt||_t||Ct?Pt(J)?gt=J:ue(J)?gt=Me(J):_t?(vt=!1,gt=tu(st,!0)):Ct?(vt=!1,gt=eu(st,!0)):gt=[]:Xs(st)||Ta(st)?(gt=J,Ta(J)?gt=Zu(J):(!oe(J)||Ni(J))&&(gt=wu(st))):vt=!1}vt&&(q.set(st,gt),L(gt,st,k,z,q),q.delete(st)),Mo(h,p,gt)}function Vh(h,d){var p=h.length;if(!!p)return d+=d<0?p:0,Oi(d,p)?h[d]:i}function $h(h,d,p){d.length?d=se(d,function(z){return Pt(z)?function(q){return Ca(q,z.length===1?z[0]:z)}:z}):d=[ze];var k=-1;d=se(d,Ye(kt()));var L=Hh(h,function(z,q,J){var st=se(d,function(dt){return dt(z)});return{criteria:st,index:++k,value:z}});return L0(L,function(z,q){return xy(z,q,p)})}function cy(h,d){return jh(h,d,function(p,k){return pl(h,k)})}function jh(h,d,p){for(var k=-1,L=d.length,z={};++k<L;){var q=d[k],J=Ca(h,q);p(J,q)&&js(z,ra(q,h),J)}return z}function hy(h){return function(d){return Ca(d,h)}}function jo(h,d,p,k){var L=k?D0:Ja,z=-1,q=d.length,J=h;for(h===d&&(d=Me(d)),p&&(J=se(h,Ye(p)));++z<q;)for(var st=0,dt=d[z],gt=p?p(dt):dt;(st=L(J,gt,st,k))>-1;)J!==h&&Wn.call(J,st,1),Wn.call(h,st,1);return h}function qh(h,d){for(var p=h?d.length:0,k=p-1;p--;){var L=d[p];if(p==k||L!==z){var z=L;Oi(L)?Wn.call(h,L,1):Xo(h,L)}}return h}function qo(h,d){return h+$n(Ch()*(d-h+1))}function uy(h,d,p,k){for(var L=-1,z=me(Vn((d-h)/(p||1)),0),q=lt(z);z--;)q[k?z:++L]=h,h+=p;return q}function Yo(h,d){var p="";if(!h||d<1||d>j)return p;do d%2&&(p+=h),d=$n(d/2),d&&(h+=h);while(d);return p}function Lt(h,d){return hl(_u(h,d,ze),h+"")}function fy(h){return Th(hs(h))}function dy(h,d){var p=hs(h);return or(p,ka(d,0,p.length))}function js(h,d,p,k){if(!oe(h))return h;d=ra(d,h);for(var L=-1,z=d.length,q=z-1,J=h;J!=null&&++L<z;){var st=Ai(d[L]),dt=p;if(st==="__proto__"||st==="constructor"||st==="prototype")return h;if(L!=q){var gt=J[st];dt=k?k(gt,st,J):i,dt===i&&(dt=oe(gt)?gt:Oi(d[L+1])?[]:{})}Ws(J,st,dt),J=J[st]}return h}var Yh=jn?function(h,d){return jn.set(h,d),h}:ze,gy=Un?function(h,d){return Un(h,"toString",{configurable:!0,enumerable:!1,value:bl(d),writable:!0})}:ze;function vy(h){return or(hs(h))}function oi(h,d,p){var k=-1,L=h.length;d<0&&(d=-d>L?0:L+d),p=p>L?L:p,p<0&&(p+=L),L=d>p?0:p-d>>>0,d>>>=0;for(var z=lt(L);++k<L;)z[k]=h[k+d];return z}function my(h,d){var p;return sa(h,function(k,L,z){return p=d(k,L,z),!p}),!!p}function Jn(h,d,p){var k=0,L=h==null?k:h.length;if(typeof d=="number"&&d===d&&L<=tt){for(;k<L;){var z=k+L>>>1,q=h[z];q!==null&&!Xe(q)&&(p?q<=d:q<d)?k=z+1:L=z}return L}return Ko(h,d,ze,p)}function Ko(h,d,p,k){var L=0,z=h==null?0:h.length;if(z===0)return 0;d=p(d);for(var q=d!==d,J=d===null,st=Xe(d),dt=d===i;L<z;){var gt=$n((L+z)/2),vt=p(h[gt]),pt=vt!==i,_t=vt===null,Ct=vt===vt,Dt=Xe(vt);if(q)var Ft=k||Ct;else dt?Ft=Ct&&(k||pt):J?Ft=Ct&&pt&&(k||!_t):st?Ft=Ct&&pt&&!_t&&(k||!Dt):_t||Dt?Ft=!1:Ft=k?vt<=d:vt<d;Ft?L=gt+1:z=gt}return Re(z,U)}function Kh(h,d){for(var p=-1,k=h.length,L=0,z=[];++p<k;){var q=h[p],J=d?d(q):q;if(!p||!yi(J,st)){var st=J;z[L++]=q===0?0:q}}return z}function Xh(h){return typeof h=="number"?h:Xe(h)?$:+h}function Ke(h){if(typeof h=="string")return h;if(Pt(h))return se(h,Ke)+"";if(Xe(h))return Fh?Fh.call(h):"";var d=h+"";return d=="0"&&1/h==-nt?"-0":d}function na(h,d,p){var k=-1,L=Sn,z=h.length,q=!0,J=[],st=J;if(p)q=!1,L=Eo;else if(z>=s){var dt=d?null:Fy(h);if(dt)return Bn(dt);q=!1,L=Ls,st=new Aa}else st=d?[]:J;t:for(;++k<z;){var gt=h[k],vt=d?d(gt):gt;if(gt=p||gt!==0?gt:0,q&&vt===vt){for(var pt=st.length;pt--;)if(st[pt]===vt)continue t;d&&st.push(vt),J.push(gt)}else L(st,vt,p)||(st!==J&&st.push(vt),J.push(gt))}return J}function Xo(h,d){return d=ra(d,h),h=Eu(h,d),h==null||delete h[Ai(li(d))]}function Gh(h,d,p,k){return js(h,d,p(Ca(h,d)),k)}function Qn(h,d,p,k){for(var L=h.length,z=k?L:-1;(k?z--:++z<L)&&d(h[z],z,h););return p?oi(h,k?0:z,k?z+1:L):oi(h,k?z+1:0,k?L:z)}function Zh(h,d){var p=h;return p instanceof Nt&&(p=p.value()),Ao(d,function(k,L){return L.func.apply(L.thisArg,ea([k],L.args))},p)}function Go(h,d,p){var k=h.length;if(k<2)return k?na(h[0]):[];for(var L=-1,z=lt(k);++L<k;)for(var q=h[L],J=-1;++J<k;)J!=L&&(z[L]=Us(z[L]||q,h[J],d,p));return na(Ee(z,1),d,p)}function Jh(h,d,p){for(var k=-1,L=h.length,z=d.length,q={};++k<L;){var J=k<z?d[k]:i;p(q,h[k],J)}return q}function Zo(h){return ue(h)?h:[]}function Jo(h){return typeof h=="function"?h:ze}function ra(h,d){return Pt(h)?h:ol(h,d)?[h]:Fu(Kt(h))}var yy=Lt;function oa(h,d,p){var k=h.length;return p=p===i?k:p,!d&&p>=k?h:oi(h,d,p)}var Qh=sm||function(h){return _e.clearTimeout(h)};function tu(h,d){if(d)return h.slice();var p=h.length,k=xh?xh(p):new h.constructor(p);return h.copy(k),k}function Qo(h){var d=new h.constructor(h.byteLength);return new zn(d).set(new zn(h)),d}function py(h,d){var p=d?Qo(h.buffer):h.buffer;return new h.constructor(p,h.byteOffset,h.byteLength)}function wy(h){var d=new h.constructor(h.source,Oc.exec(h));return d.lastIndex=h.lastIndex,d}function by(h){return Hs?Zt(Hs.call(h)):{}}function eu(h,d){var p=d?Qo(h.buffer):h.buffer;return new h.constructor(p,h.byteOffset,h.length)}function iu(h,d){if(h!==d){var p=h!==i,k=h===null,L=h===h,z=Xe(h),q=d!==i,J=d===null,st=d===d,dt=Xe(d);if(!J&&!dt&&!z&&h>d||z&&q&&st&&!J&&!dt||k&&q&&st||!p&&st||!L)return 1;if(!k&&!z&&!dt&&h<d||dt&&p&&L&&!k&&!z||J&&p&&L||!q&&L||!st)return-1}return 0}function xy(h,d,p){for(var k=-1,L=h.criteria,z=d.criteria,q=L.length,J=p.length;++k<q;){var st=iu(L[k],z[k]);if(st){if(k>=J)return st;var dt=p[k];return st*(dt=="desc"?-1:1)}}return h.index-d.index}function au(h,d,p,k){for(var L=-1,z=h.length,q=p.length,J=-1,st=d.length,dt=me(z-q,0),gt=lt(st+dt),vt=!k;++J<st;)gt[J]=d[J];for(;++L<q;)(vt||L<z)&&(gt[p[L]]=h[L]);for(;dt--;)gt[J++]=h[L++];return gt}function su(h,d,p,k){for(var L=-1,z=h.length,q=-1,J=p.length,st=-1,dt=d.length,gt=me(z-J,0),vt=lt(gt+dt),pt=!k;++L<gt;)vt[L]=h[L];for(var _t=L;++st<dt;)vt[_t+st]=d[st];for(;++q<J;)(pt||L<z)&&(vt[_t+p[q]]=h[L++]);return vt}function Me(h,d){var p=-1,k=h.length;for(d||(d=lt(k));++p<k;)d[p]=h[p];return d}function Ei(h,d,p,k){var L=!p;p||(p={});for(var z=-1,q=d.length;++z<q;){var J=d[z],st=k?k(p[J],h[J],J,p,h):i;st===i&&(st=h[J]),L?Di(p,J,st):Ws(p,J,st)}return p}function _y(h,d){return Ei(h,rl(h),d)}function Ey(h,d){return Ei(h,yu(h),d)}function tr(h,d){return function(p,k){var L=Pt(p)?R0:jm,z=d?d():{};return L(p,h,kt(k,2),z)}}function rs(h){return Lt(function(d,p){var k=-1,L=p.length,z=L>1?p[L-1]:i,q=L>2?p[2]:i;for(z=h.length>3&&typeof z=="function"?(L--,z):i,q&&Se(p[0],p[1],q)&&(z=L<3?i:z,L=1),d=Zt(d);++k<L;){var J=p[k];J&&h(d,J,k,z)}return d})}function nu(h,d){return function(p,k){if(p==null)return p;if(!Oe(p))return h(p,k);for(var L=p.length,z=d?L:-1,q=Zt(p);(d?z--:++z<L)&&k(q[z],z,q)!==!1;);return p}}function ru(h){return function(d,p,k){for(var L=-1,z=Zt(d),q=k(d),J=q.length;J--;){var st=q[h?J:++L];if(p(z[st],st,z)===!1)break}return d}}function Ay(h,d,p){var k=d&y,L=qs(h);function z(){var q=this&&this!==_e&&this instanceof z?L:h;return q.apply(k?p:this,arguments)}return z}function ou(h){return function(d){d=Kt(d);var p=Qa(d)?vi(d):i,k=p?p[0]:d.charAt(0),L=p?oa(p,1).join(""):d.slice(1);return k[h]()+L}}function os(h){return function(d){return Ao(rf(nf(d).replace(g0,"")),h,"")}}function qs(h){return function(){var d=arguments;switch(d.length){case 0:return new h;case 1:return new h(d[0]);case 2:return new h(d[0],d[1]);case 3:return new h(d[0],d[1],d[2]);case 4:return new h(d[0],d[1],d[2],d[3]);case 5:return new h(d[0],d[1],d[2],d[3],d[4]);case 6:return new h(d[0],d[1],d[2],d[3],d[4],d[5]);case 7:return new h(d[0],d[1],d[2],d[3],d[4],d[5],d[6])}var p=ns(h.prototype),k=h.apply(p,d);return oe(k)?k:p}}function ky(h,d,p){var k=qs(h);function L(){for(var z=arguments.length,q=lt(z),J=z,st=ls(L);J--;)q[J]=arguments[J];var dt=z<3&&q[0]!==st&&q[z-1]!==st?[]:ia(q,st);if(z-=dt.length,z<p)return fu(h,d,er,L.placeholder,i,q,dt,i,i,p-z);var gt=this&&this!==_e&&this instanceof L?k:h;return qe(gt,this,q)}return L}function lu(h){return function(d,p,k){var L=Zt(d);if(!Oe(d)){var z=kt(p,3);d=pe(d),p=function(J){return z(L[J],J,L)}}var q=h(d,p,k);return q>-1?L[z?d[q]:q]:i}}function cu(h){return Mi(function(d){var p=d.length,k=p,L=ni.prototype.thru;for(h&&d.reverse();k--;){var z=d[k];if(typeof z!="function")throw new si(r);if(L&&!q&&nr(z)=="wrapper")var q=new ni([],!0)}for(k=q?k:p;++k<p;){z=d[k];var J=nr(z),st=J=="wrapper"?sl(z):i;st&&ll(st[0])&&st[1]==(D|x|T|B)&&!st[4].length&&st[9]==1?q=q[nr(st[0])].apply(q,st[3]):q=z.length==1&&ll(z)?q[J]():q.thru(z)}return function(){var dt=arguments,gt=dt[0];if(q&&dt.length==1&&Pt(gt))return q.plant(gt).value();for(var vt=0,pt=p?d[vt].apply(this,dt):gt;++vt<p;)pt=d[vt].call(this,pt);return pt}})}function er(h,d,p,k,L,z,q,J,st,dt){var gt=d&D,vt=d&y,pt=d&_,_t=d&(x|C),Ct=d&V,Dt=pt?i:qs(h);function Ft(){for(var Ot=arguments.length,Ht=lt(Ot),Ge=Ot;Ge--;)Ht[Ge]=arguments[Ge];if(_t)var Ie=ls(Ft),Ze=O0(Ht,Ie);if(k&&(Ht=au(Ht,k,L,_t)),z&&(Ht=su(Ht,z,q,_t)),Ot-=Ze,_t&&Ot<dt){var fe=ia(Ht,Ie);return fu(h,d,er,Ft.placeholder,p,Ht,fe,J,st,dt-Ot)}var pi=vt?p:this,Hi=pt?pi[h]:h;return Ot=Ht.length,J?Ht=jy(Ht,J):Ct&&Ot>1&&Ht.reverse(),gt&&st<Ot&&(Ht.length=st),this&&this!==_e&&this instanceof Ft&&(Hi=Dt||qs(Hi)),Hi.apply(pi,Ht)}return Ft}function hu(h,d){return function(p,k){return Qm(p,h,d(k),{})}}function ir(h,d){return function(p,k){var L;if(p===i&&k===i)return d;if(p!==i&&(L=p),k!==i){if(L===i)return k;typeof p=="string"||typeof k=="string"?(p=Ke(p),k=Ke(k)):(p=Xh(p),k=Xh(k)),L=h(p,k)}return L}}function tl(h){return Mi(function(d){return d=se(d,Ye(kt())),Lt(function(p){var k=this;return h(d,function(L){return qe(L,k,p)})})})}function ar(h,d){d=d===i?" ":Ke(d);var p=d.length;if(p<2)return p?Yo(d,h):d;var k=Yo(d,Vn(h/ts(d)));return Qa(d)?oa(vi(k),0,h).join(""):k.slice(0,h)}function Cy(h,d,p,k){var L=d&y,z=qs(h);function q(){for(var J=-1,st=arguments.length,dt=-1,gt=k.length,vt=lt(gt+st),pt=this&&this!==_e&&this instanceof q?z:h;++dt<gt;)vt[dt]=k[dt];for(;st--;)vt[dt++]=arguments[++J];return qe(pt,L?p:this,vt)}return q}function uu(h){return function(d,p,k){return k&&typeof k!="number"&&Se(d,p,k)&&(p=k=i),d=zi(d),p===i?(p=d,d=0):p=zi(p),k=k===i?d<p?1:-1:zi(k),uy(d,p,k,h)}}function sr(h){return function(d,p){return typeof d=="string"&&typeof p=="string"||(d=ci(d),p=ci(p)),h(d,p)}}function fu(h,d,p,k,L,z,q,J,st,dt){var gt=d&x,vt=gt?q:i,pt=gt?i:q,_t=gt?z:i,Ct=gt?i:z;d|=gt?T:I,d&=~(gt?I:T),d&A||(d&=~(y|_));var Dt=[h,d,L,_t,vt,Ct,pt,J,st,dt],Ft=p.apply(i,Dt);return ll(h)&&Au(Ft,Dt),Ft.placeholder=k,ku(Ft,h,d)}function el(h){var d=ve[h];return function(p,k){if(p=ci(p),k=k==null?0:Re(Bt(k),292),k&&kh(p)){var L=(Kt(p)+"e").split("e"),z=d(L[0]+"e"+(+L[1]+k));return L=(Kt(z)+"e").split("e"),+(L[0]+"e"+(+L[1]-k))}return d(p)}}var Fy=as&&1/Bn(new as([,-0]))[1]==nt?function(h){return new as(h)}:El;function du(h){return function(d){var p=Te(d);return p==G?So(d):p==ae?$0(d):M0(d,h(d))}}function Li(h,d,p,k,L,z,q,J){var st=d&_;if(!st&&typeof h!="function")throw new si(r);var dt=k?k.length:0;if(dt||(d&=~(T|I),k=L=i),q=q===i?q:me(Bt(q),0),J=J===i?J:Bt(J),dt-=L?L.length:0,d&I){var gt=k,vt=L;k=L=i}var pt=st?i:sl(h),_t=[h,d,p,k,L,gt,vt,z,q,J];if(pt&&Uy(_t,pt),h=_t[0],d=_t[1],p=_t[2],k=_t[3],L=_t[4],J=_t[9]=_t[9]===i?st?0:h.length:me(_t[9]-dt,0),!J&&d&(x|C)&&(d&=~(x|C)),!d||d==y)var Ct=Ay(h,d,p);else d==x||d==C?Ct=ky(h,d,J):(d==T||d==(y|T))&&!L.length?Ct=Cy(h,d,p,k):Ct=er.apply(i,_t);var Dt=pt?Yh:Au;return ku(Dt(Ct,_t),h,d)}function gu(h,d,p,k){return h===i||yi(h,is[p])&&!Xt.call(k,p)?d:h}function vu(h,d,p,k,L,z){return oe(h)&&oe(d)&&(z.set(d,h),Zn(h,d,i,vu,z),z.delete(d)),h}function Ry(h){return Xs(h)?i:h}function mu(h,d,p,k,L,z){var q=p&m,J=h.length,st=d.length;if(J!=st&&!(q&&st>J))return!1;var dt=z.get(h),gt=z.get(d);if(dt&&gt)return dt==d&&gt==h;var vt=-1,pt=!0,_t=p&w?new Aa:i;for(z.set(h,d),z.set(d,h);++vt<J;){var Ct=h[vt],Dt=d[vt];if(k)var Ft=q?k(Dt,Ct,vt,d,h,z):k(Ct,Dt,vt,h,d,z);if(Ft!==i){if(Ft)continue;pt=!1;break}if(_t){if(!ko(d,function(Ot,Ht){if(!Ls(_t,Ht)&&(Ct===Ot||L(Ct,Ot,p,k,z)))return _t.push(Ht)})){pt=!1;break}}else if(!(Ct===Dt||L(Ct,Dt,p,k,z))){pt=!1;break}}return z.delete(h),z.delete(d),pt}function Ty(h,d,p,k,L,z,q){switch(p){case Ga:if(h.byteLength!=d.byteLength||h.byteOffset!=d.byteOffset)return!1;h=h.buffer,d=d.buffer;case Ds:return!(h.byteLength!=d.byteLength||!z(new zn(h),new zn(d)));case ot:case b:case rt:return yi(+h,+d);case S:return h.name==d.name&&h.message==d.message;case be:case xe:return h==d+"";case G:var J=So;case ae:var st=k&m;if(J||(J=Bn),h.size!=d.size&&!st)return!1;var dt=q.get(h);if(dt)return dt==d;k|=w,q.set(h,d);var gt=mu(J(h),J(d),k,L,z,q);return q.delete(h),gt;case jt:if(Hs)return Hs.call(h)==Hs.call(d)}return!1}function Py(h,d,p,k,L,z){var q=p&m,J=il(h),st=J.length,dt=il(d),gt=dt.length;if(st!=gt&&!q)return!1;for(var vt=st;vt--;){var pt=J[vt];if(!(q?pt in d:Xt.call(d,pt)))return!1}var _t=z.get(h),Ct=z.get(d);if(_t&&Ct)return _t==d&&Ct==h;var Dt=!0;z.set(h,d),z.set(d,h);for(var Ft=q;++vt<st;){pt=J[vt];var Ot=h[pt],Ht=d[pt];if(k)var Ge=q?k(Ht,Ot,pt,d,h,z):k(Ot,Ht,pt,h,d,z);if(!(Ge===i?Ot===Ht||L(Ot,Ht,p,k,z):Ge)){Dt=!1;break}Ft||(Ft=pt=="constructor")}if(Dt&&!Ft){var Ie=h.constructor,Ze=d.constructor;Ie!=Ze&&"constructor"in h&&"constructor"in d&&!(typeof Ie=="function"&&Ie instanceof Ie&&typeof Ze=="function"&&Ze instanceof Ze)&&(Dt=!1)}return z.delete(h),z.delete(d),Dt}function Mi(h){return hl(_u(h,i,Su),h+"")}function il(h){return Mh(h,pe,rl)}function al(h){return Mh(h,Ne,yu)}var sl=jn?function(h){return jn.get(h)}:El;function nr(h){for(var d=h.name+"",p=ss[d],k=Xt.call(ss,d)?p.length:0;k--;){var L=p[k],z=L.func;if(z==null||z==h)return L.name}return d}function ls(h){var d=Xt.call(O,"placeholder")?O:h;return d.placeholder}function kt(){var h=O.iteratee||xl;return h=h===xl?zh:h,arguments.length?h(arguments[0],arguments[1]):h}function rr(h,d){var p=h.__data__;return Ny(d)?p[typeof d=="string"?"string":"hash"]:p.map}function nl(h){for(var d=pe(h),p=d.length;p--;){var k=d[p],L=h[k];d[p]=[k,L,bu(L)]}return d}function Fa(h,d){var p=W0(h,d);return Nh(p)?p:i}function Sy(h){var d=Xt.call(h,_a),p=h[_a];try{h[_a]=i;var k=!0}catch{}var L=On.call(h);return k&&(d?h[_a]=p:delete h[_a]),L}var rl=Bo?function(h){return h==null?[]:(h=Zt(h),ta(Bo(h),function(d){return Eh.call(h,d)}))}:Al,yu=Bo?function(h){for(var d=[];h;)ea(d,rl(h)),h=Hn(h);return d}:Al,Te=Pe;(Do&&Te(new Do(new ArrayBuffer(1)))!=Ga||Os&&Te(new Os)!=G||Lo&&Te(Lo.resolve())!=At||as&&Te(new as)!=ae||Ns&&Te(new Ns)!=xi)&&(Te=function(h){var d=Pe(h),p=d==mt?h.constructor:i,k=p?Ra(p):"";if(k)switch(k){case dm:return Ga;case gm:return G;case vm:return At;case mm:return ae;case ym:return xi}return d});function Iy(h,d,p){for(var k=-1,L=p.length;++k<L;){var z=p[k],q=z.size;switch(z.type){case"drop":h+=q;break;case"dropRight":d-=q;break;case"take":d=Re(d,h+q);break;case"takeRight":h=me(h,d-q);break}}return{start:h,end:d}}function By(h){var d=h.match(zv);return d?d[1].split(Hv):[]}function pu(h,d,p){d=ra(d,h);for(var k=-1,L=d.length,z=!1;++k<L;){var q=Ai(d[k]);if(!(z=h!=null&&p(h,q)))break;h=h[q]}return z||++k!=L?z:(L=h==null?0:h.length,!!L&&dr(L)&&Oi(q,L)&&(Pt(h)||Ta(h)))}function Dy(h){var d=h.length,p=new h.constructor(d);return d&&typeof h[0]=="string"&&Xt.call(h,"index")&&(p.index=h.index,p.input=h.input),p}function wu(h){return typeof h.constructor=="function"&&!Ys(h)?ns(Hn(h)):{}}function Ly(h,d,p){var k=h.constructor;switch(d){case Ds:return Qo(h);case ot:case b:return new k(+h);case Ga:return py(h,p);case so:case no:case ro:case oo:case lo:case co:case ho:case uo:case fo:return eu(h,p);case G:return new k;case rt:case xe:return new k(h);case be:return wy(h);case ae:return new k;case jt:return by(h)}}function My(h,d){var p=d.length;if(!p)return h;var k=p-1;return d[k]=(p>1?"& ":"")+d[k],d=d.join(p>2?", ":" "),h.replace(Nv,`{
  107. /* [wrapped with `+d+`] */
  108. `)}function Oy(h){return Pt(h)||Ta(h)||!!(Ah&&h&&h[Ah])}function Oi(h,d){var p=typeof h;return d=d==null?j:d,!!d&&(p=="number"||p!="symbol"&&Xv.test(h))&&h>-1&&h%1==0&&h<d}function Se(h,d,p){if(!oe(p))return!1;var k=typeof d;return(k=="number"?Oe(p)&&Oi(d,p.length):k=="string"&&d in p)?yi(p[d],h):!1}function ol(h,d){if(Pt(h))return!1;var p=typeof h;return p=="number"||p=="symbol"||p=="boolean"||h==null||Xe(h)?!0:Dv.test(h)||!Bv.test(h)||d!=null&&h in Zt(d)}function Ny(h){var d=typeof h;return d=="string"||d=="number"||d=="symbol"||d=="boolean"?h!=="__proto__":h===null}function ll(h){var d=nr(h),p=O[d];if(typeof p!="function"||!(d in Nt.prototype))return!1;if(h===p)return!0;var k=sl(p);return!!k&&h===k[0]}function zy(h){return!!bh&&bh in h}var Hy=Ln?Ni:kl;function Ys(h){var d=h&&h.constructor,p=typeof d=="function"&&d.prototype||is;return h===p}function bu(h){return h===h&&!oe(h)}function xu(h,d){return function(p){return p==null?!1:p[h]===d&&(d!==i||h in Zt(p))}}function Wy(h){var d=ur(h,function(k){return p.size===u&&p.clear(),k}),p=d.cache;return d}function Uy(h,d){var p=h[1],k=d[1],L=p|k,z=L<(y|_|D),q=k==D&&p==x||k==D&&p==B&&h[7].length<=d[8]||k==(D|B)&&d[7].length<=d[8]&&p==x;if(!(z||q))return h;k&y&&(h[2]=d[2],L|=p&y?0:A);var J=d[3];if(J){var st=h[3];h[3]=st?au(st,J,d[4]):J,h[4]=st?ia(h[3],c):d[4]}return J=d[5],J&&(st=h[5],h[5]=st?su(st,J,d[6]):J,h[6]=st?ia(h[5],c):d[6]),J=d[7],J&&(h[7]=J),k&D&&(h[8]=h[8]==null?d[8]:Re(h[8],d[8])),h[9]==null&&(h[9]=d[9]),h[0]=d[0],h[1]=L,h}function Vy(h){var d=[];if(h!=null)for(var p in Zt(h))d.push(p);return d}function $y(h){return On.call(h)}function _u(h,d,p){return d=me(d===i?h.length-1:d,0),function(){for(var k=arguments,L=-1,z=me(k.length-d,0),q=lt(z);++L<z;)q[L]=k[d+L];L=-1;for(var J=lt(d+1);++L<d;)J[L]=k[L];return J[d]=p(q),qe(h,this,J)}}function Eu(h,d){return d.length<2?h:Ca(h,oi(d,0,-1))}function jy(h,d){for(var p=h.length,k=Re(d.length,p),L=Me(h);k--;){var z=d[k];h[k]=Oi(z,p)?L[z]:i}return h}function cl(h,d){if(!(d==="constructor"&&typeof h[d]=="function")&&d!="__proto__")return h[d]}var Au=Cu(Yh),Ks=rm||function(h,d){return _e.setTimeout(h,d)},hl=Cu(gy);function ku(h,d,p){var k=d+"";return hl(h,My(k,qy(By(k),p)))}function Cu(h){var d=0,p=0;return function(){var k=hm(),L=P-(k-p);if(p=k,L>0){if(++d>=R)return arguments[0]}else d=0;return h.apply(i,arguments)}}function or(h,d){var p=-1,k=h.length,L=k-1;for(d=d===i?k:d;++p<d;){var z=qo(p,L),q=h[z];h[z]=h[p],h[p]=q}return h.length=d,h}var Fu=Wy(function(h){var d=[];return h.charCodeAt(0)===46&&d.push(""),h.replace(Lv,function(p,k,L,z){d.push(L?z.replace(Vv,"$1"):k||p)}),d});function Ai(h){if(typeof h=="string"||Xe(h))return h;var d=h+"";return d=="0"&&1/h==-nt?"-0":d}function Ra(h){if(h!=null){try{return Mn.call(h)}catch{}try{return h+""}catch{}}return""}function qy(h,d){return ai(at,function(p){var k="_."+p[0];d&p[1]&&!Sn(h,k)&&h.push(k)}),h.sort()}function Ru(h){if(h instanceof Nt)return h.clone();var d=new ni(h.__wrapped__,h.__chain__);return d.__actions__=Me(h.__actions__),d.__index__=h.__index__,d.__values__=h.__values__,d}function Yy(h,d,p){(p?Se(h,d,p):d===i)?d=1:d=me(Bt(d),0);var k=h==null?0:h.length;if(!k||d<1)return[];for(var L=0,z=0,q=lt(Vn(k/d));L<k;)q[z++]=oi(h,L,L+=d);return q}function Ky(h){for(var d=-1,p=h==null?0:h.length,k=0,L=[];++d<p;){var z=h[d];z&&(L[k++]=z)}return L}function Xy(){var h=arguments.length;if(!h)return[];for(var d=lt(h-1),p=arguments[0],k=h;k--;)d[k-1]=arguments[k];return ea(Pt(p)?Me(p):[p],Ee(d,1))}var Gy=Lt(function(h,d){return ue(h)?Us(h,Ee(d,1,ue,!0)):[]}),Zy=Lt(function(h,d){var p=li(d);return ue(p)&&(p=i),ue(h)?Us(h,Ee(d,1,ue,!0),kt(p,2)):[]}),Jy=Lt(function(h,d){var p=li(d);return ue(p)&&(p=i),ue(h)?Us(h,Ee(d,1,ue,!0),i,p):[]});function Qy(h,d,p){var k=h==null?0:h.length;return k?(d=p||d===i?1:Bt(d),oi(h,d<0?0:d,k)):[]}function tp(h,d,p){var k=h==null?0:h.length;return k?(d=p||d===i?1:Bt(d),d=k-d,oi(h,0,d<0?0:d)):[]}function ep(h,d){return h&&h.length?Qn(h,kt(d,3),!0,!0):[]}function ip(h,d){return h&&h.length?Qn(h,kt(d,3),!0):[]}function ap(h,d,p,k){var L=h==null?0:h.length;return L?(p&&typeof p!="number"&&Se(h,d,p)&&(p=0,k=L),Xm(h,d,p,k)):[]}function Tu(h,d,p){var k=h==null?0:h.length;if(!k)return-1;var L=p==null?0:Bt(p);return L<0&&(L=me(k+L,0)),In(h,kt(d,3),L)}function Pu(h,d,p){var k=h==null?0:h.length;if(!k)return-1;var L=k-1;return p!==i&&(L=Bt(p),L=p<0?me(k+L,0):Re(L,k-1)),In(h,kt(d,3),L,!0)}function Su(h){var d=h==null?0:h.length;return d?Ee(h,1):[]}function sp(h){var d=h==null?0:h.length;return d?Ee(h,nt):[]}function np(h,d){var p=h==null?0:h.length;return p?(d=d===i?1:Bt(d),Ee(h,d)):[]}function rp(h){for(var d=-1,p=h==null?0:h.length,k={};++d<p;){var L=h[d];k[L[0]]=L[1]}return k}function Iu(h){return h&&h.length?h[0]:i}function op(h,d,p){var k=h==null?0:h.length;if(!k)return-1;var L=p==null?0:Bt(p);return L<0&&(L=me(k+L,0)),Ja(h,d,L)}function lp(h){var d=h==null?0:h.length;return d?oi(h,0,-1):[]}var cp=Lt(function(h){var d=se(h,Zo);return d.length&&d[0]===h[0]?Wo(d):[]}),hp=Lt(function(h){var d=li(h),p=se(h,Zo);return d===li(p)?d=i:p.pop(),p.length&&p[0]===h[0]?Wo(p,kt(d,2)):[]}),up=Lt(function(h){var d=li(h),p=se(h,Zo);return d=typeof d=="function"?d:i,d&&p.pop(),p.length&&p[0]===h[0]?Wo(p,i,d):[]});function fp(h,d){return h==null?"":lm.call(h,d)}function li(h){var d=h==null?0:h.length;return d?h[d-1]:i}function dp(h,d,p){var k=h==null?0:h.length;if(!k)return-1;var L=k;return p!==i&&(L=Bt(p),L=L<0?me(k+L,0):Re(L,k-1)),d===d?q0(h,d,L):In(h,fh,L,!0)}function gp(h,d){return h&&h.length?Vh(h,Bt(d)):i}var vp=Lt(Bu);function Bu(h,d){return h&&h.length&&d&&d.length?jo(h,d):h}function mp(h,d,p){return h&&h.length&&d&&d.length?jo(h,d,kt(p,2)):h}function yp(h,d,p){return h&&h.length&&d&&d.length?jo(h,d,i,p):h}var pp=Mi(function(h,d){var p=h==null?0:h.length,k=Oo(h,d);return qh(h,se(d,function(L){return Oi(L,p)?+L:L}).sort(iu)),k});function wp(h,d){var p=[];if(!(h&&h.length))return p;var k=-1,L=[],z=h.length;for(d=kt(d,3);++k<z;){var q=h[k];d(q,k,h)&&(p.push(q),L.push(k))}return qh(h,L),p}function ul(h){return h==null?h:fm.call(h)}function bp(h,d,p){var k=h==null?0:h.length;return k?(p&&typeof p!="number"&&Se(h,d,p)?(d=0,p=k):(d=d==null?0:Bt(d),p=p===i?k:Bt(p)),oi(h,d,p)):[]}function xp(h,d){return Jn(h,d)}function _p(h,d,p){return Ko(h,d,kt(p,2))}function Ep(h,d){var p=h==null?0:h.length;if(p){var k=Jn(h,d);if(k<p&&yi(h[k],d))return k}return-1}function Ap(h,d){return Jn(h,d,!0)}function kp(h,d,p){return Ko(h,d,kt(p,2),!0)}function Cp(h,d){var p=h==null?0:h.length;if(p){var k=Jn(h,d,!0)-1;if(yi(h[k],d))return k}return-1}function Fp(h){return h&&h.length?Kh(h):[]}function Rp(h,d){return h&&h.length?Kh(h,kt(d,2)):[]}function Tp(h){var d=h==null?0:h.length;return d?oi(h,1,d):[]}function Pp(h,d,p){return h&&h.length?(d=p||d===i?1:Bt(d),oi(h,0,d<0?0:d)):[]}function Sp(h,d,p){var k=h==null?0:h.length;return k?(d=p||d===i?1:Bt(d),d=k-d,oi(h,d<0?0:d,k)):[]}function Ip(h,d){return h&&h.length?Qn(h,kt(d,3),!1,!0):[]}function Bp(h,d){return h&&h.length?Qn(h,kt(d,3)):[]}var Dp=Lt(function(h){return na(Ee(h,1,ue,!0))}),Lp=Lt(function(h){var d=li(h);return ue(d)&&(d=i),na(Ee(h,1,ue,!0),kt(d,2))}),Mp=Lt(function(h){var d=li(h);return d=typeof d=="function"?d:i,na(Ee(h,1,ue,!0),i,d)});function Op(h){return h&&h.length?na(h):[]}function Np(h,d){return h&&h.length?na(h,kt(d,2)):[]}function zp(h,d){return d=typeof d=="function"?d:i,h&&h.length?na(h,i,d):[]}function fl(h){if(!(h&&h.length))return[];var d=0;return h=ta(h,function(p){if(ue(p))return d=me(p.length,d),!0}),To(d,function(p){return se(h,Co(p))})}function Du(h,d){if(!(h&&h.length))return[];var p=fl(h);return d==null?p:se(p,function(k){return qe(d,i,k)})}var Hp=Lt(function(h,d){return ue(h)?Us(h,d):[]}),Wp=Lt(function(h){return Go(ta(h,ue))}),Up=Lt(function(h){var d=li(h);return ue(d)&&(d=i),Go(ta(h,ue),kt(d,2))}),Vp=Lt(function(h){var d=li(h);return d=typeof d=="function"?d:i,Go(ta(h,ue),i,d)}),$p=Lt(fl);function jp(h,d){return Jh(h||[],d||[],Ws)}function qp(h,d){return Jh(h||[],d||[],js)}var Yp=Lt(function(h){var d=h.length,p=d>1?h[d-1]:i;return p=typeof p=="function"?(h.pop(),p):i,Du(h,p)});function Lu(h){var d=O(h);return d.__chain__=!0,d}function Kp(h,d){return d(h),h}function lr(h,d){return d(h)}var Xp=Mi(function(h){var d=h.length,p=d?h[0]:0,k=this.__wrapped__,L=function(z){return Oo(z,h)};return d>1||this.__actions__.length||!(k instanceof Nt)||!Oi(p)?this.thru(L):(k=k.slice(p,+p+(d?1:0)),k.__actions__.push({func:lr,args:[L],thisArg:i}),new ni(k,this.__chain__).thru(function(z){return d&&!z.length&&z.push(i),z}))});function Gp(){return Lu(this)}function Zp(){return new ni(this.value(),this.__chain__)}function Jp(){this.__values__===i&&(this.__values__=Xu(this.value()));var h=this.__index__>=this.__values__.length,d=h?i:this.__values__[this.__index__++];return{done:h,value:d}}function Qp(){return this}function tw(h){for(var d,p=this;p instanceof Yn;){var k=Ru(p);k.__index__=0,k.__values__=i,d?L.__wrapped__=k:d=k;var L=k;p=p.__wrapped__}return L.__wrapped__=h,d}function ew(){var h=this.__wrapped__;if(h instanceof Nt){var d=h;return this.__actions__.length&&(d=new Nt(this)),d=d.reverse(),d.__actions__.push({func:lr,args:[ul],thisArg:i}),new ni(d,this.__chain__)}return this.thru(ul)}function iw(){return Zh(this.__wrapped__,this.__actions__)}var aw=tr(function(h,d,p){Xt.call(h,p)?++h[p]:Di(h,p,1)});function sw(h,d,p){var k=Pt(h)?hh:Km;return p&&Se(h,d,p)&&(d=i),k(h,kt(d,3))}function nw(h,d){var p=Pt(h)?ta:Dh;return p(h,kt(d,3))}var rw=lu(Tu),ow=lu(Pu);function lw(h,d){return Ee(cr(h,d),1)}function cw(h,d){return Ee(cr(h,d),nt)}function hw(h,d,p){return p=p===i?1:Bt(p),Ee(cr(h,d),p)}function Mu(h,d){var p=Pt(h)?ai:sa;return p(h,kt(d,3))}function Ou(h,d){var p=Pt(h)?T0:Bh;return p(h,kt(d,3))}var uw=tr(function(h,d,p){Xt.call(h,p)?h[p].push(d):Di(h,p,[d])});function fw(h,d,p,k){h=Oe(h)?h:hs(h),p=p&&!k?Bt(p):0;var L=h.length;return p<0&&(p=me(L+p,0)),gr(h)?p<=L&&h.indexOf(d,p)>-1:!!L&&Ja(h,d,p)>-1}var dw=Lt(function(h,d,p){var k=-1,L=typeof d=="function",z=Oe(h)?lt(h.length):[];return sa(h,function(q){z[++k]=L?qe(d,q,p):Vs(q,d,p)}),z}),gw=tr(function(h,d,p){Di(h,p,d)});function cr(h,d){var p=Pt(h)?se:Hh;return p(h,kt(d,3))}function vw(h,d,p,k){return h==null?[]:(Pt(d)||(d=d==null?[]:[d]),p=k?i:p,Pt(p)||(p=p==null?[]:[p]),$h(h,d,p))}var mw=tr(function(h,d,p){h[p?0:1].push(d)},function(){return[[],[]]});function yw(h,d,p){var k=Pt(h)?Ao:gh,L=arguments.length<3;return k(h,kt(d,4),p,L,sa)}function pw(h,d,p){var k=Pt(h)?P0:gh,L=arguments.length<3;return k(h,kt(d,4),p,L,Bh)}function ww(h,d){var p=Pt(h)?ta:Dh;return p(h,fr(kt(d,3)))}function bw(h){var d=Pt(h)?Th:fy;return d(h)}function xw(h,d,p){(p?Se(h,d,p):d===i)?d=1:d=Bt(d);var k=Pt(h)?Vm:dy;return k(h,d)}function _w(h){var d=Pt(h)?$m:vy;return d(h)}function Ew(h){if(h==null)return 0;if(Oe(h))return gr(h)?ts(h):h.length;var d=Te(h);return d==G||d==ae?h.size:Vo(h).length}function Aw(h,d,p){var k=Pt(h)?ko:my;return p&&Se(h,d,p)&&(d=i),k(h,kt(d,3))}var kw=Lt(function(h,d){if(h==null)return[];var p=d.length;return p>1&&Se(h,d[0],d[1])?d=[]:p>2&&Se(d[0],d[1],d[2])&&(d=[d[0]]),$h(h,Ee(d,1),[])}),hr=nm||function(){return _e.Date.now()};function Cw(h,d){if(typeof d!="function")throw new si(r);return h=Bt(h),function(){if(--h<1)return d.apply(this,arguments)}}function Nu(h,d,p){return d=p?i:d,d=h&&d==null?h.length:d,Li(h,D,i,i,i,i,d)}function zu(h,d){var p;if(typeof d!="function")throw new si(r);return h=Bt(h),function(){return--h>0&&(p=d.apply(this,arguments)),h<=1&&(d=i),p}}var dl=Lt(function(h,d,p){var k=y;if(p.length){var L=ia(p,ls(dl));k|=T}return Li(h,k,d,p,L)}),Hu=Lt(function(h,d,p){var k=y|_;if(p.length){var L=ia(p,ls(Hu));k|=T}return Li(d,k,h,p,L)});function Wu(h,d,p){d=p?i:d;var k=Li(h,x,i,i,i,i,i,d);return k.placeholder=Wu.placeholder,k}function Uu(h,d,p){d=p?i:d;var k=Li(h,C,i,i,i,i,i,d);return k.placeholder=Uu.placeholder,k}function Vu(h,d,p){var k,L,z,q,J,st,dt=0,gt=!1,vt=!1,pt=!0;if(typeof h!="function")throw new si(r);d=ci(d)||0,oe(p)&&(gt=!!p.leading,vt="maxWait"in p,z=vt?me(ci(p.maxWait)||0,d):z,pt="trailing"in p?!!p.trailing:pt);function _t(fe){var pi=k,Hi=L;return k=L=i,dt=fe,q=h.apply(Hi,pi),q}function Ct(fe){return dt=fe,J=Ks(Ot,d),gt?_t(fe):q}function Dt(fe){var pi=fe-st,Hi=fe-dt,cf=d-pi;return vt?Re(cf,z-Hi):cf}function Ft(fe){var pi=fe-st,Hi=fe-dt;return st===i||pi>=d||pi<0||vt&&Hi>=z}function Ot(){var fe=hr();if(Ft(fe))return Ht(fe);J=Ks(Ot,Dt(fe))}function Ht(fe){return J=i,pt&&k?_t(fe):(k=L=i,q)}function Ge(){J!==i&&Qh(J),dt=0,k=st=L=J=i}function Ie(){return J===i?q:Ht(hr())}function Ze(){var fe=hr(),pi=Ft(fe);if(k=arguments,L=this,st=fe,pi){if(J===i)return Ct(st);if(vt)return Qh(J),J=Ks(Ot,d),_t(st)}return J===i&&(J=Ks(Ot,d)),q}return Ze.cancel=Ge,Ze.flush=Ie,Ze}var Fw=Lt(function(h,d){return Ih(h,1,d)}),Rw=Lt(function(h,d,p){return Ih(h,ci(d)||0,p)});function Tw(h){return Li(h,V)}function ur(h,d){if(typeof h!="function"||d!=null&&typeof d!="function")throw new si(r);var p=function(){var k=arguments,L=d?d.apply(this,k):k[0],z=p.cache;if(z.has(L))return z.get(L);var q=h.apply(this,k);return p.cache=z.set(L,q)||z,q};return p.cache=new(ur.Cache||Bi),p}ur.Cache=Bi;function fr(h){if(typeof h!="function")throw new si(r);return function(){var d=arguments;switch(d.length){case 0:return!h.call(this);case 1:return!h.call(this,d[0]);case 2:return!h.call(this,d[0],d[1]);case 3:return!h.call(this,d[0],d[1],d[2])}return!h.apply(this,d)}}function Pw(h){return zu(2,h)}var Sw=yy(function(h,d){d=d.length==1&&Pt(d[0])?se(d[0],Ye(kt())):se(Ee(d,1),Ye(kt()));var p=d.length;return Lt(function(k){for(var L=-1,z=Re(k.length,p);++L<z;)k[L]=d[L].call(this,k[L]);return qe(h,this,k)})}),gl=Lt(function(h,d){var p=ia(d,ls(gl));return Li(h,T,i,d,p)}),$u=Lt(function(h,d){var p=ia(d,ls($u));return Li(h,I,i,d,p)}),Iw=Mi(function(h,d){return Li(h,B,i,i,i,d)});function Bw(h,d){if(typeof h!="function")throw new si(r);return d=d===i?d:Bt(d),Lt(h,d)}function Dw(h,d){if(typeof h!="function")throw new si(r);return d=d==null?0:me(Bt(d),0),Lt(function(p){var k=p[d],L=oa(p,0,d);return k&&ea(L,k),qe(h,this,L)})}function Lw(h,d,p){var k=!0,L=!0;if(typeof h!="function")throw new si(r);return oe(p)&&(k="leading"in p?!!p.leading:k,L="trailing"in p?!!p.trailing:L),Vu(h,d,{leading:k,maxWait:d,trailing:L})}function Mw(h){return Nu(h,1)}function Ow(h,d){return gl(Jo(d),h)}function Nw(){if(!arguments.length)return[];var h=arguments[0];return Pt(h)?h:[h]}function zw(h){return ri(h,v)}function Hw(h,d){return d=typeof d=="function"?d:i,ri(h,v,d)}function Ww(h){return ri(h,f|v)}function Uw(h,d){return d=typeof d=="function"?d:i,ri(h,f|v,d)}function Vw(h,d){return d==null||Sh(h,d,pe(d))}function yi(h,d){return h===d||h!==h&&d!==d}var $w=sr(Ho),jw=sr(function(h,d){return h>=d}),Ta=Oh(function(){return arguments}())?Oh:function(h){return ce(h)&&Xt.call(h,"callee")&&!Eh.call(h,"callee")},Pt=lt.isArray,qw=sh?Ye(sh):ty;function Oe(h){return h!=null&&dr(h.length)&&!Ni(h)}function ue(h){return ce(h)&&Oe(h)}function Yw(h){return h===!0||h===!1||ce(h)&&Pe(h)==ot}var la=om||kl,Kw=nh?Ye(nh):ey;function Xw(h){return ce(h)&&h.nodeType===1&&!Xs(h)}function Gw(h){if(h==null)return!0;if(Oe(h)&&(Pt(h)||typeof h=="string"||typeof h.splice=="function"||la(h)||cs(h)||Ta(h)))return!h.length;var d=Te(h);if(d==G||d==ae)return!h.size;if(Ys(h))return!Vo(h).length;for(var p in h)if(Xt.call(h,p))return!1;return!0}function Zw(h,d){return $s(h,d)}function Jw(h,d,p){p=typeof p=="function"?p:i;var k=p?p(h,d):i;return k===i?$s(h,d,i,p):!!k}function vl(h){if(!ce(h))return!1;var d=Pe(h);return d==S||d==E||typeof h.message=="string"&&typeof h.name=="string"&&!Xs(h)}function Qw(h){return typeof h=="number"&&kh(h)}function Ni(h){if(!oe(h))return!1;var d=Pe(h);return d==N||d==X||d==ct||d==Rt}function ju(h){return typeof h=="number"&&h==Bt(h)}function dr(h){return typeof h=="number"&&h>-1&&h%1==0&&h<=j}function oe(h){var d=typeof h;return h!=null&&(d=="object"||d=="function")}function ce(h){return h!=null&&typeof h=="object"}var qu=rh?Ye(rh):ay;function t1(h,d){return h===d||Uo(h,d,nl(d))}function e1(h,d,p){return p=typeof p=="function"?p:i,Uo(h,d,nl(d),p)}function i1(h){return Yu(h)&&h!=+h}function a1(h){if(Hy(h))throw new Tt(n);return Nh(h)}function s1(h){return h===null}function n1(h){return h==null}function Yu(h){return typeof h=="number"||ce(h)&&Pe(h)==rt}function Xs(h){if(!ce(h)||Pe(h)!=mt)return!1;var d=Hn(h);if(d===null)return!0;var p=Xt.call(d,"constructor")&&d.constructor;return typeof p=="function"&&p instanceof p&&Mn.call(p)==em}var ml=oh?Ye(oh):sy;function r1(h){return ju(h)&&h>=-j&&h<=j}var Ku=lh?Ye(lh):ny;function gr(h){return typeof h=="string"||!Pt(h)&&ce(h)&&Pe(h)==xe}function Xe(h){return typeof h=="symbol"||ce(h)&&Pe(h)==jt}var cs=ch?Ye(ch):ry;function o1(h){return h===i}function l1(h){return ce(h)&&Te(h)==xi}function c1(h){return ce(h)&&Pe(h)==kv}var h1=sr($o),u1=sr(function(h,d){return h<=d});function Xu(h){if(!h)return[];if(Oe(h))return gr(h)?vi(h):Me(h);if(Ms&&h[Ms])return V0(h[Ms]());var d=Te(h),p=d==G?So:d==ae?Bn:hs;return p(h)}function zi(h){if(!h)return h===0?h:0;if(h=ci(h),h===nt||h===-nt){var d=h<0?-1:1;return d*H}return h===h?h:0}function Bt(h){var d=zi(h),p=d%1;return d===d?p?d-p:d:0}function Gu(h){return h?ka(Bt(h),0,K):0}function ci(h){if(typeof h=="number")return h;if(Xe(h))return $;if(oe(h)){var d=typeof h.valueOf=="function"?h.valueOf():h;h=oe(d)?d+"":d}if(typeof h!="string")return h===0?h:+h;h=vh(h);var p=qv.test(h);return p||Kv.test(h)?C0(h.slice(2),p?2:8):jv.test(h)?$:+h}function Zu(h){return Ei(h,Ne(h))}function f1(h){return h?ka(Bt(h),-j,j):h===0?h:0}function Kt(h){return h==null?"":Ke(h)}var d1=rs(function(h,d){if(Ys(d)||Oe(d)){Ei(d,pe(d),h);return}for(var p in d)Xt.call(d,p)&&Ws(h,p,d[p])}),Ju=rs(function(h,d){Ei(d,Ne(d),h)}),vr=rs(function(h,d,p,k){Ei(d,Ne(d),h,k)}),g1=rs(function(h,d,p,k){Ei(d,pe(d),h,k)}),v1=Mi(Oo);function m1(h,d){var p=ns(h);return d==null?p:Ph(p,d)}var y1=Lt(function(h,d){h=Zt(h);var p=-1,k=d.length,L=k>2?d[2]:i;for(L&&Se(d[0],d[1],L)&&(k=1);++p<k;)for(var z=d[p],q=Ne(z),J=-1,st=q.length;++J<st;){var dt=q[J],gt=h[dt];(gt===i||yi(gt,is[dt])&&!Xt.call(h,dt))&&(h[dt]=z[dt])}return h}),p1=Lt(function(h){return h.push(i,vu),qe(Qu,i,h)});function w1(h,d){return uh(h,kt(d,3),_i)}function b1(h,d){return uh(h,kt(d,3),zo)}function x1(h,d){return h==null?h:No(h,kt(d,3),Ne)}function _1(h,d){return h==null?h:Lh(h,kt(d,3),Ne)}function E1(h,d){return h&&_i(h,kt(d,3))}function A1(h,d){return h&&zo(h,kt(d,3))}function k1(h){return h==null?[]:Gn(h,pe(h))}function C1(h){return h==null?[]:Gn(h,Ne(h))}function yl(h,d,p){var k=h==null?i:Ca(h,d);return k===i?p:k}function F1(h,d){return h!=null&&pu(h,d,Gm)}function pl(h,d){return h!=null&&pu(h,d,Zm)}var R1=hu(function(h,d,p){d!=null&&typeof d.toString!="function"&&(d=On.call(d)),h[d]=p},bl(ze)),T1=hu(function(h,d,p){d!=null&&typeof d.toString!="function"&&(d=On.call(d)),Xt.call(h,d)?h[d].push(p):h[d]=[p]},kt),P1=Lt(Vs);function pe(h){return Oe(h)?Rh(h):Vo(h)}function Ne(h){return Oe(h)?Rh(h,!0):oy(h)}function S1(h,d){var p={};return d=kt(d,3),_i(h,function(k,L,z){Di(p,d(k,L,z),k)}),p}function I1(h,d){var p={};return d=kt(d,3),_i(h,function(k,L,z){Di(p,L,d(k,L,z))}),p}var B1=rs(function(h,d,p){Zn(h,d,p)}),Qu=rs(function(h,d,p,k){Zn(h,d,p,k)}),D1=Mi(function(h,d){var p={};if(h==null)return p;var k=!1;d=se(d,function(z){return z=ra(z,h),k||(k=z.length>1),z}),Ei(h,al(h),p),k&&(p=ri(p,f|g|v,Ry));for(var L=d.length;L--;)Xo(p,d[L]);return p});function L1(h,d){return tf(h,fr(kt(d)))}var M1=Mi(function(h,d){return h==null?{}:cy(h,d)});function tf(h,d){if(h==null)return{};var p=se(al(h),function(k){return[k]});return d=kt(d),jh(h,p,function(k,L){return d(k,L[0])})}function O1(h,d,p){d=ra(d,h);var k=-1,L=d.length;for(L||(L=1,h=i);++k<L;){var z=h==null?i:h[Ai(d[k])];z===i&&(k=L,z=p),h=Ni(z)?z.call(h):z}return h}function N1(h,d,p){return h==null?h:js(h,d,p)}function z1(h,d,p,k){return k=typeof k=="function"?k:i,h==null?h:js(h,d,p,k)}var ef=du(pe),af=du(Ne);function H1(h,d,p){var k=Pt(h),L=k||la(h)||cs(h);if(d=kt(d,4),p==null){var z=h&&h.constructor;L?p=k?new z:[]:oe(h)?p=Ni(z)?ns(Hn(h)):{}:p={}}return(L?ai:_i)(h,function(q,J,st){return d(p,q,J,st)}),p}function W1(h,d){return h==null?!0:Xo(h,d)}function U1(h,d,p){return h==null?h:Gh(h,d,Jo(p))}function V1(h,d,p,k){return k=typeof k=="function"?k:i,h==null?h:Gh(h,d,Jo(p),k)}function hs(h){return h==null?[]:Po(h,pe(h))}function $1(h){return h==null?[]:Po(h,Ne(h))}function j1(h,d,p){return p===i&&(p=d,d=i),p!==i&&(p=ci(p),p=p===p?p:0),d!==i&&(d=ci(d),d=d===d?d:0),ka(ci(h),d,p)}function q1(h,d,p){return d=zi(d),p===i?(p=d,d=0):p=zi(p),h=ci(h),Jm(h,d,p)}function Y1(h,d,p){if(p&&typeof p!="boolean"&&Se(h,d,p)&&(d=p=i),p===i&&(typeof d=="boolean"?(p=d,d=i):typeof h=="boolean"&&(p=h,h=i)),h===i&&d===i?(h=0,d=1):(h=zi(h),d===i?(d=h,h=0):d=zi(d)),h>d){var k=h;h=d,d=k}if(p||h%1||d%1){var L=Ch();return Re(h+L*(d-h+k0("1e-"+((L+"").length-1))),d)}return qo(h,d)}var K1=os(function(h,d,p){return d=d.toLowerCase(),h+(p?sf(d):d)});function sf(h){return wl(Kt(h).toLowerCase())}function nf(h){return h=Kt(h),h&&h.replace(Gv,N0).replace(v0,"")}function X1(h,d,p){h=Kt(h),d=Ke(d);var k=h.length;p=p===i?k:ka(Bt(p),0,k);var L=p;return p-=d.length,p>=0&&h.slice(p,L)==d}function G1(h){return h=Kt(h),h&&Pv.test(h)?h.replace(Lc,z0):h}function Z1(h){return h=Kt(h),h&&Mv.test(h)?h.replace(go,"\\$&"):h}var J1=os(function(h,d,p){return h+(p?"-":"")+d.toLowerCase()}),Q1=os(function(h,d,p){return h+(p?" ":"")+d.toLowerCase()}),tb=ou("toLowerCase");function eb(h,d,p){h=Kt(h),d=Bt(d);var k=d?ts(h):0;if(!d||k>=d)return h;var L=(d-k)/2;return ar($n(L),p)+h+ar(Vn(L),p)}function ib(h,d,p){h=Kt(h),d=Bt(d);var k=d?ts(h):0;return d&&k<d?h+ar(d-k,p):h}function ab(h,d,p){h=Kt(h),d=Bt(d);var k=d?ts(h):0;return d&&k<d?ar(d-k,p)+h:h}function sb(h,d,p){return p||d==null?d=0:d&&(d=+d),um(Kt(h).replace(vo,""),d||0)}function nb(h,d,p){return(p?Se(h,d,p):d===i)?d=1:d=Bt(d),Yo(Kt(h),d)}function rb(){var h=arguments,d=Kt(h[0]);return h.length<3?d:d.replace(h[1],h[2])}var ob=os(function(h,d,p){return h+(p?"_":"")+d.toLowerCase()});function lb(h,d,p){return p&&typeof p!="number"&&Se(h,d,p)&&(d=p=i),p=p===i?K:p>>>0,p?(h=Kt(h),h&&(typeof d=="string"||d!=null&&!ml(d))&&(d=Ke(d),!d&&Qa(h))?oa(vi(h),0,p):h.split(d,p)):[]}var cb=os(function(h,d,p){return h+(p?" ":"")+wl(d)});function hb(h,d,p){return h=Kt(h),p=p==null?0:ka(Bt(p),0,h.length),d=Ke(d),h.slice(p,p+d.length)==d}function ub(h,d,p){var k=O.templateSettings;p&&Se(h,d,p)&&(d=i),h=Kt(h),d=vr({},d,k,gu);var L=vr({},d.imports,k.imports,gu),z=pe(L),q=Po(L,z),J,st,dt=0,gt=d.interpolate||Rn,vt="__p += '",pt=Io((d.escape||Rn).source+"|"+gt.source+"|"+(gt===Mc?$v:Rn).source+"|"+(d.evaluate||Rn).source+"|$","g"),_t="//# sourceURL="+(Xt.call(d,"sourceURL")?(d.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++b0+"]")+`
  109. `;h.replace(pt,function(Ft,Ot,Ht,Ge,Ie,Ze){return Ht||(Ht=Ge),vt+=h.slice(dt,Ze).replace(Zv,H0),Ot&&(J=!0,vt+=`' +
  110. __e(`+Ot+`) +
  111. '`),Ie&&(st=!0,vt+=`';
  112. `+Ie+`;
  113. __p += '`),Ht&&(vt+=`' +
  114. ((__t = (`+Ht+`)) == null ? '' : __t) +
  115. '`),dt=Ze+Ft.length,Ft}),vt+=`';
  116. `;var Ct=Xt.call(d,"variable")&&d.variable;if(!Ct)vt=`with (obj) {
  117. `+vt+`
  118. }
  119. `;else if(Uv.test(Ct))throw new Tt(l);vt=(st?vt.replace(Cv,""):vt).replace(Fv,"$1").replace(Rv,"$1;"),vt="function("+(Ct||"obj")+`) {
  120. `+(Ct?"":`obj || (obj = {});
  121. `)+"var __t, __p = ''"+(J?", __e = _.escape":"")+(st?`, __j = Array.prototype.join;
  122. function print() { __p += __j.call(arguments, '') }
  123. `:`;
  124. `)+vt+`return __p
  125. }`;var Dt=of(function(){return qt(z,_t+"return "+vt).apply(i,q)});if(Dt.source=vt,vl(Dt))throw Dt;return Dt}function fb(h){return Kt(h).toLowerCase()}function db(h){return Kt(h).toUpperCase()}function gb(h,d,p){if(h=Kt(h),h&&(p||d===i))return vh(h);if(!h||!(d=Ke(d)))return h;var k=vi(h),L=vi(d),z=mh(k,L),q=yh(k,L)+1;return oa(k,z,q).join("")}function vb(h,d,p){if(h=Kt(h),h&&(p||d===i))return h.slice(0,wh(h)+1);if(!h||!(d=Ke(d)))return h;var k=vi(h),L=yh(k,vi(d))+1;return oa(k,0,L).join("")}function mb(h,d,p){if(h=Kt(h),h&&(p||d===i))return h.replace(vo,"");if(!h||!(d=Ke(d)))return h;var k=vi(h),L=mh(k,vi(d));return oa(k,L).join("")}function yb(h,d){var p=Q,k=F;if(oe(d)){var L="separator"in d?d.separator:L;p="length"in d?Bt(d.length):p,k="omission"in d?Ke(d.omission):k}h=Kt(h);var z=h.length;if(Qa(h)){var q=vi(h);z=q.length}if(p>=z)return h;var J=p-ts(k);if(J<1)return k;var st=q?oa(q,0,J).join(""):h.slice(0,J);if(L===i)return st+k;if(q&&(J+=st.length-J),ml(L)){if(h.slice(J).search(L)){var dt,gt=st;for(L.global||(L=Io(L.source,Kt(Oc.exec(L))+"g")),L.lastIndex=0;dt=L.exec(gt);)var vt=dt.index;st=st.slice(0,vt===i?J:vt)}}else if(h.indexOf(Ke(L),J)!=J){var pt=st.lastIndexOf(L);pt>-1&&(st=st.slice(0,pt))}return st+k}function pb(h){return h=Kt(h),h&&Tv.test(h)?h.replace(Dc,Y0):h}var wb=os(function(h,d,p){return h+(p?" ":"")+d.toUpperCase()}),wl=ou("toUpperCase");function rf(h,d,p){return h=Kt(h),d=p?i:d,d===i?U0(h)?G0(h):B0(h):h.match(d)||[]}var of=Lt(function(h,d){try{return qe(h,i,d)}catch(p){return vl(p)?p:new Tt(p)}}),bb=Mi(function(h,d){return ai(d,function(p){p=Ai(p),Di(h,p,dl(h[p],h))}),h});function xb(h){var d=h==null?0:h.length,p=kt();return h=d?se(h,function(k){if(typeof k[1]!="function")throw new si(r);return[p(k[0]),k[1]]}):[],Lt(function(k){for(var L=-1;++L<d;){var z=h[L];if(qe(z[0],this,k))return qe(z[1],this,k)}})}function _b(h){return Ym(ri(h,f))}function bl(h){return function(){return h}}function Eb(h,d){return h==null||h!==h?d:h}var Ab=cu(),kb=cu(!0);function ze(h){return h}function xl(h){return zh(typeof h=="function"?h:ri(h,f))}function Cb(h){return Wh(ri(h,f))}function Fb(h,d){return Uh(h,ri(d,f))}var Rb=Lt(function(h,d){return function(p){return Vs(p,h,d)}}),Tb=Lt(function(h,d){return function(p){return Vs(h,p,d)}});function _l(h,d,p){var k=pe(d),L=Gn(d,k);p==null&&!(oe(d)&&(L.length||!k.length))&&(p=d,d=h,h=this,L=Gn(d,pe(d)));var z=!(oe(p)&&"chain"in p)||!!p.chain,q=Ni(h);return ai(L,function(J){var st=d[J];h[J]=st,q&&(h.prototype[J]=function(){var dt=this.__chain__;if(z||dt){var gt=h(this.__wrapped__),vt=gt.__actions__=Me(this.__actions__);return vt.push({func:st,args:arguments,thisArg:h}),gt.__chain__=dt,gt}return st.apply(h,ea([this.value()],arguments))})}),h}function Pb(){return _e._===this&&(_e._=im),this}function El(){}function Sb(h){return h=Bt(h),Lt(function(d){return Vh(d,h)})}var Ib=tl(se),Bb=tl(hh),Db=tl(ko);function lf(h){return ol(h)?Co(Ai(h)):hy(h)}function Lb(h){return function(d){return h==null?i:Ca(h,d)}}var Mb=uu(),Ob=uu(!0);function Al(){return[]}function kl(){return!1}function Nb(){return{}}function zb(){return""}function Hb(){return!0}function Wb(h,d){if(h=Bt(h),h<1||h>j)return[];var p=K,k=Re(h,K);d=kt(d),h-=K;for(var L=To(k,d);++p<h;)d(p);return L}function Ub(h){return Pt(h)?se(h,Ai):Xe(h)?[h]:Me(Fu(Kt(h)))}function Vb(h){var d=++tm;return Kt(h)+d}var $b=ir(function(h,d){return h+d},0),jb=el("ceil"),qb=ir(function(h,d){return h/d},1),Yb=el("floor");function Kb(h){return h&&h.length?Xn(h,ze,Ho):i}function Xb(h,d){return h&&h.length?Xn(h,kt(d,2),Ho):i}function Gb(h){return dh(h,ze)}function Zb(h,d){return dh(h,kt(d,2))}function Jb(h){return h&&h.length?Xn(h,ze,$o):i}function Qb(h,d){return h&&h.length?Xn(h,kt(d,2),$o):i}var tx=ir(function(h,d){return h*d},1),ex=el("round"),ix=ir(function(h,d){return h-d},0);function ax(h){return h&&h.length?Ro(h,ze):0}function sx(h,d){return h&&h.length?Ro(h,kt(d,2)):0}return O.after=Cw,O.ary=Nu,O.assign=d1,O.assignIn=Ju,O.assignInWith=vr,O.assignWith=g1,O.at=v1,O.before=zu,O.bind=dl,O.bindAll=bb,O.bindKey=Hu,O.castArray=Nw,O.chain=Lu,O.chunk=Yy,O.compact=Ky,O.concat=Xy,O.cond=xb,O.conforms=_b,O.constant=bl,O.countBy=aw,O.create=m1,O.curry=Wu,O.curryRight=Uu,O.debounce=Vu,O.defaults=y1,O.defaultsDeep=p1,O.defer=Fw,O.delay=Rw,O.difference=Gy,O.differenceBy=Zy,O.differenceWith=Jy,O.drop=Qy,O.dropRight=tp,O.dropRightWhile=ep,O.dropWhile=ip,O.fill=ap,O.filter=nw,O.flatMap=lw,O.flatMapDeep=cw,O.flatMapDepth=hw,O.flatten=Su,O.flattenDeep=sp,O.flattenDepth=np,O.flip=Tw,O.flow=Ab,O.flowRight=kb,O.fromPairs=rp,O.functions=k1,O.functionsIn=C1,O.groupBy=uw,O.initial=lp,O.intersection=cp,O.intersectionBy=hp,O.intersectionWith=up,O.invert=R1,O.invertBy=T1,O.invokeMap=dw,O.iteratee=xl,O.keyBy=gw,O.keys=pe,O.keysIn=Ne,O.map=cr,O.mapKeys=S1,O.mapValues=I1,O.matches=Cb,O.matchesProperty=Fb,O.memoize=ur,O.merge=B1,O.mergeWith=Qu,O.method=Rb,O.methodOf=Tb,O.mixin=_l,O.negate=fr,O.nthArg=Sb,O.omit=D1,O.omitBy=L1,O.once=Pw,O.orderBy=vw,O.over=Ib,O.overArgs=Sw,O.overEvery=Bb,O.overSome=Db,O.partial=gl,O.partialRight=$u,O.partition=mw,O.pick=M1,O.pickBy=tf,O.property=lf,O.propertyOf=Lb,O.pull=vp,O.pullAll=Bu,O.pullAllBy=mp,O.pullAllWith=yp,O.pullAt=pp,O.range=Mb,O.rangeRight=Ob,O.rearg=Iw,O.reject=ww,O.remove=wp,O.rest=Bw,O.reverse=ul,O.sampleSize=xw,O.set=N1,O.setWith=z1,O.shuffle=_w,O.slice=bp,O.sortBy=kw,O.sortedUniq=Fp,O.sortedUniqBy=Rp,O.split=lb,O.spread=Dw,O.tail=Tp,O.take=Pp,O.takeRight=Sp,O.takeRightWhile=Ip,O.takeWhile=Bp,O.tap=Kp,O.throttle=Lw,O.thru=lr,O.toArray=Xu,O.toPairs=ef,O.toPairsIn=af,O.toPath=Ub,O.toPlainObject=Zu,O.transform=H1,O.unary=Mw,O.union=Dp,O.unionBy=Lp,O.unionWith=Mp,O.uniq=Op,O.uniqBy=Np,O.uniqWith=zp,O.unset=W1,O.unzip=fl,O.unzipWith=Du,O.update=U1,O.updateWith=V1,O.values=hs,O.valuesIn=$1,O.without=Hp,O.words=rf,O.wrap=Ow,O.xor=Wp,O.xorBy=Up,O.xorWith=Vp,O.zip=$p,O.zipObject=jp,O.zipObjectDeep=qp,O.zipWith=Yp,O.entries=ef,O.entriesIn=af,O.extend=Ju,O.extendWith=vr,_l(O,O),O.add=$b,O.attempt=of,O.camelCase=K1,O.capitalize=sf,O.ceil=jb,O.clamp=j1,O.clone=zw,O.cloneDeep=Ww,O.cloneDeepWith=Uw,O.cloneWith=Hw,O.conformsTo=Vw,O.deburr=nf,O.defaultTo=Eb,O.divide=qb,O.endsWith=X1,O.eq=yi,O.escape=G1,O.escapeRegExp=Z1,O.every=sw,O.find=rw,O.findIndex=Tu,O.findKey=w1,O.findLast=ow,O.findLastIndex=Pu,O.findLastKey=b1,O.floor=Yb,O.forEach=Mu,O.forEachRight=Ou,O.forIn=x1,O.forInRight=_1,O.forOwn=E1,O.forOwnRight=A1,O.get=yl,O.gt=$w,O.gte=jw,O.has=F1,O.hasIn=pl,O.head=Iu,O.identity=ze,O.includes=fw,O.indexOf=op,O.inRange=q1,O.invoke=P1,O.isArguments=Ta,O.isArray=Pt,O.isArrayBuffer=qw,O.isArrayLike=Oe,O.isArrayLikeObject=ue,O.isBoolean=Yw,O.isBuffer=la,O.isDate=Kw,O.isElement=Xw,O.isEmpty=Gw,O.isEqual=Zw,O.isEqualWith=Jw,O.isError=vl,O.isFinite=Qw,O.isFunction=Ni,O.isInteger=ju,O.isLength=dr,O.isMap=qu,O.isMatch=t1,O.isMatchWith=e1,O.isNaN=i1,O.isNative=a1,O.isNil=n1,O.isNull=s1,O.isNumber=Yu,O.isObject=oe,O.isObjectLike=ce,O.isPlainObject=Xs,O.isRegExp=ml,O.isSafeInteger=r1,O.isSet=Ku,O.isString=gr,O.isSymbol=Xe,O.isTypedArray=cs,O.isUndefined=o1,O.isWeakMap=l1,O.isWeakSet=c1,O.join=fp,O.kebabCase=J1,O.last=li,O.lastIndexOf=dp,O.lowerCase=Q1,O.lowerFirst=tb,O.lt=h1,O.lte=u1,O.max=Kb,O.maxBy=Xb,O.mean=Gb,O.meanBy=Zb,O.min=Jb,O.minBy=Qb,O.stubArray=Al,O.stubFalse=kl,O.stubObject=Nb,O.stubString=zb,O.stubTrue=Hb,O.multiply=tx,O.nth=gp,O.noConflict=Pb,O.noop=El,O.now=hr,O.pad=eb,O.padEnd=ib,O.padStart=ab,O.parseInt=sb,O.random=Y1,O.reduce=yw,O.reduceRight=pw,O.repeat=nb,O.replace=rb,O.result=O1,O.round=ex,O.runInContext=it,O.sample=bw,O.size=Ew,O.snakeCase=ob,O.some=Aw,O.sortedIndex=xp,O.sortedIndexBy=_p,O.sortedIndexOf=Ep,O.sortedLastIndex=Ap,O.sortedLastIndexBy=kp,O.sortedLastIndexOf=Cp,O.startCase=cb,O.startsWith=hb,O.subtract=ix,O.sum=ax,O.sumBy=sx,O.template=ub,O.times=Wb,O.toFinite=zi,O.toInteger=Bt,O.toLength=Gu,O.toLower=fb,O.toNumber=ci,O.toSafeInteger=f1,O.toString=Kt,O.toUpper=db,O.trim=gb,O.trimEnd=vb,O.trimStart=mb,O.truncate=yb,O.unescape=pb,O.uniqueId=Vb,O.upperCase=wb,O.upperFirst=wl,O.each=Mu,O.eachRight=Ou,O.first=Iu,_l(O,function(){var h={};return _i(O,function(d,p){Xt.call(O.prototype,p)||(h[p]=d)}),h}(),{chain:!1}),O.VERSION=a,ai(["bind","bindKey","curry","curryRight","partial","partialRight"],function(h){O[h].placeholder=O}),ai(["drop","take"],function(h,d){Nt.prototype[h]=function(p){p=p===i?1:me(Bt(p),0);var k=this.__filtered__&&!d?new Nt(this):this.clone();return k.__filtered__?k.__takeCount__=Re(p,k.__takeCount__):k.__views__.push({size:Re(p,K),type:h+(k.__dir__<0?"Right":"")}),k},Nt.prototype[h+"Right"]=function(p){return this.reverse()[h](p).reverse()}}),ai(["filter","map","takeWhile"],function(h,d){var p=d+1,k=p==M||p==Z;Nt.prototype[h]=function(L){var z=this.clone();return z.__iteratees__.push({iteratee:kt(L,3),type:p}),z.__filtered__=z.__filtered__||k,z}}),ai(["head","last"],function(h,d){var p="take"+(d?"Right":"");Nt.prototype[h]=function(){return this[p](1).value()[0]}}),ai(["initial","tail"],function(h,d){var p="drop"+(d?"":"Right");Nt.prototype[h]=function(){return this.__filtered__?new Nt(this):this[p](1)}}),Nt.prototype.compact=function(){return this.filter(ze)},Nt.prototype.find=function(h){return this.filter(h).head()},Nt.prototype.findLast=function(h){return this.reverse().find(h)},Nt.prototype.invokeMap=Lt(function(h,d){return typeof h=="function"?new Nt(this):this.map(function(p){return Vs(p,h,d)})}),Nt.prototype.reject=function(h){return this.filter(fr(kt(h)))},Nt.prototype.slice=function(h,d){h=Bt(h);var p=this;return p.__filtered__&&(h>0||d<0)?new Nt(p):(h<0?p=p.takeRight(-h):h&&(p=p.drop(h)),d!==i&&(d=Bt(d),p=d<0?p.dropRight(-d):p.take(d-h)),p)},Nt.prototype.takeRightWhile=function(h){return this.reverse().takeWhile(h).reverse()},Nt.prototype.toArray=function(){return this.take(K)},_i(Nt.prototype,function(h,d){var p=/^(?:filter|find|map|reject)|While$/.test(d),k=/^(?:head|last)$/.test(d),L=O[k?"take"+(d=="last"?"Right":""):d],z=k||/^find/.test(d);!L||(O.prototype[d]=function(){var q=this.__wrapped__,J=k?[1]:arguments,st=q instanceof Nt,dt=J[0],gt=st||Pt(q),vt=function(Ot){var Ht=L.apply(O,ea([Ot],J));return k&&pt?Ht[0]:Ht};gt&&p&&typeof dt=="function"&&dt.length!=1&&(st=gt=!1);var pt=this.__chain__,_t=!!this.__actions__.length,Ct=z&&!pt,Dt=st&&!_t;if(!z&&gt){q=Dt?q:new Nt(this);var Ft=h.apply(q,J);return Ft.__actions__.push({func:lr,args:[vt],thisArg:i}),new ni(Ft,pt)}return Ct&&Dt?h.apply(this,J):(Ft=this.thru(vt),Ct?k?Ft.value()[0]:Ft.value():Ft)})}),ai(["pop","push","shift","sort","splice","unshift"],function(h){var d=Dn[h],p=/^(?:push|sort|unshift)$/.test(h)?"tap":"thru",k=/^(?:pop|shift)$/.test(h);O.prototype[h]=function(){var L=arguments;if(k&&!this.__chain__){var z=this.value();return d.apply(Pt(z)?z:[],L)}return this[p](function(q){return d.apply(Pt(q)?q:[],L)})}}),_i(Nt.prototype,function(h,d){var p=O[d];if(p){var k=p.name+"";Xt.call(ss,k)||(ss[k]=[]),ss[k].push({name:d,func:p})}}),ss[er(i,_).name]=[{name:"wrapper",func:i}],Nt.prototype.clone=pm,Nt.prototype.reverse=wm,Nt.prototype.value=bm,O.prototype.at=Xp,O.prototype.chain=Gp,O.prototype.commit=Zp,O.prototype.next=Jp,O.prototype.plant=tw,O.prototype.reverse=ew,O.prototype.toJSON=O.prototype.valueOf=O.prototype.value=iw,O.prototype.first=O.prototype.head,Ms&&(O.prototype[Ms]=Qp),O},es=Z0();xa?((xa.exports=es)._=es,xo._=es):_e._=es}).call(Be)})(gc,gc.exports);const L5=gc.exports;export{TE as M,L5 as _,m5 as a,p5 as b,w5 as c,b5 as d,A5 as e,v5 as f,y5 as g,_5 as h,k5 as i,C5 as j,F5 as k,B5 as l,S5 as m,T5 as n,P5 as o,D5 as p,I5 as q,x5 as r,E5 as s,R5 as t};