var t2=Object.defineProperty;var e2=(e,t,i)=>t in e?t2(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i;var H=(e,t,i)=>(e2(e,typeof t!="symbol"?t+"":t,i),i);import{P as Oe}from"./index.0f1108f6.js";function ja(e,t){const i=t||new Path2D;if(e.name==="combine"&&!e.draw)return i instanceof Path2D?i:void 0;e.setTheme||(e.setTheme=i2);let a=e.calculative.borderRadius*e.calculative.canvas.store.data.scale||0,s=a;const{x:n,y:r,width:o,height:l,ex:h,ey:c}=e.calculative.worldRect;a<1&&(a=o*a,s=l*s);let d=at.x-i&&e.xt.y-i&&e.y0&&a>0?s=180-s:i<0&&a>0?s+=180:i<0&&a<0&&(s=360-s),s}function wo(e,t){const i=e.x-t.x,a=e.y-t.y;return Math.sqrt(i*i+a*a)}function u2(e,t){let i=Pt.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=Pt.Right:i=Pt.Left:s>0?i=Pt.Bottom:i=Pt.Up,i}function bn(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 Xf(e,t){return e.anchorId===t.anchorId&&e.connectTo===t.connectTo}function Rr(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>>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 Wa;(function(e){e[e.None=-1]="None",e[e.Document=0]="Document",e[e.Canvas=1]="Canvas"})(Wa||(Wa={}));const B2="#FFFFFF00",D2={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:Wa.Document,gridSize:20,gridColor:"#e2e2e2",ruleColor:"#888888",drawingLineName:"curve",interval:30,minFPSNumber:10,autoFPS:!0,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,parentTouch:!0,cdn:"",polylineSpace:10,dirMarkers:!1,domShapes:[],containerShapes:["tablePlus"],textFlip:!0,textRotate:!0,unavailableKeys:[],diagramOptions:{},svgPathStroke:!0,reconnetTimes:10},M2=["color","hoverColor","activeColor","disabledColor","background","activeBackground","hoverBackground","disabledBackground","anchorColor","hoverAnchorColor","anchorBackground","animateColor","textColor","ruleColor","ruleLineColor","gridColor","lineColor","penBackground","dockPenColor"],L2={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"}}},gn={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"){var a;const t=":";return(a=this[e])==null?void 0:a.reduce((s,n)=>{const[r,o]=n.split(t);return s[r]=o,s},{})},findStyleSheet(e){const t=document.styleSheets;for(let i=0;io.selectorText===this.cssRuleSelector);if(r){const o=a.join(";");r.style.cssText+=`; ${o}`}else s.addRule(this.cssRuleSelector,a.join(";"))}}};var _t;(function(e){e[e.Add=0]="Add",e[e.Update=1]="Update",e[e.Delete=2]="Delete",e[e.Replace=3]="Replace"})(_t||(_t={}));const O2=()=>({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:{...D2},theme:{...L2},emitter:I2(),bindDatas:{},bind:{},pensNetwork:{},cacheDatas:[],messageEvents:{},templatePens:{},globalTriggers:{}}),N2=(e="default")=>(wt[e]||(wt[e]=O2(),wt[e].id=e),wt[e]),z2=(e,t)=>{const i=e.data.template===t;if(i)for(const a of e.data.pens)a.canvasLayer,zt.CanvasTemplate;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()},xc={en:{\u786E\u5B9A:"OK",\u53D6\u6D88:"Cancel","\u786E\u8BA4\u6267\u884C\u64CD\u4F5C\u5417\uFF1F":"Confirm this action?",\u8BF7\u8F93\u5165:"Enter text",\u65E0:"None","\u8BF7\u6309\u4F4F\u6ED1\u5757\uFF0C\u62D6\u52A8\u5230\u6700\u53F3\u8FB9\u5B8C\u6210\u9A8C\u8BC1":"Hold and drag the slider to the right",\u9A8C\u8BC1\u6210\u529F:"Verified",\u641C\u7D22:"Search",\u6682\u65E0\u6570\u636E:"No data",\u8BF7\u9009\u62E9:"Please select",\u53EF\u62D6\u62FD\u8868\u683C:"Draggable table",SQL\u547D\u4EE4:"SQL Command",\u5171:"Total",\u6761\u6570\u636E:"records",\u6BCF\u9875:"Per page",\u6761:"items",\u6D4B\u8BD5:"Test",\u5F00\u59CB\u65E5\u671F:"Start date",\u7ED3\u675F\u65E5\u671F:"End date",\u5F00\u59CB\u5468:"Start week",\u7ED3\u675F\u5468:"End week",\u5F00\u59CB\u6708\u4EFD:"Start month",\u7ED3\u675F\u6708\u4EFD:"End month",\u5F00\u59CB\u5E74\u4EFD:"Start year",\u7ED3\u675F\u5E74\u4EFD:"End year",\u5F00\u59CB\u65F6\u95F4:"Start time",\u7ED3\u675F\u65F6\u95F4:"End time",\u65F6\u95F4:"Time",\u661F\u671F:"Week ",\u65E5:"Sun",\u4E00:"Mon",\u4E8C:"Tue",\u4E09:"Wed",\u56DB:"Thu",\u4E94:"Fri",\u516D:"Sat"}};let _c="zh-CN";function ke(e){var t,i;return _c==="zh-CN"?e:(i=(t=xc[_c])==null?void 0:t[e])!=null?i:e}function W2(e){_c=e}function H2(e,t){var i;xc[e]={...(i=xc[e])!=null?i:{},...t}}function Pi(e){return typeof e=="number"&&!isNaN(e)}function to(e){return e==null||typeof e=="string"&&e.trim()===""||!e&&e!==0&&e!=="0"&&e!==!1}function Bi(e){const{paddingTop:t,paddingBottom:i,paddingLeft:a,paddingRight:s,worldRect:n,canvas:r,text:o}=e.calculative;let{textLeft:l,textTop:h,textWidth:c,textHeight:d}=e.calculative,f=a,g=t;const m=n.width-a-s,y=n.height-t-i;c&&c<1&&(c*=n.width),d&&d<1&&(d*=n.height),c1?c:1;switch(s){case"nowrap":if(n!==!1){const m=Gf([...a],e);m[0]&&(o.push(m[0]),m.length>1&&Jl(o))}else o.push(a);break;case"pre-line":o=a.split(/[\n]/g),n!==!1&&o.length>d&&(o=o.slice(0,d),Jl(o));break;case"break-all":default:const f=a.split(/[\n]/g);let g=0;t:for(const m of f){const y=s==="break-all"?m.split(""):Dg(m);let p=Gf(y,e);if(p.length===0&&(p=[""]),n!=!1)for(const x of p)if(g++,g>d){Jl(o);break t}else o.push(x);else o.push(...p)}break}return i.textLines=o,o}function Dg(e=""){const t=[];let i="";for(let a=0;a126?(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:o,lineHeight:l}=t.calculative;a.save();const h=[];let c=e[0]||"";for(let d=1;d{let s;t.calculative.textType?s=V2(a,t)+a.length*t.calculative.letterSpacing:s=e.measureText(a).width+a.length*t.calculative.letterSpacing,t.calculative.textLineWidths.push(s),ih&&(h=c)}a.restore();let d=t.length*r*l;e.textAlign==="left"||(e.textAlign==="right"?e.x=e.x-(h-e.width):e.x=e.x-(h-e.width)/2),e.textBaseline==="top"||(e.textBaseline==="bottom"?e.y=e.y-(d-e.height):e.y=e.y-(d-e.height)/2),e.height=d+5,e.width=h+5,e.calculative.canvas.updatePenRect(e),e.calculative.canvas.calcActiveRect()}function ot(e,t=!1){if(Array.isArray(e)){const i=[];return e.forEach(a=>{i.push(ot(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 HTMLCanvasElement||e[a]instanceof HTMLMediaElement)){{if(a==="calculative"&&!t)continue;if(a==="singleton"){t?i[a]={}:i[a]=e[a];continue}}i[a]=ot(e[a],t)}return i}return e}function Ec(e,t,i){if(Array.isArray(e)){const a=[];return e.forEach(s=>{a.push(Ec(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]=Ec(e[a],t,i);return e}return e}const Xe={};function Mg(e,t,i){if(!Xe[t.fromArrow])return;const a=ce(t),{x:s,y:n}=a,r={x:s,y:n};if(r.step=(t.fromArrowSize||10)*i.data.scale,a.next)r.rotate=gi(a.next,a)+90;else{const l=t.calculative.worldAnchors[1];if(!l)return;l.prev?r.rotate=gi(l.prev,a)+90:r.rotate=gi(l,a)+90}e.save(),e.beginPath(),e.setLineDash([]);const o=t.fromArrowColor||t.calculative.color;o&&(e.strokeStyle=o),Xe[t.fromArrow](e,t,i,r),e.restore()}function Lg(e,t,i){if(!Xe[t.toArrow]||t.calculative.worldAnchors.length<2)return;e.save();const a=jt(t),{x:s,y:n}=a,r={x:s,y:n};if(r.step=(t.toArrowSize||10)*i.data.scale,a.prev)r.rotate=gi(a.prev,a)+90;else{const l=t.calculative.worldAnchors[t.calculative.worldAnchors.length-2];l.next?r.rotate=gi(l.next,a)+90:r.rotate=gi(l,a)+90}e.beginPath(),e.setLineDash([]);const o=t.toArrowColor||t.calculative.color;o&&(e.strokeStyle=o),Xe[t.toArrow](e,t,i,r),e.restore()}Xe.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()};Xe.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()};Xe.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()};Xe.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()};Xe.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()};Xe.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()};Xe.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()};Xe.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()};Xe.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()};Xe.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 Ac(e){const t=parseInt,i=Math.round;let a=e.length,s={};if(a>9){const[n,r,o,l]=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(o),s.a=l?parseFloat(l):-1}else{if(a==8||a==6||a<4)return null;a<6&&(e="#"+e[1]+e[1]+e[2]+e[2]+e[3]+e[3]+(a>4?e[4]+e[4]:"")),e=t(e.slice(1),16),a==9||a==5?(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 Ce(e,t,i,a){let s,n,r,o,l,h,c,d=Math.round,f=typeof i=="string";return typeof e!="number"||e<-1||e>1||typeof t!="string"||t[0]!="r"&&t[0]!="#"||i&&!f||(c=t.length>9,c=f?i.length>9?!0:i=="c"?!c:!1:c,l=Ac(t),o=e<0,h=i&&i!="c"?Ac(i):o?{r:0,g:0,b:0,a:-1}:{r:255,g:255,b:255,a:-1},e=o?e*-1:e,o=1-e,!l||!h)?null:(a?(s=d(o*l.r+e*h.r),n=d(o*l.g+e*h.g),r=d(o*l.b+e*h.b)):(s=d((o*l.r**2+e*h.r**2)**.5),n=d((o*l.g**2+e*h.g**2)**.5),r=d((o*l.b**2+e*h.b**2)**.5)),f=l.a,h=h.a,l=f>=0||h>=0,f=l?f<0?h:h<0?f:f*o+h*e:0,c?"rgb"+(l?"a(":"(")+s+","+n+","+r+(l?","+d(f*1e3)/1e3:"")+")":"#"+(4294967296+s*16777216+n*65536+r*256+(l?d(f*255):0)).toString(16).slice(1,l?void 0:-2))}globalThis.pSBC=Ce;function eo(e,t){const i=Ac(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 bs(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=h){console.warn("startNum must less than endNum");return}if(e>=l&&e<=h)return!0}else if(e==n)return!0;return!1}function Og(e,t,i){const a=1-e;return 3*a*a*e*t+3*a*e*e*i+e*e*e}function j2(e){const t=e.match(/^-?\d*\.?\d*/);if(e=t?t[0]:"",e.includes("-")&&e.indexOf("-")!==0&&(e=e.replace(/-/g,""),e&&(e="-"+e)),(e.match(/\./g)||[]).length>1){const a=e.split(".");e=a[0]+"."+a.slice(1).join("")}return e}function Tt(){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=Ql(e[1])?e[0]:e[1],s=Ql(e[2])?e[0]:e[2],i=Ql(e[3])?a:e[3]),[t,a,s,i]};function Ql(e){return e==null}async function q2(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 Y2(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 K2(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 Rs(e){let t=e||window.location.search.split("?")[1];const i=new URLSearchParams(t);return Object.fromEntries(i.entries())}function io(e){let t;const i=new RegExp("(^| )"+e+"=([^;]*)(;|$)");return(t=document.cookie.match(i))?decodeURIComponent(t[2]):""}var ao;(function(e){e[e.None=0]="None",e[e.LocalStorage=1]="LocalStorage",e[e.Cookie=2]="Cookie"})(ao||(ao={}));const X2=location.host.indexOf("le5le.com")!==-1;function vn(){var i,a;let e="";const t=(i=globalThis.le5leTokenName)!=null?i:"token";switch(globalThis.le5leTokenType){case ao.LocalStorage:e=localStorage.getItem(t);break;case ao.Cookie:e=io(t);break;default:e=X2?io(t):localStorage.getItem(t)}return((a=globalThis.TokenPrefix)!=null?a:"Bearer ")+(globalThis.le5leTokenD?Ng(e):e)}function Ng(e){if(!e)return e;const t=e.split("");for(let i=0;ia[s]=t.split(".").length===++n?i:a[s]||{},e)}function zg(){}function Yc(e){return!!(e!=null&&e.allowScript)}function Te(e,...t){return Yc(e)?new Function(...t):zg}function Pr(e,...t){if(!Yc(e))return async()=>{};const i=Object.getPrototypeOf(async function(){}).constructor;return new i(...t)}function G2(e,t){return Yc(e)?Te(e,`return (${t})`)():zg}function no(e,t,i){const a=["\u5929","\u4E00","\u4E8C","\u4E09","\u56DB","\u4E94","\u516D"];let s=new Date;t&&(s=new Date(t));const n=s.getFullYear(),r=s.getMonth()+1,o=s.getDate(),l=s.getDay(),h=s.getHours(),c=s.getMinutes(),d=s.getSeconds();if(!e)return`${n}:${r}:${o} ${h}:${c}:${d} \u661F\u671F${a[l]}`;let f=Te(i,"year","month","day","week","hours","minutes","seconds",`return ${e}`);const g=f(n,r,o,a[l],h,c,d);return f=null,g}const tc=new WeakMap;function Wg(e,t,i){let a=tc.get(e);return a?clearTimeout(a.timer):(a={},tc.set(e,a)),new Promise((s,n)=>{a.timer=setTimeout(async()=>{s(await e(i)),tc.delete(e)},t)})}class Kc{static debounce(t,i,a=300){const s=Symbol(`${t.constructor.name}.${i}`);this.instances.has(t)||this.instances.set(t,{});const n=this.instances.get(t);return(...r)=>{n[s]&&clearTimeout(n[s]),n[s]=setTimeout(()=>{t[i](...r),delete n[s]},a)}}}H(Kc,"instances",new WeakMap);const Zf="line",ro="repeat";function Z2(e,t){if(!e||!t)return!1;let i=We(e);for(;i;){if(i.id===t.id)return!0;i=We(i)}return!1}function We(e,t){if(!e||!e.parentId||!e.calculative)return;const a=e.calculative.canvas.store.pens[e.parentId];return t&&We(a,t)||a}function Le(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(...Le(s,t)))}),i}function Xc(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(...Xc(s,t)))}),i}function J2(e,t){const{worldRect:i,gradientFromColor:a,gradientToColor:s,gradientAngle:n}=t.calculative;return Ug(e,i,a,s,n)}function Q2(e,t){const{worldRect:i,gradientFromColor:a,gradientToColor:s,gradientRadius:n}=t.calculative;if(!a||!s)return;const{width:r,height:o,center:l}=i,{x:h,y:c}=l;let d=r;d{g.addColorStop(m.i,m.color)}),g}function Jf(e,t,i){const{x:a,y:s,ex:n,width:r,height:o,center:l}=t.calculative.worldRect;let h=[{x:n,y:s+o/2},{x:a,y:s+o/2}],c=i||t.calculative.gradientColors;t.calculative.checked&&(c=t.calculative.onGradientColors);const{angle:d,colors:f}=na(c);let g=bo(d,r,o);return h.forEach(m=>{Zt(m,d,l)}),Dn(e,h,f,g)}function i_(e,t){const{worldRect:i,textGradientColors:a}=t.calculative;if(!a)return;const{width:s,height:n,center:r}=i,{x:o,y:l}=r;let h=s;h{d.addColorStop(f.i,f.color)}),d}function a_(e,t){!t.calculative.textDrawRect&&jc(e,t),te(t.calculative.textDrawRect);const{x:i,y:a,ex:s,width:n,height:r,center:o}=t.calculative.textDrawRect;let l=[{x:s,y:a+r/2},{x:i,y:a+r/2}];const{angle:h,colors:c}=na(t.calculative.textGradientColors);let d=bo(h,n,r);return l.forEach(f=>{Zt(f,h,o)}),Dn(e,l,c,d)}function s_(e,t){const{worldIconRect:i,iconGradientColors:a}=t.calculative;if(!a||!i)return;const{x:s,y:n,ex:r,width:o,height:l,center:h}=i;let c=[{x:r,y:n+l/2},{x:s,y:n+l/2}];const{angle:d,colors:f}=na(a);let g=bo(d,o,l);return c.forEach(m=>{Zt(m,d,h)}),Dn(e,c,f,g)}function n_(e,t){const{worldIconRect:i,iconGradientColors:a,iconGradientRadius:s}=t.calculative;if(!a||!i)return;const{width:n,height:r,center:o}=i,{x:l,y:h}=o;let c=n;c{f.addColorStop(g.i,g.color)}),f}function bo(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 na(e){if(typeof e!="string"||!e.startsWith("linear-gradient"))return{angle:0,colors:[]};const t=e.indexOf("("),i=e.lastIndexOf(")");if(t===-1||i===-1||i<=t)return{angle:0,colors:[]};const a=e.slice(t+1,i).trim(),s=r_(a);if(s.length===0)return{angle:0,colors:[]};let n=0,r=0;const o=s[0].trim();o.endsWith("deg")?(n=parseFloat(o),r=1):o.startsWith("to ")&&(n=l_(o),r=1);const l=[];for(let c=r;c({color:c.color,i:c.offset/100}));return{angle:n,colors:h}}function r_(e){const t=[];let i="",a=0;for(let s=0;s{Zt(f,h,o)}),Dn(e,l,c,d)}function Dn(e,t,i,a){let s=t_(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 pa(e,t,i){let a=[];t.calculative.gradientColorStop?a=t.calculative.gradientColorStop:(a=na(t.calculative.lineGradientColors).colors,t.calculative.gradientColorStop=a),e.strokeStyle=Dn(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 Hg(e,t){const i=t.calculative.worldAnchors;let a=t.calculative.lineWidth*(t.calculative.gradientSmooth||t.calculative.lineSmooth||0);for(let s=0;s0){let o=i[s-1].curvePoints;o?Sr(e,t,a,o[o.length-1],i[s],i[s].curvePoints[0]):Sr(e,t,a,i[s-1],i[s],i[s].curvePoints[0]);let l=ta(a,i[s],i[s].curvePoints[0]);pa(e,t,[l,i[s].curvePoints[1]])}else pa(e,t,[i[s],i[s].curvePoints[0]]),pa(e,t,[i[s].curvePoints[0],i[s].curvePoints[1]]);let n=i[s].curvePoints.length-1;for(let o=1;o0&&s0&&s0&&s0&&s{const D=t.calculative.textLineWidths[I];let V=0;k==="center"?V=(_-D)/2:k==="right"&&(V=_-D);const G=x+I*R+ed(e,S,R);t.letterSpacing?p_(e,S&&ke(S),p+V,G,t.calculative.letterSpacing):e.fillText(S&&ke(S),p+V,G);const{textDecorationColor:F,textDecorationDash:P,textDecoration:T}=t;T&&w_(e,{x:p+V,y:G,width:D},{textDecorationColor:F,textDecorationDash:P,fontSize:s});const{textStrickoutColor:L,textStrickoutDash:$,textStrickout:Z}=t;Z&&b_(e,{x:p+V,y:G,width:D},{textStrickoutColor:L,textStrickoutDash:$,fontSize:s})}),e.restore()}function ed(e,t,i){const a=e.measureText(t),{actualBoundingBoxAscent:s,actualBoundingBoxDescent:n}=a;return s||n?i/2+(s-n)/2:i*.55}function p_(e,t,i,a,s=0){if(s===0){e.fillText(t,i,a);return}let n=0;for(let r=0;r0?o=t.calculative.iconSize:a.width>a.height?o=a.height:o=a.width,e.font=Ie({fontSize:o,fontWeight:r,fontFamily:l});let h;t.calculative.iconType===Oi.Linear?h=s_(e,t):t.calculative.iconType===Oi.Radial&&(h=n_(e,t)),e.fillStyle=h||t.calculative.iconColor||zi(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 qg(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:o}=t.calculative.worldRect;e.save(),e.beginPath(),t.id===a?(e.moveTo(s+r-20*i,n+o/2+2*i),e.lineTo(s+r-14*i,n+o/2-4*i),e.lineTo(s+r-8*i,n+o/2+2*i)):(e.moveTo(s+r-20*i,n+o/2-4*i),e.lineTo(s+r-14*i,n+o/2+2*i),e.lineTo(s+r-8*i,n+o/2-4*i)),e.stroke(),e.restore()}function Ie({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 Ya(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 ia(e,t,i=!1){if(t.parentId&&t.rotateByRoot){let a=We(t,!0);if(a){const{x:s,y:n}=a.calculative.worldRect.pivot||a.calculative.worldRect.center;e.translate(s,n);let r=a.calculative.rotate*Math.PI/180;i||(a.calculative.flipX&&(r*=-1),a.calculative.flipY&&(r*=-1)),e.rotate(r),e.translate(-s,-n)}}else{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 Oa(e,t,i){var m;const a=t.calculative.canvas.store.options.debug,s=a===!0||typeof a=="object"&&!!a.renderTime,n=s?performance.now():0;e.save(),e.translate(.5,.5),e.beginPath(),j_(e,t);const r=t.calculative.canvas.store,o=t.textFlip||r.options.textFlip,l=t.textRotate||r.options.textRotate;(!o||!l)&&e.save(),Ya(e,t),(t.rotateByRoot||t.calculative.rotate&&t.name!==Zf)&&ia(e,t),(t.calculative.lineWidth>1||i)&&(e.lineWidth=t.calculative.lineWidth),z_(e,r,t);let h,c=!1,d;t.calculative.disabled?(d=t.disabledColor||r.styles.disabledColor||Ce(.4,t.calculative.color||r.styles.color),h=t.disabledBackground||r.styles.disabledBackground||Ce(.4,t.calculative.background||r.styles.penBackground)):t.mouseDownValid&&t.calculative.mouseDown?(d=t.mouseDownColor||Ce(-.4,t.calculative.color||r.styles.color),h=t.mouseDownBackground||Ce(-.4,t.calculative.background||r.styles.penBackground)):t.switch&&t.calculative.checked?t.calculative.bkType||(h=t.onBackground):t.calculative.hover?(d=t.hoverColor||r.styles.hoverColor,h=t.hoverBackground||r.styles.hoverBackground):t.calculative.active?(d=t.activeColor||r.styles.activeColor,h=t.activeBackground||r.styles.activeBackground):t.calculative.isDock&&(t.type===Ut.Line?d=r.styles.dockPenColor:h=eo(r.styles.dockPenColor,.2));const f=t.calculative.strokeImg;if(t.calculative.strokeImage&&f)e.strokeStyle=d||e.createPattern(f,ro);else{let y;t.calculative.strokeType?t.calculative.lineGradientColors?t.name===Zf?c=!0:t.calculative.lineGradient?y=t.calculative.lineGradient:(y=u_(e,t),t.calculative.lineGradient=y):y=m_(e,t):y=t.calculative.color||(t.type?r.data.lineColor:"")||r.styles.color,e.strokeStyle=d||y}const g=t.calculative.backgroundImg;if(t.calculative.backgroundImage&&g)e.fillStyle=h||e.createPattern(g,ro),h=!0;else{let y;const p=t.calculative.background||"";let x=t.calculative.bkType,_=t.calculative.gradientColors;x==null&&(typeof p=="string"&&p.startsWith("linear-gradient")?(_=_||p,x=Oi.Linear):!p&&_&&(x=Oi.Linear)),x===Oi.Linear?_?t.calculative.gradient?y=t.calculative.gradient:(y=Jf(e,t,_),t.calculative.gradient=y):y=J2(e,t):x===Oi.Radial?_?t.calculative.radialGradient?y=t.calculative.radialGradient:(y=e_(e,t,_),t.calculative.radialGradient=y):y=Q2(e,t):typeof p=="string"&&p.startsWith("linear-gradient")?t.calculative.gradient?y=t.calculative.gradient:(y=Jf(e,t,p),t.calculative.gradient=y):y=t.calculative.background||r.styles.penBackground,e.fillStyle=h||y,h=!!y}if(Yg(e,t),Kg(e,t),Ka(e,t),t.calculative.lineDash&&e.setLineDash(t.calculative.lineDash.map(y=>y*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),c?(Hg(e,t),Gg(!0,e,t,r)):(Xg(!0,e,t,r,h),a0(e,t)),!(t.image&&t.calculative.img)&&t.calculative.icon&&jg(e,t),t.dropdownList&&qg(e,t),(!o||!l)&&e.restore(),o&&!l&&Ya(e,t),!o&&l&&(t.rotateByRoot||t.calculative.rotate&&t.name!=="line")&&ia(e,t,!0),Vg(e,t),t.type===Ut.Line&&((m=t.fillTexts)==null?void 0:m.length)>0)for(const y of t.fillTexts)$g(e,t,y);e.restore(),s&&(t.calculative.debug||(t.calculative.debug={}),t.calculative.debug.renderTime=performance.now()-n)}function Yg(e,t){const i=t.lineCap||(t.type?"round":"square");i?e.lineCap=i:t.type&&(e.lineCap="round")}function Kg(e,t){const i=t.lineJoin;i?e.lineJoin=i:t.type&&(e.lineJoin="round")}function oo(e,t,i,a){var h,c;e.save(),i&&e.translate(-i.x,-i.y),(h=e.setAttrs)==null||h.call(e,t);let s=!1;const n=t.calculative.canvas.store,r=t.textFlip||n.options.textFlip,o=t.textRotate||n.options.textRotate;e.beginPath(),(!r||!o)&&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.rotateByRoot||t.calculative.rotate&&t.name!=="line")&&ia(e,t),(t.calculative.lineWidth>1||a)&&(e.lineWidth=t.calculative.lineWidth);let l;if(t.calculative.hover)e.strokeStyle=t.hoverColor||n.styles.hoverColor,e.fillStyle=t.hoverBackground||n.styles.hoverBackground,l=t.hoverBackground||n.styles.hoverBackground;else if(t.calculative.active)e.strokeStyle=t.activeColor||n.styles.activeColor,e.fillStyle=t.activeBackground||n.styles.activeBackground,l=t.activeBackground||n.styles.activeBackground;else{if(t.strokeImage)t.calculative.strokeImg&&(e.strokeStyle=e.createPattern(t.calculative.strokeImg,ro),l=!0);else{let d;t.calculative.strokeType&&t.calculative.lineGradientColors&&t.name==="line"?s=!0:d=t.calculative.color||n.styles.color,e.strokeStyle=d}t.backgroundImage?t.calculative.backgroundImg&&(e.fillStyle=e.createPattern(t.calculative.backgroundImg,ro),l=!0):(e.fillStyle=t.background,l=!!t.background)}if(Yg(e,t),Kg(e,t),Ka(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?(Hg(e,t),Gg(!0,e,t,n)):(Xg(!1,e,t,n,l),a0(e,t)),t.calculative.img?(e.save(),e.shadowColor="",e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0,Is(e,t),e.restore()):t.calculative.icon&&jg(e,t),t.dropdownList&&qg(e,t),(!r||!o)&&e.restore(),r&&!o&&(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&&o&&(t.rotateByRoot||t.calculative.rotate&&t.name!=="line")&&ia(e,t,!0),Vg(e,t),t.type===Ut.Line&&((c=t.fillTexts)==null?void 0:c.length)>0)for(const d of t.fillTexts)$g(e,t,d);e.restore()}function Xg(e=!0,t,i,a,s){if(i.name==="drawCommand")return;const n=e?a.path2dMap.get(i):wt.path2dDraws[i.name];let r=null,o=null;if(i.type===Ut.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",o=new Path2D,o.moveTo(i.calculative.worldAnchors[i.calculative.worldAnchors.length-1].x,i.calculative.worldAnchors[i.calculative.worldAnchors.length-1].y),o.lineTo(i.calculative.worldAnchors[i.calculative.worldAnchors.length-1].x,i.calculative.worldAnchors[i.calculative.worldAnchors.length-1].y))),n){if(i.type===Ut.Line&&i.borderWidth){t.save(),t.beginPath();const h=i.calculative.lineWidth+i.calculative.borderWidth;t.lineWidth=h,t.strokeStyle=i.borderColor,r&&(t.save(),t.lineCap=i.fromLineCap,t.stroke(r),t.restore()),n instanceof Path2D?(s&&t.fill(n),h&&t.stroke(n)):(n(i,t),s&&t.fill(),h&&t.stroke()),o&&(t.save(),t.lineCap=i.toLineCap,t.stroke(o),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 l=(i.calculative.progress-(i.calculative.min||0))/((i.calculative.max||1)-(i.calculative.min||0));if(l!=null&&!isNaN(l)){t.save();const{ex:h,x:c,y:d,width:f,height:g,ey:m}=i.calculative.worldRect;let y=null;if(i.calculative.verticalProgress?y=i.reverseProgress?t.createLinearGradient(c,d,c,d+g*l):t.createLinearGradient(c,m,c,d+g*(1-l)):y=i.reverseProgress?t.createLinearGradient(h,d,c+f*(1-l),d):t.createLinearGradient(c,d,c+f*l,d),i.calculative.progressGradientColors){const{colors:p}=na(i.calculative.progressGradientColors);p.forEach(x=>{y.addColorStop(x.i,x.color)})}else{const p=i.calculative.progressColor||i.calculative.color||a.options.activeColor||a.data.color;y.addColorStop(0,p),y.addColorStop(1,p)}y.addColorStop(1,"transparent"),t.fillStyle=y,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),o&&(t.save(),t.lineCap=i.toLineCap,t.stroke(o),t.restore())):(n(i,t),t.stroke())),i.type){if(i.calculative.animatePos){if(t.save(),Zg(t,i,a),i.lineAnimateType===ie.Arrow||i.lineAnimateType===ie.WaterDrop){let h=c0(i,t);h instanceof Path2D?(t.stroke(h),t.fill(h)):(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&&Mg(t,i,a),i.toArrow&&Lg(t,i,a),o0(t,i,a),i.calculative.active&&!i.calculative.pencil&&!a.options.disableAnchor&&!a.data.locked&&Jg(t,i)}}}function Gg(e=!0,t,i,a){const s=e?a.path2dMap.get(i):wt.path2dDraws[i.name];if(s&&i.type){if(i.calculative.animatePos){if(t.save(),Zg(t,i,a),t.beginPath(),s instanceof Path2D)if(i.lineAnimateType===ie.Arrow||i.lineAnimateType===ie.WaterDrop){const n=c0(i);t.stroke(n),t.fill(n)}else i.calculative.gradientSmooth||i.calculative.lineSmooth?(i.calculative.gradientAnimatePath||(i.calculative.gradientAnimatePath=Gc(i)),i.calculative.gradientAnimatePath instanceof Path2D&&t.stroke(i.calculative.gradientAnimatePath)):t.stroke(s);else s(i,t),t.stroke();t.restore()}i.fromArrow&&Mg(t,i,a),i.toArrow&&Lg(t,i,a),o0(t,i,a),i.calculative.active&&!i.calculative.pencil&&!a.options.disableAnchor&&!a.data.locked&&Jg(t,i)}}function Zg(e,t,i){e.strokeStyle=t.lineAnimateType===ie.Custom?t.animateColor||B2: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),Array.isArray(t.lineAnimateType)?t.lineAnimateType.forEach(a=>{id(t,i,a,e)}):id(t,i,t.lineAnimateType,e)}function id(e,t,i,a){var n,r,o;let s=0;switch(i){case ie.Breath:{const h=e.length>0?Math.max(0,Math.min(1,(e.calculative.animatePos||0)/e.length)):0,c=(1-Math.cos(2*Math.PI*h))/2,d=e.calculative.lineWidth,f=Math.max(d,((n=e.calculative.animateLineWidth)!=null?n:0)*t.data.scale);a.lineWidth=d+(f-d)*c,a.shadowBlur=e.animateShadow?Math.max(0,(r=e.animateShadowBlur)!=null?r:e.animateLineWidth||6)*c:0,a.lineDashOffset=0,a.setLineDash([]);break}case ie.Beads:e.animateReverse?a.lineDashOffset=e.calculative.animatePos:a.lineDashOffset=e.length-e.calculative.animatePos,s=e.calculative.lineWidth||5,s<5&&(s=5);const l=e.animateLineDash&&e.animateLineDash.map(h=>h*s/5);a.setLineDash(l||[s,s*2]);break;case ie.Dot:e.animateReverse?a.lineDashOffset=e.calculative.animatePos:a.lineDashOffset=e.length-e.calculative.animatePos,s=e.calculative.animateDotSize||e.calculative.lineWidth*2||6,s<6&&(s=6),s>40&&(s=40),a.lineWidth=(e.calculative.animateLineWidth||s)*t.data.scale,a.setLineDash([.1,e.length]);break;case ie.Arrow:a.fillStyle=e.animateColor||t.styles.animateColor,a.lineWidth=1;break;case ie.WaterDrop:a.fillStyle=e.animateColor||t.styles.animateColor,a.lineWidth=1;break;case ie.Custom:switch(e.lineAnimateTargetType){case Cs.Image:if((o=e.lineAnimateImages)!=null||(e.lineAnimateImages=[]),e.lineAnimateImages.length>0){const d=e.lineAnimateImages.map((f,g)=>{const m=wt.htmlElements[f];if(!m)e.calculative.canvas.__loadImage(f);else return m});Tr(a,e,"image",d)}break;case Cs.Icon:const h=e.lineAnimateIcon;Tr(a,e,"icon",h);break;case Cs.Pen:e.lineAnimatePens&&Tr(a,e,"pen",e.lineAnimatePens);break;case Cs.Element:const c=e.lineAnimateElement;Tr(a,e,"element",c)}break;default:e.animateReverse?(a.lineDashOffset=Number.EPSILON,a.setLineDash([0,e.length-e.calculative.animatePos+1,e.calculative.animatePos])):a.setLineDash([e.calculative.animatePos,e.length+.01-e.calculative.animatePos]);break}}function Tr(e,t,i,a){let s=null;switch(i){case"image":s=__(a);break;case"icon":s=A_(a);break;case"pen":let n=t.calculative.canvas.find(a);t.lineAnimateElementCount=n.length,s=E_(n);break;case"element":if(s=wt.lineAnimateDraws[a],!s)return;s=x_(s);break}k_(e,t,s)}function x_(e){return function(t,i,a,s){const n=i.calculative.canvas.store.data.scale;t.translate(a.x,a.y),t.rotate(a.rotate*Math.PI/180),t.scale(n,n),e(t,i,a,s)}}function __(e){return function(t,i,a,s){const n=i.calculative.canvas.store.data.scale,r=i.lineAnimateElementWidth||10,o=i.lineAnimateElementHeight||10,l=e[s%e.length];!l||(t.save(),t.translate(a.x,a.y),t.rotate(a.rotate*Math.PI/180),t.scale(n,n),t.drawImage(l,-r/2,-o/2,r,o),t.restore())}}function E_(e){return function(t,i,a,s){const n=e[s%e.length];if(!n)return;const r=i.calculative.canvas.store.data.scale,o=i.calculative.canvas.store.data.origin,l=i.calculative.canvas.parent,h=n.width,c=n.height,d=a.x-h/2,f=a.y-c/2,g=(d-o.x)/r,m=(f-o.y)/r,y=h/r,p=c/r,x={x:g,y:m,width:y,height:p,rotate:a.rotate};l.setValue({id:n.id,...x},{render:!1,doEvent:!1,history:!1})}}function A_(e){return function(t,i,a,s){const n=i.calculative.canvas.store.data.scale;t.beginPath(),t.translate(a.x,a.y),t.rotate(a.rotate*Math.PI/180),t.scale(n,n);const r=i.calculative.iconWeight;let o;const l=i.calculative.iconFamily;o=i.calculative.iconSize||Math.max(i.lineAnimateElementWidth||0,i.lineAnimateElementHeight||0)||10,t.font=Ie({fontSize:o,fontWeight:r,fontFamily:l}),t.fillStyle=i.calculative.iconColor||zi(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 k_(e,t,i){var n;const a=t.calculative.canvas.store.data.scale,s=uo(t)/a;if(t.lineAnimateLoopMode)C_(e,t,i,s,a);else{const r=Array.isArray(t.lineAnimateDash)?t.lineAnimateDash:((n=t.lineAnimateDash)==null?void 0:n.split(",").map(l=>Number(l)))||[10,20];F_(s,r,t.lineAnimateDashOffset,t.lineAnimateElementCount).forEach((l,h)=>{const c=kc(t,l.start);if(!!c)try{e.save(),i(e,t,c,h),e.restore()}catch(d){e.restore(),console.warn(d)}})}}function C_(e,t,i,a,s){var h;const r=((Array.isArray(t.lineAnimateDash)?t.lineAnimateDash:((h=t.lineAnimateDash)==null?void 0:h.split(",").map(c=>Number(c)))||[10,20])[0]||30)*s,o=t.calculative.animatePos,l=t.calculative.worldAnchors;if(l.length>1){let c,d=0;for(let f=0;f=0){const _=d+p,b=(o-_)/s;try{e.save();const k=kc(t,b);k&&i(e,t,k,x),e.restore()}catch(k){e.restore(),console.warn(k)}}p+=r,x++}d+=m}c=g}if(t.close){let f=l[0];if(c){const g=Math.sqrt((f.x-c.x)**2+(f.y-c.y)**2);let y=(o-d)%r-r,p=0;for(;y=0){const x=d+y,_=(o-x)/s;try{e.save();const b=kc(t,_);b&&i(e,t,b,p),e.restore()}catch(b){e.restore(),console.warn(b)}}y+=r,p++}}}}}function F_(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,d)=>c+d,0);let o=(-i+s)%r;o<0&&(o+=r);let l=0,h=0;for(a||(a=1/0);he&&(m=e),f&&m>g){const y=(g+s)%e,p=(m+s)%e;n.push({start:y,end:p,isDash:!0}),l+=1}if(h=m,o=0,h>=e||l>=a)break}return n}function kc(e,t=0){const i=e.calculative.worldAnchors;if(!i||i.length<2)return null;const a={x:i[0].x,y:i[0].y},s=h=>h&&{...h,x:h.x-a.x,y:h.y-a.y};let n,r=null;if(i.forEach(h=>{if(r){const c=s(r);c.next=s(r.next);const d=s(h);d.prev=s(h.prev),n=yd(n,c,c.next,d.prev,d)}r=h}),e.close){const h=i[0],c=s(r);c.next=s(r.next);const d=s(h);d.prev=s(h.prev),n=yd(n,c,c.next,d.prev,d)}let o=0;e.animateReverse?o=e.length-e.calculative.animatePos+t*e.calculative.canvas.store.data.scale:o=e.calculative.animatePos-t*e.calculative.canvas.store.data.scale;const l=r5(n,o);return l?(l.x+=a.x,l.y+=a.y,l):null}function Jg(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&&R_(e,a,t)}),e.restore()}function R_(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 Qg(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),te(i),e.pivot&&Rc(i,e.pivot);else{const a=t.pens[e.parentId];let s=a.calculative.worldRect;s||(s=Qg(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,te(i),e.pivot&&Rc(i,e.pivot)}return e.calculative.worldRect=i,Zc(e,i),i}function Zc(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 qr(e){const t=ot(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,wa(t,a))}function Bs(e){const t=e.calculative.canvas.store;let i=[];if(e.anchors){let a=ot(e.anchors);e.flipX&&e.name!=="line"&&a.forEach(s=>{s.x=.5-(s.x-.5)}),e.flipY&&e.name!=="line"&&a.forEach(s=>{s.y=.5-(s.y-.5)}),a.forEach(s=>{i.push(P_(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;for(let o=0;o{Zt(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 t0(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,te(s.calculative.initRect)),t0(s)})}}function P_(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 ad(e,t){if(!t.image&&!t.icon&&!t.thumbImg)return;const{paddingTop:i,paddingBottom:a,paddingLeft:s,paddingRight:n}=t.calculative;let r=s,o=i,l=t.calculative.worldRect.width-s-n,h=t.calculative.worldRect.height-i-a,c=t.calculative.iconLeft||0,d=t.calculative.iconTop||0;c&&Math.abs(c)<1&&(c=t.calculative.worldRect.width*c),d&&Math.abs(d)<1&&(d=t.calculative.worldRect.height*d),r+=c||0,o+=d||0,l-=c||0,h-=d||0;let f=t.calculative.iconRotate||0;if(t.parentId){const g=e[t.parentId].calculative;g&&(f+=g.rotate,f%=360)}r=t.calculative.worldRect.x+r,o=t.calculative.worldRect.y+o,t.calculative.worldIconRect={x:r,y:o,width:l,height:h,rotate:f},re(t.calculative.worldIconRect),te(t.calculative.worldIconRect)}function di(e,t,i){Ds(e.calculative.worldRect,t,i,e.pivot),e.calculative.initRect&&Ds(e.calculative.initRect,t,i,e.pivot),e.calculative.prevFrameRect&&Ds(e.calculative.prevFrameRect,t,i,e.pivot),e0(e,t,i),e.calculative.x&&Fs(e.calculative,t,i),e.type&&Bs(e)}function e0(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&&Ds(n.calculative.initRect,t,i),e0(n,t,i))})}function S_(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&&Zt(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 T_(e,t,i){e.anchors||(e.anchors=[]),e.calculative.worldAnchors||(e.calculative.worldAnchors=[]);const a=Q_(e,t,i);return e.calculative.worldAnchors.splice(i+1,0,a),e.anchors.splice(i+1,0,xn(a,e.calculative.worldRect)),e.calculative.activeAnchor=a,a}function I_(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 Ns(e,t){if(!t||!t.calculative||!t.calculative.worldRect.center)return Pt.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 u2(e,t.calculative.worldRect.center)}function Ps(e,t){let i=1/0,a;return e.calculative.worldAnchors.forEach(s=>{const n=wo(t,s);i>n&&(i=n,a=s)}),a}function sd(e,t,i){e.x+=t,e.y+=i,e.anchors&&e.anchors.forEach(a=>{bn(a,t,i)}),e.calculative.worldAnchors&&e.calculative.worldAnchors.forEach(a=>{bn(a,t,i)})}function Jc(e){if(e&&e.calculative&&e.calculative.worldAnchors.length){let t=jt(e);if(!e.anchors||!e.anchors.length)for(;e.calculative.worldAnchors.length&&t!==e.calculative.activeAnchor;)e.calculative.worldAnchors.pop(),t=jt(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 xe(e,t,i,a){var o,l,h,c,d,f;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 g=jt(i);if(a.id!==g.id)return}if(t.twoWay===Ae.Out){const g=ce(i);if(a.id!==g.id)return}if(a.connectTo===e.id&&a.anchorId===t.id)return;if(a.connectTo){const g=e.calculative.canvas.store.pens[a.connectTo];Ss(g,Na(g,a.anchorId),i,a)}e.connectedLines||(e.connectedLines=[]),e.connectedLines.findIndex(g=>g.lineId===i.id&&g.lineAnchor===a.id&&g.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&&xe(i,a,e,t),e.calculative.canvas.store.emitter.emit("connectLine",{line:i,lineAnchor:a,pen:e,anchor:t});let n=((o=i.calculative.worldAnchors)==null?void 0:o.length)>=2?(l=i.calculative.worldAnchors)==null?void 0:l[0].connectTo:void 0,r=((h=i.calculative.worldAnchors)==null?void 0:h.length)>=2?(d=i.calculative.canvas.store.pens[(c=i.calculative.worldAnchors)==null?void 0:c[0].connectTo])==null?void 0:d.anchors.find(g=>{var m;return g.id===((m=i.calculative.worldAnchors)==null?void 0:m[0].anchorId)}):void 0;return(f=e.onConnectLine)==null||f.call(e,e,{line:i,lineAnchor:a,pen:e,anchor:t,fromPen:n,fromAnchor:r}),!0}function Ss(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]=ot(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&&Ss(i,a,e,t),e.calculative.canvas.store.emitter.emit("disconnectLine",{line:i,lineAnchor:a,pen:e,anchor:t}),!0}function Na(e,t){var i;if(!(!e||!t))return(i=e.calculative.worldAnchors)==null?void 0:i.find(a=>a.id===t)}function ce(e){if(!(!e||!e.calculative.worldAnchors))return e.calculative.worldAnchors[0]}function jt(e){if(!(!e||!e.calculative.worldAnchors))return e.calculative.worldAnchors[e.calculative.worldAnchors.length-1]}function B_(e,t){var s,n;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 r of e.frames){e.calculative.duration+=r.duration;for(const o in r)o!=="duration"&&!e[o]&&o==="scale"&&(e[o]=1)}}if(e.animateCycle||(e.animateCycle=1/0),e.calculative.start){let r=0;const o=Math.ceil((t-e.calculative.start)/e.calculative.duration);if(o>e.animateCycle)return e.currentAnimation=void 0,e.calculative.start=void 0,rd(e,1),0;const l=(t-e.calculative.start)%e.calculative.duration||e.calculative.duration;let h=0;for(const f of e.frames)if(h+=f.duration,l>h)e.frames[r].switch||(e.calculative.prevFrameRect=ot(e.calculative.worldRect),e.frames[r].switch=!0),++r;else break;if(!e.frames[r])return!0;let c=!1;r!==e.calculative.frameIndex&&(c=!0,e.calculative.frameIndex=r,e.calculative.frameDuration=e.frames[r].duration,r>0&&(e.calculative.frameStart+=e.frames[r-1].duration),e.calculative.frameEnd=e.calculative.frameStart+e.calculative.frameDuration);let d=!1;if(o>e.calculative.cycleIndex&&(e.frames.forEach(f=>{f.switch=!1}),e.calculative.worldRect=ot(e.calculative.initRect),e.calculative.prevFrameRect=ot(e.calculative.initRect),e.calculative.cycleIndex=o,e.calculative.frameStart=e.calculative.start+e.calculative.duration*(o-1),d=!0),c||d)if(e.calculative.x=e.calculative.initRect.x,e.calculative.y=e.calculative.initRect.y,((n=e.children)==null?void 0:n.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,r>0){e.prevFrame={};const f=e.frames[r-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 nd(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=ot(e.calculative.worldRect),e.calculative.prevFrameRect=ot(e.calculative.worldRect),e.parentId&&(e.calculative.initRelativeRect={x:e.x,y:e.y,width:e.width,height:e.height}),(s=e.children)!=null&&s.length){const r=e.calculative.canvas.store;e.calculative.childrenVisible={},e.children.forEach(o=>{e.calculative.childrenVisible[o]=r.pens[o].visible})}e.calculative.initRect.rotate=e.calculative.rotate||0,nd(e)}const i=e.frames[e.calculative.frameIndex];let a=0;if(i.curveAnimate){const r=(t-e.calculative.frameStart)/e.calculative.frameDuration%1;let o=[];i.animateTimingFunction?o=Array.isArray(i.animateTimingFunction)?i.animateTimingFunction:i.animateTimingFunction.split(","):o=[.25,.25,.75,.75],a=Og(r,o[1],o[3])}else a=(t-e.calculative.frameStart)/e.calculative.frameDuration%1;return a>0&&rd(e,a),!0}function nd(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 rd(e,t){var s,n,r,o,l,h;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=ot(e.calculative.prevFrameRect),Ds(e.calculative.worldRect,e.prevFrame.scale,e.calculative.worldRect.center);const d=e.prevFrame.scale+(i[c]-e.prevFrame.scale)*t;Ds(e.calculative.worldRect,d/e.prevFrame.scale,e.calculative.worldRect.center),e.calculative.patchFlags=!0}else if(c==="x"){const d=cn(e,c,e.calculative.frameIndex)*a;e.calculative.worldRect.x=e.calculative.initRect.x+d,e.calculative.worldRect.ex=e.calculative.initRect.ex+d,e.calculative.worldRect.center.x=e.calculative.initRect.center.x+d,(s=e.calculative.worldRect.pivot)!=null&&s.x&&(e.calculative.worldRect.pivot.x=((n=e.calculative.initRect.pivot)==null?void 0:n.x)+d),Ua(e.calculative.worldRect,i[c]*t*a,0),e.calculative.patchFlags=!0}else if(c==="y"){const d=cn(e,c,e.calculative.frameIndex)*a;e.calculative.worldRect.y=e.calculative.initRect.y+d,e.calculative.worldRect.ey=e.calculative.initRect.ey+d,e.calculative.worldRect.center.y=e.calculative.initRect.center.y+d,(r=e.calculative.worldRect.pivot)!=null&&r.x&&(e.calculative.worldRect.pivot.y=((o=e.calculative.initRect.pivot)==null?void 0:o.y)+d),Ua(e.calculative.worldRect,0,i[c]*t*a),e.calculative.patchFlags=!0}else if(c==="width"){const d=cn(e,c,e.calculative.frameIndex)*a;e.calculative.worldRect.width=e.calculative.initRect.width+d,e.calculative.worldRect.ex=e.calculative.initRect.ex+d,e.calculative.worldRect.center.x=e.calculative.initRect.center.x+d;let f=i[c]*t*a;e.calculative.worldRect.width+=f,e.calculative.worldRect.ex+=f,e.calculative.worldRect.center.x+=f,e.calculative.patchFlags=!0}else if(c==="height"){const d=cn(e,c,e.calculative.frameIndex)*a;e.calculative.worldRect.height=e.calculative.initRect.height+d,e.calculative.worldRect.ey=e.calculative.initRect.ey+d,e.calculative.worldRect.center.y=e.calculative.initRect.center.y+d;let f=i[c]*t*a;e.calculative.worldRect.height+=f,e.calculative.worldRect.ey+=f,e.calculative.worldRect.center.y+=f,e.calculative.patchFlags=!0}else if(c==="rotate"){e.prevFrame[c]>=360&&(e.prevFrame[c]%=360);const d=cn(e,c,e.calculative.frameIndex),f=(e.calculative.initRect.rotate+d+i[c]*t)%360-(e.calculative.rotate||0);(l=e.children)!=null&&l.length?e.calculative.canvas.rotatePen(e,f,e.calculative.initRect):e.calculative.rotate=(e.calculative.initRect.rotate+d+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(D_(i[c],c,e)){e.prevFrame[c]==null&&(c==="globalAlpha"?e.prevFrame[c]=1:e.prevFrame[c]=0);const d=e.prevFrame[c]+(i[c]-e.prevFrame[c])*t;["lineWidth"].includes(c)?e.calculative[c]=Math.round(d*100)/100*a:e.calculative[c]=Math.round(d*100)/100}else{if(c==="visible"&&!e.calculative.image){if((h=e.children)!=null&&h.length){const f=Le(e,e.calculative.canvas.store);e.calculative.canvas.initImageCanvas(f)}}e.calculative[c]=i[c];const d={};d[c]=i[c],Qc(e,d)}c==="text"&&Ws(e)}}function D_(e,t,i){const a=["strokeType","bkType","showChild"];return typeof e=="number"&&i.linear!==!1&&!a.includes(t)}function M_(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=Og(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 ks(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,ks(s,t))})}function mn(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&&mn(i.pens[a],t)})}function Re(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",e.name==="iframe"?t.style.opacity=e.calculative.inView?"1":"0":t.style.display=e.calculative.inView!=!1?e.calculative.cssDisplay||"inline":"none",e.disableTransform||(!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===Bt.DisableEdit||e.locked===Bt.DisableMove||i.data.locked?(t.style.userSelect="initial",t.style.pointerEvents="initial",(e.name==="gif"||e.ignoreEvent)&&(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]}async function L_(e,t){if(!!t&&globalThis.html2canvas){const i=await globalThis.html2canvas(t);if(i){const a=new Image;a.src=i.toDataURL("image/png",.1),a.src.length>10&&(e.calculative.img=a)}}}function ec(e){return e.every(t=>t.locked)}function od(e){return e.every(t=>t.disableRotate)}function i0(e,t,i){var a;e.rotateByRoot||(e.name==="line"?(e.calculative.worldAnchors.forEach(s=>{Zt(s,t,i.center)}),O_(e),qr(e)):(e.calculative.rotate?e.calculative.rotate+=t:e.calculative.rotate=t,Zt(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];i0(n,t,i)}))}function O_(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=Fc(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),te(t),e.calculative.worldRect=t,Zc(e,t),Bi(e),e.calculative.worldAnchors&&(e.anchors=e.calculative.worldAnchors.map(n=>xn(n,e.calculative.worldRect)))}function ld(e){return e.every(t=>t.disableSize||t.pivot)}function cn(e,t,i){if(!e.frames||!t)return 0;let a=0;for(let s=0;s{const l=i.pens[o];l&&Di(l,!0)})),e.calculative.inView=!0,lo(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(o=>o.hasOwnProperty("visible")))):e.calculative.inView=!1,e.calculative.inView){const{x:o,y:l,width:h,height:c,rotate:d}=e.calculative.worldRect,f={x:o+i.data.x,y:l+i.data.y,width:h,height:c,rotate:d};re(f),ea(f,a)||(e.calculative.inView=!1)}i.data.locked&&e.calculative.inView&&(e.calculative.inView=N_(e,i.options.roles)),(r=e.calculative.singleton)!=null&&r.div&&Re(e,e.calculative.singleton.div)}function N_(e,t){var s;const i=new Set;let a=e;for(;a;){if(i.has(a))return!1;if(i.add(a),(s=a.roles)!=null&&s.length)return!!(t!=null&&t.some(n=>a.roles.includes(n)));if(!a.parentId)return!0;a=We(a,!1)}return!1}function z_(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 Ka(e,t){const i=t.calculative.globalAlpha;typeof i=="number"&&i<1&&!isNaN(i)&&(e.globalAlpha=i)}function a0(e,t){const i=W_(e,t)||wt.canvasDraws[t.name];i&&(e.save(),i(e,t),e.restore())}function W_(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,o)=>{const l=H_(o,s,r.x,r.y);try{if(l.c){if(l.c.startsWith("_")){const c=l.c.split("_")[1];return typeof l.v.value=="number"&&(l.v.value*=s.calculative.canvas.store.data.scale),(l.p||a)[c]=l.v.value,{x:r.x,y:r.y}}let h=[];for(const c in l.v)h.push(l.v[c]);return(l.p||a)[l.c](...h),{x:l.startX||l.v.x,y:l.startY||l.v.y}}return{x:r.x,y:r.y}}catch{}},{})}catch{}}),a.stroke()}}function H_(e,t,i,a){var n;const s={visio:$_,dxf:U_,canvas:V_};return((n=s[t.parseType])==null?void 0:n.call(s,e,t,i,a))||e}function U_(e,t,i,a){var c,d;const{x:s,y:n,width:r,height:o}=t.calculative.worldRect,{originWidth:l,originHeight:h}=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/l)+s,y:e.v.y*(o/h)+n}};case"lineTo":return{c:"lineTo",v:{x:e.v.x*(r/l)+s,y:e.v.y*(o/h)+n}};case"arc":return{c:"ellipse",v:{x:e.v.x*(r/l)+s,y:e.v.y*(o/h)+n,rx:e.v.xr*(r/l),ry:e.v.yr*(o/h),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/l)+s,y:e.v.y*(o/h)+n,rx:e.v.xr*(r/l),ry:e.v.yr*(o/h),rotation:e.v.rotation||0,startAngle:e.v.startAngle,endAngle:e.v.endAngle,a:(d=e.v.aclockwise)!=null?d:!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 f={c:e.c,v:{...e.v}};return f.v.x!==void 0&&(f.v.x=e.v.x*(r/l)+s),f.v.y!==void 0&&(f.v.y=e.v.y*(o/h)+n),f}}function V_(e,t,i,a){var c,d;const{x:s,y:n,width:r,height:o}=t.calculative.worldRect,{originWidth:l,originHeight:h}=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/l)+s,y:e.v.y*(o/h)+n}};case"lineTo":return{c:"lineTo",v:{x:e.v.x*(r/l)+s,y:e.v.y*(o/h)+n}};case"arc":return{c:"ellipse",v:{x:e.v.x*(r/l)+s,y:e.v.y*(o/h)+n,rx:e.v.xr*(r/l),ry:e.v.yr*(o/h),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/l)+s,y:e.v.y*(o/h)+n,rx:e.v.xr*(r/l),ry:e.v.yr*(o/h),rotation:e.v.rotation||0,startAngle:e.v.startAngle,endAngle:e.v.endAngle,a:(d=e.v.aclockwise)!=null?d:!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 f={c:e.c,v:{...e.v}};return f.v.x!==void 0&&(f.v.x=e.v.x*(r/l)+s),f.v.y!==void 0&&(f.v.y=e.v.y*(o/h)+n),f}}function $_(e,t,i,a){const{x:s,y:n,width:r,height:o}=t.calculative.worldRect,{width:l,height:h}=t.origin;switch(e.c){case"MoveTo":return{c:"moveTo",v:{x:+e.v.X*100*(r/l)+s,y:+e.v.Y*100*(o/h)+n}};case"RelMoveTo":return{c:"moveTo",v:{x:+e.v.X*l*(r/l)+s,y:+e.v.Y*h*(o/h)+n}};case"LineTo":return{c:"lineTo",v:{x:+e.v.X*100*(r/l)+s,y:+e.v.Y*100*(o/h)+n}};case"RelLineTo":return{c:"lineTo",v:{x:+e.v.X*l*(r/l)+s,y:+e.v.Y*h*(o/h)+n}};case"Ellipse":let c=e.v.X,d=e.v.Y,f=Math.abs(e.v.A-e.v.C),g=Math.abs(e.v.B-e.v.D);return{c:"ellipse",v:{x:c*100*(r/l)+s,y:d*100*(o/h)+n,radiuX:f*100*(r/l),radiuY:g*100*(o/h),rotation:0,startAngle:0,endAngle:Math.PI*2,anticlockwise:!0}};case"EllipticalArcTo":const m=e.v.X*100*(r/l)+s,y=e.v.Y*100*(o/h)+n,p=e.v.A*100*(r/l)+s,x=e.v.B*100*(o/h)+n;e.v.C;const _=e.v.D*(r/o)*(h/l),b=(m-i)*(x-a)-(y-a)*(p-i)>0,k=cd(i,a,m,y,p,x,_);return!e.orign&&(e.orign={}),!e.orign.startA&&(e.orign.startA=Ir(k.x0,k.y0,i,a)),!e.orign.endA&&(e.orign.endA=Ir(k.x0,k.y0,m,y)),{c:"ellipse",v:{centerX:k.x0,centerY:k.y0,radiuX:k.a,radiuY:k.b,rotation:0,startAngle:e.orign.startA,endAngle:e.orign.endA,anticlockwise:b},startX:m,startY:y};case"RelEllipticalArcTo":const R=e.v.X*l*(r/l)+s,S=e.v.Y*h*(o/h)+n,I=e.v.A*l*(r/l)+s,D=e.v.B*h*(o/h)+n;e.v.C;const V=e.v.D*(r/o)*(h/l),G=(R-i)*(D-a)-(S-a)*(I-i)>0,F=cd(i,a,R,S,I,D,V);return!e.orign&&(e.orign={}),!e.orign.startA&&(e.orign.startA=Ir(F.x0,F.y0,i,a)),!e.orign.endA&&(e.orign.endA=Ir(F.x0,F.y0,R,S)),{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:G},startX:R,startY:S};case"ArcTo":let P=e.v.X*100*r/l+s,T=e.v.Y*100*o/h+n,L=e.v.A*100*t.calculative.canvas.store.data.scale,$=(i+P)/2,Z=(a+T)/2,at=Math.sqrt((P-i)**2+(T-a)**2);if(Math.abs(L)<.001||at<.001)return{c:"lineTo",v:{x:P,y:T}};let q=at*at/(8*Math.abs(L))+Math.abs(L)/2,W=-(T-a)/at,j=(P-i)/at,K=q-Math.abs(L),U=$-Math.sign(L)*W*K,tt=Z-Math.sign(L)*j*K,st=Math.atan2(a-tt,i-U),it=Math.atan2(T-tt,P-U),ut=it-st;for(;ut>Math.PI;)ut-=2*Math.PI;for(;ut<-Math.PI;)ut+=2*Math.PI;let lt=L>0;return(lt&&ut>0||!lt&&ut<0)&&([st,it]=[it,st],lt=!lt),{c:"arc",v:{x:U,y:tt,radius:q,startAngle:st,endAngle:it,anticlockwise:lt},startX:P,startY:T};default:const ht=ot(e);return Object.entries(ht.v).forEach(([E,A])=>{var B,N;(B=E.endsWith)!=null&&B.call(E,"_x")?typeof A=="number"&&(ht.v[E]=A*(r/l)+s):(N=E.endsWith)!=null&&N.call(E,"_y")?typeof A=="number"&&(ht.v[E]=A*(o/h)+n):typeof A=="number"&&(ht.v[E]=A)}),ht}}function j_(e,t){e.filter=t.filter}function Qc(e,t){for(const i in t)Tg.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,Bi(e)):e.calculative[i]=t[i]),e.image&&e.name!=="gif"&&Sg.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=ot(t);e.calculative.childrenVisible&&e.calculative.childrenVisible[a]===!1&&delete s.visible;const n=e.calculative.canvas.store.pens[a];n&&Qc(n,s)})}}function cd(e,t,i,a,s,n,r){let o=(e-i)*(e+i)*(a-n)-(i-s)*(i+s)*(t-a)+r*r*(t-a)*(a-n)*(t-n),l=2*((e-i)*(a-n)-(i-s)*(t-a)),h=o/l,c=(e-i)*(i-s)*(e-s)+r*r*((i-s)*(t-a)*(t+a)-(e-i)*(a-n)*(a+n)),d=2*r*r*((i-s)*(t-a)-(e-i)*(a-n)),f=c/d,g=Math.sqrt(Math.pow(e-h,2)+Math.pow(r*(t-f),2)),m=g/r;return{x0:h,y0:f,a:g,b:m}}function Ir(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 hd(e,t,i){let a,s,n=1/0,r=1/0;const o=8;for(const l of e.data.pens){if(l.calculative.inView===!1)continue;th(l).forEach(c=>{if(c===t||c===i)return;let d=(l.calculative.worldRect.center.x-t.x)*(l.calculative.worldRect.center.x-t.x)+(l.calculative.worldRect.center.y-t.y)*(l.calculative.worldRect.center.y-t.y);const f=Math.abs(c.x-t.x);f>0&&f0&&g{n.x+=a.x,n.y+=a.y})):(te(t),s=[t.center,...aa(t)]),s0(e,s,t,!0)}function th(e){if(e.type){if(e.type===Ut.Line)return e.calculative.worldAnchors}else{const t=aa(e.calculative.worldRect);return te(e.calculative.worldRect),[...e.calculative.worldAnchors,...t,e.calculative.worldRect.center]}}function Y_(e,t,i,a){const s=aa(t);return s0(e,s,t)}function s0(e,t,i,a=!1){let s,n,r=1/0,o=1/0;const l=10,h=f5(i,l);return e.data.pens.forEach(c=>{const{inView:d,worldRect:f,active:g}=c.calculative;if(d===!1||!a&&g||u5(h,f)||c.type&&e.active.some(y=>n0(e,y,c)))return;const m=th(c);if(!!m)for(const y of m)for(const p of t){const x=y.x-p.x,_=y.y-p.y,b=Math.abs(x),k=Math.abs(_);i.center||(i.center={x:i.x+i.width/2,y:i.y+i.height/2}),bh.calculative.worldRect);const a=i.map(h=>h.x),s=i.map(h=>h.y),n=a.reduce((h,c)=>h+c,0)/a.length,r=s.reduce((h,c)=>h+c,0)/s.length,o=Math.sqrt(a.map(h=>Math.pow(h-n,2)).reduce((h,c)=>h+c,0)/a.length),l=Math.sqrt(s.map(h=>Math.pow(h-r,2)).reduce((h,c)=>h+c,0)/s.length);return e.filter(h=>{let c=h.calculative.worldRect;const d=(c.x-n)/o,f=(c.y-r)/l;return Math.sqrt(d*d+f*f)>t})}function ud(e){if(e.id=Tt(),Array.isArray(e.anchors))for(const t of e.anchors)e.type&&(t.id=Tt()),t.penId=e.id,t.prev&&(e.type&&(t.prev.id=Tt()),t.prev.penId=e.id),t.next&&(e.type&&(t.next.id=Tt()),t.next.penId=e.id)}function X_(){let e=null,t=new WeakMap;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,o=new Map;e.has(a)&&e.get(a)?r=e.get(a):(o.set(a,i[a]),e.set(a,r)),n?r.delete(s):r.add(s);let l=o.get(a),h=(...c)=>{l==null||l(...c),r.forEach(d=>{d(...c)})};i[a]=h}}let G_=X_();function Z_(e){return!e.name&&!e.install?(console.error("installPenPlugin Error: Validation Failed"),!1):!0}function J_(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},wo(t.calculative.activeAnchor.next,t.calculative.activeAnchor)<5?t.calculative.activeAnchor.next=void 0:(t.calculative.activeAnchor.prev={...t.calculative.activeAnchor.next},Zt(t.calculative.activeAnchor.prev,180,t.calculative.activeAnchor)));else{const a=t.calculative.worldAnchors[0];if(!a.next){const n=Ns(a,e.pens[a.connectTo]);fd(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=Ns(s,e.pens[s.connectTo]);fd(s,n,-50),s.next=void 0}}}function fd(e,t,i){switch(t){case Pt.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 Pt.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 Pt.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 Pt.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 Ha(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 co(e,t,i,a,s){const{x:n,y:r}=t,{x:o,y:l}=s,{x:h,y:c}=i,{x:d,y:f}=a,g=1-e,m=n*g*g*g+3*h*e*g*g+3*d*e*e*g+o*e*e*e,y=r*g*g*g+3*c*e*g*g+3*f*e*e*g+l*e*e*e;return{x:m,y,step:e}}function ma(e,t,i){return{x:e.x+i*(t.x-e.x),y:e.y+i*(t.y-e.y)}}function Q_(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 o=a,l=a.next,h=s.prev,c=s,d=ma(o,l,n),f=ma(l,h,n),g=ma(h,c,n),m=ma(d,f,n),y=ma(f,g,n);r=ma(m,y,n),m.penId=e.id,r.prev=m,y.penId=e.id,r.next=y,a.next.x=d.x,a.next.y=d.y,s.prev.x=g.x,s.prev.y=g.y}else if(a.next||s.prev){const o=a,l=a.next||s.prev,h=s,c=ma(o,l,n),d=ma(l,h,n);r=t,c.penId=e.id,d.penId=e.id,r.prev=c,r.next=d,a.next=void 0,s.prev=void 0}else r=t;return r.penId=e.id,r.id=Tt(),r.prevNextType=qa.Bilateral,r}function t5(e,t,i){if(t.calculative.worldAnchors||(t.calculative.worldAnchors=[]),t.calculative.worldAnchors.length<2)return;let a=t.calculative.activeAnchor,s=i||jt(t);if(!a||!s)return;const n=20,r=e.pens[a.connectTo];let o=Ns(a,r);switch(o===Pt.None&&(s.x>a.x?o=Pt.Right:o=Pt.Left),a.next={id:Tt(),penId:t.id,x:a.x,y:a.y,prevNextType:2},s.prev={id:Tt(),penId:t.id,x:s.x,y:s.y,prevNextType:2},o){case Pt.Up:a.next.y-=n,s.prev.y=a.y;break;case Pt.Bottom:a.next.y+=n,s.prev.y=a.y;break;case Pt.Left:a.next.x-=n,s.prev.x=a.x;break;default:a.next.x+=n,s.prev.x=a.x;break}}function e5(e,t){const i=t||new Path2D;if((e.lineName==="line"||e.lineName==="polyline")&&e.calculative.lineSmooth){let s=Gc(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?dd(i,s,n):n.start=!0,s=n}),e.close&&(e.lineName==="curve"?dd(i,s,a[0]):i.closePath())}if(i instanceof Path2D)return i}function i5(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=ce(t),s=jt(t);!a||!s||!s.id||a===s||(a.next=void 0,Jc(t),s.prev=void 0,t.calculative.worldAnchors.push(s))}function dd(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 Fc(e){return uo(e),Mn(eh(e))}function eh(e){const t=[];let i;return e.calculative.worldAnchors.forEach(a=>{i&&t.push(...gd(i,a,e)),t.push(a),i=a}),e.close&&e.calculative.worldAnchors.length>1&&t.push(...gd(i,e.calculative.worldAnchors[0],e)),t}function ho(e){return e!=null&&e.lineWidth?e.lineWidth/2+4:4}function gd(e,t,i){const a=[];if(!t)return a;let s=.02;if(e.lineLength&&!i.parentId&&(s=ho(i)/e.lineLength),e.next)if(t.prev)for(let n=s;n<1;n+=s)a.push(co(n,e,e.next,t.prev,t));else for(let n=s;n<1;n+=s)a.push(Ha(n,e,e.next,t));else if(t.prev)for(let n=s;n<1;n+=s)a.push(Ha(n,e,t.prev,t));else a.push({x:t.x,y:t.y});return a.length>1&&(e.curvePoints=a),a}function a5(e,t){const i=ho(t);let a=0,s,n;for(const r of t.calculative.worldAnchors){if(s){if(n=vd(e,s,r,i),n)return{i:a,point:n};++a}s=r}if(t.close&&t.calculative.worldAnchors.length>1&&(n=vd(e,s,t.calculative.worldAnchors[0],i)))return{i:a,point:n}}function vd(e,t,i,a=4){if(!t.next&&!i.prev){const{x:s,y:n}=t,{x:r,y:o}=i,l=Math.min(s,r),h=Math.max(s,r),c=Math.min(n,o),d=Math.max(n,o);return e.x>=l-a&&e.x<=h+a&&e.y>=c-a&&e.y<=d+a?s5(e,t,i,a):void 0}else if(t.curvePoints){for(const s of t.curvePoints)if(As(e,s,a))return s}}function s5(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 l=(e.x+s*e.y-s*n)/(s*s+1);return{x:l,y:s*l+n}}}}function md(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 uo(e){if(e.calculative.worldAnchors.length<2)return 0;let t=0,i;if(e.calculative.worldAnchors.forEach(a=>{i&&(i.lineLength=md(i,i.next,a.prev,a),t+=i.lineLength),i=a}),e.close){const a=ce(e);i.lineLength=md(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 ic(e,t){const i=e.calculative.worldAnchors;for(let a=0;a=0&&d*h+f*c+g<=0||d*o+f*l+g<=0&&d*h+f*c+g>=0||d*o+f*c+g>=0&&d*h+f*l+g<=0||d*o+f*c+g<=0&&d*h+f*l+g>=0){if(o>h){const m=o;o=h,h=m}if(lh&&n>h||s>l&&r>l||si)return null;const a=Math.max(.01,i*1e-4),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}}function o5(e){const t=e.lineAnimateType;return t==null?!1:(Array.isArray(t)?t:[t]).some(a=>a===ie.Arrow||a===ie.WaterDrop)}function l5(e,t,i){e.beginPath(),e.moveTo(0,0),e.lineTo(-t,-i),e.moveTo(0,0),e.lineTo(-t,i),e.stroke()}function c5(e,t,i,a,s,n){e.save(),e.translate(t,i),e.rotate(a),l5(e,s,n),e.restore()}function pd(e,t,i){let a=0,s=t.length-1;for(;s-a>1;){const g=a+s>>1;t[g]<=i?a=g:s=g}const n=a,r=e[n],o=e[n+1],l=t[n+1]-t[n],h=l>1e-6?(i-t[n])/l:0,c=r.x+h*(o.x-r.x),d=r.y+h*(o.y-r.y),f=Math.atan2(o.y-r.y,o.x-r.x);return{x:c,y:d,ang:f}}function o0(e,t,i){var y,p,x,_,b,k;if(t.type!==Ut.Line||!(t.dirMarkers||i.options.dirMarkers)||t.calculative.pencil)return;const s=t.calculative.worldAnchors;if(!s||s.length<2||t.calculative.animatePos&&o5(t))return;const n=i.options.drawDirMarkers;e.save(),e.setLineDash([]),e.shadowBlur=0,e.shadowColor="",e.shadowOffsetX=0,e.shadowOffsetY=0;const r=eh(t);if(r.length<2){e.restore();return}const o=i.data.scale,l=((p=(y=t.dirMarkerInterval)!=null?y:i.options.dirMarkerInterval)!=null?p:40)*o,h=(_=(x=t.dirMarkerColor)!=null?x:i.options.dirMarkerColor)!=null?_:"#ffffff",c=t.calculative.lineWidth||2,d=((b=t.dirMarkerLineWidth)!=null?b:i.options.dirMarkerLineWidth)!=null?((k=t.dirMarkerLineWidth)!=null?k:i.options.dirMarkerLineWidth)*o:Math.min(c*.38,Math.max(.75,c*.14)),f=[0];let g=0;for(let R=0;Rt.x&&e.xt.y&&e.y{Zt(a,t.rotate,t.pivot||t.center)}),h5(e,i)}function Xa(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 te(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 Rc(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 h5(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 Ei(e){const t=[];e.forEach(a=>{if(a.isRuleLine)return;const s=a.calculative.worldRect;if(s){const n=aa(s);t.push(...n)}});const i=Mn(t);return te(i),i}function aa(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||te(e),t.forEach(i=>{Zt(i,e.rotate,e.pivot||e.center)})),t}function Mn(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 ea(e,t,i){return e.rotate&&(e=Mn(aa(e))),i?e.x>t.x&&e.ext.y&&e.eyt.ex||e.ext.ey)}function u5(e,t){return(t.x>e.ex||t.exe.ey||t.eye.y!=l>e.y&&e.x<(o-n)*(e.y-r)/(l-r)+n&&(i=!i)}return i}const m5=/^[\t\n\f\r ]*([MLHVZCSQTAmlhvzcsqta])[\t\n\f\r ]*/,bd=/^[01]/,Qt=/^[+-]?(([0-9]*\.[0-9]+)|([0-9]+\.)|([0-9]+))([eE][+-]?[0-9]+)?/,y5=/^(([\t\n\f\r ]+,?[\t\n\f\r ]*)|(,[\t\n\f\r ]*))/,p5={M:[Qt,Qt],L:[Qt,Qt],H:[Qt],V:[Qt],Z:[],C:[Qt,Qt,Qt,Qt,Qt,Qt],S:[Qt,Qt,Qt,Qt],Q:[Qt,Qt,Qt,Qt],T:[Qt,Qt],A:[Qt,Qt,Qt,bd,bd,Qt,Qt]};function w5(e){let t=0;const i=[];for(;t{n.worldPoints.forEach((r,o)=>{o%2===0?(ra&&(a=r)):(rs&&(s=r))})}),{x:t,y:i,ex:a,ey:s,width:a-t+1,height:s-i+1}}function b5(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 x5(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,o=Math.cos(r),l=Math.sin(r),h=n*n*i*i*o*o+s*s*i*i*l*l,c=2*t*i*o*l*(n*n-s*s),d=s*s*t*t*o*o+n*n*t*t*l*l,f=-(s*s*n*n*t*t*i*i),g=c*c-4*h*d,m=Math.sqrt((h-d)*(h-d)+c*c);a.values[2]=c!==0?Math.atan((d-h-m)/c)*180/Math.PI:h=0?a.values[4]:1-a.values[4];break;case"V":case"v":a.values[0]*=i;break;default:a.values.forEach((y,p)=>{a.values[p]=y*(p%2===0?t:i)});break}})}function _5(e){let t="";return e.commands.forEach(i=>{t+=i.key+" ",i.values.forEach(a=>{t+=a+" "})}),t}function E5(e,t,i){const a=p5[e.toUpperCase()],s=[];for(;i<=t.length;){const n={key:e,values:[]};for(const r of a){const o=t.slice(i).match(r);if(o!==null){n.values.push(+o[0]),i+=o[0].length;const l=t.slice(i).match(y5);l!==null&&(i+=l[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 A5(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;s1){const $=Math.sqrt(b);s*=$,n*=$,y=s*s,p=n*n}const k=Math.sqrt(Math.max(0,(y*p-y*_-p*x)/(y*_+p*x))),R=o===l?-k:k,S=R*s*m/n,I=-R*n*g/s,D=h*S-c*I+(e+i)/2,V=c*S+h*I+(t+a)/2;let G=Math.atan2(m-I,g-S),P=Math.atan2(-m-I,-g-S)-G;l===0&&P>0?P-=2*Math.PI:l===1&&P<0&&(P+=2*Math.PI);const T=[e,t];function L($){const Z=G+P;let at=$;const q=2*Math.PI,W=Math.floor((G-at)/q);at+=W*q;const j=1e-10;let K;if(P>0?(K=at>=G-j&&at<=Z+j||at+q>=G-j&&at+q<=Z+j,at+q>=G-j&&at+q<=Z+j&&(at+=q)):(K=at<=G+j&&at>=Z-j||at-q<=G+j&&at-q>=Z-j,at-q<=G+j&&at-q>=Z-j&&(at-=q)),K){const U=Math.cos(at),tt=Math.sin(at);T.push(D+s*U*h-n*tt*c),T.push(V+s*U*c+n*tt*h)}}if(Math.abs(h)>1e-10){const $=Math.atan(-n*c/(s*h));L($),L($+Math.PI)}else L(Math.PI/2),L(3*Math.PI/2);if(Math.abs(c)>1e-10){const $=Math.atan(n*h/(s*c));L($),L($+Math.PI)}else L(Math.PI/2),L(3*Math.PI/2);return T.push(i,a),T}function k5(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=_d(t.worldPoints[t.worldPoints.length-2],t.worldPoints[t.worldPoints.length-1],s.values[5],s.values[6],s.values[0],s.values[1],s.values[2]*Math.PI/180,s.values[3],s.values[4]);break;case"a":s.worldPoints=_d(t.worldPoints[t.worldPoints.length-2],t.worldPoints[t.worldPoints.length-1],t.worldPoints[t.worldPoints.length-2]+s.values[5],t.worldPoints[t.worldPoints.length-1]+s.values[6],s.values[0],s.values[1],s.values[2]*Math.PI/180,s.values[3],s.values[4]);break;default:A5(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 C5(e,t){var l;const a=e.calculative.canvas.store.data.paths[e.pathId];if(!a)return new Path2D;const s=w5(a);e.calculative.svgRect=xd(s),te(e.calculative.svgRect),(e.calculative.svgRect.width!==e.calculative.worldRect.width||e.calculative.svgRect.height!==e.calculative.worldRect.height)&&x5(s,e.calculative.worldRect.width/e.calculative.svgRect.width,e.calculative.worldRect.height/e.calculative.svgRect.height);const n=xd(s);te(n),b5(s,e.calculative.worldRect.x-n.x,e.calculative.worldRect.y-n.y);const r=_5(s);if(t){(l=t.svgPath)==null||l.call(t,r);return}return new Path2D(r)}function F5(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 R5(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 P5(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 S5(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 T5(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 I5(e,t){e.onResize||(e.onResize=B5);const i=t||new Path2D,{width:a,height:s,center:n}=e.calculative.worldRect,r=a>s?s:a,o=n.x,l=n.y,h=l-r/2,c=l-r/4,d=-(c-l)*Math.sin(Math.PI/180*324)+o,f=(c-l)*Math.cos(Math.PI/180*324)+l;i.moveTo(d,f);for(let g=0;g<5;++g)i.lineTo(-(h-l)*Math.sin(Math.PI/180*72*g)+o,(h-l)*Math.cos(Math.PI/180*72*g)+l),i.lineTo((d-o)*Math.cos(Math.PI/180*72*(g+1))-(f-l)*Math.sin(Math.PI/180*72*(g+1))+o,(d-o)*Math.sin(Math.PI/180*72*(g+1))+(f-l)*Math.cos(Math.PI/180*72*(g+1))+l);if(i.closePath(),i instanceof Path2D)return i}function l0(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 B5(e){const t=e.anchors.filter(i=>i.flag!==1);l0(e),e.anchors=e.anchors.concat(...t)}function D5(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 M5(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 L5(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 O5(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 N5(e,t){const i=t||new Path2D,{x:a,y:s,width:n,height:r,ey:o}=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,o),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 z5(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 W5(e,t){const i=t||new Path2D,{x:a,y:s,width:n,ex:r,ey:o}=e.calculative.worldRect,l=n/6;if(i.moveTo(a,s),i.lineTo(r-l,s),i.lineTo(r,s+l),i.lineTo(r,o),i.lineTo(a,o),i.closePath(),i.moveTo(r-l,s),i.lineTo(r-l,s+l),i.lineTo(r,s+l),i.closePath(),i instanceof Path2D)return i}function H5(e,t){const{x:i,y:a,width:s,ex:n,ey:r}=t.calculative.worldRect;let o=s*.25;const l=t.z;l>1?o=l*t.calculative.canvas.store.data.scale:l>0&&(o=s*l);const h={x:i,y:a+o},c={x:n-o,y:a+o},d={x:n-o,y:r};ac(e,[h,c,d,{x:i,y:r}],t.backgroundFront||t.background,t.color),ac(e,[h,{x:i+o,y:a},{x:n,y:a},c],t.backgroundUp||t.background,t.color),ac(e,[c,{x:n,y:a},{x:n,y:r-o},d],t.backgroundRight||t.background,t.color)}function ac(e,t,i="",a=""){e.save(),i&&(e.fillStyle=i),a&&(e.strokeStyle=a),e.beginPath();for(let s=0;sg.y&&a.yg.y))){m=f;let p=qe;a.x{p.id=Tt(),p.penId=t.id,t.calculative.worldAnchors.push(p)}),t.calculative.worldAnchors.push(s),m&&t.calculative.worldAnchors.push(m),f&&t.calculative.worldAnchors.push(g),n&&t.calculative.worldAnchors.reverse(),r){const p=t.calculative.worldAnchors.length-2;t.calculative.worldAnchors[p].isTemp=!1,t.calculative.worldAnchors[1].isTemp=!1}}function Ed(e,t,i){const a={x:e.x,y:e.y,id:Tt()};switch(t){case Pt.Up:a.y-=i;break;case Pt.Right:a.x+=i;break;case Pt.Bottom:a.y+=i;break;case Pt.Left:a.x-=i;break;default:return}return a}function $5(e,t,i){if(e.x===t.x||e.y===t.y)return[];const a=[];let s,n;switch(i){case Pt.Up:e.ye.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 Pt.Right:s=t.x,n=e.y,t.xe.x&&t.ye.y-qe)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+qe)/2;a.push({x:e.x,y:r},{x:t.x,y:r})}break}return a}function j5(e,t,i){if(e.x===t.x||e.y===t.y)return[];const a=[];let s,n;switch(i){case Pt.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 Pt.Bottom:s=e.x,n=t.y,t.x>e.x&&t.ye.y&&(s=e.x,n=t.y),a.push({x:s,y:n});break;case Pt.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 Pt.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.ye.y&&(s=t.x,n=e.y),a.push({x:s,y:n});break;case Pt.Bottom:s=e.x,n=t.y,t.xe.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 Pt.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.xMath.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){a.unshift(r)}));for(let r=0;r{a.unshift(r)}));for(let r=0;rl.id===t.id),s=ce(e),n=jt(e);let r=e.calculative.worldAnchors[a-1],o=e.calculative.worldAnchors[a+1];if(e.calculative.h==null&&(s.connectTo&&(Br(e,t,!0)?e.calculative.h=!0:Dr(e,t,!0)&&(e.calculative.h=!1)),e.calculative.h==null&&n.connectTo&&(Br(e,t,!1)?e.calculative.h=!0:Dr(e,t,!1)&&(e.calculative.h=!1)),e.calculative.h==null&&(r?e.calculative.h=r.y===t.y:o&&(e.calculative.h=o.y===t.y))),e.calculative.h){if(t.x=i.x,s.connectTo&&Br(e,t,!0)){o&&o.y!==t.y&&(o.x=t.x);return}if(n.connectTo&&Br(e,t,!1)){r&&r.y!==t.y&&(r.x=t.x);return}const l=e.anchors[a];let h;for(let c=a-1;c>-1;c--)if(r=e.anchors[c],h==null&&(h=r.y===l.y),h===!0)if(r.y===l.y)e.calculative.worldAnchors[c].y=i.y;else break;else if(r.x===l.x)e.calculative.worldAnchors[c].x=i.x;else break;h=void 0;for(let c=a+1;c-1;c--)if(r=e.anchors[c],h==null&&(h=r.x===l.x),h===!0)if(r.x===l.x)e.calculative.worldAnchors[c].x=i.x;else break;else if(r.y===l.y)e.calculative.worldAnchors[c].y=i.y;else break;h=void 0;for(let c=a+1;c1?(h=y.x-m.x,c=y.y-m.y):p>0?(h=y.x-(o+d*p),c=y.y-(l+f*p)):(h=y.x-o,c=y.y-l)):(h=y.x-o,c=y.y-l),x=h*h+c*c,x>n&&(r=b,n=x);return n>t&&(r-i>1&&s.push(...Sc(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(...Sc(e,t,r,a))),s}function G5(e,t=.8,i=!1){if(e.length<3)return e;let a,s,n,r,o,l,h,c,d,f,g,m,y,p,x;const _=(b,k,R,S)=>(r=Math.sqrt(b*b+k*k),r>0?(m=b/r,p=k/r):(m=1,p=0),o=Math.sqrt(R*R+S*S),o>0?(y=R/o,x=S/o):(y=1,x=0),Math.acos(m*y+p*x));f=[],g=e.length,a=e[0],e[g-1],f.push({...e[0]});for(let b=0;b1){let c,d=0;if(e.close&&(a=ot(a),a.push(a[0])),["polyline","line"].includes(e.lineName))for(let f=0;fr)&&p>l+r&&x-p>l&&(e.lineAnimateType===ie.Arrow?un(i,y,n,m,h,r):e.lineAnimateType===ie.WaterDrop&&fn(i,y,e.animateReverse,m,h,r)),y.x+=o*Math.cos(m*Math.PI/180),y.y-=o*Math.sin(m*Math.PI/180),p=Math.sqrt((y.x-c.x)**2+(y.y-c.y)**2)}c=g}else{let f,g=e.calculative.animatePos%o/o;g>1&&(g=1),e.animateReverse&&(g=1-g);let m=1/(a[0].lineLength/o),y=g*m,p;a.forEach(x=>{let _=x;if(f)if(m=1/(f.lineLength/o),f.next)if(_.prev)for(p=y;p<1;p+=m){let b=co(p,f,f.next,_.prev,_),k=co(p+.001,f,f.next,_.prev,_),R=hn(b,k);e.lineAnimateType===ie.Arrow?un(i,b,n,R,h,r):e.lineAnimateType===ie.WaterDrop&&fn(i,b,e.animateReverse,R,h,r)}else for(p=y;p<1;p+=m){let b=Ha(p,f,f.next,_),k=Ha(p+.001,f,f.next,_),R=hn(b,k);e.lineAnimateType===ie.Arrow?un(i,b,n,R,h,r):e.lineAnimateType===ie.WaterDrop&&fn(i,b,e.animateReverse,R,h,r)}else if(_.prev)for(p=y;p<1;p+=m){let b=Ha(p,f,_.prev,_),k=Ha(p+.001,f,_.prev,_),R=hn(b,k);e.lineAnimateType===ie.Arrow?un(i,b,n,R,h,r):e.lineAnimateType===ie.WaterDrop&&fn(i,b,e.animateReverse,R,h,r)}else{let b=hn(f,_);for(p=y;p<1;p+=m){let k={x:f.x+(_.x-f.x)*p,y:f.y+(_.y-f.y)*p};e.lineAnimateType===ie.Arrow?un(i,k,n,b,h,r):e.lineAnimateType===ie.WaterDrop&&fn(i,k,e.animateReverse,b,h,r)}}f=x,p?y=p-1:p=y})}}if(i instanceof Path2D)return i}function hn(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 _a(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 un(e,t,i,a,s,n){let r=_a({x:t.x+i,y:t.y+.57*i},{x:t.x,y:t.y},a),o=_a({x:t.x+i,y:t.y-.57*i},{x:t.x,y:t.y},a),l=_a({x:t.x+i,y:t.y+s/2},{x:t.x,y:t.y},a),h=_a({x:t.x+n,y:t.y+s/2},{x:t.x,y:t.y},a),c=_a({x:t.x+i,y:t.y-s/2},{x:t.x,y:t.y},a),d=_a({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(o.x,o.y),e.lineTo(c.x,c.y),e.lineTo(d.x,d.y),e.lineTo(h.x,h.y),e.lineTo(l.x,l.y),e.lineTo(r.x,r.y)}function fn(e,t,i,a,s,n){let r=s/2;i&&(r=-s/2);let o=_a({x:t.x,y:t.y+r},{x:t.x,y:t.y},a),l=_a({x:t.x+n,y:t.y},{x:t.x,y:t.y},a),h=Math.PI/2;i&&(h=-Math.PI/2),e.moveTo(t.x,t.y),e.arc(t.x,t.y,s/2,-h-a/180*Math.PI,h-a/180*Math.PI,!1),e.lineTo(l.x,l.y),e.lineTo(o.x,o.y)}function h0(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 Z5(e){for(;e.childNodes.length>1;)e.removeChild(e.lastChild)}function xo(e){if(!h0(e.operationalRect))return;const t=e.calculative.singleton.div;if(!t)return;t.childNodes.length>1&&Z5(t);const i=navigator.userAgent.indexOf("Linux")>-1,a=document.createElement("div");a.style.position="absolute",a.style.left=e.operationalRect.x*100+"%",a.style.top="0px",a.style.width=e.operationalRect.width*100+"%",a.style.height=e.operationalRect.y*100+"%",!i&&e.blur&&(a.style["backdrop-filter"]=`blur(${e.blur}px)`),a.style.backgroundColor=e.blurBackground,t.appendChild(a);const s=document.createElement("div");s.style.position="absolute",s.style.right="0px",s.style.top="0px",s.style.width=(1-e.operationalRect.x-e.operationalRect.width)*100+"%",s.style.height="100%",!i&&e.blur&&(s.style["backdrop-filter"]=`blur(${e.blur}px)`),s.style.backgroundColor=e.blurBackground,t.appendChild(s);const n=document.createElement("div");n.style.position="absolute",n.style.left=e.operationalRect.x*100+"%",n.style.bottom="0px",n.style.width=e.operationalRect.width*100+"%",n.style.height=(1-e.operationalRect.y-e.operationalRect.height)*100+"%",!i&&e.blur&&(n.style["backdrop-filter"]=`blur(${e.blur}px)`),n.style.backgroundColor=e.blurBackground,t.appendChild(n);const r=document.createElement("div");r.style.position="absolute",r.style.left="0px",r.style.top="0px",r.style.width=e.operationalRect.x*100+"%",r.style.height="100%",!i&&e.blur&&(r.style["backdrop-filter"]=`blur(${e.blur}px)`),r.style.backgroundColor=e.blurBackground,t.appendChild(r);let o=()=>{ih(e)};a.onmouseenter=o,n.onmouseenter=o,s.onmouseenter=o,r.onmouseenter=o,t.onmouseleave=o}function J5(e){const t=e.calculative.singleton.div.children;t[1].style.height=e.operationalRect.y*100+"%",t[1].style.left=e.operationalRect.x*100+"%",t[1].style.width=e.operationalRect.width*100+"%",t[2].style.width=(1-e.operationalRect.x-e.operationalRect.width)*100+"%",t[3].style.height=(1-e.operationalRect.y-e.operationalRect.height)*100+"%",t[3].style.left=e.operationalRect.x*100+"%",t[3].style.width=e.operationalRect.width*100+"%",t[4].style.width=e.operationalRect.x*100+"%"}function ih(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 u0(e,t){if(!(!e.calculative.canvas.store.data.locked&&!e.locked)&&h0(e.operationalRect)&&e.calculative.zIndex<5&&t.x>e.x+e.width*e.operationalRect.x&&t.xe.y+e.height*e.operationalRect.y&&t.ya.name=="iframe"&&_o(a.iframe)==i)||((t=sa[i])==null||t.remove(),delete sa[i])}function eE(e){const t=_o(e.iframe),i=sa[t];return i?(e.calculative.singleton.div=i,e.calculative.iframeKey=t,xo(e),!0):!1}function iE(e){var i;e.onDestroy||(e.onDestroy=aE,e.onMove=Mr,e.onResize=Mr,e.onRotate=Mr,e.onValue=Mr,e.onMouseMove=u0,e.onBeforeValue=sE,e.onRenderPenRaw=nE),e.calculative.singleton||(e.calculative.singleton={});const t=e.calculative.worldRect;if(!e.calculative.singleton.div){if(eE(e))return;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",(i=e.calculative.canvas.externalElements)==null||i.parentElement.appendChild(a),Re(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,s.allowFullscreen=!0,e.calculative.iframe=e.iframe,e.calculative.iframeKey=_o(e.iframe),a.appendChild(s),xo(e)}return e.calculative.patchFlags&&Re(e,e.calculative.singleton.div),e.onRenderPenRaw(e),new Path2D}function aE(e){ih(e),e.calculative.singleton&&e.calculative.singleton.div&&(e.calculative.canvas.store.data.locked?(sa[e.calculative.iframeKey]=e.calculative.singleton.div,delete e.calculative.singleton.div):(e.calculative.singleton.div.remove(),sa[e.calculative.iframeKey]=null))}function Mr(e){e.calculative.singleton.div&&Re(e,e.calculative.singleton.div)}function sE(e,t){if(t.iframe&&e.calculative.singleton.div){const i=_o(t.iframe),a=e.calculative.iframeKey;i!==a&&(e.calculative.singleton.div.children[0].src=t.iframe,e.calculative.iframe=t.iframe,e.calculative.iframeKey=i)}return f0(e,t),t}function nE(e){if(e.thumbImg&&!e.calculative.img){const t=new Image;t.crossOrigin=e.crossOrigin==="undefined"?void 0:e.crossOrigin||e.calculative.canvas.store.options.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 Ye={},Yr=['',''];function rE(e){var t;if(e.onDestroy||(e.onDestroy=oE,e.onMove=sc,e.onResize=sc,e.onRotate=sc,e.onClick=Ad,e.onValue=cE,e.onChangeId=lE),Ye[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=Yr[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=Yr[0],e.calculative.media.muted=!1):(s.innerHTML=Yr[1],e.calculative.media.muted=!0)},e.calculative.singleton||(e.calculative.singleton={div:i}),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(),Ad(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.crossOrigin=e.crossOrigin||"anonymous",e.calculative.img=n),n.loop=e.playLoop,n.ontimeupdate=()=>{d0(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),Ye[e.id]=i,(t=e.calculative.canvas.externalElements)==null||t.parentElement.appendChild(i),Re(e,i),e.autoPlay&&(n.autoplay=!0,n.muted=!0)}return e.calculative.patchFlags&&Re(e,Ye[e.id]),new Path2D}function oE(e){Ye[e.id].onclick=null,Ye[e.id].remove(),Ye[e.id]=void 0}function sc(e){Re(e,Ye[e.id]);const t=Ye[e.id].children[0],i=Ye[e.id].children[1];d0(t,i,e.calculative.worldRect.width)}function Ad(e){e.calculative.media&&(e.calculative.media.muted=!1,e.calculative.singleton.muted.innerHTML=Yr[0],e.calculative.media.paused?e.calculative.media.play():e.calculative.media.pause())}function d0(e,t,i){e.style.width=t.currentTime/t.duration*i+"px"}function lE(e,t,i){!Ye[t]||(Ye[i]=Ye[t],delete Ye[t])}function cE(e){const t=Ye[e.id];if(!t)return;Re(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 Ni(){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 za{constructor(t,i){H(this,"parentElement");H(this,"store");H(this,"box");H(this,"text");H(this,"arrowUp");H(this,"arrowDown");H(this,"x");H(this,"y");H(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;s0?(this.arrowUp.style.borderBottomColor="transparent",this.arrowDown.style.borderTopColor="#777777"):(o+=s.height+n.height+5,this.arrowUp.style.borderBottomColor="#777777",this.arrowDown.style.borderTopColor="transparent"),this.x=r,this.y=o,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 g0{constructor(t){H(this,"parent");H(this,"h");H(this,"v");H(this,"isDownH");H(this,"isDownV");H(this,"x");H(this,"y");H(this,"hSize");H(this,"vSize");H(this,"scrollX");H(this,"scrollY");H(this,"lastScrollX");H(this,"lastScrollY");H(this,"rect");H(this,"isShow");H(this,"isV");H(this,"padding");H(this,"pageMode");H(this,"onMouseDownH",t=>{t.preventDefault(),t.stopPropagation(),this.isDownH=t.x,this.x=this.parent.store.data.x||0,this.lastScrollX=this.scrollX});H(this,"onMouseDownV",t=>{t.preventDefault(),t.stopPropagation(),this.isDownV=t.y,this.y=this.parent.store.data.y||0,this.lastScrollY=this.scrollY});H(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.isV?this.parent.store.data.y=this.y-i*this.isV.h/this.parent.parentElement.clientHeight: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())});H(this,"onMouseUp",t=>{!this.isDownH&&!this.isDownV||(this.isDownH=void 0,this.isDownV=void 0,!this.isV&&(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;a0)?(this.scrollY=0,this.v.style.top="0px",!0):t>0&&(Math.abs(a.y+this.isV.h-this.parent.height+this.parent.store.data.y-this.padding)<1||a.y+this.isV.h-this.parent.height+this.parent.store.data.y-this.padding<=0)?(this.parent.store.data.y=-(a.y+this.isV.h-this.parent.height+this.padding)-1,this.parent.onMovePens(),this.parent.canvasTemplate.init(),this.parent.canvasImage.init(),this.parent.canvasImageBottom.init(),this.parent.render(),!0):!1}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(t){this.pageMode=!0,this.h.style.display="none";const i=this.parent.parent.getRect();if(i.height0?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;typeof t=="boolean"?t&&(i=-10):i=t,!(this.pageMode&&this.canMouseMove(i))&&(this.scrollY+=i,this.v.style.top=`${this.scrollY}px`,this.isV?this.parent.store.data.y-=i*this.isV.h/this.parent.parentElement.clientHeight: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 kd{constructor(t,i,a){H(this,"parentElement");H(this,"store");H(this,"isBottom");H(this,"canvas",document.createElement("canvas"));H(this,"otherOffsreen",Ni());H(this,"offscreen",Ni());H(this,"animateOffsScreen",Ni());H(this,"fitOffscreen",Ni());H(this,"fitFlag",!1);H(this,"currentFit");H(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 o of this.store.data.pens)this.hasImage(o)&&(this.store.animates.has(o)?i=!0:o.calculative.imageDrawed||(t=!0),o.parentId&&this.store.animates.has(We(o,!0))&&(i=!0));const a=this.store.patchFlagsBackground,s=this.store.patchFlagsTop;if(s&&!this.isBottom){const o=this.otherOffsreen.getContext("2d");o.clearRect(0,0,this.canvas.width,this.canvas.height),this.renderRule(o)}if(this.store.patchFlagsLast&&this.offscreen.getContext("2d").clearRect(0,0,this.canvas.width,this.canvas.height),t){const o=this.offscreen.getContext("2d");o.save(),o.clearRect(0,0,this.canvas.width,this.canvas.height),o.translate(this.store.data.x,this.store.data.y);for(const l of this.store.data.pens)!l.calculative.hasImage||this.store.animates.has(l)||this.store.animates.has(We(l,!0))||l.canvasLayer!==zt.CanvasTemplate&&(l.calculative.imageDrawed=!0,o.save(),Ya(o,l),(l.rotateByRoot||l.calculative.rotate)&&ia(o,l),Ka(o,l),Is(o,l),o.restore());o.restore()}if(i){const o=this.animateOffsScreen.getContext("2d");o.save(),o.clearRect(0,0,this.canvas.width,this.canvas.height),o.translate(this.store.data.x,this.store.data.y);for(const l of this.store.animates)!l.calculative.hasImage||l.canvasLayer!==zt.CanvasTemplate&&(l.visible===!1||l.calculative.visible===!1||(l.calculative.imageDrawed=!0,o.save(),Ya(o,l),(l.rotateByRoot||l.calculative.rotate)&&ia(o,l),Ka(o,l),Is(o,l),o.restore()));for(const l of this.store.data.pens)!l.calculative.hasImage||!l.parentId||l.canvasLayer!==zt.CanvasTemplate&&(l.visible===!1||l.calculative.visible===!1||this.store.animates.has(We(l,!0))&&(l.calculative.imageDrawed=!0,o.save(),Ya(o,l),(l.rotateByRoot||l.calculative.rotate)&&ia(o,l),Ka(o,l),Is(o,l),o.restore()));o.restore()}if(!this.isBottom&&!this.store.data.locked&&this.fitFlag){const o=(this.store.data.width||this.store.options.width)*this.store.data.scale,l=(this.store.data.height||this.store.options.height)*this.store.data.scale,h=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,d=this.fitOffscreen.getContext("2d");d.save(),d.clearRect(0,0,this.canvas.width,this.canvas.height),d.fillStyle="#ffffff66",d.strokeStyle=this.store.styles.activeColor,(r=this.store.data.fits)==null||r.forEach((f,g)=>{d.fillRect(h+o*f.x,c+l*f.y,o*f.width,l*f.height),f.active&&d.strokeRect(h+o*f.x,c+l*f.y,o*f.width,l*f.height)}),d.restore()}if(t||i||a&&this.isBottom||s&&!this.isBottom){const o=this.canvas.getContext("2d");o.clearRect(0,0,this.canvas.width,this.canvas.height),this.isBottom&&(this.store.patchFlagsBackground=!1),o.drawImage(this.offscreen,0,0,this.canvas.width,this.canvas.height),o.drawImage(this.animateOffsScreen,0,0,this.canvas.width,this.canvas.height),this.isBottom||(o.drawImage(this.otherOffsreen,0,0,this.canvas.width,this.canvas.height),this.store.patchFlagsTop=!1,!this.store.data.locked&&this.fitFlag&&o.drawImage(this.fitOffscreen,0,0,this.canvas.width,this.canvas.height))}}renderRule(t){var b,k,R,S,I,D,V,G;const{data:i,options:a}=this.store,{rule:s,ruleColor:n,scale:r,origin:o}=i;if(!(s!=null?s:a.rule))return;const l=r*10;t.save();const h=n||a.ruleColor||"#ccc";t.strokeStyle=eo(h,.7);const c=o.x+i.x,d=o.y+i.y,{width:f,height:g}=this.canvas;let m=((b=a.ruleOptions)==null?void 0:b.height)||20;(k=a.ruleOptions)!=null&&k.background&&(t.beginPath(),t.fillStyle=(R=a.ruleOptions)==null?void 0:R.background,t.rect(0,0,f,m),t.fill(),t.rect(0,0,m,g),t.fill()),(S=a.ruleOptions)!=null&&S.underline&&(t.beginPath(),t.fillStyle=eo(h,.7),t.moveTo(0,m),t.lineTo(f,m),t.stroke(),t.moveTo(m,0),t.lineTo(m,g),t.stroke());let y=m/4;((I=a.ruleOptions)==null?void 0:I.baseline)==="bottom"&&(y=m*3/4),t.beginPath(),t.lineWidth=m/2,t.lineDashOffset=-c%l,t.setLineDash([1,l-1]),t.moveTo(0,y),t.lineTo(f,y),t.stroke(),t.beginPath(),t.lineDashOffset=-d%l,t.moveTo(y,0),t.lineTo(y,g),t.stroke(),t.strokeStyle=h,t.beginPath(),t.lineWidth=m,t.lineDashOffset=-c%(l*10),t.setLineDash([1,l*10-1]),t.moveTo(0,m/2),t.lineTo(f,m/2),t.stroke(),t.beginPath(),t.lineDashOffset=-d%(l*10),t.moveTo(m/2,0),t.lineTo(m/2,g),t.stroke(),t.beginPath(),t.fillStyle=((D=a.ruleOptions)==null?void 0:D.textColor)||t.strokeStyle;let p=0-Math.floor(c/l/10)*100,x=((V=a.ruleOptions)==null?void 0:V.textTop)||16,_=((G=a.ruleOptions)==null?void 0:G.textLeft)||4;c<0&&(p-=100);for(let F=c%(l*10);F{a.drawImage(l,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 v0(e){if(e.data.locked)throw new Error("canvas is locked")}class uE{constructor(t,i){H(this,"parentElement");H(this,"box");H(this,"iframe");H(this,"dialog");H(this,"close");H(this,"title");H(this,"body");H(this,"x");H(this,"y");H(this,"url");H(this,"meta2dDiv");H(this,"dialogMeta2d");H(this,"store");H(this,"data");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=` `,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{this.close.style.display=a!=null&&a.hideClose?"none":"block",this.box.style.opacity="1"};if(this.iframe.onload=()=>{n&&o()},(!n||!r)&&o(),!n){this.meta2dDiv.style.display="block",this.dialogMeta2d||(globalThis.mainMeta2d=globalThis.meta2d,this.dialogMeta2d=new E6(this.meta2dDiv),globalThis.meta2d=globalThis.mainMeta2d);const l=await qc(this.store,i);l&&(this.box.style.display="block",this.dialogMeta2d.clear(!0),this.dialogMeta2d.open(l,!1),this.dialogMeta2d.lock(1),this.dialogMeta2d.resize(),this.dialogMeta2d.fitView(!0,0),this.dialogMeta2d.render(!0))}}detailRect(t){var o,l,h,c,d,f;const i=this.formatRectValue(t==null?void 0:t.x),a=this.formatRectValue(t==null?void 0:t.y),s=this.formatRectValue(t==null?void 0:t.width),n=this.formatRectValue(t==null?void 0:t.height),r=t!=null&&t.relative?(l=(o=t.pen)==null?void 0:o.calculative)==null?void 0:l.worldRect:void 0;if(r){const g=(c=(h=r.center)==null?void 0:h.x)!=null?c:r.x+r.width/2,m=(f=(d=r.center)==null?void 0:d.y)!=null?f:r.y+r.height/2;return{x:`calc(${g+this.store.data.x}px + ${i||"0px"})`,y:`calc(${m+this.store.data.y}px + ${a||"0px"})`,width:s||"80%",height:n||"420px"}}return{x:i||"50%",y:a||"50%",width:s||"80%",height:n||"420px"}}formatRectValue(t){if(t==null||t==="")return;if(typeof t=="number")return t+"px";const i=t.trim();if(!isNaN(Number(i)))return Number(i)+"px";if(/^-?\d+(\.\d+)?(px|vh|vw|%)$/.test(i)||/^(calc|min|max|clamp)\(.+\)$/.test(i))return i;const a=parseFloat(i);return isNaN(a)?void 0:a+"px"}hide(){var t;(t=this.dialogMeta2d)==null||t.clear(!1),this.box.style.display="none",this.box.style.opacity="0",this.iframe.onload=null,this.iframe.setAttribute("src","about:blank"),this.url="about:blank"}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 fo{constructor(t){H(this,"parentElement");H(this,"box");H(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;ai?(this.box.style.right=i-t.x+"px",this.box.style.left="auto"):(this.box.style.left=t.x+10+"px",this.box.style.right="auto"),t.y+10+100>a?(this.box.style.bottom=a-t.y+"px",this.box.style.top="auto"):(this.box.style.top=t.y+10+"px",this.box.style.bottom="auto")}static titleEmpty(t){return!t.title}show(t,i){if(fo.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}}function fE(e,{area:t,align:i,size:a,color:s,rotate:n},r){if(e.lineWidth=1,e.strokeStyle=s,n){const o=n*Math.PI/180,l=o+Math.PI/2,h={x:Math.sin(o),y:-Math.cos(o)},c={x:Math.sin(l),y:-Math.cos(l)};Cd(e,t,a,h),Cd(e,t,a,c)}else{const o=i.x/a,l=i.y/a,h=a*10,c=i.x-Math.ceil(o)*a,d=i.y-Math.ceil(l)*a,f=t.x+t.width+h,g=t.y+t.height+h;e.beginPath();for(let m=c;m<=f;m+=a)e.moveTo(m,d),e.lineTo(m,t.y+t.height+h);for(let m=d;m<=g;m+=a)e.moveTo(c,m),e.lineTo(t.x+t.width+h,m);e.stroke()}return!1}function Cd(e,t,i,a,s){const n=[{x:t.x,y:t.y},{x:t.x+t.width,y:t.y},{x:t.x+t.width,y:t.y+t.height},{x:t.x,y:t.y+t.height}];let r=1/0,o=-1/0;n.forEach(h=>{const c=h.x*a.x+h.y*a.y;r=Math.min(r,c),o=Math.max(o,c)});const l=Math.ceil((o-r)/i);e.beginPath();for(let h=0;h<=l;h++){const c=r+h*i;let d=[];for(let f=0;f1e-6){const p=(c-g.x*a.x-g.y*a.y)/(a.x*(m.x-g.x)+a.y*(m.y-g.y));if(p>=0&&p<=1){const x=g.x+p*(m.x-g.x),_=g.y+p*(m.y-g.y);d.push({x,y:_})}}}d.length>=2&&(e.moveTo(d[0].x,d[0].y),e.lineTo(d[1].x,d[1].y))}e.stroke()}function dE(e,{store:t,area:i,align:a,size:s,color:n},r){const o=n;e.fillStyle=o;const l=Math.max(.5,1.5*t.data.scale),h=a.x/s,c=a.y/s,d=s*10,f=a.x-Math.ceil(h)*s,g=a.y-Math.ceil(c)*s,m=i.x+i.width+d,y=i.y+i.height+d;for(let p=f+l;p<=m-l;p+=s)for(let x=g+l;x<=y-l;x+=s)e.beginPath(),e.arc(p,x,l,0,Math.PI*2),e.fill();return!0}class gE{constructor(t,i,a){H(this,"parentElement");H(this,"store");H(this,"canvas",document.createElement("canvas"));H(this,"offscreen",Ni());H(this,"bgOffscreen",Ni());H(this,"patchFlags");H(this,"bgPatchFlags");H(this,"parentCanvas");H(this,"fit");this.parentElement=t,this.store=i,t.appendChild(this.canvas),this.parentCanvas=a,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",wt.gridDrawers.default||(wt.gridDrawers.default=fE),wt.gridDrawers.dot||(wt.gridDrawers.dot=dE)}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,o=this.store.data.background||this.store.styles.background;o&&(i.save(),i.fillStyle=o,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&&(Oa(i,a),a.image&&a.name!=="gif"&&a.calculative.img&&(i.save(),Ya(i,a),(a.rotateByRoot||a.calculative.rotate)&&ia(i,a),Ka(i,a),Is(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,s={x:this.parentCanvas.mousePos.x+this.parentCanvas.store.data.x,y:this.parentCanvas.mousePos.y+this.parentCanvas.store.data.y},{grid:n}=i;if(!(n!=null?n:a.grid))return;const{gridRotate:r,gridColor:o,gridSize:l,scale:h,origin:c,gridScope:d}=i;let f=(l||a.gridSize)*h;f=f<0?0:f;const g=(i.width||a.width)*h,m=(i.height||a.height)*h,y=(i.x||a.x||0)+c.x,p=(i.y||a.y||0)+c.y,x=this.store.dpiRatio,_=this.canvas.width/x,b=this.canvas.height/x,k=d||a.gridScope,R=g&&m;t.save();let S;k==="full"?S={x:0,y:0,width:_,height:b}:k==="inner"?R?(S={x:y,y:p,width:g,height:m},t.beginPath(),t.rect(y,p,g,m),t.clip()):S={x:0,y:0,width:_,height:b}:k==="outer"?(S={x:0,y:0,width:_,height:b},R&&(t.beginPath(),t.rect(0,0,_,b),t.rect(y,p,g,m),t.clip("evenodd"))):R?(S={x:y,y:p,width:g,height:m},t.beginPath(),t.rect(y,p,g,m),t.clip()):S={x:0,y:0,width:_,height:b};const I={store:this.store,canvas:this.canvas,area:S,align:{x:y,y:p},size:f,color:o||a.gridColor,rotate:r,scale:h,mousePos:s},D=i.gridType||a.gridType||"default",V=wt.gridDrawers[D]||wt.gridDrawers.default;V&&(this.parentCanvas.store.options.gridAlwaysRender=V(t,I,s)),t.restore()}}const vE={success:{},info:{icon:''},warning:{},error:{}};class mE{constructor(t,i){H(this,"parentElement");H(this,"store");H(this,"box");H(this,"text");H(this,"arrowUp");H(this,"arrowDown");H(this,"icon");H(this,"confirm");H(this,"cancel");H(this,"x");H(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=ke("\u786E\u5B9A"),this.cancel.innerHTML=ke("\u53D6\u6D88"),this.icon.innerHTML=vE.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;s0?(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||ke("\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 Fd={linear:e=>e,easeInQuad:e=>e*e,easeOutQuad:e=>1-(1-e)*(1-e),easeInOutQuad:e=>e<.5?2*e*e:1-Math.pow(-2*e+2,2)/2,easeInCubic:e=>e*e*e,easeOutCubic:e=>1-Math.pow(1-e,3),easeInOutCubic:e=>e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2,easeInQuart:e=>e*e*e*e,easeOutQuart:e=>1-Math.pow(1-e,4),easeInOutQuart:e=>e<.5?8*e*e*e*e:1-Math.pow(-2*e+2,4)/2,easeInSine:e=>1-Math.cos(e*Math.PI/2),easeOutSine:e=>Math.sin(e*Math.PI/2),easeInOutSine:e=>-(Math.cos(Math.PI*e)-1)/2};function yE(e){return Fd[e]||Fd.easeOutCubic}const je="-moving";class Rd{constructor(t,i,a){H(this,"parent");H(this,"parentElement");H(this,"store");H(this,"canvas",document.createElement("canvas"));H(this,"offscreen",Ni());H(this,"width");H(this,"height");H(this,"externalElements",document.createElement("div"));H(this,"clientRect");H(this,"canvasRect");H(this,"activeRect");H(this,"initActiveRect");H(this,"dragRect");H(this,"lastRotate",0);H(this,"sizeCPs");H(this,"activeInitPos");H(this,"hoverType",xt.None);H(this,"resizeIndex",0);H(this,"mouseDown");H(this,"hotkeyType");H(this,"mouseRight");H(this,"addCaches");H(this,"touchCenter");H(this,"initTouchDis");H(this,"initScale");H(this,"touchScaling");H(this,"touchMoving");H(this,"startTouches");H(this,"lastTouchY");H(this,"startDistance");H(this,"startCenter");H(this,"currentCenter");H(this,"lastOffsetX",0);H(this,"lastOffsetY",0);H(this,"drawingLineName");H(this,"drawLineFns",[...h2]);H(this,"drawingLine");H(this,"pencil");H(this,"pencilLine");H(this,"movingPens");H(this,"patchFlagsLines",new Set);H(this,"dock");H(this,"prevAnchor");H(this,"nextAnchor");H(this,"lastMouseTime",0);H(this,"hoverTimer",0);H(this,"fitTimer",0);H(this,"willInactivePen");H(this,"patchFlags",!1);H(this,"lastRender",0);H(this,"batchRendering",!1);H(this,"touchStart",0);H(this,"touchStartTimer");H(this,"timer");H(this,"lastTapTime",0);H(this,"lastAnimateRender",0);H(this,"animateRendering",!1);H(this,"renderTimer");H(this,"viewAnimation");H(this,"viewAnimationTimer");H(this,"initPens");H(this,"pointSize",8);H(this,"pasteOffset",!0);H(this,"opening",!1);H(this,"maxZindex",5);H(this,"canMoveLine",!1);H(this,"randomIdObj");H(this,"keyOptions");H(this,"isMobile",/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));H(this,"beforeAddPen");H(this,"beforeAddPens");H(this,"beforeAddAnchor");H(this,"beforeRemovePens");H(this,"beforeRemoveAnchor");H(this,"customResizeDock");H(this,"customMoveDock");H(this,"inputParent",document.createElement("div"));H(this,"inputDiv",document.createElement("div"));H(this,"dropdown",document.createElement("ul"));H(this,"tooltip");H(this,"popconfirm");H(this,"title");H(this,"mousePos",{x:0,y:0});H(this,"scroll");H(this,"movingAnchor");H(this,"canvasTemplate");H(this,"canvasImage");H(this,"canvasImageBottom");H(this,"magnifierCanvas");H(this,"dialog");H(this,"autoPolylineFlag",!1);H(this,"stopPropagation",t=>{t.stopPropagation()});H(this,"curve",J_);H(this,"polyline",V5);H(this,"mind",t5);H(this,"line",i5);H(this,"onCopy",t=>{this.store.options.disableClipboard||t.target!==this.externalElements&&t.target!==document.body&&t.target.offsetParent!==this.externalElements||this.copy()});H(this,"onCut",t=>{this.store.options.disableClipboard||t.target!==this.externalElements&&t.target!==document.body&&t.target.offsetParent!==this.externalElements||this.cut()});H(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{var a,s,n,r;if(!t.data||typeof t.data=="string"&&(((s=(a=t.data).startsWith)==null?void 0:s.call(a,"setImmediate"))||((r=(n=t.data).startsWith)==null?void 0:r.call(n,"webpackHotUpdate"))))return;let i=typeof t.data=="string"?JSON.parse(t.data):t.data;typeof i=="object"?(i.name==="onload"&&this.dialog.iframe.contentWindow.postMessage(JSON.stringify({name:"dialog",data:this.dialog.data}),"*"),i.name==="closeDialog"&&this.dialog.hide(),this.parent.doMessageEvent(i.name,JSON.stringify(i.data))):this.parent.doMessageEvent(i)});H(this,"onwheel",t=>{if(this.viewAnimation=void 0,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===Bt.Disable||this.store.data.locked===Bt.DisableScale||this.store.data.locked===Bt.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()});H(this,"onkeydown",t=>{var n,r,o;if(this.store.data.locked>=Bt.DisableEdit&&t.target.tagName!=="INPUT"&&t.target.tagName!=="TEXTAREA"&&!t.target.dataset.meta2dIgnore&&this.store.active.forEach(l=>{var h;(h=l.onKeyDown)==null||h.call(l,l,t.key)}),this.store.data.locked>=Bt.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 l=this.store.data.width||this.store.options.width,h=this.store.data.height||this.store.options.height;l&&h&&(s={x:this.store.data.origin.x,y:this.store.data.origin.y,width:l*this.store.data.scale,height:h*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 l=jt(this.drawingLine);l!==this.drawingLine.calculative.activeAnchor?(Jc(this.drawingLine),this.drawingLine.calculative.worldAnchors.push(l)):this.drawingLine.calculative.worldAnchors.push({x:l.x,y:l.y});const h=this.drawLineFns.indexOf(this.drawingLineName);this.drawingLineName=this.drawLineFns[(h+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(l=>!l.parentId&&l.locked!==Bt.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+is.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?t.shiftKey?this.redo():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(l=>{l.type?(l.close=!l.close,l.close&&eh(l),this.store.path2dMap.set(l,wt.path2dDraws.line(l)),uo(l)):l.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(l=>{l.type||(l.calculative.focus=!1)}),this.movingPens&&(this.getAllByPens(this.movingPens).forEach(l=>{this.store.pens[l.id]=void 0}),this.movingPens=void 0,this.mouseDown=void 0,this.clearDock(),(o=this.store.active)==null||o.forEach(l=>{this.updateLines(l)}),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)});H(this,"onkeyup",t=>{switch(t.key){case"l":case"L":this.canMoveLine=!1;break}this.hotkeyType&&this.render(),this.hotkeyType{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),await 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)});H(this,"ontouchstart",t=>{if(this.viewAnimation=void 0,this.lastTouchY=t.touches[0].clientY,this.store.data.locked===Bt.Disable)return;const i=new Date().getTime(),a=i-this.lastTapTime;a<300&&a>0&&t.touches.length!==2&&this.ondblclick(t),this.lastTapTime=i,this.touchStartTimer&&clearTimeout(this.touchStartTimer),this.touchStartTimer=setTimeout(()=>{this.touchStart=performance.now();const s=t.touches[0].pageX-this.clientRect.x,n=t.touches[0].pageY-this.clientRect.y,r={x:s,y:n};if(this.calibrateMouse(r),this.getHover(r),this.onMouseDown({x:s,y:n,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.mouseDown=void 0,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},this.startDistance=this.getDistance(t.touches[0],t.touches[1]),this.startCenter=this.getCenter(t.touches[0],t.touches[1]),this.currentCenter={...this.startCenter},this.touchScaling=void 0,this.touchMoving=void 0;return}else t.touches.length===3&&(this.store.emitter.emit("contextmenu",{e:{x:s,y:n,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)});H(this,"ontouchmove",t=>{var o,l;if(this.store.data.locked===Bt.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){const h=this.lastTouchY-t.touches[0].clientY;if(h){const c={x:n,y:r};if(this.calibrateMouse(c),this.getHover(c),(o=this.store.hover)!=null&&o.onWheel){this.onwheel(this.touchToWheelEvent(t,h)),this.lastTouchY=t.touches[0].clientY;return}}if(this.store.options.scroll&&this.scroll&&!this.store.options.scrollButScale){if(!h)return;this.scroll.wheel(h),this.lastTouchY=t.touches[0].clientY;return}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.mouseDown=void 0,!this.touchMoving&&!this.touchScaling){const h=this.getDistance(a[0],a[1]),c=this.getCenter(a[0],a[1]),d=h-this.startDistance,f=c.x-this.currentCenter.x,g=c.y-this.currentCenter.y,m=Math.sqrt(f*f+g*g);Math.abs(d)/this.startDistance>m/100?this.touchScaling=!0:m>5&&(this.touchMoving=!0)}if(this.touchScaling){if(this.store.data.disableScale||this.store.options.disableScale)return;const h=Math.hypot(a[0].pageX-a[1].pageX,a[0].pageY-a[1].pageY)/this.initTouchDis;this.scale(this.initScale*h,ot(this.touchCenter))}if(this.touchMoving){if(this.store.data.locked>=Bt.DisableMove&&this.store.data.locked!==Bt.DisableScale||this.store.data.disableScale||this.store.options.disableScale)return;if(this.lastOffsetX){const{scale:h}=this.store.data;this.translate((n-this.lastOffsetX)/h,(r-this.lastOffsetY)/h)}this.lastOffsetX=n,this.lastOffsetY=r}}});H(this,"ontouchend",t=>{if(this.store.data.locked===Bt.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;setTimeout(()=>{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}),this.render()},60)});H(this,"onGesturestart",t=>{t.preventDefault()});H(this,"onMouseDown",t=>{var i,a,s,n,r;if(this.viewAnimation=void 0,t.buttons===2&&!this.drawingLine&&(this.mouseRight=Zi.Down),this.hideInput(),this.popconfirm.hide(),this.store.data.locked===Bt.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 o=this.store.activeAnchor;if(!o)return;const l={id:Tt(),x:o.x,y:o.y};this.drawingLine=this.createDrawingLine(l);let h=ce(this.drawingLine);this.drawingLine.calculative.activeAnchor=h,xe(this.store.hover,o,this.drawingLine,l),this.drawline();return}if(!(this.hotkeyType===Yt.Translate||this.mouseRight===Zi.Down&&!this.store.options.mouseRightActive)){if(this.drawingLine){if(this.store.hoverAnchor){const l=jt(this.drawingLine);this.store.hoverAnchor.type===Ii.Line?Rr(l,this.store.hoverAnchor,this.store):(l.x=this.store.hoverAnchor.x,l.y=this.store.hoverAnchor.y),xe(this.store.hover,this.store.hoverAnchor,this.drawingLine,l),this.drawline(),this.finishDrawline(!0);return}if(!this.store.options.autoAnchor&&t.shiftKey&&t.altKey&&t.ctrlKey){this.setAnchor(this.store.pointAt);const l=jt(this.drawingLine),h=this.store.activeAnchor;if(!h)return;l.x=h.x,l.y=h.y,xe(this.store.hover,h,this.drawingLine,l),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 l=jt(this.drawingLine),h=Ps(this.store.hover,t);l.x=h.x,l.y=h.y,this.drawingLine.autoTo=!0,xe(this.store.hover,h,this.drawingLine,l),this.drawline(),this.finishDrawline(!0);return}const o=jt(this.drawingLine);o.isTemp?(this.drawingLine.calculative.activeAnchor=this.drawingLine.calculative.worldAnchors[this.drawingLine.calculative.worldAnchors.length-2],o.isTemp=void 0):(this.drawingLine.calculative.activeAnchor=o,this.drawingLine.calculative.worldAnchors.push({x:o.x,y:o.y,penId:o.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 o=Ps(this.store.hover,t);this.store.hoverAnchor=o;const l={id:Tt(),x:o.x,y:o.y};this.drawingLine=this.createDrawingLine(l),this.drawingLine.autoFrom=!0,xe(this.store.hover,o,this.drawingLine,l)}else this.inactive(),this.hoverType=xt.None;else if(this.hoverType===xt.NodeAnchor){this.drawingLineName=this.store.options.drawingLineName;const o={id:Tt(),x:this.store.hoverAnchor.x,y:this.store.hoverAnchor.y};this.drawingLine=this.createDrawingLine(o),this.drawingLine.calculative.activeAnchor=o,xe(this.store.hover,this.store.hoverAnchor,this.drawingLine,o)}else if(!this.drawingLine&&this.drawingLineName!=="curve"){this.inactive(!0);const o={id:Tt(),x:t.x,y:t.y};this.drawingLine=this.createDrawingLine(o),this.drawingLine.calculative.activeAnchor=o}}else if(this.pencil){this.inactive(!0);const o=Tt(),l={x:t.x,y:t.y,id:Tt(),penId:o};this.pencilLine=this.getInitPencilLine(l)}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 o=We(this.store.hover,!0);let l=o||this.store.hover;o&&(o.container||((r=this.store.options.containerShapes)==null?void 0:r.includes(o.name)))&&(l=this.store.hover),t.ctrlKey&&!t.shiftKey?(l.calculative.active?this.willInactivePen=l:this.store.active.length>0&&(l.calculative.active=!0,ks(l),this.store.active.push(l),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&&Gi({x:t.x,y:t.y},this.activeRect))||this.store.active.length==1)&&(l.calculative.active||(this.active([l]),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(o=>{this.activeInitPos.push({x:(o.calculative.worldRect.x-this.activeRect.x)/this.activeRect.width,y:(o.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()}}});H(this,"onMouseMove",t=>{var a,s,n,r,o,l,h,c,d;if(this.store.data.locked===Bt.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){this.mouseRight===Zi.Down&&(this.mouseRight=Zi.Translate);const f=this.store.active[0];if(f&&this.store.data.locked&&(f.locked===void 0||f.locked=y||Math.abs(m)>=y)&&(this.willInactivePen=void 0),this.store.active.length===1){const p=this.store.active[0];if((p.locked===void 0||p.locked1&&(y=jt(this.drawingLine)),y?(y.prev=void 0,y.next=void 0,y.id||(y.id=Tt()),y.x=m.x,y.y=m.y,y.connectTo=void 0):(y={...m},this.drawingLine.calculative.worldAnchors.push(y)),(this.hoverType===xt.NodeAnchor||this.hoverType===xt.LineAnchor)&&(this.store.hoverAnchor.type!==Ii.Line&&(y.x=this.store.hoverAnchor.x,y.y=this.store.hoverAnchor.y),y.connectTo=this.store.hoverAnchor.penId,this.drawingLineName==="polyline"&&(y.isTemp=!1)),this.drawingLineName==="line"){if(t.ctrlKey&&!t.shiftKey)y.x=this.drawingLine.calculative.worldAnchors[this.drawingLine.calculative.worldAnchors.length-2].x;else if(t.shiftKey&&!t.ctrlKey)y.y=this.drawingLine.calculative.worldAnchors[this.drawingLine.calculative.worldAnchors.length-2].y;else if(t.shiftKey&&t.ctrlKey){let p=this.drawingLine.calculative.worldAnchors[this.drawingLine.calculative.worldAnchors.length-2];this.getSpecialAngle(y,p)}}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)});H(this,"onMouseUp",t=>{if(this.store.data.locked===Bt.Disable){this.hoverType=xt.None;return}if(!!this.mouseDown){if(this.mouseRight===Zi.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=Zi.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=jt(this.drawingLine);this.store.hoverAnchor.type===Ii.Line?Rr(i,this.store.hoverAnchor,this.store):(i.x=this.store.hoverAnchor.x,i.y=this.store.hoverAnchor.y),xe(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=jt(this.drawingLine),a=Ps(this.store.hover,t);i.x=a.x,i.y=a.y,this.drawingLine.autoTo=!0,xe(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=ce(i),s=jt(i);if(this.store.hoverAnchor){const n=this.store.hover,r=ce(n)===this.store.hoverAnchor,o=jt(n)===this.store.hoverAnchor,l=a===this.store.activeAnchor,h=s===this.store.activeAnchor;if((t.ctrlKey||t.altKey)&&n.type===Ut.Line&&(r||o)&&(l||h)){const c=n.calculative.worldAnchors.map(d=>({...d,penId:i.id}));r?c.shift():o&&c.pop(),(r&&l||o&&h)&&c.reverse(),l?(i.calculative.worldAnchors[0].connectTo=void 0,i.calculative.worldAnchors.unshift(...c)):h&&(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===Ii.Line?Rr(this.store.activeAnchor,this.store.hoverAnchor,this.store):(this.store.activeAnchor.x=this.store.hoverAnchor.x,this.store.activeAnchor.y=this.store.hoverAnchor.y),xe(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,wt.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>=Bt.DisableMove||a.parentId||a.isRuleLine)return!1;if(ea(a.calculative.worldRect,this.dragRect,t.ctrlKey||this.store.options.dragAllIn))return a.type===Ut.Line&&!this.store.options.dragAllIn?ic(a,this.dragRect):!0});this.active(i)}if(t.button!==2&&(wo(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,ks(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()}});H(this,"clearDock",()=>{var n,r,o,l;const t=(r=(n=this.dock)==null?void 0:n.xDock)==null?void 0:r.penId,i=(l=(o=this.dock)==null?void 0:o.yDock)==null?void 0:l.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});H(this,"onResize",()=>{this.timer&&clearTimeout(this.timer),this.timer=setTimeout(()=>{this.resize(),this.timer=void 0},100)});H(this,"onScroll",()=>{this.timer&&clearTimeout(this.timer),this.timer=setTimeout(()=>{this.clientRect=this.canvas.getBoundingClientRect(),this.timer=void 0},100)});H(this,"calibrateMouse",t=>(t.x-=this.store.data.x,t.y-=this.store.data.y,t));H(this,"getContainerHover",t=>{var a;if(this.dragRect)return;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===Bt.Disable)){if(Gi(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+je];this.store.lastHoverContainer&&!r&&(this.store.lastHoverContainer.calculative.containerHover=!1,this.store.emitter.emit("leave",this.store.lastHoverContainer)),this.store.lastHoverContainer=this.store.hoverContainer}}}});H(this,"lastHoverType",xt.None);H(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=ec(this.store.active),o=od(this.store.active)||this.store.options.disableRotate,l=ld(this.store.active)||this.store.options.disableSize;if(!r&&!o){const h={x:this.activeRect.center.x,y:this.activeRect.y-30};this.activeRect.rotate&&Zt(h,this.activeRect.rotate,this.activeRect.pivot||this.activeRect.center),!this.hotkeyType&&As(t,h,this.pointSize)&&(i=xt.Rotate,this.externalElements.style.cursor=`url("${this.store.options.rotateCursor}"), auto`)}if(!r&&!l)for(let h=0;h<8;h++){const c=h<4;if((this.hotkeyType===Yt.Resize||c&&!this.hotkeyType)&&As(t,this.sizeCPs[h],this.pointSize)){let f=c?Yf:Kf,g=0;Math.abs(this.activeRect.rotate%90-45)<25?(f=c?Kf:Yf,g=Math.round((this.activeRect.rotate-45)/90)+(c?0:1)):g=Math.round(this.activeRect.rotate/90),i=xt.Resize,this.resizeIndex=h,this.externalElements.style.cursor=f[(h+g)%4];break}}}i===xt.None&&(i=this.inPens(t,this.store.data.pens)),!i&&!a&&Gi(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,mn(We(this.store.lastHover,!0)||this.store.lastHover,!1),this.store.pens[this.store.lastHover.id]&&this.store.emitter.emit("leave",this.store.lastHover),this.tooltip.hide()),this.store.hover&&(this.store.hover.calculative.hover=!0,mn(We(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),[xt.LineAnchor,xt.NodeAnchor].includes(i)&&![xt.LineAnchor,xt.NodeAnchor].includes(this.lastHoverType)&&this.store.emitter.emit("enterAnchor",{pen:this.store.hover,anchor:this.store.hoverAnchor}),this.lastHoverType=i,(n=(s=this.store.hover)==null?void 0:s.onMouseMove)==null||n.call(s,this.store.hover,this.mousePos)});H(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===Bt.Disable||this.store.data.locked&&r.name==="sceneContainer")continue;const o=this.store.data.locked&&r.ignoreEvent===!0,l=ho(r);if(!(!r.calculative.active&&!Xa(t,r.calculative.worldRect,l)&&!Gi(t,r.calculative.worldRect))){if(!o&&!this.store.data.locked&&this.hotkeyType!==Yt.Resize&&r.calculative.worldAnchors){for(const h of r.calculative.worldAnchors)if(a=this.inAnchor(t,r,h),a){let c=ot(h);Object.assign(c,t),this.title.show(c,r);break t}}if(r.type){if(o)continue;if(r.isRuleLine){let c=((s=this.store.options.ruleOptions)==null?void 0:s.height)||20;if(t.x+this.store.data.x>c&&t.y+this.store.data.y>c)break}const h=a5(t,r);if(h){!this.store.data.locked&&!r.locked?this.hotkeyType===Yt.AddAnchor?this.externalElements.style.cursor="pointer":this.externalElements.style.cursor="move":this.externalElements.style.cursor=r.hoverCursor||this.store.options.hoverCursor,r.calculative.disabled&&(this.externalElements.style.cursor="not-allowed"),this.store.hover=r,this.store.pointAt=h.point,this.store.pointAtIndex=h.i,this.initTemplateCanvas([this.store.hover]),a=xt.Line;break}}else{if(r.children){const c=[];if(r.children.forEach(d=>{this.store.pens[d]&&c.push(this.store.pens[d])}),a=this.inPens(t,c),a)break}if(o)continue;let h=!1;if(r.name==="line"?h=Xa(t,r.calculative.worldRect,r.lineWidth):h=Gi(t,r.calculative.worldRect),h){if(r.type===Ut.Node&&r.name==="line"&&!v5(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=r.hoverCursor||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:c,y:d,ex:f,ey:g,rotate:m,center:y}=this.store.hover.calculative.worldRect;if(m){const p=[{x:c,y:d},{x:f,y:d},{x:f,y:g},{x:c,y:g}];p.forEach(_=>{Zt(_,m,y)});let x=p[p.length-1];for(const _ of p){if(x.y>t.y!=_.y>t.y){const b=_.x+(t.y-_.y)*(x.x-_.x)/(x.y-_.y);Math.abs(b-this.store.pointAt.x)<10&&(this.store.pointAt.x=b)}x=_}}else this.store.pointAt.x-10f&&(this.store.pointAt.x=f),this.store.pointAt.y-10g&&(this.store.pointAt.y=g)}break}}}}return a});H(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===Bt.Disable||this.store.data.locked&&n.ignoreEvent===!0||n===this.store.active[0])continue;let r=ho(n);if(r+=2*this.store.options.anchorRadius,!!Xa(t,n.calculative.worldRect,r)&&(this.store.hover=n,this.hotkeyType!==Yt.Resize&&n.calculative.worldAnchors))for(const o of n.calculative.worldAnchors){if(o.twoWay===Ae.In){const l=jt(this.store.active[0]);if(this.store.activeAnchor.id!==l.id)continue}if(o.twoWay===Ae.Out){const l=ce(this.store.active[0]);if(this.store.activeAnchor.id!==l.id)continue}if(!(o.twoWay===Ae.DisableConnected||o.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,o))){let l=ot(o);return Object.assign(l,t),this.title.show(l,n),!0}}}});H(this,"__loadMap",new Map);H(this,"imageTimer");H(this,"templateImageTimer");H(this,"render",t=>{if(this.batchRendering){this.patchFlags=!0;return}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){this.store.options.gridAlwaysRender&&(this.store.options.grid||this.store.data.grid)&&(this.canvasTemplate.bgPatchFlags=!0,this.canvasTemplate.render());return}if(t!=null)if(i-this.lastRenderthis.store.options.minFPSNumber&&this.store.options.autoFPS&&(this.store.options.interval--,this.store.options.animateInterval=this.store.options.interval),this.renderTimer&&cancelAnimationFrame(this.renderTimer),this.renderTimer=requestAnimationFrame(this.render);return}else i-this.lastRender-this.store.options.interval>10&&this.store.options.autoFPS&&document.visibilityState==="visible"&&(this.store.options.interval++,this.store.options.animateInterval=this.store.options.interval);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(),this.renderPensAnchors(),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});H(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(),Ya(t,i),(i.rotateByRoot||i.calculative.rotate)&&ia(t,i),Ka(t,i),Is(t,i),t.restore()),Oa(t,i));this.drawingLine&&Oa(t,this.drawingLine),this.pencilLine&&Oa(t,this.pencilLine),this.movingPens&&this.movingPens.forEach(i=>{this.renderPenContainChild(t,i)})});H(this,"renderPenContainChild",(t,i)=>{var a;i.calculative.inView&&Oa(t,i),(a=i.children)==null||a.forEach(s=>{const n=this.store.pens[s];n&&this.renderPenContainChild(t,n)})});H(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,ec(this.store.active)||od(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()}});H(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>Bt.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===Ii.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)&&!ec(this.store.active)&&!ld(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=eo(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()});H(this,"renderPensAnchors",()=>{for(const t of this.store.data.pens)!isFinite(t.x)||t.anchorVisible===!0&&this.renderAnchors(t)});H(this,"renderAnchors",t=>{const i=this.offscreen.getContext("2d");i.save(),i.translate(.5,.5),i.strokeStyle=t.anchorColor||this.store.styles.anchorColor,i.fillStyle=t.anchorBackground||this.store.options.anchorBackground;const{fontStyle:a,fontWeight:s,fontSize:n,fontFamily:r,lineHeight:o}=t.calculative,l=this.store.data.scale;t.calculative.worldAnchors.forEach((h,c)=>{var f,g,m,y,p,x;if(h.hidden||h.locked>Bt.DisableEdit)return;if(h===this.store.hoverAnchor){i.save();const _=t.hoverAnchorColor||this.store.options.hoverAnchorColor;i.strokeStyle=_,i.fillStyle=_}i.beginPath();let d=h.radius||t.anchorRadius||this.store.options.anchorRadius;if(t.type&&!h.radius&&!t.anchorRadius&&(d=3,t.calculative.lineWidth>3&&(d=t.calculative.lineWidth)),h.type===Ii.Line){let _=this.store.pens[h.penId].rotate||0;this.store.pens[h.penId].calculative.flipX&&(_*=-1),this.store.pens[h.penId].calculative.flipY&&(_*=-1);let b=h.rotate+_;this.store.pens[h.penId].calculative.flipX&&(b*=-1),this.store.pens[h.penId].calculative.flipY&&(b*=-1),i.save(),i.translate(h.x,h.y),i.rotate(b*Math.PI/180),i.translate(-h.x,-h.y),i.rect(h.x-h.length*this.store.data.scale/2,h.y-d,h.length*this.store.data.scale,d*2),i.restore()}else i.arc(h.x,h.y,d,0,Math.PI*2);if(t.type&&this.store.hoverAnchor===h?(i.save(),i.strokeStyle=t.activeColor||this.store.styles.activeColor,i.fillStyle=i.strokeStyle):(h.color||h.background)&&(i.save(),i.strokeStyle=h.color,i.fillStyle=h.background),i.fill(),i.stroke(),h===this.store.hoverAnchor&&i.restore(),(t.type&&this.store.hoverAnchor===h||h.color||h.background)&&i.restore(),h.label){i.save(),i.font=Ie({fontStyle:((f=h.labelStyle)==null?void 0:f.fontStyle)||a,fontWeight:((g=h.labelStyle)==null?void 0:g.fontWeight)||s,fontFamily:((m=h.labelStyle)==null?void 0:m.fontFamily)||r,lineHeight:((y=h.labelStyle)==null?void 0:y.lineHeight)||o,fontSize:((p=h.labelStyle)==null?void 0:p.fontSize)*l||n});const _=t.anchors[c].x,b=t.anchors[c].y;let k=0,R=0;h.labelDirection!==void 0?h.labelDirection===Pt.Left?(i.textAlign="right",i.textBaseline="middle",k=-(h.labelGap||10)*l):h.labelDirection===Pt.Right?(i.textAlign="left",i.textBaseline="middle",k=(h.labelGap||10)*l):h.labelDirection===Pt.Up?(i.textAlign="center",i.textBaseline="bottom",R=-(h.labelGap||5)*l):h.labelDirection===Pt.Bottom&&(i.textAlign="center",i.textBaseline="top",R=(h.labelGap||5)*l):_<.1?(i.textAlign="left",i.textBaseline="middle",k=(h.labelGap||10)*l):_>.9?(i.textAlign="right",i.textBaseline="middle",k=-(h.labelGap||10)*l):(i.textAlign="center",b<.1?(i.textBaseline="top",R=(h.labelGap||5)*l):b>.9?(i.textBaseline="bottom",R=-(h.labelGap||5)*l):i.textBaseline="middle"),i.fillStyle=((x=h.labelStyle)==null?void 0:x.textColor)||zi(t,this.store),i.fillText(h.label,h.x+k,h.y+R),i.restore()}if(!t.parentId&&t.children&&t.children.length>0&&h===this.store.hoverAnchor){i.save(),i.beginPath(),i.lineWidth=3;const _=t.hoverAnchorColor||this.store.options.hoverAnchorColor;globalThis.pSBC&&(i.strokeStyle=globalThis.pSBC(.5,_)),i.arc(h.x,h.y,d+1.5,0,Math.PI*2),i.stroke(),i.restore()}}),i.restore()});H(this,"transTimeout");H(this,"animateViewFrame",()=>{if(!this.viewAnimation)return;const t=performance.now(),{startTime:i,duration:a,fromX:s,fromY:n,fromScale:r,toX:o,toY:l,toScale:h,easing:c,center:d,pen:f}=this.viewAnimation;let g=Math.min(1,(t-i)/a);g=c(g);const m=this.store.data.scale,y=r+(h-r)*g,p=y/m;p!==1&&(this.store.data.scale=y,this.store.data.center=d,Fs(this.store.data.origin,p,d),this.store.data.pens.forEach(R=>{if(R.onScale&&R.onScale(R),!R.parentId){if(di(R,p,d),R.isRuleLine){const S=1/p,I=R.calculative.worldRect.center;R.width&&R.height||di(R,S,I)}this.updatePenRect(R,{worldRectIsReady:!0}),this.execPenResize(R)}}),this.calcActiveRect());let x,_;if(f){const R={x:this.width/2,y:this.height/2},S=R.x-f.calculative.worldRect.x-f.calculative.worldRect.width/2,I=R.y-f.calculative.worldRect.y-f.calculative.worldRect.height/2;x=s+(S-s)*g,_=n+(I-n)*g}else x=s+(o-s)*g,_=n+(l-n)*g;const b=this.store.data.x,k=this.store.data.y;if(this.store.data.x=x,this.store.data.y=_,this.scroll&&this.scroll.isShow&&this.scroll.translate(x-b,_-k),this.onMovePens(),this.canvasTemplate.init(),this.canvasImage.init(),this.canvasImageBottom.init(),this.render(),g<1)this.viewAnimationTimer=requestAnimationFrame(this.animateViewFrame);else{if(f||(this.store.data.x=o,this.store.data.y=l),Math.abs(this.store.data.scale-h)>.001){const R=h/this.store.data.scale;this.store.data.scale=h,this.store.data.center=d,Fs(this.store.data.origin,R,d),this.store.data.pens.forEach(S=>{if(S.onScale&&S.onScale(S),!S.parentId){if(di(S,R,d),S.isRuleLine){const I=1/R,D=S.calculative.worldRect.center;S.width&&S.height||di(S,I,D)}this.updatePenRect(S,{worldRectIsReady:!0}),this.execPenResize(S)}}),this.calcActiveRect(),this.onMovePens(),this.canvasTemplate.init(),this.canvasImage.init(),this.canvasImageBottom.init(),this.render()}this.viewAnimation=void 0,this.viewAnimationTimer=void 0,this.store.emitter.emit("scale",this.store.data.scale),this.store.emitter.emit("translate",{x:this.store.data.x,y:this.store.data.y})}});H(this,"pastePen",(t,i)=>{const a=t.id;if(ud(t),t.parentId=i,t.type===Ut.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:o,scale:l}=this.store.data;t.x=o.x+n.x*l,t.y=o.y+n.y*l,t.width=n.width*l,t.height=n.height*l,r.x=o.x+r.x*l,r.y=o.y+r.y*l,te(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(o=>o.id===n);r&&s.push(this.pastePen(r,t.id).id)}return t.children=s,Di(t,!0),t});H(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 o=1/0;(s=(a=this.store.pens[this.store.hover.parentId])==null?void 0:a.children)==null||s.forEach(l=>{const h=this.store.pens[l];if(Gi(r,h.calculative.worldRect)){const c=Math.sqrt((r.x-h.calculative.worldRect.center.x)**2+(r.y-h.calculative.worldRect.center.y)**2);c{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,o=`${(t.calculative.tempText===void 0?t.text+""||"":t.calculative.tempText).replace(/\x20/g," ").split(/[\s\n]/).join("
")}
`.replace("","").replace(/\\<\/div\>/g,"

");this.inputDiv.innerHTML=o,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 l=s.width;if(this.inputParent.style.width=(l<0?12:l)+"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";const c=this.inputDiv.getBoundingClientRect();let d=window.innerHeight-c.top-c.height;d=d>200?200:d,this.dropdown.style.maxHeight=d+"px",this.setDropdownList(),this.externalElements.style.zIndex="9999"}this.inputDiv.contentEditable=t.readonly?"false":"true",this.inputDiv.focus();const h=window.getSelection();h.selectAllChildren(this.inputDiv),h.collapseToEnd(),this.inputDiv.scrollTop=this.inputDiv.scrollHeight,this.inputDiv.scrollLeft=this.inputDiv.scrollWidth,t.calculative.text=void 0,this.initTemplateCanvas([t]),this.render()});H(this,"setInputStyle",t=>{t.text||(t.text="");let i;for(let h=0;h1,t.textLeft*r),a+=`margin-left:${o}px;`),t.textTop&&(a+=`margin-top:${r>1,t.textTop*n}px;`),t.lineHeight&&(a+=`line-height:${r>1?t.fontSize*t.lineHeight*r:t.calculative.fontSize*t.lineHeight}px;`),t.textHeight)a+=`height:${r>1?t.textHeight*n*r:t.textHeight*n}px;`;else{let h=t.calculative.worldRect.height/r;h<0&&(h=0);let c=(t.fontSize*r<12,h*r*n);c1,l*n}px;`);else if(t.whiteSpace===void 0||t.whiteSpace==="break-all"){let h=(t.calculative.worldTextRect.width||12)/r;h<0&&(h=0),a+=`width:${t.fontSize*r<12,h*r-o}px;`}t.whiteSpace&&(t.whiteSpace==="pre-line"?a+="white-space:pre;":(a+=`white-space:${t.whiteSpace};`,t.whiteSpace==="nowrap"&&(s+="display:contents;"))),t.whiteSpace!=="nowrap"&&(t.fontSize*1.2*t.text.length,(l||t.calculative.worldRect.width/r)*Math.floor(t.calculative.worldRect.height/r/(t.lineHeight*t.fontSize))),i.deleteRule(0),i.deleteRule(0),i.insertRule(`.meta2d-input .input-div{ resize:none;border:none;outline:none;background:transparent;position:absolute;flex-grow:1;height:100%;width: 100%;position:absolute;left:0;top:0;display:flex;flex-direction: column;cursor: text;${a}}`),i.insertRule(`.input-div div{${s}}`)});H(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(/\/g,` `).replace(/\<\/div\>/g,"").replace(/\/g,"").replace(/ /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=[ot(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&&$2(t),Bi(t),this.patchFlags=!0,this.pushHistory({type:_t.Update,pens:[ot(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&&t.calculative.textLines.length==0&&Bi(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()});H(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=ke("\u65E0"),n.style.padding="5px 12px",n.style.color="#ddd",this.dropdown.appendChild(n);return}const a=this.inputDiv.innerHTML.replace(/\/g,` `).replace(/\<\/div\>/g,"").replace(/\/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(ke(r),s):this.dropdownAppendOption(ke(r),s),++s}if(!this.dropdown.hasChildNodes()){const n=document.createElement("div");n.innerText=ke("\u65E0"),n.style.padding="5px 12px",n.style.color="#ddd",this.dropdown.appendChild(n)}});H(this,"selectDropdown",t=>{t.stopPropagation();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=[ot(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:_t.Update,pens:[ot(a,!0)],initPens:r}),this.render(),this.store.emitter.emit("change",a),this.store.emitter.emit("valueUpdate",a)});H(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.ys*(r.y+r.height)-10&&n.ya*r.x-10&&n.xa*(r.x+r.width)-10&&n.x{this.patchFlags=!0,this.store.lastHover&&(this.store.lastHover.calculative.hover=!1);let n=this.store.data.pens.find(r=>r.calculative.hover===!0);mn(n,!1)},this.popconfirm=new mE(i,a),this.dialog=new uE(i,a),this.title=new fo(i),this.store.options.scroll&&(this.scroll=new g0(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.store.options.parentTouch?(this.parentElement.ontouchstart=this.ontouchstart,this.parentElement.ontouchmove=this.ontouchmove,this.parentElement.ontouchend=this.ontouchend):(this.externalElements.ontouchstart=this.ontouchstart,this.externalElements.ontouchmove=this.ontouchmove,this.externalElements.ontouchend=this.ontouchend),this.externalElements.onmousedown=t=>{this.isMobile||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=>{this.isMobile||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.isMobile||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=t=>{this.isMobile||this.ondblclick(t)},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 Wa.Document:document.addEventListener("keydown",this.onkeydown),document.addEventListener("keyup",this.onkeyup);break;case Wa.Canvas:this.externalElements.addEventListener("keydown",this.onkeydown),this.externalElements.addEventListener("keyup",this.onkeyup);break}}touchToWheelEvent(t,i){const a=t.changedTouches[0]||t.touches[0];return{deltaX:0,deltaY:i,deltaZ:0,deltaMode:0,clientX:a.clientX,clientY:a.clientY,pageX:a.pageX,pageY:a.pageY,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,altKey:t.altKey,metaKey:t.metaKey,wheelDelta:-i,wheelDeltaY:-i,preventDefault:()=>t.preventDefault(),stopPropagation:()=>t.stopPropagation()}}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=ot(t,!0),r=ot(t,!0),o=Tt();r.id=o,r.calculative.canvas=this,r.calculative.active=!1,r.calculative.hover=!1;const l=ot(a.slice(0,s+1)),h=ot(a.slice(s)).map(c=>(c.penId=o,c));t.calculative.worldAnchors=l,r.calculative.worldAnchors=h,this.initLineRect(t),this.initLineRect(r),this.store.data.pens.push(r),this.store.pens[o]=r,this.pushHistory({type:_t.Add,pens:[ot(r,!0)],step:2}),this.pushHistory({type:_t.Update,initPens:[n],pens:[ot(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.xn.ex&&(this.movingAnchor.x=n.ex),this.movingAnchor.yn.ey&&(this.movingAnchor.y=n.ey);const r=xn(this.movingAnchor,n),o=s.anchors.findIndex(l=>l.id===this.movingAnchor.id);s.anchors[o]=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 Y2(t,this.store.options.uploadUrl,this.store.options.uploadParams,this.store.options.uploadHeaders):a=await q2(t),new Promise((s,n)=>{const r=new Image;r.onload=()=>{wt.htmlElements[a]=r,s({width:r.width,height:r.height,name:i?"gif":"image",image:a})},r.onerror=o=>{n(o)},r.crossOrigin=this.store.options.crossOrigin||"anonymous",r.src=a})}async dropPens(t,i){var l,h,c,d;this.randomIdObj={},this.parent.store.options.textPresetStyle&&t.length===1&&!t[0].temPreset&&t[0].name==="text"&&Object.assign(t[0],this.parent.store.options.textPresetStyle);for(const f of t)!f.parentId&&this.randomCombineId(f,t);if(Object.keys(this.randomIdObj).length!==0){const f=Object.keys(this.randomIdObj).join("|"),g=new RegExp(`(${f})`,"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]):(l=m.connectedLines)==null||l.forEach(y=>{y.lineAnchor=this.randomIdObj[y.lineAnchor],y.lineId=this.randomIdObj[y.lineId]}),(h=m.animations)!=null&&h.length){const y=JSON.stringify(m.animations).replace(g,p=>this.randomIdObj[p]);m.animations=JSON.parse(y)}if((c=m.triggers)!=null&&c.length){const y=JSON.stringify(m.triggers).replace(g,p=>this.randomIdObj[p]);m.triggers=JSON.parse(y)}if((d=m.events)!=null&&d.length){const y=JSON.stringify(m.events).replace(g,p=>this.randomIdObj[p]);m.events=JSON.parse(y)}}}for(const f of t)f.id||(f.id=Tt()),!f.calculative&&(f.calculative={canvas:this}),this.store.pens[f.id]=f;let a=0,s=0,n=0;for(const f of t)f.parentId||(f.width*=this.store.data.scale,f.height*=this.store.data.scale,f.x=i.x-f.width/2+n,f.y=i.y-f.height/2+s,f.tags&&f.tags.includes("meta3d")&&(f.x=this.store.data.origin.x,f.y=this.store.data.origin.y),f.dataset&&(a%2===0?n=f.width-40*this.store.data.scale:n=0,a++,a%2===0&&(s+=f.height+10*this.store.data.scale),delete f.dataset),f.temOffsetX&&(f.x+=f.temOffsetX*this.store.data.scale,delete f.temOffsetX),f.temOffsetY&&(f.y+=f.temOffsetY*this.store.data.scale,delete f.temOffsetY));const r=this.store.data.width||this.store.options.width,o=this.store.data.height||this.store.options.height;if(r&&o){let f={x:this.store.data.origin.x,y:this.store.data.origin.y,width:r*this.store.data.scale,height:o*this.store.data.scale},g=!0;for(const m of t)if(!m.parentId){let y=[{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===f.x&&m.y===f.y&&m.width===f.width&&m.height===f.height||y.some(p=>Gi(p,f))){g=!1,this.store.options.strictScope&&(m.xf.x+f.width&&(m.x=f.x+f.width-m.width),m.y+m.height>f.y+f.height&&(m.y=f.y+f.height-m.height));break}}if(g){console.info("\u753B\u7B14\u5728\u5927\u5C4F\u8303\u56F4\u5916");return}}await this.addPens(t,!0),this.active(t.filter(f=>!f.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]),ud(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 o=i.find(l=>l.id===r);o&&n.push(this.randomCombineId(o,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:_t.Add,pens:ot(s,!0)}),s}addPensSync(t,i,a){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:_t.Add,pens:ot(s,!0)}),s}getDistance(t,i){const a=i.clientX-t.clientX,s=i.clientY-t.clientY;return Math.sqrt(a*a+s*s)}getCenter(t,i){return{x:(t.clientX+i.clientX)/2,y:(t.clientY+i.clientY)/2}}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:Ut.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){var r;this.inactive();const{data:i,options:a}=this.store,s=i.scale,n=i.lineWidth||1;return t.penId=Tt(),{id:t.penId,name:"line",lineName:this.drawingLineName,x:t.x,y:t.y,type:Ut.Line,calculative:{canvas:this,active:!0,worldAnchors:[t],...a.linePresetStyle,lineWidth:a.linePresetStyle&&a.linePresetStyle.lineWidth?((r=a.linePresetStyle)==null?void 0:r.lineWidth)*s:n*s},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,o=t.y+a;let l=t.x,h=t.y,c=0,d=0,f=0,g=0;if(r<=o&&r<20)l=-i,c=this.width,f=1,t.ctrlKey||(h=Math.round((h-n.y)/(s*10))*(s*10)+n.y);else if(ot.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:o,y:l}=t,h={x:o,y:l},c=this.getPenRect(t),d=parseInt((c.x/s).toFixed()),f=parseInt((c.y/s).toFixed()),g=d*s,m=f*s;h.x=n.x+g*r,h.y=n.y+m*r,Object.assign(t,h),(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=ot(i,!0),s=this.store.data.gridSize||this.store.options.gridSize,{origin:n,scale:r}=this.store.data,o=this.store.options.autoAlignGrid&&(this.store.data.grid||this.store.options.grid);if(i.forEach(f=>{var x;const g=this.movingPens.findIndex(_=>_.id===f.id+je);if(g<0)return;const{x:m,y}=this.movingPens[g],p={x:m,y};if(o&&!this.movingPens[g].type){const _=this.getPenRect(this.movingPens[g]),b=parseInt((_.x/s).toFixed()),k=parseInt((_.y/s).toFixed()),R=b*s,S=k*s;p.x=n.x+R*r,p.y=n.y+S*r}Object.assign(f,p),(x=f.onMove)==null||x.call(f,f),this.updatePenRect(f),this.updateLines(f),this.store.emitter.emit("updateLines",f),this.patchFlagsLines.forEach(_=>{_.type&&this.initLineRect(_)}),this.patchFlagsLines.clear(),f.calculative.x=f.x,f.calculative.y=f.y,f.calculative.initRect&&(f.calculative.initRect.x=f.calculative.x,f.calculative.initRect.y=f.calculative.y,f.calculative.initRect.ex=f.calculative.x+f.calculative.width,f.calculative.initRect.ey=f.calculative.y+f.calculative.height),t0(f),f.parentId&&this.parent.updateRectbyChild(f.calculative.worldRect,f,this.store.pens[f.parentId])}),this.initImageCanvas(this.store.active),this.initTemplateCanvas(this.store.active),!this.dock)return;const{xDock:l,yDock:h}=this.dock;let c;l&&(c=this.store.pens[l.penId]),!c&&h&&(c=this.store.pens[h.penId]);const d=ot(this.store.active,!0);if(t&&this.store.active.length===1&&(c==null?void 0:c.type)===1&&((l==null?void 0:l.anchorId)||(h==null?void 0:h.anchorId))){const f=ce(c),g=jt(c);if(l!=null&&l.anchorId){const m=this.store.pens[this.store.active[0].id+je].calculative.worldAnchors.find(y=>y.id===l.anchorId);m.x===f.x&&m.y===f.y?(a.push(ot(c,!0)),xe(this.store.active[0],m,c,f),d.push(ot(c,!0))):m.x===g.x&&m.y===g.y&&(a.push(ot(c,!0)),xe(this.store.active[0],m,c,g),d.push(ot(c,!0)))}else if(h!=null&&h.anchorId){const m=this.store.pens[this.store.active[0].id+je].calculative.worldAnchors.find(y=>y.id===h.anchorId);m.x===f.x&&m.y===f.y?(a.push(ot(c,!0)),xe(this.store.active[0],m,c,f),d.push(ot(c,!0))):m.x===g.x&&m.y===g.y&&(a.push(ot(c,!0)),xe(this.store.active[0],m,c,g),d.push(ot(c,!0)))}}o&&(this.calcActiveRect(),this.getSizeCPs()),this.pushHistory({type:_t.Update,pens:d,initPens:a}),this.store.emitter.emit("translatePens",d)}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){if(!this.store.active.length)return;this.initTemplateCanvas(this.store.active),this.store.active.forEach(a=>{a.calculative.active=void 0,a.calculative.activeAnchor=void 0,a.calculative.hover=!1,ks(a,!1)});const i=[...this.store.active];this.store.active=[],this.activeRect=void 0,this.sizeCPs=void 0,this.store.activeAnchor=void 0,this.patchFlags=!0,!t&&this.store.emitter.emit("inactive",i)}active(t,i=!0){if(this.store.active&&this.store.active.length){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,ks(a,!1)}this.store.active=[],t.forEach(a=>{a.calculative.active=!0,ks(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=aa(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:o}=this.activeRect;t.forEach(l=>{const h={x:l.x*s+i,y:l.y*n+a};Zt(h,r,o),this.sizeCPs.push(h)})}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.x0?a-=180:a+=180)):i.y>t.y?a=90:i.yBt.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(o=>o.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(As(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&&As(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&&As(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)),Di(a);this.render()}clearCanvas(){this.activeRect=void 0,this.sizeCPs=void 0,this.__loadMap=new Map,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:_t.Add,pens:[t]}),t}addPenSync(t,i,a,s){if(!(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:_t.Add,pens:[t]}),t}pushHistory(t){var s;if(this.store.data.locked)return;const{origin:i,scale:a}=this.store.data;t.origin=ot(i),t.scale=a,t.type!==_t.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{let r;if(t.initPens)for(const o of t.initPens)o.id===n.id&&(r=o);if(r)for(const o in n)r[o]==null&&(r[o]=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==_t.Add||t.type==_t.Delete||t.type==_t.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==_t.Add||t.type==_t.Delete||t.type==_t.Update)&&this.activeHistory()}activeHistory(){let t=this.store.histories[this.store.historyIndex+1];const i=[];if(t&&t.type===_t.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===_t.Add||a.type===_t.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 _t.Add:t.pens.forEach(n=>{var l;const r=ot(n,!0),o=this.store.data.pens.findIndex(h=>h.id===r.id);if(o>-1){(l=r.onDestroy)==null||l.call(r,this.store.pens[r.id]);const h=r.parentId?this.store.pens[r.parentId]:void 0;h!=null&&h.children&&(h.children=h.children.filter(c=>c!==r.id)),this.store.data.pens.splice(o,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=_t.Delete;break;case _t.Update:const a=i?t.initPens:t.pens,s=i?t.pens:t.initPens;a.forEach(n=>{const r=ot(n,!0),o=this.store.data.pens.findIndex(l=>l.id===r.id);if(o>-1){if(r.calculative=this.store.data.pens[o].calculative,this.store.data.pens[o].type&&this.store.data.pens[o].lastConnected){for(let h in this.store.data.pens[o].lastConnected)if(this.store.pens[h]){let c=ot(this.store.data.pens[o].lastConnected[h]);this.store.pens[h].connectedLines=c,r.anchors.forEach(d=>{c.forEach(f=>{d.id===f.lineAnchor&&(d.connectTo=h)})})}}this.store.data.pens[o]=r,this.store.pens[r.id]=r;for(const h in r)(typeof r[h]!="object"||h==="lineDash")&&(r.calculative[h]=r[h]);r.calculative.image=void 0;const l=this.getPenRect(r,t.origin,t.scale);if(this.setPenRect(r,l,!1),this.updateLines(r,!0),r.calculative.canvas.parent.isCombine(r)){let h=s.find(c=>c.id===r.id);Tg.forEach(c=>{r[c]!==h[c]&&this.parent.setValue({id:r.id,[c]:r[c]},{render:!0,doEvent:!1})})}}});break;case _t.Delete:t.pens.reverse().forEach(n=>{var o,l;const r=ot(n,!0);if(r.calculative||(r.calculative={}),this.store.data.pens.splice(((o=r.calculative)==null?void 0:o.layer)!==-1?(l=r.calculative)==null?void 0:l.layer:this.store.data.pens.length,0,r),r.path&&!this.store.data.paths[r.pathId]&&(this.store.data.paths[r.pathId]=r.path),r.calculative.canvas=this,this.store.pens[r.id]=r,r.parentId){const h=this.store.pens[r.parentId];h&&(!h.children&&(h.children=[]),h.children.includes(r.id)||h.children.push(r.id))}if(r.type&&r.lastConnected)for(let h in r.lastConnected)this.store.pens[h]&&(this.store.pens[h].connectedLines=r.lastConnected[h])}),t.pens.reverse().forEach(n=>{const r=this.store.pens[n.id],o=this.getPenRect(r,t.origin,t.scale);this.setPenRect(r,o,!1),r.calculative.image=void 0,r.calculative.backgroundImage=void 0,r.calculative.strokeImage=void 0,this.loadImage(r)}),t.type=_t.Add;break;case _t.Replace:{const n=i?t.initPens:t.pens;(i?t.pens:t.initPens).forEach(o=>{var c;const l=ot(o,!0);if(this.store.data.pens.findIndex(d=>d.id===l.id)>-1){(c=l.onDestroy)==null||c.call(l,this.store.data.pens.find(f=>f.id===l.id));const d=this.store.data.pens.findIndex(f=>f.id===l.id);this.store.data.pens.splice(d,1),this.store.pens[l.id]=void 0,l.calculative||(l.calculative={}),l.calculative.canvas=this,this.store.animates.delete(l),this.store.animateMap.delete(l)}}),n.reverse().forEach(o=>{var h,c;const l=ot(o,!0);if(l.calculative||(l.calculative={}),this.store.data.pens.splice(((h=l.calculative)==null?void 0:h.layer)!==-1?(c=l.calculative)==null?void 0:c.layer:this.store.data.pens.length,0,l),this.store.pens[l.id]=l,l.type&&l.lastConnected)for(let d in l.lastConnected)this.store.pens[d]&&(this.store.pens[d].connectedLines=l.lastConnected[d]);l.calculative.canvas=this}),n.reverse().forEach(o=>{const l=this.store.data.pens.find(c=>c.id===o.id),h=this.getPenRect(l,t.origin,t.scale);this.setPenRect(l,h,!1),l.calculative.image=void 0,l.calculative.backgroundImage=void 0,l.calculative.strokeImage=void 0,this.loadImage(l)}),t.type=_t.Replace;break}}if(t.type===_t.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=Tt()),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=Tt());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&&wt.anchors[t.name]&&(t.anchors||(t.anchors=[]),wt.anchors[t.name](t)),!t.anchors){const r=ot(this.store.options.defaultAnchors);r.forEach((o,l)=>{o.id=`${l}`,o.penId=t.id}),t.anchors=r}this.updatePenRect(t),!t.anchors&&t.calculative.worldAnchors&&(t.anchors=t.calculative.worldAnchors.map(r=>xn(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,wt.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=Fc(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),te(i),t.calculative.worldRect=i,Zc(t,i),Bi(t),Di(t),t.calculative&&(t.calculative.gradientAnimatePath=void 0),this.store.path2dMap.set(t,wt.path2dDraws[t.name](t)),t.calculative.worldAnchors&&(t.anchors=t.calculative.worldAnchors.map(r=>xn(r,t.calculative.worldRect)))}drawingPencil(){v0(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=ce(this.drawingLine);let a=jt(this.drawingLine);if(a.isTemp&&(this.drawingLine.calculative.worldAnchors.pop(),a=jt(this.drawingLine)),!t&&(!a.connectTo&&this.drawingLine.calculative.worldAnchors.pop(),ce(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(o=>{if(o.type){const l=ce(o),h=jt(o);return Xf(l,i)&&Xf(h,a)}})){this.drawingLine=void 0,this.render();return}if(this.drawingLine.lineName==="polyline"&&!a.connectTo&&this.drawingLine.calculative.worldAnchors.length>2){let r=this.drawingLine.calculative.worldAnchors[this.drawingLine.calculative.worldAnchors.length-2];Math.abs(r.x-a.x)/this.store.data.scale<5&&Math.abs(r.y-a.y)/this.store.data.scale<5&&this.drawingLine.calculative.worldAnchors.pop()}const s=Fc(this.drawingLine);Object.assign(this.drawingLine,s),this.drawingLine.calculative.worldRect=s,this.drawingLine.calculative.activeAnchor=jt(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:_t.Add,pens:ot([this.drawingLine],!0)})),this.store.path2dMap.set(this.drawingLine,wt.path2dDraws[this.drawingLine.name](this.drawingLine)),this.drawingLine=void 0,this.drawingLineName=void 0,this.render()}async finishPencil(){if(this.pencilLine){const t=Sc(this.pencilLine.calculative.worldAnchors,10,0,this.pencilLine.calculative.worldAnchors.length-1);let i=ce(this.pencilLine);t.unshift({id:i.id,penId:i.penId,x:i.x,y:i.y}),i=jt(this.pencilLine),t.push({id:i.id,penId:i.penId,x:i.x,y:i.y}),this.pencilLine.calculative.worldAnchors=G5(t),this.pencilLine.calculative.worldAnchors.length>1&&(this.pencilLine.calculative.pencil=!1,this.store.path2dMap.set(this.pencilLine,wt.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:_t.Add,pens:ot([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:o,height:l}=t.calculative.worldRect;r.setAttribute("width",`${o}px`),r.setAttribute("height",`${l}px`);const c="data:image/svg+xml;base64,"+btoa(unescape(encodeURIComponent(new XMLSerializer().serializeToString(r))));i.src=c,i.crossOrigin=t.crossOrigin||this.store.options.crossOrigin||"anonymous",i.onload=()=>{t.calculative.img=i,t.calculative.imgNaturalWidth=i.naturalWidth||t.iconWidth,t.calculative.imgNaturalHeight=i.naturalHeight||t.iconHeight,wt.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(wt.htmlElements[t.image]){const i=wt.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||this.store.options.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,wt.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(wt.htmlElements[t.backgroundImage]){const i=wt.htmlElements[t.backgroundImage];t.calculative.backgroundImg=i}else{const i=new Image;i.crossOrigin=t.crossOrigin||this.store.options.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,wt.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(wt.htmlElements[t.strokeImage]){const i=wt.htmlElements[t.strokeImage];t.calculative.strokeImg=i}else{const i=new Image;i.crossOrigin=t.crossOrigin||this.store.options.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,wt.htmlElements[t.strokeImage]=i,this.imageLoaded(),t.canvasLayer===zt.CanvasTemplate&&t.name!=="gif"&&this.templateImageLoaded()}}t.calculative.strokeImage=t.strokeImage}}__loadImage(t,i=5){if(this.__loadMap.has(t))return this.__loadMap.get(t);const a=new Promise((s,n)=>{if(wt.htmlElements[t])s(wt.htmlElements[t]);else{const r=new Image;r.crossOrigin=this.store.options.crossOrigin||"anonymous",this.store.options.cdn&&!(t.startsWith("http")||t.startsWith("//")||t.startsWith("data:image"))?r.src=this.store.options.cdn+t:r.src=t,r.onload=()=>{wt.htmlElements[t]=r,this.__loadMap.delete(t),s(r)},r.onerror=()=>{i>0?(console.warn(`Image ${t} load failed, retrying... (${i})`),setTimeout(()=>{this.__loadMap.delete(t),this.__loadImage(t,i-1).then(s).catch(n)},1e3)):(this.__loadMap.set(t,0),n(new Error(`Failed to load image: ${t}`)))}}});return this.__loadMap.set(t,a),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.calculative.letterSpacing=(t.letterSpacing||0)*i,t.fontSize<1&&t.fontSize>0&&(t.calculative.fontSize=t.fontSize*t.calculative.worldRect.height),Pi(t.iconSize)&&(t.calculative.iconSize=t.iconSize*i),Pi(t.iconWidth)&&(t.calculative.iconWidth=t.iconWidth*i),Pi(t.iconHeight)&&(t.calculative.iconHeight=t.iconHeight*i),Pi(t.iconLeft)&&(t.calculative.iconLeft=t.iconLeft<1&&t.iconLeft>-1?t.iconLeft:t.iconLeft*i),Pi(t.iconTop)&&(t.calculative.iconTop=t.iconTop<1&&t.iconTop>-1?t.iconTop:t.iconTop*i),Pi(t.textWidth)&&(t.calculative.textWidth=t.textWidth<1&&t.textWidth>-1?t.textWidth:t.textWidth*i),Pi(t.textHeight)&&(t.calculative.textHeight=t.textHeight<1&&t.textHeight>-1?t.textHeight:t.textHeight*i),Pi(t.textLeft)&&(t.calculative.textLeft=t.textLeft<1&&t.textLeft>-1?t.textLeft*t.calculative.worldRect.width:t.textLeft*i),Pi(t.textTop)&&(t.calculative.textTop=t.textTop<1&&t.textTop>-1?t.textTop*t.calculative.worldRect.height:t.textTop*i),Pi(t.borderWidth)&&t.type===Ut.Line&&t.borderWidth&&(t.calculative.borderWidth=t.borderWidth*i)}updatePenRect(t,{worldRectIsReady:i,playingAnimate:a}={}){i?qr(t):Qg(t),a||this.setCalculativeByScale(t),Bs(t),ad(this.store.pens,t),Bi(t),Di(t),wt.path2dDraws[t.name]&&this.store.path2dMap.set(t,wt.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.bkType&&t.gradientColors||t.strokeType&&t.lineGradientColors||typeof t.background=="string"&&t.background.startsWith("linear-gradient"))&&(t.calculative.lineGradient&&(t.calculative.lineGradient=null),t.calculative.gradient&&(t.calculative.gradient=null),t.calculative.radialGradient&&(t.calculative.radialGradient=null))}initGlobalStyle(){if(this.store.options.themeOnlyCanvas||this.store.data.themeOnlyCanvas)return;const t={},i={},a={};M2.forEach(l=>{var h;if(this.store.options[l]!=null&&this.store.options[l]!==""&&(t[l]=this.store.options[l]),this.store.data[l]!=null&&this.store.data[l]!==""&&(i[l]=this.store.data[l]),this.store.data.theme){const c=(h=this.store.theme[this.store.data.theme])==null?void 0:h[l];c!=null&&c!==""&&(a[l]=c)}}),this.store.styles={};let s="";const n=this.store.data.width||this.store.options.width,r=this.store.data.height||this.store.options.height;!n&&!r&&(s="default");const o=gn.getThemeObj(this.store.data.theme||s);Object.assign(this.store.styles,t,i,a,o)}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.scalea[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.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)Di(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 o;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,(o=this.store.clipboard)!=null&&o.pos&&Fs(this.store.clipboard.pos,n,i),Fs(this.store.data.origin,n,i),this.store.data.pens.forEach(l=>{if(l.onScale&&l.onScale(l),!l.parentId){if(di(l,n,i),l.isRuleLine){const h=1/n,c=l.calculative.worldRect.center;l.width&&l.height||di(l,h,c)}this.updatePenRect(l,{worldRectIsReady:!0}),this.execPenResize(l)}}),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)}animateView(t){var c,d;this.viewAnimationTimer&&(cancelAnimationFrame(this.viewAnimationTimer),this.viewAnimationTimer=void 0),this.viewAnimation=void 0;const i=(c=t.duration)!=null?c:300,a=(d=t.easing)!=null?d:"easeOutCubic",s=t.center?{...t.center}:{x:this.width/2,y:this.height/2};let n=t.x!==void 0?t.x:this.store.data.x,r=t.y!==void 0?t.y:this.store.data.y,o=t.scale!==void 0?t.scale:this.store.data.scale;const l=this.store.data.minScale||this.store.options.minScale,h=this.store.data.maxScale||this.store.options.maxScale;if(oh&&(o=h),t.pen){const f={x:this.width/2,y:this.height/2};n=f.x-t.pen.calculative.worldRect.x-t.pen.calculative.worldRect.width/2,r=f.y-t.pen.calculative.worldRect.y-t.pen.calculative.worldRect.height/2}!t.pen&&Math.abs(n-this.store.data.x)<.5&&Math.abs(r-this.store.data.y)<.5&&Math.abs(o-this.store.data.scale)<.001||(this.calibrateMouse(s),this.viewAnimation={startTime:performance.now(),duration:i,fromX:this.store.data.x,fromY:this.store.data.y,fromScale:this.store.data.scale,toX:n,toY:r,toScale:o,easing:yE(a),center:s,pen:t.pen},this.animateViewFrame())}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(di(r,n,i),r.onScale&&r.onScale(r),r.isRuleLine){const o=n>1?1:1/n/n,l=r.calculative.worldRect.center;r.width&&r.height||di(r,o,l)}this.execPenResize(r)}}),this.calcActiveRect()}rotatePens(t){this.initPens||(this.initPens=ot(this.getAllByPens(this.store.active))),this.activeRect.rotate=gi(t,this.activeRect.center),this.activeRect.rotate%90<10&&(this.activeRect.rotate-=this.activeRect.rotate%90),this.activeRect.rotate%90>80&&(this.activeRect.rotate+=90-this.activeRect.rotate%90),this.store.active.length===1&&(this.lastRotate=this.store.active[0].rotate||0);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:_t.Update,pens:ot(this.getAllByPens(this.store.active)),initPens:this.initPens}),this.initPens=void 0},200)}resizePens(t){if(this.initPens||(this.initPens=ot(this.store.active,!0)),!this.initActiveRect){this.initActiveRect=ot(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=ot(this.initActiveRect);if(wd(r,s,n,this.resizeIndex),te(r),!this.store.options.disableDock){this.clearDock();const g=this.customResizeDock||Y_;this.dock=g(this.store,r,this.store.active,this.resizeIndex);const{xDock:m,yDock:y}=this.dock;if(m){s+=m.step;const p=this.store.pens[m.penId];p.calculative.isDock=!0}if(y){n+=y.step;const p=this.store.pens[y.penId];p.calculative.isDock=!0}}const o=this.activeRect.width,l=this.activeRect.height;let h=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)*(h*l)/o),this.activeRect.ratio=this.initPens[0].ratio,wd(this.activeRect,h,c,this.resizeIndex),this.store.options.strictScope){const g=this.store.data.width||this.store.options.width,m=this.store.data.height||this.store.options.height;if(g&&m){let y={x:this.store.data.origin.x,y:this.store.data.origin.y,width:g*this.store.data.scale,height:m*this.store.data.scale};this.activeRect.xy.x+y.width&&(this.activeRect.width=this.activeRect.width-(this.activeRect.x+this.activeRect.width-(y.x+y.width)),this.activeRect.x=y.x+y.width-this.activeRect.width,this.activeRect.ex=this.activeRect.x+this.activeRect.width),this.activeRect.y+this.activeRect.height>y.y+y.height&&(this.activeRect.height=this.activeRect.height-(this.activeRect.y+this.activeRect.height-(y.y+y.height)),this.activeRect.y=y.y+y.height-this.activeRect.height,this.activeRect.ey=this.activeRect.y+this.activeRect.height)}}te(this.activeRect);const d=this.activeRect.width/o,f=this.activeRect.height/l;this.store.active.forEach((g,m)=>{g.calculative.worldRect.x=this.activeInitPos[m].x*this.activeRect.width+this.activeRect.x,g.calculative.worldRect.y=this.activeInitPos[m].y*this.activeRect.height+this.activeRect.y,g.calculative.worldRect.width*=d,g.calculative.iconWidth&&(g.calculative.iconWidth*=d),g.calculative.worldRect.height*=f,g.calculative.iconHeight&&(g.calculative.iconHeight*=f),re(g.calculative.worldRect),te(g.calculative.worldRect),this.updatePenRect(g,{worldRectIsReady:!0}),this.execPenResize(g,!0),this.updateLines(g)}),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:_t.Update,pens:ot(this.store.active,!0),initPens:this.initPens}),this.initPens=void 0},200)}movePens(t){var o,l;if(!this.activeRect||this.store.data.locked)return;if(!this.initActiveRect){this.initActiveRect=ot(this.activeRect);return}if(!this.store.options.moveConnectedLine&&!this.canMoveLine&&this.store.active.length===1&&(((o=this.store.active[0].anchors[0])==null?void 0:o.connectTo)||((l=this.store.active[0].anchors[this.store.active[0].anchors.length-1])==null?void 0:l.connectTo))||(this.movingPens||(this.initMovingPens(),this.store.active.forEach(h=>{mn(h,!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=ot(this.initActiveRect);Ua(s,i,a);let n=!1;if(this.store.options.strictScope){const h=this.store.data.width||this.store.options.width,c=this.store.data.height||this.store.options.height;if(h&&c){let d={x:this.store.data.origin.x,y:this.store.data.origin.y,width:h*this.store.data.scale,height:c*this.store.data.scale};s.xd.x+d.width&&(s.x=d.x+d.width-s.width,n=!0),s.y+s.height>d.y+d.height&&(s.y=d.y+d.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 h=this.customMoveDock||q_;this.dock=h(this.store,s,this.movingPens,r);const{xDock:c,yDock:d}=this.dock;let f;c&&(r.x+=c.step,f=this.store.pens[c.penId],f.calculative.isDock=!0),d&&(r.y+=d.step,f=this.store.pens[d.penId],f.calculative.isDock=!0)}this.translatePens(this.movingPens,r.x,r.y,!0)}changeIdsByMoving(t,i){t.id+=je,t.parentId&&i.find(a=>a.id===t.parentId)&&(t.parentId+=je),t.children&&(t.children=t.children.map(a=>a+je)),t.connectedLines&&(t.connectedLines=t.connectedLines.map(a=>(i.find(s=>s.id===a.lineId)&&(a.lineId+=je),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+=je),a)))}initMovingPens(){var a,s;if(!this.store.options.moveConnectedLine&&!this.canMoveLine)for(let n=0;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")||bc.includes(n.name)||this.store.options.domShapes.includes(n.name)||n.image||n.isDom)&&(r.name="rectangle",r.onDestroy=void 0),this.updateValue(n,r),n.calculative.image=void 0})}moveLineAnchor(t,i){var o,l,h,c,d;if(!this.activeRect||this.store.data.locked)return;if(this.initPens||(this.initPens=ot(this.store.active,!0)),(o=this.store.activeAnchor)!=null&&o.connectTo){const f=this.store.pens[this.store.activeAnchor.connectTo];Ss(f,Na(f,this.store.activeAnchor.anchorId),this.store.pens[this.store.activeAnchor.penId],this.store.activeAnchor)}let a=(l=this.store.activeAnchor)==null?void 0:l.id,s=(c=(h=this.store.pens[this.store.activeAnchor.penId])==null?void 0:h.connectedLines)==null?void 0:c.filter(f=>f.anchor===a);s&&s.length>0&&s.forEach(f=>{const g=this.store.pens[f.lineId];Ss(this.store.pens[this.store.activeAnchor.penId],this.store.activeAnchor,g,Na(g,f.lineAnchor))});const n=this.store.active[0];ce(n);const r=jt(n);if(n.lineName==="polyline"&&!i.shiftKey)X5(n,this.store.activeAnchor,t);else{let f=0,g=0;if(n.lineName==="line"){let m=n.calculative.worldAnchors.findIndex(p=>p.id===this.store.activeAnchor.id);m===0&&(m=2);let y=n.calculative.worldAnchors[m-1];if(i.ctrlKey&&i.shiftKey){let p=ot(t);this.getSpecialAngle(p,y),f=p.x-this.store.activeAnchor.x,g=p.y-this.store.activeAnchor.y}else if(!i.ctrlKey&&i.shiftKey){let p={x:t.x,y:y.y};f=p.x-this.store.activeAnchor.x,g=p.y-this.store.activeAnchor.y}else if(i.ctrlKey&&!i.shiftKey){let p={x:y.x,y:t.y};f=p.x-this.store.activeAnchor.x,g=p.y-this.store.activeAnchor.y}else f=t.x-this.store.activeAnchor.x,g=t.y-this.store.activeAnchor.y}else!i.ctrlKey&&i.shiftKey?(f=t.x-this.store.activeAnchor.x,g=0):i.ctrlKey&&!i.shiftKey?(f=0,g=t.y-this.store.activeAnchor.y):(f=t.x-this.store.activeAnchor.x,g=t.y-this.store.activeAnchor.y);bn(this.store.activeAnchor,f,g),this.store.hover&&this.store.hoverAnchor&&this.store.hoverAnchor.penId!==this.store.activeAnchor.penId&&(this.store.hoverAnchor.type===Ii.Line?(f=t.x-this.store.activeAnchor.x,g=t.y-this.store.activeAnchor.y,Rr(this.store.activeAnchor,this.store.hoverAnchor,this.store)):(f=this.store.hoverAnchor.x-this.store.activeAnchor.x,g=this.store.hoverAnchor.y-this.store.activeAnchor.y),bn(this.store.activeAnchor,f,g),r.prev=void 0,n.lineName!=="polyline"&&((d=this[n.lineName])==null||d.call(this,this.store,n)))}this.patchFlagsLines.add(n),this.store.path2dMap.set(n,wt.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:_t.Update,pens:ot(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=ot(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,Zt(this.store.activeAnchor.next,180,this.store.activeAnchor);else if(this.store.activeAnchor.prevNextType===qa.Bilateral&&this.prevAnchor){const a=gi(t,this.store.activeAnchor),s=gi(this.prevAnchor,this.store.activeAnchor);this.store.activeAnchor.next.x=this.nextAnchor.x,this.store.activeAnchor.next.y=this.nextAnchor.y,Zt(this.store.activeAnchor.next,a-s,this.store.activeAnchor)}}const i=this.store.active[0];this.patchFlagsLines.add(i),this.store.path2dMap.set(i,wt.path2dDraws[i.name](i)),this.render(),this.timer&&clearTimeout(this.timer),this.timer=setTimeout(()=>{this.timer=void 0,this.pushHistory({type:_t.Update,pens:ot(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=ot(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,Zt(this.store.activeAnchor.prev,180,this.store.activeAnchor);else if(this.store.activeAnchor.prevNextType===qa.Bilateral&&this.nextAnchor){const a=gi(t,this.store.activeAnchor),s=gi(this.nextAnchor,this.store.activeAnchor);this.store.activeAnchor.prev.x=this.prevAnchor.x,this.store.activeAnchor.prev.y=this.prevAnchor.y,Zt(this.store.activeAnchor.prev,a-s,this.store.activeAnchor)}}const i=this.store.active[0];this.patchFlagsLines.add(i),this.store.path2dMap.set(i,wt.path2dDraws[i.name](i)),this.render(),this.timer&&clearTimeout(this.timer),this.timer=setTimeout(()=>{this.timer=void 0,this.pushHistory({type:_t.Update,pens:ot(this.store.active,!0),initPens:this.initPens}),this.initPens=void 0},200)}async setAnchor(t){var s;const i=[ot(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===Ut.Line&&((s=a.calculative.worldAnchors)==null?void 0:s.length)<=2?this.delete([a]):(I_(a,this.store.hoverAnchor),a.type===Ut.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===Ut.Line){this.store.activeAnchor=T_(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:Tt(),x:t.x,y:t.y};this.store.activeAnchor=S_(a,n)}}this.hotkeyType=Yt.None,this.render(),a&&this.pushHistory({type:_t.Update,pens:[ot(a,!0)],initPens:i})}checkDisconnect(t,i){if(t.id.indexOf(je)>0){const a=t.id;t=this.store.pens[a.replace(je,"")]}t.anchors.forEach(a=>{if(a.connectTo&&!i.find(s=>s.id===a.connectTo||s.id===a.connectTo+je)){const s=this.store.pens[a.connectTo];if(!s||s.type)return;Ss(s,Na(s,a.anchorId),t,a)}})}translatePens(t=this.store.active,i,a,s){if(!t||!t.length||t.some(l=>{if(l.locked>=Bt.DisableMove)return!0}))return;const r=!s&&ot(t,!0);this.activeRect&&Ua(this.activeRect,i,a);const o=this.getAllByPens(t);t.forEach(l=>{var h,c;if(!(l.locked>=Bt.DisableMove)){if(l.type===Ut.Line){if(!this.store.options.moveConnectedLine&&!this.canMoveLine||l.isRuleLine)return;sd(l,i,a),this.checkDisconnect(l,o),this.store.path2dMap.set(l,wt.path2dDraws[l.name](l)),s||(this.initLineRect(l),(h=l.connectedLines)==null||h.forEach(d=>{const f=this.store.pens[d.lineId];this.initLineRect(f)}))}else Ua(l.calculative.worldRect,i,a),this.updatePenRect(l,{worldRectIsReady:!0}),l.calculative.x=l.x,l.calculative.y=l.y,l.calculative.initRect&&(l.calculative.initRect.x=l.calculative.x,l.calculative.initRect.y=l.calculative.y,l.calculative.initRect.ex=l.calculative.x+l.calculative.width,l.calculative.initRect.ey=l.calculative.y+l.calculative.height);this.updateLines(l),(c=l.onMove)==null||c.call(l,l)}}),this.activeRect&&this.getSizeCPs(),this.render(),this.tooltip.translate(i,a),s||(this.pushHistory({type:_t.Update,pens:ot(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===Ut.Line){if(!this.store.options.moveConnectedLine&&!this.canMoveLine)return;sd(n,i,a),this.checkDisconnect(n,s),this.store.path2dMap.set(n,wt.path2dDraws[n.name](n))}else Ua(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=ce(t),r=jt(t),o=Ps(a,i===n?r:n);!o||(i.x=o.x,i.y=o.y,i.prev=void 0,i.next=void 0,s?s.anchor=o.id:xe(a,o,t,i),this[t.lineName]&&this[t.lineName](this.store,t),this.store.path2dMap.set(t,wt.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&&i0(t,s,t.calculative.worldRect):t.calculative.rotate=t.rotate;const n=ot(this.store.animateMap.get(t));n&&(n.id=t.id,this.parent.setValue(n,{doEvent:!1,render:!1,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,Ws(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 o=Na(r,s.lineAnchor);if(!o)return;if(!o.connectTo){t.connectedLines.splice(n,1);return}if(r.autoFrom){const f=ce(r);f.id===o.id&&this.calcAutoAnchor(r,f,t,s)}if(r.autoTo){const f=jt(r);f.id===o.id&&this.calcAutoAnchor(r,f,t,s)}const l=Na(t,s.anchor);if(!l)return;let h=t.rotate;t.flipX&&(h*=-1),t.flipY&&(h*=-1);let c=o.distance*this.store.data.scale*Math.cos((h+l.rotate)/180*Math.PI)||0,d=o.distance*this.store.data.scale*Math.sin((h+l.rotate)/180*Math.PI)||0;if(t.flipX&&(c=-c),t.flipY&&(d=-d),bn(o,l.x-o.x+c,l.y-o.y+d),this.store.options.autoPolyline&&!this.autoPolylineFlag&&r.autoPolyline!==!1&&r.lineName==="polyline"){let f=ce(r),g=jt(r),m=!1;f.id===o.id?(f=o,m=!0):g.id===o.id&&(g=o,m=!0),m&&(r.calculative.worldAnchors=[f,g],r.calculative.activeAnchor=f,this.polyline(this.store,r,g),this.initLineRect(r))}this.store.path2dMap.set(r,wt.path2dDraws[r.name](r)),this.patchFlagsLines.add(r),r.calculative.gradientSmooth&&(r.calculative.gradientAnimatePath=Gc(r)),i&&uo(r)})}calcActiveRect(){const t=this.store.active.filter(i=>(!i.locked||i.locked{Zt(s,i,a.center)}),this.initLineRect(t),qr(t)):(t.calculative.rotate?t.calculative.rotate+=i:t.calculative.rotate=i,Zt(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,o,l;if(a.calculative.pause){const h=Date.now()-a.calculative.pause;a.calculative.pause=void 0,a.calculative.frameStart+=h,a.calculative.frameEnd+=h}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((l=a.animations)!=null&&l.length){const h=ot(a.animations[0]);delete h.name,h.currentAnimation=0,this.parent.setValue({id:a.id,...h},{doEvent:!1,history:!1})}}else{if(!a.frames&&a.animations&&a.animations.length){let h=(o=a.animations)==null?void 0:o.findIndex(f=>f.autoPlay),c=h===-1?0:h;const d=ot(a.animations[c]);delete d.name,d.currentAnimation=c,!a.type&&d.frames&&(d.showDuration=this.parent.calcAnimateDuration(d)),this.parent.setValue({id:a.id,...d},{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.lastAnimateRender0&&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)B_(s,t)?s.calculative.patchFlags&&(te(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(!M_(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]);qr(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=Tt(),{origin:s,scale:n}=this.store.data;this.store.clipboard=void 0,localStorage.removeItem(this.clipboardName),sessionStorage.setItem("page",a);let r=ot(t,!0);r||(r=ot(this.store.active,!0),r.length===1&&r[0].parentId&&(r[0].parentId=void 0,r[0].x=r[0].calculative.worldRect.x,r[0].y=r[0].calculative.worldRect.y,r[0].width=r[0].calculative.worldRect.width,r[0].height=r[0].calculative.worldRect.height));let o=this.getAllByPens(r);o.forEach(h=>{var c;h.copyIndex=this.store.data.pens.findIndex(d=>d.id===h.id),(c=h.followers)!=null&&c.length&&(h.followers=void 0),h.pathId&&(h.path=this.store.data.paths[h.pathId])}),o.sort((h,c)=>h.copyIndex-c.copyIndex);const l={meta2d:!0,pens:o,origin:ot(s),scale:n,page:a,initRect:ot(this.activeRect),offset:10,mousePos:ot(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 l,h;let t,i;if(navigator.clipboard&&!this.store.options.disableClipboard&&!navigator.userAgent.includes("Firefox"))try{t=await((l=navigator.clipboard)==null?void 0:l.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=ot(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,d=-this.store.clipboard.initRect.height/this.store.clipboard.scale/10/r,f=(r-this.store.clipboard.scale)*this.store.clipboard.initRect.width/2+c,g=(r-this.store.clipboard.scale)*this.store.clipboard.initRect.height/2+d;r1&&(f=(r-1)*this.store.clipboard.initRect.width/this.store.clipboard.scale/2,g=(r-1)*this.store.clipboard.initRect.height/this.store.clipboard.scale/2),this.store.clipboard.pos={x:this.mousePos.x-f,y:this.mousePos.y-g},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);const o=this.store.clipboard.pens.filter(c=>!c.parentId);for(const c of o)this.pastePen(c,void 0);(h=this.keyOptions)!=null&&h.F||this.store.clipboard.pens.forEach(c=>{delete c.copyIndex}),sessionStorage.setItem("page",i.page),this.active(o),this.pushHistory({type:_t.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(...ot(Le(a,this.store),!0));return i.concat(t)}getAllFollowersByPens(t,i=!0){const a=t;for(const s of t){let n=Xc(s,this.store);i&&(n=ot(n,!0));for(const r of n)a.find(o=>o.id===r.id)||a.push(r)}return a}setFollowers(t=this.store.active){if(!(!t||t.length===0))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;so.id===n);if(r){const o=r.anchors[0],l=r.anchors[r.anchors.length-1];o.connectTo===t&&(o.connectTo=i.id),l.connectTo===t&&(l.connectTo=i.id)}else i.connectedLines.splice(s,1),s--}}changeNodeConnectedLine(t,i,a){var o;const s=i.anchors[0],n=i.anchors[i.anchors.length-1],r=[s,n];for(const l of r){const h=l.connectTo;if(h){const c=a.find(d=>d.id===h);c?(o=c.connectedLines)==null||o.forEach(d=>{d.lineId===t&&(d.lineId=i.id,d.lineAnchor=l.id)}):(l.connectTo=void 0,l.prev&&(l.prev.connectTo=void 0),l.next&&(l.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:_t.Delete,pens:s})}this.store.emitter.emit("delete",t)}deleteSync(t=this.store.active,i=!1,a=!0){if(!t||!t.length||(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:_t.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=We(s),o=r.children.indexOf(s.id);r.children.splice(o,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),s.pathId&&(s.path=this.store.data.paths[t.pathId]),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=We(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&&(this.store.data.pens.some(n=>n.pathId===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;al.id===n);(o==null?void 0:o.connectTo)===t.id&&(o.connectTo=void 0,o.anchorId=void 0,o.prev&&(o.prev.connectTo=void 0),o.next&&(o.next.connectTo=void 0)),o=Na(r,n),o&&(o.connectTo=void 0,o.anchorId=void 0,o.prev&&(o.prev.connectTo=void 0),o.next&&(o.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(o=>{Ss(n,o,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(){var i;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 a=0;a{if(navigator.userAgent.includes("Firefox")){if(!a.target.innerText){let s=this.inputDiv.offsetWidth/2;window.getComputedStyle(this.inputDiv,null).textAlign!=="center"&&(s=0),this.inputDiv.innerHTML=`
`}}else if(a.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.inputDiv.oninput=a=>{const s=this.store.pens[this.inputDiv.dataset.penId],n=a.target.innerText;if((s==null?void 0:s.dropdownList)&&!n.trim()){const r={};s.dropdownList.forEach(o=>{typeof o=="object"&&Object.keys(o).forEach(l=>{l!=="text"&&(r[l]=void 0)})}),this.updateValue(s,r)}if(s&&s.inputType==="number"){const r=j2(n);n!==r&&(a.preventDefault(),a.target.innerText=r)}if(navigator.userAgent.includes("Firefox")){if(!a.target.innerText.trim()){let r=this.inputDiv.offsetWidth/2;window.getComputedStyle(this.inputDiv,null).textAlign!=="center"&&(r=0),this.inputDiv.innerHTML=`
`}}else if(a.target.innerText)this.inputDiv.style.paddingTop="";else{let r=window.getComputedStyle(this.inputDiv,null);r.justifyContent==="center"&&(this.inputDiv.style.paddingTop=` ${this.inputDiv.offsetHeight/2-parseFloat(r.lineHeight)/2}px`)}this.store.emitter.emit("input",s)},this.inputDiv.onclick=a=>{a.stopPropagation();const s=this.store.pens[this.inputDiv.dataset.penId];this.dropdown.style.display==="block"?this.dropdown.style.display="none":(s==null?void 0:s.dropdownList)&&this.store.data.locked&&(this.dropdown.style.display="block"),this.store.emitter.emit("clickInput",s)},this.inputDiv.onkeyup=a=>{this.setDropdownList(!0);const s=this.store.pens[this.inputDiv.dataset.penId];this.store.emitter.emit("input",{pen:s,text:a.key}),a.stopPropagation()},this.inputDiv.onkeydown=a=>{if(a.key==="Enter"){const s=this.store.pens[this.inputDiv.dataset.penId];s.input&&s.whiteSpace==="nowrap"&&this.hideInput()}a.stopPropagation()},this.inputDiv.onmousedown=this.stopPropagation,this.inputDiv.onwheel=a=>{a.stopPropagation()},this.inputDiv.onpaste=a=>{a.preventDefault();let s="";a.clipboardData&&a.clipboardData.getData&&(s=a.clipboardData.getData("text/plain")),document.execCommand("insertHTML",!1,s)}}clearDropdownList(){if(this.dropdown.hasChildNodes())for(let t=0;t{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,o,l,h,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 d=this.store.pens[a.parentId],f=(n=d.children)==null?void 0:n.findIndex(g=>g===t);f!==-1&&((r=d.children)==null||r.splice(f,1,i))}(o=a.children)==null||o.forEach(d=>{const f=this.store.pens[d];f.parentId=i}),a.formId&&a.followers.forEach(d=>{const f=this.store.pens[d];f.formId=i}),a.type===Ut.Line?this.changeNodeConnectedLine(t,a,this.store.data.pens):(this.changeLineAnchors(t,a,this.store.data.pens),(l=a.connectedLines)==null||l.forEach(({lineId:d})=>{const f=this.store.pens[d];Bs(f)})),(h=a.anchors)==null||h.forEach(d=>d.penId=i),(c=a.calculative.worldAnchors)==null||c.forEach(d=>d.penId=i)}}updateValue(t,i){var m,y,p,x,_,b;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,o=!1,l=!1,h=!1,c=!1,d=!1,f,g=!1;for(const k in i)k.indexOf(".")===-1?(k==="rotate"?t.disableRotate?t.rotate=t.calculative.rotate||0:f=t.calculative.rotate||0:k==="canvasLayer"||k==="isBottom"||k==="showChild"?d=!0:k==="image"&&(g=!0),(typeof t[k]!="object"||k==="lineDash")&&(!t.disableRotate||k!=="rotate")&&(t.calculative[k]=i[k]),n2.includes(k)&&(o=!0),["name","borderRadius","lineSmooth","close"].includes(k)&&(r=!0),r2.includes(k)&&(c=!0),o2.includes(k)&&(l=!0),l2.includes(k)&&(h=!0),t.image&&t.name!=="gif"&&Sg.includes(k)&&(g=!0)):(delete t[k],so(t,k,i[k])),k.split(".")[0]==="anchors"&&Bs(t);if(this.setCalculativeByScale(t),n&&((m=t.onDestroy)==null||m.call(t,t),c2(t)),c){const k={x:(y=i.x)!=null?y:a.x,y:(p=i.y)!=null?p:a.y,width:(x=i.width)!=null?x:a.width,height:(_=i.height)!=null?_:a.height};this.setPenRect(t,k,!1),this.updateLines(t,!0),this.store.active&&this.store.active.length&&t.id===this.store.active[0].id&&this.calcActiveRect()}else l?this.updatePenRect(t):(!t.hiddenText&&o&&Bi(t),h&&ad(this.store.pens,t),r&&wt.path2dDraws[t.name]&&this.store.path2dMap.set(t,wt.path2dDraws[t.name](t)));if(f!==void 0){const k=t.calculative.rotate;t.calculative.rotate=f,this.rotatePen(t,k-f,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.background!==void 0&&(t.calculative.gradient=void 0,t.calculative.radialGradient=void 0),i.bkType!==void 0&&(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),d?(this.canvasImage.init(),this.canvasImageBottom.init()):g&&(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&&(b=t.calculative.singleton)!=null&&b.div&&Re(t,t.calculative.singleton.div)}execPenResize(t,i){var a,s;(a=t.onResize)==null||a.call(t,t,i),(s=t.children)==null||s.forEach(n=>{const r=this.store.pens[n];r&&this.execPenResize(r,i)})}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,!0),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){var R;const n=Ei(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 o=ot(n),l=this.store.data,h=a&&this.store.bkImg;let c=!1,d=!1;if(h){if(n.x+=l.x,n.y+=l.y,re(n),ea(n,this.canvasRect,!0))Object.assign(n,this.canvasRect);else{const S=Mn([...aa(n),...aa(this.canvasRect)]);Object.assign(n,S)}c=n.x===0,d=n.y===0}const f=this.store.data.width||this.store.options.width,g=this.store.data.height||this.store.options.height;let m=!1;f&&g&&!this.store.data.component&&(m=!0),m&&(n.x=this.store.data.origin.x,n.y=this.store.data.origin.y,n.width=f*this.store.data.scale,n.height=g*this.store.data.scale);const y=ot(n),p=Qi(t);n.x-=p[3]*r,n.y-=p[0]*r,n.width+=(p[3]+p[1])*r,n.height+=(p[0]+p[2])*r;const x=(s||1920)/n.width;n.width*=x,n.height*=x,re(n);const _=document.createElement("canvas");if(_.width=n.width,_.height=n.height,_.width>32767||_.height>32767||!navigator.userAgent.includes("Firefox")&&_.height*_.width>268435456||navigator.userAgent.includes("Firefox")&&_.height*_.width>472907776)throw new Error("can not to png, because the size exceeds the browser limit");const b=_.getContext("2d");b.textBaseline="middle",b.scale(x,x);const k=this.store.options.downloadBgTransparent?void 0:this.store.data.background||this.store.styles.background;if(k&&m&&(b.save(),b.fillStyle=k,b.fillRect(0,0,y.width+(p[1]+p[3])*r,y.height+(p[0]+p[2])*r),b.restore()),h)if(m)b.drawImage(this.store.bkImg,p[3]*r||0,p[0]*r||0,y.width,y.height);else{const S=n.x<0?-n.x:0,I=n.y<0?-n.y:0;b.drawImage(this.store.bkImg,S,I,this.canvasRect.width,this.canvasRect.height)}if(k&&!m)if(h){const S=n.x<0?-n.x:0,I=n.y<0?-n.y:0;b.save(),b.fillStyle=k,b.fillRect(S,I,this.canvasRect.width,this.canvasRect.height),b.restore()}else b.save(),b.fillStyle=k,b.fillRect(0,0,o.width+(p[3]+p[1])*r,o.height+(p[0]+p[2])*r),b.restore();h?m?b.translate(-n.x,-n.y):b.translate((c?l.x:-o.x)+p[3]*r||0,(d?l.y:-o.y)+p[0]*r||0):b.translate(-n.x,-n.y);for(const S of this.store.data.pens){if(!lo(S,this.store)||S.visible==!1)continue;(R=S.onRenderPenRaw)==null||R.call(S,S);const{active:I}=S.calculative;S.calculative.active=!1,S.calculative.img?oo(b,S):Oa(b,S,!0),S.calculative.active=I}if(i){_.toBlob(i);return}return _.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(g=>g.id);const r=Ei(s);if(!isFinite(r.width))throw new Error("can not to png, because width is not finite");const o=ot(r),l=Qi(i);r.x-=l[3],r.y-=l[0],r.width+=l[3]+l[1],r.height+=l[0]+l[2],re(r);const h=(a||r.width)/r.width;r.width*=h,r.height*=h;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 d=c.getContext("2d");d.textBaseline="middle",d.scale(h,h);const f=this.store.options.downloadBgTransparent?void 0:this.store.data.background||this.store.styles.background;f&&(d.save(),d.fillStyle=f,d.fillRect(0,0,o.width+(l[3]+l[1]),o.height+(l[0]+l[2])),d.restore()),d.translate(-o.x+l[3],-o.y+l[0]);for(const g of this.store.data.pens)if(n.includes(g.id)){if(!lo(g,this.store)||g.visible==!1)continue;const{active:m}=g.calculative;g.calculative.active=!1,g.calculative.img?oo(d,g):Oa(d,g),g.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=[ot(this.store.active[0],!0)];this.store.activeAnchor.prev?this.store.activeAnchor.next||(this.store.activeAnchor.next={...this.store.activeAnchor.prev},Zt(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},Zt(this.store.activeAnchor.prev,180,this.store.activeAnchor),this.initLineRect(this.store.active[0]),this.patchFlags=!0),this.pushHistory({type:_t.Update,pens:[ot(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=[ot(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:_t.Update,pens:[ot(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=qa.Mirror),this.store.activeAnchor.prevNextType=(this.store.activeAnchor.prevNextType+1)%3)}gotoView(t,i){let a=Ei(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(h=>{if(h.parentId||h.isRuleLine)return!1;if(ea(h.calculative.worldRect,this.dragRect,!0))return h.type===Ut.Line&&!this.store.options.dragAllIn?ic(h,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,o=(Math.floor(i.y)-this.store.data.origin.y)/a/n,l={x:r,y:o,width:(Math.ceil(i.width)+1)/a/s,height:(Math.ceil(i.height)+1)/a/n,children:t.map(h=>h.id),id:Tt(),active:!0};l.x<-.1&&(l.x=-.1),l.y<-.1&&(l.y=-.1),l.width>.5?(l.left=!0,l.right=!0,l.leftValue=l.x,l.rightValue=1-(l.x+l.width)):l.x<.5?(l.left=!0,l.leftValue=l.x,l.x>.2&&l.x+l.width>.5&&(l.right=!0,l.rightValue=1-(l.x+l.width))):(l.right=!0,l.rightValue=1-(l.x+l.width)),l.leftValue<.05&&(l.leftValue=0),l.rightValue<.05&&(l.rightValue=0),l.height>.5?(l.top=!0,l.bottom=!0,l.topValue=l.y,l.bottomValue=1-(l.y+l.height)):l.y<.5?(l.top=!0,l.topValue=l.y):(l.bottom=!0,l.bottomValue=1-(l.y+l.height)),l.topValue<.05&&(l.topValue=0),l.bottomValue<.05&&(l.bottomValue=0),this.store.data.fits||(this.store.data.fits=[]),this.store.data.fits.forEach(h=>{h.active=!1}),this.store.data.fits.push(l),this.canvasImage.activeFit=l,this.store.emitter.emit("fit",l),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 o=this.canvasImage.activeFit;if(this.canvasImage.currentFit==="top"){r<-.1&&(r=-.1);let c=r-o.y;if(o.height-=c,o.height<.01){o.height=.01;return}o.y=r}if(this.canvasImage.currentFit==="bottom"&&(r>1.1&&(r=1.1),o.height=r-o.y,o.height<=.01&&(o.height=.01)),this.canvasImage.currentFit==="left"){n<-.1&&(n=-.1);let c=n-o.x;if(o.width-=c,o.width<.01){o.width=.01;return}o.x=n}this.canvasImage.currentFit==="right"&&(n>1.1&&(n=1.1),o.width=n-o.x,o.width<=.01&&(o.width=.01));let l={x:o.x*a*i+this.store.data.origin.x,y:o.y*s*i+this.store.data.origin.y,width:o.width*a*i,height:o.height*s*i};re(l);const h=this.store.data.pens.filter(c=>{if(c.parentId||c.isRuleLine)return!1;if(ea(c.calculative.worldRect,l,!0))return c.type===Ut.Line&&!this.store.options.dragAllIn?ic(c,l):!0});o.left=void 0,o.leftValue=void 0,o.right=void 0,o.rightValue=void 0,o.top=void 0,o.topValue=void 0,o.bottom=void 0,o.bottomValue=void 0,o.width>.5?(o.left=!0,o.right=!0,o.leftValue=o.x,o.rightValue=1-(o.x+o.width)):o.x<.5?(o.left=!0,o.leftValue=o.x,o.x>.2&&o.x+o.width>.5&&(o.right=!0,o.rightValue=1-(o.x+o.width))):(o.right=!0,o.rightValue=1-(o.x+o.width)),Math.abs(o.leftValue)<.05&&(o.leftValue=0),Math.abs(o.rightValue)<.05&&(o.rightValue=0),o.height>.5?(o.top=!0,o.bottom=!0,o.topValue=o.y,o.bottomValue=1-(o.y+o.height)):o.y<.5?(o.top=!0,o.topValue=o.y-0):(o.bottom=!0,o.bottomValue=1-(o.y+o.height)),Math.abs(o.topValue)<.05&&(o.topValue=0),Math.abs(o.bottomValue)<.05&&(o.bottomValue=0),o.children=h.map(c=>c.id),this.store.emitter.emit("fit",o),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 o;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;(o=this.store.data.fits)==null||o.forEach((l,h)=>{l.ex=null,l.ey=null,Gi({x:a,y:s},l)&&(n=h),l.active&&(r=h)}),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.magnifierCanvas.render(),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.store.options.parentTouch?(this.parentElement.ontouchstart=void 0,this.parentElement.ontouchmove=void 0,this.parentElement.ontouchend=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 Wa.Document:document.removeEventListener("keydown",this.onkeydown),document.removeEventListener("keyup",this.onkeyup);break;case Wa.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 pE(e,t){const i=t||new Path2D;e.onDestroy||(e.onDestroy=wE,e.onMouseLeave=bE,e.onMouseUp=xE),e.formId=e.id;let a=e.calculative.borderRadius||0,s=a;const{x:n,y:r,width:o,height:l,ex:h,ey:c}=e.calculative.worldRect;e.calculative.worldTextRect,a<1&&(a=o*a,s=l*s);let d=a{let i=e.calculative.canvas.store.pens[t];i.formKey=void 0,i.formValue=void 0,i.formType=void 0,i.formId=void 0})}function bE(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+je];s&&s.calculative&&(ea(s.calculative.worldRect,e.calculative.worldRect,!0)||(e.followers.splice(a,1),delete i.formKey,delete i.formValue,delete i.formType,delete i.formId))}}})}function xE(e){const t=e.calculative.canvas.store.active;t&&t.length&&t.forEach(i=>{let a=e.calculative.canvas.store.pens[i.id+je];if(a||(a=e.calculative.canvas.store.pens[i.id]),a&&a.calculative){let s=ot(e.calculative.worldRect);s.x-=1,s.y-=1,s.width+=2,s.height+=2,ea(a.calculative.worldRect,s,!0)&&(e.followers||(e.followers=[]),e.followers.includes(i.id)||e.followers.push(i.id),i.formId=e.id,AE(i))}})}function nc(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 _E(e){const t=e.calculative.canvas.store.pens[e.formId];for(let i=t.followers.length-1;i>=0;i--){let a=t.followers[i];const s=e.calculative.canvas.store.pens[a];if(s&&s.formId&&s.formKey&&t.formData[s.formKey]){const n=s[s.formValue];let r="";Array.isArray(n)&&(r=[]),e.calculative.canvas.parent.setValue({id:s.id,[s.formValue]:r},{render:!1,doEvent:!1,history:!1})}s||t.followers.splice(i,1)}t.formData={},e.calculative.canvas.parent.render()}const EE={progress:"progress",cascadeFilterDom:"checked",treeFilterDom:"checked",dateRangePickerDom:"pickerTimes",datePickerDom:"pickerTimes",slider:"value",switch:"checked",inputDom:"text",checkbox:"selectedKeys",radio:"selectKey",rectangle:"text"};function AE(e){e.name==="rectangle"&&!e.input&&!e.dropdownList||(e.formValue=EE[e.name])}function kE(e,t){e.onDestroy||(e.onAdd=CE,e.onDestroy=PE,e.onMove=TE,e.onBeforeValue=SE,e.onMouseDown=IE,e.onMouseUp=BE);const i=t||new Path2D;if(i instanceof Path2D)return i}async function CE(e){e.sceneId||(e.sceneId=Tt())}const Tc=async(e,t)=>{var o;const i=e.calculative.canvas.store,a=i.data.origin,s=i.data.scale,n=t||e.vId,r=await qc(i,n);if(r&&((o=r.pens)==null?void 0:o.length)){const l=r.scale,h=r.origin;r.pens.forEach(d=>{d.parentId||(d.width=d.width/l,d.height=d.height/l,d.x=(d.x-h.x)/l+(e.x-a.x)/s,d.y=(d.y-h.y)/l+(e.y-a.y)/s),d.p_sceneId||(d.p_sceneId=e.sceneId,d.name!=="sceneContainer"&&(d.p_vId=n))}),e.calculative.canvas.parent.addPens(r.pens,!1,!0)}DE(e)},go=e=>{const t=e.calculative.canvas.parent;FE(e).forEach(a=>{t.canvas.delForce(a)}),t.canvas.canvasTemplate.init(),t.canvas.canvasImage.init(),t.canvas.canvasImageBottom.init(),t.render()},FE=e=>{let t=[];return e.calculative.canvas.parent.store.data.pens.forEach(a=>{a.p_sceneId&&e.sceneId&&a.p_sceneId===e.sceneId&&a.id!==e.id&&(a.calculative.locked=0,a.locked=0,t.push(a))}),t},RE=async e=>{e.calculative.drag&&e.calculative.active&&!(e.locked>1)&&(e.calculative.drag=!1,go(e),Tc(e))};function PE(e){go(e)}function SE(e,t){return t.vId&&(go(e),Tc(e,t.vId)),(t.x!==void 0||t.y!==void 0)&&(go(e),Tc(e)),t}function TE(e){Wg(RE,500,e)}function IE(e,t){e.calculative.drag=!0}function BE(e,t){e.calculative.drag=!1}function DE(e){let t=e.calculative.canvas.store.data.pens,i=t.findIndex(s=>s.id===e.id);if(i<0||i>=t.length)return t;const a=t.splice(i,1)[0];t.push(a)}function ME(e){const t=new Path2D;if(e.calculative.worldRect,e.calculative.singleton||(e.calculative.singleton={}),e.onDestroy||(e.onDestroy=LE,e.onResize=Pd,e.onRenderPenRaw=zE,e.onMove=Sd,e.onMouseMove=u0,e.onBeforeValue=OE),!e.calculative.singleton.div){const i=document.createElement("div");i.style.position="absolute",i.style.outline="none",i.style.left="-9999px",i.style.top="-9999px",e.ignoreEvent&&(i.style.pointerEvents="none");const a=e.html.iframe?document.createElement("iframe"):document.createElement("div");e.html.iframe?(a.srcdoc=e.html.content||"",a.onload=()=>{a.style.overflow="hidden",a.style.border="none",a.scrolling="no",Eo(e)}):a.innerHTML=e.html.content||"",a.style.width="100%",a.style.height="100%",a.style.outline="none",a.style.border="none",a.style.overflow="hidden",i.appendChild(a),e.calculative.canvas.externalElements.parentElement.appendChild(i),e.calculative.singleton.div=i,xo(e),Pd(e),Re(e,i)}return Sd(e),t}function LE(e){ih(e),e.calculative.singleton&&e.calculative.singleton.div&&(e.calculative.singleton.div.remove(),delete e.calculative.singleton.div)}function OE(e,t){var a,s,n,r,o;const i=(s=(a=t.html)==null?void 0:a.content)!=null?s:t["html.content"];if(i!==void 0){const l=(r=(n=e.calculative.singleton)==null?void 0:n.div)==null?void 0:r.children[0];l&&(e.html.iframe?l.srcdoc=i:(l.innerHTML=i,l.onload=()=>{requestAnimationFrame(()=>Eo(e))}))}if(t.ignoreEvent!==void 0){const l=(o=e.calculative.singleton)==null?void 0:o.div;l&&(l.style.pointerEvents=t.ignoreEvent?"none":"")}return f0(e,t),t}const NE=e=>Eo(e);function Pd(e){const{width:t,height:i}=window.meta2d.getPenRect(e);e.calculative.singleton._width=t,e.calculative.singleton._height=i,Wg(NE,1e3,e)}function Sd(e){requestAnimationFrame(()=>{const t=e.calculative.worldRect,i=e.calculative.canvas.store,a=e.calculative.singleton.div;!a||(a.style.width=e.calculative.singleton._width+"px",a.style.height=e.calculative.singleton._height+"px",a.style.left=t.x+i.data.x-1/2*e.calculative.singleton._width+1/2*t.width+"px",a.style.top=t.y+i.data.y-1/2*e.calculative.singleton._height+1/2*t.height+"px",a.style.scale=e.calculative.canvas.store.data.scale)})}function Eo(e){var s,n;const t=(s=e.calculative.singleton)==null?void 0:s.div;if(!t)return;const i=t.children[0];if(!i)return;const a=e.html.iframe?(n=i.contentDocument)==null?void 0:n.querySelector("body"):i;!a||L_(e,a)}function zE(e){Eo(e)}function WE(e,t){var m,y;const i=t||new Path2D,{x:a,y:s,width:n,height:r}=e.calculative.worldRect,o=a+n/2,l=s+r/2,h=Math.min(n,r)/2,c=(m=e.calculative.startAngle)!=null?m:45,d=(y=e.calculative.endAngle)!=null?y:135,f=(c-90)*Math.PI/180,g=(d-90)*Math.PI/180;if(i.moveTo(o,l),i.arc(o,l,h,f,g),i.closePath(),i instanceof Path2D)return i}function HE(e,t){var y,p;const i=t||new Path2D,{x:a,y:s,width:n,height:r}=e.calculative.worldRect,o=a+n/2,l=s+r/2,h=n/2,c=r/2,d=(y=e.calculative.startAngle)!=null?y:0,f=(p=e.calculative.endAngle)!=null?p:180,g=(d-90)*Math.PI/180,m=(f-90)*Math.PI/180;if(i.ellipse(o,l,h,c,0,g,m),i instanceof Path2D)return i}function UE(e,t){const i=t||new Path2D;if(VE(e).forEach(({x:s,y:n},r)=>{r?i.lineTo(s,n):i.moveTo(s,n)}),i.closePath(),i instanceof Path2D)return i}function VE(e){const{x:t,y:i,width:a,height:s}=e.calculative.worldRect,n=t+a/2,r=i+s/2,o=Math.min(a,s)/2,l=Math.max(3,Math.round(Number(e.calculative.sides||e.calculative.sideCount||e.calculative.edgeCount)||5)),h=-Math.PI/2;return new Array(l).fill(0).map((c,d)=>{const f=h+Math.PI*2*d/l;return{x:n+o*Math.cos(f),y:r+o*Math.sin(f)}})}function $E(e,t){const i=t||new Path2D,{x:a,y:s,width:n,height:r}=e.calculative.worldRect,o=a+n/2,l=s+r/2,h=Math.min(n,r)/2,c=8,d=Math.PI*2/c;let f=-Math.PI/2;i.moveTo(o+h*Math.cos(f),l+h*Math.sin(f));for(let g=1;g<=c;g++)f+=d,i.lineTo(o+h*Math.cos(f),l+h*Math.sin(f));if(i.closePath(),i instanceof Path2D)return i}function jE(e,t){const i=t||new Path2D,{x:a,y:s,width:n,height:r}=e.calculative.worldRect,o=e.calculative.topRatio||.5,l=n*o,h=a+(n-l)/2,c=h+l;if(i.moveTo(h,s),i.lineTo(c,s),i.lineTo(a+n,s+r),i.lineTo(a,s+r),i.closePath(),i instanceof Path2D)return i}function qE(e){const t=e.calculative.topRatio||.5;e.anchors=[{id:"0",penId:e.id,x:0+(1-t)/2,y:0},{id:"1",penId:e.id,x:1-(1-t)/2,y:0},{id:"2",penId:e.id,x:0,y:1},{id:"3",penId:e.id,x:1,y:1}]}function YE(e,t){const i=t||new Path2D,{x:a,y:s,width:n,height:r}=e.calculative.worldRect,o=e.calculative.barRatio||.3,l=n*o,h=r*o,c=a+n/2,d=s+r/2;if(i.rect(c-l/2,s,l,r),i.rect(a,d-h/2,n,h),i instanceof Path2D)return i}function KE(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,s),i.lineTo(a+n,s+r),i.closePath(),i instanceof Path2D)return i}function XE(e){e.anchors=[{id:"0",penId:e.id,x:0,y:0},{id:"1",penId:e.id,x:0,y:1},{id:"2",penId:e.id,x:1,y:1}]}function GE(e,t){const i=t||new Path2D,{x:a,y:s,width:n,height:r}=e.calculative.worldRect,o=e.calculative.skewRatio||.2,l=n*o;if(i.moveTo(a+l,s),i.lineTo(a+n,s),i.lineTo(a+n-l,s+r),i.lineTo(a,s+r),i.closePath(),i instanceof Path2D)return i}function ZE(e){const t=e.calculative.skewRatio||.2;e.anchors=[{id:"0",penId:e.id,x:t,y:0},{id:"1",penId:e.id,x:1,y:0},{id:"2",penId:e.id,x:0,y:1},{id:"3",penId:e.id,x:1-t,y:1}]}function JE(e){var t;if(e.onDestroy||(e.onDestroy=QE,e.onMove=Lr,e.onResize=Lr,e.onRotate=Lr,e.onValue=Lr,e.onBeforeValue=t6),e.calculative.singleton||(e.calculative.singleton={}),!e.calculative.singleton.div){const i=document.createElement("div");i.style.position="absolute",i.style.outline="none",i.style.left="-9999px",i.style.top="-9999px",(t=e.calculative.canvas.externalElements)==null||t.parentElement.appendChild(i),e.calculative.singleton.div=i}return m0(e),Re(e,e.calculative.singleton.div),e.calculative.singleton.div.style.pointerEvents="none",new Path2D}function QE(e){e.calculative.singleton&&e.calculative.singleton.div&&(e.calculative.singleton.div.remove(),delete e.calculative.singleton.div)}function Lr(e){e.calculative.singleton.div&&Re(e,e.calculative.singleton.div)}function t6(e,t){return(t.blur!==void 0||t.blurBackground!==void 0||t.background!==void 0||t.borderRadius!==void 0)&&requestAnimationFrame(()=>m0(e)),t}function m0(e){var n,r,o,l,h,c;const t=e.calculative.singleton.div;if(!t)return;const i=`blur(${(n=e.blur)!=null?n:10}px)`;t.style["backdrop-filter"]=i,t.style["-webkit-backdrop-filter"]=i,t.style.background=(l=(o=(r=e.blurBackground)!=null?r:e.calculative.background)!=null?o:e.background)!=null?l:"rgba(255, 255, 255, 0.25)";const a=e.calculative.canvas.store.data.scale||1,s=((c=(h=e.calculative.borderRadius)!=null?h:e.borderRadius)!=null?c:0)*a;t.style.borderRadius=s+"px"}const ve={};function e6(e){e.onDestroy||(e.onDestroy=i6,e.onMove=Td,e.onResize=a6,e.onRotate=Td,e.onValue=s6,e.onChangeId=n6);const t=new Path2D;if(!e.image)return;const a=e.calculative.canvas.store.id+"-"+e.id;if(!ve[a]){const s=new Image;s.crossOrigin=e.crossOrigin||e.calculative.canvas.parent.store.options.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),ve[a]=s,s.onload=()=>{var n;ve[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),Rn(e,s))}}return e.calculative.patchFlags&&ve[a]&&Rn(e,ve[a]),t}function i6(e){const i=e.calculative.canvas.store.id+"-"+e.id;ve[i]&&(ve[i].remove(),ve[i]=void 0)}function Td(e){const i=e.calculative.canvas.store.id+"-"+e.id;!ve[i]||Rn(e,ve[i])}function a6(e){const i=e.calculative.canvas.store.id+"-"+e.id;!ve[i]||Rn(e,ve[i])}function s6(e){const i=e.calculative.canvas.store.id+"-"+e.id;!ve[i]||(Rn(e,ve[i]),ve[i].getAttribute("src")!==e.image&&(ve[i].src=e.image))}function n6(e,t,i){const a=e.calculative.canvas.store.id;!ve[a+"-"+t]||(ve[a+"-"+i]=ve[a+"-"+t],delete ve[a+"-"+t])}function Rn(e,t){t.style.objectFit=e.imageRatio?"contain":"fill",Re(e,t)}function r6(e,t){return e.onResize||(e.onResize=y0,e.onValue=o6),ja(e,t)}function y0(e){const t=e.anchors.filter(i=>i.flag!==1);p0(e),e.anchors=e.anchors.concat(...t)}function o6(e){y0(e),Bs(e)}function p0(e){const t=[],{x:i,y:a,width:s,height:n}=e,r=l6(e),o=5;for(let d=0;di+s-r&&(g=Nr(i+s-r,g+r,f,r,-1)),t.push({id:String(t.length),flag:1,penId:e.id,x:(f-i)/s,y:(g-a)/n})}const l=3;for(let d=0;da+n-r&&(g=Or(g-r,a+n-r,f,r)),t.push({id:String(t.length),flag:1,penId:e.id,x:(g-i)/s,y:(f-a)/n})}const h=5;for(let d=0;di+s-r&&(g=Nr(i+s-r,g-r,f,r)),t.push({id:String(t.length),flag:1,penId:e.id,x:(f-i)/s,y:(g-a)/n})}const c=3;for(let d=0;da+n-r&&(g=Or(g+r,a+n-r,f,r,-1)),t.push({id:String(t.length),flag:1,penId:e.id,x:(g-i)/s,y:(f-a)/n})}e.anchors=t}function l6(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({id:s+"",x:i,y:a,penId:e.id}))}function u6(){return{rectangle:ja,square:a2,circle:s2,htmlDom:ME,svgPath:C5,diamond:F5,triangle:R5,pentagon:S5,pentagram:I5,hexagon:D5,leftArrow:M5,rightArrow:L5,twowayArrow:O5,message:N5,cloud:z5,file:W5,people:U5,line:e5,iframe:iE,video:rE,gif:e6,mindNode:r6,mindLine:c6,mindNode2:ja,form:pE,combine:ja,sceneContainer:kE,sector:WE,chord:HE,polygon:UE,octagon:$E,trapezoid:jE,crosse:YE,rightTriangle:KE,parallelogram:GE,frostedGlassDom:JE}}function f6(){return{triangle:P5,pentagon:T5,pentagram:l0,mindNode:p0,mindLine:h6,rightTriangle:XE,trapezoid:qE,parallelogram:ZE}}var ue;(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"})(ue||(ue={}));class d6{constructor(t){H(this,"parent");H(this,"box");H(this,"boxWidth",320);H(this,"boxHeight",180);H(this,"ratio",this.boxWidth/this.boxHeight);H(this,"padding",5);H(this,"img");H(this,"isShow");H(this,"isDown");H(this,"view");H(this,"timer");H(this,"onMouseDown",t=>{t.preventDefault(),t.stopPropagation(),this.isDown=!0});H(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}});H(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}});H(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 l=.2;t.deltaY.toString().indexOf(".")!==-1&&(l=.01),t.deltaY>0?i=-l:i=l}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 o=this.parent.parent.getRect();a=a/this.boxWidth*o.width+o.x+this.parent.store.data.x,s=s/this.boxHeight*o.height+o.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{this.parent.store.bkImg&&(this.img.src=this.parent.toPng(0,void 0,!0))},300)),Ua(i,t.x,t.y),i.width/i.height>this.ratio){const d=i.width/this.ratio;i.y-=(d-i.height)/2,i.height=d,re(i)}else{const d=i.height*this.ratio;i.x-=(d-i.width)/2,i.width=d,re(i)}const r=this.parent.canvasRect;let o=0,l=0;if(i.x<0)o=-i.x/i.width;else if(i.x+i.width>r.width){let d=0;r.width>i.width&&(d=r.width-i.width),o=(-i.x+d)/i.width}if(i.y<0)l=-i.y/i.height;else if(i.y+i.height>r.height){let d=0;r.height>i.height&&(d=r.height-i.height),l=(-i.y+d)/i.height}const h=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+o*this.boxWidth+"px",this.view.style.width=h*this.boxWidth+"px",this.view.style.top=this.padding+l*this.boxHeight+"px",this.view.style.height=c*this.boxHeight+"px"}}}function zr(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 yn={exports:{}};(function(e,t){(function(i){e.exports=i()})(function(){return function(){return function i(a,s,n){function r(h,c){if(!s[h]){if(!a[h]){var d=typeof zr=="function"&&zr;if(!c&&d)return d(h,!0);if(o)return o(h,!0);var f=new Error("Cannot find module '"+h+"'");throw f.code="MODULE_NOT_FOUND",f}var g=s[h]={exports:{}};a[h][0].call(g.exports,function(m){return r(a[h][1][m]||m)},g,g.exports,i,a,s,n)}return s[h].exports}for(var o=typeof zr=="function"&&zr,l=0;l0&&(L.topicAliasMaximum>65535?b("MqttClient :: options.topicAliasMaximum is out of range"):this.topicAliasRecv=new h(L.topicAliasMaximum)),this.on("connect",function(){const at=this.queue;b("connect :: sending queued packets"),function q(){const W=at.shift();b("deliver :: entry %o",W);let j=null;if(!W)return void Z._resubscribe();j=W.packet,b("deliver :: call _sendPacket for %o",j);let K=!0;j.messageId&&j.messageId!==0&&(Z.messageIdProvider.register(j.messageId)||(K=!1)),K?Z._sendPacket(j,function(U){W.cb&&W.cb(U),q()}):(b("messageId: %d has already used. The message is skipped and removed.",j.messageId),q())}()}),this.on("close",function(){b("close :: connected set to `false`"),this.connected=!1,b("close :: clearing connackTimer"),clearTimeout(this.connackTimer),b("close :: clearing ping timer"),Z.pingTimer!==null&&(Z.pingTimer.clear(),Z.pingTimer=null),this.topicAliasRecv&&this.topicAliasRecv.clear(),b("close :: calling _setupReconnect"),this._setupReconnect()}),o.call(this),b("MqttClient :: setting up stream"),this._setupStream()}m(P,o),P.prototype._setupStream=function(){const T=this,L=new g,$=d.parser(this.options);let Z=null;const at=[];function q(){if(at.length)k(W);else{const K=Z;Z=null,K()}}function W(){b("work :: getting next packet in queue");const K=at.shift();if(K)b("work :: packet pulled from queue"),T._handlePacket(K,q);else{b("work :: no packets in queue");const U=Z;Z=null,b("work :: done flag is %s",!!U),U&&U()}}b("_setupStream :: calling method to clear reconnect"),this._clearReconnect(),b("_setupStream :: using streamBuilder provided to client to create stream"),this.stream=this.streamBuilder(this),$.on("packet",function(K){b("parser :: on packet push to packets array."),at.push(K)}),L._write=function(K,U,tt){Z=tt,b("writable stream :: parsing buffer"),$.parse(K),W()},b("_setupStream :: pipe stream to writable stream"),this.stream.pipe(L),this.stream.on("error",function(K){b("streamErrorHandler :: error",K.message),K.code?(b("streamErrorHandler :: emitting error"),T.emit("error",K)):F(K)}),this.stream.on("close",function(){var K;b("(%s)stream :: on close",T.options.clientId),(K=T.outgoing)&&(b("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])})),b("stream: emit close to MqttClient"),T.emit("close")}),b("_setupStream: sending packet `connect`");const j=Object.create(this.options);if(j.cmd="connect",this.topicAliasRecv&&(j.properties||(j.properties={}),this.topicAliasRecv&&(j.properties.topicAliasMaximum=this.topicAliasRecv.max)),V(this,j),$.on("error",this.emit.bind(this,"error")),this.options.properties){if(!this.options.properties.authenticationMethod&&this.options.properties.authenticationData)return T.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,_({cmd:"auth",reasonCode:0},this.options.authPacket))}this.stream.setMaxListeners(1e3),clearTimeout(this.connackTimer),this.connackTimer=setTimeout(function(){b("!!connectTimeout hit!! Calling _cleanUp with force `true`"),T._cleanUp(!0)},this.options.connectTimeout)},P.prototype._handlePacket=function(T,L){const $=this.options;if($.protocolVersion===5&&$.properties&&$.properties.maximumPacketSize&&$.properties.maximumPacketSize0||!W())&&this._storeProcessingQueue.push({invoke:W,cbStorePut:$.cbStorePut,callback:Z}),this},P.prototype.subscribe=function(){const T=this,L=new Array(arguments.length);for(let st=0;st0){const ht={qos:lt.qos};j===5&&(ht.nl=lt.nl||!1,ht.rap=lt.rap||!1,ht.rh=lt.rh||0,ht.properties=lt.properties),T._resubscribeTopics[lt.topic]=ht,ut.push(lt.topic)}}),T.messageIdToTopic[it.messageId]=ut}return T.outgoing[it.messageId]={volatile:!0,cb:function(ut,lt){if(!ut){const ht=lt.granted;for(let E=0;E0||!tt())&&this._storeProcessingQueue.push({invoke:tt,callback:q}),this},P.prototype.unsubscribe=function(){const T=this,L=new Array(arguments.length);for(let j=0;j0||!W())&&this._storeProcessingQueue.push({invoke:W,callback:Z}),this},P.prototype.end=function(T,L,$){const Z=this;function at(){b("end :: (%s) :: finish :: calling _cleanUp with force %s",Z.options.clientId,T),Z._cleanUp(T,()=>{b("end :: finish :: calling process.nextTick on closeStores"),k(function(){b("end :: closeStores: closing incoming and outgoing stores"),Z.disconnected=!0,Z.incomingStore.close(function(q){Z.outgoingStore.close(function(W){if(b("end :: closeStores: emitting end"),Z.emit("end"),$){const j=q||W;b("end :: closeStores: invoking callback with args"),$(j)}})}),Z._deferredReconnect&&Z._deferredReconnect()}.bind(Z))},L)}return b("end :: (%s)",this.options.clientId),T!=null&&typeof T=="boolean"||($=L||F,L=T,T=!1,typeof L!="object"&&($=L,L=null,typeof $!="function"&&($=F))),typeof L!="object"&&($=L,L=null),b("end :: cb? %s",!!$),$=$||F,this.disconnecting?($(),this):(this._clearReconnect(),this.disconnecting=!0,!T&&Object.keys(this.outgoing).length>0?(b("end :: (%s) :: calling finish in 10ms once outgoing is empty",Z.options.clientId),this.once("outgoingEmpty",setTimeout.bind(null,at,10))):(b("end :: (%s) :: immediately calling finish",Z.options.clientId),at()),this)},P.prototype.removeOutgoingMessage=function(T){const L=this.outgoing[T]?this.outgoing[T].cb:null;return delete this.outgoing[T],this.outgoingStore.del({messageId:T},function(){L(new Error("Message removed"))}),this},P.prototype.reconnect=function(T){b("client reconnect");const L=this,$=function(){T?(L.options.incomingStore=T.incomingStore,L.options.outgoingStore=T.outgoingStore):(L.options.incomingStore=null,L.options.outgoingStore=null),L.incomingStore=L.options.incomingStore||new l,L.outgoingStore=L.options.outgoingStore||new l,L.disconnecting=!1,L.disconnected=!1,L._deferredReconnect=null,L._reconnect()};return this.disconnecting&&!this.disconnected?this._deferredReconnect=$:$(),this},P.prototype._reconnect=function(){b("_reconnect: emitting reconnect to client"),this.emit("reconnect"),this.connected?(this.end(()=>{this._setupStream()}),b("client already connected. disconnecting first.")):(b("_reconnect: calling _setupStream"),this._setupStream())},P.prototype._setupReconnect=function(){const T=this;!T.disconnecting&&!T.reconnectTimer&&T.options.reconnectPeriod>0?(this.reconnecting||(b("_setupReconnect :: emit `offline` state"),this.emit("offline"),b("_setupReconnect :: set `reconnecting` to `true`"),this.reconnecting=!0),b("_setupReconnect :: setting reconnectTimer for %d ms",T.options.reconnectPeriod),T.reconnectTimer=setInterval(function(){b("reconnectTimer :: reconnect triggered!"),T._reconnect()},T.options.reconnectPeriod)):b("_setupReconnect :: doing nothing...")},P.prototype._clearReconnect=function(){b("_clearReconnect : clearing reconnect timer"),this.reconnectTimer&&(clearInterval(this.reconnectTimer),this.reconnectTimer=null)},P.prototype._cleanUp=function(T,L){const $=arguments[2];if(L&&(b("_cleanUp :: done callback provided for on stream close"),this.stream.on("close",L)),b("_cleanUp :: forced? %s",T),T)this.options.reconnectPeriod===0&&this.options.clean&&(Z=this.outgoing)&&(b("flush: queue exists? %b",!!Z),Object.keys(Z).forEach(function(at){typeof Z[at].cb=="function"&&(Z[at].cb(new Error("Connection closed")),delete Z[at])})),b("_cleanUp :: (%s) :: destroying stream",this.options.clientId),this.stream.destroy();else{const at=_({cmd:"disconnect"},$);b("_cleanUp :: (%s) :: call _sendPacket with disconnect packet",this.options.clientId),this._sendPacket(at,R.bind(null,this.stream.end.bind(this.stream)))}var Z;this.disconnecting||(b("_cleanUp :: client not disconnecting. Clearing and resetting reconnect."),this._clearReconnect(),this._setupReconnect()),this.pingTimer!==null&&(b("_cleanUp :: clearing pingTimer"),this.pingTimer.clear(),this.pingTimer=null),L&&!this.connected&&(b("_cleanUp :: (%s) :: removing stream `done` callback `close` listener",this.options.clientId),this.stream.removeListener("close",L),L())},P.prototype._sendPacket=function(T,L,$){b("_sendPacket :: (%s) :: start",this.options.clientId),$=$||F,L=L||F;const Z=function(at,q){if(at.options.protocolVersion===5&&q.cmd==="publish"){let W;q.properties&&(W=q.properties.topicAlias);const j=q.topic.toString();if(at.topicAliasSend)if(W){if(j.length!==0&&(b("applyTopicAlias :: register topic: %s - alias: %d",j,W),!at.topicAliasSend.put(j,W)))return b("applyTopicAlias :: error out of range. topic: %s - alias: %d",j,W),new Error("Sending Topic Alias out of range")}else j.length!==0&&(at.options.autoAssignTopicAlias?(W=at.topicAliasSend.getAliasByTopic(j))?(q.topic="",q.properties={...q.properties,topicAlias:W},b("applyTopicAlias :: auto assign(use) topic: %s - alias: %d",j,W)):(W=at.topicAliasSend.getLruAlias(),at.topicAliasSend.put(j,W),q.properties={...q.properties,topicAlias:W},b("applyTopicAlias :: auto assign topic: %s - alias: %d",j,W)):at.options.autoUseTopicAlias&&(W=at.topicAliasSend.getAliasByTopic(j))&&(q.topic="",q.properties={...q.properties,topicAlias:W},b("applyTopicAlias :: auto use topic: %s - alias: %d",j,W)));else if(W)return b("applyTopicAlias :: error out of range. topic: %s - alias: %d",j,W),new Error("Sending Topic Alias out of range")}}(this,T);if(Z)L(Z);else{if(!this.connected)return T.cmd==="auth"?(this._shiftPingInterval(),void V(this,T,L)):(b("_sendPacket :: client not connected. Storing packet offline."),void this._storePacket(T,L,$));switch(this._shiftPingInterval(),T.cmd){case"publish":break;case"pubrel":return void G(this,T,L,$);default:return void V(this,T,L)}switch(T.qos){case 2:case 1:G(this,T,L,$);break;case 0:default:V(this,T,L)}b("_sendPacket :: (%s) :: end",this.options.clientId)}},P.prototype._storePacket=function(T,L,$){b("_storePacket :: packet: %o",T),b("_storePacket :: cb? %s",!!L),$=$||F;let Z=T;if(Z.cmd==="publish"){const at=D(this,Z=p(T));if(at)return L&&L(at)}(Z.qos||0)===0&&this.queueQoSZero||Z.cmd!=="publish"?this.queue.push({packet:Z,cb:L}):Z.qos>0?(L=this.outgoing[Z.messageId]?this.outgoing[Z.messageId].cb:null,this.outgoingStore.put(Z,function(at){if(at)return L&&L(at);$()})):L&&L(new Error("No connection to broker"))},P.prototype._setupPingTimer=function(){b("_setupPingTimer :: keepalive %d (seconds)",this.options.keepalive);const T=this;!this.pingTimer&&this.options.keepalive&&(this.pingResp=!0,this.pingTimer=y(function(){T._checkPing()},1e3*this.options.keepalive))},P.prototype._shiftPingInterval=function(){this.pingTimer&&this.options.keepalive&&this.options.reschedulePings&&this.pingTimer.reschedule(1e3*this.options.keepalive)},P.prototype._checkPing=function(){b("_checkPing :: checking ping..."),this.pingResp?(b("_checkPing :: ping response received. Clearing flag and sending `pingreq`"),this.pingResp=!1,this._sendPacket({cmd:"pingreq"})):(b("_checkPing :: calling _cleanUp with force true"),this._cleanUp(!0))},P.prototype._handlePingresp=function(){this.pingResp=!0},P.prototype._handleConnack=function(T){b("_handleConnack");const L=this.options,$=L.protocolVersion===5?T.reasonCode:T.returnCode;if(clearTimeout(this.connackTimer),delete this.topicAliasSend,T.properties){if(T.properties.topicAliasMaximum){if(T.properties.topicAliasMaximum>65535)return void this.emit("error",new Error("topicAliasMaximum from broker is out of range"));T.properties.topicAliasMaximum>0&&(this.topicAliasSend=new c(T.properties.topicAliasMaximum))}T.properties.serverKeepAlive&&L.keepalive&&(L.keepalive=T.properties.serverKeepAlive,this._shiftPingInterval()),T.properties.maximumPacketSize&&(L.properties||(L.properties={}),L.properties.maximumPacketSize=T.properties.maximumPacketSize)}if($===0)this.reconnecting=!1,this._onConnect(T);else if($>0){const Z=new Error("Connection refused: "+I[$]);Z.code=$,this.emit("error",Z)}},P.prototype._handleAuth=function(T){const L=this.options.protocolVersion,$=L===5?T.reasonCode:T.returnCode;if(L!==5){const at=new Error("Protocol error: Auth packets are only supported in MQTT 5. Your version:"+L);return at.code=$,void this.emit("error",at)}const Z=this;this.handleAuth(T,function(at,q){if(at)Z.emit("error",at);else if($===24)Z.reconnecting=!1,Z._sendPacket(q);else{const W=new Error("Connection refused: "+I[$]);at.code=$,Z.emit("error",W)}})},P.prototype.handleAuth=function(T,L){L()},P.prototype._handlePublish=function(T,L){b("_handlePublish: packet %o",T),L=L!==void 0?L:F;let $=T.topic.toString();const Z=T.payload,at=T.qos,q=T.messageId,W=this,j=this.options,K=[0,16,128,131,135,144,145,151,153];if(this.options.protocolVersion===5){let U;if(T.properties&&(U=T.properties.topicAlias),U!==void 0)if($.length===0){if(!(U>0&&U<=65535))return b("_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 b("_handlePublish :: unregistered topic alias. alias: %d",U),void this.emit("error",new Error("Received unregistered Topic Alias"));b("_handlePublish :: topic complemented by alias. topic: %s - alias: %d",$=tt,U)}}else{if(!this.topicAliasRecv.put($,U))return b("_handlePublish :: topic alias out of range. alias: %d",U),void this.emit("error",new Error("Received Topic Alias is out of range"));b("_handlePublish :: registered topic: %s - alias: %d",$,U)}}switch(b("_handlePublish: qos %d",at),at){case 2:j.customHandleAcks($,Z,T,function(U,tt){return U instanceof Error||(tt=U,U=null),U?W.emit("error",U):K.indexOf(tt)===-1?W.emit("error",new Error("Wrong reason code for pubrec")):void(tt?W._sendPacket({cmd:"pubrec",messageId:q,reasonCode:tt},L):W.incomingStore.put(T,function(){W._sendPacket({cmd:"pubrec",messageId:q},L)}))});break;case 1:j.customHandleAcks($,Z,T,function(U,tt){return U instanceof Error||(tt=U,U=null),U?W.emit("error",U):K.indexOf(tt)===-1?W.emit("error",new Error("Wrong reason code for puback")):(tt||W.emit("message",$,Z,T),void W.handleMessage(T,function(st){if(st)return L&&L(st);W._sendPacket({cmd:"puback",messageId:q,reasonCode:tt},L)}))});break;case 0:this.emit("message",$,Z,T),this.handleMessage(T,L);break;default:b("_handlePublish: unknown QoS. Doing nothing.")}},P.prototype.handleMessage=function(T,L){L()},P.prototype._handleAck=function(T){const L=T.messageId,$=T.cmd;let Z=null;const at=this.outgoing[L]?this.outgoing[L].cb:null,q=this;let W;if(at){switch(b("_handleAck :: packet type",$),$){case"pubcomp":case"puback":{const j=T.reasonCode;j&&j>0&&j!==16&&((W=new Error("Publish error: "+I[j])).code=j,at(W,T)),delete this.outgoing[L],this.outgoingStore.del(T,at),this.messageIdProvider.deallocate(L),this._invokeStoreProcessingQueue();break}case"pubrec":{Z={cmd:"pubrel",qos:2,messageId:L};const j=T.reasonCode;j&&j>0&&j!==16?((W=new Error("Publish error: "+I[j])).code=j,at(W,T)):this._sendPacket(Z);break}case"suback":delete this.outgoing[L],this.messageIdProvider.deallocate(L);for(let j=0;j0)if(this.options.resubscribe)if(this.options.protocolVersion===5){b("_resubscribe: protocolVersion 5");for(let L=0;L0){const T=this._storeProcessingQueue[0];if(T&&T.invoke())return this._storeProcessingQueue.shift(),!0}return!1},P.prototype._invokeAllStoreProcessingQueue=function(){for(;this._invokeStoreProcessingQueue(););},P.prototype._flushStoreProcessingQueue=function(){for(const T of this._storeProcessingQueue)T.cbStorePut&&T.cbStorePut(new Error("Connection closed")),T.callback&&T.callback(new Error("Connection closed"));this._storeProcessingQueue.splice(0)},a.exports=P}).call(this)}).call(this,i("_process"),typeof Oe<"u"?Oe: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,o=i("duplexify");let l,h,c,d=!1;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 m=g.protocolId==="MQIsdp"&&g.protocolVersion===3?"mqttv3.1":"mqtt";(function(p){p.hostname||(p.hostname="localhost"),p.path||(p.path="/"),p.wsOptions||(p.wsOptions={})})(g);const y=function(p,x){const _=p.protocol==="alis"?"wss":"ws";let b=_+"://"+p.hostname+p.path;return p.port&&p.port!==80&&p.port!==443&&(b=_+"://"+p.hostname+":"+p.port+p.path),typeof p.transformWsUrl=="function"&&(b=p.transformWsUrl(b,p,x)),b}(g,f);return(l=g.my).connectSocket({url:y,protocols:m}),h=function(){const p=new r;return p._write=function(x,_,b){l.sendSocketMessage({data:x.buffer,success:function(){b()},fail:function(){b(new Error)}})},p._flush=function(x){l.closeSocket({success:function(){x()}})},p}(),c=o.obj(),d||(d=!0,l.onSocketOpen(function(){c.setReadable(h),c.setWritable(h),c.emit("connect")}),l.onSocketMessage(function(p){if(typeof p.data=="string"){const x=n.from(p.data,"base64");h.push(x)}else{const x=new FileReader;x.addEventListener("load",function(){let _=x.result;_=_ instanceof ArrayBuffer?n.from(_):n.from(_,"utf8"),h.push(_)}),x.readAsArrayBuffer(p.data)}}),l.onSocketClose(function(){c.end(),c.destroy()}),l.onSocketError(function(p){c.destroy(p)})),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(o,l){l.port=l.port||1883,l.hostname=l.hostname||l.host||"localhost";const h=l.port,c=l.hostname;return r("port %d and host %s",h,c),n.createConnection(h,c)}},{debug:18,net:16}],4:[function(i,a,s){const n=i("tls"),r=i("net"),o=i("debug")("mqttjs:tls");a.exports=function(l,h){h.port=h.port||8883,h.host=h.hostname||h.host||"localhost",r.isIP(h.host)===0&&(h.servername=h.host),h.rejectUnauthorized=h.rejectUnauthorized!==!1,delete h.path,o("port %d host %s rejectUnauthorized %b",h.port,h.host,h.rejectUnauthorized);const c=n.connect(h);function d(f){h.rejectUnauthorized&&l.emit("error",f),c.end()}return c.on("secureConnect",function(){h.rejectUnauthorized&&!c.authorized?c.emit("error",new Error("TLS not authorized")):c.removeListener("error",d)}),c.on("error",d),c}},{debug:18,net:16,tls:16}],5:[function(i,a,s){(function(n){(function(){const{Buffer:r}=i("buffer"),o=i("ws"),l=i("debug")("mqttjs:ws"),h=i("duplexify"),c=i("readable-stream").Transform,d=["rejectUnauthorized","ca","cert","key","pfx","passphrase"],f=n!==void 0&&n.title==="browser"||typeof __webpack_require__=="function";function g(y,p){let x=y.protocol+"://"+y.hostname+":"+y.port+y.path;return typeof y.transformWsUrl=="function"&&(x=y.transformWsUrl(x,y,p)),x}function m(y){const p=y;return y.hostname||(p.hostname="localhost"),y.port||(y.protocol==="wss"?p.port=443:p.port=80),y.path||(p.path="/"),y.wsOptions||(p.wsOptions={}),f||y.protocol!=="wss"||d.forEach(function(x){Object.prototype.hasOwnProperty.call(y,x)&&!Object.prototype.hasOwnProperty.call(y.wsOptions,x)&&(p.wsOptions[x]=y[x])}),p}a.exports=f?function(y,p){let x;l("browserStreamBuilder");const _=function(T){const L=m(T);if(L.hostname||(L.hostname=L.host),!L.hostname){if(typeof document>"u")throw new Error("Could not determine host. Specify host manually.");const $=new URL(document.URL);L.hostname=$.hostname,L.port||(L.port=$.port)}return L.objectMode===void 0&&(L.objectMode=!(L.binary===!0||L.binary===void 0)),L}(p).browserBufferSize||524288,b=p.browserBufferTimeout||1e3,k=!p.objectMode,R=function(T,L){const $=L.protocolId==="MQIsdp"&&L.protocolVersion===3?"mqttv3.1":"mqtt",Z=g(L,T),at=new WebSocket(Z,[$]);return at.binaryType="arraybuffer",at}(y,p),S=function(T,L,$){const Z=new c({objectModeMode:T.objectMode});return Z._write=L,Z._flush=$,Z}(p,function T(L,$,Z){R.bufferedAmount>_&&setTimeout(T,b,L,$,Z),k&&typeof L=="string"&&(L=r.from(L,"utf8"));try{R.send(L)}catch(at){return Z(at)}Z()},function(T){R.close(),T()});p.objectMode||(S._writev=P),S.on("close",()=>{R.close()});const I=R.addEventListener!==void 0;function D(){x.setReadable(S),x.setWritable(S),x.emit("connect")}function V(){x.end(),x.destroy()}function G(T){x.destroy(T)}function F(T){let L=T.data;L=L instanceof ArrayBuffer?r.from(L):r.from(L,"utf8"),S.push(L)}function P(T,L){const $=new Array(T.length);for(let Z=0;Z{k.destroy()}),k}}).call(this)}).call(this,i("_process"))},{_process:50,buffer:17,debug:18,duplexify:20,"readable-stream":69,ws:80}],6:[function(i,a,s){const{Buffer:n}=i("buffer"),r=i("readable-stream").Transform,o=i("duplexify");let l,h,c;a.exports=function(d,f){if(f.hostname=f.hostname||f.host,!f.hostname)throw new Error("Could not determine host. Specify host manually.");const g=f.protocolId==="MQIsdp"&&f.protocolVersion===3?"mqttv3.1":"mqtt";(function(p){p.hostname||(p.hostname="localhost"),p.path||(p.path="/"),p.wsOptions||(p.wsOptions={})})(f);const m=function(p,x){const _=p.protocol==="wxs"?"wss":"ws";let b=_+"://"+p.hostname+p.path;return p.port&&p.port!==80&&p.port!==443&&(b=_+"://"+p.hostname+":"+p.port+p.path),typeof p.transformWsUrl=="function"&&(b=p.transformWsUrl(b,p,x)),b}(f,d);l=wx.connectSocket({url:m,protocols:[g]}),h=function(){const p=new r;return p._write=function(x,_,b){l.send({data:x.buffer,success:function(){b()},fail:function(k){b(new Error(k))}})},p._flush=function(x){l.close({success:function(){x()}})},p}(),(c=o.obj())._destroy=function(p,x){l.close({success:function(){x&&x(p)}})};const y=c.destroy;return c.destroy=function(){c.destroy=y;const p=this;setTimeout(function(){l.close({fail:function(){p._destroy(new Error)}})},0)}.bind(c),l.onOpen(function(){c.setReadable(h),c.setWritable(h),c.emit("connect")}),l.onMessage(function(p){let x=p.data;x=x instanceof ArrayBuffer?n.from(x):n.from(x,"utf8"),h.push(x)}),l.onClose(function(){c.end(),c.destroy()}),l.onError(function(p){c.destroy(new Error(p.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,o={objectMode:!0},l={clean:!0};function h(c){if(!(this instanceof h))return new h(c);this.options=c||{},this.options=n(l,c),this._inflights=new Map}h.prototype.put=function(c,d){return this._inflights.set(c.messageId,c),d&&d(),this},h.prototype.createStream=function(){const c=new r(o),d=[];let f=!1,g=0;return this._inflights.forEach(function(m,y){d.push(m)}),c._read=function(){!f&&gthis.max)&&(this.aliasToTopic[o]=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 o(l){if(!(this instanceof o))return new o(l);l>0&&(this.aliasToTopic=new n({max:l}),this.topicToAlias={},this.numberAllocator=new r(1,l),this.max=l,this.length=0)}o.prototype.put=function(l,h){if(h===0||h>this.max)return!1;const c=this.aliasToTopic.get(h);return c&&delete this.topicToAlias[c],this.aliasToTopic.set(h,l),this.topicToAlias[l]=h,this.numberAllocator.use(h),this.length=this.aliasToTopic.length,!0},o.prototype.getTopicByAlias=function(l){return this.aliasToTopic.get(l)},o.prototype.getAliasByTopic=function(l){const h=this.topicToAlias[l];return h!==void 0&&this.aliasToTopic.get(h),h},o.prototype.clear=function(){this.aliasToTopic.reset(),this.topicToAlias={},this.numberAllocator.clear(),this.length=0},o.prototype.getLruAlias=function(){return this.numberAllocator.firstVacant()||this.aliasToTopic.keys()[this.aliasToTopic.length-1]},a.exports=o},{"lru-cache":37,"number-allocator":46}],11:[function(i,a,s){function n(r){const o=r.split("/");for(let l=0;l0?x-4:x;for(y=0;y>16&255,b[k++]=m>>8&255,b[k++]=255&m;return _===2&&(m=r[g.charCodeAt(y)]<<2|r[g.charCodeAt(y+1)]>>4,b[k++]=255&m),_===1&&(m=r[g.charCodeAt(y)]<<10|r[g.charCodeAt(y+1)]<<4|r[g.charCodeAt(y+2)]>>2,b[k++]=m>>8&255,b[k++]=255&m),b},s.fromByteArray=function(g){for(var m,y=g.length,p=y%3,x=[],_=0,b=y-p;_b?b:_+16383));return p===1?(m=g[y-1],x.push(n[m>>2]+n[m<<4&63]+"==")):p===2&&(m=(g[y-2]<<8)+g[y-1],x.push(n[m>>10]+n[m>>4&63]+n[m<<2&63]+"=")),x.join("")};for(var n=[],r=[],o=typeof Uint8Array<"u"?Uint8Array:Array,l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",h=0,c=l.length;h0)throw new Error("Invalid string. Length must be a multiple of 4");var y=g.indexOf("=");return y===-1&&(y=m),[y,y===m?0:4-y%4]}function f(g,m,y){for(var p,x,_=[],b=m;b>18&63]+n[x>>12&63]+n[x>>6&63]+n[63&x]);return _.join("")}r["-".charCodeAt(0)]=62,r["_".charCodeAt(0)]=63},{}],14:[function(i,a,s){const{Buffer:n}=i("buffer"),r=Symbol.for("BufferList");function o(l){if(!(this instanceof o))return new o(l);o._init.call(this,l)}o._init=function(l){Object.defineProperty(this,r,{value:!0}),this._bufs=[],this.length=0,l&&this.append(l)},o.prototype._new=function(l){return new o(l)},o.prototype._offset=function(l){if(l===0)return[0,0];let h=0;for(let c=0;cthis.length||l<0)return;const h=this._offset(l);return this._bufs[h[0]][h[1]]},o.prototype.slice=function(l,h){return typeof l=="number"&&l<0&&(l+=this.length),typeof h=="number"&&h<0&&(h+=this.length),this.copy(null,0,l,h)},o.prototype.copy=function(l,h,c,d){if((typeof c!="number"||c<0)&&(c=0),(typeof d!="number"||d>this.length)&&(d=this.length),c>=this.length||d<=0)return l||n.alloc(0);const f=!!l,g=this._offset(c),m=d-c;let y=m,p=f&&h||0,x=g[1];if(c===0&&d===this.length){if(!f)return this._bufs.length===1?this._bufs[0]:n.concat(this._bufs,this.length);for(let _=0;_b)){this._bufs[_].copy(l,p,x,x+y),p+=b;break}this._bufs[_].copy(l,p,x),p+=b,y-=b,x&&(x=0)}return l.length>p?l.slice(0,p):l},o.prototype.shallowSlice=function(l,h){if(l=l||0,h=typeof h!="number"?this.length:h,l<0&&(l+=this.length),h<0&&(h+=this.length),l===h)return this._new();const c=this._offset(l),d=this._offset(h),f=this._bufs.slice(c[0],d[0]+1);return d[1]===0?f.pop():f[f.length-1]=f[f.length-1].slice(0,d[1]),c[1]!==0&&(f[0]=f[0].slice(c[1])),this._new(f)},o.prototype.toString=function(l,h,c){return this.slice(h,c).toString(l)},o.prototype.consume=function(l){if(l=Math.trunc(l),Number.isNaN(l)||l<=0)return this;for(;this._bufs.length;){if(!(l>=this._bufs[0].length)){this._bufs[0]=this._bufs[0].slice(l),this.length-=l;break}l-=this._bufs[0].length,this.length-=this._bufs[0].length,this._bufs.shift()}return this},o.prototype.duplicate=function(){const l=this._new();for(let h=0;hthis.length?this.length:h;const d=this._offset(h);let f=d[0],g=d[1];for(;f=l.length){const y=m.indexOf(l,g);if(y!==-1)return this._reverseOffset([f,y]);g=m.length-l.length+1}else{const y=this._reverseOffset([f,g]);if(this._match(y,l))return y;g++}g=0}return-1},o.prototype._match=function(l,h){if(this.length-ll)throw new RangeError('The value "'+E+'" is invalid for option "size"');var A=new Uint8Array(E);return A.__proto__=c.prototype,A}function c(E,A,B){if(typeof E=="number"){if(typeof A=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return g(E)}return d(E,A,B)}function d(E,A,B){if(typeof E=="string")return function(J,rt){if(typeof rt=="string"&&rt!==""||(rt="utf8"),!c.isEncoding(rt))throw new TypeError("Unknown encoding: "+rt);var yt=0|p(J,rt),mt=h(yt),Et=mt.write(J,rt);return Et!==yt&&(mt=mt.slice(0,Et)),mt}(E,A);if(ArrayBuffer.isView(E))return m(E);if(E==null)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof E);if(lt(E,ArrayBuffer)||E&<(E.buffer,ArrayBuffer))return function(J,rt,yt){if(rt<0||J.byteLength=l)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+l.toString(16)+" bytes");return 0|E}function p(E,A){if(c.isBuffer(E))return E.length;if(ArrayBuffer.isView(E)||lt(E,ArrayBuffer))return E.byteLength;if(typeof E!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof E);var B=E.length,N=arguments.length>2&&arguments[2]===!0;if(!N&&B===0)return 0;for(var X=!1;;)switch(A){case"ascii":case"latin1":case"binary":return B;case"utf8":case"utf-8":return st(E).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*B;case"hex":return B>>>1;case"base64":return it(E).length;default:if(X)return N?-1:st(E).length;A=(""+A).toLowerCase(),X=!0}}function x(E,A,B){var N=E[A];E[A]=E[B],E[B]=N}function _(E,A,B,N,X){if(E.length===0)return-1;if(typeof B=="string"?(N=B,B=0):B>2147483647?B=2147483647:B<-2147483648&&(B=-2147483648),ht(B=+B)&&(B=X?0:E.length-1),B<0&&(B=E.length+B),B>=E.length){if(X)return-1;B=E.length-1}else if(B<0){if(!X)return-1;B=0}if(typeof A=="string"&&(A=c.from(A,N)),c.isBuffer(A))return A.length===0?-1:b(E,A,B,N,X);if(typeof A=="number")return A&=255,typeof Uint8Array.prototype.indexOf=="function"?X?Uint8Array.prototype.indexOf.call(E,A,B):Uint8Array.prototype.lastIndexOf.call(E,A,B):b(E,[A],B,N,X);throw new TypeError("val must be string, number or Buffer")}function b(E,A,B,N,X){var J,rt=1,yt=E.length,mt=A.length;if(N!==void 0&&((N=String(N).toLowerCase())==="ucs2"||N==="ucs-2"||N==="utf16le"||N==="utf-16le")){if(E.length<2||A.length<2)return-1;rt=2,yt/=2,mt/=2,B/=2}function Et(oe,Vt){return rt===1?oe[Vt]:oe.readUInt16BE(Vt*rt)}if(X){var Ft=-1;for(J=B;Jyt&&(B=yt-mt),J=B;J>=0;J--){for(var Ge=!0,we=0;weX&&(N=X):N=X;var J=A.length;N>J/2&&(N=J/2);for(var rt=0;rt>8,mt=rt%256,Et.push(mt),Et.push(yt);return Et}(A,E.length-B),E,B,N)}function G(E,A,B){return A===0&&B===E.length?r.fromByteArray(E):r.fromByteArray(E.slice(A,B))}function F(E,A,B){B=Math.min(E.length,B);for(var N=[],X=A;X239?4:Et>223?3:Et>191?2:1;if(X+Ge<=B)switch(Ge){case 1:Et<128&&(Ft=Et);break;case 2:(192&(J=E[X+1]))==128&&(mt=(31&Et)<<6|63&J)>127&&(Ft=mt);break;case 3:J=E[X+1],rt=E[X+2],(192&J)==128&&(192&rt)==128&&(mt=(15&Et)<<12|(63&J)<<6|63&rt)>2047&&(mt<55296||mt>57343)&&(Ft=mt);break;case 4:J=E[X+1],rt=E[X+2],yt=E[X+3],(192&J)==128&&(192&rt)==128&&(192&yt)==128&&(mt=(15&Et)<<18|(63&J)<<12|(63&rt)<<6|63&yt)>65535&&mt<1114112&&(Ft=mt)}Ft===null?(Ft=65533,Ge=1):Ft>65535&&(Ft-=65536,N.push(Ft>>>10&1023|55296),Ft=56320|1023&Ft),N.push(Ft),X+=Ge}return function(we){var oe=we.length;if(oe<=P)return String.fromCharCode.apply(String,we);for(var Vt="",Gt=0;Gt"u"||typeof console.error!="function"||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(c.prototype,"parent",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.buffer}}),Object.defineProperty(c.prototype,"offset",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.byteOffset}}),typeof Symbol<"u"&&Symbol.species!=null&&c[Symbol.species]===c&&Object.defineProperty(c,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),c.poolSize=8192,c.from=function(E,A,B){return d(E,A,B)},c.prototype.__proto__=Uint8Array.prototype,c.__proto__=Uint8Array,c.alloc=function(E,A,B){return function(N,X,J){return f(N),N<=0?h(N):X!==void 0?typeof J=="string"?h(N).fill(X,J):h(N).fill(X):h(N)}(E,A,B)},c.allocUnsafe=function(E){return g(E)},c.allocUnsafeSlow=function(E){return g(E)},c.isBuffer=function(E){return E!=null&&E._isBuffer===!0&&E!==c.prototype},c.compare=function(E,A){if(lt(E,Uint8Array)&&(E=c.from(E,E.offset,E.byteLength)),lt(A,Uint8Array)&&(A=c.from(A,A.offset,A.byteLength)),!c.isBuffer(E)||!c.isBuffer(A))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(E===A)return 0;for(var B=E.length,N=A.length,X=0,J=Math.min(B,N);Xthis.length||((N===void 0||N>this.length)&&(N=this.length),N<=0)||(N>>>=0)<=(B>>>=0))return"";for(A||(A="utf8");;)switch(A){case"hex":return $(this,B,N);case"utf8":case"utf-8":return F(this,B,N);case"ascii":return T(this,B,N);case"latin1":case"binary":return L(this,B,N);case"base64":return G(this,B,N);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Z(this,B,N);default:if(X)throw new TypeError("Unknown encoding: "+A);A=(A+"").toLowerCase(),X=!0}}.apply(this,arguments)},c.prototype.toLocaleString=c.prototype.toString,c.prototype.equals=function(E){if(!c.isBuffer(E))throw new TypeError("Argument must be a Buffer");return this===E||c.compare(this,E)===0},c.prototype.inspect=function(){var E="",A=s.INSPECT_MAX_BYTES;return E=this.toString("hex",0,A).replace(/(.{2})/g,"$1 ").trim(),this.length>A&&(E+=" ... "),""},c.prototype.compare=function(E,A,B,N,X){if(lt(E,Uint8Array)&&(E=c.from(E,E.offset,E.byteLength)),!c.isBuffer(E))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof E);if(A===void 0&&(A=0),B===void 0&&(B=E?E.length:0),N===void 0&&(N=0),X===void 0&&(X=this.length),A<0||B>E.length||N<0||X>this.length)throw new RangeError("out of range index");if(N>=X&&A>=B)return 0;if(N>=X)return-1;if(A>=B)return 1;if(A>>>=0,B>>>=0,N>>>=0,X>>>=0,this===E)return 0;for(var J=X-N,rt=B-A,yt=Math.min(J,rt),mt=this.slice(N,X),Et=E.slice(A,B),Ft=0;Ft>>=0,isFinite(B)?(B>>>=0,N===void 0&&(N="utf8")):(N=B,B=void 0)}var X=this.length-A;if((B===void 0||B>X)&&(B=X),E.length>0&&(B<0||A<0)||A>this.length)throw new RangeError("Attempt to write outside buffer bounds");N||(N="utf8");for(var J=!1;;)switch(N){case"hex":return k(this,E,A,B);case"utf8":case"utf-8":return R(this,E,A,B);case"ascii":return S(this,E,A,B);case"latin1":case"binary":return I(this,E,A,B);case"base64":return D(this,E,A,B);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return V(this,E,A,B);default:if(J)throw new TypeError("Unknown encoding: "+N);N=(""+N).toLowerCase(),J=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var P=4096;function T(E,A,B){var N="";B=Math.min(E.length,B);for(var X=A;XN)&&(B=N);for(var X="",J=A;JB)throw new RangeError("Trying to access beyond buffer length")}function q(E,A,B,N,X,J){if(!c.isBuffer(E))throw new TypeError('"buffer" argument must be a Buffer instance');if(A>X||AE.length)throw new RangeError("Index out of range")}function W(E,A,B,N,X,J){if(B+N>E.length)throw new RangeError("Index out of range");if(B<0)throw new RangeError("Index out of range")}function j(E,A,B,N,X){return A=+A,B>>>=0,X||W(E,0,B,4),o.write(E,A,B,N,23,4),B+4}function K(E,A,B,N,X){return A=+A,B>>>=0,X||W(E,0,B,8),o.write(E,A,B,N,52,8),B+8}c.prototype.slice=function(E,A){var B=this.length;E=~~E,A=A===void 0?B:~~A,E<0?(E+=B)<0&&(E=0):E>B&&(E=B),A<0?(A+=B)<0&&(A=0):A>B&&(A=B),A>>=0,A>>>=0,B||at(E,A,this.length);for(var N=this[E],X=1,J=0;++J>>=0,A>>>=0,B||at(E,A,this.length);for(var N=this[E+--A],X=1;A>0&&(X*=256);)N+=this[E+--A]*X;return N},c.prototype.readUInt8=function(E,A){return E>>>=0,A||at(E,1,this.length),this[E]},c.prototype.readUInt16LE=function(E,A){return E>>>=0,A||at(E,2,this.length),this[E]|this[E+1]<<8},c.prototype.readUInt16BE=function(E,A){return E>>>=0,A||at(E,2,this.length),this[E]<<8|this[E+1]},c.prototype.readUInt32LE=function(E,A){return E>>>=0,A||at(E,4,this.length),(this[E]|this[E+1]<<8|this[E+2]<<16)+16777216*this[E+3]},c.prototype.readUInt32BE=function(E,A){return E>>>=0,A||at(E,4,this.length),16777216*this[E]+(this[E+1]<<16|this[E+2]<<8|this[E+3])},c.prototype.readIntLE=function(E,A,B){E>>>=0,A>>>=0,B||at(E,A,this.length);for(var N=this[E],X=1,J=0;++J=(X*=128)&&(N-=Math.pow(2,8*A)),N},c.prototype.readIntBE=function(E,A,B){E>>>=0,A>>>=0,B||at(E,A,this.length);for(var N=A,X=1,J=this[E+--N];N>0&&(X*=256);)J+=this[E+--N]*X;return J>=(X*=128)&&(J-=Math.pow(2,8*A)),J},c.prototype.readInt8=function(E,A){return E>>>=0,A||at(E,1,this.length),128&this[E]?-1*(255-this[E]+1):this[E]},c.prototype.readInt16LE=function(E,A){E>>>=0,A||at(E,2,this.length);var B=this[E]|this[E+1]<<8;return 32768&B?4294901760|B:B},c.prototype.readInt16BE=function(E,A){E>>>=0,A||at(E,2,this.length);var B=this[E+1]|this[E]<<8;return 32768&B?4294901760|B:B},c.prototype.readInt32LE=function(E,A){return E>>>=0,A||at(E,4,this.length),this[E]|this[E+1]<<8|this[E+2]<<16|this[E+3]<<24},c.prototype.readInt32BE=function(E,A){return E>>>=0,A||at(E,4,this.length),this[E]<<24|this[E+1]<<16|this[E+2]<<8|this[E+3]},c.prototype.readFloatLE=function(E,A){return E>>>=0,A||at(E,4,this.length),o.read(this,E,!0,23,4)},c.prototype.readFloatBE=function(E,A){return E>>>=0,A||at(E,4,this.length),o.read(this,E,!1,23,4)},c.prototype.readDoubleLE=function(E,A){return E>>>=0,A||at(E,8,this.length),o.read(this,E,!0,52,8)},c.prototype.readDoubleBE=function(E,A){return E>>>=0,A||at(E,8,this.length),o.read(this,E,!1,52,8)},c.prototype.writeUIntLE=function(E,A,B,N){E=+E,A>>>=0,B>>>=0,N||q(this,E,A,B,Math.pow(2,8*B)-1,0);var X=1,J=0;for(this[A]=255&E;++J>>=0,B>>>=0,N||q(this,E,A,B,Math.pow(2,8*B)-1,0);var X=B-1,J=1;for(this[A+X]=255&E;--X>=0&&(J*=256);)this[A+X]=E/J&255;return A+B},c.prototype.writeUInt8=function(E,A,B){return E=+E,A>>>=0,B||q(this,E,A,1,255,0),this[A]=255&E,A+1},c.prototype.writeUInt16LE=function(E,A,B){return E=+E,A>>>=0,B||q(this,E,A,2,65535,0),this[A]=255&E,this[A+1]=E>>>8,A+2},c.prototype.writeUInt16BE=function(E,A,B){return E=+E,A>>>=0,B||q(this,E,A,2,65535,0),this[A]=E>>>8,this[A+1]=255&E,A+2},c.prototype.writeUInt32LE=function(E,A,B){return E=+E,A>>>=0,B||q(this,E,A,4,4294967295,0),this[A+3]=E>>>24,this[A+2]=E>>>16,this[A+1]=E>>>8,this[A]=255&E,A+4},c.prototype.writeUInt32BE=function(E,A,B){return E=+E,A>>>=0,B||q(this,E,A,4,4294967295,0),this[A]=E>>>24,this[A+1]=E>>>16,this[A+2]=E>>>8,this[A+3]=255&E,A+4},c.prototype.writeIntLE=function(E,A,B,N){if(E=+E,A>>>=0,!N){var X=Math.pow(2,8*B-1);q(this,E,A,B,X-1,-X)}var J=0,rt=1,yt=0;for(this[A]=255&E;++J>0)-yt&255;return A+B},c.prototype.writeIntBE=function(E,A,B,N){if(E=+E,A>>>=0,!N){var X=Math.pow(2,8*B-1);q(this,E,A,B,X-1,-X)}var J=B-1,rt=1,yt=0;for(this[A+J]=255&E;--J>=0&&(rt*=256);)E<0&&yt===0&&this[A+J+1]!==0&&(yt=1),this[A+J]=(E/rt>>0)-yt&255;return A+B},c.prototype.writeInt8=function(E,A,B){return E=+E,A>>>=0,B||q(this,E,A,1,127,-128),E<0&&(E=255+E+1),this[A]=255&E,A+1},c.prototype.writeInt16LE=function(E,A,B){return E=+E,A>>>=0,B||q(this,E,A,2,32767,-32768),this[A]=255&E,this[A+1]=E>>>8,A+2},c.prototype.writeInt16BE=function(E,A,B){return E=+E,A>>>=0,B||q(this,E,A,2,32767,-32768),this[A]=E>>>8,this[A+1]=255&E,A+2},c.prototype.writeInt32LE=function(E,A,B){return E=+E,A>>>=0,B||q(this,E,A,4,2147483647,-2147483648),this[A]=255&E,this[A+1]=E>>>8,this[A+2]=E>>>16,this[A+3]=E>>>24,A+4},c.prototype.writeInt32BE=function(E,A,B){return E=+E,A>>>=0,B||q(this,E,A,4,2147483647,-2147483648),E<0&&(E=4294967295+E+1),this[A]=E>>>24,this[A+1]=E>>>16,this[A+2]=E>>>8,this[A+3]=255&E,A+4},c.prototype.writeFloatLE=function(E,A,B){return j(this,E,A,!0,B)},c.prototype.writeFloatBE=function(E,A,B){return j(this,E,A,!1,B)},c.prototype.writeDoubleLE=function(E,A,B){return K(this,E,A,!0,B)},c.prototype.writeDoubleBE=function(E,A,B){return K(this,E,A,!1,B)},c.prototype.copy=function(E,A,B,N){if(!c.isBuffer(E))throw new TypeError("argument should be a Buffer");if(B||(B=0),N||N===0||(N=this.length),A>=E.length&&(A=E.length),A||(A=0),N>0&&N=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),E.length-A=0;--J)E[J+A]=this[J+B];else Uint8Array.prototype.set.call(E,this.subarray(B,N),A);return X},c.prototype.fill=function(E,A,B,N){if(typeof E=="string"){if(typeof A=="string"?(N=A,A=0,B=this.length):typeof B=="string"&&(N=B,B=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(E.length===1){var X=E.charCodeAt(0);(N==="utf8"&&X<128||N==="latin1")&&(E=X)}}else typeof E=="number"&&(E&=255);if(A<0||this.length>>=0,B=B===void 0?this.length:B>>>0,E||(E=0),typeof E=="number")for(J=A;J55295&&B<57344){if(!X){if(B>56319){(A-=3)>-1&&J.push(239,191,189);continue}if(rt+1===N){(A-=3)>-1&&J.push(239,191,189);continue}X=B;continue}if(B<56320){(A-=3)>-1&&J.push(239,191,189),X=B;continue}B=65536+(X-55296<<10|B-56320)}else X&&(A-=3)>-1&&J.push(239,191,189);if(X=null,B<128){if((A-=1)<0)break;J.push(B)}else if(B<2048){if((A-=2)<0)break;J.push(B>>6|192,63&B|128)}else if(B<65536){if((A-=3)<0)break;J.push(B>>12|224,B>>6&63|128,63&B|128)}else{if(!(B<1114112))throw new Error("Invalid code point");if((A-=4)<0)break;J.push(B>>18|240,B>>12&63|128,B>>6&63|128,63&B|128)}}return J}function it(E){return r.toByteArray(function(A){if((A=(A=A.split("=")[0]).trim().replace(U,"")).length<2)return"";for(;A.length%4!=0;)A+="=";return A}(E))}function ut(E,A,B,N){for(var X=0;X=A.length||X>=E.length);++X)A[X+B]=E[X];return X}function lt(E,A){return E instanceof A||E!=null&&E.constructor!=null&&E.constructor.name!=null&&E.constructor.name===A.name}function ht(E){return E!=E}}).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(o){if(o[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+o[0]+(this.useColors?"%c ":" ")+"+"+a.exports.humanize(this.diff),!this.useColors)return;const l="color: "+this.color;o.splice(1,0,l,"color: inherit");let h=0,c=0;o[0].replace(/%[a-zA-Z%]/g,d=>{d!=="%%"&&d==="%c"&&(c=++h)}),o.splice(c,0,l)},s.save=function(o){try{o?s.storage.setItem("debug",o):s.storage.removeItem("debug")}catch{}},s.load=function(){let o;try{o=s.storage.getItem("debug")}catch{}return!o&&n!==void 0&&"env"in n&&(o=n.env.DEBUG),o},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 o=!1;return()=>{o||(o=!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(o){try{return JSON.stringify(o)}catch(l){return"[UnexpectedJSONParseError]: "+l.message}}}).call(this)}).call(this,i("_process"))},{"./common":19,_process:50}],19:[function(i,a,s){a.exports=function(n){function r(h){let c,d,f,g=null;function m(...y){if(!m.enabled)return;const p=m,x=Number(new Date),_=x-(c||x);p.diff=_,p.prev=c,p.curr=x,c=x,y[0]=r.coerce(y[0]),typeof y[0]!="string"&&y.unshift("%O");let b=0;y[0]=y[0].replace(/%([a-zA-Z%])/g,(k,R)=>{if(k==="%%")return"%";b++;const S=r.formatters[R];if(typeof S=="function"){const I=y[b];k=S.call(p,I),y.splice(b,1),b--}return k}),r.formatArgs.call(p,y),(p.log||r.log).apply(p,y)}return m.namespace=h,m.useColors=r.useColors(),m.color=r.selectColor(h),m.extend=o,m.destroy=r.destroy,Object.defineProperty(m,"enabled",{enumerable:!0,configurable:!1,get:()=>g!==null?g:(d!==r.namespaces&&(d=r.namespaces,f=r.enabled(h)),f),set:y=>{g=y}}),typeof r.init=="function"&&r.init(m),m}function o(h,c){const d=r(this.namespace+(c===void 0?":":c)+h);return d.log=this.log,d}function l(h){return h.toString().substring(2,h.toString().length-2).replace(/\.\*\?$/,"*")}return r.debug=r,r.default=r,r.coerce=function(h){return h instanceof Error?h.stack||h.message:h},r.disable=function(){const h=[...r.names.map(l),...r.skips.map(l).map(c=>"-"+c)].join(",");return r.enable(""),h},r.enable=function(h){let c;r.save(h),r.namespaces=h,r.names=[],r.skips=[];const d=(typeof h=="string"?h:"").split(/[\s,]+/),f=d.length;for(c=0;c{r[h]=n[h]}),r.names=[],r.skips=[],r.formatters={},r.selectColor=function(h){let c=0;for(let d=0;d0&&V.length>I){V.warned=!0;var G=new Error("Possible EventEmitter memory leak detected. "+V.length+' "'+String(k)+'" listeners added. Use emitter.setMaxListeners() to increase limit.');G.name="MaxListenersExceededWarning",G.emitter=b,G.type=k,G.count=V.length,typeof console=="object"&&console.warn&&console.warn("%s: %s",G.name,G.message)}}else V=D[k]=R,++b._eventsCount;return b}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 b=new Array(arguments.length),k=0;k1&&(k=arguments[1]),k instanceof Error)throw k;var F=new Error('Unhandled "error" event. ('+k+")");throw F.context=k,F}if(!(R=V[b]))return!1;var P=typeof R=="function";switch(S=arguments.length){case 1:(function(T,L,$){if(L)T.call($);else for(var Z=T.length,at=_(T,Z),q=0;q=0;D--)if(R[D]===k||R[D].listener===k){V=R[D].listener,I=D;break}if(I<0)return this;I===0?R.shift():function(G,F){for(var P=F,T=P+1,L=G.length;T=0;S--)this.removeListener(b,k[S]);return this},l.prototype.listeners=function(b){return p(this,b,!0)},l.prototype.rawListeners=function(b){return p(this,b,!1)},l.listenerCount=function(b,k){return typeof b.listenerCount=="function"?b.listenerCount(k):x.call(b,k)},l.prototype.listenerCount=x,l.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]}},{}],23:[function(i,a,s){s.read=function(n,r,o,l,h){var c,d,f=8*h-l-1,g=(1<>1,y=-7,p=o?h-1:0,x=o?-1:1,_=n[r+p];for(p+=x,c=_&(1<<-y)-1,_>>=-y,y+=f;y>0;c=256*c+n[r+p],p+=x,y-=8);for(d=c&(1<<-y)-1,c>>=-y,y+=l;y>0;d=256*d+n[r+p],p+=x,y-=8);if(c===0)c=1-m;else{if(c===g)return d?NaN:1/0*(_?-1:1);d+=Math.pow(2,l),c-=m}return(_?-1:1)*d*Math.pow(2,c-l)},s.write=function(n,r,o,l,h,c){var d,f,g,m=8*c-h-1,y=(1<>1,x=h===23?Math.pow(2,-24)-Math.pow(2,-77):0,_=l?0:c-1,b=l?1:-1,k=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(f=isNaN(r)?1:0,d=y):(d=Math.floor(Math.log(r)/Math.LN2),r*(g=Math.pow(2,-d))<1&&(d--,g*=2),(r+=d+p>=1?x/g:x*Math.pow(2,1-p))*g>=2&&(d++,g/=2),d+p>=y?(f=0,d=y):d+p>=1?(f=(r*g-1)*Math.pow(2,h),d+=p):(f=r*Math.pow(2,p-1)*Math.pow(2,h),d=0));h>=8;n[o+_]=255&f,_+=b,f/=256,h-=8);for(d=d<0;n[o+_]=255&d,_+=b,d/=256,m-=8);n[o+_-b]|=128*k}},{}],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 o=function(){};o.prototype=r.prototype,n.prototype=new o,n.prototype.constructor=n}}},{}],25:[function(i,a,s){Object.defineProperty(s,"__esModule",{value:!0});var n=function(){function r(o,l){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=o,this.value=l}return r.prototype.rotateLeft=function(){var o=this.parent,l=this.brother,h=this.leftChild,c=this.rightChild;if(!c)throw new Error("unknown error");var d=c.leftChild,f=c.rightChild;return o&&(o.leftChild===this?o.leftChild=c:o.rightChild===this&&(o.rightChild=c)),c.parent=o,c.brother=l,c.leftChild=this,c.rightChild=f,l&&(l.brother=c),this.parent=c,this.brother=f,this.leftChild=h,this.rightChild=d,f&&(f.parent=c,f.brother=this),h&&(h.parent=this,h.brother=d),d&&(d.parent=this,d.brother=h),c},r.prototype.rotateRight=function(){var o=this.parent,l=this.brother,h=this.leftChild;if(!h)throw new Error("unknown error");var c=this.rightChild,d=h.leftChild,f=h.rightChild;return o&&(o.leftChild===this?o.leftChild=h:o.rightChild===this&&(o.rightChild=h)),h.parent=o,h.brother=l,h.leftChild=d,h.rightChild=this,l&&(l.brother=h),d&&(d.parent=h,d.brother=this),this.parent=h,this.brother=d,this.leftChild=f,this.rightChild=c,f&&(f.parent=this,f.brother=c),c&&(c.parent=this,c.brother=f),h},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(o,l){var h,c,d,f,g={label:0,sent:function(){if(1&d[0])throw d[1];return d[1]},trys:[],ops:[]};return f={next:m(0),throw:m(1),return:m(2)},typeof Symbol=="function"&&(f[Symbol.iterator]=function(){return this}),f;function m(y){return function(p){return function(x){if(h)throw new TypeError("Generator is already executing.");for(;g;)try{if(h=1,c&&(d=2&x[0]?c.return:x[0]?c.throw||((d=c.return)&&d.call(c),0):c.next)&&!(d=d.call(c,x[1])).done)return d;switch(c=0,d&&(x=[2&x[0],d.value]),x[0]){case 0:case 1:d=x;break;case 4:return g.label++,{value:x[1],done:!1};case 5:g.label++,c=x[1],x=[0];continue;case 7:x=g.ops.pop(),g.trys.pop();continue;default:if(!(d=(d=g.trys).length>0&&d[d.length-1])&&(x[0]===6||x[0]===2)){g=0;continue}if(x[0]===3&&(!d||x[1]>d[0]&&x[1]R)throw new Error("pos should more than 0 and less than queue's size");return{curNodeBucketIndex:Math.floor(k/r.bucketSize),curNodePointerIndex:k%r.bucketSize}};this.getElementByPos=function(_){var b=p(_),k=b.curNodeBucketIndex,R=b.curNodePointerIndex;return h[k][R]},this.eraseElementByPos=function(_){var b=this;if(_<0||_>y)throw new Error("pos should more than 0 and less than queue's size");if(_===0)this.popFront();else if(_===this.size())this.popBack();else{for(var k=[],R=_+1;R0?--g:c0&&--y)},this.setElementByPos=function(_,b){var k=p(_),R=k.curNodeBucketIndex,S=k.curNodePointerIndex;h[R][S]=b},this.insert=function(_,b,k){var R=this;if(k===void 0&&(k=1),_===0)for(;k--;)this.pushFront(b);else if(_===this.size())for(;k--;)this.pushBack(b);else{for(var S=[],I=_;I0?--d:c>0&&(--c,d=r.bucketSize-1)),++y,h[c][d]=_},this.popFront=function(){this.empty()||(this.size()!==1&&(d0&&--y)},this.shrinkToFit=function(){var _=this,b=[];this.forEach(function(I){b.push(I)});var k=b.length;h=[];for(var R=Math.ceil(k/r.bucketSize),S=0;S0&&m[m.length-1])&&(k[0]===6||k[0]===2)){p=0;continue}if(k[0]===3&&(!m||k[1]>m[0]&&k[1]=c.length&&(c=void 0),{value:c&&c[g++],done:!c}}};throw new TypeError(d?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(s,"__esModule",{value:!0});var o=i("../LinkList/LinkList"),l=i("../Map/Map");function h(c,d,f){var g=this;if(c===void 0&&(c=[]),d===void 0&&(d=h.initSize),f=f||function(x){var _,b,k=0,R="";if(typeof x=="number")k=((k=Math.floor(x))<<5)-k,k&=k;else{R=typeof x!="string"?JSON.stringify(x):x;try{for(var S=r(R),I=S.next();!I.done;I=S.next())k=(k<<5)-k+I.value.charCodeAt(0),k&=k}catch(D){_={error:D}}finally{try{I&&!I.done&&(b=S.return)&&b.call(S)}finally{if(_)throw _.error}}}return k^=k>>>16},(d&d-1)!=0)throw new Error("initBucketNum must be 2 to the power of n");var m=0,y=[],p=Math.max(h.initSize,Math.min(h.maxSize,d));this.size=function(){return m},this.empty=function(){return m===0},this.clear=function(){m=0,p=d,y=[]},this.forEach=function(x){var _=0;y.forEach(function(b){b.forEach(function(k){x(k,_++)})})},this.setElement=function(x,_){var b,k;if(x==null)throw new Error("to avoid some unnecessary errors, we don't suggest you insert null or undefined here");if(_!=null){var R=f(x)&p-1;if(y[R]){var S=y[R].size();if(y[R]instanceof o.default){try{for(var I=r(y[R]),D=I.next();!D.done;D=I.next()){var V=D.value;if(V.key===x)return void(V.value=_)}}catch(F){b={error:F}}finally{try{D&&!D.done&&(k=I.return)&&k.call(I)}finally{if(b)throw b.error}}y[R].pushBack({key:x,value:_}),y[R].size()>=h.treeifyThreshold&&(y[R]=new l.default(y[R]))}else y[R].setElement(x,_);var G=y[R].size();m+=G-S}else++m,y[R]=new o.default([{key:x,value:_}]);m>p*h.sigma&&function(F){if(!(F>=h.maxSize)){p=2*F;var P=[];y.forEach(function(T,L){if(!T.empty()){if(T instanceof o.default&&T.size()===1){var $=T.front(),Z=$.key,at=$.value;P[f(Z)&p-1]=new o.default([{key:Z,value:at}])}else if(T instanceof l.default){var q=new o.default,W=new o.default;T.forEach(function(U){(f(U.key)&F)==0?q.pushBack(U):W.pushBack(U)}),q.size()>h.untreeifyThreshold?P[L]=new l.default(q):q.size()&&(P[L]=q),W.size()>h.untreeifyThreshold?P[L+F]=new l.default(W):W.size()&&(P[L+F]=W)}else{var j=new o.default,K=new o.default;T.forEach(function(U){(f(U.key)&F)==0?j.pushBack(U):K.pushBack(U)}),j.size()&&(P[L]=j),K.size()&&(P[L+F]=K)}y[L].clear()}}),y=P}}.call(this,p)}else this.eraseElementByKey(x)},this.getElementByKey=function(x){var _,b,k=f(x)&p-1;if(y[k]){if(y[k]instanceof l.default)return y[k].getElementByKey(x);try{for(var R=r(y[k]),S=R.next();!S.done;S=R.next()){var I=S.value;if(I.key===x)return I.value}}catch(D){_={error:D}}finally{try{S&&!S.done&&(b=R.return)&&b.call(R)}finally{if(_)throw _.error}}}},this.eraseElementByKey=function(x){var _,b,k=f(x)&p-1;if(y[k]){var R=y[k].size();if(y[k]instanceof l.default)y[k].eraseElementByKey(x),y[k].size()<=h.untreeifyThreshold&&(y[k]=new o.default(y[k]));else{var S=-1;try{for(var I=r(y[k]),D=I.next();!D.done;D=I.next())if(++S,D.value.key===x){y[k].eraseElementByPos(S);break}}catch(G){_={error:G}}finally{try{D&&!D.done&&(b=I.return)&&b.call(I)}finally{if(_)throw _.error}}}var V=y[k].size();m+=V-R}},this.find=function(x){var _,b,k=f(x)&p-1;if(!y[k])return!1;if(y[k]instanceof l.default)return y[k].find(x);try{for(var R=r(y[k]),S=R.next();!S.done;S=R.next())if(S.value.key===x)return!0}catch(I){_={error:I}}finally{try{S&&!S.done&&(b=R.return)&&b.call(R)}finally{if(_)throw _.error}}return!1},this[Symbol.iterator]=function(){return function(){var x,_,b,k,R,S;return n(this,function(I){switch(I.label){case 0:x=0,I.label=1;case 1:if(!(x=p)return[3,10];I.label=2;case 2:I.trys.push([2,7,8,9]),R=void 0,_=r(y[x]),b=_.next(),I.label=3;case 3:return b.done?[3,6]:[4,b.value];case 4:I.sent(),I.label=5;case 5:return b=_.next(),[3,3];case 6:return[3,9];case 7:return k=I.sent(),R={error:k},[3,9];case 8:try{b&&!b.done&&(S=_.return)&&S.call(_)}finally{if(R)throw R.error}return[7];case 9:return++x,[3,1];case 10:return[2]}})}()},c.forEach(function(x){var _=x.key,b=x.value;return g.setElement(_,b)}),Object.freeze(this)}h.initSize=16,h.maxSize=1<<30,h.sigma=.75,h.treeifyThreshold=8,h.untreeifyThreshold=6,h.minTreeifySize=64,Object.freeze(h),s.default=h},{"../LinkList/LinkList":29,"../Map/Map":30}],28:[function(i,a,s){var n=this&&this.__generator||function(c,d){var f,g,m,y,p={label:0,sent:function(){if(1&m[0])throw m[1];return m[1]},trys:[],ops:[]};return y={next:x(0),throw:x(1),return:x(2)},typeof Symbol=="function"&&(y[Symbol.iterator]=function(){return this}),y;function x(_){return function(b){return function(k){if(f)throw new TypeError("Generator is already executing.");for(;p;)try{if(f=1,g&&(m=2&k[0]?g.return:k[0]?g.throw||((m=g.return)&&m.call(g),0):g.next)&&!(m=m.call(g,k[1])).done)return m;switch(g=0,m&&(k=[2&k[0],m.value]),k[0]){case 0:case 1:m=k;break;case 4:return p.label++,{value:k[1],done:!1};case 5:p.label++,g=k[1],k=[0];continue;case 7:k=p.ops.pop(),p.trys.pop();continue;default:if(!(m=(m=p.trys).length>0&&m[m.length-1])&&(k[0]===6||k[0]===2)){p=0;continue}if(k[0]===3&&(!m||k[1]>m[0]&&k[1]=c.length&&(c=void 0),{value:c&&c[g++],done:!c}}};throw new TypeError(d?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(s,"__esModule",{value:!0});var o=i("../Set/Set"),l=i("../LinkList/LinkList");function h(c,d,f){var g=this;if(c===void 0&&(c=[]),d===void 0&&(d=h.initSize),f=f||function(x){var _=0,b="";if(typeof x=="number")_=((_=Math.floor(x))<<5)-_,_&=_;else{b=typeof x!="string"?JSON.stringify(x):x;for(var k=0;k>>16},(d&d-1)!=0)throw new Error("initBucketNum must be 2 to the power of n");var m=0,y=[],p=Math.max(h.initSize,Math.min(h.maxSize,d));this.size=function(){return m},this.empty=function(){return m===0},this.clear=function(){m=0,p=d,y=[]},this.forEach=function(x){var _=0;y.forEach(function(b){b.forEach(function(k){x(k,_++)})})},this.insert=function(x){if(x==null)throw new Error("to avoid some unnecessary errors, we don't suggest you insert null or undefined here");var _=f(x)&p-1;if(y[_]){var b=y[_].size();if(y[_]instanceof l.default){if(y[_].find(x))return;y[_].pushBack(x),y[_].size()>=h.treeifyThreshold&&(y[_]=new o.default(y[_]))}else y[_].insert(x);var k=y[_].size();m+=k-b}else y[_]=new l.default([x]),++m;m>p*h.sigma&&function(R){if(!(R>=h.maxSize)){p=2*R;var S=[];y.forEach(function(I,D){if(!I.empty()){if(I instanceof l.default&&I.size()===1){var V=I.front();if(V===void 0)throw new Error("unknown error");S[f(V)&p-1]=new l.default([V])}else if(I instanceof o.default){var G=new l.default,F=new l.default;I.forEach(function(L){(f(L)&R)==0?G.pushBack(L):F.pushBack(L)}),G.size()>h.untreeifyThreshold?S[D]=new o.default(G):G.size()&&(S[D]=G),F.size()>h.untreeifyThreshold?S[D+R]=new o.default(F):F.size()&&(S[D+R]=F)}else{var P=new l.default,T=new l.default;I.forEach(function(L){(f(L)&R)==0?P.pushBack(L):T.pushBack(L)}),P.size()&&(S[D]=P),T.size()&&(S[D+R]=T)}y[D].clear()}}),y=S}}.call(this,p)},this.eraseElementByValue=function(x){var _=f(x)&p-1;if(y[_]){var b=y[_].size();y[_].eraseElementByValue(x),y[_]instanceof o.default&&y[_].size()<=h.untreeifyThreshold&&(y[_]=new l.default(y[_]));var k=y[_].size();m+=k-b}},this.find=function(x){var _=f(x)&p-1;return!!y[_]&&y[_].find(x)},this[Symbol.iterator]=function(){return function(){var x,_,b,k,R,S;return n(this,function(I){switch(I.label){case 0:x=0,I.label=1;case 1:if(!(x=p)return[3,10];I.label=2;case 2:I.trys.push([2,7,8,9]),R=void 0,_=r(y[x]),b=_.next(),I.label=3;case 3:return b.done?[3,6]:[4,b.value];case 4:I.sent(),I.label=5;case 5:return b=_.next(),[3,3];case 6:return[3,9];case 7:return k=I.sent(),R={error:k},[3,9];case 8:try{b&&!b.done&&(S=_.return)&&S.call(_)}finally{if(R)throw R.error}return[7];case 9:return++x,[3,1];case 10:return[2]}})}()},c.forEach(function(x){return g.insert(x)}),Object.freeze(this)}h.initSize=16,h.maxSize=1<<30,h.sigma=.75,h.treeifyThreshold=8,h.untreeifyThreshold=6,h.minTreeifySize=64,Object.freeze(h),s.default=h},{"../LinkList/LinkList":29,"../Set/Set":33}],29:[function(i,a,s){var n=this&&this.__generator||function(l,h){var c,d,f,g,m={label:0,sent:function(){if(1&f[0])throw f[1];return f[1]},trys:[],ops:[]};return g={next:y(0),throw:y(1),return:y(2)},typeof Symbol=="function"&&(g[Symbol.iterator]=function(){return this}),g;function y(p){return function(x){return function(_){if(c)throw new TypeError("Generator is already executing.");for(;m;)try{if(c=1,d&&(f=2&_[0]?d.return:_[0]?d.throw||((f=d.return)&&f.call(d),0):d.next)&&!(f=f.call(d,_[1])).done)return f;switch(d=0,f&&(_=[2&_[0],f.value]),_[0]){case 0:case 1:f=_;break;case 4:return m.label++,{value:_[1],done:!1};case 5:m.label++,d=_[1],_=[0];continue;case 7:_=m.ops.pop(),m.trys.pop();continue;default:if(!(f=(f=m.trys).length>0&&f[f.length-1])&&(_[0]===6||_[0]===2)){m=0;continue}if(_[0]===3&&(!f||_[1]>f[0]&&_[1]=c)throw new Error("pos must more then 0 and less then the list length");for(var m=d;g--&&m;)m=m.next;if(!m||m.value===void 0)throw new Error("unknown error");return m.value},this.eraseElementByPos=function(g){if(g<0||g>=c)throw new Error("erase pos must more then 0 and less then the list length");if(g===0)this.popFront();else if(g===c-1)this.popBack();else{for(var m=d;g--;){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 y=m.pre,p=m.next;p.pre=y,y.next=p,c>0&&--c}},this.eraseElementByValue=function(g){for(;d&&d.value===g;)this.popFront();for(;f&&f.value===g;)this.popBack();if(d)for(var m=d;m;){if(m.value===g){var y=m.pre,p=m.next;p&&(p.pre=y),y&&(y.next=p),c>0&&--c}m=m.next}},this.pushBack=function(g){if(g==null)throw new Error("you can't push null or undefined here");++c;var m=new r(g);f?(f.next=m,m.pre=f,f=m):d=f=m},this.popBack=function(){f&&(c>0&&--c,f&&(d===f?d=f=void 0:(f=f.pre)&&(f.next=void 0)))},this.setElementByPos=function(g,m){if(m==null)throw new Error("you can't set null or undefined here");if(g<0||g>=c)throw new Error("pos must more then 0 and less then the list length");for(var y=d;g--;){if(!y)throw new Error("unknown error");y=y.next}y&&(y.value=m)},this.insert=function(g,m,y){if(y===void 0&&(y=1),m==null)throw new Error("you can't insert null or undefined here");if(g<0||g>c)throw new Error("insert pos must more then 0 and less then or equal to the list length");if(y<0)throw new Error("insert size must more than 0");if(g===0)for(;y--;)this.pushFront(m);else if(g===c)for(;y--;)this.pushBack(m);else{for(var p=d,x=1;x0&&--c;g.next=m.next,g.next&&(g.next.pre=g),g=g.next}},this.sort=function(g){var m=[];this.forEach(function(p){m.push(p)}),m.sort(g);var y=d;m.forEach(function(p){y&&(y.value=p,y=y.next)})},this.pushFront=function(g){if(g==null)throw new Error("you can't push null or undefined here");++c;var m=new r(g);d?(m.next=d,d.pre=m,d=m):d=f=m},this.popFront=function(){d&&(c>0&&--c,d&&(d===f?d=f=void 0:(d=d.next)&&(d.pre=void 0)))},this.merge=function(g){var m=this,y=d;g.forEach(function(p){for(;y&&y.value!==void 0&&y.value<=p;)y=y.next;if(y===void 0)m.pushBack(p),y=f;else if(y===d)m.pushFront(p),y=d;else{++c;var x=y.pre;x&&(x.next=new r(p),x.next.pre=x,x.next.next=y,y&&(y.pre=x.next))}})},this[Symbol.iterator]=function(){return function(){var g;return n(this,function(m){switch(m.label){case 0:g=d,m.label=1;case 1:if(g===void 0)return[3,3];if(!g.value)throw new Error("unknown error");return[4,g.value];case 2:return m.sent(),g=g.next,[3,1];case 3:return[2]}})}()},l.forEach(function(g){return h.pushBack(g)}),Object.freeze(this)}Object.freeze(o),s.default=o},{}],30:[function(i,a,s){var n=this&&this.__generator||function(h,c){var d,f,g,m,y={label:0,sent:function(){if(1&g[0])throw g[1];return g[1]},trys:[],ops:[]};return m={next:p(0),throw:p(1),return:p(2)},typeof Symbol=="function"&&(m[Symbol.iterator]=function(){return this}),m;function p(x){return function(_){return function(b){if(d)throw new TypeError("Generator is already executing.");for(;y;)try{if(d=1,f&&(g=2&b[0]?f.return:b[0]?f.throw||((g=f.return)&&g.call(f),0):f.next)&&!(g=g.call(f,b[1])).done)return g;switch(f=0,g&&(b=[2&b[0],g.value]),b[0]){case 0:case 1:g=b;break;case 4:return y.label++,{value:b[1],done:!1};case 5:y.label++,f=b[1],b=[0];continue;case 7:b=y.ops.pop(),y.trys.pop();continue;default:if(!(g=(g=y.trys).length>0&&g[g.length-1])&&(b[0]===6||b[0]===2)){y=0;continue}if(b[0]===3&&(!g||b[1]>g[0]&&b[1]=h.length&&(h=void 0),{value:h&&h[f++],done:!h}}};throw new TypeError(c?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(s,"__esModule",{value:!0});var o=i("../Base/TreeNode");function l(h,c){var d=this;h===void 0&&(h=[]),c=c||function(F,P){return FP?1:0};var f=0,g=new o.default;g.color=o.default.TreeNodeColorType.black,this.size=function(){return f},this.empty=function(){return f===0},this.clear=function(){f=0,g.key=g.value=void 0,g.leftChild=g.rightChild=g.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},y=function(F){if(!F||F.key===void 0)throw new Error("unknown error");return F.rightChild?y(F.rightChild):F};this.front=function(){if(!this.empty()){var F=m(g);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=y(g);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 P,T,L=0;try{for(var $=r(this),Z=$.next();!Z.done;Z=$.next())F(Z.value,L++)}catch(at){P={error:at}}finally{try{Z&&!Z.done&&(T=$.return)&&T.call($)}finally{if(P)throw P.error}}},this.getElementByPos=function(F){var P,T;if(F<0||F>=this.size())throw new Error("pos must more than 0 and less than set's size");var L=0;try{for(var $=r(this),Z=$.next();!Z.done;Z=$.next()){var at=Z.value;if(L===F)return at;++L}}catch(q){P={error:q}}finally{try{Z&&!Z.done&&(T=$.return)&&T.call($)}finally{if(P)throw P.error}}throw new Error("unknown Error")};var p=function(F,P){if(F&&F.key!==void 0&&F.value!==void 0){var T=c(F.key,P);return T===0?{key:F.key,value:F.value}:T<0?p(F.rightChild,P):p(F.leftChild,P)||{key:F.key,value:F.value}}};this.lowerBound=function(F){return p(g,F)};var x=function(F,P){if(F&&F.key!==void 0&&F.value!==void 0)return c(F.key,P)<=0?x(F.rightChild,P):x(F.leftChild,P)||{key:F.key,value:F.value}};this.upperBound=function(F){return x(g,F)};var _=function(F,P){if(F&&F.key!==void 0&&F.value!==void 0){var T=c(F.key,P);return T===0?{key:F.key,value:F.value}:T>0?_(F.leftChild,P):_(F.rightChild,P)||{key:F.key,value:F.value}}};this.reverseLowerBound=function(F){return _(g,F)};var b=function(F,P){if(F&&F.key!==void 0&&F.value!==void 0)return c(F.key,P)>=0?b(F.leftChild,P):b(F.rightChild,P)||{key:F.key,value:F.value}};this.reverseUpperBound=function(F){return b(g,F)};var k=function(F){var P=F.parent;if(!P){if(F===g)return;throw new Error("unknown error")}if(F.color!==o.default.TreeNodeColorType.red){var T=F.brother;if(!T)throw new Error("unknown error");if(F===P.leftChild)if(T.color===o.default.TreeNodeColorType.red){T.color=o.default.TreeNodeColorType.black,P.color=o.default.TreeNodeColorType.red;var L=P.rotateLeft();g===P&&(g=L),k(F)}else T.color===o.default.TreeNodeColorType.black&&(T.rightChild&&T.rightChild.color===o.default.TreeNodeColorType.red?(T.color=P.color,P.color=o.default.TreeNodeColorType.black,T.rightChild&&(T.rightChild.color=o.default.TreeNodeColorType.black),L=P.rotateLeft(),g===P&&(g=L),F.color=o.default.TreeNodeColorType.black):T.rightChild&&T.rightChild.color!==o.default.TreeNodeColorType.black||!T.leftChild||T.leftChild.color!==o.default.TreeNodeColorType.red?T.leftChild&&T.leftChild.color!==o.default.TreeNodeColorType.black||T.rightChild&&T.rightChild.color!==o.default.TreeNodeColorType.black||(T.color=o.default.TreeNodeColorType.red,k(P)):(T.color=o.default.TreeNodeColorType.red,T.leftChild&&(T.leftChild.color=o.default.TreeNodeColorType.black),L=T.rotateRight(),g===T&&(g=L),k(F)));else F===P.rightChild&&(T.color===o.default.TreeNodeColorType.red?(T.color=o.default.TreeNodeColorType.black,P.color=o.default.TreeNodeColorType.red,L=P.rotateRight(),g===P&&(g=L),k(F)):T.color===o.default.TreeNodeColorType.black&&(T.leftChild&&T.leftChild.color===o.default.TreeNodeColorType.red?(T.color=P.color,P.color=o.default.TreeNodeColorType.black,T.leftChild&&(T.leftChild.color=o.default.TreeNodeColorType.black),L=P.rotateRight(),g===P&&(g=L),F.color=o.default.TreeNodeColorType.black):T.leftChild&&T.leftChild.color!==o.default.TreeNodeColorType.black||!T.rightChild||T.rightChild.color!==o.default.TreeNodeColorType.red?T.leftChild&&T.leftChild.color!==o.default.TreeNodeColorType.black||T.rightChild&&T.rightChild.color!==o.default.TreeNodeColorType.black||(T.color=o.default.TreeNodeColorType.red,k(P)):(T.color=o.default.TreeNodeColorType.red,T.rightChild&&(T.rightChild.color=o.default.TreeNodeColorType.black),L=T.rotateLeft(),g===T&&(g=L),k(F))))}else F.color=o.default.TreeNodeColorType.black},R=function(F){for(var P=F;P.leftChild||P.rightChild;){if(P.rightChild){P=m(P.rightChild);var T=F.key;F.key=P.key,P.key=T;var L=F.value;F.value=P.value,P.value=L,F=P}P.leftChild&&(P=y(P.leftChild),T=F.key,F.key=P.key,P.key=T,L=F.value,F.value=P.value,P.value=L,F=P)}k(P),P&&P.remove(),--f,g.color=o.default.TreeNodeColorType.black},S=function(F,P){return!(!F||F.key===void 0)&&(!!S(F.leftChild,P)||!!P(F)||S(F.rightChild,P))};this.eraseElementByPos=function(F){if(F<0||F>=f)throw new Error("pos must more than 0 and less than set's size");var P=0;S(g,function(T){return F===P?(R(T),!0):(++P,!1)})},this.eraseElementByKey=function(F){if(!this.empty()){var P=V(g,F);P!==void 0&&P.key!==void 0&&c(P.key,F)===0&&R(P)}};var I=function(F,P){if(!F||F.key===void 0)throw new Error("unknown error");var T=c(P,F.key);return T<0?F.leftChild?I(F.leftChild,P):(F.leftChild=new o.default,F.leftChild.parent=F,F.leftChild.brother=F.rightChild,F.rightChild&&(F.rightChild.brother=F.leftChild),F.leftChild):T>0?F.rightChild?I(F.rightChild,P):(F.rightChild=new o.default,F.rightChild.parent=F,F.rightChild.brother=F.leftChild,F.leftChild&&(F.leftChild.brother=F.rightChild),F.rightChild):F},D=function(F){var P=F.parent;if(!P){if(F===g)return;throw new Error("unknown error")}if(P.color!==o.default.TreeNodeColorType.black&&P.color===o.default.TreeNodeColorType.red){var T=P.brother,L=P.parent;if(!L)throw new Error("unknown error");if(T&&T.color===o.default.TreeNodeColorType.red)T.color=P.color=o.default.TreeNodeColorType.black,L.color=o.default.TreeNodeColorType.red,D(L);else if(!T||T.color===o.default.TreeNodeColorType.black)if(P===L.leftChild)if(F===P.leftChild){P.color=o.default.TreeNodeColorType.black,L.color=o.default.TreeNodeColorType.red;var $=L.rotateRight();L===g&&(g=$)}else F===P.rightChild&&($=P.rotateLeft(),L===g&&(g=$),D(P));else P===L.rightChild&&(F===P.leftChild?($=P.rotateRight(),L===g&&(g=$),D(P)):F===P.rightChild&&(P.color=o.default.TreeNodeColorType.black,L.color=o.default.TreeNodeColorType.red,$=L.rotateLeft(),L===g&&(g=$)))}};this.setElement=function(F,P){if(F==null)throw new Error("to avoid some unnecessary errors, we don't suggest you insert null or undefined here");if(P!=null){if(this.empty())return++f,g.key=F,g.value=P,void(g.color=o.default.TreeNodeColorType.black);var T=I(g,F);T.key===void 0||c(T.key,F)!==0?(++f,T.key=F,T.value=P,D(T),g.color=o.default.TreeNodeColorType.black):T.value=P}else this.eraseElementByKey(F)};var V=function(F,P){if(F&&F.key!==void 0){var T=c(P,F.key);return T<0?V(F.leftChild,P):T>0?V(F.rightChild,P):F}};this.find=function(F){return!!V(g,F)},this.getElementByKey=function(F){var P=V(g,F);if((P==null?void 0:P.key)===void 0||(P==null?void 0:P.value)===void 0)throw new Error("unknown error");return P.value},this.union=function(F){var P=this;F.forEach(function(T){var L=T.key,$=T.value;return P.setElement(L,$)})},this.getHeight=function(){if(this.empty())return 0;var F=function(P){return P?Math.max(F(P.leftChild),F(P.rightChild))+1:1};return F(g)};var G=function(F){return n(this,function(P){switch(P.label){case 0:return F&&F.key!==void 0&&F.value!==void 0?[5,r(G(F.leftChild))]:[2];case 1:return P.sent(),[4,{key:F.key,value:F.value}];case 2:return P.sent(),[5,r(G(F.rightChild))];case 3:return P.sent(),[2]}})};this[Symbol.iterator]=function(){return G(g)},h.forEach(function(F){var P=F.key,T=F.value;return d.setElement(P,T)}),Object.freeze(this)}Object.freeze(l),s.default=l},{"../Base/TreeNode":25}],31:[function(i,a,s){function n(r,o){r===void 0&&(r=[]),o=o||function(f,g){return f>g?-1:f=h)throw new Error("unknown error");if(g<0||g>=h)throw new Error("unknown error");var m=l[f];l[f]=l[g],l[g]=m},d=function(f){if(f<0||f>=h)throw new Error("unknown error");var g=2*f+1,m=2*f+2;g0&&c(f,g),m0&&c(f,m)};(function(){for(var f=Math.floor((h-1)/2);f>=0;--f)for(var g=f,m=2*g+1;m0&&(p=y),o(l[g],l[p])<=0)break;c(g,p),m=2*(g=p)+1}})(),this.size=function(){return h},this.empty=function(){return h===0},this.clear=function(){h=0,l.length=0},this.push=function(f){if(l.push(f),++h!==1)for(var g=h-1;g>0;){var m=Math.floor((g-1)/2);if(o(l[m],f)<=0)break;d(m),g=m}},this.pop=function(){if(!this.empty())if(this.size()!==1){var f=l[h-1];--h;for(var g=0;g=this.size())break;var p=m;if(y0&&(p=y),o(l[p],f)>=0)break;l[g]=l[p],g=p}l[g]=f}else--h},this.top=function(){return l[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(o){o===void 0&&(o=[]);var l=new n.default(o);this.size=function(){return l.size()},this.empty=function(){return l.empty()},this.clear=function(){l.clear()},this.push=function(h){l.pushBack(h)},this.pop=function(){l.popFront()},this.front=function(){return l.front()},Object.freeze(this)}Object.freeze(r),s.default=r},{"../LinkList/LinkList":29}],33:[function(i,a,s){var n=this&&this.__generator||function(h,c){var d,f,g,m,y={label:0,sent:function(){if(1&g[0])throw g[1];return g[1]},trys:[],ops:[]};return m={next:p(0),throw:p(1),return:p(2)},typeof Symbol=="function"&&(m[Symbol.iterator]=function(){return this}),m;function p(x){return function(_){return function(b){if(d)throw new TypeError("Generator is already executing.");for(;y;)try{if(d=1,f&&(g=2&b[0]?f.return:b[0]?f.throw||((g=f.return)&&g.call(f),0):f.next)&&!(g=g.call(f,b[1])).done)return g;switch(f=0,g&&(b=[2&b[0],g.value]),b[0]){case 0:case 1:g=b;break;case 4:return y.label++,{value:b[1],done:!1};case 5:y.label++,f=b[1],b=[0];continue;case 7:b=y.ops.pop(),y.trys.pop();continue;default:if(!(g=(g=y.trys).length>0&&g[g.length-1])&&(b[0]===6||b[0]===2)){y=0;continue}if(b[0]===3&&(!g||b[1]>g[0]&&b[1]=h.length&&(h=void 0),{value:h&&h[f++],done:!h}}};throw new TypeError(c?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(s,"__esModule",{value:!0});var o=i("../Base/TreeNode");function l(h,c){var d=this;h===void 0&&(h=[]),c=c||function(F,P){return FP?1:0};var f=0,g=new o.default;g.color=o.default.TreeNodeColorType.black,this.size=function(){return f},this.empty=function(){return f===0},this.clear=function(){f=0,g.key=void 0,g.leftChild=g.rightChild=g.brother=g.parent=void 0,g.color=o.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},y=function(F){if(!F||F.key===void 0)throw new Error("unknown error");return F.rightChild?y(F.rightChild):F};this.front=function(){if(!this.empty())return m(g).key},this.back=function(){if(!this.empty())return y(g).key},this.forEach=function(F){var P,T,L=0;try{for(var $=r(this),Z=$.next();!Z.done;Z=$.next())F(Z.value,L++)}catch(at){P={error:at}}finally{try{Z&&!Z.done&&(T=$.return)&&T.call($)}finally{if(P)throw P.error}}},this.getElementByPos=function(F){var P,T;if(F<0||F>=this.size())throw new Error("pos must more than 0 and less than set's size");var L=0;try{for(var $=r(this),Z=$.next();!Z.done;Z=$.next()){var at=Z.value;if(L===F)return at;++L}}catch(q){P={error:q}}finally{try{Z&&!Z.done&&(T=$.return)&&T.call($)}finally{if(P)throw P.error}}throw new Error("unknown error")};var p=function(F){var P=F.parent;if(!P){if(F===g)return;throw new Error("unknown error")}if(F.color!==o.default.TreeNodeColorType.red){var T=F.brother;if(!T)throw new Error("unknown error");if(F===P.leftChild)if(T.color===o.default.TreeNodeColorType.red){T.color=o.default.TreeNodeColorType.black,P.color=o.default.TreeNodeColorType.red;var L=P.rotateLeft();g===P&&(g=L),p(F)}else T.color===o.default.TreeNodeColorType.black&&(T.rightChild&&T.rightChild.color===o.default.TreeNodeColorType.red?(T.color=P.color,P.color=o.default.TreeNodeColorType.black,T.rightChild&&(T.rightChild.color=o.default.TreeNodeColorType.black),L=P.rotateLeft(),g===P&&(g=L),F.color=o.default.TreeNodeColorType.black):T.rightChild&&T.rightChild.color!==o.default.TreeNodeColorType.black||!T.leftChild||T.leftChild.color!==o.default.TreeNodeColorType.red?T.leftChild&&T.leftChild.color!==o.default.TreeNodeColorType.black||T.rightChild&&T.rightChild.color!==o.default.TreeNodeColorType.black||(T.color=o.default.TreeNodeColorType.red,p(P)):(T.color=o.default.TreeNodeColorType.red,T.leftChild&&(T.leftChild.color=o.default.TreeNodeColorType.black),L=T.rotateRight(),g===T&&(g=L),p(F)));else F===P.rightChild&&(T.color===o.default.TreeNodeColorType.red?(T.color=o.default.TreeNodeColorType.black,P.color=o.default.TreeNodeColorType.red,L=P.rotateRight(),g===P&&(g=L),p(F)):T.color===o.default.TreeNodeColorType.black&&(T.leftChild&&T.leftChild.color===o.default.TreeNodeColorType.red?(T.color=P.color,P.color=o.default.TreeNodeColorType.black,T.leftChild&&(T.leftChild.color=o.default.TreeNodeColorType.black),L=P.rotateRight(),g===P&&(g=L),F.color=o.default.TreeNodeColorType.black):T.leftChild&&T.leftChild.color!==o.default.TreeNodeColorType.black||!T.rightChild||T.rightChild.color!==o.default.TreeNodeColorType.red?T.leftChild&&T.leftChild.color!==o.default.TreeNodeColorType.black||T.rightChild&&T.rightChild.color!==o.default.TreeNodeColorType.black||(T.color=o.default.TreeNodeColorType.red,p(P)):(T.color=o.default.TreeNodeColorType.red,T.rightChild&&(T.rightChild.color=o.default.TreeNodeColorType.black),L=T.rotateLeft(),g===T&&(g=L),p(F))))}else F.color=o.default.TreeNodeColorType.black},x=function(F){for(var P=F;P.leftChild||P.rightChild;){if(P.rightChild){P=m(P.rightChild);var T=F.key;F.key=P.key,P.key=T,F=P}P.leftChild&&(P=y(P.leftChild),T=F.key,F.key=P.key,P.key=T,F=P)}p(P),P&&P.remove(),--f,g.color=o.default.TreeNodeColorType.black},_=function(F,P){return!(!F||F.key===void 0)&&(!!_(F.leftChild,P)||!!P(F)||_(F.rightChild,P))};this.eraseElementByPos=function(F){if(F<0||F>=f)throw new Error("pos must more than 0 and less than set's size");var P=0;_(g,function(T){return F===P?(x(T),!0):(++P,!1)})},this.eraseElementByValue=function(F){if(!this.empty()){var P=R(g,F);P!==void 0&&P.key!==void 0&&c(P.key,F)===0&&x(P)}};var b=function(F,P){if(!F||F.key===void 0)throw new Error("unknown error");var T=c(P,F.key);return T<0?F.leftChild?b(F.leftChild,P):(F.leftChild=new o.default,F.leftChild.parent=F,F.leftChild.brother=F.rightChild,F.rightChild&&(F.rightChild.brother=F.leftChild),F.leftChild):T>0?F.rightChild?b(F.rightChild,P):(F.rightChild=new o.default,F.rightChild.parent=F,F.rightChild.brother=F.leftChild,F.leftChild&&(F.leftChild.brother=F.rightChild),F.rightChild):F},k=function(F){var P=F.parent;if(!P){if(F===g)return;throw new Error("unknown error")}if(P.color!==o.default.TreeNodeColorType.black&&P.color===o.default.TreeNodeColorType.red){var T=P.brother,L=P.parent;if(!L)throw new Error("unknown error");if(T&&T.color===o.default.TreeNodeColorType.red)T.color=P.color=o.default.TreeNodeColorType.black,L.color=o.default.TreeNodeColorType.red,k(L);else if(!T||T.color===o.default.TreeNodeColorType.black)if(P===L.leftChild)if(F===P.leftChild){P.color=o.default.TreeNodeColorType.black,L.color=o.default.TreeNodeColorType.red;var $=L.rotateRight();L===g&&(g=$)}else F===P.rightChild&&($=P.rotateLeft(),L===g&&(g=$),k(P));else P===L.rightChild&&(F===P.leftChild?($=P.rotateRight(),L===g&&(g=$),k(P)):F===P.rightChild&&(P.color=o.default.TreeNodeColorType.black,L.color=o.default.TreeNodeColorType.red,$=L.rotateLeft(),L===g&&(g=$)))}};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++f,g.key=F,void(g.color=o.default.TreeNodeColorType.black);var P=b(g,F);P.key!==void 0&&c(P.key,F)===0||(++f,P.key=F,k(P),g.color=o.default.TreeNodeColorType.black)};var R=function(F,P){if(F&&F.key!==void 0){var T=c(P,F.key);return T<0?R(F.leftChild,P):T>0?R(F.rightChild,P):F}};this.find=function(F){var P=R(g,F);return P!==void 0&&P.key!==void 0&&c(P.key,F)===0};var S=function(F,P){if(F&&F.key!==void 0){var T=c(F.key,P);if(T===0)return F.key;if(T<0)return S(F.rightChild,P);var L=S(F.leftChild,P);return L!==void 0?L:F.key}};this.lowerBound=function(F){return S(g,F)};var I=function(F,P){if(F&&F.key!==void 0){if(c(F.key,P)<=0)return I(F.rightChild,P);var T=I(F.leftChild,P);return T!==void 0?T:F.key}};this.upperBound=function(F){return I(g,F)};var D=function(F,P){if(F&&F.key!==void 0){var T=c(F.key,P);if(T===0)return F.key;if(T>0)return D(F.leftChild,P);var L=D(F.rightChild,P);return L!==void 0?L:F.key}};this.reverseLowerBound=function(F){return D(g,F)};var V=function(F,P){if(F&&F.key!==void 0){if(c(F.key,P)>=0)return V(F.leftChild,P);var T=V(F.rightChild,P);return T!==void 0?T:F.key}};this.reverseUpperBound=function(F){return V(g,F)},this.union=function(F){var P=this;F.forEach(function(T){return P.insert(T)})},this.getHeight=function(){if(this.empty())return 0;var F=function(P){return P?Math.max(F(P.leftChild),F(P.rightChild))+1:1};return F(g)};var G=function(F){return n(this,function(P){switch(P.label){case 0:return F&&F.key!==void 0?[5,r(G(F.leftChild))]:[2];case 1:return P.sent(),[4,F.key];case 2:return P.sent(),[5,r(G(F.rightChild))];case 3:return P.sent(),[2]}})};this[Symbol.iterator]=function(){return G(g)},h.forEach(function(F){return d.insert(F)}),Object.freeze(this)}Object.freeze(l),s.default=l},{"../Base/TreeNode":25}],34:[function(i,a,s){function n(r){var o=this;r===void 0&&(r=[]);var l=0,h=[];this.size=function(){return l},this.empty=function(){return l===0},this.clear=function(){l=0,h.length=0},this.push=function(c){h.push(c),++l},this.pop=function(){h.pop(),l>0&&--l},this.top=function(){return h[l-1]},r.forEach(function(c){return o.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,d){var f,g,m,y,p={label:0,sent:function(){if(1&m[0])throw m[1];return m[1]},trys:[],ops:[]};return y={next:x(0),throw:x(1),return:x(2)},typeof Symbol=="function"&&(y[Symbol.iterator]=function(){return this}),y;function x(_){return function(b){return function(k){if(f)throw new TypeError("Generator is already executing.");for(;p;)try{if(f=1,g&&(m=2&k[0]?g.return:k[0]?g.throw||((m=g.return)&&m.call(g),0):g.next)&&!(m=m.call(g,k[1])).done)return m;switch(g=0,m&&(k=[2&k[0],m.value]),k[0]){case 0:case 1:m=k;break;case 4:return p.label++,{value:k[1],done:!1};case 5:p.label++,g=k[1],k=[0];continue;case 7:k=p.ops.pop(),p.trys.pop();continue;default:if(!(m=(m=p.trys).length>0&&m[m.length-1])&&(k[0]===6||k[0]===2)){p=0;continue}if(k[0]===3&&(!m||k[1]>m[0]&&k[1]0)&&!(g=y.next()).done;)p.push(g.value)}catch(x){m={error:x}}finally{try{g&&!g.done&&(f=y.return)&&f.call(y)}finally{if(m)throw m.error}}return p},o=this&&this.__spreadArray||function(c,d,f){if(f||arguments.length===2)for(var g,m=0,y=d.length;m=c.length&&(c=void 0),{value:c&&c[g++],done:!c}}};throw new TypeError(d?"Object is not iterable.":"Symbol.iterator is not defined.")};function h(c){var d=this;c===void 0&&(c=[]);var f=0,g=[];this.size=function(){return f},this.empty=function(){return f===0},this.clear=function(){f=0,g.length=0},this.front=function(){if(!this.empty())return g[0]},this.back=function(){if(!this.empty())return g[f-1]},this.forEach=function(m){g.forEach(m)},this.getElementByPos=function(m){if(m<0||m>=f)throw new Error("pos must more than 0 and less than vector's size");return g[m]},this.eraseElementByPos=function(m){if(m<0||m>=f)throw new Error("pos must more than 0 and less than vector's size");for(var y=m;yp;)this.popBack()},this.pushBack=function(m){g.push(m),++f},this.popBack=function(){g.pop(),f>0&&--f},this.setElementByPos=function(m,y){if(m<0||m>=f)throw new Error("pos must more than 0 and less than vector's size");g[m]=y},this.insert=function(m,y,p){if(p===void 0&&(p=1),m<0||m>f)throw new Error("pos must more than 0 and less than or equal to vector's size");g.splice.apply(g,o([m,0],r(new Array(p).fill(y)),!1)),f+=p},this.find=function(m){return g.includes(m)},this.reverse=function(){g.reverse()},this.unique=function(){var m,y=[];this.forEach(function(x,_){_!==0&&x===m||(y.push(x),m=x)}),y.forEach(function(x,_){g[_]=x});for(var p=y.length;f>p;)this.popBack()},this.sort=function(m){g.sort(m)},this[Symbol.iterator]=function(){return function(){return n(this,function(m){switch(m.label){case 0:return[5,l(g)];case 1:return[2,m.sent()]}})}()},c.forEach(function(m){return d.pushBack(m)}),Object.freeze(this)}Object.defineProperty(s,"__esModule",{value:!0}),Object.freeze(h),s.default=h},{}],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 o=i("./Queue/Queue");s.Queue=o.default;var l=i("./LinkList/LinkList");s.LinkList=l.default;var h=i("./Deque/Deque");s.Deque=h.default;var c=i("./PriorityQueue/PriorityQueue");s.PriorityQueue=c.default;var d=i("./Set/Set");s.Set=d.default;var f=i("./Map/Map");s.Map=f.default;var g=i("./HashSet/HashSet");s.HashSet=g.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"),o=Symbol("length"),l=Symbol("lengthCalculator"),h=Symbol("allowStale"),c=Symbol("maxAge"),d=Symbol("dispose"),f=Symbol("noDisposeOnSet"),g=Symbol("lruList"),m=Symbol("cache"),y=Symbol("updateAgeOnGet"),p=()=>1,x=(I,D,V)=>{const G=I[m].get(D);if(G){const F=G.value;if(_(I,F)){if(k(I,G),!I[h])return}else V&&(I[y]&&(G.value.now=Date.now()),I[g].unshiftNode(G));return F.value}},_=(I,D)=>{if(!D||!D.maxAge&&!I[c])return!1;const V=Date.now()-D.now;return D.maxAge?V>D.maxAge:I[c]&&V>I[c]},b=I=>{if(I[o]>I[r])for(let D=I[g].tail;I[o]>I[r]&&D!==null;){const V=D.prev;k(I,D),D=V}},k=(I,D)=>{if(D){const V=D.value;I[d]&&I[d](V.key,V.value),I[o]-=V.length,I[m].delete(V.key),I[g].removeNode(D)}};class R{constructor(D,V,G,F,P){this.key=D,this.value=V,this.length=G,this.now=F,this.maxAge=P||0}}const S=(I,D,V,G)=>{let F=V.value;_(I,F)&&(k(I,V),I[h]||(F=void 0)),F&&D.call(G,F.value,F.key,I)};a.exports=class{constructor(I){if(typeof I=="number"&&(I={max:I}),I||(I={}),I.max&&(typeof I.max!="number"||I.max<0))throw new TypeError("max must be a non-negative number");this[r]=I.max||1/0;const D=I.length||p;if(this[l]=typeof D!="function"?p:D,this[h]=I.stale||!1,I.maxAge&&typeof I.maxAge!="number")throw new TypeError("maxAge must be a number");this[c]=I.maxAge||0,this[d]=I.dispose,this[f]=I.noDisposeOnSet||!1,this[y]=I.updateAgeOnGet||!1,this.reset()}set max(I){if(typeof I!="number"||I<0)throw new TypeError("max must be a non-negative number");this[r]=I||1/0,b(this)}get max(){return this[r]}set allowStale(I){this[h]=!!I}get allowStale(){return this[h]}set maxAge(I){if(typeof I!="number")throw new TypeError("maxAge must be a non-negative number");this[c]=I,b(this)}get maxAge(){return this[c]}set lengthCalculator(I){typeof I!="function"&&(I=p),I!==this[l]&&(this[l]=I,this[o]=0,this[g].forEach(D=>{D.length=this[l](D.value,D.key),this[o]+=D.length})),b(this)}get lengthCalculator(){return this[l]}get length(){return this[o]}get itemCount(){return this[g].length}rforEach(I,D){D=D||this;for(let V=this[g].tail;V!==null;){const G=V.prev;S(this,I,V,D),V=G}}forEach(I,D){D=D||this;for(let V=this[g].head;V!==null;){const G=V.next;S(this,I,V,D),V=G}}keys(){return this[g].toArray().map(I=>I.key)}values(){return this[g].toArray().map(I=>I.value)}reset(){this[d]&&this[g]&&this[g].length&&this[g].forEach(I=>this[d](I.key,I.value)),this[m]=new Map,this[g]=new n,this[o]=0}dump(){return this[g].map(I=>!_(this,I)&&{k:I.key,v:I.value,e:I.now+(I.maxAge||0)}).toArray().filter(I=>I)}dumpLru(){return this[g]}set(I,D,V){if((V=V||this[c])&&typeof V!="number")throw new TypeError("maxAge must be a number");const G=V?Date.now():0,F=this[l](D,I);if(this[m].has(I)){if(F>this[r])return k(this,this[m].get(I)),!1;const T=this[m].get(I).value;return this[d]&&(this[f]||this[d](I,T.value)),T.now=G,T.maxAge=V,T.value=D,this[o]+=F-T.length,T.length=F,this.get(I),b(this),!0}const P=new R(I,D,F,G,V);return P.length>this[r]?(this[d]&&this[d](I,D),!1):(this[o]+=P.length,this[g].unshift(P),this[m].set(I,this[g].head),b(this),!0)}has(I){if(!this[m].has(I))return!1;const D=this[m].get(I).value;return!_(this,D)}get(I){return x(this,I,!0)}peek(I){return x(this,I,!1)}pop(){const I=this[g].tail;return I?(k(this,I),I.value):null}del(I){k(this,this[m].get(I))}load(I){this.reset();const D=Date.now();for(let V=I.length-1;V>=0;V--){const G=I[V],F=G.e||0;if(F===0)this.set(G.k,G.v);else{const P=F-D;P>0&&this.set(G.k,G.v,P)}}}prune(){this[m].forEach((I,D)=>x(this,D,!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 l in r.types){const h=r.types[l];r.codes[h]=l}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<[0,1].map(c=>[0,1].map(d=>{const f=n.alloc(1);return f.writeUInt8(r.codes[l]<n.from([l])),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"),o=i("events");class l extends o{constructor(){super(),this._array=new Array(20),this._i=0}write(c){return this._array[this._i++]=c,!0}concat(){let c=0;const d=new Array(this._array.length),f=this._array;let g,m=0;for(g=0;g>8,0),d.writeUInt8(255&c,1),d}a.exports={cache:o,generateCache:function(){for(let c=0;c<65536;c++)o[c]=h(c)},generateNumber:h,genBufVariableByteInt:function(c){let d=0,f=0;const g=n.allocUnsafe(4);do d=c%128|0,(c=c/128|0)>0&&(d|=128),g.writeUInt8(d,f++);while(c>0&&f<4);return c>0&&(f=0),l?g.subarray(0,f):g.slice(0,f)},generate4ByteBuffer:function(c){const d=n.allocUnsafe(4);return d.writeUInt32BE(c,0),d}}}).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"),o=i("./packet"),l=i("./constants"),h=i("debug")("mqtt-packet:parser");class c extends r{constructor(){super(),this.parser=this.constructor.parser}static parser(f){return this instanceof c?(this.settings=f||{},this._states=["_parseHeader","_parseLength","_parsePayload","_newPacket"],this._resetState(),this):new c().parser(f)}_resetState(){h("_resetState: resetting packet, error, _list, and _stateCounter"),this.packet=new o,this.error=null,this._list=n(),this._stateCounter=0}parse(f){for(this.error&&this._resetState(),this._list.append(f),h("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++,h("parse: state complete. _stateCounter is now: %d",this._stateCounter),h("parse: packet.length: %d, buffer list length: %d",this.packet.length,this._list.length),this._stateCounter>=this._states.length&&(this._stateCounter=0);return h("parse: exited while loop. packet: %d, buffer list length: %d",this.packet.length,this._list.length),this._list.length}_parseHeader(){const f=this._list.readUInt8(0);return this.packet.cmd=l.types[f>>l.CMD_SHIFT],this.packet.retain=(f&l.RETAIN_MASK)!=0,this.packet.qos=f>>l.QOS_SHIFT&l.QOS_MASK,this.packet.dup=(f&l.DUP_MASK)!=0,h("_parseHeader: packet: %o",this.packet),this._list.consume(1),!0}_parseLength(){const f=this._parseVarByteNum(!0);return f&&(this.packet.length=f.value,this._list.consume(f.bytes)),h("_parseLength %d",f.value),!!f}_parsePayload(){h("_parsePayload: payload %O",this._list);let f=!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"))}f=!0}return h("_parsePayload complete result: %s",f),f}_parseConnect(){let f,g,m,y;h("_parseConnect");const p={},x=this.packet,_=this._parseString();if(_===null)return this._emitError(new Error("Cannot parse protocolId"));if(_!=="MQTT"&&_!=="MQIsdp")return this._emitError(new Error("Invalid protocolId"));if(x.protocolId=_,this._pos>=this._list.length)return this._emitError(new Error("Packet too short"));if(x.protocolVersion=this._list.readUInt8(this._pos),x.protocolVersion>=128&&(x.bridgeMode=!0,x.protocolVersion=x.protocolVersion-128),x.protocolVersion!==3&&x.protocolVersion!==4&&x.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(p.username=this._list.readUInt8(this._pos)&l.USERNAME_MASK,p.password=this._list.readUInt8(this._pos)&l.PASSWORD_MASK,p.will=this._list.readUInt8(this._pos)&l.WILL_FLAG_MASK,p.will&&(x.will={},x.will.retain=(this._list.readUInt8(this._pos)&l.WILL_RETAIN_MASK)!=0,x.will.qos=(this._list.readUInt8(this._pos)&l.WILL_QOS_MASK)>>l.WILL_QOS_SHIFT),x.clean=(this._list.readUInt8(this._pos)&l.CLEAN_SESSION_MASK)!=0,this._pos++,x.keepalive=this._parseNum(),x.keepalive===-1)return this._emitError(new Error("Packet too short"));if(x.protocolVersion===5){const k=this._parseProperties();Object.getOwnPropertyNames(k).length&&(x.properties=k)}const b=this._parseString();if(b===null)return this._emitError(new Error("Packet too short"));if(x.clientId=b,h("_parseConnect: packet.clientId: %s",x.clientId),p.will){if(x.protocolVersion===5){const k=this._parseProperties();Object.getOwnPropertyNames(k).length&&(x.will.properties=k)}if((f=this._parseString())===null)return this._emitError(new Error("Cannot parse will topic"));if(x.will.topic=f,h("_parseConnect: packet.will.topic: %s",x.will.topic),(g=this._parseBuffer())===null)return this._emitError(new Error("Cannot parse will payload"));x.will.payload=g,h("_parseConnect: packet.will.paylaod: %s",x.will.payload)}if(p.username){if((y=this._parseString())===null)return this._emitError(new Error("Cannot parse username"));x.username=y,h("_parseConnect: packet.username: %s",x.username)}if(p.password){if((m=this._parseBuffer())===null)return this._emitError(new Error("Cannot parse password"));x.password=m}return this.settings=x,h("_parseConnect: complete"),x}_parseConnack(){h("_parseConnack");const f=this.packet;if(this._list.length<1)return null;if(f.sessionPresent=!!(this._list.readUInt8(this._pos++)&l.SESSIONPRESENT_MASK),this.settings.protocolVersion===5)this._list.length>=2?f.reasonCode=this._list.readUInt8(this._pos++):f.reasonCode=0;else{if(this._list.length<2)return null;f.returnCode=this._list.readUInt8(this._pos++)}if(f.returnCode===-1||f.reasonCode===-1)return this._emitError(new Error("Cannot parse return code"));if(this.settings.protocolVersion===5){const g=this._parseProperties();Object.getOwnPropertyNames(g).length&&(f.properties=g)}h("_parseConnack: complete")}_parsePublish(){h("_parsePublish");const f=this.packet;if(f.topic=this._parseString(),f.topic===null)return this._emitError(new Error("Cannot parse topic"));if(!(f.qos>0)||this._parseMessageId()){if(this.settings.protocolVersion===5){const g=this._parseProperties();Object.getOwnPropertyNames(g).length&&(f.properties=g)}f.payload=this._list.slice(this._pos,f.length),h("_parsePublish: payload from buffer list: %o",f.payload)}}_parseSubscribe(){h("_parseSubscribe");const f=this.packet;let g,m,y,p,x,_,b;if(f.qos!==1)return this._emitError(new Error("Wrong subscribe header"));if(f.subscriptions=[],this._parseMessageId()){if(this.settings.protocolVersion===5){const k=this._parseProperties();Object.getOwnPropertyNames(k).length&&(f.properties=k)}for(;this._pos=f.length)return this._emitError(new Error("Malformed Subscribe Payload"));y=(m=this._parseByte())&l.SUBSCRIBE_OPTIONS_QOS_MASK,_=(m>>l.SUBSCRIBE_OPTIONS_NL_SHIFT&l.SUBSCRIBE_OPTIONS_NL_MASK)!=0,x=(m>>l.SUBSCRIBE_OPTIONS_RAP_SHIFT&l.SUBSCRIBE_OPTIONS_RAP_MASK)!=0,p=m>>l.SUBSCRIBE_OPTIONS_RH_SHIFT&l.SUBSCRIBE_OPTIONS_RH_MASK,b={topic:g,qos:y},this.settings.protocolVersion===5?(b.nl=_,b.rap=x,b.rh=p):this.settings.bridgeMode&&(b.rh=0,b.rap=!0,b.nl=!0),h("_parseSubscribe: push subscription `%s` to subscription",b),f.subscriptions.push(b)}}}_parseSuback(){h("_parseSuback");const f=this.packet;if(this.packet.granted=[],this._parseMessageId()){if(this.settings.protocolVersion===5){const g=this._parseProperties();Object.getOwnPropertyNames(g).length&&(f.properties=g)}for(;this._pos2?(f.reasonCode=this._parseByte(),h("_parseConfirmation: packet.reasonCode `%d`",f.reasonCode)):f.reasonCode=0,f.length>3)){const g=this._parseProperties();Object.getOwnPropertyNames(g).length&&(f.properties=g)}return!0}_parseDisconnect(){const f=this.packet;if(h("_parseDisconnect"),this.settings.protocolVersion===5){this._list.length>0?f.reasonCode=this._parseByte():f.reasonCode=0;const g=this._parseProperties();Object.getOwnPropertyNames(g).length&&(f.properties=g)}return h("_parseDisconnect result: true"),!0}_parseAuth(){h("_parseAuth");const f=this.packet;if(this.settings.protocolVersion!==5)return this._emitError(new Error("Not supported auth packet for this version MQTT"));f.reasonCode=this._parseByte();const g=this._parseProperties();return Object.getOwnPropertyNames(g).length&&(f.properties=g),h("_parseAuth: result: true"),!0}_parseMessageId(){const f=this.packet;return f.messageId=this._parseNum(),f.messageId===null?(this._emitError(new Error("Cannot parse messageId")),!1):(h("_parseMessageId: packet.messageId %d",f.messageId),!0)}_parseString(f){const g=this._parseNum(),m=g+this._pos;if(g===-1||m>this._list.length||m>this.packet.length)return null;const y=this._list.toString("utf8",this._pos,m);return this._pos+=g,h("_parseString: result: %s",y),y}_parseStringPair(){return h("_parseStringPair"),{name:this._parseString(),value:this._parseString()}}_parseBuffer(){const f=this._parseNum(),g=f+this._pos;if(f===-1||g>this._list.length||g>this.packet.length)return null;const m=this._list.slice(this._pos,g);return this._pos+=f,h("_parseBuffer: result: %o",m),m}_parseNum(){if(this._list.length-this._pos<2)return-1;const f=this._list.readUInt16BE(this._pos);return this._pos+=2,h("_parseNum: result: %s",f),f}_parse4ByteNum(){if(this._list.length-this._pos<4)return-1;const f=this._list.readUInt32BE(this._pos);return this._pos+=4,h("_parse4ByteNum: result: %s",f),f}_parseVarByteNum(f){h("_parseVarByteNum");let g,m=0,y=1,p=0,x=!1;const _=this._pos?this._pos:0;for(;m<4&&_+m=m&&this._emitError(new Error("Invalid variable byte integer")),_&&(this._pos+=m),h("_parseVarByteNum: result: %o",x=!!x&&(f?{bytes:m,value:p}:p)),x}_parseByte(){let f;return this._pos=4)&&(A||ht))J+=n.byteLength(A)+2;else{if(ut<4)return U.emit("error",new Error("clientId must be supplied before 3.1.1")),!1;if(1*ht==0)return U.emit("error",new Error("clientId must be given if cleanSession set to 0")),!1}if(typeof E!="number"||E<0||E>65535||E%1!=0)return U.emit("error",new Error("Invalid keepalive")),!1;if(J+=2,J+=1,ut===5){var rt=P(U,X);if(!rt)return!1;J+=rt.length}if(lt){if(typeof lt!="object")return U.emit("error",new Error("Invalid will")),!1;if(!lt.topic||typeof lt.topic!="string")return U.emit("error",new Error("Invalid will topic")),!1;if(J+=n.byteLength(lt.topic)+2,J+=2,lt.payload){if(!(lt.payload.length>=0))return U.emit("error",new Error("Invalid will payload")),!1;typeof lt.payload=="string"?J+=n.byteLength(lt.payload):J+=lt.payload.length}var yt={};if(ut===5){if(!(yt=P(U,lt.properties)))return!1;J+=yt.length}}let mt=!1;if(B!=null){if(!at(B))return U.emit("error",new Error("Invalid username")),!1;mt=!0,J+=n.byteLength(B)+2}if(N!=null){if(!mt)return U.emit("error",new Error("Username is required to use password")),!1;if(!at(N))return U.emit("error",new Error("Invalid password")),!1;J+=Z(N)+2}U.write(r.CONNECT_HEADER),S(U,J),F(U,it),st.bridgeMode&&(ut+=128),U.write(ut===131?r.VERSION131:ut===132?r.VERSION132:ut===4?r.VERSION4:ut===5?r.VERSION5:r.VERSION3);let Et=0;return Et|=B!=null?r.USERNAME_MASK:0,Et|=N!=null?r.PASSWORD_MASK:0,Et|=lt&<.retain?r.WILL_RETAIN_MASK:0,Et|=lt&<.qos?lt.qos<0&&x(U,A),X!=null&&X.write(),d("publish: payload: %o",E),U.write(E)}(q,W,j);case"puback":case"pubrec":case"pubrel":case"pubcomp":return function(K,U,tt){const st=tt?tt.protocolVersion:4,it=K||{},ut=it.cmd||"puback",lt=it.messageId,ht=it.dup&&ut==="pubrel"?r.DUP_MASK:0;let E=0;const A=it.reasonCode,B=it.properties;let N=st===5?3:2;if(ut==="pubrel"&&(E=1),typeof lt!="number")return U.emit("error",new Error("Invalid messageId")),!1;let X=null;if(st===5&&typeof B=="object"){if(!(X=T(U,B,tt,N)))return!1;N+=X.length}return U.write(r.ACKS[ut][E][ht][0]),S(U,N),x(U,lt),st===5&&U.write(n.from([A])),X!==null&&X.write(),!0}(q,W,j);case"subscribe":return function(K,U,tt){d("subscribe: packet: ");const st=tt?tt.protocolVersion:4,it=K||{},ut=it.dup?r.DUP_MASK:0,lt=it.messageId,ht=it.subscriptions,E=it.properties;let A=0;if(typeof lt!="number")return U.emit("error",new Error("Invalid messageId")),!1;A+=2;let B=null;if(st===5){if(!(B=P(U,E)))return!1;A+=B.length}if(typeof ht!="object"||!ht.length)return U.emit("error",new Error("Invalid subscriptions")),!1;for(let X=0;X2)return U.emit("error",new Error("Invalid subscriptions - invalid Retain Handling")),!1}A+=n.byteLength(J)+2+1}d("subscribe: writing to stream: %o",r.SUBSCRIBE_HEADER),U.write(r.SUBSCRIBE_HEADER[1][ut?1:0][0]),S(U,A),x(U,lt),B!==null&&B.write();let N=!0;for(const X of ht){const J=X.topic,rt=X.qos,yt=+X.nl,mt=+X.rap,Et=X.rh;let Ft;I(U,J),Ft=r.SUBSCRIBE_OPTIONS_QOS[rt],st===5&&(Ft|=yt?r.SUBSCRIBE_OPTIONS_NL:0,Ft|=mt?r.SUBSCRIBE_OPTIONS_RAP:0,Ft|=Et?r.SUBSCRIBE_OPTIONS_RH[Et]:0),N=U.write(n.from([Ft]))}return N}(q,W,j);case"suback":return function(K,U,tt){const st=tt?tt.protocolVersion:4,it=K||{},ut=it.messageId,lt=it.granted,ht=it.properties;let E=0;if(typeof ut!="number")return U.emit("error",new Error("Invalid messageId")),!1;if(E+=2,typeof lt!="object"||!lt.length)return U.emit("error",new Error("Invalid qos vector")),!1;for(let B=0;Bx===V,set(q){q?(f&&Object.keys(f).length!==0||(_=!0),x=V):(_=!1,x=G)}});const R={};function S(q,W){if(W>r.VARBYTEINT_MAX)return q.emit("error",new Error(`Invalid variable byte integer: ${W}`)),!1;let j=R[W];return j||(j=y(W),W<16384&&(R[W]=j)),d("writeVarByteInt: writing to stream: %o",j),q.write(j)}function I(q,W){const j=n.byteLength(W);return x(q,j),d("writeString: %s",W),q.write(W,"utf8")}function D(q,W,j){I(q,W),I(q,j)}function V(q,W){return d("writeNumberCached: number: %d",W),d("writeNumberCached: %o",f[W]),q.write(f[W])}function G(q,W){const j=g(W);return d("writeNumberGenerated: %o",j),q.write(j)}function F(q,W){typeof W=="string"?I(q,W):W?(x(q,W.length),q.write(W)):x(q,0)}function P(q,W){if(typeof W!="object"||W.length!=null)return{length:1,write(){$(q,{},0)}};let j=0;function K(U,tt){let st=0;switch(r.propertiesTypes[U]){case"byte":if(typeof tt!="boolean")return q.emit("error",new Error(`Invalid ${U}: ${tt}`)),!1;st+=2;break;case"int8":if(typeof tt!="number"||tt<0||tt>255)return q.emit("error",new Error(`Invalid ${U}: ${tt}`)),!1;st+=2;break;case"binary":if(tt&&tt===null)return q.emit("error",new Error(`Invalid ${U}: ${tt}`)),!1;st+=1+n.byteLength(tt)+2;break;case"int16":if(typeof tt!="number"||tt<0||tt>65535)return q.emit("error",new Error(`Invalid ${U}: ${tt}`)),!1;st+=3;break;case"int32":if(typeof tt!="number"||tt<0||tt>4294967295)return q.emit("error",new Error(`Invalid ${U}: ${tt}`)),!1;st+=5;break;case"var":if(typeof tt!="number"||tt<0||tt>268435455)return q.emit("error",new Error(`Invalid ${U}: ${tt}`)),!1;st+=1+n.byteLength(y(tt));break;case"string":if(typeof tt!="string")return q.emit("error",new Error(`Invalid ${U}: ${tt}`)),!1;st+=3+n.byteLength(tt.toString());break;case"pair":if(typeof tt!="object")return q.emit("error",new Error(`Invalid ${U}: ${tt}`)),!1;st+=Object.getOwnPropertyNames(tt).reduce((it,ut)=>{const lt=tt[ut];return Array.isArray(lt)?it+=lt.reduce((ht,E)=>ht+=3+n.byteLength(ut.toString())+2+n.byteLength(E.toString()),0):it+=3+n.byteLength(ut.toString())+2+n.byteLength(tt[ut].toString()),it},0);break;default:return q.emit("error",new Error(`Invalid property ${U}: ${tt}`)),!1}return st}if(W)for(const U in W){let tt=0,st=0;const it=W[U];if(Array.isArray(it))for(let ut=0;uttt;){const it=U.shift();if(!it||!W[it])return!1;delete W[it],st=P(q,W)}return st}function L(q,W,j){switch(r.propertiesTypes[W]){case"byte":q.write(n.from([r.properties[W]])),q.write(n.from([+j]));break;case"int8":q.write(n.from([r.properties[W]])),q.write(n.from([j]));break;case"binary":q.write(n.from([r.properties[W]])),F(q,j);break;case"int16":q.write(n.from([r.properties[W]])),x(q,j);break;case"int32":q.write(n.from([r.properties[W]])),function(K,U){const tt=p(U);d("write4ByteNumber: %o",tt),K.write(tt)}(q,j);break;case"var":q.write(n.from([r.properties[W]])),S(q,j);break;case"string":q.write(n.from([r.properties[W]])),I(q,j);break;case"pair":Object.getOwnPropertyNames(j).forEach(K=>{const U=j[K];Array.isArray(U)?U.forEach(tt=>{q.write(n.from([r.properties[W]])),D(q,K.toString(),tt.toString())}):(q.write(n.from([r.properties[W]])),D(q,K.toString(),U.toString()))});break;default:return q.emit("error",new Error(`Invalid property ${W} value: ${j}`)),!1}}function $(q,W,j){S(q,j);for(const K in W)if(Object.prototype.hasOwnProperty.call(W,K)&&W[K]!==null){const U=W[K];if(Array.isArray(U))for(let tt=0;tt=1.5*m;return Math.round(f/m)+" "+y+(p?"s":"")}a.exports=function(f,g){g=g||{};var m=typeof f;if(m==="string"&&f.length>0)return function(y){if(!((y=String(y)).length>100)){var p=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(y);if(!!p){var x=parseFloat(p[1]);switch((p[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return x*c;case"weeks":case"week":case"w":return x*h;case"days":case"day":case"d":return x*l;case"hours":case"hour":case"hrs":case"hr":case"h":return x*o;case"minutes":case"minute":case"mins":case"min":case"m":return x*r;case"seconds":case"second":case"secs":case"sec":case"s":return x*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return x;default:return}}}}(f);if(m==="number"&&isFinite(f))return g.long?function(y){var p=Math.abs(y);return p>=l?d(y,p,l,"day"):p>=o?d(y,p,o,"hour"):p>=r?d(y,p,r,"minute"):p>=n?d(y,p,n,"second"):y+" ms"}(f):function(y){var p=Math.abs(y);return p>=l?Math.round(y/l)+"d":p>=o?Math.round(y/o)+"h":p>=r?Math.round(y/r)+"m":p>=n?Math.round(y/n)+"s":y+"ms"}(f);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(f))}},{}],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"),o=i("debug")("number-allocator:error");function l(c,d){this.low=c,this.high=d}function h(c,d){if(!(this instanceof h))return new h(c,d);this.min=c,this.max=d,this.ss=new n([],(f,g)=>f.compare(g)),r("Create"),this.clear()}l.prototype.equals=function(c){return this.low===c.low&&this.high===c.high},l.prototype.compare=function(c){return this.lowc)return!1;if(f.low===c)return++f.low,r("use():"+c),!0;if(f.high===c)return--f.high,r("use():"+c),!0;const g=f.low;return f.low=c+1,this.ss.insert(new l(g,c-1)),r("use():"+c),!0}return r("use():failed"),!1},h.prototype.free=function(c){if(cthis.max)return void o("free():"+c+" is out of range");const d=new l(c,c),f=this.ss.lowerBound(d);if(f){if(f.low<=c&&c<=f.high)return void o("free():"+c+" has already been vacant");if(f===this.ss.front())c+1===f.low?--f.low:this.ss.insert(d);else{const g=this.ss.reverseLowerBound(d);g.high+1===c?c+1===f.low?(this.ss.eraseElementByValue(g),f.low=g.low):g.high=c:c+1===f.low?f.low=c:this.ss.insert(d)}}else{if(f===this.ss.front())return void this.ss.insert(d);const g=this.ss.reverseLowerBound(d);g.high+1===c?g.high=c:this.ss.insert(d)}r("free():"+c)},h.prototype.clear=function(){r("clear()"),this.ss.clear(),this.ss.insert(new l(this.min,this.max))},h.prototype.intervalCount=function(){return this.ss.size()},h.prototype.dump=function(){console.log("length:"+this.ss.size());for(const c of this.ss)console.log(c)},a.exports=h},{debug:18,"js-sdsl":36}],48:[function(i,a,s){var n=i("wrappy");function r(l){var h=function(){return h.called?h.value:(h.called=!0,h.value=l.apply(this,arguments))};return h.called=!1,h}function o(l){var h=function(){if(h.called)throw new Error(h.onceError);return h.called=!0,h.value=l.apply(this,arguments)},c=l.name||"Function wrapped with `once`";return h.onceError=c+" shouldn't be called more than once",h.called=!1,h}a.exports=n(r),a.exports.strict=n(o),r.proto=r(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return r(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return o(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,o,l,h){if(typeof r!="function")throw new TypeError('"callback" argument must be a function');var c,d,f=arguments.length;switch(f){case 0:case 1:return n.nextTick(r);case 2:return n.nextTick(function(){r.call(null,o)});case 3:return n.nextTick(function(){r.call(null,o,l)});case 4:return n.nextTick(function(){r.call(null,o,l,h)});default:for(c=new Array(f-1),d=0;d1)for(var R=1;R= 0x80 (not a basic code point)","invalid-input":"Invalid input"},V=g-m,G=Math.floor,F=String.fromCharCode;function P(K){throw new RangeError(D[K])}function T(K,U){for(var tt=K.length,st=[];tt--;)st[tt]=U(K[tt]);return st}function L(K,U){var tt=K.split("@"),st="";return tt.length>1&&(st=tt[0]+"@",K=tt[1]),st+T((K=K.replace(I,".")).split("."),U).join(".")}function $(K){for(var U,tt,st=[],it=0,ut=K.length;it=55296&&U<=56319&&it65535&&(tt+=F((U-=65536)>>>10&1023|55296),U=56320|1023&U),tt+=F(U)}).join("")}function at(K,U){return K+22+75*(K<26)-((U!=0)<<5)}function q(K,U,tt){var st=0;for(K=tt?G(K/x):K>>1,K+=G(K/U);K>V*y>>1;st+=g)K=G(K/V);return G(st+(V+1)*K/(K+p))}function W(K){var U,tt,st,it,ut,lt,ht,E,A,B,N,X=[],J=K.length,rt=0,yt=b,mt=_;for((tt=K.lastIndexOf(k))<0&&(tt=0),st=0;st=128&&P("not-basic"),X.push(K.charCodeAt(st));for(it=tt>0?tt+1:0;it=J&&P("invalid-input"),((E=(N=K.charCodeAt(it++))-48<10?N-22:N-65<26?N-65:N-97<26?N-97:g)>=g||E>G((f-rt)/lt))&&P("overflow"),rt+=E*lt,!(E<(A=ht<=mt?m:ht>=mt+y?y:ht-mt));ht+=g)lt>G(f/(B=g-A))&&P("overflow"),lt*=B;mt=q(rt-ut,U=X.length+1,ut==0),G(rt/U)>f-yt&&P("overflow"),yt+=G(rt/U),rt%=U,X.splice(rt++,0,yt)}return Z(X)}function j(K){var U,tt,st,it,ut,lt,ht,E,A,B,N,X,J,rt,yt,mt=[];for(X=(K=$(K)).length,U=b,tt=0,ut=_,lt=0;lt=U&&NG((f-tt)/(J=st+1))&&P("overflow"),tt+=(ht-U)*J,U=ht,lt=0;ltf&&P("overflow"),N==U){for(E=tt,A=g;!(E<(B=A<=ut?m:A>=ut+y?y:A-ut));A+=g)yt=E-B,rt=g-B,mt.push(F(at(B+yt%rt,0))),E=G(yt/rt);mt.push(F(at(E,0))),ut=q(tt,J,st==it),tt=0,++st}++tt,++U}return mt.join("")}if(c={version:"1.4.1",ucs2:{decode:$,encode:Z},decode:W,encode:j,toASCII:function(K){return L(K,function(U){return S.test(U)?"xn--"+j(U):U})},toUnicode:function(K){return L(K,function(U){return R.test(U)?W(U.slice(4).toLowerCase()):U})}},o&&l)if(a.exports==o)l.exports=c;else for(d in c)c.hasOwnProperty(d)&&(o[d]=c[d]);else r.punycode=c})(this)}).call(this)}).call(this,typeof Oe<"u"?Oe:typeof self<"u"?self:typeof window<"u"?window:{})},{}],52:[function(i,a,s){function n(o,l){return Object.prototype.hasOwnProperty.call(o,l)}a.exports=function(o,l,h,c){l=l||"&",h=h||"=";var d={};if(typeof o!="string"||o.length===0)return d;var f=/\+/g;o=o.split(l);var g=1e3;c&&typeof c.maxKeys=="number"&&(g=c.maxKeys);var m=o.length;g>0&&m>g&&(m=g);for(var y=0;y=0?(p=k.substr(0,R),x=k.substr(R+1)):(p=k,x=""),_=decodeURIComponent(p),b=decodeURIComponent(x),n(d,_)?r(d[_])?d[_].push(b):d[_]=[d[_],b]:d[_]=b}return d};var r=Array.isArray||function(o){return Object.prototype.toString.call(o)==="[object Array]"}},{}],53:[function(i,a,s){var n=function(h){switch(typeof h){case"string":return h;case"boolean":return h?"true":"false";case"number":return isFinite(h)?h:"";default:return""}};a.exports=function(h,c,d,f){return c=c||"&",d=d||"=",h===null&&(h=void 0),typeof h=="object"?o(l(h),function(g){var m=encodeURIComponent(n(g))+d;return r(h[g])?o(h[g],function(y){return m+encodeURIComponent(n(y))}).join(c):m+encodeURIComponent(n(h[g]))}).join(c):f?encodeURIComponent(n(f))+d+encodeURIComponent(n(h)):""};var r=Array.isArray||function(h){return Object.prototype.toString.call(h)==="[object Array]"};function o(h,c){if(h.map)return h.map(c);for(var d=[],f=0;f2?"one of ".concat(h," ").concat(l.slice(0,c-1).join(", "),", or ")+l[c-1]:c===2?"one of ".concat(h," ").concat(l[0]," or ").concat(l[1]):"of ".concat(h," ").concat(l[0])}return"of ".concat(h," ").concat(String(l))}r("ERR_INVALID_OPT_VALUE",function(l,h){return'The value "'+h+'" is invalid for option "'+l+'"'},TypeError),r("ERR_INVALID_ARG_TYPE",function(l,h,c){var d,f,g;if(typeof h=="string"&&(f="not ",h.substr(0,f.length)===f)?(d="must not be",h=h.replace(/^not /,"")):d="must be",function(y,p,x){return(x===void 0||x>y.length)&&(x=y.length),y.substring(x-p.length,x)===p}(l," argument"))g="The ".concat(l," ").concat(d," ").concat(o(h,"type"));else{var m=function(y,p,x){return typeof x!="number"&&(x=0),!(x+p.length>y.length)&&y.indexOf(p,x)!==-1}(l,".")?"property":"argument";g='The "'.concat(l,'" ').concat(m," ").concat(d," ").concat(o(h,"type"))}return g+=". Received type ".concat(typeof c)},TypeError),r("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),r("ERR_METHOD_NOT_IMPLEMENTED",function(l){return"The "+l+" method is not implemented"}),r("ERR_STREAM_PREMATURE_CLOSE","Premature close"),r("ERR_STREAM_DESTROYED",function(l){return"Cannot call "+l+" 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(l){return"Unknown encoding: "+l},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(y){var p=[];for(var x in y)p.push(x);return p};a.exports=f;var o=i("./_stream_readable"),l=i("./_stream_writable");i("inherits")(f,o);for(var h=r(l.prototype),c=0;c0)if(typeof A=="string"||rt.objectMode||Object.getPrototypeOf(A)===c.prototype||(A=function(yt){return c.from(yt)}(A)),N)rt.endEmitted?V(E,new D):L(E,rt,A,!0);else if(rt.ended)V(E,new S);else{if(rt.destroyed)return!1;rt.reading=!1,rt.decoder&&!B?(A=rt.decoder.write(A),rt.objectMode||A.length!==0?L(E,rt,A,!1):W(E,rt)):L(E,rt,A,!1)}else N||(rt.reading=!1,W(E,rt));return!rt.ended&&(rt.lengthA.highWaterMark&&(A.highWaterMark=function(B){return B>=$?B=$:(B--,B|=B>>>1,B|=B>>>2,B|=B>>>4,B|=B>>>8,B|=B>>>16,B++),B}(E)),E<=A.length?E:A.ended?A.length:(A.needReadable=!0,0))}function at(E){var A=E._readableState;f("emitReadable",A.needReadable,A.emittedReadable),A.needReadable=!1,A.emittedReadable||(f("emitReadable",A.flowing),A.emittedReadable=!0,n.nextTick(q,E))}function q(E){var A=E._readableState;f("emitReadable_",A.destroyed,A.length,A.ended),A.destroyed||!A.length&&!A.ended||(E.emit("readable"),A.emittedReadable=!1),A.needReadable=!A.flowing&&!A.ended&&A.length<=A.highWaterMark,st(E)}function W(E,A){A.readingMore||(A.readingMore=!0,n.nextTick(j,E,A))}function j(E,A){for(;!A.reading&&!A.ended&&(A.length0,A.resumeScheduled&&!A.paused?A.flowing=!0:E.listenerCount("data")>0&&E.resume()}function U(E){f("readable nexttick read 0"),E.read(0)}function tt(E,A){f("resume",A.reading),A.reading||E.read(0),A.resumeScheduled=!1,E.emit("resume"),st(E),A.flowing&&!A.reading&&E.read(0)}function st(E){var A=E._readableState;for(f("flow",A.flowing);A.flowing&&E.read()!==null;);}function it(E,A){return A.length===0?null:(A.objectMode?B=A.buffer.shift():!E||E>=A.length?(B=A.decoder?A.buffer.join(""):A.buffer.length===1?A.buffer.first():A.buffer.concat(A.length),A.buffer.clear()):B=A.buffer.consume(E,A.decoder),B);var B}function ut(E){var A=E._readableState;f("endReadable",A.endEmitted),A.endEmitted||(A.ended=!0,n.nextTick(lt,A,E))}function lt(E,A){if(f("endReadableNT",E.endEmitted,E.length),!E.endEmitted&&E.length===0&&(E.endEmitted=!0,A.readable=!1,A.emit("end"),E.autoDestroy)){var B=A._writableState;(!B||B.autoDestroy&&B.finished)&&A.destroy()}}function ht(E,A){for(var B=0,N=E.length;B=A.highWaterMark:A.length>0)||A.ended))return f("read: emitReadable",A.length,A.ended),A.length===0&&A.ended?ut(this):at(this),null;if((E=Z(E,A))===0&&A.ended)return A.length===0&&ut(this),null;var N,X=A.needReadable;return f("need readable",X),(A.length===0||A.length-E0?it(E,A):null)===null?(A.needReadable=A.length<=A.highWaterMark,E=0):(A.length-=E,A.awaitDrain=0),A.length===0&&(A.ended||(A.needReadable=!0),B!==E&&A.ended&&ut(this)),N!==null&&this.emit("data",N),N},P.prototype._read=function(E){V(this,new I("_read()"))},P.prototype.pipe=function(E,A){var B=this,N=this._readableState;switch(N.pipesCount){case 0:N.pipes=E;break;case 1:N.pipes=[N.pipes,E];break;default:N.pipes.push(E)}N.pipesCount+=1,f("pipe count=%d opts=%j",N.pipesCount,A);var X=(!A||A.end!==!1)&&E!==n.stdout&&E!==n.stderr?rt:oe;function J(Vt,Gt){f("onunpipe"),Vt===B&&Gt&&Gt.hasUnpiped===!1&&(Gt.hasUnpiped=!0,f("cleanup"),E.removeListener("close",Ge),E.removeListener("finish",we),E.removeListener("drain",yt),E.removeListener("error",Ft),E.removeListener("unpipe",J),B.removeListener("end",rt),B.removeListener("end",oe),B.removeListener("data",Et),mt=!0,!N.awaitDrain||E._writableState&&!E._writableState.needDrain||yt())}function rt(){f("onend"),E.end()}N.endEmitted?n.nextTick(X):B.once("end",X),E.on("unpipe",J);var yt=function(Vt){return function(){var Gt=Vt._readableState;f("pipeOnDrain",Gt.awaitDrain),Gt.awaitDrain&&Gt.awaitDrain--,Gt.awaitDrain===0&&l(Vt,"data")&&(Gt.flowing=!0,st(Vt))}}(B);E.on("drain",yt);var mt=!1;function Et(Vt){f("ondata");var Gt=E.write(Vt);f("dest.write",Gt),Gt===!1&&((N.pipesCount===1&&N.pipes===E||N.pipesCount>1&&ht(N.pipes,E)!==-1)&&!mt&&(f("false write response, pause",N.awaitDrain),N.awaitDrain++),B.pause())}function Ft(Vt){f("onerror",Vt),oe(),E.removeListener("error",Ft),l(E,"error")===0&&V(E,Vt)}function Ge(){E.removeListener("finish",we),oe()}function we(){f("onfinish"),E.removeListener("close",Ge),oe()}function oe(){f("unpipe"),B.unpipe(E)}return B.on("data",Et),function(Vt,Gt,ss){if(typeof Vt.prependListener=="function")return Vt.prependListener(Gt,ss);Vt._events&&Vt._events[Gt]?Array.isArray(Vt._events[Gt])?Vt._events[Gt].unshift(ss):Vt._events[Gt]=[ss,Vt._events[Gt]]:Vt.on(Gt,ss)}(E,"error",Ft),E.once("close",Ge),E.once("finish",we),E.emit("pipe",B),N.flowing||(f("pipe resume"),B.resume()),E},P.prototype.unpipe=function(E){var A=this._readableState,B={hasUnpiped:!1};if(A.pipesCount===0)return this;if(A.pipesCount===1)return E&&E!==A.pipes?this:(E||(E=A.pipes),A.pipes=null,A.pipesCount=0,A.flowing=!1,E&&E.emit("unpipe",this,B),this);if(!E){var N=A.pipes,X=A.pipesCount;A.pipes=null,A.pipesCount=0,A.flowing=!1;for(var J=0;J0,N.flowing!==!1&&this.resume()):E==="readable"&&(N.endEmitted||N.readableListening||(N.readableListening=N.needReadable=!0,N.flowing=!1,N.emittedReadable=!1,f("on readable",N.length,N.reading),N.length?at(this):N.reading||n.nextTick(U,this))),B},P.prototype.addListener=P.prototype.on,P.prototype.removeListener=function(E,A){var B=h.prototype.removeListener.call(this,E,A);return E==="readable"&&n.nextTick(K,this),B},P.prototype.removeAllListeners=function(E){var A=h.prototype.removeAllListeners.apply(this,arguments);return E!=="readable"&&E!==void 0||n.nextTick(K,this),A},P.prototype.resume=function(){var E=this._readableState;return E.flowing||(f("resume"),E.flowing=!E.readableListening,function(A,B){B.resumeScheduled||(B.resumeScheduled=!0,n.nextTick(tt,A,B))}(this,E)),E.paused=!1,this},P.prototype.pause=function(){return f("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(f("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},P.prototype.wrap=function(E){var A=this,B=this._readableState,N=!1;for(var X in E.on("end",function(){if(f("wrapped end"),B.decoder&&!B.ended){var rt=B.decoder.end();rt&&rt.length&&A.push(rt)}A.push(null)}),E.on("data",function(rt){f("wrapped data"),B.decoder&&(rt=B.decoder.write(rt)),(!B.objectMode||rt!=null)&&(B.objectMode||rt&&rt.length)&&(A.push(rt)||(N=!0,E.pause()))}),E)this[X]===void 0&&typeof E[X]=="function"&&(this[X]=function(rt){return function(){return E[rt].apply(E,arguments)}}(X));for(var J=0;J-1))throw new D(W);return this._writableState.defaultEncoding=W,this},Object.defineProperty(P.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(P.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),P.prototype._write=function(W,j,K){K(new _("_write()"))},P.prototype._writev=null,P.prototype.end=function(W,j,K){var U=this._writableState;return typeof W=="function"?(K=W,W=null,j=null):typeof j=="function"&&(K=j,j=null),W!=null&&this.write(W,j),U.corked&&(U.corked=1,this.uncork()),U.ending||function(tt,st,it){st.ending=!0,q(tt,st),it&&(st.finished?n.nextTick(it):tt.once("finish",it)),st.ended=!0,tt.writable=!1}(this,U,K),this},Object.defineProperty(P.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(P.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState!==void 0&&this._writableState.destroyed},set:function(W){this._writableState&&(this._writableState.destroyed=W)}}),P.prototype.destroy=m.destroy,P.prototype._undestroy=m.undestroy,P.prototype._destroy=function(W,j){j(W)}}).call(this)}).call(this,i("_process"),typeof Oe<"u"?Oe: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 o(k,R,S){return R in k?Object.defineProperty(k,R,{value:S,enumerable:!0,configurable:!0,writable:!0}):k[R]=S,k}var l=i("./end-of-stream"),h=Symbol("lastResolve"),c=Symbol("lastReject"),d=Symbol("error"),f=Symbol("ended"),g=Symbol("lastPromise"),m=Symbol("handlePromise"),y=Symbol("stream");function p(k,R){return{value:k,done:R}}function x(k){var R=k[h];if(R!==null){var S=k[y].read();S!==null&&(k[g]=null,k[h]=null,k[c]=null,R(p(S,!1)))}}var _=Object.getPrototypeOf(function(){}),b=Object.setPrototypeOf((o(r={get stream(){return this[y]},next:function(){var k=this,R=this[d];if(R!==null)return Promise.reject(R);if(this[f])return Promise.resolve(p(void 0,!0));if(this[y].destroyed)return new Promise(function(V,G){n.nextTick(function(){k[d]?G(k[d]):V(p(void 0,!0))})});var S,I=this[g];if(I)S=new Promise(function(V,G){return function(F,P){V.then(function(){G[f]?F(p(void 0,!0)):G[m](F,P)},P)}}(I,this));else{var D=this[y].read();if(D!==null)return Promise.resolve(p(D,!1));S=new Promise(this[m])}return this[g]=S,S}},Symbol.asyncIterator,function(){return this}),o(r,"return",function(){var k=this;return new Promise(function(R,S){k[y].destroy(null,function(I){I?S(I):R(p(void 0,!0))})})}),r),_);a.exports=function(k){var R,S=Object.create(b,(o(R={},y,{value:k,writable:!0}),o(R,h,{value:null,writable:!0}),o(R,c,{value:null,writable:!0}),o(R,d,{value:null,writable:!0}),o(R,f,{value:k._readableState.endEmitted,writable:!0}),o(R,m,{value:function(I,D){var V=S[y].read();V?(S[g]=null,S[h]=null,S[c]=null,I(p(V,!1))):(S[h]=I,S[c]=D)},writable:!0}),R));return S[g]=null,l(k,function(I){if(I&&I.code!=="ERR_STREAM_PREMATURE_CLOSE"){var D=S[c];return D!==null&&(S[g]=null,S[h]=null,S[c]=null,D(I)),void(S[d]=I)}var V=S[h];V!==null&&(S[g]=null,S[h]=null,S[c]=null,V(p(void 0,!0))),S[f]=!0}),k.on("readable",function(I){n.nextTick(x,I)}.bind(null,S)),S}}).call(this)}).call(this,i("_process"))},{"./end-of-stream":64,_process:50}],62:[function(i,a,s){function n(d,f){var g=Object.keys(d);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(d);f&&(m=m.filter(function(y){return Object.getOwnPropertyDescriptor(d,y).enumerable})),g.push.apply(g,m)}return g}function r(d,f,g){return f in d?Object.defineProperty(d,f,{value:g,enumerable:!0,configurable:!0,writable:!0}):d[f]=g,d}function o(d,f){for(var g=0;g0?this.tail.next=y:this.head=y,this.tail=y,++this.length}},{key:"unshift",value:function(m){var y={data:m,next:this.head};this.length===0&&(this.tail=y),this.head=y,++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 y=this.head,p=""+y.data;y=y.next;)p+=m+y.data;return p}},{key:"concat",value:function(m){if(this.length===0)return l.alloc(0);for(var y,p,x,_=l.allocUnsafe(m>>>0),b=this.head,k=0;b;)y=b.data,p=_,x=k,l.prototype.copy.call(y,p,x),k+=b.data.length,b=b.next;return _}},{key:"consume",value:function(m,y){var p;return m_.length?_.length:m;if(b===_.length?x+=_:x+=_.slice(0,m),(m-=b)===0){b===_.length?(++p,y.next?this.head=y.next:this.head=this.tail=null):(this.head=y,y.data=_.slice(b));break}++p}return this.length-=p,x}},{key:"_getBuffer",value:function(m){var y=l.allocUnsafe(m),p=this.head,x=1;for(p.data.copy(y),m-=p.data.length;p=p.next;){var _=p.data,b=m>_.length?_.length:m;if(_.copy(y,y.length-m,0,b),(m-=b)===0){b===_.length?(++x,p.next?this.head=p.next:this.head=this.tail=null):(this.head=p,p.data=_.slice(b));break}++x}return this.length-=x,y}},{key:c,value:function(m,y){return h(this,function(p){for(var x=1;x0,function(R){y||(y=R),R&&x.forEach(c),k||(x.forEach(c),p(y))})});return g.reduce(d)}},{"../../../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,o,l,h){var c=function(d,f,g){return d.highWaterMark!=null?d.highWaterMark:f?d[g]:null}(o,h,l);if(c!=null){if(!isFinite(c)||Math.floor(c)!==c||c<0)throw new n(h?l:"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>5==6?2:p>>4==14?3:p>>3==30?4:p>>6==2?-1:-2}function h(p){var x=this.lastTotal-this.lastNeed,_=function(b,k,R){if((192&k[0])!=128)return b.lastNeed=0,"\uFFFD";if(b.lastNeed>1&&k.length>1){if((192&k[1])!=128)return b.lastNeed=1,"\uFFFD";if(b.lastNeed>2&&k.length>2&&(192&k[2])!=128)return b.lastNeed=2,"\uFFFD"}}(this,p);return _!==void 0?_:this.lastNeed<=p.length?(p.copy(this.lastChar,x,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(p.copy(this.lastChar,x,0,p.length),void(this.lastNeed-=p.length))}function c(p,x){if((p.length-x)%2==0){var _=p.toString("utf16le",x);if(_){var b=_.charCodeAt(_.length-1);if(b>=55296&&b<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=p[p.length-2],this.lastChar[1]=p[p.length-1],_.slice(0,-1)}return _}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=p[p.length-1],p.toString("utf16le",x,p.length-1)}function d(p){var x=p&&p.length?this.write(p):"";if(this.lastNeed){var _=this.lastTotal-this.lastNeed;return x+this.lastChar.toString("utf16le",0,_)}return x}function f(p,x){var _=(p.length-x)%3;return _===0?p.toString("base64",x):(this.lastNeed=3-_,this.lastTotal=3,_===1?this.lastChar[0]=p[p.length-1]:(this.lastChar[0]=p[p.length-2],this.lastChar[1]=p[p.length-1]),p.toString("base64",x,p.length-_))}function g(p){var x=p&&p.length?this.write(p):"";return this.lastNeed?x+this.lastChar.toString("base64",0,3-this.lastNeed):x}function m(p){return p.toString(this.encoding)}function y(p){return p&&p.length?this.write(p):""}s.StringDecoder=o,o.prototype.write=function(p){if(p.length===0)return"";var x,_;if(this.lastNeed){if((x=this.fillLast(p))===void 0)return"";_=this.lastNeed,this.lastNeed=0}else _=0;return _=0?(D>0&&(k.lastNeed=D-1),D):--I=0?(D>0&&(k.lastNeed=D-2),D):--I=0?(D>0&&(D===2?D=0:k.lastNeed=D-3),D):0}(this,p,x);if(!this.lastNeed)return p.toString("utf8",x);this.lastTotal=_;var b=p.length-(_-this.lastNeed);return p.copy(this.lastChar,0,b),p.toString("utf8",x,b)},o.prototype.fillLast=function(p){if(this.lastNeed<=p.length)return p.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);p.copy(this.lastChar,this.lastTotal-this.lastNeed,0,p.length),this.lastNeed-=p.length}},{"safe-buffer":73}],76:[function(i,a,s){var n=i("punycode"),r=i("./util");function o(){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=R,s.resolve=function(S,I){return R(S,!1,!0).resolve(I)},s.resolveObject=function(S,I){return S?R(S,!1,!0).resolveObject(I):I},s.format=function(S){return r.isString(S)&&(S=R(S)),S instanceof o?S.format():o.prototype.format.call(S)},s.Url=o;var l=/^([a-z0-9.+-]+:)/i,h=/:[0-9]*$/,c=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,d=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r",` `," "]),f=["'"].concat(d),g=["%","/","?",";","#"].concat(f),m=["/","?","#"],y=/^[+a-z0-9A-Z_-]{0,63}$/,p=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,x={javascript:!0,"javascript:":!0},_={javascript:!0,"javascript:":!0},b={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},k=i("querystring");function R(S,I,D){if(S&&r.isObject(S)&&S instanceof o)return S;var V=new o;return V.parse(S,I,D),V}o.prototype.parse=function(S,I,D){if(!r.isString(S))throw new TypeError("Parameter 'url' must be a string, not "+typeof S);var V=S.indexOf("?"),G=V!==-1&&V127?ut+="x":ut+=it[lt];if(!ut.match(y)){var E=tt.slice(0,j),A=tt.slice(j+1),B=it.match(p);B&&(E.push(B[1]),A.unshift(B[2])),A.length&&(P="/"+A.join(".")+P),this.hostname=E.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),P[0]!=="/"&&(P="/"+P))}if(!x[$])for(j=0,st=f.length;j0)&&D.host.split("@"))&&(D.auth=B.shift(),D.host=D.hostname=B.shift())),D.search=S.search,D.query=S.query,r.isNull(D.pathname)&&r.isNull(D.search)||(D.path=(D.pathname?D.pathname:"")+(D.search?D.search:"")),D.href=D.format(),D;if(!it.length)return D.pathname=null,D.search?D.path="/"+D.search:D.path=null,D.href=D.format(),D;for(var lt=it.slice(-1)[0],ht=(D.host||S.host||it.length>1)&&(lt==="."||lt==="..")||lt==="",E=0,A=it.length;A>=0;A--)(lt=it[A])==="."?it.splice(A,1):lt===".."?(it.splice(A,1),E++):E&&(it.splice(A,1),E--);if(!tt&&!st)for(;E--;E)it.unshift("..");!tt||it[0]===""||it[0]&&it[0].charAt(0)==="/"||it.unshift(""),ht&&it.join("/").substr(-1)!=="/"&&it.push("");var B,N=it[0]===""||it[0]&&it[0].charAt(0)==="/";return ut&&(D.hostname=D.host=N?"":it.length?it.shift():"",(B=!!(D.host&&D.host.indexOf("@")>0)&&D.host.split("@"))&&(D.auth=B.shift(),D.host=D.hostname=B.shift())),(tt=tt||D.host&&it.length)&&!N&&it.unshift(""),it.length?D.pathname=it.join("/"):(D.pathname=null,D.path=null),r.isNull(D.pathname)&&r.isNull(D.search)||(D.path=(D.pathname?D.pathname:"")+(D.search?D.search:"")),D.auth=S.auth||D.auth,D.slashes=D.slashes||S.slashes,D.href=D.format(),D},o.prototype.parseHost=function(){var S=this.host,I=h.exec(S);I&&((I=I[0])!==":"&&(this.port=I.substr(1)),S=S.substr(0,S.length-I.length)),S&&(this.hostname=S)}},{"./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(o){try{if(!n.localStorage)return!1}catch{return!1}var l=n.localStorage[o];return l!=null&&String(l).toLowerCase()==="true"}a.exports=function(o,l){if(r("noDeprecation"))return o;var h=!1;return function(){if(!h){if(r("throwDeprecation"))throw new Error(l);r("traceDeprecation")?console.trace(l):console.warn(l),h=!0}return o.apply(this,arguments)}}}).call(this)}).call(this,typeof Oe<"u"?Oe:typeof self<"u"?self:typeof window<"u"?window:{})},{}],79:[function(i,a,s){a.exports=function n(r,o){if(r&&o)return n(r)(o);if(typeof r!="function")throw new TypeError("need wrapper function");return Object.keys(r).forEach(function(h){l[h]=r[h]}),l;function l(){for(var h=new Array(arguments.length),c=0;c0)for(var f=0,g=arguments.length;f1)f=d;else{if(!this.head)throw new TypeError("Reduce of empty list with no initial value");g=this.head.next,f=this.head.value}for(var m=0;g!==null;m++)f=c(f,g.value,m),g=g.next;return f},n.prototype.reduceReverse=function(c,d){var f,g=this.tail;if(arguments.length>1)f=d;else{if(!this.tail)throw new TypeError("Reduce of empty list with no initial value");g=this.tail.prev,f=this.tail.value}for(var m=this.length-1;g!==null;m--)f=c(f,g.value,m),g=g.prev;return f},n.prototype.toArray=function(){for(var c=new Array(this.length),d=0,f=this.head;f!==null;d++)c[d]=f.value,f=f.next;return c},n.prototype.toArrayReverse=function(){for(var c=new Array(this.length),d=0,f=this.tail;f!==null;d++)c[d]=f.value,f=f.prev;return c},n.prototype.slice=function(c,d){(d=d||this.length)<0&&(d+=this.length),(c=c||0)<0&&(c+=this.length);var f=new n;if(dthis.length&&(d=this.length);for(var g=0,m=this.head;m!==null&&gthis.length&&(d=this.length);for(var g=this.length,m=this.tail;m!==null&&g>d;g--)m=m.prev;for(;m!==null&&g>c;g--,m=m.prev)f.push(m.value);return f},n.prototype.splice=function(c,d,...f){c>this.length&&(c=this.length-1),c<0&&(c=this.length+c);for(var g=0,m=this.head;m!==null&&g'},info:{color:"#0052d9",icon:''},warning:{color:"#e37318",icon:''},error:{color:"#d54941",icon:''},question:{color:"#0052d9",icon:''}},si={};class g6{constructor(t,i){H(this,"parentElement");H(this,"box");H(this,"icon");H(this,"text");H(this,"closeBtn");H(this,"duration");H(this,"content");H(this,"theme");H(this,"placement");H(this,"height");H(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=Id[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{this.close()},this.duration);let t=-1;Object.keys(si).forEach(i=>{var a;((a=si[i])==null?void 0:a.placement)===this.placement&&t++}),this.setPosition(this.placement,t),this.icon.children[0].style.fill=Id[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(si).forEach(t=>{var i;if(((i=si[t])==null?void 0:i.placement)===this.placement)switch(this.placement){case"top":case"left":case"right":si[t].box.style.top=parseInt(si[t].box.style.top)-60+"px";break;case"bottom":si[t].box.style.bottom=parseInt(si[t].box.style.bottom)-60+"px";break}}),si[this.id]=null,delete si[this.id],this.box.remove()}}function v6(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")||io("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 o in s.payload.properties)r.push({id:`${s.payload.headers.productId}#${s.payload.deviceId}#${o}`,value:s.payload.properties[o]});e.setDatas(r,{history:!1})}else s.topic.startsWith("/notifications")&&w0(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+"-"+Tt()}))}),t.notification&&e.jetLinksClient.send(JSON.stringify({type:"sub",topic:"/notifications",id:"notification",parameter:{}}))}}}function w0(e,t){var r,o;let i=t.payload.topicName,a=t.payload.message,s=t.payload.notifyTime,n=`
${i}
${m6(s)}
${a}
`;e.message({content:n,duration:0,closeBtn:!0,placement:"right",height:75}),(r=t.payload.detail)!=null&&r.alarmConfigId&&b6(e,(o=t.payload.detail)==null?void 0:o.alarmConfigId)}globalThis.doWarning=w0;function m6(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"),o=(t.getSeconds()+"").padStart(2,"0");return i+"-"+a+"-"+s+" "+n+":"+r+":"+o}function y6(e){e.jetLinksClient&&(e.jetLinksClient.close(),e.jetLinksClient=void 0)}function p6(e,t,i){const a=[];return i.list.forEach((s,n)=>{var o,l,h;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 d=(o=r.realTimes)==null?void 0:o.find(f=>f.propertyId===c);d&&(a[n].properties[c]=r[d.key])}else if(typeof s.value[c]=="string"&&((l=s.value[c])==null?void 0:l.indexOf("${"))>-1){let d=s.value[c].match(new RegExp("(?<=\\$\\{).*?(?=\\})","g"));d!=null&&d.length&&(a[n].properties[c]=(h=r[d[0]])!=null?h:e.getDynamicParam(d[0]))}else a[n].properties[c]=s.value[c]}),a}async function w6(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 b6(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&&b0(e,a.result.media,a.result.playTimes)}}function b0(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{this.store.data.lineAnimateDraws[t]=i,wt.lineAnimateDraws[t]=Te(this.store.options,"ctx","pen","state","index",i)});H(this,"websocketTimes",0);H(this,"mqttTimes",0);H(this,"httpTimer");H(this,"httpTimerList",[]);H(this,"updateTimer");H(this,"updateTimerList",[]);H(this,"sqlTimerList",[]);H(this,"iotMqttClient");H(this,"iotTimer");H(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"&&(_E(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&&nc(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?(nc(i.pen),this.store.data.locked&&!i.pen.disabled&&this.doEvent(i.pen,t)):(nc(i),this.store.data.locked&&i&&!i.disabled&&this.doEvent(i,t));break}this.doMessageEvent(t,i)});H(this,"doEvent",(t,i)=>{var n,r,o,l,h,c,d,f,g,m;if(!t)return;let a=!1,s=[];if((n=t.events)==null||n.forEach((y,p)=>{var x;if(y.actions&&y.actions.length){if(y.name===i){let _=!1;y.conditions&&y.conditions.length?y.conditionType==="and"?_=y.conditions.every(b=>this.judgeCondition(t,b.key,b)):y.conditionType==="or"&&(_=y.conditions.some(b=>this.judgeCondition(t,b.key,b))):_=!0,_&&s.push(p)}}else if(a=!0,this.events[y.action]&&y.name===i){let _=!((x=y.where)!=null&&x.type);if(y.where){const{fn:b,fnJs:k,comparison:R,key:S,value:I}=y.where;if(b)_=b(t,{meta2d:this});else if(k){try{y.where.fn=Te(this.store.options,"pen","context",k)}catch(D){console.error("Error: make function:",D,"code:",k)}y.where.fn&&(_=y.where.fn(t,{meta2d:this}))}else{let D=t[S];switch(["x","y","width","height"].includes(S)&&(D=this.getPenRect(t)[S]),R){case">":_=D>+I;break;case">=":_=D>=+I;break;case"<":_=D<+I;break;case"<=":_=D<=+I;break;case"=":case"==":_=D==I;break;case"!=":_=D!=I;break;case"[)":_=bs(+D,I);break;case"![)":_=!bs(+D,I);break;case"[]":_=xs(D,I);break;case"![]":_=!xs(D,I);break}}}_&&s.push(p)}}),a?(r=t.events)==null||r.forEach((y,p)=>{s.includes(p)&&this.events[y.action]&&this.events[y.action](t,y)}):(o=t.events)==null||o.forEach(async(y,p)=>{if(s.includes(p)){if(y.confirm&&!await this.canvas.popconfirm.showModal(t,this.canvas.mousePos,y.confirmTitle))return;y.actions.forEach(x=>{x.timeout?setTimeout(()=>{this.events[x.action]&&this.events[x.action](t,x)},x.timeout):this.events[x.action]&&this.events[x.action](t,x)})}}),i==="valueUpdate"){(l=t.realTimes)==null||l.forEach(p=>{var _,b;let x=[];(_=p.triggers)==null||_.forEach((k,R)=>{var I;let S=!1;(I=k.conditions)!=null&&I.length?k.conditionType==="and"?S=k.conditions.every(D=>this.judgeCondition(t,p.key,D)):k.conditionType==="or"&&(S=k.conditions.some(D=>this.judgeCondition(t,p.key,D))):S=!0,S&&x.push(R)}),(b=p.triggers)==null||b.forEach((k,R)=>{var S;x.includes(R)&&((S=k.actions)==null||S.forEach(I=>{I.timeout?setTimeout(()=>{this.events[I.action]&&this.events[I.action](t,I)},I.timeout):this.events[I.action]&&this.events[I.action](t,I)}))})});let y=[];if((h=this.store.globalTriggers[t.id])==null||h.forEach((p,x)=>{var b;let _=!1;(b=p.conditions)!=null&&b.length?p.conditionType==="and"?_=p.conditions.every(k=>this.judgeCondition(this.store.pens[k.source],k.key,k)):p.conditionType==="or"&&(_=p.conditions.some(k=>this.judgeCondition(this.store.pens[k.source],k.key,k))):_=!0,_&&y.push(x)}),(c=this.store.globalTriggers[t.id])==null||c.forEach((p,x)=>{var _;y.includes(x)&&((_=p.actions)==null||_.forEach(b=>{b.timeout?setTimeout(()=>{this.events[b.action]&&this.events[b.action](t,b)},b.timeout):this.events[b.action]&&this.events[b.action](t,b)}))}),(d=t.triggers)!=null&&d.length){for(let p of t.triggers)if((f=p.status)!=null&&f.length)for(let x of p.status){let _=!1;if((g=x.conditions)!=null&&g.length?x.conditionType==="and"?_=x.conditions.every(b=>this.judgeCondition(t,b.key,b)):x.conditionType==="or"&&(_=x.conditions.some(b=>this.judgeCondition(t,b.key,b))):_=!0,_){(m=x.actions)==null||m.forEach(b=>{b.timeout?setTimeout(()=>{this.events[b.action]&&this.events[b.action](t,b)},b.timeout):this.events[b.action]&&this.events[b.action](t,b)});break}}}}this.doEvent(this.store.pens[t.parentId],i)});H(this,"doDataEvent",t=>{var s,n,r;if(!((s=this.store.data.dataEvents)!=null&&s.length))return;const i=t.reduce((o,{dataId:l,id:h,value:c})=>(o[h||l]=c,o),{});let a=[];(n=this.store.data.dataEvents)==null||n.forEach((o,l)=>{let h=!1;o.conditions&&o.conditions.length?o.conditionType==="and"?h=o.conditions.every(c=>this.dataJudegeCondition(i,c.key,c)):o.conditionType==="or"&&(h=o.conditions.some(c=>this.dataJudegeCondition(i,c.key,c))):h=!0,h&&a.push(l)}),(r=this.store.data.dataEvents)==null||r.forEach((o,l)=>{var h;a.includes(l)&&((h=o.actions)==null||h.forEach(c=>{this.events[c.action]&&this.events[c.action](i,c)}))})});H(this,"renderPenRaw",oo);H(this,"setElemPosition",Re);H(this,"setLifeCycleFunc",G_);this.store=N2(Tt()),this.setOptions(i),this.setDatabyOptions(i),this.init(t),this.register(u6()),this.registerCanvasDraw({cube:H5}),this.registerAnchors(f6()),globalThis[i.alias||_6]=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,s;if((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),t.roles&&((a=this.store.data.pens)==null?void 0:a.length))for(const n of this.store.data.pens)Di(n);this.canvas&&t.scroll!==void 0&&(t.scroll?(!this.canvas.scroll&&(this.canvas.scroll=new g0(this.canvas)),this.canvas.scroll.show()):this.canvas.scroll&&this.canvas.scroll.hide()),(s=this.canvas)==null||s.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(o=>a.test(o)))return;const n={},r=[];for(let o=0;o{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(o=>o.slice(2,-1));r&&(r==null||r.forEach(o=>{n=n.replace(`\${${o}}`,Ne(t,o)||this.getDynamicParam(o))}))}window.open(n,(s=i.params)!=null?s:"_blank");return}console.warn("[meta2d] Link param is not a string")},this.events[ue.SetProps]=(t,i)=>{var s,n,r;const a=i.value;if(a&&typeof a=="object"){const o=i.params?this.find(i.params):this.find(t.id),l={};for(let c in a)if((s=a[c])!=null&&s.id)l[c]=(n=this.store.pens[a[c].id])==null?void 0:n[a[c].key];else if(typeof a[c]=="string"&&a[c].includes("${")){let d=a[c],f=(r=d.match(/\$\{([^}]+)\}/g))==null?void 0:r.map(g=>g.slice(2,-1));f&&f.forEach(g=>{d=d.replace(`\${${g}}`,Ne(t,g)||this.getDynamicParam(g))}),l[c]=d}else if(typeof a[c]=="string"&&(a[c].startsWith("{")&&a[c].endsWith("}")||a[c].startsWith("[")&&a[c].endsWith("]")))try{l[c]=JSON.parse(a[c])}catch{l[c]=a[c]}else l[c]=a[c];let h=!1;o.forEach(c=>{l.hasOwnProperty("visible")&&c.visible!==l.visible&&(h=!0,this.store.emitter.emit("setProps-visible",{pen:c,visible:l.visible}),this.setVisible(c,l.visible,!1,!1)),this.setValue({id:c.id,...l},{render:!1,doEvent:!1})}),h&&this.onSizeUpdate(),this.requestSetPropsRender();return}console.warn("[meta2d] SetProps value is not an object")},this.events[ue.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[ue.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[ue.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[ue.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[ue.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[ue.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[ue.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=Te(this.store.options,"pen","params","context",n)}catch(n){console.error("[meta2d]: Error on make a function:",n,"code:",i.value)}(s=i.fn)==null||s.call(i,t,a||i.params,{meta2d:this,eventName:i.name})},this.events[ue.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[ue.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[ue.SendPropData]=(t,i)=>{const a=ot(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[ue.SendVarData]=(t,i)=>{var s;const a=ot(i.value);if(a&&typeof a=="object"){const n=i.params?this.findOne(i.params):t;let r=[];for(let o in a){let l={dataId:o,value:a[o]};if(!l.value){let h=(s=n.form)==null?void 0:s.find(c=>c.dataIds&&c.dataIds.dataId===l.dataId);h&&(l.value=n[h.key])}r.push(l)}this.doSendDataEvent(r,i.extend);return}console.warn("[meta2d] SendVarData value is not an object")},this.events[ue.Navigator]=(t,i)=>{i.value&&typeof i.value=="string"&&this.navigatorTo(i.value)},this.events[ue.Dialog]=(t,i)=>{var a;if(i.params&&typeof i.params=="string"){let s=i.params;if(i.params.includes("${")){let o=(a=i.params.match(/\$\{([^}]+)\}/g))==null?void 0:a.map(l=>l.slice(2,-1));o&&(o==null||o.forEach(l=>{s=s.replace(`\${${l}}`,Ne(t,l)||this.getDynamicParam(l))}))}const n=i.extend||{};Object.keys(n).forEach(o=>{["x","y","width","height","relative","pen"].includes(o)||(s.indexOf("?")!==-1?s+=`&${o}=${n[o]}`:s+=`?${o}=${n[o]}`)});let r=this.getEventData(i.list,t);Object.keys(r).length&&(r=null),this.canvas.dialog.show(i.value,s,i.extend?{...n,pen:t}:void 0,r)}},this.events[ue.SendData]=(t,i)=>{var s,n,r,o,l;if((s=i.data)!=null&&s.length){const h=this.getSendData(i.data,t);t.formId&&t.formData&&Object.assign(h,t.formData),this.sendDataToNetWork(h,t,i);return}if((n=i.list)!=null&&n.length){if(i.network&&i.network.protocol==="ADIIOT"){const c=p6(this,t,i);c.length&&w6(this,c);return}const h=this.getEventData(i.list,t);t.deviceId&&(h.deviceId=t.deviceId),t.formId&&t.formData&&Object.assign(h,t.formData),this.sendDataToNetWork(h,t,i);return}const a=ot(i.value);if(a&&typeof a=="object"&&i.targetType==="id"){const h=i.params?this.findOne(i.params):t;for(let c in a)if(a[c]===void 0||a[c]==="")a[c]=Ne(h,c);else if(typeof a[c]=="string"&&((r=a[c])==null?void 0:r.indexOf("${"))>-1){let d=(o=a[c].match(/\$\{([^}]+)\}/g))==null?void 0:o.map(f=>f.slice(2,-1));d!=null&&d.length&&(a[c]=(l=Ne(h,c[0]))!=null?l:this.getDynamicParam(d[0]))}h.deviceId&&(a.deviceId=h.deviceId),this.sendDataToNetWork(a,t,i);return}},this.events[ue.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(!["iframe","htmlDom"].includes(a.name)&&!a.iframe){console.warn("\u4E0D\u662F\u5D4C\u5165\u9875\u9762");return}let n={};a.iframe?n=Rs(a.iframe.split("?")[1]):n={id:a.id};let r=this.getSendData(i.data,t);i.list&&(r=this.getEventData(i.list,t)),a.calculative.singleton.div.children[0].contentWindow.postMessage(JSON.stringify({name:i.value,id:n.id,data:r}),"*")},this.events[ue.PostMessageToParent]=(t,i)=>{if(typeof i.value!="string"){console.warn("[meta2d] Emit value must be a string");return}let a=this.getSendData(i.data,t);i.list&&(a=this.getEventData(i.list,t)),window.parent.postMessage(JSON.stringify({name:i.value,data:a}),"*")},this.events[ue.Message]=(t,i,a)=>{let s=i.params,n=i.value;!n&&a&&a.type==="http"&&(n=a.error.statusText,s||(s="error")),this.message({theme:s,content:n,...i.extend})}}getSendData(t,i){const a={};return t==null||t.forEach(s=>{var n;if(s.prop)if(s.id&&s.id!=="\u56FA\u5B9A\u503C"){const r=this.findOne(s.id);a[s.prop]=Ne(r,s.key)}else if(typeof s.value=="string"&&s.value.includes("${")){let r=s.value,o=(n=r.match(/\$\{([^}]+)\}/g))==null?void 0:n.map(l=>l.slice(2,-1));o&&o.forEach(l=>{r=r.replace(`\${${l}}`,Ne(i,l)||this.getDynamicParam(l))}),a[s.prop]=r}else a[s.prop]=this.convertType(s.value,s.type)}),a}convertType(t,i){var a;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)}else if(typeof t=="object"){let s=JSON.stringify(t),n=(a=s.match(/\$\{([^}]+)\}/g))==null?void 0:a.map(r=>r.slice(2,-1));if(n!=null&&n.length)for(let r=0;r{var r,o,l;const n=s.params?this.findOne(s.params):i;for(let h in s.value)if(s.value[h]===void 0||s.value[h]==="")a[h]=n[h];else if(typeof s.value[h]=="string"&&((r=s.value[h])==null?void 0:r.indexOf("${"))>-1){let c=(o=s.value[h].match(/\$\{([^}]+)\}/g))==null?void 0:o.map(d=>d.slice(2,-1));c!=null&&c.length&&(a[h]=(l=n[c[0]])!=null?l:this.getDynamicParam(c[0]))}else a[h]=s.value[h]}),Object.keys(a).length?a:{}}message(t){new g6(this.canvas.parentElement,t).init()}closeAll(){for(let t in si)si[t].close()}async navigatorTo(t){var s,n;if(!t)return;if((s=Rs())==null?void 0:s.id){const r=new URL(window.location);r.searchParams.set("id",t),history.pushState({},"",r)}const a=await qc(this.store,t);if(a){a.locked=1,(n=a.fits)!=null&&n.length&&(globalThis.meta2dData=JSON.stringify(a)),this.canvas.opening=!0,this.open(a),this.lock(1);const r=this.store.data.width||this.store.options.width,o=this.store.data.height||this.store.options.height;r&&o?this.fitSizeView(!0,0):this.fitView(!0,10),this.render(!0)}}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,o,l,h,c;const s=ot(a.network);if(s.data&&(Object.assign(s,s.data),delete s.data),s.protocol==="iot"){if(this.store.data.iot.room){let d={token:this.store.data.iot.token,data:t};if(t.name){const f=Object.keys(t).filter(g=>t[g]==="aggregate");if(f.length){const g=ot(t);f.forEach(y=>{delete g[y]}),delete g.name,g.start&&typeof g.start=="string"&&(g.start=Math.floor(new Date(g.start).getTime()/1e3)),g.end&&typeof g.end=="string"&&(g.end=Math.floor(new Date(g.end).getTime()/1e3));let m=[];f.forEach(y=>{let p=y.split("#");m.push({token:this.store.data.iot.token,deviceId:p[0],key:p[1],name:p[1]+"_"+t.name,...g})}),this.iotMqttClient&&this.iotMqttClient.publish(`le5le-iot/${this.store.data.iot.room}/property/aggregate`,JSON.stringify(m));return}}this.iotMqttClient&&this.iotMqttClient.publish(`le5le-iot/${this.store.data.iot.room}/properties/set`,JSON.stringify(d))}else 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),y=(r=m.match(/\$\{([^}]+)\}/g))==null?void 0:r.map(p=>p.slice(2,-1));if(y!=null&&y.length)for(let p=0;pm+"="+t[m]).join("&"):d="?"+Object.keys(t).map(m=>m+"="+t[m]).join("&")),f.indexOf("${")>-1){let m=(o=f.match(/\$\{([^}]+)\}/g))==null?void 0:o.map(y=>y.slice(2,-1));m&&m.forEach(y=>{f=f.replace(`\${${y}}`,Ne(i,y)||this.getDynamicParam(y))})}const g=await fetch(f+(d||""),{headers:s.headers||{},method:s.method,body:s.method==="POST"?JSON.stringify(t):void 0});if(g.ok){if(a.callback){const m=await g.text();if(!a.fn)try{if(typeof a.callback!="string")throw new Error("[meta2d] Function callback must be string");const y=a.callback;a.fn=Te(this.store.options,"pen","data","context",y)}catch(y){console.error("[meta2d]: Error on make a function:",y,"code:",a.callback)}(l=a.fn)==null||l.call(a,i,m,{meta2d:this,e:a})}console.info("http\u6D88\u606F\u53D1\u9001\u6210\u529F")}else this.store.emitter.emit("error",{type:"http",error:g})}else if(s.protocol==="mqtt"){const d=(h=this.mqttClients)==null?void 0:h.filter(f=>f.options.href===s.url);if(d&&d.length)d[0].connected&&s.topics.split(",").forEach(f=>{d[0].publish(f,JSON.stringify(t))});else{let f=yn.exports.connect(s.url,s.options);f.on("connect",()=>{console.info("mqtt\u8FDE\u63A5\u6210\u529F"),s.topics.split(",").forEach(g=>{f.publish(g,JSON.stringify(t)),setTimeout(()=>{f==null||f.end()},1e3)})})}}else if(s.protocol==="websocket"){const d=(c=this.websockets)==null?void 0:c.filter(f=>f.url===s.url);if(d&&d.length)d[0].readyState===1&&d[0].send(JSON.stringify(t));else{let f=new WebSocket(s.url,s.protocols||void 0);f.onopen=function(){console.info("websocket\u8FDE\u63A5\u6210\u529F"),f.send(JSON.stringify(t)),setTimeout(()=>{f.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)}addPenSync(t,i,a=!0,s=!0){return this.canvas.addPenSync(t,i,a,s)}addPensSync(t,i,a=!0){return this.canvas.addPensSync(t,i,a)}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)}requestSetPropsRender(){this.setPropsRenderPending||(this.setPropsRenderPending=!0,requestAnimationFrame(()=>{this.setPropsRenderPending=!1,this.render(!1)}))}async setBackgroundImage(t,i){var o,l,h,c;let a=this;async function s(d){return new Promise(f=>{const g=new Image;g.src=d,a.store.options.cdn&&!(d.startsWith("http")||d.startsWith("//")||d.startsWith("data:image"))&&(g.src=a.store.options.cdn+d),g.crossOrigin=a.store.options.crossOrigin||"anonymous",g.onload=()=>{f(g)}})}this.store.data.bkImage=t;const n=(i==null?void 0:i.width)||((o=this.store.data)==null?void 0:o.width)||((l=this.store.options)==null?void 0:l.width),r=(i==null?void 0:i.height)||((h=this.store.data)==null?void 0:h.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 d=await s(t);this.store.bkImg=d,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,gridType:n=this.store.data.gridType,gridScope:r=this.store.data.gridScope}={}){this.store.data.grid=t,this.store.data.gridColor=i,this.store.data.gridSize=a<0?0:a,this.store.data.gridRotate=s,this.store.data.gridType=n,this.store.data.gridScope=r,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.fillViewSnapshot=null,this.canvas.autoPolylineFlag=!0,t){t.theme&&this.setTheme(t.theme),tE(t.pens),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=Tt()),!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=Tt()),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)K2(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 o=i[r];if(o.parentId){const l=this.store.pens[o.parentId];(o.x>10||o.y>10||o.width>10||o.height>10||!l.children||!l.children.includes(o.id))&&n.push(o)}if(a&&s){let l=this.getPenRect(o);(l.x<-10||l.y<-10||l.x+l.width>a||l.y+l.height>s)&&n.push(o)}o.name==="line"&&o.anchors.length<2&&n.push(o)}return(!a||!s)&&K_(i).forEach(o=>{n.filter(h=>h.id===o.id).length||n.push(o)}),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:ot(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,wt.path2dDraws[a.name]&&this.store.path2dMap.set(a,wt.path2dDraws[a.name](a)),a.type&&this.store.path2dMap.set(a,wt.path2dDraws[a.name](a)),a.image&&(a.calculative.imageDrawed=!1,this.canvas.loadImage(a))}),this.render())}loadLineAnimateDraws(){wt.lineAnimateDraws={},Object.entries(this.store.data.lineAnimateDraws).forEach(([t,i])=>{wt.lineAnimateDraws[t]=Te(this.store.options,"ctx","pen","state","index",i)})}statistics(){const t=this.store.data.pens.length,i=this.store.data.pens.filter(o=>o.image).length,a=this.store.data.pens.filter(o=>o.image&&o.calculative.inView).length,s=this.store.data.pens.filter(o=>o.name.endsWith("Dom")||bc.includes(o.name)||this.store.options.domShapes.includes(o.name)||o.externElement||o.isDom).length,n=this.store.animates.size;let r=0;return Object.keys(this.store.bind).forEach(o=>{r+=this.store.bind[o].length}),Object.keys(this.store.bindDatas).forEach(o=>{r+=this.store.bindDatas[o].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=[],a=[];this.store.data.pens.forEach(s=>{var n,r;(n=s.realTimes)==null||n.forEach(o=>{var l;if(o.bind&&o.bind.id){const h=(l=this.store.data.networks)==null?void 0:l.some(m=>m.protocol==="ADIIOT");let c=o.productId||s.productId,d=o.deviceId||s.deviceId,f=o.propertyId,g=!1;if(h){if(c&&typeof c=="string"&&c.indexOf("${")>-1){let m=c.match(new RegExp("(?<=\\$\\{).*?(?=\\})","g"));m!=null&&m.length&&(c=this.getDynamicParam(m[0])||c),g=!0}if(d&&typeof d=="string"&&d.indexOf("${")>-1){let m=d.match(new RegExp("(?<=\\$\\{).*?(?=\\})","g"));m!=null&&m.length&&(d=this.getDynamicParam(m[0])||d),g=!0}if(f&&typeof f=="string"&&f.indexOf("${")>-1){let m=f.match(new RegExp("(?<=\\$\\{).*?(?=\\})","g"));m!=null&&m.length&&(f=this.getDynamicParam(m[0])||f),g=!0}g&&o.bind&&(o.bind.id=c+"#"+d+"#"+f)}if(this.store.bind[o.bind.id]||(this.store.bind[o.bind.id]=[]),this.store.bind[o.bind.id].push({id:s.id,key:o.key}),h&&c&&d&&f){const m=this.jetLinksList.findIndex(y=>y.topic.startsWith(`/${c}/${d}`));m>-1?this.jetLinksList[m].properties.includes(o.propertyId)||this.jetLinksList[m].properties.push(o.propertyId):this.jetLinksList.push({topic:`/${c}/${d}`,deviceId:d,properties:[o.propertyId]})}if(o.bind.class==="iot")if(o.bind.compute_name){a.findIndex(p=>p.id===o.bind.id)===-1&&a.push(ot(o.bind));let y=t.findIndex(p=>p.deviceId===o.bind.deviceId);y>-1?t[y].properties.includes(o.bind.key)||t[y].properties.push(o.bind.key):t.push({deviceId:o.bind.deviceId,properties:[o.bind.key],token:o.bind.token})}else{let m=o.bind.id.split("#"),y=t.findIndex(x=>x.deviceId===m[0]);y>-1?t[y].properties.includes(m[1])||t[y].properties.push(m[1]):t.push({deviceId:m[0],properties:[m[1]],token:o.bind.token}),i.findIndex(x=>x.key===o.bind.id)===-1&&i.push({key:o.bind.id,label:o.bind.label})}else if(o.bind.class==="sql"){let m=o.bind.id.split("#");const y=this.store.data.sqls.find(p=>p.bindId===m[0]);if(y){y.keys||(y.keys=[]),m.shift();const p=m.join("#");y.keys.includes(p)||y.keys.push(p)}}}}),(r=s.events)==null||r.forEach(o=>{var h;const l=(h=o.actions)==null?void 0:h.filter(c=>c.action===ue.SendData);l==null||l.forEach(c=>{var d;(d=c.data)==null||d.forEach(f=>{if(f.class==="iot"){let g=f.prop.split("#"),m=t.findIndex(y=>y.deviceId===g[0]);m>-1?t[m].properties.includes(g[1])||t[m].properties.push(g[1]):t.push({deviceId:g[0],properties:[g[1]],token:f.token})}})})})}),this.store.data.iot||(this.store.data.iot={}),t.length?this.store.data.iot.devices=t:delete this.store.data.iot.devices,i.length?this.store.data.iot.list=i:delete this.store.data.iot.list,a.length&&(this.store.data.iot.computes=a)}connectSocket(){this.connectWebsocket(),this.connectMqtt(),this.connectHttp()}doInitJS(){const t=this.store.data.initJs;if(t&&t.trim())try{let i=Te(this.store.options,"context",t);i({meta2d:this}),i=null}catch(i){console.warn("initJs error",i)}}doInitFn(){let t=Rs(),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&&v0(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&&Re(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=ce(t),s=jt(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);z2(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 wt.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){let a;t?typeof t=="string"?(a=this.find(t),a.forEach(s=>{(!s.calculative.pause||s.currentAnimation!==i)&&this.stopAnimate([s])})):(a=t,a.forEach(s=>{(!s.calculative.pause||s.currentAnimation!==i)&&this.stopAnimate([s])})):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 o=Date.now()-s.calculative.pause;s.calculative.pause=void 0,s.calculative.frameStart+=o,s.calculative.frameEnd+=o}else{let o=-1;if(i!==void 0&&s.animations){if(typeof i=="string"){if(o=s.animations.findIndex(l=>l.name===i),o===-1)return}else if(typeof i=="number")if(s.animations.length>i)o=i;else return}else i===void 0&&(o=(n=s.animations)==null?void 0:n.findIndex(l=>l.autoPlay),o===-1&&((r=s.animations)==null?void 0:r.length)&&(o=0));if(o!==-1&&o!==void 0){const l=ot(s.animations[o]);l.animateCycle||(l.animateCycle=0),l.animateName=l.name,delete l.name,l.currentAnimation=o,!s.type&&l.frames&&(l.showDuration=this.calcAnimateDuration(l)),this.setValue({id:s.id,...l},{doEvent:!1,history:!1,render:!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),this.store.data.locked===Bt.None&&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=ot(t);if(t.length===1&&t[0].type){t[0].type=Ut.Node,this.canvas.active(t),this.pushHistory({type:_t.Update,initPens:s,pens:ot(t,!0)}),this.render();return}const n=Ei(t);let r={id:Tt(),name:"combine",...n,children:[],showChild:i};this.canvas.makePen(r);const o=ot(r);let l=1/0;return t.forEach(h=>{var f;const c=this.store.data.pens.findIndex(g=>g.id===h.id);if(c{Di(h,!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=ot(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=Bt.None,n.calculative.active=void 0,n.calculative.hover=!1,this.setVisible(n,!0)});const s=this.isCombine(t)?3:2;this.pushHistory({type:_t.Update,initPens:a,pens:i,step:s}),a=[ot(t)],this.inactive(),t.children=void 0,this.pushHistory({type:_t.Update,initPens:a,pens:[t],step:s}),this.isCombine(t)&&(this.delete([t]),this.store.histories[this.store.histories.length-1].step=s)}clearCombine(t){if(!t&&this.store.active&&(t=this.store.active[0]),!t||!t.children)return;const i=Le(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=Bt.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=Ei(t);Object.assign(a,s),Object.assign(a.calculative.worldRect,s),Bs(a),a.children.forEach(n=>{const r=this.store.pens[n],o=wa(r.calculative.worldRect,s);Object.assign(r,o)}),t.forEach(n=>{var r;if(n.id!==a.id){a.children.push(n.id),n.parentId=a.id;const o=wa(n.calculative.worldRect,s);Object.assign(n,o),n.locked=(r=n.lockedOnCombine)!=null?r:Bt.DisableMove,n.locked=n.interaction||Gl.includes(n.name)?0:n.locked,Di(n,!0)}}),this.initImageCanvas(t),this.render()}else console.warn("Invalid operation!")}updateRectbyChild(t,i,a){if(re(t),te(t),i.calculative.worldRect=t,a.container&&ea(t,a.calculative.worldRect,!0)){const s=wa(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),o=Math.max(t.ey,a.calculative.worldRect.ey);a.calculative.worldRect={x:s,y:n,width:r-s,height:o-n,ex:r,ey:o},te(a.calculative.worldRect)}else{const s=a.children.map(n=>this.store.pens[n]);a.calculative.worldRect=Ei(s)}a.parentId||Object.assign(a,a.calculative.worldRect),a.children.forEach(s=>{const n=this.store.pens[s],r=wa(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!==Bt.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)}deleteSync(t,i=!1,a=!0){this.canvas.deleteSync(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 We(t,i)}getAllChildren(t){return Le(t,this.store)}getAllFollowers(t){return Xc(t,this.store)}data(){this.initBinds();const t=ot(this.store.data),{pens:i,paths:a}=this.store.data;t.version=Ig.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=Te(this.store.options,"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){if(this.closeWebsocket(),t&&(this.store.data.websocket=t),this.store.data.websocket){try{this.websocket=new WebSocket(this.store.data.websocket,this.store.data.websocketProtocols||void 0)}catch(i){this.store.emitter.emit("error",{type:"websocket",error:i});return}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=Tt());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=yn.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=ot(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 o=>{o.protocol==="mqtt"?(o.index=a,this.connectNetMqtt(o),a+=1):o.protocol==="websocket"?(o.index=n,this.connectNetWebSocket(o),n+=1):o.protocol==="http"?(o.index=s,i.push({url:o.url,interval:o.interval,headers:o.headers||void 0,method:o.method,body:o.body,enable:o.enable,index:o.index,once:o.once}),s+=1):o.protocol==="ADIIOT"?v6(this,o):o.protocol==="SSE"&&(o.index=r,this.connectSSE(o),r+=1)})}this.onNetworkConnect(i),this.connectIot(),this.connectSqls()}reconnectNetwork(t){var a,s,n;const i=(a=this.store.data.networks)==null?void 0:a[t];if(!!i)if(i.protocol==="mqtt")this.mqttClients&&((s=this.mqttClients[i.index])==null||s.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 r=ot(i);this.store.data.cancelFirstConnect||this.requestHttp(r),i.interval!==0&&(this.updateTimerList[i.index]=setInterval(async()=>{this.requestHttp(r)},r.interval||1e3))}else i.protocol==="SSE"&&(this.eventSources&&((n=this.eventSources[i.index])==null||n.close(),this.eventSources[i.index]=void 0),this.connectSSE(i))}async connectIot(){var h,c;const{iot:t}=this.store.data;if(!(t&&((h=t==null?void 0:t.devices)==null?void 0:h.length))||t&&t.enable===!1)return;let{url:i,password:a,username:s}=await this.getMqttUrl();if(i||(i=globalThis.iotUrl),!i){console.warn("iot Request address error");return}const{token:n,room:r,data:o}=await this.getIotToken(t.devices,t.protocol==="websocket"?1:void 0,t.room);o&&this.socketCallback(JSON.stringify(o),{type:"iot",url:i,method:"mqtt"}),r&&(t.room=r),t.token=n;const l={username:s,password:a,clientId:"client-"+Math.random().toString(16).slice(2,8)};if(this.iotMqttClient=yn.exports.connect(i,l),this.iotMqttClient.on("message",(d,f)=>{this.socketCallback(f.toString(),{topic:`le5le-iot/properties/${n}`,type:"iot",url:i,method:"mqtt"})}),this.iotMqttClient.on("error",d=>{this.store.emitter.emit("error",{type:"mqtt",error:d})}),t.room?this.iotMqttClient.subscribe(`le5le-iot/${t.room}/properties/get`):this.iotMqttClient.subscribe(`le5le-iot/properties/${n}`),this.iotTimer=setInterval(()=>{t.room?this.iotMqttClient&&this.iotMqttClient.publish("le5le-iot/subscribe/ping",t.room):this.iotMqttClient&&this.iotMqttClient.publish("le5le-iot/subscribe/ping",n)},3e5),(c=this.store.data.iot.computes)!=null&&c.length){let d=!1;this.store.data.iot.computes.forEach(f=>{f.times>0&&(d=!0)}),this.iotAggregatePublish(this.store.data.iot.computes),t.times=0,d&&(t.interval=setInterval(()=>{t.times+=1;let f=this.store.data.iot.computes.filter(g=>g.times&&t.times%g.times===0);f.length&&this.iotAggregatePublish(f)},1e3))}}iotAggregateBuild(t){let i={token:this.store.data.iot.token,deviceId:t.deviceId,key:t.key,name:t.key+"_"+t.compute_name};return["aggregate","start","end","groupBy","limit","recent"].forEach(a=>{if(t[a])if(t[a].indexOf("${")>-1){let s=t[a].match(new RegExp("(?<=\\$\\{).*?(?=\\})","g"));i[a]=this.getDynamicParam(s[0])}else(a==="start"||a==="end")&&typeof t[a]=="string"?i[a]=Math.floor(new Date(t[a]).getTime()/1e3):i[a]=t[a]}),i}iotAggregatePublish(t){if(this.iotMqttClient){let i=t.map(a=>this.iotAggregateBuild(a));this.iotMqttClient.publish(`le5le-iot/${this.store.data.iot.room}/property/aggregate`,JSON.stringify(i))}}closeIot(){if(this.iotMqttClient){const{iot:t}=this.store.data;t.interval&&(clearInterval(t.interval),t.interval=void 0),t!=null&&t.token&&this.unsubscribeIot(t.token,t.room),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)))})}async connectSSE(t){if(t.enable!==!1){if(t.preJs&&(t.preFn||(t.preFn=Pr(this.store.options,"network",t.preJs)),t.preFn)){const i=await t.preFn(t);i&&(t=i)}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)})}async connectNetMqtt(t){var s,n,r;if(t.enable===!1)return;if(t.preJs&&(t.preFn||(t.preFn=Pr(this.store.options,"network",t.preJs)),t.preFn)){const o=await t.preFn(t);o&&(t=o)}t.options.clientId&&!t.options.customClientId&&(t.options.clientId=Tt());let i=t.url;if(i.indexOf("${")>-1){let o=(s=i.match(/\$\{([^}]+)\}/g))==null?void 0:s.map(l=>l.slice(2,-1));o&&o.forEach(l=>{i=i.replace(`\${${l}}`,this.getDynamicParam(l))})}t.times=0;let a=ot(t.options);if((a==null?void 0:a.username)&&a.username.includes("${")){let o=(n=a.username.match(/\$\{([^}]+)\}/g))==null?void 0:n.map(l=>l.slice(2,-1));o&&o.forEach(l=>{a.username=a.username.replace(`\${${l}}`,this.getDynamicParam(l))})}if((a==null?void 0:a.password)&&a.password.includes("${")){let o=(r=a.password.match(/\$\{([^}]+)\}/g))==null?void 0:r.map(l=>l.slice(2,-1));o&&o.forEach(l=>{a.password=a.password.replace(`\${${l}}`,this.getDynamicParam(l))})}a.hasOwnProperty("keepalive")||Object.assign(a,{keepallive:30}),a.hasOwnProperty("reconnectPeriod")||Object.assign(a,{reconnectPeriod:5e3}),a.hasOwnProperty("connectTimeout")||Object.assign(a,{connectTimeout:10*1e3}),this.mqttClients[t.index]=yn.exports.connect(i,a),this.mqttClients[t.index].on("message",(o,l)=>{this.socketCallback(l.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("connect",o=>{var l;if(!o.sessionPresent&&t.topics){let h=t.topics;if(h.indexOf("${")>-1){let c=(l=h.match(/\$\{([^}]+)\}/g))==null?void 0:l.map(d=>d.slice(2,-1));c&&c.forEach(d=>{h=h.replace(`\${${d}}`,this.getDynamicParam(d))})}this.mqttClients[t.index].subscribe(h.split(","),{qos:1},c=>{c&&console.error("\u8BA2\u9605\u5931\u8D25\uFF1A",c)})}})}async 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;if(t.preJs&&(t.preFn||(t.preFn=Pr(this.store.options,"network",t.preJs)),t.preFn)){const n=await t.preFn(t);n&&(t=n)}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:vn()}});if(t.ok){const i=await t.text();let a=JSON.parse(i);return a.wssPort||a.wsPort?{username:a.username,password:a.password,url:`${location.protocol==="https:"?"wss":"ws"}://${a.host}:${location.protocol==="https:"?a.wssPort:a.wsPort}${a.path}`}:void 0}}async getIotToken(t,i,a){const s=await fetch("/api/iot/subscribe/properties",{method:"POST",headers:{Authorization:vn()},body:JSON.stringify({devices:t,type:i,room:a})});if(s.ok)return await s.json()}async unsubscribeIot(t,i){return await fetch("/api/iot/unsubscribe/properties",{method:"POST",headers:{Authorization:vn()},body:JSON.stringify({token:t,room:i})})}async doSqlCode(t){var n;const i=t.method||"get";let a=t.sql;i==="list"&&t.pageSize!==-1&&(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:vn()},body:JSON.stringify({dbId:t.dbId||t.dbid,sql:a})});if(s.ok){let r=await s.text();if(r){const o=[];if(r=JSON.parse(r),r.error){this.store.emitter.emit("error",{type:"sql",error:r.error});return}(n=t.keys)==null||n.forEach(l=>{o.push({id:t.bindId+"#"+l,value:Ne(r,l.split("#").join("."))})}),o.push({id:t.bindId,value:r}),this.socketCallback(JSON.stringify(o),{type:"sql",url:`/api/iot/data/sql/${i}`,method:i,net:t})}}}randomString(t){t=t||32;let i="ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678",a=i.length,s="";for(let n=0;n{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=ot(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){if(!t.apiUrl)return;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){var n,r;let i=localStorage.getItem(t);return globalThis.le5leTokenD&&[(n=globalThis.le5leSSOTokenName)!=null?n:"ssotoken",(r=globalThis.le5leTokenName)!=null?r:"token"].includes(t)&&(i=Ng(i)),Rs()[t]||i||io(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 s,n,r,o;let i=ot(t);const a=(s=this.store.data.networks)==null?void 0:s.filter(l=>l.protocol==="http")[i.index];if(a!=null&&a.preJs&&(a.preFn||(a.preFn=Pr(this.store.options,"network",a.preJs)),a.preFn)){const l=await a.preFn(i);l&&(i=l)}if(i.url){if(i.url.indexOf("${")>-1){let h=(n=i.url.match(/\$\{([^}]+)\}/g))==null?void 0:n.map(c=>c.slice(2,-1));h&&h.forEach(c=>{i.url=i.url.replace(`\${${c}}`,this.getDynamicParam(c))})}if(typeof i.headers=="object"){let h=JSON.stringify(i.headers),c=(r=h.match(/\$\{([^}]+)\}/g))==null?void 0:r.map(d=>d.slice(2,-1));if(c!=null&&c.length)for(let d=0;dd.slice(2,-1));if(c!=null&&c.length)for(let d=0;d{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(),y6(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=Te(this.store.options,"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,net:i.net}),!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(o){console.warn("Invalid socket data:",s,o)}else return;if(!!s){if(!Array.isArray(s)&&s.constructor===Object&&!s.id&&!s.dataId&&!s.tag){const o=Object.keys(s).map(l=>({dataId:l,id:l,value:s[l]}));o.length&&(this.setDatas(o,{render:!1}),this.render(!0));return}Array.isArray(s)||(s=[s]),s.length&&(s[0].dataId?this.setDatas(s,{render:!1}):s.forEach(o=>{this.setValue(o,{render:!1})}),this.render(!0))}}setDatas(t,{render:i=!0,doEvent:a=!0,history:s}={}){const n=new Map;t.forEach(h=>{var c,d;(c=this.store.bindDatas[h.dataId])==null||c.forEach(f=>{const g=this.store.pens[f.id];if(!g)return;let m=n.get(g);if(!g.noOnBinds&&typeof g.onBinds=="function"){if(m)return;n.set(g,g.onBinds(g,t,f.formItem));return}m?m[f.formItem.key]=h.value:(m={id:f.id,[f.formItem.key]:h.value},n.set(g,m))}),(d=this.store.bind[h.id||h.dataId])==null||d.forEach(f=>{const g=this.store.pens[f.id];if(!g)return;let m=n.get(g);m?m[f.key]=h.value:(m={id:f.id,[f.key]:h.value},n.set(g,m))})});let r,o;s&&(r=[],o=[]);const l=this.canvas.batchRendering;this.canvas.batchRendering=!0;try{this.store.data.locked&&this.doDataEvent(t),n.forEach((h,c)=>{!h||(s&&r.push(ot(c,!0)),this.updatePenValue(c,h),a&&this.store.emitter.emit("valueUpdate",c),s&&o.push(c))})}finally{this.canvas.batchRendering=l}i&&this.render(),s&&this.pushHistory({type:_t.Update,initPens:r,pens:o})}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 o=this.store.pens[t.id];if(o)n=[o];else{let l=this.store.bind[t.id];if(l&&l.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 o=[];for(let l in t)o.push({dataId:l,id:l,value:t[l]});o.length&&this.setDatas(o,{render:i,doEvent:a,history:s});return}s=s&&!this.store.data.locked;let r;if(s&&(r=ot(n)),n.forEach(o=>{this.updatePenValue(o,t)}),!this.store.data.locked&&this.store.active.length&&!this.canvas.movingPens&&this.canvas.calcActiveRect(),s){let o=ot(n);this.pushHistory({type:_t.Update,initPens:r,pens:o})}a&&n.forEach(o=>{this.store.emitter.emit("valueUpdate",o)}),i&&this.render()}updatePenValue(t,i){var s;if(t.name==="echarts"&&!t.onBeforeValue&&Object.keys(i).some(r=>x6.test(r)))return;const a=t.onBeforeValue?t.onBeforeValue(t,i):i;i.frames&&(this.stopAnimate([t]),i.showDuration||(i.showDuration=i.frames.reduce((n,r)=>n+r.duration,0))),Qc(t,a),this.canvas.updateValue(t,a),(s=t.onValue)==null||s.call(t,t)}_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=>{n.timeout?setTimeout(()=>{this.events[n.action]&&this.events[n.action](a.pen,n,i)},n.timeout):this.events[n.action]&&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:o,operator:l,valueType:h}=a;let c=!1;if(s==="fn"){if(o)c=o(t,{meta2d:this});else if(r){try{a.fn=Te(this.store.options,"data","context",r)}catch(d){console.error("Error: make function:",d)}a.fn&&(c=a.fn(t,{meta2d:this}))}}else{let d=a.value;h==="prop"&&(d=t[a.value]);let f=t[i];switch(l){case">":c=f>+d;break;case">=":c=f>=+d;break;case"<":c=f<+d;break;case"<=":c=f<=+d;break;case"=":case"==":c=f==d;break;case"!=":c=f!=d;break;case"[)":c=bs(+f,d);break;case"![)":c=!bs(+f,d);break;case"[]":c=xs(f,d);break;case"![]":c=!xs(f,d);break}}return c}judgeCondition(t,i,a){const{type:s,target:n,fnJs:r,fn:o,operator:l,valueType:h}=a;let c=!1;if(s==="fn"){if(o)c=o(t,{meta2d:this});else if(r){try{a.fn=Te(this.store.options,"pen","context",r)}catch(d){console.error("Error: make function:",d)}a.fn&&(c=a.fn(t,{meta2d:this}))}}else{let d=a.value;h==="prop"&&(d=this.store.pens[n][a.value]);let f=Ne(t,i);switch(["x","y","width","height"].includes(i)&&(f=this.getPenRect(t)[i]),l){case">":c=f>+d;break;case">=":c=f>=+d;break;case"<":c=f<+d;break;case"<=":c=f<=+d;break;case"=":case"==":c=f==d;break;case"!=":c=f!=d;break;case"[)":c=bs(+f,d);break;case"![)":c=!bs(+f,d);break;case"[]":c=xs(f,d);break;case"![]":c=!xs(f,d);break}}return c}pushChildren(t,i){const a=[ot(t,!0)],s=[];t.children||(t.children=[]);const n=[];i.forEach(o=>{var c;let l=ot(o,!0);if((!o.id||!this.store.pens[o.id])&&(this.canvas.makePen(o),l=null),o.parentId){const d=this.store.pens[o.parentId],f=d.children.findIndex(g=>g===o.id);a.push(ot(d,!0)),d.children.splice(f,1),n.push(ot(d,!0))}t.children.push(o.id),o.parentId=t.id;const h=wa(o.calculative.worldRect,t.calculative.worldRect);Object.assign(o,h),o.locked=(c=o.lockedOnCombine)!=null?c:Bt.DisableMove,o.locked=o.interaction||Gl.includes(o.name)?0:o.locked,l?(a.push(l),n.push(ot(o,!0))):s.push(ot(o,!0))}),n.push(ot(t,!0));let r=1;s.length&&(r=2,this.pushHistory({type:_t.Add,pens:s,step:r})),this.pushHistory({type:_t.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 o=this.store.options.downloadBgTransparent?void 0:this.store.data.background||this.store.styles.background;o&&i&&(r.save(),r.fillStyle=o,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),o&&!i&&(r.save(),r.fillStyle=o,r.fillRect(0,0,n.width+20,n.height+20),r.restore());for(const m of this.store.data.pens)m.visible==!1||!lo(m,this.store)||oo(r,m,n,!0);let l=r.getSerializedSvg();t!=null&&t.length&&(l=l.replace("",` {{bk}} {{bkRect}}`)),o?(l=l.replace("{{bk}}",""),l=l.replace("{{bkRect}}",``)):(l=l.replace("{{bk}}",""),l=l.replace("{{bkRect}}","")),l=l.replace(/--le5le--/g,"&#x");const h=window.URL,c=new Blob([l]),d=h.createObjectURL(c),f=document.createElement("a");f.setAttribute("download",`${this.store.data.name||"le5le.meta2d"}.svg`),f.setAttribute("href",d);const g=document.createEvent("MouseEvents");g.initEvent("click",!0,!0),f.dispatchEvent(g)}getRect(t=this.store.data.pens){return Ei(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,a=!0){var f,g;if(!this.hasView())return;const{canvas:s}=this.canvas,{offsetWidth:n,offsetHeight:r}=s;this.resize(n,r);const o=Qi(i),l=this.getRect(),h=(n-o[1]-o[3])/l.width,c=(r-o[0]-o[2])/l.height;let d=h;t?d=h>c?c:h:d=h>c?h:c,a&&((f=this.store.data.fits)==null?void 0:f.length)&&(this.canvas.opening=!0),this.scale(d*this.store.data.scale),this.centerView(),a&&((g=this.store.data.fits)==null?void 0:g.length)&&this.fillView()}fillView(){var h,c,d,f;if(this.store.options.unFill)return;let t={x:this.store.data.origin.x,y:this.store.data.origin.y,width:this.store.data.width*this.store.data.scale,height:this.store.data.height*this.store.data.scale};(isNaN(t.width)||isNaN(t.height))&&(t=this.getRect());const i=new Set;(h=this.store.data.fits)==null||h.forEach(g=>{var m;(m=g.children)==null||m.forEach(y=>i.add(y))});const a=(g,m,y)=>{var p,x;!g||g.name!=="tablePlus"||y!=null&&y.has(g.id)||(y==null||y.add(g.id),g.colWidth=((p=g.colWidth)!=null?p:150)*m,(x=g.styles)==null||x.forEach(_=>{_.width&&(_.width*=m)}))},s=(g,m,y)=>{var p;a(g,m,y),(p=g.children)!=null&&p.length&&Le(g,this.store).forEach(x=>{a(x,m,y)})},{origin:n,scale:r}=this.store.data;if(this.fillViewSnapshot)this.fillViewSnapshot.forEach((g,m)=>{var p,x,_,b;const y=this.store.pens[m];!y||(g.colWidth!==void 0&&(y.colWidth=g.colWidth),g.styleWidths&&((p=y.styles)==null||p.forEach((k,R)=>{g.styleWidths[R]!==void 0&&(k.width=g.styleWidths[R])})),!g.onlyTablePlus&&(y.x=n.x+g.x*r,y.y=n.y+g.y*r,y.width=g.width*r,y.height=g.height*r,g.textWidth!==void 0&&(y.textWidth=g.textWidth*r),g.imageRatio!==void 0&&(y.imageRatio=g.imageRatio),g.ratio!==void 0&&(y.ratio=g.ratio),(y.name==="iframe"||y.name==="htmlDom")&&g.operationalRect&&(y.operationalRect=ot(g.operationalRect),(x=y.onBeforeValue)==null||x.call(y,y,{operationalRect:y.operationalRect})),this.canvas.updatePenRect(y,{worldRectIsReady:!1}),y.externElement&&((_=y.onResize)==null||_.call(y,y)),(b=y.children)!=null&&b.length&&Le(y,this.store).forEach(k=>{var R;k.externElement&&((R=k.onResize)==null||R.call(k,k))})))});else{this.fillViewSnapshot=new Map;const g=(m,y=!1)=>{var x;const p=m.calculative.worldRect;this.fillViewSnapshot.set(m.id,{onlyTablePlus:y,x:y?void 0:(p.x-n.x)/r,y:y?void 0:(p.y-n.y)/r,width:y?void 0:p.width/r,height:y?void 0:p.height/r,textWidth:!y&&m.textWidth!=null?m.textWidth/r:void 0,colWidth:m.name==="tablePlus"?m.colWidth:void 0,styleWidths:m.name==="tablePlus"?(x=m.styles)==null?void 0:x.map(_=>_.width):void 0,imageRatio:y?void 0:m.imageRatio,ratio:y?void 0:m.ratio,operationalRect:!y&&(m.name==="iframe"||m.name==="htmlDom")&&m.operationalRect?ot(m.operationalRect):void 0})};(c=this.store.data.fits)==null||c.forEach(m=>{m.children.forEach(y=>{var x;const p=this.store.pens[y];!p||(g(p),(x=p.children)!=null&&x.length&&Le(p,this.store).forEach(_=>{_.name==="tablePlus"&&!this.fillViewSnapshot.has(_.id)&&g(_,!0)}))})}),this.store.data.pens.filter(m=>m.name==="iframe"||m.name==="htmlDom").forEach(m=>g(m))}const o=this.canvas.width-t.width,l=this.canvas.height-t.height;if(Math.abs(o)>10){(d=this.store.data.fits)==null||d.forEach(y=>{let p=[];y.children.forEach(_=>{this.store.pens[_]&&(this.store.pens[_].locked=Bt.None,p.push(this.store.pens[_]))});let x=o/2;if(y.left&&y.right){let _=y.leftValue,b=y.rightValue;_?_=Math.abs(_)<1?_*t.width:_:_=0,b?b=Math.abs(b)<1?b*t.width:b:b=0;let k=(this.canvas.width-_-b)/(t.width-_-b);const R=new Set;p.forEach(S=>{var I,D;S.image&&S.imageRatio&&S.calculative.worldRect.width/this.canvas.width>.1&&(S.imageRatio=!1,S.ratio=!1),s(S,k,R),Math.abs(y.leftValue)<1?S.calculative.worldRect.x=t.x-o/2+_+(S.calculative.worldRect.x-t.x-_)*k:S.calculative.worldRect.x=t.x-o/2+_+(S.calculative.worldRect.x-t.x)*k,S.calculative.worldRect.width*=k,S.calculative.worldRect.ex=S.calculative.worldRect.x+S.calculative.worldRect.width,S.calculative.width=S.calculative.worldRect.width,S.calculative.x=S.calculative.worldRect.x,S.width=S.calculative.worldRect.width,S.x=S.calculative.worldRect.x,S.textWidth*=k,S.calculative.textWidth*=k,this.canvas.updatePenRect(S,{worldRectIsReady:!1}),S.externElement&&((I=S.onResize)==null||I.call(S,S)),(D=S.children)!=null&&D.length&&Le(S,this.store).forEach(G=>{var F;G.externElement&&((F=G.onResize)==null||F.call(G,G))})})}else y.left?(x=-x,y.leftValue&&(x+=Math.abs(y.leftValue)<1?y.leftValue*this.canvas.width:y.leftValue),this.translatePens(p,x,0)):y.right&&(y.rightValue&&(x=x-(Math.abs(y.rightValue)<1?y.rightValue*this.canvas.width:y.rightValue)),this.translatePens(p,x,0))});const g=this.store.data.pens.filter(y=>y.name==="iframe"&&!i.has(y.id));g==null||g.forEach(y=>{var x,_;const p=y.calculative.worldRect;if(p.width/t.width>.8){let b=p.width;y.calculative.worldRect.x=p.x-o/2,y.calculative.worldRect.width=p.width+o,y.calculative.worldRect.ex=p.ex+o,y.operationalRect&&(y.operationalRect.x=y.operationalRect.x*b/y.calculative.worldRect.width,y.operationalRect.width=(y.calculative.worldRect.width-(1-y.operationalRect.width)*b)/y.calculative.worldRect.width,(x=y.onBeforeValue)==null||x.call(y,y,{operationalRect:y.operationalRect})),(_=y.onResize)==null||_.call(y,y)}});const m=this.store.data.pens.filter(y=>y.name==="video");m==null||m.forEach(y=>{var x;const p=y.calculative.worldRect;p.width/this.canvas.width>.8&&(y.calculative.worldRect.x=p.x-o/2,y.calculative.worldRect.width=p.width+o,y.calculative.worldRect.ex=p.ex+o,(x=y.onResize)==null||x.call(y,y))})}if(Math.abs(l)>10){(f=this.store.data.fits)==null||f.forEach(y=>{let p=[];y.children.forEach(_=>{this.store.pens[_]&&(this.store.pens[_].locked=Bt.None,p.push(this.store.pens[_]))});let x=l/2;if(y.top&&y.bottom){let _=y.topValue,b=y.bottomValue;_?_=Math.abs(_)<1?_*this.canvas.height:_:_=0,b?b=Math.abs(b)<1?b*this.canvas.height:b:b=0;let k=(this.canvas.height-_-b)/t.height;p.forEach(R=>{var S,I;R.image&&R.imageRatio&&R.calculative.worldRect.height/this.canvas.height>.1&&(R.imageRatio=!1,R.ratio=!1),R.calculative.worldRect.y=t.y-l/2+_+(R.calculative.worldRect.y-t.y)*k,R.calculative.worldRect.height*=k,R.calculative.worldRect.ey=R.calculative.worldRect.y+R.calculative.worldRect.height,R.calculative.height=R.calculative.worldRect.height,R.calculative.y=R.calculative.worldRect.y,R.height=R.calculative.worldRect.height,R.y=R.calculative.worldRect.y,this.canvas.updatePenRect(R,{worldRectIsReady:!1}),R.externElement&&((S=R.onResize)==null||S.call(R,R)),(I=R.children)!=null&&I.length&&Le(R,this.store).forEach(V=>{var G;V.externElement&&((G=V.onResize)==null||G.call(V,V))})})}else y.top?(x=-x,y.topValue&&(x+=Math.abs(y.topValue)<1?y.topValue*this.canvas.height:y.topValue),this.translatePens(p,0,x)):y.bottom&&(y.bottomValue&&(x=x-(Math.abs(y.bottomValue)<1?y.bottomValue*this.canvas.height:y.bottomValue)),this.translatePens(p,0,x))});const g=this.store.data.pens.filter(y=>y.name==="iframe"&&!i.has(y.id));g==null||g.forEach(y=>{var x,_;const p=y.calculative.worldRect;if(p.height/t.height>.8){let b=p.height;y.calculative.worldRect.y=p.y-l/2,y.calculative.worldRect.height=p.height+l,y.calculative.worldRect.ey=p.ey+l,y.operationalRect&&(y.operationalRect.y=y.operationalRect.y*b/y.calculative.worldRect.width,y.operationalRect.height=(y.calculative.worldRect.height-(1-y.operationalRect.height)*b)/y.calculative.worldRect.height,(x=y.onBeforeValue)==null||x.call(y,y,{operationalRect:y.operationalRect})),(_=y.onResize)==null||_.call(y,y)}});const m=this.store.data.pens.filter(y=>y.name==="video");m==null||m.forEach(y=>{var x;const p=y.calculative.worldRect;p.height/this.canvas.height>.8&&(y.calculative.worldRect.y=p.y-l/2,y.calculative.worldRect.height=p.height+l,y.calculative.worldRect.ey=p.ey+l,(x=y.onResize)==null||x.call(y,y))})}this.canvas.canvasTemplate.fit=!0,this.canvas.canvasTemplate.init(),this.canvas.canvasImage.init(),this.canvas.canvasImageBottom.init(),this.render(!0)}scaleView(){const t=window.innerWidth/window.innerHeight,i=this.getRect(),a=i.width/i.height;if(Math.abs(t-a)<.001)return;let s;t>a?s=`scale(${t/a},1)`:s=`scale(1,${a/t})`,this.canvas.parentElement.style.transform=s}setFits(){if(!this.store.data.fits){const t=this.store.data.pens.filter(i=>!i.parentId).map(i=>i.id);this.store.data.fits=[{bottom:!0,bottomValue:0,left:!0,leftValue:0,right:!0,rightValue:0,top:!0,topValue:0,x:0,y:0,height:1,width:1,children:t}]}}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),o=this.getRect(),l=(s-r[1]-r[3])/o.width,h=(n-r[0]-r[2])/o.height;let c=l;t?c=l>h?h:l:c=l>h?l:h,this.canvas.templateScale(c*this.store.data.scale);let d=this.getRect(),f=this.store.data.pens.filter(g=>!g.parentId);this.canvas.templateTranslatePens(f,-d.x,-d.y),this.store.data.pens.forEach(g=>{g.type?this.canvas.initLineRect(g):this.canvas.updateLines(g)}),this.centerView()}fitSizeView(t=!0,i=10,a=!0){var g,m;const{canvas:s}=this.canvas,{offsetWidth:n,offsetHeight:r}=s;this.resize(n,r);const o=Qi(i),l=(this.store.data.width||this.store.options.width)*this.store.data.scale,h=(this.store.data.height||this.store.options.height)*this.store.data.scale,c=(n-o[1]-o[3])/l,d=(r-o[0]-o[2])/h;let f=c;t==="width"?f=c:t==="height"?f=d:t?f=c>d?d:c:f=c>d?c:d,a&&((g=this.store.data.fits)==null?void 0:g.length)&&(this.canvas.opening=!0),this.scale(f*this.store.data.scale),this.centerSizeView(),a&&((m=this.store.data.fits)==null?void 0:m.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};te(s);const{center:n}=s,{scale:r,origin:o,x:l,y:h}=this.store.data;this.translate((t.x-o.x)/r-n.x-l/r,(t.y-o.y)/r-n.y-h/r);const{canvas:c}=this.canvas,d=(c.scrollWidth-c.offsetWidth)/2,f=(c.scrollHeight-c.offsetHeight)/2;c.scrollTo(d,f)}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);let o=null;const l=this.store.data.width||this.store.options.width,h=this.store.data.height||this.store.options.height;l&&h?o={width:l*this.store.data.scale,height:h*this.store.data.scale}:o=this.getRect();const c=(s-r[1]-r[3])/o.width;this.scale(c*this.store.data.scale),this.topView(r[0]),i&&this.canvas.scroll.changeMode(r[0])}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),o=this.getRect();let l=(s-r[1]-r[3])/o.width;i||(l=(n-r[0]-r[2])/o.height),this.scale(l*this.store.data.scale),this.topView(r[0])}topView(t=10){if(!this.hasView())return;const i=this.getRect(),a=this.getViewCenter(),s=this.store.data.width||this.store.options.width,n=this.store.data.height||this.store.options.height;let r=null;s&&n?r={x:0,y:0,width:s,height:n}:r=this.getPenRect(i),te(r);const{center:o}=r,{scale:l,origin:h,x:c,y:d}=this.store.data;this.translate((a.x-h.x)/l-o.x-c/l,(t-h.y)/l-r.y-d/l);const{canvas:f}=this.canvas,g=(f.scrollWidth-f.offsetWidth)/2,m=(f.scrollHeight-f.offsetHeight)/2;f.scrollTo(g,m)}centerView(){if(!this.hasView())return;const t=this.getRect(),i=this.getViewCenter(),a=this.getPenRect(t);te(a);const{center:s}=a,{scale:n,origin:r,x:o,y:l}=this.store.data;this.translate((i.x-r.x)/n-s.x-o/n,(i.y-r.y)/n-s.y-l/n);const{canvas:h}=this.canvas,c=(h.scrollWidth-h.offsetWidth)/2,d=(h.scrollHeight-h.offsetHeight)/2;h.scrollTo(c,d)}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=ot(t),s=t[0],{width:n,height:r}=this.getPenRect(s);for(let o=1;o{s[n]=a[n]});for(let n=1;n{s[n]=a[n]});for(let n=0;n0){const a=t[0];ln.forEach(s=>{i[s]=a[s]!==void 0?a[s]:this.store.options.defaultFormat[s]||this.store.data[s]||this.store.options[s]})}else ln.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=ot(t),a=JSON.parse(localStorage.getItem("meta2d-formatPainter"));for(let s=0;s{for(let s=0;s{h=Math.min(h,f.calculative.worldRect[d]),c=Math.max(c,f.calculative.worldRect["e"+d])}),a=(c-h)/this.store.data.scale}if(i=i.filter(h=>!h.parentId),i.length<=2)return;const s=ot(i),n=i.reduce((h,c)=>{const d=this.getPenRect(c);return h+d[t]},0),r=(a-n)/(i.length-1);i=i.sort((h,c)=>t==="width"?h.x-c.x:h.y-c.y);const o=this.getPenRect(i[0]);let l=t==="width"?o.x:o.y;for(const h of i){const c=this.getPenRect(h);t==="width"?c.x=l:c.y=l,l+=c[t]+r,this.setValue({id:h.id,...c},{render:!1,doEvent:!1})}this.initImageCanvas(i),this.initTemplateCanvas(i),this.render(),this.pushHistory({type:_t.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(Ei(t));!i&&(i=s.width),t=t.filter(h=>!h.type&&!h.parentId);const n=ot(t);let r=0;t.forEach(h=>{const c=this.getPenRect(h);c.height>r&&(r=c.height)});let o=s.x,l=s.y;t.forEach((h,c)=>{const d=this.getPenRect(h);if(d.x=o,d.y=l+r/2-d.height/2,this.setValue({id:h.id,...d},{render:!1,doEvent:!1}),c===t.length-1)return;const f=o+d.width-s.x,g=this.getPenRect(t[c+1]);Math.round(i-f)>=Math.round(g.width+a)?o+=d.width+a:(o=s.x,l+=r+a)}),this.initImageCanvas(t),this.initTemplateCanvas(t),this.render(),this.pushHistory({type:_t.Update,initPens:n,pens:t})}gotoView(t){var n;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 r of this.store.data.pens)Di(r),(n=r.onMove)==null||n.call(r,r);this.canvas.canvasTemplate.init(),this.canvas.canvasImage.init(),this.canvas.canvasImageBottom.init(),this.render()}animateView(t){this.canvas.animateView(t)}showMap(){this.map||(this.map=new d6(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=[...Le(i,this.store),i].map(r=>r.id);a.filter(r=>s.includes(r.id)).forEach(r=>{const o=a.findIndex(l=>l.id===r.id);o>-1&&(a.push(a[o]),a.splice(o,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=[...Le(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 o=n[r],l=a.findIndex(h=>h.id===o.id);l>-1&&(a.unshift(a[l]),a.splice(l+1,1),this.initTemplateCanvas([o]),this.initImageCanvas([o])),this.specificLayerMove(o,"bottom")}}this.store.emitter.emit("layer",{type:"bottom",pens:t})}upByArea(t){if(this.store.data.pens.findIndex(l=>l.id===t.id)===-1){console.warn("upByArea: pen not in canvas");return}const a=[t,...Le(t,this.store)];let s=a.map(l=>this.store.data.pens.findIndex(h=>h.id===l.id));s.includes(-1)&&(console.warn("upByArea: pen children not in canvas"),s=s.filter(l=>l!==-1));const n=Math.min(...s),r=t.calculative.worldRect,o=this.store.data.pens.findIndex((l,h)=>{if(h<=n||l.id===t.id||Z2(l,t))return!1;const c=l.calculative.worldRect;return ea(r,c)});if(o===-1){this.up(t);return}this.store.data.pens.splice(o+1,0,...a);for(const l of a){const h=this.store.data.pens.findIndex(c=>c.id===l.id);h>-1&&this.store.data.pens.splice(h,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.name.endsWith("Dom")||bc.includes(t.name)||this.store.options.domShapes.includes(t.name)||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&&Re(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=[...Le(i,this.store),i],n=[];for(let l=0;lc.id===h.id)!==-1&&(h.temIndex=l,n.push(h))}let r=-1,o=0;n.forEach(l=>{l.temIndex-=o,a.splice(l.temIndex,1),o+=1,r=l.temIndex,delete l.temIndex,this.specificLayerMove(l,"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=[...Le(i,this.store),i],n=[];for(let l=0;lc.id===h.id)!==-1&&(h.temIndex=l,n.push(h))}let r=-1,o=0;n.forEach((l,h)=>{l.temIndex-=o,a.splice(l.temIndex,1),o+=1,h===0&&(r=l.temIndex),delete l.temIndex,this.specificLayerMove(l,"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{const r=this.store.pens[n];if(!r){console.warn(t,"node contain a error connectedLine");return}if(!a.find(o=>o.id===r.id))switch(i){case"all":a.push(r);break;case"in":jt(r).connectTo===t.id&&a.push(r);break;case"out":ce(r).connectTo===t.id&&a.push(r);break}}),a}nextNode(t){if(t.type===Ut.Line){const i=this.store.pens[jt(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(l=>l.id===r.id)&&a.push(r)}),a}}previousNode(t){if(t.type===Ut.Line){const i=this.store.pens[ce(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(l=>l.id===r.id)&&a.push(r)}),a}}getNext(t){var a;if(t.type===Ut.Line){console.warn("\u975E\u8FDE\u7EBF\u8282\u70B9");return}const i=[];return(a=t.connectedLines)==null||a.forEach(({lineId:s,anchor:n})=>{var l,h;const r=(l=t.anchors)==null?void 0:l.filter(c=>c.id===n)[0],o=this.findOne(s);if(o.anchors[0].connectTo==t.id){const c=o.anchors[o.anchors.length-1].connectTo;if(c){const d=this.findOne(c),f=(h=d.connectedLines)==null?void 0:h.filter(m=>m.lineId===o.id)[0],g=d.anchors.filter(m=>m.id===f.anchor)[0];i.push({from:t,fromAnchor:r,line:o,to:d,toAnchor:g})}}}),i}addAnchor(t,i,a){if(!t)return;if(t.anchors||(t.anchors=[]),t.calculative.worldAnchors||(t.calculative.worldAnchors=[]),t.type===Ut.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||Tt(),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&&Zt(n,t.rotate,t.calculative.worldRect.center),s={id:n.id,penId:t.id,x:i.x,y:i.y}):(n={id:i.id||Tt(),penId:t.id,x:i.x,y:i.y},t.calculative.worldRect&&(t.rotate%360&&Zt(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===Ut.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 h=i.calculative.worldRect;a=Ps(t,{x:h.x+h.width/2,y:h.y+h.height/2})}if(!s){const h=t.calculative.worldRect;s=Ps(i,{x:h.x+h.width/2,y:h.y+h.height/2})}const r=Math.abs(a.x-s.x),l={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:Tt()},{x:a.x>s.x?0:1,y:a.x>s.x?0:1,id:Tt()}]};return this.addPens([l]),xe(t,a,l,l.calculative.worldAnchors[0]),xe(i,s,l,l.calculative.worldAnchors[1]),l.calculative.active=!1,this.canvas.updateLines(l),this.canvas.updateLines(t),this.canvas.updateLines(i),this.canvas.initLineRect(l),n&&this.render(),l}async addLineByPoints(t,i={},a=!0){if(!t||t.length<2){console.warn("addLineByPoints: \u81F3\u5C11\u9700\u8981 2 \u4E2A\u70B9");return}const{scale:s,origin:n}=this.store.data,r=t.map(y=>({x:y.x*s+n.x,y:y.y*s+n.y})),o=r.map(y=>y.x),l=r.map(y=>y.y),h=Math.min(...o),c=Math.min(...l),d=Math.max(...o)-h,f=Math.max(...l)-c,g=i.id||Tt(),m={lineName:"line",...i,id:g,name:"line",type:Ut.Line,x:h,y:c,width:d,height:f,anchors:r.map((y,p)=>({id:`${p}`,penId:g,x:d?(y.x-h)/d:0,y:f?(y.y-c)/f:0}))};return await this.addPen(m,a,!0)}toComponent(t=this.store.data.pens,i,a){if(t.length===1){const c=ot(t[0]);return c.type=Ut.Node,c.id=void 0,[c]}const s=ot(t,!0),n=Ei(s);let r={id:Tt(),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 o=s.filter(c=>!c.parentId),l=s.find(c=>c.width===n.width&&c.height===n.height),h=l&&i===void 0;return o.length===1?r=o[0]:h&&(l.children||(l.children=[]),r=l),s.forEach(c=>{var f;if(c===r||c.parentId===r.id||c.parentId)return;r.children.push(c.id),c.parentId=r.id;const d=wa(c.calculative.worldRect,n);Object.assign(c,d),c.locked=(f=c.lockedOnCombine)!=null?f:Bt.DisableMove}),h||o.length===1?ot(s):ot([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&&Z_(n)&&a)if(n.install(t,r),!this.penPluginMap.has(n))this.penPluginMap.set(n,[{[a]:t[a],option:r}]);else{let o=this.penPluginMap.get(n).find(l=>l[a]===t[a]);o?o.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),o=r.findIndex(l=>l[a]===t[a]);o!==-1&&(r.splice(o,1),r.length===0&&this.penPluginMap.delete(n))})}setVisible(t,i,a=!0,s=!0,n=!0){if(this.setValue({id:t.id,visible:i},{render:!1,doEvent:!1}),t.children)for(const o of t.children){const l=this.store.pens[o];l&&this.setVisible(l,i,!1,!1,!1)}a&&this.store.emitter.emit("visible",{pen:t,visible:i});const r=[t];s&&this.onSizeUpdate(),n&&this.initImageCanvas(r),a&&this.render()}clearHover(){this.canvas.clearHover()}closeSocket(){this.closeWebsocket(),this.closeMqtt(),this.closeHttp()}setLocale(t){W2(t)}addLocale(t,i){H2(t,i)}destroy(t){if(this.clear(!1),Q5(),this.stopDataMock(),this.closeSocket(),this.closeNetwork(),this.closeAll(),gn.destroyThemeSheet(this.store.id),this.store.emitter.all.clear(),this.canvas.destroy(),this.canvas=void 0,wt[this.store.id]=void 0,!t){for(const i in wt)delete wt[i];wt.path2dDraws={},wt.canvasDraws={},wt.anchors={},wt.htmlElements={},wt.lineAnimateDraws={},wt.gridDrawers={}}}}function A6(e,t){const i=t||new Path2D,{x:a,y:s,width:n,ey:r}=e.calculative.worldRect,o=n/4;if(i.moveTo(a+o,s),i.lineTo(a,s),i.lineTo(a,r),i.lineTo(a+o,r),i instanceof Path2D)return i}function k6(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 C6(e,t){const i=t||new Path2D,{x:a,y:s,width:n,ex:r,ey:o}=e.calculative.worldRect,l=e.offsetX;let h=n/7;if(l>1?h=l:l>0&&(h=n*l),i.moveTo(a+h,s),i.lineTo(r,s),i.lineTo(a+n-h,o),i.lineTo(a,o),i.closePath(),i instanceof Path2D)return i}function F6(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 R6(e,t){const i=t||new Path2D,{x:a,y:s,width:n,height:r,ex:o,ey:l}=e.calculative.worldRect,h=n/8;if(i.moveTo(a+h,s),i.lineTo(o-h,s),i.bezierCurveTo(o+h/3,s,o+h/3,l,o-h,l),i.lineTo(a+h,l),i.lineTo(a,s+r/2),i.closePath(),i instanceof Path2D)return i}function P6(e,t){const i=t||new Path2D,{x:a,y:s,width:n,height:r,ex:o,center:l}=e.calculative.worldRect,h=l.x,c=s+r*6/7,d=r/6;if(i.moveTo(a,s),i.lineTo(o,s),i.lineTo(o,c),i.bezierCurveTo(o-20,c-d,h+n/5,c-d,h,c),i.bezierCurveTo(h-n/5,c+d,a,c+d,a,c),i.closePath(),i instanceof Path2D)return i}function S6(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 T6(e,t){const i=t||new Path2D,{x:a,y:s,width:n,ex:r,ey:o}=e.calculative.worldRect,l=n/10;if(i.moveTo(a+l*2,s),i.bezierCurveTo(a-l*2/3,s,a-l*2/3,o,a+l*2,o),i.lineTo(r,o),i.bezierCurveTo(r-l,o,r-l,s,r,s),i.closePath(),i instanceof Path2D)return i}function I6(e,t){const i=t||new Path2D,{x:a,y:s,width:n,ex:r,ey:o}=e.calculative.worldRect;i.moveTo(a,s),i.lineTo(r,s),i.lineTo(r,o),i.lineTo(a,o),i.closePath();const l=n/7;if(i.moveTo(a,s+l),i.lineTo(r,s+l),i.moveTo(a+l,s),i.lineTo(a+l,o),i instanceof Path2D)return i}function B6(e,t){const i=t||new Path2D,{x:a,y:s,height:n,ex:r,ey:o}=e.calculative.worldRect,l=n/4;if(i.moveTo(a,s+l),i.lineTo(r,s),i.lineTo(r,o),i.lineTo(a,o),i.closePath(),i instanceof Path2D)return i}function D6(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 M6(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 L6(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 O6(e,t){const i=t||new Path2D,{x:a,y:s,width:n,height:r,ex:o,ey:l}=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,l),i.lineTo(o,l),i.closePath(),i instanceof Path2D)return i}function N6(e,t){const i=t||new Path2D,{x:a,y:s,width:n,ex:r,ey:o}=e.calculative.worldRect,l=n/7;if(i.moveTo(a,s),i.lineTo(r,s),i.lineTo(r,o),i.lineTo(a,o),i.closePath(),i.moveTo(a+l,s),i.lineTo(a+l,o),i.moveTo(r-l,s),i.lineTo(r-l,o),i instanceof Path2D)return i}function z6(e,t){const i=t||new Path2D,{x:a,y:s,height:n,ex:r,ey:o}=e.calculative.worldRect,l=n/7;if(i.moveTo(a,s+l),i.bezierCurveTo(a,s-l/2|0,r,s-l/2|0,r,s+l),i.lineTo(r,o-l),i.bezierCurveTo(r,o+l/2|0,a,o+l/2|0,a,o-l),i.closePath(),i.moveTo(a,o-l),i.bezierCurveTo(a,o-l*2|0,r,o-l*2|0,r,o-l),i instanceof Path2D)return i}function xF(){return{flowComment:A6,flowData:C6,flowDb:z6,flowDisplay:R6,flowDocument:P6,flowExternStorage:T6,flowInternalStorage:I6,flowManually:B6,flowParallel:M6,flowQueue:O6,flowSubprocess:N6}}function _F(){return{flowDocument:S6,flowManually:D6,flowParallel:L6,flowComment:k6,flowData:F6}}var vo;(function(e){e[e.Add=0]="Add",e[e.Replace=1]="Replace",e[e.ReplaceAll=2]="ReplaceAll"})(vo||(vo={}));function x0(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 _0(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+=x0(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 Bd(e,t){t.onAdd||(t.onAdd=E0,(!t.rowPos||!t.colPos||!t.calculative.maxOffsetY)&&t.onAdd(t),t.onMouseMove=q6,t.onMouseLeave=Y6,t.onMouseDown=K6,t.onShowInput=$6,t.onInput=j6,t.onValue=Z6,t.onBeforeValue=J6,t.onMouseEnter=aA,t.onWheel=Q6,t.onDestroy=eA),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()}U6(e,t),V6(e,t),W6(e,t),e.restore(),t.isFirstTime=!1}function W6(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.xi.y&&a.yp.col!==void 0&&p.row===void 0&&p.width);let r={};n&&n.forEach(p=>{r[p.col]=p.width});for(let p=0;p_.col===p&&_.row===void 0);x&&(a[p]=x[0])}let o=0;const l=e.styles&&e.styles.filter(p=>p.col===void 0&&p.row!==void 0&&p.height);let h={};l&&l.forEach(p=>{h[p.row]=p.height});let c=o;for(let p=0;pt.calculative.worldRect.height)continue}else if(g<0||g>t.calculative.worldRect.height)continue;e.beginPath(),e.moveTo(t.calculative.worldRect.x,t.calculative.worldRect.y+g),e.lineTo(t.calculative.worldRect.ex,t.calculative.worldRect.y+g),e.strokeStyle=t.borderColor||t.color||"#424B61",e.stroke()}}if(t.vLine!==!1){let d=t.colPos[t.colPos.length-1];t.colPos.forEach((f,g)=>{if(f===d)return;const m=f*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 V6(e,t){var a,s,n,r,o;if(!t.colPos)return;t.calculative.texts||(t.calculative.texts=[]);const i=1;for(let l=0;l0){let D=0;f.forEach((V,G)=>{V.wheres&&V.wheres.every(P=>{var $,Z,at;let T=Te((at=(Z=($=t.calculative)==null?void 0:$.canvas)==null?void 0:Z.store)==null?void 0:at.options,"attr",`return attr ${P.comparison} ${P.value}`);const L=T(d);return T=null,L})&&(D=G)}),f=f[D]}else f.wheres&&Array.isArray(f.wheres)&&(g=!1,g=f.wheres.every(function(D){var F,P,T;let V=Te((T=(P=(F=t.calculative)==null?void 0:F.canvas)==null?void 0:P.store)==null?void 0:T.options,"attr",`return attr ${D.comparison} ${D.value}`);const G=V(d);return V=null,G}));let m=t.color,y=t.textColor||t.color,p=null,x=null,_=null,b=null;g&&(m=f.color||h.color||t.color,y=f.textColor||h.textColor||t.textColor,p=f.background||h.background,x=(f.fontSize||h.fontSize||0)*t.calculative.canvas.store.data.scale,_=f.fontWeight||h.fontWeight,b=f.fontStyle||h.fontStyle);let k;t.stripe&&(t.hasHeader!==!1?l%2===1&&(p=p||t.stripeColor||"#407FFF1F"):l%2===0&&(p=p||t.stripeColor||"#407FFF1F")),t.calculative.active&&((a=t.calculative.activeCell)==null?void 0:a.row)===l&&((s=t.calculative.activeCell)==null?void 0:s.col)===c&&(m=t.activeColor,p=t.activeBackground,k=m,y=t.activeTextColor||t.activeColor),t.calculative.hover&&((n=t.calculative.hoverCell)==null?void 0:n.row)===l&&((r=t.calculative.hoverCell)==null?void 0:r.col)===c&&(m=t.hoverColor,p=t.hoverBackground,y=t.hoverTextColor||t.hoverColor,k=m);const R=F0(t,l,c);if(R.y+R.heightt.calculative.worldRect.height+t.calculative.worldRect.y)continue;p&&(e.save(),e.beginPath(),e.fillStyle=p,e.fillRect(R.x,R.y,R.width+.25*t.calculative.canvas.store.data.scale,R.height),e.restore()),k&&(e.save(),e.beginPath(),e.strokeStyle=k,e.strokeRect(R.x,R.y,R.width,R.height),e.restore()),t.calculative.worldTextRect=R;let S=t.calculative.texts[l];if(t.calculative.texts[l]||(S=[],t.calculative.texts.push(S)),S[c]==null){if(typeof d=="object"){const D=t.styles&&t.styles.filter(V=>V.col===c&&V.row===void 0&&V.pens);if(D.length>0){if(S[c]="",t.isFirstTime){t.maxNum&&t.hasHeader&&l>=t.maxNum&&(d.visible=!1);let V=JSON.parse(JSON.stringify(D[0].pens));V.forEach(G=>{Object.assign(G,{row:l,col:c},d),G.activeBackground=G.background,G.hoverBackground=G.background,G.activeColor=G.color,G.hoverColor=G.color,G.activeTextColor=G.textColor,G.hoverTextColor=G.textColor,G.height*=t.calculative.canvas.store.data.scale,G.width*=t.calculative.canvas.store.data.scale}),G6(t,R,V),t.calculative.canvas.parent.pushChildren(t,V)}continue}}else d===void 0?S[c]="":S[c]=d.text||d+"";if(!S[c])continue;S[c]=Ws(t,S[c])}if(!S[c])continue;e.save(),e.beginPath(),e.fillStyle=y,e.textAlign="center",e.textBaseline="middle",e.font=(b||t.calculative.fontStyle||"")+" normal "+(_||t.calculative.fontWeight||"")+" "+(x||t.calculative.fontSize||12)*i+"px "+t.calculative.fontFamily;let I=t.colStyle&&((o=t.colStyle[c])==null?void 0:o.textAlign);if(I&&(e.textAlign=I),S[c].length===1)I==="left"?e.fillText(S[c][0],R.x,R.y+R.height/2):I==="right"?e.fillText(S[c][0],R.x+R.width,R.y+R.height/2):e.fillText(S[c][0],R.x+R.width/2,R.y+R.height/2);else{const V=(x||t.calculative.fontSize)*t.calculative.lineHeight*i,G=S[c].length*V;let F=(R.height-G)/2;I==="left"?S[c].forEach((P,T)=>{e.fillText(P,R.x,R.y+F+(T+.55)*V)}):I==="right"?S[c].forEach((P,T)=>{e.fillText(P,R.x+R.width,R.y+F+(T+.55)*V)}):S[c].forEach((P,T)=>{e.fillText(P,R.x+R.width/2,R.y+F+(T+.55)*V)})}e.restore()}}}function E0(e){var t;sh(e),(t=e.children)!=null&&t.length||(e.isFirstTime=!0),e.offsetY||(e.offsetY=0),H6(e)}function $6(e,t){if(!e.calculative.hoverCell)return;const{value:i}=k0(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=F0(e,e.calculative.hoverCell.row,e.calculative.hoverCell.col);e.calculative.tempText=i.text||i+"",e.calculative.canvas.showInput(e,a,"#ffffff")}function j6(e,t){!e.calculative.inputCell||(C0(e,e.calculative.inputCell.row,e.calculative.inputCell.col,t),e.calculative.isInput=!1,e.calculative.isHover=!0,e.calculative.canvas.render())}function q6(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=A0(e,t),e.calculative.canvas.render()}function Y6(e,t){sh(e),e.calculative.hoverCell=void 0,e.calculative.canvas.render()}function K6(e,t){e.calculative.activeCell=A0(e,t),e.calculative.canvas.render()}function A0(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;ne.calculative.worldRect.x+e.colPos[n]*i&&(s.col=n+1);for(let n=0;ne.calculative.worldRect.y+e.rowPos[n]*a-e.offsetY*e.calculative.canvas.store.data.scale&&(s.row=n+1);return s}function k0(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 X6(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 C0(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 F0(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 o=0,l=e.rowPos[t]*s;t>0&&(o=e.rowPos[t-1]*s);let h=e.offsetY*e.calculative.canvas.store.data.scale;return t===0&&e.hasHeader&&(h=0),{x:e.calculative.worldRect.x+n,y:e.calculative.worldRect.y+o-h,ex:e.calculative.worldRect.x+r,ey:e.calculative.worldRect.y+l-h,width:r-n,height:l-o}}function G6(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 o=0,l=0,h=0;const c=e.calculative.canvas.store.data.scale;if(i.length>1){for(const d of i)l+d.width*a+20*c*a{d.width=d.width*n,d.height=d.height*r})}function Z6(e){if(e.calculative.isUpdateData){delete e.calculative.isUpdateData;let t=ot(e.children);e.children=[],E0(e),t&&t.forEach(i=>{e.calculative.canvas.delForce(e.calculative.canvas.findOne(i))}),e.calculative.texts=void 0}}function J6(e,t){if(e.calculative.isUpdateData=!1,e.swiper!==void 0&&(e.swiper?sh(e):ah(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===vo.Replace?(s=e.data,t.dataX&&t.dataX.forEach((n,r)=>{s[n]=t.dataY[r]})):a===vo.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),C0(e,t.row,t.col,t.value),e.calculative.canvas.render(),delete t.col,delete t.row),t}function Q6(e,t){if(!e.locked&&!e.calculative.canvas.store.data.locked||!e.maxNum)return;let i=0;t.deltaY>0?i=4:i=-4,Ic(e,i)}function Ic(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];tA(e,s)}),e.calculative.canvas.render()}function tA(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.y1){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=ot(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=ot(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=ot(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 eA(e){ah(e)}function ah(e){e.interval&&(globalThis.clearInterval(e.interval),e.interval=null)}function sh(e){if(e.maxNum&&e.swiper){if(e.interval)return;e.interval=globalThis.setInterval(()=>{e.offsetY>=e.calculative.maxOffsetY?(e.offsetY=0,iA(e)):e.offsetY%e.rowHeight?Ic(e,1):(e.calculative.stap||(e.calculative.stap=0),e.calculative.stap+=1,e.calculative.stap==12&&(e.calculative.stap=0,Ic(e,1)))},50)}}function iA(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 o=ot(e.data[r][s.col]);o.background&&(o.activeBackground=o.background,o.hoverBackground=o.background),o.color&&(o.hoverColor=o.color,o.activeColor=o.color),o.textColor&&(o.activeTextColor=o.textColor,o.hoverTextColor=o.textColor),s.calculative.visible=!0,s.visible=!0,Object.assign(s,o,{row:r}),Object.assign(s.calculative,o,{row:r})}),e.calculative.canvas.render()}function aA(e){ah(e)}function sA(e,t){t.onClick||(t.onClick=nA,t.setTheme=rA);let i=t.calculative.worldRect.x,a=t.calculative.worldRect.y,s=t.calculative.worldRect.width,n=t.calculative.worldRect.height;s2?n/2-2:1,0,Math.PI*2),e.fill()):(e.fillStyle=t.offColor,(t.disabled||t.disable)&&(e.fillStyle=t.disableOffColor||Ce(.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 nA(e){e.disableDefaultClick||e.disabled||e.disable||(e.checked=!e.checked,e.calculative.canvas.store.emitter.emit("valueUpdate",e),e.calculative.canvas.render())}function rA(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 oA(e,t){t.onAdd||(t.onAdd=pn,t.onResize=pn,t.onMove=pn,t.onMouseMove=lA,t.onMouseDown=R0,t.onValue=cA,t.onBeforeValue=hA,t.onMouseUp=fA,t.setTheme=uA),t.calculative.barRect||pn(t);const i=t.calculative.canvas.store;t.calculative.canvas.store.options;let a=t.background;t.disabled&&(a=t.disabledBackground||Ce(.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,o=t.calculative.barRect.height,l=o/2;e.moveTo(s+l,n),e.arcTo(s+r,n,s+r,n+o,l),e.arcTo(s+r,n+o,s,n+o,l),e.arcTo(s,n+o,s,n,l),e.arcTo(s,n,s+r,n,l),e.fill();let h=t.activeColor||i.styles.activeColor;t.disabled&&(h=t.disabledColor||Ce(.6,h)),e.fillStyle=h,e.beginPath(),r=t.calculative.ballRect.x,e.moveTo(s+l,n),e.arcTo(s+r,n,s+r,n+o,l),e.arcTo(s+r,n+o,s,n+o,l),e.arcTo(s,n+o,s,n,l),e.arcTo(s,n,s+r,n,l),e.fill(),e.fillStyle=t.btnBackground||"#fff",e.strokeStyle=h,e.lineWidth=2,e.beginPath();const c=t.calculative.canvas.store.data.scale;s=t.calculative.worldRect.x+t.calculative.ballRect.x+20*c,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 pn(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;e.calculative.worldRect.width/e.sliderWidth;const t=e.calculative.worldRect.height/e.sliderHeight,i=e.calculative.canvas.store.data.scale,a=e.calculative.worldRect.width-3*e.calculative.fontSize;e.calculative.barRect={x:0+20*i,y:(e.calculative.worldRect.height-e.barHeight*t)/2,width:a-20*i,height:e.barHeight*t},re(e.calculative.barRect),nh(e)}function nh(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,Bi(e)}function R0(e,t){if(e.disabled)return;let i=0;const a=e.calculative.canvas.store.data.scale,s=t.x-e.calculative.worldRect.x-20*a;if(s>e.calculative.barRect.width)i=100;else{let n=s/e.calculative.barRect.width*100;if(n<1?i=0:n>99?i=100:i=Math.round(n),ie.max||i<0||i>100)return}e.value=i,nh(e),e.calculative.text=e.value+e.unit,Bi(e),e.calculative.canvas.store.emitter.emit("valueUpdate",e),e.calculative.canvas.render()}function lA(e,t){e.calculative.canvas.mouseDown&&R0(e,t)}function cA(e){e.calculative.isUpdateData&&(delete e.calculative.isUpdateData,pn(e)),nh(e)}function hA(e,t){return e.calculative.isUpdateData=!1,(t.textWidth||t.barHeight)&&(t.textWidth&&(e._textWidth=0),e.calculative.isUpdateData=!0),t}function uA(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 fA(e,t){e.calculative.canvas.store.emitter.emit("change",e)}function dA(e,t){t.onMouseDown||(t.onMouseDown=gA),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:o,fontFamily:l,lineHeight:h}=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||Ce(.6,t.background)||"#ebebeb",e.strokeStyle=t.disabledColor||Ce(.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||Ce(.6,t.textColor||t.color)||"#00000040":zi(t,t.calculative.canvas.parent.store)||"#000000d9",e.textAlign="start",e.textBaseline="middle",e.font=Ie({fontStyle:n,fontWeight:r,fontFamily:l||t.calculative.canvas.parent.store.options.fontFamily,fontSize:o,lineHeight:h}),e.fillText(t.value+"",i+s+10,a+s/2),e.restore()}function gA(e,t){e.isForbidden||(e.checked=!e.checked,e.calculative.canvas.store.emitter.emit("valueUpdate",e),e.calculative.canvas.render())}function vA(e,t){t.options||(t.options=t.data),t.onAdd||(t.onAdd=mA,t.optionPos||(t.onAdd(t),t.calculative.canvas.parent.active([t])),t.onMouseDown=yA,t.onValue=pA,t.onBeforeValue=wA);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:o,fontSize:l,fontFamily:h,lineHeight:c}=t.calculative;if(t.direction=="horizontal")for(let d=0;de.calculative.worldRect.x+e.optionPos[i]*e.calculative.worldRect.width/e.checkboxWidth&&t.xe.calculative.worldRect.y+e.optionPos[a]*i&&t.y{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 CA(e,t){e.onDestroy||(e.onDestroy=RA,e.onAdd=FA);const i=t||new Path2D,{x:a,y:s,width:n,height:r,ex:o}=e.calculative.worldRect;let l=e.calculative.borderRadius||0,h=l;l<1&&(l=n*l,h=r*h);let c=l{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 CF(){return{interfaceClass:EA,simpleClass:CA}}function PA(e){if(!e||typeof e!="object")return e;const t=JSON.parse(JSON.stringify(e)),i=new Set(["text","subtext","name","label","placeholder"]),a=new Set(["type","id","formatter","color","emphasis","itemStyle","lineStyle","areaStyle","textStyle","axisLabel"]);function s(n,r){if(Array.isArray(n))return n.map((o,l)=>s(o,r));if(typeof n=="string")return r&&i.has(r)?ke(n):n;if(typeof n=="function")return n;if(n&&typeof n=="object"){const o={};for(const l in n)if(!!n.hasOwnProperty(l)){if(a.has(l)){o[l]=n[l];continue}o[l]=s(n[l],l)}return o}return n}return s(t)}const Dd={enter:"mouseover",leave:"mouseout"};var _n;(function(e){e[e.Add=0]="Add",e[e.Replace=1]="Replace",e[e.ReplaceAll=2]="ReplaceAll"})(_n||(_n={}));let Bc=["fontSize","lineHeight","nameGap","margin","width","height","symbolSize","itemWidth","itemHeight","fontWeight","top","left","right","bottom","zoom","edgeSymbolSize","nodeWidth","nodeGap","distance","length","length2","offsetCenter","size","symbolOffset","padding","barWidth","symbolOffset","shadowOffsetY","shadowOffsetX","itemGap","pageIconSize","scrollIconSize","pageItemGap","pageTextGap","borderWidth","borderRadius","itemGap","labelWidth","labelHeight","centerX","centerY","radius2","startAngle","endAngle","richWidth","richHeight"];const SA=["formatter","color"];function Ga(e,t,i){var s,n;const a=(n=(s=e.calculative)==null?void 0:s.singleton)==null?void 0:n.echart;if(!a)return!1;if(t==null)return console.warn("[meta2d:echarts] Skip setOption because option is empty.",e),!1;try{return a.setOption(t,i),!0}catch(r){return console.error("[meta2d:echarts] setOption failed.",{penId:e.id,option:t,opts:i,error:r}),!1}}function Ao(e){var n,r,o,l,h;const t=(r=(n=e.calculative)==null?void 0:n.singleton)==null?void 0:r.echart,i=(l=(o=e.calculative)==null?void 0:o.singleton)==null?void 0:l.div;if(!t||!i||!i.isConnected)return!1;const{width:a,height:s}=((h=e.calculative)==null?void 0:h.worldRect)||{};if(!(a>0)||!(s>0))return console.warn("[meta2d:echarts] Skip resize because container size is invalid.",{penId:e.id,width:a,height:s}),!1;try{return t.resize(),!0}catch(c){return console.error("[meta2d:echarts] resize failed.",{penId:e.id,width:a,height:s,error:c}),!1}}function Md(e,t){if(!t)return;const i=t;e.calculative.img=i,e.calculative.imgNaturalWidth=i.width||i.naturalWidth,e.calculative.imgNaturalHeight=i.height||i.naturalHeight}function Dc(e){var t;return(t=e.echarts)!=null&&t.scaleDom?1:e.calculative.canvas.store.data.scale||1}function Ln(e,t){var o,l;if(!t||((o=e.echarts)!=null&&o.scaleDom&&(e.disableTransform=!0),Re(e,t),!((l=e.echarts)!=null&&l.scaleDom)))return;const i=e.calculative.canvas.store.data.scale||1,a=e.calculative.worldRect,s=a.width/i,n=a.height/i;t.style.width=s+"px",t.style.height=n+"px",t.style.transformOrigin="0 0";const r=e.calculative.rotate||0;t.style.transform=r?`scale(${i}) translate(${s/2}px, ${n/2}px) rotate(${r}deg) translate(${-s/2}px, ${-n/2}px)`:`scale(${i})`}function Wr(e){var n,r,o,l,h,c,d,f,g,m;const t=(r=(n=e.calculative)==null?void 0:n.singleton)==null?void 0:r.echart,i=(l=(o=e.calculative)==null?void 0:o.singleton)==null?void 0:l.div;if(!t||!i||((c=(h=e.calculative)==null?void 0:h.singleton)==null?void 0:c.echartsReady)===!1)return;Ln(e,i),Ao(e),(g=(d=t.getZr)==null?void 0:(f=d.call(t)).flush)==null||g.call(f);const a=(m=t.getRenderedCanvas)==null?void 0:m.call(t,{pixelRatio:2});if((a==null?void 0:a.width)&&(a==null?void 0:a.height)){Md(e,a);return}const s=new Image;s.onload=()=>Md(e,s);try{s.src=t.getDataURL({pixelRatio:2})}catch(y){console.error("[meta2d:echarts] getDataURL failed.",{penId:e.id,error:y})}}function TA(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{}Bc=((s=e.calculative.canvas.store.options.diagramOptions.chart)==null?void 0:s.keyWords)||Bc,e.onDestroy||(e.onDestroy=BA,e.onMove=Kr,e.onResize=DA,e.onRotate=Kr,e.onValue=LA,e.onBeforeValue=OA,e.onBinds=zA,e.onMouseEnter=Kr,e.onRenderPenRaw=Wr,e.onScale=MA),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),e.echarts.scaleDom!==!1&&(e.echarts.scaleDom=!0),Ln(e,r),e.calculative.singleton.div=r,e.calculative.singleton.echart=t.init(r,e.echarts.theme),IA(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(o=>{o.text().then(l=>{if(typeof l=="string")try{l=JSON.parse(l)}catch{}if(l.constructor!==Object&&l.constructor!==Array){console.warn("Invalid data:",l);return}t.registerMap(e.echarts.geoName,l),e.calculative.singleton.echartsReady=!0,Ga(e,mo(e.echarts.option,Dc(e),e.calculative.canvas.store.options),!0),Ao(e),setTimeout(()=>Wr(e),300)})}))),e.calculative.singleton.echartsReady&&setTimeout(()=>{if(e.echarts.initJs){const l=Te(e.calculative.canvas.store.options,"myChart","context",`return async function () { ${e.echarts.initJs}}`)(e.calculative.singleton.echart,{meta2d:this,pen:e});l==null||l().then(h=>{if(h&&Ga(e,h,!0)){let d=e.calculative.singleton.echart.getOption();e.echarts.option=d,setTimeout(()=>Wr(e),300)}})}else Ga(e,mo(e.echarts.option,Dc(e),e.calculative.canvas.store.options),!0);setTimeout(()=>Wr(e),300)})}return i}function IA(e){var a;const t=e.calculative.singleton.echart,i=["click","dblclick","mousedown","mousemove","mouseup","mouseover","mouseout","globalout","contextmenu"];(a=e.events)==null||a.forEach(s=>{s.actions&&s.actions.length&&i.includes(Dd[s.name]||s.name)&&t.getZr().on(Dd[s.name]||s.name,n=>{let r=!1;s.conditions&&s.conditions.length?s.conditionType==="and"?r=s.conditions.every(o=>e.calculative.canvas.parent.judgeCondition(e,o.key,o)):s.conditionType==="or"&&(r=s.conditions.some(o=>e.calculative.canvas.parent.judgeCondition(e,o.key,o))):r=!0,r&&s.actions.forEach(o=>{if(o.timeout){let l=setTimeout(()=>{e.calculative.canvas.parent.events[o.action]&&(e.calculative.canvas.parent.events[o.action](e,o,n),clearTimeout(l),l=null)},o.timeout)}else e.calculative.canvas.parent.events[o.action]&&e.calculative.canvas.parent.events[o.action](e,o,n)})})})}function BA(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 Kr(e){e.calculative.singleton.div&&Ln(e,e.calculative.singleton.div)}function DA(e){e.debounceTime?(e.resizeFn||(e.resizeFn=Ld,e.debounceResize=Kc.debounce(e,"resizeFn",e.debounceTime)),e.debounceResize(e)):Ld(e)}function Ld(e){var t;Kr(e),(t=e.calculative.singleton)!=null&&t.echart&&Ao(e)}function MA(e){e.debounceTime?(e.scaleFn||(e.scaleFn=Od,e.debounceScale=Kc.debounce(e,"scaleFn",e.debounceTime)),e.debounceScale(e)):Od(e)}function Od(e){var i,a;if(!e.calculative.singleton.echart)return;let t=globalThis.echarts;if(Ln(e,e.calculative.singleton.div),!e.echarts.scaleDom&&!(e.echarts.geoName&&!t.getMap(e.echarts.geoName))){if(!(e.echarts.diabled||e.echarts.disabled)&&!e.echarts.initJs){if((i=e.echarts.option)!=null&&i.dataZoom){const s=e.calculative.singleton.echart.getOption();if(s!=null&&s.dataZoom){const n=s.dataZoom;(a=e.echarts.option.dataZoom)==null||a.forEach((r,o)=>{n[o]&&(r.start=n[o].start,r.end=n[o].end)})}}Ga(e,mo(e.echarts.option,e.calculative.canvas.store.data.scale,e.calculative.canvas.store.options),!0)}Ao(e)}}function LA(e){var t,i;if(!!e.calculative.singleton.echart&&(Ln(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)?Ga(e,ot(a),{replaceMerge:e.echarts.replaceMerge}):Ga(e,ot(a))}else Ga(e,mo(e.echarts.option,Dc(e),e.calculative.canvas.store.options),!0)}function OA(e,t){var m,y,p;if(e.calculative.partialOption=null,t.echarts){let x=globalThis.echarts;return t.echarts.geoName&&!x.getMap(t.echarts.geoName)&&(t.echarts.geoJson?x.registerMap(t.echarts.geoName,t.echarts.geoJson):t.echarts.geoUrl&&(e.calculative.singleton.echartsReady=!1,fetch(t.echarts.geoUrl).then(_=>{_.text().then(b=>{if(typeof b=="string")try{b=JSON.parse(b)}catch{}if(b.constructor!==Object&&b.constructor!==Array){console.warn("Invalid data:",b);return}return x.registerMap(t.echarts.geoName,b),e.calculative.singleton.echartsReady=!0,e.onValue(e),!1})}))),t}if(e.realTimes&&e.realTimes.length){e.echarts.dataMap&&t.data&&(t=NA(e,t));let x=Object.keys(t);const{xAxis:_,yAxis:b}=e.echarts.option,{max:k,replaceMode:R,timeFormat:S,autoGetTime:I=!0}=e.echarts;let D=[],V=!1,G=e.realTimes.filter(F=>F.bind&&F.bind.class==="iot"&&F.bind.compute_name);if(G.length&&G.find(P=>x.includes(P.key))){let P={},T=[];for(let L in t)L.includes("echarts.option.series")&&(P[L]=Object.fromEntries(t[L]),T.push(...Object.keys(P[L])));T=[...new Set(T)].sort((L,$)=>L-$);for(let L in t)L.includes("echarts.option.series")&&(P[L]=T.map($=>P[L][$]));return(T[0]+"").length===19&&(T=T.map(L=>L/1e6)),T=T.map(L=>{var $,Z,at;return no(S||"`${year}:${month}:${day} ${hours}:${minutes}:${seconds}`",L,(at=(Z=($=e.calculative)==null?void 0:$.canvas)==null?void 0:Z.store)==null?void 0:at.options)}),P["echarts.option.xAxis.data"]=T,P}for(let F in t)if(F.includes("echarts.option")){V=!0,F.includes("series.links.")&&(V=!1);let P=Ne(e,F);if(Array.isArray(P)&&R===_n.Add&&(P.push(t[F]),k&&P.splice(0,P.length-k),t[F]=P,I&&!x.includes("echarts.option.xAxis.data"))){let T="echarts.option.xAxis.data";if(!t[T]){Array.isArray(_)&&_.length&&(T="echarts.option.xAxis.0.data");let L=Ne(e,T),$=no(S||"`${hours}:${minutes}:${seconds}`",void 0,(p=(y=(m=e.calculative)==null?void 0:m.canvas)==null?void 0:y.store)==null?void 0:p.options);L.push($),k&&L.splice(0,L.length-k),t[T]=L}}if(F.includes(".data.")){let T=F.substring(0,F.indexOf(".data.")+5);D.includes(T)||D.push(T)}}if(V){const F=ot(t);e.calculative.partialOption=WA(F,e),D.forEach(P=>{let T=Ne(e,P);so(e.calculative.partialOption,P,T)})}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,o=[];r&&o.push("echarts.option.series");const l=i.option.series,h=l.length,{xAxis:c,yAxis:d}=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 f=Array.isArray(c)?c[0]:c,g=Array.isArray(d)?d[0]:d;if(s)if(s===_n.Replace){if(!f&&!g)r&&(h===1?(!Array.isArray(r)&&(r=[r]),r.forEach((x,_)=>{const b=l[0].data.find(k=>k.name===x.name);b&&(b.value=x.value)})):l.forEach((x,_)=>{Array.isArray(r[_])||(r[_]=[r[_]]),r[_].forEach((b,k)=>{const R=x.data.find(S=>S.name===b.name);R&&(R.value=b.value)})}));else if((f.type==="category"||g.type==="category")&&n&&r){const x=f.type==="category"?f.data:g.data;!Array.isArray(n)&&(n=[n]),!Array.isArray(r)&&(r=[r]),f.type==="category"?o.push("echarts.option.xAxis"):o.push("echarts.option.yAxis"),h===1?r.forEach((_,b)=>{const k=x.indexOf(n[b]);l[0].data[k]=_}):l.forEach((_,b)=>{r[b].forEach((k,R)=>{const S=x.indexOf(n[R]);_.data[S]=k})})}}else s===_n.ReplaceAll&&(n&&(f.data=n,f.data.splice(0,f.data.length-a),o.push("echarts.option.xAxis")),r&&(h===1?(l[0].data=r,l[0].data.splice(0,l[0].data.length-a)):l.forEach((x,_)=>{x.data=r[_],x.data.splice(0,x.data.length-a)})));else{if(n){!Array.isArray(n)&&(n=[n]);const x=f.data;x.push(...n),x.splice(0,x.length-a),o.push("echarts.option.xAxis")}if(r)if(h===1){!Array.isArray(r)&&(r=[r]);const x=l[0].data;x.push(...r),x.splice(0,x.length-a)}else l.forEach((x,_)=>{Array.isArray(r[_])||(r[_]=[r[_]]);const b=x.data;b.push(...r[_]),b.splice(0,b.length-a)})}return e.calculative.partialOption={},o.forEach(x=>{let _=Ne(e,x);so(e.calculative.partialOption,x,_)}),delete t.dataX,delete t.dataY,Object.assign(t,{echarts:i})}function NA(e,t){var i,a,s,n,r;if(!e.echarts.dataMap||!t.data)return t;if(t.data){let o={};if(Array.isArray(t.data))for(const l in e.echarts.dataMap)e.echarts.dataMap.hasOwnProperty(l)&&(((i=e.echarts.timeKeys)==null?void 0:i.length)&&e.echarts.timeKeys.includes(e.echarts.dataMap[l])?o[l]=t.data.map(h=>{var c,d,f;return no(e.echarts.timeFormat,h[e.echarts.dataMap[l]],(f=(d=(c=e.calculative)==null?void 0:c.canvas)==null?void 0:d.store)==null?void 0:f.options)}):o[l]=t.data.map(h=>h[e.echarts.dataMap[l]]));else for(const l in e.echarts.dataMap)e.echarts.dataMap.hasOwnProperty(l)&&(((a=e.echarts.timeKeys)==null?void 0:a.length)&&e.echarts.timeKeys.includes(e.echarts.dataMap[l])?o[l]=no(e.echarts.timeFormat,t.data[e.echarts.dataMap[l]],(r=(n=(s=e.calculative)==null?void 0:s.canvas)==null?void 0:n.store)==null?void 0:r.options):o[l]=t.data[e.echarts.dataMap[l]]);return delete t.data,Object.assign(t,o),t}}function zA(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,o=Array.isArray(n)?n[0]:n,l=a.option.series;if(!r&&!o){const h=[];if(Array.isArray(l)&&l.length===1)return l[0].data.forEach(c=>{const{dataId:d}=i.dataIds.find(f=>f.name===c.name);if(d){const f=t.find(g=>g.dataId===d);f&&h.push({name:c.name,value:f.value})}}),{id:e.id,dataY:h}}else if(r.type==="category"||o.type==="category"){const h=[],c=[],d=r.type==="category"?r.data:o.data;return d==null||d.forEach(f=>{const{dataId:g}=i.dataIds.find(m=>m.name===f);if(g){const m=t.find(y=>y.dataId===g);m&&(c.push(f),h.push(m.value))}}),{id:e.id,dataY:h,dataX:c}}else if(r.type==="time"){const h=[],c=+new Date;let d=!1;if(l.forEach((f,g)=>{const m=[],{dataId:y}=i.dataIds.find(p=>p.name===f.name);if(y){const p=t.find(x=>x.dataId===y);p&&(m.push([c,p.value]),d=!0)}h[g]=m}),d)h.forEach((f,g)=>{if(!f||f.length===0){const m=l[g].data[l[g].data.length-1];h[g]=[[c,m[1]]]}});else return;return{id:e.id,dataY:h.length===1?h[0]:h}}}function mo(e,t,i){const a=ot(e),s=PA(a);if(s.dataZoom){let n=["right","top","width","height","left","bottom"];for(let r=0;r{isNaN(o[n[r]])||(o[n[r]]*=t)})}return Ec(s,Bc,t),Mc(s,SA,i),s}function WA(e,t){const i={};return Object.keys(e).forEach(a=>{const s=a.split(".");let n=i;s.forEach((r,o)=>{const l=!isNaN(parseInt(r));if(o===6){let h=s.slice(0,7).join(".");so(t,a,e[a]);let c=Ne(t,h);n[s[o]]=c}else{if(o>6)return;if(o===s.length-1)l?(Array.isArray(n)||(n=[]),n[parseInt(r)]=e[a]):n[r]=e[a];else if(l){const h=parseInt(r);if(Array.isArray(n)||n[s[o-1]],n[h]||(n[h]={}),Array.isArray(n))for(let c=0;c\s*(\{[\s\S]*\}|[^{}]+)\s*$/;return i.test(t)||a.test(t)}function Mc(e,t,i){if(Array.isArray(e)){const a=[];return e.forEach(s=>{a.push(Mc(s,t,i))}),a}else if(typeof e=="object"){if(e===null)return null;for(const a in e)t.includes(a)?HA(e[a])&&(e[a]=G2(i,e[a])):e[a]=Mc(e[a],t,i);return e}return e}function FF(e){e&&(globalThis.echarts=e),Bg({echarts:TA})}const UA=15;function La(e,t=UA){let i=""+e;return i.indexOf(".")>=0&&(i=Number.parseFloat(i).toFixed(t)),Number.parseFloat(i)}function rc(e){return typeof e=="number"&&Number.isFinite(e)}function VA(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:o}=e;if(!rc(i)||!rc(a)||i0&&(i<0?i=0:a=0);const l=(i-a)/s;let h=Math.floor(Math.log10(l)-1);h=Math.pow(10,h);const c=l/h;let d=t[0]*h,f=-1,g;for(g=0;gc){d=t[g]*h;break}let m=i,y=a;function p(_){if(m=parseInt(""+(i/_+1))*_,y=parseInt(""+(a/_-1))*_,i===0&&(m=0),a===0&&(y=0),n&&m*y<0){const b=Math.max(Math.abs(m),Math.abs(y));m=b,y=-b}}if(p(d),r)return{max:La(m),min:La(y),interval:La(d),splitNumber:Math.round((m-y)/d)};if(!n||m*y>0){let _;t:do{if(_=Math.round((m-y)/d),(g-f)*(_-s)<0){for(;_=t.length-1||g<=0||_===s)break;f=g,_>s?d=t[++g]*h:d=t[--g]*h,p(d)}while(_!==s)}m=La(m),y=La(y);const x=La((m-y)/s);return{max:m,min:y,interval:x,splitNumber:s}}function P0(e,t){var p,x,_,b,k,R,S,I,D,V,G,F,P,T,L,$,Z,at,q,W,j,K,U,tt,st,it,ut,lt;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,o=[];if(t.echarts)for(let ht=0;ht{m=i+(1+l/2)+(l+1)*R,y=a+s-(g[R]-h.min)/(h.max-h.min)*s;let S=i+(1+l/2)+(l+1)*(R+1),I=a+s-(g[R+1]-h.min)/(h.max-h.min)*s,D=i+(1+l/2)+(l+1)*(R-1),V=a+s-(g[R-1]-h.min)/(h.max-h.min)*s,G=i+(1+l/2)+(l+1)*(R+2),F=a+s-(g[R+2]-h.min)/(h.max-h.min)*s;R===0?(D=i+(1+l/2)+(l+1)*R,V=a+s-(g[R]-h.min)/(h.max-h.min)*s):R===g.length-2&&(G=i+(1+l/2)+(l+1)*(R+1),F=a+s-(g[R+1]-h.min)/(h.max-h.min)*s),d.push({x:m,y}),p=m+(S-D)/4,x=y+(I-V)/4,_=S-(G-m)/4,b=I-(F-y)/4,e.bezierCurveTo(p,x,_,b,S,I)})}else for(let p=1;p{e.beginPath(),e.strokeStyle="#fff",e.lineWidth=2*n,e.arc(p.x,p.y,4*n,0,Math.PI*2),e.stroke(),e.fill(),e.closePath()}),e.restore(),d=[]}}function S0(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===zs.Replace?(t.dataX.forEach((o,l)=>{let h=i.indexOf(o);a.forEach((c,d)=>{c[h]=t.dataY[d][l]})}),n=i,r=a):s===zs.ReplaceAll&&(n=t.dataX,r=t.dataY):(n=[...i,...t.dataX],a.forEach((o,l)=>{let h=[...o,...t.dataY[l]];r.push(h)})),delete t.dataX,delete t.dataY,Object.assign(t,{xAxisData:n,data:r})}function qA(e,t){var c,d;t.onBeforeValue||(t.onBeforeValue=YA);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,o=!!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 l=o?t.echarts.option.series:t.data;let h=0;for(let f=0;fI+D.value,0):x=g.reduce((I,D)=>I+D.value,0);const _=m*parseFloat(o?g.radius[0]:t.chartsRadius[f][0])/100,b=m*parseFloat(o?g.radius[1]:t.chartsRadius[f][1])/100;if(_>b)return;let k=0,R=0;e.strokeStyle=o&&((c=g.itemStyle)==null?void 0:c.borderColor)||"#fff",e.lineWidth=(o&&((d=g.itemStyle)==null?void 0:d.borderWidth)||2)*i;const S=o?g.data:g;S.forEach((I,D)=>{var $,Z,at,q,W,j,K,U,tt,st,it,ut,lt;R+=Math.PI*2*I.value/x,e.beginPath();let V=h+D;V>=t.chartsColor.length&&(V=V%t.chartsColor.length),e.fillStyle=o?t.echarts.option.color[V]:t.chartsColor[V],e.moveTo(y+_*Math.sin(R),p-_*Math.cos(R)),e.arc(y,p,_,-Math.PI/2+R,-Math.PI/2+k,!0),e.lineTo(y+b*Math.sin(k),p-b*Math.cos(k)),e.arc(y,p,b,-Math.PI/2+k,-Math.PI/2+R),e.lineTo(y+_*Math.sin(R),p-_*Math.cos(R)),e.stroke(),e.fill(),e.closePath();let G=(k+R)/2,F=y+(b+10*i)*Math.sin(G),P=p-(b+10*i)*Math.cos(G),T=e.fillStyle;g.label||(g.label={position:"outside",show:!0}),o&&["inner","inside"].includes(g.label.position)?(e.fillStyle="#ffffff",F=y+(b-_)/2*Math.sin(G),P=p-(b-_)/2*Math.cos(G)):o&&g.label.position=="outside",g.labelLine||(g.labelLine={show:!0}),(o&&g.labelLine.show!==!1||!o)&&(e.beginPath(),e.strokeStyle=o?t.echarts.option.color[h+D]:t.chartsColor[h+D],e.moveTo(y+b*Math.sin(G),p-b*Math.cos(G)),e.lineTo(F,P));let L={fontStyle:(($=t.tickLabel)==null?void 0:$.fontStyle)||t.calculative.fontStyle,fontWeight:((Z=t.tickLabel)==null?void 0:Z.fontWeight)||t.calculative.fontWeight,fontFamily:((at=t.tickLabel)==null?void 0:at.fontFamily)||t.calculative.fontFamily,lineHeight:((q=t.tickLabel)==null?void 0:q.lineHeight)||t.calculative.lineHeight,fontSize:(((W=t.tickLabel)==null?void 0:W.fontSize)||t.calculative.fontSize)*i};e.font=Ie(L),e.textBaseline="middle",e.textAlign="center",G>Math.PI?((o&&g.label.position==="outside"||!o)&&(e.textAlign="end"),(o&&g.labelLine.show!==!1||!o&&((U=(K=(j=t.tickLabel)==null?void 0:j.labelLine)==null?void 0:K.show)!=null?U:!0))&&e.lineTo(F-5*i,P),(o&&g.label.show!==!1||!o&&((st=(tt=t.tickLabel)==null?void 0:tt.show)!=null?st:!0))&&e.fillText(I.name,F-5*i,P)):((o&&g.label.position==="outside"||!o)&&(e.textAlign="start"),(o&&g.labelLine.show!==!1||!o)&&e.lineTo(F+5*i,P),(o&&g.label.show!==!1||!o&&((ut=(it=t.tickLabel)==null?void 0:it.show)!=null?ut:!0))&&e.fillText(I.name,F+5*i,P)),e.stroke(),e.closePath(),e.fillStyle=T,e.strokeStyle=o&&((lt=g.itemStyle)==null?void 0:lt.borderColor)||"#fff",k=R}),h+=S.length}}function YA(e,t){if(t.data||!t.dataX&&!t.dataY)return t;const i=e.data,a=e.replaceMode;let s=[];return a?a===zs.Replace?(t.dataY.forEach((n,r)=>{n.forEach((o,l)=>{let h=i[r].filter(c=>c.name===o.name);h.length>0&&(h[0].value=o.value)})}),s=i):a===zs.ReplaceAll&&(s=t.dataY):i.forEach((n,r)=>{let o=[...n,...t.dataY[r]];s.push(o)}),delete t.dataX,delete t.dataY,Object.assign(t,{data:s})}function KA(e,t){t.onBeforeValue||(t.onBeforeValue=S0);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 d=0;dn?n/2*9/10:s/2*9/10,h=i+s/2,c=a+n/2,d=t.echarts?t.echarts.option.series[0].data[0].value:t.value,f,g=t.startAngle-t.endAngle,m=t.background||"#E6EBF8";e.strokeStyle=m;let y=l/10;e.lineWidth=y,e.beginPath(),e.lineCap="round",e.arc(h,c,l,-t.startAngle/180*Math.PI,-t.endAngle/180*Math.PI),e.stroke(),e.closePath();let p=0;if(t.axisLine&&!t.isClock)for(let N=t.axisLine.length-1;N>=0;N--)t.axisLine[N][0]*(t.max-t.min).02?e.textAlign="end":J<-.02?e.textAlign="start":e.textAlign="center",rt>.02?e.textBaseline="top":rt<-.02?e.textBaseline="bottom":e.textBaseline="middle",e.fillText($A(P*N+t.min,1),h+L*J,c-L*rt),e.fill()}e.closePath();let $=1,Z=["value"];if(t.isClock&&($=3,Z=["hourvalue","minutevalue","secondvalue"]),t.isClock)for(let N=0;N<$;N++){let X=(t.startAngle-(t[Z[N]]-t.min)/(t.max-t.min)*g)/180*Math.PI;N>0&&(X=(t.startAngle-(t[Z[N]]-t.min)/(t.max*5-t.min)*g)/180*Math.PI);let J=4/5*l;Z[N]==="hourvalue"&&(J=3/5*l),Z[N]==="minutevalue"&&(J=3.5/5*l);let rt=l*1/40;e.beginPath(),e.setLineDash([]),e.lineWidth=l/(N+1)/20,e.strokeStyle=t.color||"#999999",e.moveTo(h-rt*3*Math.cos(X),c+rt*3*Math.sin(X)),e.lineTo(h+J*Math.cos(X),c-J*Math.sin(X)),e.stroke()}else{let N=(t.startAngle-(d-t.min)/(t.max-t.min)*g)/180*Math.PI,X=4/5*l,J=l*1/40;e.beginPath(),e.setLineDash([]),e.lineWidth=2,e.fillStyle=f,e.moveTo(h-J*3*Math.cos(N),c+J*3*Math.sin(N)),e.lineTo(h+J*Math.cos(N-Math.PI/2),c-J*Math.sin(N-Math.PI/2)),e.lineTo(h+X*Math.cos(N),c-X*Math.sin(N)),e.lineTo(h+J*Math.cos(N+Math.PI/2),c-J*Math.sin(N+Math.PI/2)),e.lineTo(h-J*3*Math.cos(N),c+J*3*Math.sin(N)),e.fill()}e.beginPath(),e.textAlign="center",e.textBaseline="middle";let at={fontStyle:((it=t.titleLabel)==null?void 0:it.fontStyle)||t.calculative.fontStyle,textDecoration:((ut=t.titleLabel)==null?void 0:ut.textDecoration)||t.textDecoration,fontWeight:((lt=t.titleLabel)==null?void 0:lt.fontWeight)||t.calculative.fontWeight,fontFamily:((ht=t.titleLabel)==null?void 0:ht.fontFamily)||t.calculative.fontFamily,fontSize:(((E=t.titleLabel)==null?void 0:E.fontSize)||t.calculative.fontSize)*r,lineHeight:((A=t.titleLabel)==null?void 0:A.lineHeight)||t.calculative.lineHeight};e.font=Ie(at),e.fillStyle=((B=t.titleLabel)==null?void 0:B.color)||f,t.isClock?e.fillText(("0"+parseInt(t.hourvalue)).slice(-2)+":"+("0"+parseInt(t.minutevalue)).slice(-2)+":"+("0"+parseInt(t.secondvalue)).slice(-2),h,c+l/2):e.fillText(d+" "+(t.unit||""),h,c+l/2),e.fill(),t.isClock&&(e.beginPath(),e.fillStyle=t.color||"#999999",e.strokeStyle="#ffffff",e.arc(h,c,l/20,0,Math.PI*2),e.stroke(),e.fill(),e.closePath())}function GA(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 ZA(e){e.clockInterval&&(clearInterval(e.clockInterval),e.clockInterval=void 0)}function JA(e){e.isClock&&(e.onDestroy(e),e.onAdd(e))}function QA(e,t){if(t.onBeforeValue||(t.onBeforeValue=tk),t.calculative.update===void 0&&(t.calculative.update=!0),t.calculative.update){const i=ek(t);i&&(t.calculative.img||(t.calculative.img=new Image),t.calculative.img.src=i),t.calculative.update=!1}if(t.calculative.img){const{x:i,y:a,width:s,height:n}=t.calculative.worldRect;e.drawImage(t.calculative.img,i,a,s,n)}}function tk(e,t){return(t.data||t.min||t.max||t.chartsColor)&&(e.calculative.update=!0),t}function ek(e){var p,x;const{width:t,height:i}=e.calculative.worldRect,a=e.data,s=(a==null?void 0:a.length)||0,n=s>0?a[0].length:0,r=document.createElement("canvas");r.style.width=`${t}px`,r.style.height=`${i}px`,r.width=t,r.height=i;const o=r.width,l=r.height,h=r.getContext("2d");(x=(p=e.calculative)==null?void 0:p.canvas)==null||x.getPenRect(e);const c=(n-1)/o,d=(s-1)/l;if(s===0||n===0){console.warn("\u65E0\u6548\u6570\u636E\u7EF4\u5EA6");return}const f=h.createImageData(o,l),g=f.data,m=ik(a,s,n),y=sk(e.min,e.max,e.chartsColor);for(let _=0;_Array(n).fill(0));for(let o=0;o=h.pos)return h.rgb;const c=(r-l.pos)/(h.pos-l.pos),d=Math.round(l.rgb.r+(h.rgb.r-l.rgb.r)*c),f=Math.round(l.rgb.g+(h.rgb.g-l.rgb.g)*c),g=Math.round(l.rgb.b+(h.rgb.b-l.rgb.b)*c);return{r:d,g:f,b:g}}}function nk(e){const t=document.createElement("div");t.style.color=e,t.style.display="none",document.body.appendChild(t);const i=window.getComputedStyle(t).color;document.body.removeChild(t);const a=i.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/);if(!a)throw new Error(`\u65E0\u6CD5\u89E3\u6790\u989C\u8272: ${e}`);return{r:parseInt(a[1]),g:parseInt(a[2]),b:parseInt(a[3])}}function RF(){return{lineChart:jA,histogram:KA,pieChart:qA,gauge:XA,heatmap:QA}}function rk(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 ok(e,t){var f;const i=(f=t.headHeight)!=null?f:50,{x:a,y:s,width:n,height:r,ey:o}=t.calculative.worldRect;let l=t.calculative.borderRadius||0,h=l;t.calculative.borderRadius<1&&(l*=n,h*=r);let c=l({id:`${s}`,penId:e.id,x:i,y:a}))}function ck(e,t){const i=t||new Path2D,{x:a,y:s,width:n,height:r}=e.calculative.worldRect,o=r-n,l=.5*n;if(i.moveTo(a+n/2,s),i.lineTo(a+n/2,s+o),i.moveTo(a+n,s+l+o),i.arc(a+n/2,s+l+o,l,0,Math.PI*2,!1),i.closePath(),i instanceof Path2D)return i}function Wd(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 hk(e,t){const i=t||new Path2D,{x:a,y:s,width:n,height:r}=e.calculative.worldRect,o=r/2,l=n/5;if(i.moveTo(a,s+o),i.lineTo(a+l,s+o),i.moveTo(a+l*5,s+o),i.ellipse(a+l*3,s+o,2*l,o,0,0,Math.PI*2),i.closePath(),i instanceof Path2D)return i}function uk(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 fk(e,t){const i=t||new Path2D,{x:a,y:s,width:n,height:r}=e.calculative.worldRect,o=r/4,l=.5*n;if(i.moveTo(a+l,s),i.lineTo(a+l,s+o),i.moveTo(a,s+o),i.rect(a,s+o,l*2,o*2),i.moveTo(a+l,s+3*o),i.lineTo(a+l,s+4*o),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,o=r/8,l=.25*n;if(i.moveTo(a+l*2,s),i.lineTo(a+l*2,s+o*2),i.lineTo(a+l*3,s+o*3),i.lineTo(a+l*3,s+o*5),i.lineTo(a+l*2,s+o*6),i.lineTo(a+l*1,s+o*5),i.lineTo(a+l*1,s+o*3),i.lineTo(a+l*2,s+o*2),i.moveTo(a+l*3,s+o*4),i.lineTo(a+l*4,s+o*4),i.moveTo(a+l*2,s+o*6),i.lineTo(a+l*2,s+o*8),i.closePath(),i instanceof Path2D)return i}function gk(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 vk(e,t){const i=t||new Path2D,{x:a,y:s,width:n,height:r}=e.calculative.worldRect,o=n/2,l=r/10;if(i.moveTo(a+o,s),i.lineTo(a+o,s+l),i.moveTo(a+o,s+l),i.quadraticCurveTo(a+o*2,s+l,a+o*2,s+l*9),i.moveTo(a+o,s+l),i.quadraticCurveTo(a,s+l,a,s+l*9),i.quadraticCurveTo(a+o,s+l*6,a+o*2,s+l*9),i.moveTo(a+o,s+r*3/4),i.lineTo(a+o,s+r),i.moveTo(a+o*2/5,s+r*201/250),i.lineTo(a+o*2/5,s+r),i.moveTo(a+o*8/5,s+r*201/250),i.lineTo(a+o*8/5,s+r),i.closePath(),i instanceof Path2D)return i}function Hd(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 mk(e,t){const i=t||new Path2D,{x:a,y:s,width:n,height:r}=e.calculative.worldRect,o=r/6,l=n/4;if(i.moveTo(a+l*2,s+0),i.lineTo(a+l*2,s+o),i.moveTo(a,s+o+l*2),i.arc(a+l*2,s+o+l*2,l*2,Math.PI*1,Math.PI*2,!1),i.lineTo(a+l*4,s+o*5),i.lineTo(a,s+o*5),i.lineTo(a,s+o+l*2),i.moveTo(a,s+o*5-o/3),i.lineTo(a+l*4,s+o*5-o/3),i.moveTo(a+l,s+o*5),i.lineTo(a+l,s+o*6),i.moveTo(a+l*2,s+o*5),i.lineTo(a+l*2,s+o*6),i.moveTo(a+l*3,s+o*5),i.lineTo(a+l*3,s+o*6),i.closePath(),i instanceof Path2D)return i}function yk(e,t){const i=t||new Path2D,{x:a,y:s,width:n,height:r}=e.calculative.worldRect,o=r/4,l=.5*n;if(i.moveTo(a+l,s),i.lineTo(a+l,s+o),i.lineTo(a+l*2,s+o*2),i.lineTo(a+l*2,s+o*4),i.lineTo(a,s+o*4),i.lineTo(a,s+o*2),i.lineTo(a+l,s+o),i.closePath(),i instanceof Path2D)return i}function pk(e,t){const i=t||new Path2D,{x:a,y:s,width:n,height:r}=e.calculative.worldRect,o=r/4,l=n/2;if(i.moveTo(a+l,s),i.lineTo(a+l,s+o),i.lineTo(a+l*2,s+o*4),i.lineTo(a,s+o*4),i.lineTo(a+l,s+o),i.closePath(),i instanceof Path2D)return i}function wk(e,t){const i=t||new Path2D,{x:a,y:s,width:n,height:r}=e.calculative.worldRect,o=r/3,l=.5*n;if(i.moveTo(a+l,s),i.lineTo(a+l,s+o),i.lineTo(a+n,s+2*o),i.lineTo(a+l,s+r),i.lineTo(a,s+2*o),i.lineTo(a+l,s+o),i.closePath(),i instanceof Path2D)return i}function bk(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 xk(e,t){const i=t||new Path2D,{x:a,y:s,width:n,height:r}=e.calculative.worldRect;let o=n/2,l=r/10;if(i.moveTo(a+o,s),i.lineTo(a+o,s+l),i.moveTo(a+o,s+l),i.quadraticCurveTo(a+o*2,s+l,a+o*2,s+l*9),i.moveTo(a+o,s+l),i.quadraticCurveTo(a,s+l,a,s+l*9),i.quadraticCurveTo(a+o,s+l*6,a+o*2,s+l*9),i.moveTo(a,s+l*10),i.quadraticCurveTo(a+o,s+l*7,a+o*2,s+l*10),i.moveTo(a+o*2/5,s+r*201/250+l),i.lineTo(a+o*2/5,s+r),i.moveTo(a+o*8/5,s+r*201/250+l),i.lineTo(a+o*8/5,s+r),i.closePath(),i instanceof Path2D)return i}function _k(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 Ek(e,t){const{x:i,y:a,width:s,height:n}=t.calculative.worldRect,r=s/2,o=n/10;e.beginPath(),e.moveTo(i+r,a),e.lineTo(i+r,a+o),e.moveTo(i+r,a+o),e.quadraticCurveTo(i+r*2,a+o,i+r*2,a+o*9),e.moveTo(i+r,a+o),e.quadraticCurveTo(i,a+o,i,a+o*9),e.quadraticCurveTo(i+r,a+o*6,i+r*2,a+o*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 l=r*2>o*10?o:r/5;e.fillStyle="#333333",e.font=l+"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 TF(){return{andGate:lk,basicEvent:ck,conditionalEvent:hk,event:fk,forbiddenGate:dk,orGate:vk,priorityAndGate:mk,switchEvent:yk,transferSymbol:pk,unexpandedEvent:wk,xorGate:xk}}function IF(){return{votingGate:Ek}}function BF(){return{andGate:zd,orGate:Hd,priorityAndGate:zd,votingGate:Hd,xorGate:_k,forbiddenGate:gk,basicEvent:Wd,unexpandedEvent:bk,conditionalEvent:uk,transferSymbol:Wd}}const DF={background:"#ECE5E5",color:"#fff",textColor:"#fff",anchorColor:"#f90",gridSize:30,grid:!1,gridColor:"rgba(255,255,255,0.1)",drawingLineName:"line"},MF=[{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"}],LF=["triangle","diamond","circle","lineDown","lineUp","triangleSolid","diamondSolid","circleSolid","line"],OF=["#000","#fff","#f00","#0f0","rgba(255,255,255,0.5)"],T0={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"}}]},I0={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"}}]},B0={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"}}]},Ak={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"}}]},kk={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"}}]},Ck={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"}}]},Fk={name:"\u56FD\u5BB6\u7535\u7F51",show:!0,list:[{name:"\u907F\u96F7\u5668",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u907F\u96F7\u5668.svg"}},{name:"\u907F\u96F7\u9488",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u907F\u96F7\u9488.svg"}},{name:"\u6D4B\u91CF\u8868\u8BA1",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u6D4B\u91CF\u8868\u8BA1.svg"}},{name:"\u5145\u7535\u673A",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u5145\u7535\u673A.svg"}},{name:"\u51FA\u7EBF",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u51FA\u7EBF.svg"}},{name:"\u7A7F\u5899\u5957\u7BA1",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u7A7F\u5899\u5957\u7BA1.svg"}},{name:"\u5E26\u7535\u663E\u793A\u5668",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u5E26\u7535\u663E\u793A\u5668.svg"}},{name:"\u7535\u52A8\u673A",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u7535\u52A8\u673A.svg"}},{name:"\u7535\u6297\u5668",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u7535\u6297\u5668.svg"}},{name:"\u7535\u7F06\u7EBF\u8DEF",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u7535\u7F06\u7EBF\u8DEF.svg"}},{name:"\u7535\u7F06\u7EC8\u7AEF",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u7535\u7F06\u7EC8\u7AEF.svg"}},{name:"\u7535\u6D41\u4E92\u611F\u5668",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u7535\u6D41\u4E92\u611F\u5668.svg"}},{name:"\u7535\u80FD\u8868",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u7535\u80FD\u8868.svg"}},{name:"\u7535\u5BB9\u5668",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u7535\u5BB9\u5668.svg"}},{name:"\u7535\u538B\u4E92\u611F\u5668-\u5E26\u7194\u65AD\u5668",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u7535\u538B\u4E92\u611F\u5668-\u5E26\u7194\u65AD\u5668.svg"}},{name:"\u7535\u538B\u4E92\u611F\u5668",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u7535\u538B\u4E92\u611F\u5668.svg"}},{name:"\u7535\u963B\u63A5\u5730",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u7535\u963B\u63A5\u5730.svg"}},{name:"\u8DCC\u843D\u5F0F\u7194\u65AD\u5668",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u8DCC\u843D\u5F0F\u7194\u65AD\u5668.svg"}},{name:"\u65AD\u8DEF\u5668-\u5206",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u65AD\u8DEF\u5668-\u5206.svg"}},{name:"\u65AD\u8DEF\u5668-\u5408",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u65AD\u8DEF\u5668-\u5408.svg"}},{name:"\u65AD\u8DEF\u5668\u624B\u8F66",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u65AD\u8DEF\u5668\u624B\u8F66.svg"}},{name:"\u53D1\u7535\u673A",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u53D1\u7535\u673A.svg"}},{name:"\u98CE\u529B\u53D1\u7535\u673A",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u98CE\u529B\u53D1\u7535\u673A.svg"}},{name:"\u8D1F\u8377\u5F00\u5173",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u8D1F\u8377\u5F00\u5173.svg"}},{name:"\u9694\u79BB\u5F00\u5173-\u5E26\u63A5\u5730",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u9694\u79BB\u5F00\u5173-\u5E26\u63A5\u5730.svg"}},{name:"\u9694\u79BB\u5F00\u5173-\u5206",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u9694\u79BB\u5F00\u5173-\u5206.svg"}},{name:"\u9694\u79BB\u5F00\u5173-\u5408",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u9694\u79BB\u5F00\u5173-\u5408.svg"}},{name:"\u5149\u4F0F\u9006\u53D8\u5668",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u5149\u4F0F\u9006\u53D8\u5668.svg"}},{name:"\u5149\u4F0F\u7EC4\u4EF6",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u5149\u4F0F\u7EC4\u4EF6.svg"}},{name:"\u73AF\u7F51\u67DC",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u73AF\u7F51\u67DC.svg"}},{name:"\u6362\u6D41\u53D8\u538B\u5668",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u6362\u6D41\u53D8\u538B\u5668.svg"}},{name:"\u6362\u6D41\u9600",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u6362\u6D41\u9600.svg"}},{name:"\u4EA4\u6D41\u6EE4\u6CE2\u5668",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u4EA4\u6D41\u6EE4\u6CE2\u5668.svg"}},{name:"\u63A5\u5730",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u63A5\u5730.svg"}},{name:"\u63A5\u5730\u53D8\u538B\u5668",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u63A5\u5730\u53D8\u538B\u5668.svg"}},{name:"\u63A5\u5730\u5F00\u5173",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u63A5\u5730\u5F00\u5173.svg"}},{name:"\u9759\u6B62\u65E0\u529F\u8865\u507FSVG",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u9759\u6B62\u65E0\u529F\u8865\u507FSVG.svg"}},{name:"\u8FDE\u63A5\u8282\u70B9",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u8FDE\u63A5\u8282\u70B9.svg"}},{name:"\u96F6\u5E8F\u7535\u6D41\u4E92\u611F\u5668",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u96F6\u5E8F\u7535\u6D41\u4E92\u611F\u5668.svg"}},{name:"\u6BCD\u7EBF",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u6BCD\u7EBF.svg"}},{name:"\u8026\u5408\u7535\u5BB9\u5668",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u8026\u5408\u7535\u5BB9\u5668.svg"}},{name:"\u5E73\u6CE2\u7535\u6297\u5668",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u5E73\u6CE2\u7535\u6297\u5668.svg"}},{name:"\u7194\u65AD\u5668",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u7194\u65AD\u5668.svg"}},{name:"\u4E09\u7ED5\u7EC4\u53D8\u538B\u5668",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u4E09\u7ED5\u7EC4\u53D8\u538B\u5668.svg"}},{name:"\u624B\u8F66\u89E6\u5934",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u624B\u8F66\u89E6\u5934.svg"}},{name:"\u53CC\u7ED5\u7EC4\u53D8\u538B\u5668",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u53CC\u7ED5\u7EC4\u53D8\u538B\u5668.svg"}},{name:"\u7BB1\u5F0F\u53D8\u7535\u7AD9",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u7BB1\u5F0F\u53D8\u7535\u7AD9.svg"}},{name:"\u6D88\u5F27\u7EBF\u5708",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u6D88\u5F27\u7EBF\u5708.svg"}},{name:"\u84C4\u7535\u6C60",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u84C4\u7535\u6C60.svg"}},{name:"\u7AD9\u7528\u53D8\u538B\u5668",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u7AD9\u7528\u53D8\u538B\u5668.svg"}},{name:"\u76F4\u6D41\u65AD\u8DEF\u5668",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u76F4\u6D41\u65AD\u8DEF\u5668.svg"}},{name:"\u81EA\u8026\u53D8\u538B\u5668",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u81EA\u8026\u53D8\u538B\u5668.svg"}},{name:"\u963B\u6CE2\u5668",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u963B\u6CE2\u5668.svg"}},{name:"GIS\u7EC4\u5408\u7535\u5668",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/GIS\u7EC4\u5408\u7535\u5668.svg"}},{name:"SVC\u9759\u6B62\u65E0\u529F\u8865\u507F",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/SVC\u9759\u6B62\u65E0\u529F\u8865\u507F.svg"}},{name:"UPS\u7535\u6E90",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/UPS\u7535\u6E90.svg"}}]},NF=["time-comp"],rh=window.allEnv.topo.showAllMenu||!1;T0.show=rh;I0.show=rh;B0.show=rh;const zF=[{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}
{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"}}]},{...Ak},{...kk},{...Ck},{...Fk},{...T0},{...I0},{...B0},{name:"\u7535\u529B\u7CFB\u7EDF-1",show:!0,list:[{font_family:"sg-ele",my_class:"uniE00A",unicode:"e900"},{font_family:"sg-ele",my_class:"uniE04D",unicode:"e97e"},{font_family:"sg-ele",my_class:"uniE04E",unicode:"e97f"},{font_family:"sg-ele",my_class:"uniE005",unicode:"e981"},{font_family:"sg-ele",my_class:"uniE007",unicode:"e98f"},{font_family:"sg-ele",my_class:"uniE006",unicode:"e988"},{font_family:"sg-ele",my_class:"uniE008",unicode:"e996"},{font_family:"sg-ele",my_class:"uniE009",unicode:"e99d"},{font_family:"sg-ele",my_class:"uniE012",unicode:"e9b2"},{font_family:"sg-ele",my_class:"uniE082",unicode:"ea09"},{font_family:"sg-ele",my_class:"uniE088",unicode:"ea0f"},{font_family:"sg-ele",my_class:"uniE090",unicode:"ea11"},{font_family:"sg-ele",my_class:"uniE107",unicode:"ea22"},{font_family:"sg-ele",my_class:"uniE152",unicode:"ea4f"},{font_family:"sg-ele",my_class:"uniE080",unicode:"ea07"},{font_family:"sg-ele",my_class:"uniE084",unicode:"ea0b"},{font_family:"sg-ele",my_class:"uniE059",unicode:"e9f2"},{font_family:"sg-ele",my_class:"uniE10C",unicode:"e9a7"},{font_family:"sg-ele",my_class:"uniE0A0",unicode:"e901"}]},{name:"\u7535\u529B\u7CFB\u7EDF-2",show:!0,list:[{font_family:"sg-ele",my_class:"uniE09E",unicode:"e9a2"},{font_family:"sg-ele",my_class:"uniE010",unicode:"e9a4"},{font_family:"sg-ele",my_class:"uniE014",unicode:"e9bf"},{font_family:"sg-ele",my_class:"uniE040",unicode:"e9df"},{font_family:"sg-ele",my_class:"uniE041",unicode:"e9e0"},{font_family:"sg-ele",my_class:"uniE042",unicode:"e9e1"},{font_family:"sg-ele",my_class:"uniE043",unicode:"e9e2"},{font_family:"sg-ele",my_class:"uniE044",unicode:"e9e3"},{font_family:"sg-ele",my_class:"uniE062",unicode:"e9f5"},{font_family:"sg-ele",my_class:"uniE110",unicode:"ea25"},{font_family:"sg-ele",my_class:"uniE095",unicode:"ea16"},{font_family:"sg-ele",my_class:"uniE0FC",unicode:"e961"},{font_family:"sg-ele",my_class:"uniE02B",unicode:"e96e"},{font_family:"sg-ele",my_class:"uniE06C",unicode:"e98b"},{font_family:"sg-ele",my_class:"uniE0A1",unicode:"e902"},{font_family:"sg-ele",my_class:"uniE0ED",unicode:"e951"},{font_family:"sg-ele",my_class:"uniE00E",unicode:"e943"},{font_family:"sg-ele",my_class:"uniE0DB",unicode:"e93e"},{font_family:"sg-ele",my_class:"uniE0F0",unicode:"e955"},{font_family:"sg-ele",my_class:"uniE0EC",unicode:"e950"},{font_family:"sg-ele",my_class:"uniE0EE",unicode:"e952"},{font_family:"sg-ele",my_class:"uniE00B",unicode:"e911"},{font_family:"sg-ele",my_class:"uniE018",unicode:"e9c9"},{font_family:"sg-ele",my_class:"uniE103",unicode:"ea1e"},{font_family:"sg-ele",my_class:"uniE094",unicode:"ea15"},{font_family:"sg-ele",my_class:"uniE073",unicode:"ea00"}]},{name:"\u7535\u529B\u7CFB\u7EDF-3",show:!0,list:[{font_family:"sg-ele",my_class:"uniE0E4",unicode:"e948"},{font_family:"sg-ele",my_class:"uniE00F",unicode:"e954"},{font_family:"sg-ele",my_class:"uniE05A",unicode:"e982"},{font_family:"sg-ele",my_class:"uniE0AC",unicode:"e90d"},{font_family:"sg-ele",my_class:"uniE0AD",unicode:"e90e"},{font_family:"sg-ele",my_class:"uniE08F",unicode:"e99c"},{font_family:"sg-ele",my_class:"uniE02D",unicode:"e970"},{font_family:"sg-ele",my_class:"uniE09A",unicode:"e99e"},{font_family:"sg-ele",my_class:"uniE00D",unicode:"e932"},{font_family:"sg-ele",my_class:"uniE0C5",unicode:"e928"},{font_family:"sg-ele",my_class:"uniE10B",unicode:"e9a6"},{font_family:"sg-ele",my_class:"uniE00C",unicode:"e922"},{font_family:"sg-ele",my_class:"uniE0F5",unicode:"e95a"},{font_family:"sg-ele",my_class:"uniE01D",unicode:"e969"},{font_family:"sg-ele",my_class:"uniE02C",unicode:"e96f"},{font_family:"sg-ele",my_class:"uniE002",unicode:"e96c"},{font_family:"sg-ele",my_class:"uniE019",unicode:"e9ca"},{font_family:"sg-ele",my_class:"uniE020",unicode:"e9cb"},{font_family:"sg-ele",my_class:"uniE021",unicode:"e9cc"},{font_family:"sg-ele",my_class:"uniE022",unicode:"e9cd"},{font_family:"sg-ele",my_class:"uniE102",unicode:"ea1d"},{font_family:"sg-ele",my_class:"uniE023",unicode:"e9ce"},{font_family:"sg-ele",my_class:"uniE024",unicode:"e9cf"},{font_family:"sg-ele",my_class:"uniE025",unicode:"e9d0"},{font_family:"sg-ele",my_class:"uniE015",unicode:"e9c6"},{font_family:"sg-ele",my_class:"uniE0CB",unicode:"e92d"},{font_family:"sg-ele",my_class:"uniE0E2",unicode:"e946"},{font_family:"sg-ele",my_class:"uniE091",unicode:"ea12"},{font_family:"sg-ele",my_class:"uniE096",unicode:"ea17"}]},{name:"\u7535\u529B\u7CFB\u7EDF-4",show:!0,list:[{font_family:"sg-ele",my_class:"uniE0A2",unicode:"e903"},{font_family:"sg-ele",my_class:"uniE0A3",unicode:"e904"},{font_family:"sg-ele",my_class:"uniE0A6",unicode:"e907"},{font_family:"sg-ele",my_class:"uniE0A8",unicode:"e909"},{font_family:"sg-ele",my_class:"uniE0AE",unicode:"e90f"},{font_family:"sg-ele",my_class:"uniE0C7",unicode:"e929"},{font_family:"sg-ele",my_class:"uniE0C8",unicode:"e92a"},{font_family:"sg-ele",my_class:"uniE0EB",unicode:"e94f"},{font_family:"sg-ele",my_class:"uniE03E",unicode:"e978"},{font_family:"sg-ele",my_class:"uniE05F",unicode:"e987"},{font_family:"sg-ele",my_class:"uniE08A",unicode:"e997"},{font_family:"sg-ele",my_class:"uniE0BC",unicode:"e91e"},{font_family:"sg-ele",my_class:"uniE071",unicode:"e9fe"},{font_family:"sg-ele",my_class:"uniE111",unicode:"ea26"},{font_family:"sg-ele",my_class:"uniE112",unicode:"ea27"},{font_family:"sg-ele",my_class:"uniE100",unicode:"ea1b"},{font_family:"sg-ele",my_class:"uniE108",unicode:"ea23"},{font_family:"sg-ele",my_class:"uniE104",unicode:"ea1f"},{font_family:"sg-ele",my_class:"uniE105",unicode:"ea20"},{font_family:"sg-ele",my_class:"uniE079",unicode:"ea06"},{font_family:"sg-ele",my_class:"uniE072",unicode:"e9ff"},{font_family:"sg-ele",my_class:"uniE10D",unicode:"e9a8"},{font_family:"sg-ele",my_class:"uniE056",unicode:"e9ef"},{font_family:"sg-ele",my_class:"uniE047",unicode:"e9e6"},{font_family:"sg-ele",my_class:"uniE048",unicode:"e9e7"},{font_family:"sg-ele",my_class:"uniE049",unicode:"e9e8"},{font_family:"sg-ele",my_class:"uniE026",unicode:"e9d1"},{font_family:"sg-ele",my_class:"uniE028",unicode:"e9d3"},{font_family:"sg-ele",my_class:"uniE06F",unicode:"e98e"},{font_family:"sg-ele",my_class:"uniE11B",unicode:"e9ad"},{font_family:"sg-ele",my_class:"uniE04A",unicode:"e97b"},{font_family:"sg-ele",my_class:"uniE04B",unicode:"e97c"},{font_family:"sg-ele",my_class:"uniE04C",unicode:"e97d"},{font_family:"sg-ele",my_class:"uniE0EF",unicode:"e953"},{font_family:"sg-ele",my_class:"uniE0D8",unicode:"e93b"},{font_family:"sg-ele",my_class:"uniE0C9",unicode:"e92b"},{font_family:"sg-ele",my_class:"uniE0BE",unicode:"e920"}]},{name:"\u7535\u529B\u7CFB\u7EDF-5",show:!0,list:[{font_family:"sg-ele",my_class:"uniE140",unicode:"ea43"},{font_family:"sg-ele",my_class:"uniE0B5",unicode:"e917"},{font_family:"sg-ele",my_class:"uniE0E8",unicode:"e94c"},{font_family:"sg-ele",my_class:"uniE0B9",unicode:"e91b"},{font_family:"sg-ele",my_class:"uniE0AB",unicode:"e90c"},{font_family:"sg-ele",my_class:"uniE14F",unicode:"e9c5"},{font_family:"sg-ele",my_class:"uniE070",unicode:"e9fd"},{font_family:"sg-ele",my_class:"uniE0A7",unicode:"e908"},{font_family:"sg-ele",my_class:"uniE0A9",unicode:"e90a"},{font_family:"sg-ele",my_class:"uniE0AA",unicode:"e90b"},{font_family:"sg-ele",my_class:"uniE077",unicode:"ea04"},{font_family:"sg-ele",my_class:"uniE06E",unicode:"e98d"},{font_family:"sg-ele",my_class:"uniE10E",unicode:"e9a9"},{font_family:"sg-ele",my_class:"uniE10F",unicode:"e9aa"},{font_family:"sg-ele",my_class:"uniE0DC",unicode:"e93f"},{font_family:"sg-ele",my_class:"uniE0E7",unicode:"e94b"},{font_family:"sg-ele",my_class:"uniE113",unicode:"ea28"},{font_family:"sg-ele",my_class:"uniE127",unicode:"ea36"},{font_family:"sg-ele",my_class:"uniE097",unicode:"ea18"},{font_family:"sg-ele",my_class:"uniE136",unicode:"ea3f"},{font_family:"sg-ele",my_class:"uniE0A5",unicode:"e906"},{font_family:"sg-ele",my_class:"uniE0CE",unicode:"e930"},{font_family:"sg-ele",my_class:"uniE045",unicode:"e9e4"},{font_family:"sg-ele",my_class:"uniE046",unicode:"e9e5"},{font_family:"sg-ele",my_class:"uniE0E0",unicode:"e944"},{font_family:"sg-ele",my_class:"uniE063",unicode:"e9f6"},{font_family:"sg-ele",my_class:"uniE0F1",unicode:"e956"},{font_family:"sg-ele",my_class:"uniE07C",unicode:"e992"},{font_family:"sg-ele",my_class:"uniE07D",unicode:"e993"},{font_family:"sg-ele",my_class:"uniE08C",unicode:"e999"},{font_family:"sg-ele",my_class:"uniE0B3",unicode:"e915"},{font_family:"sg-ele",my_class:"uniE0AF",unicode:"e910"},{font_family:"sg-ele",my_class:"uniE0B2",unicode:"e914"},{font_family:"sg-ele",my_class:"uniE0B6",unicode:"e918"},{font_family:"sg-ele",my_class:"uniE0FB",unicode:"e960"},{font_family:"sg-ele",my_class:"uniE0B8",unicode:"e91a"},{font_family:"sg-ele",my_class:"uniE0CD",unicode:"e92f"},{font_family:"sg-ele",my_class:"uniE0D1",unicode:"e934"},{font_family:"sg-ele",my_class:"uniE0D3",unicode:"e936"},{font_family:"sg-ele",my_class:"uniE0D5",unicode:"e938"},{font_family:"sg-ele",my_class:"uniE087",unicode:"ea0e"},{font_family:"sg-ele",my_class:"uniE0D9",unicode:"e93c"},{font_family:"sg-ele",my_class:"uniE0DD",unicode:"e940"},{font_family:"sg-ele",my_class:"uniE0DE",unicode:"e941"},{font_family:"sg-ele",my_class:"uniE0DF",unicode:"e942"},{font_family:"sg-ele",my_class:"uniE0E3",unicode:"e947"},{font_family:"sg-ele",my_class:"uniE0E5",unicode:"e949"},{font_family:"sg-ele",my_class:"uniE0E6",unicode:"e94a"},{font_family:"sg-ele",my_class:"uniE0E9",unicode:"e94d"},{font_family:"sg-ele",my_class:"uniE0F2",unicode:"e957"},{font_family:"sg-ele",my_class:"uniE0FA",unicode:"e95f"},{font_family:"sg-ele",my_class:"uniE0FF",unicode:"e964"},{font_family:"sg-ele",my_class:"uniE001",unicode:"e965"},{font_family:"sg-ele",my_class:"uniE01A",unicode:"e966"},{font_family:"sg-ele",my_class:"uniE01E",unicode:"e96a"},{font_family:"sg-ele",my_class:"uniE003",unicode:"e973"},{font_family:"sg-ele",my_class:"uniE0E1",unicode:"e945"},{font_family:"sg-ele",my_class:"uniE035",unicode:"e9da"},{font_family:"sg-ele",my_class:"uniE0C0",unicode:"e923"},{font_family:"sg-ele",my_class:"uniE03F",unicode:"e979"},{font_family:"sg-ele",my_class:"uniE05E",unicode:"e986"},{font_family:"sg-ele",my_class:"uniE07F",unicode:"e995"},{font_family:"sg-ele",my_class:"uniE08B",unicode:"e998"},{font_family:"sg-ele",my_class:"uniE08D",unicode:"e99a"},{font_family:"sg-ele",my_class:"uniE09B",unicode:"e99f"},{font_family:"sg-ele",my_class:"uniE09C",unicode:"e9a0"},{font_family:"sg-ele",my_class:"uniE029",unicode:"e9d4"},{font_family:"sg-ele",my_class:"uniE036",unicode:"e9db"},{font_family:"sg-ele",my_class:"uniE037",unicode:"e9dc"},{font_family:"sg-ele",my_class:"uniE038",unicode:"e9dd"},{font_family:"sg-ele",my_class:"uniE053",unicode:"e9ec"},{font_family:"sg-ele",my_class:"uniE054",unicode:"e9ed"},{font_family:"sg-ele",my_class:"uniE076",unicode:"ea03"},{font_family:"sg-ele",my_class:"uniE081",unicode:"ea08"},{font_family:"sg-ele",my_class:"uniE085",unicode:"ea0c"},{font_family:"sg-ele",my_class:"uniE089",unicode:"ea10"},{font_family:"sg-ele",my_class:"uniE098",unicode:"ea19"},{font_family:"sg-ele",my_class:"uniE093",unicode:"ea14"}]},{name:"\u7535\u529B\u7CFB\u7EDF-6",show:!0,list:[{font_family:"sg-ele",my_class:"uniE147",unicode:"ea4a"},{font_family:"sg-ele",my_class:"uniE145",unicode:"ea48"},{font_family:"sg-ele",my_class:"uniE148",unicode:"ea4b"},{font_family:"sg-ele",my_class:"uniE139",unicode:"ea42"},{font_family:"sg-ele",my_class:"uniE133",unicode:"ea3c"},{font_family:"sg-ele",my_class:"uniE135",unicode:"ea3e"},{font_family:"sg-ele",my_class:"uniE064",unicode:"e9f7"},{font_family:"sg-ele",my_class:"uniE065",unicode:"e9f8"},{font_family:"sg-ele",my_class:"uniE066",unicode:"e9f9"},{font_family:"sg-ele",my_class:"uniE067",unicode:"e9fa"},{font_family:"sg-ele",my_class:"uniE068",unicode:"e9fb"},{font_family:"sg-ele",my_class:"uniE14B",unicode:"e9c1"},{font_family:"sg-ele",my_class:"uniE14D",unicode:"e9c3"},{font_family:"sg-ele",my_class:"uniE13A",unicode:"e9b9"},{font_family:"sg-ele",my_class:"uniE13B",unicode:"e9ba"},{font_family:"sg-ele",my_class:"uniE12C",unicode:"e9b4"},{font_family:"sg-ele",my_class:"uniE06D",unicode:"e98c"},{font_family:"sg-ele",my_class:"uniE05C",unicode:"e984"},{font_family:"sg-ele",my_class:"uniE03A",unicode:"e974"},{font_family:"sg-ele",my_class:"uniE03B",unicode:"e975"},{font_family:"sg-ele",my_class:"uniE03C",unicode:"e976"},{font_family:"sg-ele",my_class:"uniE004",unicode:"e97a"},{font_family:"sg-ele",my_class:"uniE134",unicode:"ea3d"},{font_family:"sg-ele",my_class:"uniE128",unicode:"ea37"},{font_family:"sg-ele",my_class:"uniE122",unicode:"ea31"},{font_family:"sg-ele",my_class:"uniE123",unicode:"ea32"},{font_family:"sg-ele",my_class:"uniE120",unicode:"ea2f"},{font_family:"sg-ele",my_class:"uniE039",unicode:"e9de"},{font_family:"sg-ele",my_class:"uniE03D",unicode:"e977"},{font_family:"sg-ele",my_class:"uniE05D",unicode:"e985"},{font_family:"sg-ele",my_class:"uniE0EA",unicode:"e94e"},{font_family:"sg-ele",my_class:"uniE08E",unicode:"e99b"},{font_family:"sg-ele",my_class:"uniE07A",unicode:"e990"},{font_family:"sg-ele",my_class:"uniE07B",unicode:"e991"},{font_family:"sg-ele",my_class:"uniE074",unicode:"ea01"},{font_family:"sg-ele",my_class:"uniE078",unicode:"ea05"}]},{name:"\u7535\u529B\u7CFB\u7EDF-7",show:!0,list:[{font_family:"sg-ele",my_class:"uniE02A",unicode:"e96d"},{font_family:"sg-ele",my_class:"uniE02E",unicode:"e971"},{font_family:"sg-ele",my_class:"uniE02F",unicode:"e972"},{font_family:"sg-ele",my_class:"uniE131",unicode:"ea3a"},{font_family:"sg-ele",my_class:"uniE132",unicode:"ea3b"},{font_family:"sg-ele",my_class:"uniE143",unicode:"ea46"},{font_family:"sg-ele",my_class:"uniE0A4",unicode:"e905"},{font_family:"sg-ele",my_class:"uniE144",unicode:"ea47"},{font_family:"sg-ele",my_class:"uniE146",unicode:"ea49"},{font_family:"sg-ele",my_class:"uniE149",unicode:"ea4c"},{font_family:"sg-ele",my_class:"uniE150",unicode:"ea4d"},{font_family:"sg-ele",my_class:"uniE154",unicode:"ea50"},{font_family:"sg-ele",my_class:"uniE151",unicode:"ea4e"},{font_family:"sg-ele",my_class:"uniE138",unicode:"ea41"},{font_family:"sg-ele",my_class:"uniE0C2",unicode:"e925"},{font_family:"sg-ele",my_class:"uniE027",unicode:"e9d2"},{font_family:"sg-ele",my_class:"uniE141",unicode:"ea44"},{font_family:"sg-ele",my_class:"uniE126",unicode:"ea35"},{font_family:"sg-ele",my_class:"uniE129",unicode:"ea38"},{font_family:"sg-ele",my_class:"uniE130",unicode:"ea39"},{font_family:"sg-ele",my_class:"uniE069",unicode:"e9fc"},{font_family:"sg-ele",my_class:"uniE057",unicode:"e9f0"},{font_family:"sg-ele",my_class:"uniE058",unicode:"e9f1"},{font_family:"sg-ele",my_class:"uniE030",unicode:"e9d5"},{font_family:"sg-ele",my_class:"uniE031",unicode:"e9d6"},{font_family:"sg-ele",my_class:"uniE032",unicode:"e9d7"},{font_family:"sg-ele",my_class:"uniE033",unicode:"e9d8"},{font_family:"sg-ele",my_class:"uniE034",unicode:"e9d9"},{font_family:"sg-ele",my_class:"uniE12B",unicode:"e9b3"},{font_family:"sg-ele",my_class:"uniE12D",unicode:"e9b5"},{font_family:"sg-ele",my_class:"uniE12E",unicode:"e9b6"},{font_family:"sg-ele",my_class:"uniE12F",unicode:"e9b7"},{font_family:"sg-ele",my_class:"uniE14A",unicode:"e9c0"},{font_family:"sg-ele",my_class:"uniE14C",unicode:"e9c2"},{font_family:"sg-ele",my_class:"uniE14E",unicode:"e9c4"},{font_family:"sg-ele",my_class:"uniE06A",unicode:"e989"},{font_family:"sg-ele",my_class:"uniE011",unicode:"e9ab"},{font_family:"sg-ele",my_class:"uniE075",unicode:"ea02"},{font_family:"sg-ele",my_class:"uniE083",unicode:"ea0a"},{font_family:"sg-ele",my_class:"uniE0C4",unicode:"e927"},{font_family:"sg-ele",my_class:"uniE0B1",unicode:"e913"},{font_family:"sg-ele",my_class:"uniE0FE",unicode:"e963"}]},{name:"\u7535\u529B\u7CFB\u7EDF-8",show:!0,list:[{font_family:"sg-ele",my_class:"uniE114",unicode:"ea29"},{font_family:"sg-ele",my_class:"uniE115",unicode:"ea2a"},{font_family:"sg-ele",my_class:"uniE116",unicode:"ea2b"},{font_family:"sg-ele",my_class:"uniE117",unicode:"ea2c"},{font_family:"sg-ele",my_class:"uniE118",unicode:"ea2d"},{font_family:"sg-ele",my_class:"uniE119",unicode:"ea2e"},{font_family:"sg-ele",my_class:"uniE121",unicode:"ea30"},{font_family:"sg-ele",my_class:"uniE124",unicode:"ea33"},{font_family:"sg-ele",my_class:"uniE0B0",unicode:"e912"},{font_family:"sg-ele",my_class:"uniE0B7",unicode:"e919"},{font_family:"sg-ele",my_class:"uniE0BA",unicode:"e91c"},{font_family:"sg-ele",my_class:"uniE0BB",unicode:"e91d"},{font_family:"sg-ele",my_class:"uniE0BD",unicode:"e91f"},{font_family:"sg-ele",my_class:"uniE0C1",unicode:"e924"},{font_family:"sg-ele",my_class:"uniE0CC",unicode:"e92e"},{font_family:"sg-ele",my_class:"uniE0DA",unicode:"e93d"},{font_family:"sg-ele",my_class:"uniE0F3",unicode:"e958"},{font_family:"sg-ele",my_class:"uniE0F4",unicode:"e959"},{font_family:"sg-ele",my_class:"uniE0F6",unicode:"e95b"},{font_family:"sg-ele",my_class:"uniE0F7",unicode:"e95c"},{font_family:"sg-ele",my_class:"uniE0F8",unicode:"e95d"},{font_family:"sg-ele",my_class:"uniE0F9",unicode:"e95e"},{font_family:"sg-ele",my_class:"uniE0FD",unicode:"e962"},{font_family:"sg-ele",my_class:"uniE04F",unicode:"e980"},{font_family:"sg-ele",my_class:"uniE05B",unicode:"e983"},{font_family:"sg-ele",my_class:"uniE11A",unicode:"e9ac"},{font_family:"sg-ele",my_class:"uniE11C",unicode:"e9ae"},{font_family:"sg-ele",my_class:"uniE11D",unicode:"e9af"},{font_family:"sg-ele",my_class:"uniE11E",unicode:"e9b0"},{font_family:"sg-ele",my_class:"uniE13C",unicode:"e9bb"},{font_family:"sg-ele",my_class:"uniE13D",unicode:"e9bc"},{font_family:"sg-ele",my_class:"uniE13E",unicode:"e9bd"},{font_family:"sg-ele",my_class:"uniE052",unicode:"e9eb"},{font_family:"sg-ele",my_class:"uniE055",unicode:"e9ee"},{font_family:"sg-ele",my_class:"uniE060",unicode:"e9f3"},{font_family:"sg-ele",my_class:"uniE0B4",unicode:"e916"},{font_family:"sg-ele",my_class:"uniE0BF",unicode:"e921"},{font_family:"sg-ele",my_class:"uniE0CA",unicode:"e92c"},{font_family:"sg-ele",my_class:"uniE0D7",unicode:"e93a"},{font_family:"sg-ele",my_class:"uniE06B",unicode:"e98a"},{font_family:"sg-ele",my_class:"uniE10A",unicode:"e9a5"},{font_family:"sg-ele",my_class:"uniE017",unicode:"e9c8"},{font_family:"sg-ele",my_class:"uniE050",unicode:"e9e9"},{font_family:"sg-ele",my_class:"uniE086",unicode:"ea0d"},{font_family:"sg-ele",my_class:"uniE099",unicode:"ea1a"},{font_family:"sg-ele",my_class:"uniE101",unicode:"ea1c"}]},{name:"\u7535\u529B\u7CFB\u7EDF-9",show:!0,list:[{font_family:"sg-ele",my_class:"uniE106",unicode:"ea21"},{font_family:"sg-ele",my_class:"uniE109",unicode:"ea24"},{font_family:"sg-ele",my_class:"uniE061",unicode:"e9f4"},{font_family:"sg-ele",my_class:"uniE092",unicode:"ea13"},{font_family:"sg-ele",my_class:"uniE01B",unicode:"e967"},{font_family:"sg-ele",my_class:"uniE01C",unicode:"e968"},{font_family:"sg-ele",my_class:"uniE09D",unicode:"e9a1"},{font_family:"sg-ele",my_class:"uniE09F",unicode:"e9a3"},{font_family:"sg-ele",my_class:"uniE11F",unicode:"e9b1"},{font_family:"sg-ele",my_class:"uniE13F",unicode:"e9be"},{font_family:"sg-ele",my_class:"uniE016",unicode:"e9c7"},{font_family:"sg-ele",my_class:"uniE125",unicode:"ea34"},{font_family:"sg-ele",my_class:"uniE137",unicode:"ea40"},{font_family:"sg-ele",my_class:"uniE142",unicode:"ea45"},{font_family:"sg-ele",my_class:"uniE0C3",unicode:"e926"},{font_family:"sg-ele",my_class:"uniE0CF",unicode:"e931"},{font_family:"sg-ele",my_class:"uniE0D0",unicode:"e933"},{font_family:"sg-ele",my_class:"uniE0D2",unicode:"e935"},{font_family:"sg-ele",my_class:"uniE0D4",unicode:"e937"},{font_family:"sg-ele",my_class:"uniE0D6",unicode:"e939"},{font_family:"sg-ele",my_class:"uniE051",unicode:"e9ea"}]},{name:"\u8111\u56FE",show:!1,list:[{name:"mindNode",icon:"t-icon t-zhuti",data:{text:"\u4E3B\u9898",width:200,height:50,name:"mindNode",borderRadius:.5}},{name:"mindLine",icon:"t-icon t-zizhuti",data:{text:"\u5B50\u4E3B\u9898",width:160,height:40,name:"mindLine"}}]},{name:"\u6D41\u7A0B\u56FE",show:!1,list:[{name:"\u5F00\u59CB/\u7ED3\u675F",icon:"t-icon t-flow-start",id:21,data:{text:"\u5F00\u59CB/\u7ED3\u675F",width:120,height:40,borderRadius:.5,name:"rectangle"}},{name:"\u6D41\u7A0B",icon:"t-icon t-rectangle",id:22,data:{text:"\u6D41\u7A0B",width:120,height:40,name:"rectangle"}},{name:"\u5224\u5B9A",icon:"t-icon t-diamond",id:23,data:{text:"\u5224\u5B9A",width:120,height:60,name:"diamond"}},{name:"\u6570\u636E",icon:"t-icon t-flow-data",id:24,data:{text:"\u6570\u636E",width:120,height:50,name:"flowData"}},{name:"\u51C6\u5907",icon:"t-icon t-flow-ready",id:25,data:{text:"\u51C6\u5907",width:120,height:50,name:"hexagon"}},{name:"\u5B50\u6D41\u7A0B",icon:"t-icon t-flow-subprocess",id:26,data:{text:"\u5B50\u6D41\u7A0B",width:120,height:50,name:"flowSubprocess"}},{name:"\u6570\u636E\u5E93",icon:"t-icon t-db",id:27,data:{text:"\u6570\u636E\u5E93",width:80,height:120,name:"flowDb"}},{name:"\u6587\u6863",icon:"t-icon t-flow-document",id:28,data:{text:"\u6587\u6863",width:120,height:100,name:"flowDocument"}},{name:"\u5185\u90E8\u5B58\u50A8",icon:"t-icon t-internal-storage",id:29,data:{text:"\u5185\u90E8\u5B58\u50A8",width:120,height:80,name:"flowInternalStorage"}},{name:"\u5916\u90E8\u5B58\u50A8",icon:"t-icon t-extern-storage",id:30,data:{text:"\u5916\u90E8\u5B58\u50A8",width:120,height:80,name:"flowExternStorage"}},{name:"\u961F\u5217",icon:"t-icon t-flow-queue",id:31,data:{text:"\u961F\u5217",width:100,height:100,name:"flowQueue"}},{name:"\u624B\u52A8\u8F93\u5165",icon:"t-icon t-flow-manually",id:32,data:{text:"\u624B\u52A8\u8F93\u5165",width:120,height:80,name:"flowManually"}},{name:"\u5C55\u793A",icon:"t-icon t-flow-display",id:33,data:{text:"\u5C55\u793A",width:120,height:80,name:"flowDisplay"}},{name:"\u5E76\u884C\u6A21\u5F0F",icon:"t-icon t-flow-parallel",id:34,data:{text:"\u5E76\u884C\u6A21\u5F0F",width:120,height:50,name:"flowParallel"}},{name:"\u6CE8\u91CA",icon:"t-icon t-flow-comment",id:35,data:{text:"\u6CE8\u91CA",width:100,height:100,name:"flowComment"}}]},{name:"\u6D3B\u52A8\u56FE",show:!1,list:[{name:"\u5F00\u59CB",icon:"t-icon t-inital",id:36,data:{text:"",width:30,height:30,name:"circle",background:"#555",color:"transparent"}},{name:"\u7ED3\u675F",icon:"t-icon t-final",id:37,data:{width:30,height:30,name:"activityFinal"}},{name:"\u6D3B\u52A8",icon:"t-icon t-action",id:38,data:{text:"\u6D3B\u52A8",width:120,height:50,borderRadius:.25,name:"rectangle"}},{name:"\u51B3\u7B56/\u5408\u5E76",icon:"t-icon t-diamond",id:39,data:{text:"\u51B3\u7B56/\u5408\u5E76",width:120,height:50,name:"diamond"}},{name:"\u5782\u76F4\u6CF3\u9053",icon:"t-icon t-swimlane-v",id:40,data:{text:"\u5782\u76F4\u6CF3\u9053",width:200,height:500,name:"swimlaneV",textHeight:.1}},{name:"\u6C34\u5E73\u6CF3\u9053",icon:"t-icon t-swimlane-h",id:41,data:{text:"\u6C34\u5E73\u6CF3\u9053",width:500,height:200,name:"swimlaneH",textWidth:.01,textLeft:.04,textAlign:"start"}},{name:"\u5782\u76F4\u5206\u5C94/\u6C47\u5408",icon:"t-icon t-fork-v",id:42,data:{text:"\u5782\u76F4\u5206\u5C94/\u6C47\u5408",width:10,height:150,name:"forkV",fillStyle:"#555",strokeStyle:"transparent"}},{name:"\u6C34\u5E73\u5206\u5C94/\u6C47\u5408",icon:"t-icon t-fork",id:43,data:{text:"\u6C34\u5E73\u5206\u5C94/\u6C47\u5408",width:150,height:10,name:"forkH",fillStyle:"#555",strokeStyle:"transparent"}}]},{name:"\u65F6\u5E8F\u56FE\u548C\u7C7B\u56FE",show:!1,list:[{name:"\u751F\u547D\u7EBF",icon:"t-icon t-lifeline",id:44,data:{text:"\u751F\u547D\u7EBF",width:150,height:400,textHeight:50,name:"lifeline"}},{name:"\u6FC0\u6D3B",icon:"t-icon t-focus",id:45,data:{text:"\u6FC0\u6D3B",width:12,height:200,name:"sequenceFocus"}},{name:"\u7B80\u5355\u7C7B",icon:"t-icon t-simple-class",id:46,data:{text:"Topolgoy",width:270,height:200,textHeight:.2,name:"simpleClass",textAlign:"center",textBaseline:"top",textTop:10,list:[{text:`- name: string + setName(name: string): void`}]}},{name:"\u7C7B",icon:"t-icon t-class",id:47,data:{text:"Topolgoy",width:270,height:200,textHeight:.2,name:"interfaceClass",textAlign:"center",textBaseline:"top",textTop:10,list:[{text:"- name: string"},{text:"+ setName(name: string): void"}]}}]}];var ra={};(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 o=r.shift();if(!!o){if(typeof o!="object")throw new TypeError(o+"must be non-object");for(var l in o)i(o,l)&&(n[l]=o[l])}}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,o,l,h){if(r.subarray&&n.subarray){n.set(r.subarray(o,o+l),h);return}for(var c=0;c=0;)e[t]=0}var Tk=0,D0=1,Ik=2,Bk=3,Dk=258,oh=29,Nn=256,Pn=Nn+1+oh,Ms=30,lh=19,M0=2*Pn+1,Va=15,oc=16,Mk=7,ch=256,L0=16,O0=17,N0=18,Lc=[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],Xr=[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],Lk=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],z0=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],Ok=512,Ji=new Array((Pn+2)*2);Us(Ji);var En=new Array(Ms*2);Us(En);var Sn=new Array(Ok);Us(Sn);var Tn=new Array(Dk-Bk+1);Us(Tn);var hh=new Array(oh);Us(hh);var yo=new Array(Ms);Us(yo);function lc(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 W0,H0,U0;function cc(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function V0(e){return e<256?Sn[e]:Sn[256+(e>>>7)]}function In(e,t){e.pending_buf[e.pending++]=t&255,e.pending_buf[e.pending++]=t>>>8&255}function Ke(e,t,i){e.bi_valid>oc-i?(e.bi_buf|=t<>oc-e.bi_valid,e.bi_valid+=i-oc):(e.bi_buf|=t<>>=1,i<<=1;while(--t>0);return i>>>1}function Nk(e){e.bi_valid===16?(In(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 zk(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,o=t.stat_desc.extra_base,l=t.stat_desc.max_length,h,c,d,f,g,m,y=0;for(f=0;f<=Va;f++)e.bl_count[f]=0;for(i[e.heap[e.heap_max]*2+1]=0,h=e.heap_max+1;hl&&(f=l,y++),i[c*2+1]=f,!(c>a)&&(e.bl_count[f]++,g=0,c>=o&&(g=r[c-o]),m=i[c*2],e.opt_len+=m*(f+g),n&&(e.static_len+=m*(s[c*2+1]+g)));if(y!==0){do{for(f=l-1;e.bl_count[f]===0;)f--;e.bl_count[f]--,e.bl_count[f+1]+=2,e.bl_count[l]--,y-=2}while(y>0);for(f=l;f!==0;f--)for(c=e.bl_count[f];c!==0;)d=e.heap[--h],!(d>a)&&(i[d*2+1]!==f&&(e.opt_len+=(f-i[d*2+1])*i[d*2],i[d*2+1]=f),c--)}}function j0(e,t,i){var a=new Array(Va+1),s=0,n,r;for(n=1;n<=Va;n++)a[n]=s=s+i[n-1]<<1;for(r=0;r<=t;r++){var o=e[r*2+1];o!==0&&(e[r*2]=$0(a[o]++,o))}}function Wk(){var e,t,i,a,s,n=new Array(Va+1);for(i=0,a=0;a>=7;a8?In(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 Hk(e,t,i,a){Y0(e),a&&(In(e,i),In(e,~i)),Rk.arraySet(e.pending_buf,e.window,t,i,e.pending),e.pending+=i}function $d(e,t,i,a){var s=t*2,n=i*2;return e[s]>1;r>=1;r--)hc(e,i,r);h=n;do r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],hc(e,i,1),o=e.heap[1],e.heap[--e.heap_max]=r,e.heap[--e.heap_max]=o,i[h*2]=i[r*2]+i[o*2],e.depth[h]=(e.depth[r]>=e.depth[o]?e.depth[r]:e.depth[o])+1,i[r*2+1]=i[o*2+1]=h,e.heap[1]=h++,hc(e,i,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],zk(e,t),j0(i,l,e.bl_count)}function qd(e,t,i){var a,s=-1,n,r=t[0*2+1],o=0,l=7,h=4;for(r===0&&(l=138,h=3),t[(i+1)*2+1]=65535,a=0;a<=i;a++)n=r,r=t[(a+1)*2+1],!(++o=3&&e.bl_tree[z0[t]*2+1]===0;t--);return e.opt_len+=3*(t+1)+5+5+4,t}function Vk(e,t,i,a){var s;for(Ke(e,t-257,5),Ke(e,i-1,5),Ke(e,a-4,4),s=0;s>>=1)if(t&1&&e.dyn_ltree[i*2]!==0)return Ud;if(e.dyn_ltree[9*2]!==0||e.dyn_ltree[10*2]!==0||e.dyn_ltree[13*2]!==0)return Vd;for(i=32;i0?(e.strm.data_type===Sk&&(e.strm.data_type=$k(e)),Oc(e,e.l_desc),Oc(e,e.d_desc),r=Uk(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?K0(e,t,i,a):e.strategy===Pk||n===s?(Ke(e,(D0<<1)+(a?1:0),3),jd(e,Ji,En)):(Ke(e,(Ik<<1)+(a?1:0),3),Vk(e,e.l_desc.max_code+1,e.d_desc.max_code+1,r+1),jd(e,e.dyn_ltree,e.dyn_dtree)),q0(e),a&&Y0(e)}function Kk(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[(Tn[i]+Nn+1)*2]++,e.dyn_dtree[V0(t)*2]++),e.last_lit===e.lit_bufsize-1}Hs._tr_init=jk;Hs._tr_stored_block=K0;Hs._tr_flush_block=Yk;Hs._tr_tally=Kk;Hs._tr_align=qk;function Xk(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 X0=Xk;function Gk(){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 Zk=Gk();function Jk(e,t,i,a){var s=Zk,n=a+i;e^=-1;for(var r=a;r>>8^s[(e^t[r])&255];return e^-1}var G0=Jk,uh={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"},ze=ra,vi=Hs,Z0=X0,ba=G0,Qk=uh,is=0,tC=1,eC=3,Ca=4,Xd=5,Li=0,Gd=1,mi=-2,iC=-3,uc=-5,aC=-1,sC=1,Hr=2,nC=3,rC=4,oC=0,lC=2,ko=8,cC=9,hC=15,uC=8,fC=29,dC=256,Nc=dC+1+fC,gC=30,vC=19,mC=2*Nc+1,yC=15,Ht=3,Aa=258,Ai=Aa+Ht+1,pC=32,Co=42,zc=69,Gr=73,Zr=91,Jr=103,$a=113,wn=666,pe=1,zn=2,Za=3,Vs=4,wC=3;function ka(e,t){return e.msg=Qk[t],t}function Zd(e){return(e<<1)-(e>4?9:0)}function Ea(e){for(var t=e.length;--t>=0;)e[t]=0}function xa(e){var t=e.state,i=t.pending;i>e.avail_out&&(i=e.avail_out),i!==0&&(ze.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 Fe(e,t){vi._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,xa(e.strm)}function $t(e,t){e.pending_buf[e.pending++]=t}function dn(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=t&255}function bC(e,t,i,a){var s=e.avail_in;return s>a&&(s=a),s===0?0:(e.avail_in-=s,ze.arraySet(t,e.input,e.next_in,s,i),e.state.wrap===1?e.adler=Z0(e.adler,t,s,i):e.state.wrap===2&&(e.adler=ba(e.adler,t,s,i)),e.next_in+=s,e.total_in+=s,s)}function J0(e,t){var i=e.max_chain_length,a=e.strstart,s,n,r=e.prev_length,o=e.nice_match,l=e.strstart>e.w_size-Ai?e.strstart-(e.w_size-Ai):0,h=e.window,c=e.w_mask,d=e.prev,f=e.strstart+Aa,g=h[a+r-1],m=h[a+r];e.prev_length>=e.good_match&&(i>>=2),o>e.lookahead&&(o=e.lookahead);do if(s=t,!(h[s+r]!==m||h[s+r-1]!==g||h[s]!==h[a]||h[++s]!==h[a+1])){a+=2,s++;do;while(h[++a]===h[++s]&&h[++a]===h[++s]&&h[++a]===h[++s]&&h[++a]===h[++s]&&h[++a]===h[++s]&&h[++a]===h[++s]&&h[++a]===h[++s]&&h[++a]===h[++s]&&ar){if(e.match_start=t,r=n,n>=o)break;g=h[a+r-1],m=h[a+r]}}while((t=d[t&c])>l&&--i!==0);return r<=e.lookahead?r:e.lookahead}function Ja(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-Ai)){ze.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=bC(e.strm,e.window,e.strstart+e.lookahead,n),e.lookahead+=a,e.lookahead+e.insert>=Ht)for(r=e.strstart-e.insert,e.ins_h=e.window[r],e.ins_h=(e.ins_h<e.pending_buf_size-5&&(i=e.pending_buf_size-5);;){if(e.lookahead<=1){if(Ja(e),e.lookahead===0&&t===is)return pe;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,Fe(e,!1),e.strm.avail_out===0)||e.strstart-e.block_start>=e.w_size-Ai&&(Fe(e,!1),e.strm.avail_out===0))return pe}return e.insert=0,t===Ca?(Fe(e,!0),e.strm.avail_out===0?Za:Vs):(e.strstart>e.block_start&&(Fe(e,!1),e.strm.avail_out===0),pe)}function fc(e,t){for(var i,a;;){if(e.lookahead=Ht&&(e.ins_h=(e.ins_h<=Ht)if(a=vi._tr_tally(e,e.strstart-e.match_start,e.match_length-Ht),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=Ht){e.match_length--;do e.strstart++,e.ins_h=(e.ins_h<=Ht&&(e.ins_h=(e.ins_h<4096)&&(e.match_length=Ht-1)),e.prev_length>=Ht&&e.match_length<=e.prev_length){s=e.strstart+e.lookahead-Ht,a=vi._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-Ht),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=s&&(e.ins_h=(e.ins_h<=Ht&&e.strstart>0&&(s=e.strstart-1,a=r[s],a===r[++s]&&a===r[++s]&&a===r[++s])){n=e.strstart+Aa;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]&&se.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=Ht?(i=vi._tr_tally(e,1,e.match_length-Ht),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(i=vi._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),i&&(Fe(e,!1),e.strm.avail_out===0))return pe}return e.insert=0,t===Ca?(Fe(e,!0),e.strm.avail_out===0?Za:Vs):e.last_lit&&(Fe(e,!1),e.strm.avail_out===0)?pe:zn}function EC(e,t){for(var i;;){if(e.lookahead===0&&(Ja(e),e.lookahead===0)){if(t===is)return pe;break}if(e.match_length=0,i=vi._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,i&&(Fe(e,!1),e.strm.avail_out===0))return pe}return e.insert=0,t===Ca?(Fe(e,!0),e.strm.avail_out===0?Za:Vs):e.last_lit&&(Fe(e,!1),e.strm.avail_out===0)?pe:zn}function Si(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 Ts;Ts=[new Si(0,0,0,0,xC),new Si(4,4,8,4,fc),new Si(4,5,16,8,fc),new Si(4,6,32,32,fc),new Si(4,4,16,16,_s),new Si(8,16,32,32,_s),new Si(8,16,128,128,_s),new Si(8,32,128,256,_s),new Si(32,128,258,1024,_s),new Si(32,258,258,4096,_s)];function AC(e){e.window_size=2*e.w_size,Ea(e.head),e.max_lazy_match=Ts[e.level].max_lazy,e.good_match=Ts[e.level].good_length,e.nice_match=Ts[e.level].nice_length,e.max_chain_length=Ts[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=Ht-1,e.match_available=0,e.ins_h=0}function kC(){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=ko,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 ze.Buf16(mC*2),this.dyn_dtree=new ze.Buf16((2*gC+1)*2),this.bl_tree=new ze.Buf16((2*vC+1)*2),Ea(this.dyn_ltree),Ea(this.dyn_dtree),Ea(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new ze.Buf16(yC+1),this.heap=new ze.Buf16(2*Nc+1),Ea(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new ze.Buf16(2*Nc+1),Ea(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 Q0(e){var t;return!e||!e.state?ka(e,mi):(e.total_in=e.total_out=0,e.data_type=lC,t=e.state,t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?Co:$a,e.adler=t.wrap===2?0:1,t.last_flush=is,vi._tr_init(t),Li)}function tv(e){var t=Q0(e);return t===Li&&AC(e.state),t}function CC(e,t){return!e||!e.state||e.state.wrap!==2?mi:(e.state.gzhead=t,Li)}function ev(e,t,i,a,s,n){if(!e)return mi;var r=1;if(t===aC&&(t=6),a<0?(r=0,a=-a):a>15&&(r=2,a-=16),s<1||s>cC||i!==ko||a<8||a>15||t<0||t>9||n<0||n>rC)return ka(e,mi);a===8&&(a=9);var o=new kC;return e.state=o,o.strm=e,o.wrap=r,o.gzhead=null,o.w_bits=a,o.w_size=1<Xd||t<0)return e?ka(e,mi):mi;if(a=e.state,!e.output||!e.input&&e.avail_in!==0||a.status===wn&&t!==Ca)return ka(e,e.avail_out===0?uc:mi);if(a.strm=e,i=a.last_flush,a.last_flush=t,a.status===Co)if(a.wrap===2)e.adler=0,$t(a,31),$t(a,139),$t(a,8),a.gzhead?($t(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)),$t(a,a.gzhead.time&255),$t(a,a.gzhead.time>>8&255),$t(a,a.gzhead.time>>16&255),$t(a,a.gzhead.time>>24&255),$t(a,a.level===9?2:a.strategy>=Hr||a.level<2?4:0),$t(a,a.gzhead.os&255),a.gzhead.extra&&a.gzhead.extra.length&&($t(a,a.gzhead.extra.length&255),$t(a,a.gzhead.extra.length>>8&255)),a.gzhead.hcrc&&(e.adler=ba(e.adler,a.pending_buf,a.pending,0)),a.gzindex=0,a.status=zc):($t(a,0),$t(a,0),$t(a,0),$t(a,0),$t(a,0),$t(a,a.level===9?2:a.strategy>=Hr||a.level<2?4:0),$t(a,wC),a.status=$a);else{var r=ko+(a.w_bits-8<<4)<<8,o=-1;a.strategy>=Hr||a.level<2?o=0:a.level<6?o=1:a.level===6?o=2:o=3,r|=o<<6,a.strstart!==0&&(r|=pC),r+=31-r%31,a.status=$a,dn(a,r),a.strstart!==0&&(dn(a,e.adler>>>16),dn(a,e.adler&65535)),e.adler=1}if(a.status===zc)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=ba(e.adler,a.pending_buf,a.pending-s,s)),xa(e),s=a.pending,a.pending===a.pending_buf_size));)$t(a,a.gzhead.extra[a.gzindex]&255),a.gzindex++;a.gzhead.hcrc&&a.pending>s&&(e.adler=ba(e.adler,a.pending_buf,a.pending-s,s)),a.gzindex===a.gzhead.extra.length&&(a.gzindex=0,a.status=Gr)}else a.status=Gr;if(a.status===Gr)if(a.gzhead.name){s=a.pending;do{if(a.pending===a.pending_buf_size&&(a.gzhead.hcrc&&a.pending>s&&(e.adler=ba(e.adler,a.pending_buf,a.pending-s,s)),xa(e),s=a.pending,a.pending===a.pending_buf_size)){n=1;break}a.gzindexs&&(e.adler=ba(e.adler,a.pending_buf,a.pending-s,s)),n===0&&(a.gzindex=0,a.status=Zr)}else a.status=Zr;if(a.status===Zr)if(a.gzhead.comment){s=a.pending;do{if(a.pending===a.pending_buf_size&&(a.gzhead.hcrc&&a.pending>s&&(e.adler=ba(e.adler,a.pending_buf,a.pending-s,s)),xa(e),s=a.pending,a.pending===a.pending_buf_size)){n=1;break}a.gzindexs&&(e.adler=ba(e.adler,a.pending_buf,a.pending-s,s)),n===0&&(a.status=Jr)}else a.status=Jr;if(a.status===Jr&&(a.gzhead.hcrc?(a.pending+2>a.pending_buf_size&&xa(e),a.pending+2<=a.pending_buf_size&&($t(a,e.adler&255),$t(a,e.adler>>8&255),e.adler=0,a.status=$a)):a.status=$a),a.pending!==0){if(xa(e),e.avail_out===0)return a.last_flush=-1,Li}else if(e.avail_in===0&&Zd(t)<=Zd(i)&&t!==Ca)return ka(e,uc);if(a.status===wn&&e.avail_in!==0)return ka(e,uc);if(e.avail_in!==0||a.lookahead!==0||t!==is&&a.status!==wn){var l=a.strategy===Hr?EC(a,t):a.strategy===nC?_C(a,t):Ts[a.level].func(a,t);if((l===Za||l===Vs)&&(a.status=wn),l===pe||l===Za)return e.avail_out===0&&(a.last_flush=-1),Li;if(l===zn&&(t===tC?vi._tr_align(a):t!==Xd&&(vi._tr_stored_block(a,0,0,!1),t===eC&&(Ea(a.head),a.lookahead===0&&(a.strstart=0,a.block_start=0,a.insert=0))),xa(e),e.avail_out===0))return a.last_flush=-1,Li}return t!==Ca?Li:a.wrap<=0?Gd:(a.wrap===2?($t(a,e.adler&255),$t(a,e.adler>>8&255),$t(a,e.adler>>16&255),$t(a,e.adler>>24&255),$t(a,e.total_in&255),$t(a,e.total_in>>8&255),$t(a,e.total_in>>16&255),$t(a,e.total_in>>24&255)):(dn(a,e.adler>>>16),dn(a,e.adler&65535)),xa(e),a.wrap>0&&(a.wrap=-a.wrap),a.pending!==0?Li:Gd)}function PC(e){var t;return!e||!e.state?mi:(t=e.state.status,t!==Co&&t!==zc&&t!==Gr&&t!==Zr&&t!==Jr&&t!==$a&&t!==wn?ka(e,mi):(e.state=null,t===$a?ka(e,iC):Li))}function SC(e,t){var i=t.length,a,s,n,r,o,l,h,c;if(!e||!e.state||(a=e.state,r=a.wrap,r===2||r===1&&a.status!==Co||a.lookahead))return mi;for(r===1&&(e.adler=Z0(e.adler,t,i,0)),a.wrap=0,i>=a.w_size&&(r===0&&(Ea(a.head),a.strstart=0,a.block_start=0,a.insert=0),c=new ze.Buf8(a.w_size),ze.arraySet(c,t,i-a.w_size,a.w_size,0),t=c,i=a.w_size),o=e.avail_in,l=e.next_in,h=e.input,e.avail_in=i,e.next_in=0,e.input=t,Ja(a);a.lookahead>=Ht;){s=a.strstart,n=a.lookahead-(Ht-1);do a.ins_h=(a.ins_h<=252?6:ya>=248?5:ya>=240?4:ya>=224?3:ya>=192?2:1;Bn[254]=Bn[254]=1;as.string2buf=function(e){var t,i,a,s,n,r=e.length,o=0;for(s=0;s>>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 sv(e,t){if(t<65534&&(e.subarray&&av||!e.subarray&&iv))return String.fromCharCode.apply(null,Fo.shrinkBuf(e,t));for(var i="",a=0;a4){o[a++]=65533,i+=n-1;continue}for(s&=n===2?31:n===3?15:7;n>1&&i1){o[a++]=65533;continue}s<65536?o[a++]=s:(s-=65536,o[a++]=55296|s>>10&1023,o[a++]=56320|s&1023)}return sv(o,a)};as.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+Bn[e[i]]>t?i:t};function TC(){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 nv=TC,An=Wi,kn=ra,Wc=as,Hc=uh,IC=nv,rv=Object.prototype.toString,BC=0,dc=4,Ls=0,Jd=1,Qd=2,DC=-1,MC=0,LC=8;function Qa(e){if(!(this instanceof Qa))return new Qa(e);this.options=kn.assign({level:DC,method:LC,chunkSize:16384,windowBits:15,memLevel:8,strategy:MC,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 IC,this.strm.avail_out=0;var i=An.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(i!==Ls)throw new Error(Hc[i]);if(t.header&&An.deflateSetHeader(this.strm,t.header),t.dictionary){var a;if(typeof t.dictionary=="string"?a=Wc.string2buf(t.dictionary):rv.call(t.dictionary)==="[object ArrayBuffer]"?a=new Uint8Array(t.dictionary):a=t.dictionary,i=An.deflateSetDictionary(this.strm,a),i!==Ls)throw new Error(Hc[i]);this._dict_set=!0}}Qa.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?dc:BC,typeof e=="string"?i.input=Wc.string2buf(e):rv.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 kn.Buf8(a),i.next_out=0,i.avail_out=a),s=An.deflate(i,n),s!==Jd&&s!==Ls)return this.onEnd(s),this.ended=!0,!1;(i.avail_out===0||i.avail_in===0&&(n===dc||n===Qd))&&(this.options.to==="string"?this.onData(Wc.buf2binstring(kn.shrinkBuf(i.output,i.next_out))):this.onData(kn.shrinkBuf(i.output,i.next_out)))}while((i.avail_in>0||i.avail_out===0)&&s!==Jd);return n===dc?(s=An.deflateEnd(this.strm),this.onEnd(s),this.ended=!0,s===Ls):(n===Qd&&(this.onEnd(Ls),i.avail_out=0),!0)};Qa.prototype.onData=function(e){this.chunks.push(e)};Qa.prototype.onEnd=function(e){e===Ls&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=kn.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function fh(e,t){var i=new Qa(t);if(i.push(e,!0),i.err)throw i.msg||Hc[i.err];return i.result}function OC(e,t){return t=t||{},t.raw=!0,fh(e,t)}function NC(e,t){return t=t||{},t.gzip=!0,fh(e,t)}On.Deflate=Qa;On.deflate=fh;On.deflateRaw=OC;On.gzip=NC;var Wn={},ki={},Ur=30,zC=12,WC=function(t,i){var a,s,n,r,o,l,h,c,d,f,g,m,y,p,x,_,b,k,R,S,I,D,V,G,F;a=t.state,s=t.next_in,G=t.input,n=s+(t.avail_in-5),r=t.next_out,F=t.output,o=r-(i-t.avail_out),l=r+(t.avail_out-257),h=a.dmax,c=a.wsize,d=a.whave,f=a.wnext,g=a.window,m=a.hold,y=a.bits,p=a.lencode,x=a.distcode,_=(1<>>24,m>>>=R,y-=R,R=k>>>16&255,R===0)F[r++]=k&65535;else if(R&16){S=k&65535,R&=15,R&&(y>>=R,y-=R),y<15&&(m+=G[s++]<>>24,m>>>=R,y-=R,R=k>>>16&255,R&16){if(I=k&65535,R&=15,yh){t.msg="invalid distance too far back",a.mode=Ur;break t}if(m>>>=R,y-=R,R=r-o,I>R){if(R=I-R,R>d&&a.sane){t.msg="invalid distance too far back",a.mode=Ur;break t}if(D=0,V=g,f===0){if(D+=c-R,R2;)F[r++]=V[D++],F[r++]=V[D++],F[r++]=V[D++],S-=3;S&&(F[r++]=V[D++],S>1&&(F[r++]=V[D++]))}else{D=r-I;do F[r++]=F[D++],F[r++]=F[D++],F[r++]=F[D++],S-=3;while(S>2);S&&(F[r++]=F[D++],S>1&&(F[r++]=F[D++]))}}else if((R&64)===0){k=x[(k&65535)+(m&(1<>3,s-=S,y-=S<<3,m&=(1<=1&&P[g]===0;g--);if(m>g&&(m=g),g===0)return n[r++]=1<<24|64<<16|0,n[r++]=1<<24|64<<16|0,l.bits=1,0;for(f=1;f0&&(t===ag||g!==1))return-1;for(T[1]=0,c=1;ceg||t===sg&&_>ig)return 1;for(;;){Z=c-p,o[d]F?(at=L[$+o[d]],q=V[G+o[d]]):(at=32+64,q=0),k=1<>p)+R]=Z<<24|at<<16|q|0;while(R!==0);for(k=1<>=1;if(k!==0?(b&=k-1,b+=k):b=0,d++,--P[c]===0){if(c===g)break;c=i[a+o[d]]}if(c>m&&(b&I)!==S){for(p===0&&(p=m),D+=f,y=c-p,x=1<eg||t===sg&&_>ig)return 1;S=b&I,n[S]=m<<24|y<<16|D-r|0}}return b!==0&&(n[D+b]=c-p<<24|64<<16|0),l.bits=m,0},ni=ra,Uc=X0,Ti=G0,qC=WC,Cn=jC,YC=0,ov=1,lv=2,ng=4,KC=5,Vr=6,ts=0,XC=1,GC=2,yi=-2,cv=-3,hv=-4,ZC=-5,rg=8,uv=1,og=2,lg=3,cg=4,hg=5,ug=6,fg=7,dg=8,gg=9,vg=10,po=11,Xi=12,vc=13,mg=14,mc=15,yg=16,pg=17,wg=18,bg=19,$r=20,jr=21,xg=22,_g=23,Eg=24,Ag=25,kg=26,yc=27,Cg=28,Fg=29,ne=30,fv=31,JC=32,QC=852,tF=592,eF=15,iF=eF;function Rg(e){return(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24)}function aF(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new ni.Buf16(320),this.work=new ni.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function dv(e){var t;return!e||!e.state?yi:(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=t.wrap&1),t.mode=uv,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new ni.Buf32(QC),t.distcode=t.distdyn=new ni.Buf32(tF),t.sane=1,t.back=-1,ts)}function gv(e){var t;return!e||!e.state?yi:(t=e.state,t.wsize=0,t.whave=0,t.wnext=0,dv(e))}function vv(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))?yi:(a.window!==null&&a.wbits!==t&&(a.window=null),a.wrap=i,a.wbits=t,gv(e))}function mv(e,t){var i,a;return e?(a=new aF,e.state=a,a.window=null,i=vv(e,t),i!==ts&&(e.state=null),i):yi}function sF(e){return mv(e,iF)}var Pg=!0,pc,wc;function nF(e){if(Pg){var t;for(pc=new ni.Buf32(512),wc=new ni.Buf32(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(Cn(ov,e.lens,0,288,pc,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;Cn(lv,e.lens,0,32,wc,0,e.work,{bits:5}),Pg=!1}e.lencode=pc,e.lenbits=9,e.distcode=wc,e.distbits=5}function yv(e,t,i,a){var s,n=e.state;return n.window===null&&(n.wsize=1<=n.wsize?(ni.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),ni.arraySet(n.window,t,i-a,s,n.wnext),a-=s,a?(ni.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>>8&255,i.check=Ti(i.check,V,2,0),h=0,c=0,i.mode=og;break}if(i.flags=0,i.head&&(i.head.done=!1),!(i.wrap&1)||(((h&255)<<8)+(h>>8))%31){e.msg="incorrect header check",i.mode=ne;break}if((h&15)!==rg){e.msg="unknown compression method",i.mode=ne;break}if(h>>>=4,c-=4,I=(h&15)+8,i.wbits===0)i.wbits=I;else if(I>i.wbits){e.msg="invalid window size",i.mode=ne;break}i.dmax=1<>8&1),i.flags&512&&(V[0]=h&255,V[1]=h>>>8&255,i.check=Ti(i.check,V,2,0)),h=0,c=0,i.mode=lg;case lg:for(;c<32;){if(o===0)break t;o--,h+=a[n++]<>>8&255,V[2]=h>>>16&255,V[3]=h>>>24&255,i.check=Ti(i.check,V,4,0)),h=0,c=0,i.mode=cg;case cg:for(;c<16;){if(o===0)break t;o--,h+=a[n++]<>8),i.flags&512&&(V[0]=h&255,V[1]=h>>>8&255,i.check=Ti(i.check,V,2,0)),h=0,c=0,i.mode=hg;case hg:if(i.flags&1024){for(;c<16;){if(o===0)break t;o--,h+=a[n++]<>>8&255,i.check=Ti(i.check,V,2,0)),h=0,c=0}else i.head&&(i.head.extra=null);i.mode=ug;case ug:if(i.flags&1024&&(g=i.length,g>o&&(g=o),g&&(i.head&&(I=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Array(i.head.extra_len)),ni.arraySet(i.head.extra,a,n,g,I)),i.flags&512&&(i.check=Ti(i.check,a,g,n)),o-=g,n+=g,i.length-=g),i.length))break t;i.length=0,i.mode=fg;case fg:if(i.flags&2048){if(o===0)break t;g=0;do I=a[n+g++],i.head&&I&&i.length<65536&&(i.head.name+=String.fromCharCode(I));while(I&&g>9&1,i.head.done=!0),e.adler=i.check=0,i.mode=Xi;break;case vg:for(;c<32;){if(o===0)break t;o--,h+=a[n++]<>>=c&7,c-=c&7,i.mode=yc;break}for(;c<3;){if(o===0)break t;o--,h+=a[n++]<>>=1,c-=1,h&3){case 0:i.mode=mg;break;case 1:if(nF(i),i.mode=$r,t===Vr){h>>>=2,c-=2;break t}break;case 2:i.mode=pg;break;case 3:e.msg="invalid block type",i.mode=ne}h>>>=2,c-=2;break;case mg:for(h>>>=c&7,c-=c&7;c<32;){if(o===0)break t;o--,h+=a[n++]<>>16^65535)){e.msg="invalid stored block lengths",i.mode=ne;break}if(i.length=h&65535,h=0,c=0,i.mode=mc,t===Vr)break t;case mc:i.mode=yg;case yg:if(g=i.length,g){if(g>o&&(g=o),g>l&&(g=l),g===0)break t;ni.arraySet(s,a,n,g,r),o-=g,n+=g,l-=g,r+=g,i.length-=g;break}i.mode=Xi;break;case pg:for(;c<14;){if(o===0)break t;o--,h+=a[n++]<>>=5,c-=5,i.ndist=(h&31)+1,h>>>=5,c-=5,i.ncode=(h&15)+4,h>>>=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=wg;case wg:for(;i.have>>=3,c-=3}for(;i.have<19;)i.lens[P[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,G={bits:i.lenbits},D=Cn(YC,i.lens,0,19,i.lencode,0,i.work,G),i.lenbits=G.bits,D){e.msg="invalid code lengths set",i.mode=ne;break}i.have=0,i.mode=bg;case bg:for(;i.have>>24,_=p>>>16&255,b=p&65535,!(x<=c);){if(o===0)break t;o--,h+=a[n++]<>>=x,c-=x,i.lens[i.have++]=b;else{if(b===16){for(F=x+2;c>>=x,c-=x,i.have===0){e.msg="invalid bit length repeat",i.mode=ne;break}I=i.lens[i.have-1],g=3+(h&3),h>>>=2,c-=2}else if(b===17){for(F=x+3;c>>=x,c-=x,I=0,g=3+(h&7),h>>>=3,c-=3}else{for(F=x+7;c>>=x,c-=x,I=0,g=11+(h&127),h>>>=7,c-=7}if(i.have+g>i.nlen+i.ndist){e.msg="invalid bit length repeat",i.mode=ne;break}for(;g--;)i.lens[i.have++]=I}}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,G={bits:i.lenbits},D=Cn(ov,i.lens,0,i.nlen,i.lencode,0,i.work,G),i.lenbits=G.bits,D){e.msg="invalid literal/lengths set",i.mode=ne;break}if(i.distbits=6,i.distcode=i.distdyn,G={bits:i.distbits},D=Cn(lv,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,G),i.distbits=G.bits,D){e.msg="invalid distances set",i.mode=ne;break}if(i.mode=$r,t===Vr)break t;case $r:i.mode=jr;case jr:if(o>=6&&l>=258){e.next_out=r,e.avail_out=l,e.next_in=n,e.avail_in=o,i.hold=h,i.bits=c,qC(e,f),r=e.next_out,s=e.output,l=e.avail_out,n=e.next_in,a=e.input,o=e.avail_in,h=i.hold,c=i.bits,i.mode===Xi&&(i.back=-1);break}for(i.back=0;p=i.lencode[h&(1<>>24,_=p>>>16&255,b=p&65535,!(x<=c);){if(o===0)break t;o--,h+=a[n++]<>k)],x=p>>>24,_=p>>>16&255,b=p&65535,!(k+x<=c);){if(o===0)break t;o--,h+=a[n++]<>>=k,c-=k,i.back+=k}if(h>>>=x,c-=x,i.back+=x,i.length=b,_===0){i.mode=kg;break}if(_&32){i.back=-1,i.mode=Xi;break}if(_&64){e.msg="invalid literal/length code",i.mode=ne;break}i.extra=_&15,i.mode=xg;case xg:if(i.extra){for(F=i.extra;c>>=i.extra,c-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=_g;case _g:for(;p=i.distcode[h&(1<>>24,_=p>>>16&255,b=p&65535,!(x<=c);){if(o===0)break t;o--,h+=a[n++]<>k)],x=p>>>24,_=p>>>16&255,b=p&65535,!(k+x<=c);){if(o===0)break t;o--,h+=a[n++]<>>=k,c-=k,i.back+=k}if(h>>>=x,c-=x,i.back+=x,_&64){e.msg="invalid distance code",i.mode=ne;break}i.offset=b,i.extra=_&15,i.mode=Eg;case Eg:if(i.extra){for(F=i.extra;c>>=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=Ag;case Ag:if(l===0)break t;if(g=f-l,i.offset>g){if(g=i.offset-g,g>i.whave&&i.sane){e.msg="invalid distance too far back",i.mode=ne;break}g>i.wnext?(g-=i.wnext,m=i.wsize-g):m=i.wnext-g,g>i.length&&(g=i.length),y=i.window}else y=s,m=r-i.offset,g=i.length;g>l&&(g=l),l-=g,i.length-=g;do s[r++]=y[m++];while(--g);i.length===0&&(i.mode=jr);break;case kg:if(l===0)break t;s[r++]=i.length,l--,i.mode=jr;break;case yc:if(i.wrap){for(;c<32;){if(o===0)break t;o--,h|=a[n++]<=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 fF,this.strm.avail_out=0;var i=Os.inflateInit2(this.strm,t.windowBits);if(i!==ge.Z_OK)throw new Error(Vc[i]);if(this.header=new dF,Os.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=Qr.string2buf(t.dictionary):wv.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(i=Os.inflateSetDictionary(this.strm,t.dictionary),i!==ge.Z_OK)))throw new Error(Vc[i])}es.prototype.push=function(e,t){var i=this.strm,a=this.options.chunkSize,s=this.options.dictionary,n,r,o,l,h,c=!1;if(this.ended)return!1;r=t===~~t?t:t===!0?ge.Z_FINISH:ge.Z_NO_FLUSH,typeof e=="string"?i.input=Qr.binstring2buf(e):wv.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 Fn.Buf8(a),i.next_out=0,i.avail_out=a),n=Os.inflate(i,ge.Z_NO_FLUSH),n===ge.Z_NEED_DICT&&s&&(n=Os.inflateSetDictionary(this.strm,s)),n===ge.Z_BUF_ERROR&&c===!0&&(n=ge.Z_OK,c=!1),n!==ge.Z_STREAM_END&&n!==ge.Z_OK)return this.onEnd(n),this.ended=!0,!1;i.next_out&&(i.avail_out===0||n===ge.Z_STREAM_END||i.avail_in===0&&(r===ge.Z_FINISH||r===ge.Z_SYNC_FLUSH))&&(this.options.to==="string"?(o=Qr.utf8border(i.output,i.next_out),l=i.next_out-o,h=Qr.buf2string(i.output,o),i.next_out=l,i.avail_out=a-l,l&&Fn.arraySet(i.output,i.output,o,l,0),this.onData(h)):this.onData(Fn.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!==ge.Z_STREAM_END);return n===ge.Z_STREAM_END&&(r=ge.Z_FINISH),r===ge.Z_FINISH?(n=Os.inflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===ge.Z_OK):(r===ge.Z_SYNC_FLUSH&&(this.onEnd(ge.Z_OK),i.avail_out=0),!0)};es.prototype.onData=function(e){this.chunks.push(e)};es.prototype.onEnd=function(e){e===ge.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Fn.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function dh(e,t){var i=new es(t);if(i.push(e,!0),i.err)throw i.msg||Vc[i.err];return i.result}function gF(e,t){return t=t||{},t.raw=!0,dh(e,t)}Wn.Inflate=es;Wn.inflate=dh;Wn.inflateRaw=gF;Wn.ungzip=dh;var vF=ra.assign,mF=On,yF=Wn,pF=pv,bv={};vF(bv,mF,yF,pF);var WF=bv,$c={exports:{}};/** * @license * Lodash * Copyright OpenJS Foundation and other contributors * Released under MIT license * Based on Underscore.js 1.8.3 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */(function(e,t){(function(){var i,a="4.18.1",s=200,n="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",r="Expected a function",o="Invalid `variable` option passed into `_.template`",l="Invalid `imports` option passed into `_.template`",h="__lodash_hash_undefined__",c=500,d="__lodash_placeholder__",f=1,g=2,m=4,y=1,p=2,x=1,_=2,b=4,k=8,R=16,S=32,I=64,D=128,V=256,G=512,F=30,P="...",T=800,L=16,$=1,Z=2,at=3,q=1/0,W=9007199254740991,j=17976931348623157e292,K=0/0,U=4294967295,tt=U-1,st=U>>>1,it=[["ary",D],["bind",x],["bindKey",_],["curry",k],["curryRight",R],["flip",G],["partial",S],["partialRight",I],["rearg",V]],ut="[object Arguments]",lt="[object Array]",ht="[object AsyncFunction]",E="[object Boolean]",A="[object Date]",B="[object DOMException]",N="[object Error]",X="[object Function]",J="[object GeneratorFunction]",rt="[object Map]",yt="[object Number]",mt="[object Null]",Et="[object Object]",Ft="[object Promise]",Ge="[object Proxy]",we="[object RegExp]",oe="[object Set]",Vt="[object String]",Gt="[object Symbol]",ss="[object Undefined]",$s="[object WeakMap]",xv="[object WeakSet]",js="[object ArrayBuffer]",ns="[object DataView]",Ro="[object Float32Array]",Po="[object Float64Array]",So="[object Int8Array]",To="[object Int16Array]",Io="[object Int32Array]",Bo="[object Uint8Array]",Do="[object Uint8ClampedArray]",Mo="[object Uint16Array]",Lo="[object Uint32Array]",_v=/\b__p \+= '';/g,Ev=/\b(__p \+=) '' \+/g,Av=/(__e\(.*?\)|\b__t\)) \+\n'';/g,gh=/&(?:amp|lt|gt|quot|#39);/g,vh=/[&<>"']/g,kv=RegExp(gh.source),Cv=RegExp(vh.source),Fv=/<%-([\s\S]+?)%>/g,Rv=/<%([\s\S]+?)%>/g,mh=/<%=([\s\S]+?)%>/g,Pv=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Sv=/^\w*$/,Tv=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Oo=/[\\^$.*+?()[\]{}|]/g,Iv=RegExp(Oo.source),No=/^\s+/,Bv=/\s/,Dv=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Mv=/\{\n\/\* \[wrapped with (.+)\] \*/,Lv=/,? & /,Ov=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,yh=/[()=,{}\[\]\/\s]/,Nv=/\\(\\)?/g,zv=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,ph=/\w*$/,Wv=/^[-+]0x[0-9a-f]+$/i,Hv=/^0b[01]+$/i,Uv=/^\[object .+?Constructor\]$/,Vv=/^0o[0-7]+$/i,$v=/^(?:0|[1-9]\d*)$/,jv=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Hn=/($^)/,qv=/['\n\r\u2028\u2029\\]/g,Un="\\ud800-\\udfff",Yv="\\u0300-\\u036f",Kv="\\ufe20-\\ufe2f",Xv="\\u20d0-\\u20ff",wh=Yv+Kv+Xv,bh="\\u2700-\\u27bf",xh="a-z\\xdf-\\xf6\\xf8-\\xff",Gv="\\xac\\xb1\\xd7\\xf7",Zv="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Jv="\\u2000-\\u206f",Qv=" \\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",_h="A-Z\\xc0-\\xd6\\xd8-\\xde",Eh="\\ufe0e\\ufe0f",Ah=Gv+Zv+Jv+Qv,zo="['\u2019]",tm="["+Un+"]",kh="["+Ah+"]",Vn="["+wh+"]",Ch="\\d+",em="["+bh+"]",Fh="["+xh+"]",Rh="[^"+Un+Ah+Ch+bh+xh+_h+"]",Wo="\\ud83c[\\udffb-\\udfff]",im="(?:"+Vn+"|"+Wo+")",Ph="[^"+Un+"]",Ho="(?:\\ud83c[\\udde6-\\uddff]){2}",Uo="[\\ud800-\\udbff][\\udc00-\\udfff]",rs="["+_h+"]",Sh="\\u200d",Th="(?:"+Fh+"|"+Rh+")",am="(?:"+rs+"|"+Rh+")",Ih="(?:"+zo+"(?:d|ll|m|re|s|t|ve))?",Bh="(?:"+zo+"(?:D|LL|M|RE|S|T|VE))?",Dh=im+"?",Mh="["+Eh+"]?",sm="(?:"+Sh+"(?:"+[Ph,Ho,Uo].join("|")+")"+Mh+Dh+")*",nm="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",rm="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Lh=Mh+Dh+sm,om="(?:"+[em,Ho,Uo].join("|")+")"+Lh,lm="(?:"+[Ph+Vn+"?",Vn,Ho,Uo,tm].join("|")+")",cm=RegExp(zo,"g"),hm=RegExp(Vn,"g"),Vo=RegExp(Wo+"(?="+Wo+")|"+lm+Lh,"g"),um=RegExp([rs+"?"+Fh+"+"+Ih+"(?="+[kh,rs,"$"].join("|")+")",am+"+"+Bh+"(?="+[kh,rs+Th,"$"].join("|")+")",rs+"?"+Th+"+"+Ih,rs+"+"+Bh,rm,nm,Ch,om].join("|"),"g"),fm=RegExp("["+Sh+Un+wh+Eh+"]"),dm=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,gm=["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"],vm=-1,ae={};ae[Ro]=ae[Po]=ae[So]=ae[To]=ae[Io]=ae[Bo]=ae[Do]=ae[Mo]=ae[Lo]=!0,ae[ut]=ae[lt]=ae[js]=ae[E]=ae[ns]=ae[A]=ae[N]=ae[X]=ae[rt]=ae[yt]=ae[Et]=ae[we]=ae[oe]=ae[Vt]=ae[$s]=!1;var ee={};ee[ut]=ee[lt]=ee[js]=ee[ns]=ee[E]=ee[A]=ee[Ro]=ee[Po]=ee[So]=ee[To]=ee[Io]=ee[rt]=ee[yt]=ee[Et]=ee[we]=ee[oe]=ee[Vt]=ee[Gt]=ee[Bo]=ee[Do]=ee[Mo]=ee[Lo]=!0,ee[N]=ee[X]=ee[$s]=!1;var mm={\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"},ym={"&":"&","<":"<",">":">",'"':""","'":"'"},pm={"&":"&","<":"<",">":">",""":'"',"'":"'"},wm={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},bm=parseFloat,xm=parseInt,Oh=typeof Oe=="object"&&Oe&&Oe.Object===Object&&Oe,_m=typeof self=="object"&&self&&self.Object===Object&&self,_e=Oh||_m||Function("return this")(),$o=t&&!t.nodeType&&t,Fa=$o&&!0&&e&&!e.nodeType&&e,Nh=Fa&&Fa.exports===$o,jo=Nh&&Oh.process,ri=function(){try{var et=Fa&&Fa.require&&Fa.require("util").types;return et||jo&&jo.binding&&jo.binding("util")}catch{}}(),zh=ri&&ri.isArrayBuffer,Wh=ri&&ri.isDate,Hh=ri&&ri.isMap,Uh=ri&&ri.isRegExp,Vh=ri&&ri.isSet,$h=ri&&ri.isTypedArray;function Ze(et,ft,ct){switch(ct.length){case 0:return et.call(ft);case 1:return et.call(ft,ct[0]);case 2:return et.call(ft,ct[0],ct[1]);case 3:return et.call(ft,ct[0],ct[1],ct[2])}return et.apply(ft,ct)}function Em(et,ft,ct,bt){for(var St=-1,qt=et==null?0:et.length;++St-1}function qo(et,ft,ct){for(var bt=-1,St=et==null?0:et.length;++bt-1;);return ct}function Jh(et,ft){for(var ct=et.length;ct--&&os(ft,et[ct],0)>-1;);return ct}function Im(et,ft){for(var ct=et.length,bt=0;ct--;)et[ct]===ft&&++bt;return bt}var Bm=Go(mm),Dm=Go(ym);function Mm(et){return"\\"+wm[et]}function Lm(et,ft){return et==null?i:et[ft]}function ls(et){return fm.test(et)}function Om(et){return dm.test(et)}function Nm(et){for(var ft,ct=[];!(ft=et.next()).done;)ct.push(ft.value);return ct}function tl(et){var ft=-1,ct=Array(et.size);return et.forEach(function(bt,St){ct[++ft]=[St,bt]}),ct}function Qh(et,ft){return function(ct){return et(ft(ct))}}function ca(et,ft){for(var ct=-1,bt=et.length,St=0,qt=[];++ct-1}function ky(u,v){var w=this.__data__,C=or(w,u);return C<0?(++this.size,w.push([u,v])):w[C][1]=v,this}Hi.prototype.clear=xy,Hi.prototype.delete=_y,Hi.prototype.get=Ey,Hi.prototype.has=Ay,Hi.prototype.set=ky;function Ui(u){var v=-1,w=u==null?0:u.length;for(this.clear();++v=v?u:v)),u}function ci(u,v,w,C,M,z){var Y,Q=v&f,nt=v&g,dt=v&m;if(w&&(Y=M?w(u,C,M,z):w(u)),Y!==i)return Y;if(!le(u))return u;var gt=It(u);if(gt){if(Y=Pp(u),!Q)return He(u,Y)}else{var vt=Se(u),pt=vt==X||vt==J;if(va(u))return Mu(u,Q);if(vt==Et||vt==ut||pt&&!M){if(Y=nt||pt?{}:tf(u),!Q)return nt?pp(u,Hy(Y,u)):yp(u,uu(Y,u))}else{if(!ee[vt])return M?u:{};Y=Sp(u,vt,Q)}}z||(z=new wi);var At=z.get(u);if(At)return At;z.set(u,Y),Sf(u)?u.forEach(function(kt){Y.add(ci(kt,v,w,kt,u,z))}):Rf(u)&&u.forEach(function(kt,Ot){Y.set(Ot,ci(kt,v,w,Ot,u,z))});var Rt=dt?nt?Cl:kl:nt?Ve:be,Mt=gt?i:Rt(u);return Je(Mt||u,function(kt,Ot){Mt&&(Ot=kt,kt=u[Ot]),Js(Y,Ot,ci(kt,v,w,Ot,u,z))}),Y}function Uy(u){var v=be(u);return function(w){return fu(w,u,v)}}function fu(u,v,w){var C=w.length;if(u==null)return!C;for(u=Jt(u);C--;){var M=w[C],z=v[M],Y=u[M];if(Y===i&&!(M in u)||!z(Y))return!1}return!0}function du(u,v,w){if(typeof u!="function")throw new oi(r);return rn(function(){u.apply(i,w)},v)}function Qs(u,v,w,C){var M=-1,z=$n,Y=!0,Q=u.length,nt=[],dt=v.length;if(!Q)return nt;w&&(v=se(v,Qe(w))),C?(z=qo,Y=!1):v.length>=s&&(z=qs,Y=!1,v=new Sa(v));t:for(;++MM?0:M+w),C=C===i||C>M?M:Dt(C),C<0&&(C+=M),C=w>C?0:If(C);w0&&w(Q)?v>1?Ee(Q,v-1,w,C,M):la(M,Q):C||(M[M.length]=Q)}return M}var ol=Hu(),mu=Hu(!0);function Fi(u,v){return u&&ol(u,v,be)}function ll(u,v){return u&&mu(u,v,be)}function cr(u,v){return oa(v,function(w){return qi(u[w])})}function Ia(u,v){v=da(v,u);for(var w=0,C=v.length;u!=null&&wv}function jy(u,v){return u!=null&&Kt.call(u,v)}function qy(u,v){return u!=null&&v in Jt(u)}function Yy(u,v,w){return u>=Pe(v,w)&&u=120&>.length>=120)?new Sa(Y&>):i}gt=u[0];var vt=-1,pt=Q[0];t:for(;++vt-1;)Q!==u&&tr.call(Q,nt,1),tr.call(u,nt,1);return u}function Fu(u,v){for(var w=u?v.length:0,C=w-1;w--;){var M=v[w];if(w==C||M!==z){var z=M;ji(M)?tr.call(u,M,1):pl(u,M)}}return u}function vl(u,v){return u+ar(ou()*(v-u+1))}function rp(u,v,w,C){for(var M=-1,z=ye(ir((v-u)/(w||1)),0),Y=ct(z);z--;)Y[C?z:++M]=u,u+=w;return Y}function ml(u,v){var w="";if(!u||v<1||v>W)return w;do v%2&&(w+=u),v=ar(v/2),v&&(u+=u);while(v);return w}function Lt(u,v){return Bl(sf(u,v,$e),u+"")}function op(u){return hu(ws(u))}function lp(u,v){var w=ws(u);return br(w,Ta(v,0,w.length))}function an(u,v,w,C){if(!le(u))return u;v=da(v,u);for(var M=-1,z=v.length,Y=z-1,Q=u;Q!=null&&++MM?0:M+v),w=w>M?M:w,w<0&&(w+=M),M=v>w?0:w-v>>>0,v>>>=0;for(var z=ct(M);++C>>1,Y=u[z];Y!==null&&!ei(Y)&&(w?Y<=v:Y=s){var dt=v?null:_p(u);if(dt)return qn(dt);Y=!1,M=qs,nt=new Sa}else nt=v?[]:Q;t:for(;++C=C?u:hi(u,v,w)}var Du=Qm||function(u){return _e.clearTimeout(u)};function Mu(u,v){if(v)return u.slice();var w=u.length,C=iu?iu(w):new u.constructor(w);return u.copy(C),C}function _l(u){var v=new u.constructor(u.byteLength);return new Jn(v).set(new Jn(u)),v}function dp(u,v){var w=v?_l(u.buffer):u.buffer;return new u.constructor(w,u.byteOffset,u.byteLength)}function gp(u){var v=new u.constructor(u.source,ph.exec(u));return v.lastIndex=u.lastIndex,v}function vp(u){return Zs?Jt(Zs.call(u)):{}}function Lu(u,v){var w=v?_l(u.buffer):u.buffer;return new u.constructor(w,u.byteOffset,u.length)}function Ou(u,v){if(u!==v){var w=u!==i,C=u===null,M=u===u,z=ei(u),Y=v!==i,Q=v===null,nt=v===v,dt=ei(v);if(!Q&&!dt&&!z&&u>v||z&&Y&&nt&&!Q&&!dt||C&&Y&&nt||!w&&nt||!M)return 1;if(!C&&!z&&!dt&&u=Q)return nt;var dt=w[C];return nt*(dt=="desc"?-1:1)}}return u.index-v.index}function Nu(u,v,w,C){for(var M=-1,z=u.length,Y=w.length,Q=-1,nt=v.length,dt=ye(z-Y,0),gt=ct(nt+dt),vt=!C;++Q1?w[M-1]:i,Y=M>2?w[2]:i;for(z=u.length>3&&typeof z=="function"?(M--,z):i,Y&&De(w[0],w[1],Y)&&(z=M<3?i:z,M=1),v=Jt(v);++C-1?M[z?v[Y]:Y]:i}}function $u(u){return $i(function(v){var w=v.length,C=w,M=li.prototype.thru;for(u&&v.reverse();C--;){var z=v[C];if(typeof z!="function")throw new oi(r);if(M&&!Y&&pr(z)=="wrapper")var Y=new li([],!0)}for(C=Y?C:w;++C1&&Wt.reverse(),gt&&ntQ))return!1;var dt=z.get(u),gt=z.get(v);if(dt&>)return dt==v&>==u;var vt=-1,pt=!0,At=w&p?new Sa:i;for(z.set(u,v),z.set(v,u);++vt1?"& ":"")+v[C],v=v.join(w>2?", ":" "),u.replace(Dv,`{ /* [wrapped with `+v+`] */ `)}function Ip(u){return It(u)||Ma(u)||!!(nu&&u&&u[nu])}function ji(u,v){var w=typeof u;return v=v==null?W:v,!!v&&(w=="number"||w!="symbol"&&$v.test(u))&&u>-1&&u%1==0&&u0){if(++v>=T)return arguments[0]}else v=0;return u.apply(i,arguments)}}function br(u,v){var w=-1,C=u.length,M=C-1;for(v=v===i?C:v;++w1?u[v-1]:i;return w=typeof w=="function"?(u.pop(),w):i,mf(u,w)});function yf(u){var v=O(u);return v.__chain__=!0,v}function Vw(u,v){return v(u),u}function xr(u,v){return v(u)}var $w=$i(function(u){var v=u.length,w=v?u[0]:0,C=this.__wrapped__,M=function(z){return rl(z,u)};return v>1||this.__actions__.length||!(C instanceof Nt)||!ji(w)?this.thru(M):(C=C.slice(w,+w+(v?1:0)),C.__actions__.push({func:xr,args:[M],thisArg:i}),new li(C,this.__chain__).thru(function(z){return v&&!z.length&&z.push(i),z}))});function jw(){return yf(this)}function qw(){return new li(this.value(),this.__chain__)}function Yw(){this.__values__===i&&(this.__values__=Tf(this.value()));var u=this.__index__>=this.__values__.length,v=u?i:this.__values__[this.__index__++];return{done:u,value:v}}function Kw(){return this}function Xw(u){for(var v,w=this;w instanceof rr;){var C=hf(w);C.__index__=0,C.__values__=i,v?M.__wrapped__=C:v=C;var M=C;w=w.__wrapped__}return M.__wrapped__=u,v}function Gw(){var u=this.__wrapped__;if(u instanceof Nt){var v=u;return this.__actions__.length&&(v=new Nt(this)),v=v.reverse(),v.__actions__.push({func:xr,args:[Dl],thisArg:i}),new li(v,this.__chain__)}return this.thru(Dl)}function Zw(){return Iu(this.__wrapped__,this.__actions__)}var Jw=dr(function(u,v,w){Kt.call(u,w)?++u[w]:Ci(u,w,1)});function Qw(u,v,w){var C=It(u)?jh:Vy;return w&&De(u,v,w)&&(v=i),C(u,Ct(v,3))}function t1(u,v){var w=It(u)?oa:vu;return w(u,Ct(v,3))}var e1=Vu(uf),i1=Vu(ff);function a1(u,v){return Ee(_r(u,v),1)}function s1(u,v){return Ee(_r(u,v),q)}function n1(u,v,w){return w=w===i?1:Dt(w),Ee(_r(u,v),w)}function pf(u,v){var w=It(u)?Je:ua;return w(u,Ct(v,3))}function wf(u,v){var w=It(u)?Am:gu;return w(u,Ct(v,3))}var r1=dr(function(u,v,w){Kt.call(u,w)?u[w].push(v):Ci(u,w,[v])});function o1(u,v,w,C){u=Ue(u)?u:ws(u),w=w&&!C?Dt(w):0;var M=u.length;return w<0&&(w=ye(M+w,0)),Fr(u)?w<=M&&u.indexOf(v,w)>-1:!!M&&os(u,v,w)>-1}var l1=Lt(function(u,v,w){var C=-1,M=typeof v=="function",z=Ue(u)?ct(u.length):[];return ua(u,function(Y){z[++C]=M?Ze(v,Y,w):tn(Y,v,w)}),z}),c1=dr(function(u,v,w){Ci(u,w,v)});function _r(u,v){var w=It(u)?se:xu;return w(u,Ct(v,3))}function h1(u,v,w,C){return u==null?[]:(It(v)||(v=v==null?[]:[v]),w=C?i:w,It(w)||(w=w==null?[]:[w]),ku(u,v,w))}var u1=dr(function(u,v,w){u[w?0:1].push(v)},function(){return[[],[]]});function f1(u,v,w){var C=It(u)?Yo:Xh,M=arguments.length<3;return C(u,Ct(v,4),w,M,ua)}function d1(u,v,w){var C=It(u)?km:Xh,M=arguments.length<3;return C(u,Ct(v,4),w,M,gu)}function g1(u,v){var w=It(u)?oa:vu;return w(u,kr(Ct(v,3)))}function v1(u){var v=It(u)?hu:op;return v(u)}function m1(u,v,w){(w?De(u,v,w):v===i)?v=1:v=Dt(v);var C=It(u)?Ny:lp;return C(u,v)}function y1(u){var v=It(u)?zy:hp;return v(u)}function p1(u){if(u==null)return 0;if(Ue(u))return Fr(u)?cs(u):u.length;var v=Se(u);return v==rt||v==oe?u.size:fl(u).length}function w1(u,v,w){var C=It(u)?Ko:up;return w&&De(u,v,w)&&(v=i),C(u,Ct(v,3))}var b1=Lt(function(u,v){if(u==null)return[];var w=v.length;return w>1&&De(u,v[0],v[1])?v=[]:w>2&&De(v[0],v[1],v[2])&&(v=[v[0]]),ku(u,Ee(v,1),[])}),Er=ty||function(){return _e.Date.now()};function x1(u,v){if(typeof v!="function")throw new oi(r);return u=Dt(u),function(){if(--u<1)return v.apply(this,arguments)}}function bf(u,v,w){return v=w?i:v,v=u&&v==null?u.length:v,Vi(u,D,i,i,i,i,v)}function xf(u,v){var w;if(typeof v!="function")throw new oi(r);return u=Dt(u),function(){return--u>0&&(w=v.apply(this,arguments)),u<=1&&(v=i),w}}var Ll=Lt(function(u,v,w){var C=x;if(w.length){var M=ca(w,ys(Ll));C|=S}return Vi(u,C,v,w,M)}),_f=Lt(function(u,v,w){var C=x|_;if(w.length){var M=ca(w,ys(_f));C|=S}return Vi(v,C,u,w,M)});function Ef(u,v,w){v=w?i:v;var C=Vi(u,k,i,i,i,i,i,v);return C.placeholder=Ef.placeholder,C}function Af(u,v,w){v=w?i:v;var C=Vi(u,R,i,i,i,i,i,v);return C.placeholder=Af.placeholder,C}function kf(u,v,w){var C,M,z,Y,Q,nt,dt=0,gt=!1,vt=!1,pt=!0;if(typeof u!="function")throw new oi(r);v=fi(v)||0,le(w)&&(gt=!!w.leading,vt="maxWait"in w,z=vt?ye(fi(w.maxWait)||0,v):z,pt="trailing"in w?!!w.trailing:pt);function At(de){var _i=C,Ki=M;return C=M=i,dt=de,Y=u.apply(Ki,_i),Y}function Rt(de){return dt=de,Q=rn(Ot,v),gt?At(de):Y}function Mt(de){var _i=de-nt,Ki=de-dt,jf=v-_i;return vt?Pe(jf,z-Ki):jf}function kt(de){var _i=de-nt,Ki=de-dt;return nt===i||_i>=v||_i<0||vt&&Ki>=z}function Ot(){var de=Er();if(kt(de))return Wt(de);Q=rn(Ot,Mt(de))}function Wt(de){return Q=i,pt&&C?At(de):(C=M=i,Y)}function ii(){Q!==i&&Du(Q),dt=0,C=nt=M=Q=i}function Me(){return Q===i?Y:Wt(Er())}function ai(){var de=Er(),_i=kt(de);if(C=arguments,M=this,nt=de,_i){if(Q===i)return Rt(nt);if(vt)return Du(Q),Q=rn(Ot,v),At(nt)}return Q===i&&(Q=rn(Ot,v)),Y}return ai.cancel=ii,ai.flush=Me,ai}var _1=Lt(function(u,v){return du(u,1,v)}),E1=Lt(function(u,v,w){return du(u,fi(v)||0,w)});function A1(u){return Vi(u,G)}function Ar(u,v){if(typeof u!="function"||v!=null&&typeof v!="function")throw new oi(r);var w=function(){var C=arguments,M=v?v.apply(this,C):C[0],z=w.cache;if(z.has(M))return z.get(M);var Y=u.apply(this,C);return w.cache=z.set(M,Y)||z,Y};return w.cache=new(Ar.Cache||Ui),w}Ar.Cache=Ui;function kr(u){if(typeof u!="function")throw new oi(r);return function(){var v=arguments;switch(v.length){case 0:return!u.call(this);case 1:return!u.call(this,v[0]);case 2:return!u.call(this,v[0],v[1]);case 3:return!u.call(this,v[0],v[1],v[2])}return!u.apply(this,v)}}function k1(u){return xf(2,u)}var C1=fp(function(u,v){v=v.length==1&&It(v[0])?se(v[0],Qe(Ct())):se(Ee(v,1),Qe(Ct()));var w=v.length;return Lt(function(C){for(var M=-1,z=Pe(C.length,w);++M=v}),Ma=pu(function(){return arguments}())?pu:function(u){return he(u)&&Kt.call(u,"callee")&&!su.call(u,"callee")},It=ct.isArray,H1=zh?Qe(zh):Xy;function Ue(u){return u!=null&&Cr(u.length)&&!qi(u)}function fe(u){return he(u)&&Ue(u)}function U1(u){return u===!0||u===!1||he(u)&&Be(u)==E}var va=iy||Xl,V1=Wh?Qe(Wh):Gy;function $1(u){return he(u)&&u.nodeType===1&&!on(u)}function j1(u){if(u==null)return!0;if(Ue(u)&&(It(u)||typeof u=="string"||typeof u.splice=="function"||va(u)||ps(u)||Ma(u)))return!u.length;var v=Se(u);if(v==rt||v==oe)return!u.size;if(nn(u))return!fl(u).length;for(var w in u)if(Kt.call(u,w))return!1;return!0}function q1(u,v){return en(u,v)}function Y1(u,v,w){w=typeof w=="function"?w:i;var C=w?w(u,v):i;return C===i?en(u,v,i,w):!!C}function Nl(u){if(!he(u))return!1;var v=Be(u);return v==N||v==B||typeof u.message=="string"&&typeof u.name=="string"&&!on(u)}function K1(u){return typeof u=="number"&&ru(u)}function qi(u){if(!le(u))return!1;var v=Be(u);return v==X||v==J||v==ht||v==Ge}function Ff(u){return typeof u=="number"&&u==Dt(u)}function Cr(u){return typeof u=="number"&&u>-1&&u%1==0&&u<=W}function le(u){var v=typeof u;return u!=null&&(v=="object"||v=="function")}function he(u){return u!=null&&typeof u=="object"}var Rf=Hh?Qe(Hh):Jy;function X1(u,v){return u===v||ul(u,v,Rl(v))}function G1(u,v,w){return w=typeof w=="function"?w:i,ul(u,v,Rl(v),w)}function Z1(u){return Pf(u)&&u!=+u}function J1(u){if(Mp(u))throw new St(n);return wu(u)}function Q1(u){return u===null}function tb(u){return u==null}function Pf(u){return typeof u=="number"||he(u)&&Be(u)==yt}function on(u){if(!he(u)||Be(u)!=Et)return!1;var v=Qn(u);if(v===null)return!0;var w=Kt.call(v,"constructor")&&v.constructor;return typeof w=="function"&&w instanceof w&&Xn.call(w)==Gm}var zl=Uh?Qe(Uh):Qy;function eb(u){return Ff(u)&&u>=-W&&u<=W}var Sf=Vh?Qe(Vh):tp;function Fr(u){return typeof u=="string"||!It(u)&&he(u)&&Be(u)==Vt}function ei(u){return typeof u=="symbol"||he(u)&&Be(u)==Gt}var ps=$h?Qe($h):ep;function ib(u){return u===i}function ab(u){return he(u)&&Se(u)==$s}function sb(u){return he(u)&&Be(u)==xv}var nb=yr(dl),rb=yr(function(u,v){return u<=v});function Tf(u){if(!u)return[];if(Ue(u))return Fr(u)?pi(u):He(u);if(Ys&&u[Ys])return Nm(u[Ys]());var v=Se(u),w=v==rt?tl:v==oe?qn:ws;return w(u)}function Yi(u){if(!u)return u===0?u:0;if(u=fi(u),u===q||u===-q){var v=u<0?-1:1;return v*j}return u===u?u:0}function Dt(u){var v=Yi(u),w=v%1;return v===v?w?v-w:v:0}function If(u){return u?Ta(Dt(u),0,U):0}function fi(u){if(typeof u=="number")return u;if(ei(u))return K;if(le(u)){var v=typeof u.valueOf=="function"?u.valueOf():u;u=le(v)?v+"":v}if(typeof u!="string")return u===0?u:+u;u=Gh(u);var w=Hv.test(u);return w||Vv.test(u)?xm(u.slice(2),w?2:8):Wv.test(u)?K:+u}function Bf(u){return Ri(u,Ve(u))}function ob(u){return u?Ta(Dt(u),-W,W):u===0?u:0}function Xt(u){return u==null?"":ti(u)}var lb=vs(function(u,v){if(nn(v)||Ue(v)){Ri(v,be(v),u);return}for(var w in v)Kt.call(v,w)&&Js(u,w,v[w])}),Df=vs(function(u,v){Ri(v,Ve(v),u)}),Mf=vs(function(u,v,w,C){Ri(v,Ve(v),u,C)}),Wl=vs(function(u,v,w,C){Ri(v,be(v),u,C)}),cb=$i(rl);function hb(u,v){var w=gs(u);return v==null?w:uu(w,v)}var ub=Lt(function(u,v){u=Jt(u);var w=-1,C=v.length,M=C>2?v[2]:i;for(M&&De(v[0],v[1],M)&&(C=1);++w1),z}),Ri(u,Cl(u),w),C&&(w=ci(w,f|g|m,Ep));for(var M=v.length;M--;)pl(w,v[M]);return w});function Pb(u,v){return Of(u,kr(Ct(v)))}var Sb=$i(function(u,v){return u==null?{}:sp(u,v)});function Of(u,v){if(u==null)return{};var w=se(Cl(u),function(C){return[C]});return v=Ct(v),Cu(u,w,function(C,M){return v(C,M[0])})}function Tb(u,v,w){v=da(v,u);var C=-1,M=v.length;for(M||(M=1,u=i);++Cv){var C=u;u=v,v=C}if(w||u%1||v%1){var M=ou();return Pe(u+M*(v-u+bm("1e-"+((M+"").length-1))),v)}return vl(u,v)}var Ub=ms(function(u,v,w){return v=v.toLowerCase(),u+(w?Wf(v):v)});function Wf(u){return Vl(Xt(u).toLowerCase())}function Hf(u){return u=Xt(u),u&&u.replace(jv,Bm).replace(hm,"")}function Vb(u,v,w){u=Xt(u),v=ti(v);var C=u.length;w=w===i?C:Ta(Dt(w),0,C);var M=w;return w-=v.length,w>=0&&u.slice(w,M)==v}function $b(u){return u=Xt(u),u&&Cv.test(u)?u.replace(vh,Dm):u}function jb(u){return u=Xt(u),u&&Iv.test(u)?u.replace(Oo,"\\$&"):u}var qb=ms(function(u,v,w){return u+(w?"-":"")+v.toLowerCase()}),Yb=ms(function(u,v,w){return u+(w?" ":"")+v.toLowerCase()}),Kb=Uu("toLowerCase");function Xb(u,v,w){u=Xt(u),v=Dt(v);var C=v?cs(u):0;if(!v||C>=v)return u;var M=(v-C)/2;return mr(ar(M),w)+u+mr(ir(M),w)}function Gb(u,v,w){u=Xt(u),v=Dt(v);var C=v?cs(u):0;return v&&C>>0,w?(u=Xt(u),u&&(typeof v=="string"||v!=null&&!zl(v))&&(v=ti(v),!v&&ls(u))?ga(pi(u),0,w):u.split(v,w)):[]}var ax=ms(function(u,v,w){return u+(w?" ":"")+Vl(v)});function sx(u,v,w){return u=Xt(u),w=w==null?0:Ta(Dt(w),0,u.length),v=ti(v),u.slice(w,w+v.length)==v}function nx(u,v,w){var C=O.templateSettings;w&&De(u,v,w)&&(v=i),u=Xt(u),v=Wl({},v,C,Xu);var M=Wl({},v.imports,C.imports,Xu),z=be(M),Y=Qo(M,z);Je(z,function(kt){if(yh.test(kt))throw new St(l)});var Q,nt,dt=0,gt=v.interpolate||Hn,vt="__p += '",pt=el((v.escape||Hn).source+"|"+gt.source+"|"+(gt===mh?zv:Hn).source+"|"+(v.evaluate||Hn).source+"|$","g"),At="//# sourceURL="+(Kt.call(v,"sourceURL")?(v.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++vm+"]")+` `;u.replace(pt,function(kt,Ot,Wt,ii,Me,ai){return Wt||(Wt=ii),vt+=u.slice(dt,ai).replace(qv,Mm),Ot&&(Q=!0,vt+=`' + __e(`+Ot+`) + '`),Me&&(nt=!0,vt+=`'; `+Me+`; __p += '`),Wt&&(vt+=`' + ((__t = (`+Wt+`)) == null ? '' : __t) + '`),dt=ai+kt.length,kt}),vt+=`'; `;var Rt=Kt.call(v,"variable")&&v.variable;if(!Rt)vt=`with (obj) { `+vt+` } `;else if(yh.test(Rt))throw new St(o);vt=(nt?vt.replace(_v,""):vt).replace(Ev,"$1").replace(Av,"$1;"),vt="function("+(Rt||"obj")+`) { `+(Rt?"":`obj || (obj = {}); `)+"var __t, __p = ''"+(Q?", __e = _.escape":"")+(nt?`, __j = Array.prototype.join; function print() { __p += __j.call(arguments, '') } `:`; `)+vt+`return __p }`;var Mt=Vf(function(){return qt(z,At+"return "+vt).apply(i,Y)});if(Mt.source=vt,Nl(Mt))throw Mt;return Mt}function rx(u){return Xt(u).toLowerCase()}function ox(u){return Xt(u).toUpperCase()}function lx(u,v,w){if(u=Xt(u),u&&(w||v===i))return Gh(u);if(!u||!(v=ti(v)))return u;var C=pi(u),M=pi(v),z=Zh(C,M),Y=Jh(C,M)+1;return ga(C,z,Y).join("")}function cx(u,v,w){if(u=Xt(u),u&&(w||v===i))return u.slice(0,tu(u)+1);if(!u||!(v=ti(v)))return u;var C=pi(u),M=Jh(C,pi(v))+1;return ga(C,0,M).join("")}function hx(u,v,w){if(u=Xt(u),u&&(w||v===i))return u.replace(No,"");if(!u||!(v=ti(v)))return u;var C=pi(u),M=Zh(C,pi(v));return ga(C,M).join("")}function ux(u,v){var w=F,C=P;if(le(v)){var M="separator"in v?v.separator:M;w="length"in v?Dt(v.length):w,C="omission"in v?ti(v.omission):C}u=Xt(u);var z=u.length;if(ls(u)){var Y=pi(u);z=Y.length}if(w>=z)return u;var Q=w-cs(C);if(Q<1)return C;var nt=Y?ga(Y,0,Q).join(""):u.slice(0,Q);if(M===i)return nt+C;if(Y&&(Q+=nt.length-Q),zl(M)){if(u.slice(Q).search(M)){var dt,gt=nt;for(M.global||(M=el(M.source,Xt(ph.exec(M))+"g")),M.lastIndex=0;dt=M.exec(gt);)var vt=dt.index;nt=nt.slice(0,vt===i?Q:vt)}}else if(u.indexOf(ti(M),Q)!=Q){var pt=nt.lastIndexOf(M);pt>-1&&(nt=nt.slice(0,pt))}return nt+C}function fx(u){return u=Xt(u),u&&kv.test(u)?u.replace(gh,Um):u}var dx=ms(function(u,v,w){return u+(w?" ":"")+v.toUpperCase()}),Vl=Uu("toUpperCase");function Uf(u,v,w){return u=Xt(u),v=w?i:v,v===i?Om(u)?jm(u):Rm(u):u.match(v)||[]}var Vf=Lt(function(u,v){try{return Ze(u,i,v)}catch(w){return Nl(w)?w:new St(w)}}),gx=$i(function(u,v){return Je(v,function(w){w=bi(w),Ci(u,w,Ll(u[w],u))}),u});function vx(u){var v=u==null?0:u.length,w=Ct();return u=v?se(u,function(C){if(typeof C[1]!="function")throw new oi(r);return[w(C[0]),C[1]]}):[],Lt(function(C){for(var M=-1;++MW)return[];var w=U,C=Pe(u,U);v=Ct(v),u-=U;for(var M=Jo(C,v);++w0||v<0)?new Nt(w):(u<0?w=w.takeRight(-u):u&&(w=w.drop(u)),v!==i&&(v=Dt(v),w=v<0?w.dropRight(-v):w.take(v-u)),w)},Nt.prototype.takeRightWhile=function(u){return this.reverse().takeWhile(u).reverse()},Nt.prototype.toArray=function(){return this.take(U)},Fi(Nt.prototype,function(u,v){var w=/^(?:filter|find|map|reject)|While$/.test(v),C=/^(?:head|last)$/.test(v),M=O[C?"take"+(v=="last"?"Right":""):v],z=C||/^find/.test(v);!M||(O.prototype[v]=function(){var Y=this.__wrapped__,Q=C?[1]:arguments,nt=Y instanceof Nt,dt=Q[0],gt=nt||It(Y),vt=function(Ot){var Wt=M.apply(O,la([Ot],Q));return C&&pt?Wt[0]:Wt};gt&&w&&typeof dt=="function"&&dt.length!=1&&(nt=gt=!1);var pt=this.__chain__,At=!!this.__actions__.length,Rt=z&&!pt,Mt=nt&&!At;if(!z&>){Y=Mt?Y:new Nt(this);var kt=u.apply(Y,Q);return kt.__actions__.push({func:xr,args:[vt],thisArg:i}),new li(kt,pt)}return Rt&&Mt?u.apply(this,Q):(kt=this.thru(vt),Rt?C?kt.value()[0]:kt.value():kt)})}),Je(["pop","push","shift","sort","splice","unshift"],function(u){var v=Yn[u],w=/^(?:push|sort|unshift)$/.test(u)?"tap":"thru",C=/^(?:pop|shift)$/.test(u);O.prototype[u]=function(){var M=arguments;if(C&&!this.__chain__){var z=this.value();return v.apply(It(z)?z:[],M)}return this[w](function(Y){return v.apply(It(Y)?Y:[],M)})}}),Fi(Nt.prototype,function(u,v){var w=O[v];if(w){var C=w.name+"";Kt.call(ds,C)||(ds[C]=[]),ds[C].push({name:v,func:w})}}),ds[gr(i,_).name]=[{name:"wrapper",func:i}],Nt.prototype.clone=dy,Nt.prototype.reverse=gy,Nt.prototype.value=vy,O.prototype.at=$w,O.prototype.chain=jw,O.prototype.commit=qw,O.prototype.next=Yw,O.prototype.plant=Xw,O.prototype.reverse=Gw,O.prototype.toJSON=O.prototype.valueOf=O.prototype.value=Zw,O.prototype.first=O.prototype.head,Ys&&(O.prototype[Ys]=Kw),O},hs=qm();Fa?((Fa.exports=hs)._=hs,$o._=hs):_e._=hs}).call(Oe)})($c,$c.exports);const HF=$c.exports;export{E6 as M,HF as _,_F as a,AF as b,kF as c,CF as d,SF as e,xF as f,EF as g,RF as h,TF as i,IF as j,BF as k,zF as l,OF as m,MF as n,LF as o,WF as p,NF as q,FF as r,PF as s,DF as t};