scada-engine 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (120) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +193 -0
  3. package/dist/draco/gltf/draco_decoder.js +33 -0
  4. package/dist/draco/gltf/draco_decoder.wasm +0 -0
  5. package/dist/draco/gltf/draco_encoder.js +33 -0
  6. package/dist/draco/gltf/draco_wasm_wrapper.js +116 -0
  7. package/dist/index.d.ts +3 -0
  8. package/dist/scada-engine.css +1 -0
  9. package/dist/scada-engine.es.js +22936 -0
  10. package/dist/scada-engine.umd.js +1356 -0
  11. package/dist/src/features/canvas/components/CanvasArea.d.ts +4 -0
  12. package/dist/src/features/canvas/components/CanvasConfigPanel.d.ts +2 -0
  13. package/dist/src/features/canvas/index.d.ts +9 -0
  14. package/dist/src/features/canvas/managers/configWatcher.d.ts +49 -0
  15. package/dist/src/features/canvas/managers/dataHandler.d.ts +70 -0
  16. package/dist/src/features/canvas/managers/layerManager.d.ts +88 -0
  17. package/dist/src/features/canvas/operations/edgeOperations.d.ts +52 -0
  18. package/dist/src/features/canvas/operations/graphOperations.d.ts +85 -0
  19. package/dist/src/features/canvas/operations/nodeOperations.d.ts +77 -0
  20. package/dist/src/features/data-source/components/DataSourceDialog.d.ts +26 -0
  21. package/dist/src/features/data-source/components/MappingConfigurator.d.ts +27 -0
  22. package/dist/src/features/data-source/index.d.ts +14 -0
  23. package/dist/src/features/data-source/services/dataBindingService.d.ts +86 -0
  24. package/dist/src/features/data-source/services/dataParser.d.ts +110 -0
  25. package/dist/src/features/data-source/services/dataSourceManager.d.ts +127 -0
  26. package/dist/src/features/data-source/services/httpService.d.ts +73 -0
  27. package/dist/src/features/data-source/services/mqttService.d.ts +110 -0
  28. package/dist/src/features/data-source/services/sseService.d.ts +75 -0
  29. package/dist/src/features/data-source/services/websocketService.d.ts +67 -0
  30. package/dist/src/features/data-source/types/dataAdapter.d.ts +184 -0
  31. package/dist/src/features/data-source/types/device.d.ts +131 -0
  32. package/dist/src/features/preview/Preview.d.ts +2 -0
  33. package/dist/src/features/preview/components/NodeTooltip.d.ts +62 -0
  34. package/dist/src/features/preview/index.d.ts +1 -0
  35. package/dist/src/features/property-panel/PropertyPanel.d.ts +45 -0
  36. package/dist/src/features/property-panel/cards/BindingCard.d.ts +39 -0
  37. package/dist/src/features/property-panel/cards/EventCard.d.ts +63 -0
  38. package/dist/src/features/property-panel/index.d.ts +6 -0
  39. package/dist/src/features/property-panel/tabs/BasicPropertiesTab.d.ts +51 -0
  40. package/dist/src/features/property-panel/tabs/DataPropertiesTab.d.ts +24 -0
  41. package/dist/src/features/property-panel/tabs/EdgePropertiesTab.d.ts +22 -0
  42. package/dist/src/features/workflow/WorkflowDialog.d.ts +37 -0
  43. package/dist/src/features/workflow/WorkflowEditor.d.ts +38 -0
  44. package/dist/src/features/workflow/components/AddNodeMenu.d.ts +32 -0
  45. package/dist/src/features/workflow/components/ElementSelector.d.ts +37 -0
  46. package/dist/src/features/workflow/components/PropertyPanel.d.ts +27 -0
  47. package/dist/src/features/workflow/components/WorkflowToolbar.d.ts +24 -0
  48. package/dist/src/features/workflow/components/node-configs/ClearTimerConfig.d.ts +20 -0
  49. package/dist/src/features/workflow/components/node-configs/ConditionConfig.d.ts +20 -0
  50. package/dist/src/features/workflow/components/node-configs/CustomCodeConfig.d.ts +20 -0
  51. package/dist/src/features/workflow/components/node-configs/GetPropertyConfig.d.ts +20 -0
  52. package/dist/src/features/workflow/components/node-configs/HttpRequestConfig.d.ts +20 -0
  53. package/dist/src/features/workflow/components/node-configs/SetPropertyConfig.d.ts +20 -0
  54. package/dist/src/features/workflow/components/node-configs/TimerConfig.d.ts +20 -0
  55. package/dist/src/features/workflow/config/nodeConfigRegistry.d.ts +5 -0
  56. package/dist/src/features/workflow/index.d.ts +6 -0
  57. package/dist/src/features/workflow/services/canvasElementService.d.ts +31 -0
  58. package/dist/src/features/workflow/types/element.d.ts +16 -0
  59. package/dist/src/features/workflow/types/node.d.ts +70 -0
  60. package/dist/src/index.d.ts +161 -0
  61. package/dist/src/main.d.ts +1 -0
  62. package/dist/src/scada-components/canvas/config.d.ts +17 -0
  63. package/dist/src/scada-components/canvas/index.d.ts +6 -0
  64. package/dist/src/scada-components/canvas/manager.d.ts +95 -0
  65. package/dist/src/scada-components/canvas/types.d.ts +77 -0
  66. package/dist/src/scada-components/chart/echarts-gauge/EChartsGauge.d.ts +14 -0
  67. package/dist/src/scada-components/chart/echarts-gauge/index.d.ts +6 -0
  68. package/dist/src/scada-components/chart/echarts-gauge/presets.d.ts +18 -0
  69. package/dist/src/scada-components/chart/echarts-line/EChartsLine.d.ts +14 -0
  70. package/dist/src/scada-components/chart/echarts-line/index.d.ts +6 -0
  71. package/dist/src/scada-components/chart/echarts-line/presets.d.ts +13 -0
  72. package/dist/src/scada-components/chart/index.d.ts +5 -0
  73. package/dist/src/scada-components/index.d.ts +7 -0
  74. package/dist/src/scada-components/registry.d.ts +117 -0
  75. package/dist/src/scada-components/types.d.ts +108 -0
  76. package/dist/src/shared/animation/animationEngine.d.ts +68 -0
  77. package/dist/src/shared/animation/animationScheduler.d.ts +85 -0
  78. package/dist/src/shared/animation/index.d.ts +2 -0
  79. package/dist/src/shared/components/ComponentLibrary.d.ts +34 -0
  80. package/dist/src/shared/components/ContextMenu.d.ts +63 -0
  81. package/dist/src/shared/components/Footer.d.ts +41 -0
  82. package/dist/src/shared/components/Header.d.ts +73 -0
  83. package/dist/src/shared/components/dialogs/AttributeConfigDialog.d.ts +39 -0
  84. package/dist/src/shared/components/dialogs/CustomCodeDialog.d.ts +30 -0
  85. package/dist/src/shared/components/dialogs/WorkflowSelectorDialog.d.ts +15 -0
  86. package/dist/src/shared/components/index.d.ts +8 -0
  87. package/dist/src/shared/components/selectors/ComponentPointSelector.d.ts +29 -0
  88. package/dist/src/shared/managers/contextMenuManager.d.ts +27 -0
  89. package/dist/src/shared/managers/eventManager.d.ts +62 -0
  90. package/dist/src/shared/managers/index.d.ts +3 -0
  91. package/dist/src/shared/managers/workerManager.d.ts +57 -0
  92. package/dist/src/shared/types/binding.d.ts +75 -0
  93. package/dist/src/shared/types/index.d.ts +2 -0
  94. package/dist/src/shared/types/workflow.d.ts +195 -0
  95. package/dist/src/shared/utils/commonUtils.d.ts +83 -0
  96. package/dist/src/shared/utils/edgeAnimationUtils.d.ts +16 -0
  97. package/dist/src/shared/utils/eventUtils.d.ts +43 -0
  98. package/dist/src/shared/utils/fileUtils.d.ts +43 -0
  99. package/dist/src/shared/utils/index.d.ts +7 -0
  100. package/dist/src/shared/utils/messageUtils.d.ts +56 -0
  101. package/dist/src/shared/utils/nodePropertyUtils.d.ts +33 -0
  102. package/dist/src/shared/utils/storageUtils.d.ts +32 -0
  103. package/dist/src/svg/core/index.d.ts +7 -0
  104. package/dist/src/svg/core/loader.d.ts +71 -0
  105. package/dist/src/svg/core/parser.d.ts +41 -0
  106. package/dist/src/svg/core/types.d.ts +297 -0
  107. package/dist/src/svg/helpers/demo.d.ts +20 -0
  108. package/dist/src/svg/helpers/index.d.ts +5 -0
  109. package/dist/src/svg/helpers/utils.d.ts +25 -0
  110. package/dist/src/svg/index.d.ts +9 -0
  111. package/dist/src/svg/rendering/SVGRenderer.d.ts +22 -0
  112. package/dist/src/svg/rendering/animationTemplates.d.ts +82 -0
  113. package/dist/src/svg/rendering/index.d.ts +6 -0
  114. package/dist/src/utils/authCrypto.d.ts +16 -0
  115. package/dist/src/utils/dracoLoader.d.ts +3 -0
  116. package/dist/src/utils/index.d.ts +29 -0
  117. package/dist/src/utils/viewportCulling.d.ts +63 -0
  118. package/dist/src/workers/dataProcessor.worker.d.ts +21 -0
  119. package/dist/utils-Ncgt7Dqu.js +1057 -0
  120. package/package.json +85 -0
@@ -0,0 +1,1356 @@
1
+ (function(Te,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("@antv/x6"),require("@antv/x6-plugin-selection"),require("@antv/x6-plugin-snapline"),require("echarts")):typeof define=="function"&&define.amd?define(["exports","vue","@antv/x6","@antv/x6-plugin-selection","@antv/x6-plugin-snapline","echarts"],e):(Te=typeof globalThis<"u"?globalThis:Te||self,e(Te.ScadaEngine={},Te.Vue,Te.X6,Te.X6PluginSelection,Te.X6PluginSnapline,Te.echarts))})(this,function(Te,e,Ae,Qt,Dr,Cc){"use strict";var Yv=Object.defineProperty;var mc=Te=>{throw TypeError(Te)};var Jv=(Te,e,Ae)=>e in Te?Yv(Te,e,{enumerable:!0,configurable:!0,writable:!0,value:Ae}):Te[e]=Ae;var he=(Te,e,Ae)=>Jv(Te,typeof e!="symbol"?e+"":e,Ae),os=(Te,e,Ae)=>e.has(Te)||mc("Cannot "+Ae);var q=(Te,e,Ae)=>(os(Te,e,"read from private field"),Ae?Ae.call(Te):e.get(Te)),Fe=(Te,e,Ae)=>e.has(Te)?mc("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(Te):e.set(Te,Ae),Re=(Te,e,Ae,Qt)=>(os(Te,e,"write to private field"),Qt?Qt.call(Te,Ae):e.set(Te,Ae),Ae),Oe=(Te,e,Ae)=>(os(Te,e,"access private method"),Ae);var Nn=(Te,e,Ae,Qt)=>({set _(Dr){Re(Te,e,Dr,Ae)},get _(){return q(Te,e,Qt)}});/*!
2
+ * @nywqs/scada-engine v1.1.31
3
+ * Copyright (c) 2025 leoncheng
4
+ * Licensed under proprietary license - see LICENSE file
5
+ * Contact: nywqs@outlook.com
6
+ */function xc(d){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(d){for(const r in d)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(d,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>d[r]})}}return t.default=d,Object.freeze(t)}const ds=xc(Cc);var Ac=function(d,t,r,n){var i=arguments.length,s=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(d,t,r,n);else for(var a=d.length-1;a>=0;a--)(o=d[a])&&(s=(i<3?o(s):i>3?o(t,r,s):o(t,r))||s);return i>3&&s&&Object.defineProperty(t,r,s),s};class us extends Ae.View{get model(){return this.graph.model}get view(){return this.graph.renderer.findViewByCell(this.node)}get containerClassName(){return this.prefixClassName("widget-transform")}get resizeClassName(){return`${this.containerClassName}-resize`}get rotateClassName(){return`${this.containerClassName}-rotate`}constructor(t,r,n){super(),this.node=r,this.graph=n,this.options=Object.assign(Object.assign({},tt.defaultOptions),t),this.render(),this.startListening()}startListening(){this.delegateEvents({[`mousedown .${this.resizeClassName}`]:"startResizing",[`touchstart .${this.resizeClassName}`]:"startResizing",[`mousedown .${this.rotateClassName}`]:"startRotating",[`touchstart .${this.rotateClassName}`]:"startRotating"}),this.model.on("*",this.update,this),this.graph.on("scale",this.update,this),this.graph.on("translate",this.update,this),this.node.on("removed",this.remove,this),this.model.on("reseted",this.remove,this),this.view.on("cell:knob:mousedown",this.onKnobMouseDown,this),this.view.on("cell:knob:mouseup",this.onKnobMouseUp,this)}stopListening(){this.undelegateEvents(),this.model.off("*",this.update,this),this.graph.off("scale",this.update,this),this.graph.off("translate",this.update,this),this.node.off("removed",this.remove,this),this.model.off("reseted",this.remove,this),this.view.off("cell:knob:mousedown",this.onKnobMouseDown,this),this.view.off("cell:knob:mouseup",this.onKnobMouseUp,this)}renderHandles(){this.container=document.createElement("div");const t=document.createElement("div");Ae.Dom.attr(t,"draggable","false");const r=t.cloneNode(!0);Ae.Dom.addClass(r,this.rotateClassName);const n=tt.POSITIONS.map(i=>{const s=t.cloneNode(!0);return Ae.Dom.addClass(s,this.resizeClassName),Ae.Dom.attr(s,"data-position",i),s});this.empty(),Ae.Dom.append(this.container,[...n,r])}render(){return this.renderHandles(),this.view&&this.view.addClass(tt.NODE_CLS),Ae.Dom.addClass(this.container,this.containerClassName),Ae.Dom.toggleClass(this.container,"no-orth-resize",this.options.preserveAspectRatio||!this.options.orthogonalResizing),Ae.Dom.toggleClass(this.container,"no-resize",!this.options.resizable),Ae.Dom.toggleClass(this.container,"no-rotate",!this.options.rotatable),this.options.className&&Ae.Dom.addClass(this.container,this.options.className),this.graph.container.appendChild(this.container),this.update()}update(){const t=this.graph.matrix(),r=this.node.getBBox();r.x*=t.a,r.x+=t.e,r.y*=t.d,r.y+=t.f,r.width*=t.a,r.height*=t.d;const n=Ae.Angle.normalize(this.node.getAngle()),i=n!==0?`rotate(${n}deg)`:"";return Ae.Dom.css(this.container,{transform:i,width:r.width,height:r.height,left:r.x,top:r.y}),this.updateResizerDirections(),this}remove(){return this.view&&this.view.removeClass(tt.NODE_CLS),super.remove()}onKnobMouseDown(){this.startHandle()}onKnobMouseUp(){this.stopHandle()}updateResizerDirections(){const t=Ae.Angle.normalize(this.node.getAngle()),r=Math.floor(t*(tt.DIRECTIONS.length/360));if(r!==this.prevShift){const n=tt.DIRECTIONS.slice(r).concat(tt.DIRECTIONS.slice(0,r)),i=o=>`${this.containerClassName}-cursor-${o}`;this.container.querySelectorAll(`.${this.resizeClassName}`).forEach((o,a)=>{Ae.Dom.removeClass(o,tt.DIRECTIONS.map(l=>i(l)).join(" ")),Ae.Dom.addClass(o,i(n[a]))}),this.prevShift=r}}getTrueDirection(t){const r=Ae.Angle.normalize(this.node.getAngle());let n=tt.POSITIONS.indexOf(t);return n+=Math.floor(r*(tt.POSITIONS.length/360)),n%=tt.POSITIONS.length,tt.POSITIONS[n]}toValidResizeDirection(t){return{top:"top-left",bottom:"bottom-right",left:"bottom-left",right:"top-right"}[t]||t}startResizing(t){t.stopPropagation(),this.model.startBatch("resize",{cid:this.cid});const r=Ae.Dom.attr(t.target,"data-position");this.prepareResizing(t,r),this.startAction(t)}prepareResizing(t,r){const n=this.getTrueDirection(r);let i=0,s=0;r.split("-").forEach(c=>{i={left:-1,right:1}[c]||i,s={top:-1,bottom:1}[c]||s});const o=this.toValidResizeDirection(r),a={"top-right":"bottomLeft","top-left":"bottomRight","bottom-left":"topRight","bottom-right":"topLeft"}[o],l=Ae.Angle.normalize(this.node.getAngle());this.setEventData(t,{selector:a,direction:o,trueDirection:n,relativeDirection:r,angle:l,resizeX:i,resizeY:s,action:"resizing"})}startRotating(t){t.stopPropagation(),this.model.startBatch("rotate",{cid:this.cid});const r=this.node.getBBox().getCenter(),n=this.normalizeEvent(t),i=this.graph.snapToGrid(n.clientX,n.clientY);this.setEventData(t,{center:r,action:"rotating",angle:Ae.Angle.normalize(this.node.getAngle()),start:Ae.Point.create(i).theta(r)}),this.startAction(t)}onMouseMove(t){const r=this.graph.findViewByCell(this.node);let n=this.getEventData(t);if(n.action){const i=this.normalizeEvent(t);let s=i.clientX,o=i.clientY;const a=this.graph.getPlugin("scroller"),l=this.options.restrictedResizing;if(l===!0||typeof l=="number"){const m=l===!0?0:l,f=a?Math.max(m,8):m,E=this.graph.container.getBoundingClientRect();s=Ae.NumberExt.clamp(s,E.left+f,E.right-f),o=Ae.NumberExt.clamp(o,E.top+f,E.bottom-f)}else this.options.autoScrollOnResizing&&a&&a.autoScroll(s,o);const c=this.graph.snapToGrid(s,o),u=this.graph.getGridSize(),p=this.node,h=this.options;if(n.action==="resizing"){n=n,n.resized||(r&&(r.addClass("node-resizing"),this.notify("node:resize",t,r)),n.resized=!0);const m=p.getBBox(),f=Ae.Point.create(c).rotate(n.angle,m.getCenter()).diff(m[n.selector]);let E=n.resizeX?f.x*n.resizeX:m.width,N=n.resizeY?f.y*n.resizeY:m.height;const k=E,g=N;if(E=Ae.GeometryUtil.snapToGrid(E,u),N=Ae.GeometryUtil.snapToGrid(N,u),E=Math.max(E,h.minWidth||u),N=Math.max(N,h.minHeight||u),E=Math.min(E,h.maxWidth||1/0),N=Math.min(N,h.maxHeight||1/0),h.preserveAspectRatio){const _=m.width*N/m.height,S=m.height*E/m.width;E<_?N=S:E=_}const v=n.relativeDirection;if(h.allowReverse&&(k<=-E||g<=-N)){let _;v==="left"?k<=-E&&(_="right"):v==="right"?k<=-E&&(_="left"):v==="top"?g<=-N&&(_="bottom"):v==="bottom"?g<=-N&&(_="top"):v==="top-left"?k<=-E&&g<=-N?_="bottom-right":k<=-E?_="top-right":g<=-N&&(_="bottom-left"):v==="top-right"?k<=-E&&g<=-N?_="bottom-left":k<=-E?_="top-left":g<=-N&&(_="bottom-right"):v==="bottom-left"?k<=-E&&g<=-N?_="top-right":k<=-E?_="bottom-right":g<=-N&&(_="top-left"):v==="bottom-right"&&(k<=-E&&g<=-N?_="top-left":k<=-E?_="bottom-left":g<=-N&&(_="top-right"));const S=_;this.stopHandle();const B=this.container.querySelector(`.${this.resizeClassName}[data-position="${S}"]`);this.startHandle(B),this.prepareResizing(t,S),this.onMouseMove(t)}if(m.width!==E||m.height!==N){const _={ui:!0,direction:n.direction,relativeDirection:n.relativeDirection,trueDirection:n.trueDirection,minWidth:h.minWidth,minHeight:h.minHeight,maxWidth:h.maxWidth,maxHeight:h.maxHeight,preserveAspectRatio:h.preserveAspectRatio===!0};p.resize(E,N,_),this.notify("node:resizing",t,r)}}else if(n.action==="rotating"){n=n,n.rotated||(r&&(r.addClass("node-rotating"),this.notify("node:rotate",t,r)),n.rotated=!0);const m=p.getAngle(),f=n.start-Ae.Point.create(c).theta(n.center);let E=n.angle+f;h.rotateGrid&&(E=Ae.GeometryUtil.snapToGrid(E,h.rotateGrid)),E=Ae.Angle.normalize(E),m!==E&&(p.rotate(E,{absolute:!0}),this.notify("node:rotating",t,r))}}}onMouseUp(t){const r=this.getEventData(t);r.action&&(this.stopAction(t),this.model.stopBatch(r.action==="resizing"?"resize":"rotate",{cid:this.cid}))}startHandle(t){if(this.handle=t||null,Ae.Dom.addClass(this.container,`${this.containerClassName}-active`),t){Ae.Dom.addClass(t,`${this.containerClassName}-active-handle`);const r=t.getAttribute("data-position");if(r){const n=tt.DIRECTIONS[tt.POSITIONS.indexOf(r)];Ae.Dom.addClass(this.container,`${this.containerClassName}-cursor-${n}`)}}}stopHandle(){if(Ae.Dom.removeClass(this.container,`${this.containerClassName}-active`),this.handle){Ae.Dom.removeClass(this.handle,`${this.containerClassName}-active-handle`);const t=this.handle.getAttribute("data-position");if(t){const r=tt.DIRECTIONS[tt.POSITIONS.indexOf(t)];Ae.Dom.removeClass(this.container,`${this.containerClassName}-cursor-${r}`)}this.handle=null}}startAction(t){this.startHandle(t.target),this.graph.view.undelegateEvents(),this.delegateDocumentEvents(tt.documentEvents,t.data)}stopAction(t){this.stopHandle(),this.undelegateDocumentEvents(),this.graph.view.delegateEvents();const r=this.graph.findViewByCell(this.node),n=this.getEventData(t);r&&(r.removeClass(`node-${n.action}`),n.action==="resizing"&&n.resized?this.notify("node:resized",t,r):n.action==="rotating"&&n.rotated&&this.notify("node:rotated",t,r))}notify(t,r,n,i={}){if(n){const s=n.graph,o=s.view.normalizeEvent(r),a=s.snapToGrid(o.clientX,o.clientY);this.trigger(t,Object.assign({e:o,view:n,node:n.cell,cell:n.cell,x:a.x,y:a.y},i))}}dispose(){this.stopListening(),this.remove(),this.off()}}Ac([Ae.View.dispose()],us.prototype,"dispose",null);var tt;(function(d){d.NODE_CLS="has-widget-transform",d.DIRECTIONS=["nw","n","ne","e","se","s","sw","w"],d.POSITIONS=["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"],d.documentEvents={mousemove:"onMouseMove",touchmove:"onMouseMove",mouseup:"onMouseUp",touchend:"onMouseUp"},d.defaultOptions={minWidth:0,minHeight:0,maxWidth:1/0,maxHeight:1/0,rotateGrid:15,rotatable:!0,preserveAspectRatio:!1,orthogonalResizing:!0,restrictedResizing:!1,autoScrollOnResizing:!0,allowReverse:!0}})(tt||(tt={}));const Ic=`.x6-widget-transform {
7
+ position: absolute;
8
+ box-sizing: content-box !important;
9
+ margin: -5px 0 0 -5px;
10
+ padding: 4px;
11
+ border: 1px dashed #000;
12
+ border-radius: 5px;
13
+ user-select: none;
14
+ pointer-events: none;
15
+ }
16
+ .x6-widget-transform > div {
17
+ position: absolute;
18
+ box-sizing: border-box;
19
+ background-color: #fff;
20
+ border: 1px solid #000;
21
+ transition: background-color 0.2s;
22
+ pointer-events: auto;
23
+ -webkit-user-drag: none;
24
+ user-drag: none;
25
+ /* stylelint-disable-line */
26
+ }
27
+ .x6-widget-transform > div:hover {
28
+ background-color: #d3d3d3;
29
+ }
30
+ .x6-widget-transform-cursor-n {
31
+ cursor: n-resize;
32
+ }
33
+ .x6-widget-transform-cursor-s {
34
+ cursor: s-resize;
35
+ }
36
+ .x6-widget-transform-cursor-e {
37
+ cursor: e-resize;
38
+ }
39
+ .x6-widget-transform-cursor-w {
40
+ cursor: w-resize;
41
+ }
42
+ .x6-widget-transform-cursor-ne {
43
+ cursor: ne-resize;
44
+ }
45
+ .x6-widget-transform-cursor-nw {
46
+ cursor: nw-resize;
47
+ }
48
+ .x6-widget-transform-cursor-se {
49
+ cursor: se-resize;
50
+ }
51
+ .x6-widget-transform-cursor-sw {
52
+ cursor: sw-resize;
53
+ }
54
+ .x6-widget-transform-resize {
55
+ width: 10px;
56
+ height: 10px;
57
+ border-radius: 6px;
58
+ }
59
+ .x6-widget-transform-resize[data-position='top-left'] {
60
+ top: -5px;
61
+ left: -5px;
62
+ }
63
+ .x6-widget-transform-resize[data-position='top-right'] {
64
+ top: -5px;
65
+ right: -5px;
66
+ }
67
+ .x6-widget-transform-resize[data-position='bottom-left'] {
68
+ bottom: -5px;
69
+ left: -5px;
70
+ }
71
+ .x6-widget-transform-resize[data-position='bottom-right'] {
72
+ right: -5px;
73
+ bottom: -5px;
74
+ }
75
+ .x6-widget-transform-resize[data-position='top'] {
76
+ top: -5px;
77
+ left: 50%;
78
+ margin-left: -5px;
79
+ }
80
+ .x6-widget-transform-resize[data-position='bottom'] {
81
+ bottom: -5px;
82
+ left: 50%;
83
+ margin-left: -5px;
84
+ }
85
+ .x6-widget-transform-resize[data-position='left'] {
86
+ top: 50%;
87
+ left: -5px;
88
+ margin-top: -5px;
89
+ }
90
+ .x6-widget-transform-resize[data-position='right'] {
91
+ top: 50%;
92
+ right: -5px;
93
+ margin-top: -5px;
94
+ }
95
+ .x6-widget-transform.prevent-aspect-ratio .x6-widget-transform-resize[data-position='top'],
96
+ .x6-widget-transform.prevent-aspect-ratio .x6-widget-transform-resize[data-position='bottom'],
97
+ .x6-widget-transform.prevent-aspect-ratio .x6-widget-transform-resize[data-position='left'],
98
+ .x6-widget-transform.prevent-aspect-ratio .x6-widget-transform-resize[data-position='right'] {
99
+ display: none;
100
+ }
101
+ .x6-widget-transform.no-orth-resize .x6-widget-transform-resize[data-position='bottom'],
102
+ .x6-widget-transform.no-orth-resize .x6-widget-transform-resize[data-position='left'],
103
+ .x6-widget-transform.no-orth-resize .x6-widget-transform-resize[data-position='right'],
104
+ .x6-widget-transform.no-orth-resize .x6-widget-transform-resize[data-position='top'] {
105
+ display: none;
106
+ }
107
+ .x6-widget-transform.no-resize .x6-widget-transform-resize {
108
+ display: none;
109
+ }
110
+ .x6-widget-transform-rotate {
111
+ top: -20px;
112
+ left: -20px;
113
+ width: 12px;
114
+ height: 12px;
115
+ border-radius: 6px;
116
+ cursor: crosshair;
117
+ }
118
+ .x6-widget-transform.no-rotate .x6-widget-transform-rotate {
119
+ display: none;
120
+ }
121
+ .x6-widget-transform-active {
122
+ border-color: transparent;
123
+ pointer-events: all;
124
+ }
125
+ .x6-widget-transform-active > div {
126
+ display: none;
127
+ }
128
+ .x6-widget-transform-active > .x6-widget-transform-active-handle {
129
+ display: block;
130
+ background-color: #808080;
131
+ }
132
+ `;Ae.Graph.prototype.createTransformWidget=function(d){const t=this.getPlugin("transform");return t&&t.createWidget(d),this},Ae.Graph.prototype.clearTransformWidgets=function(){const d=this.getPlugin("transform");return d&&d.clearWidgets(),this};var Tc=function(d,t,r,n){var i=arguments.length,s=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(d,t,r,n);else for(var a=d.length-1;a>=0;a--)(o=d[a])&&(s=(i<3?o(s):i>3?o(t,r,s):o(t,r))||s);return i>3&&s&&Object.defineProperty(t,r,s),s};class Xt extends Ae.Basecoat{constructor(t={}){super(),this.name="transform",this.widgets=new Map,this.disabled=!1,this.options=t,Ae.CssLoader.ensure(this.name,Ic)}init(t){this.graph=t,!this.disabled&&this.startListening()}startListening(){this.graph.on("node:click",this.onNodeClick,this),this.graph.on("blank:mousedown",this.onBlankMouseDown,this)}stopListening(){this.graph.off("node:click",this.onNodeClick,this),this.graph.off("blank:mousedown",this.onBlankMouseDown,this)}enable(){this.disabled&&(this.disabled=!1,this.startListening())}disable(){this.disabled||(this.disabled=!0,this.stopListening())}isEnabled(){return!this.disabled}createWidget(t){this.clearWidgets();const r=this.createTransform(t);r&&(this.widgets.set(t,r),r.on("*",(n,i)=>{this.trigger(n,i),this.graph.trigger(n,i)}))}onNodeClick({node:t}){this.createWidget(t)}onBlankMouseDown(){this.clearWidgets()}createTransform(t){const r=this.getTransformOptions(t);return r.resizable||r.rotatable?new us(r,t,this.graph):null}getTransformOptions(t){this.options.resizing||(this.options.resizing={enabled:!1}),this.options.rotating||(this.options.rotating={enabled:!1}),typeof this.options.resizing=="boolean"&&(this.options.resizing={enabled:this.options.resizing}),typeof this.options.rotating=="boolean"&&(this.options.rotating={enabled:this.options.rotating});const r=Xt.parseOptionGroup(this.graph,t,this.options.resizing),n=Xt.parseOptionGroup(this.graph,t,this.options.rotating);return{resizable:!!r.enabled,minWidth:r.minWidth||0,maxWidth:r.maxWidth||Number.MAX_SAFE_INTEGER,minHeight:r.minHeight||0,maxHeight:r.maxHeight||Number.MAX_SAFE_INTEGER,orthogonalResizing:typeof r.orthogonal=="boolean"?r.orthogonal:!0,restrictedResizing:!!r.restrict,autoScrollOnResizing:typeof r.autoScroll=="boolean"?r.autoScroll:!0,preserveAspectRatio:!!r.preserveAspectRatio,allowReverse:typeof r.allowReverse=="boolean"?r.allowReverse:!0,rotatable:!!n.enabled,rotateGrid:n.grid||15}}clearWidgets(){this.widgets.forEach((t,r)=>{this.graph.getCellById(r.id)&&t.dispose()}),this.widgets.clear()}dispose(){this.clearWidgets(),this.stopListening(),this.off(),Ae.CssLoader.clean(this.name)}}Tc([Ae.Basecoat.dispose()],Xt.prototype,"dispose",null),function(d){function t(r,n,i){const s={};return Object.keys(i||{}).forEach(o=>{const a=i[o];s[o]=typeof a=="function"?a.call(r,n):a}),s}d.parseOptionGroup=t}(Xt||(Xt={}));class fs extends Ae.Node{}(function(d){function t(r){const n=[],i=Ae.Markup.getForeignObjectMarkup();return r?n.push({tagName:r,selector:"body"},i):n.push(i),n}d.config({view:"vue-shape-view",markup:t(),attrs:{body:{fill:"none",stroke:"none",refWidth:"100%",refHeight:"100%"},fo:{refWidth:"100%",refHeight:"100%"}},propHooks(r){if(r.markup==null){const n=r.primer;if(n){r.markup=t(n);let i={};switch(n){case"circle":i={refCx:"50%",refCy:"50%",refR:"50%"};break;case"ellipse":i={refCx:"50%",refCy:"50%",refRx:"50%",refRy:"50%"};break}r.attrs=Ae.ObjectExt.merge({},{body:Object.assign({refWidth:null,refHeight:null},i)},r.attrs||{})}}return r}}),Ae.Node.registry.register("vue-shape",d,!0)})(fs||(fs={}));var Vc=function(d,t){var r={};for(var n in d)Object.prototype.hasOwnProperty.call(d,n)&&t.indexOf(n)<0&&(r[n]=d[n]);if(d!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(d);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(d,n[i])&&(r[n[i]]=d[n[i]]);return r};const ps={};function An(d){const{shape:t,component:r,inherit:n}=d,i=Vc(d,["shape","component","inherit"]);if(!t)throw new Error("should specify shape in config");ps[t]={component:r},Ae.Graph.registerNode(t,Object.assign({inherit:n||"vue-shape"},i),!0)}e.reactive({});class Rr extends Ae.NodeView{getComponentContainer(){return this.selectors&&this.selectors.foContent}confirmUpdate(t){const r=super.confirmUpdate(t);return this.handleAction(r,Rr.action,()=>{this.renderVueComponent()})}targetId(){return`${this.graph.view.cid}:${this.cell.id}`}renderVueComponent(){this.unmountVueComponent();const t=this.getComponentContainer(),r=this.cell,n=this.graph;if(t){const{component:i}=ps[r.shape];i&&(this.vm=e.createApp({render(){return e.h(i,{node:r,graph:n})},provide(){return{getNode:()=>r,getGraph:()=>n}}}),this.vm.mount(t))}}unmountVueComponent(){const t=this.getComponentContainer();return this.vm&&(this.vm.unmount(),this.vm=null),t&&(t.innerHTML=""),t}onMouseDown(t,r,n){const i=t.target;if(i.tagName.toLowerCase()==="input"){const o=i.getAttribute("type");if(o==null||["text","password","number","email","search","tel","url"].includes(o))return}super.onMouseDown(t,r,n)}unmount(){return this.unmountVueComponent(),super.unmount(),this}}(function(d){d.action="vue",d.config({bootstrap:[d.action],actions:{component:d.action}}),Ae.NodeView.registry.register("vue-shape-view",d,!0)})(Rr||(Rr={}));const Pc={version:"1.1.31"};/**
133
+ * @license lucide-vue-next v0.563.0 - ISC
134
+ *
135
+ * This source code is licensed under the ISC license.
136
+ * See the LICENSE file in the root directory of this source tree.
137
+ */const Bc=d=>{for(const t in d)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};/**
138
+ * @license lucide-vue-next v0.563.0 - ISC
139
+ *
140
+ * This source code is licensed under the ISC license.
141
+ * See the LICENSE file in the root directory of this source tree.
142
+ */const hs=d=>d==="";/**
143
+ * @license lucide-vue-next v0.563.0 - ISC
144
+ *
145
+ * This source code is licensed under the ISC license.
146
+ * See the LICENSE file in the root directory of this source tree.
147
+ */const Oc=(...d)=>d.filter((t,r,n)=>!!t&&t.trim()!==""&&n.indexOf(t)===r).join(" ").trim();/**
148
+ * @license lucide-vue-next v0.563.0 - ISC
149
+ *
150
+ * This source code is licensed under the ISC license.
151
+ * See the LICENSE file in the root directory of this source tree.
152
+ */const ms=d=>d.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/**
153
+ * @license lucide-vue-next v0.563.0 - ISC
154
+ *
155
+ * This source code is licensed under the ISC license.
156
+ * See the LICENSE file in the root directory of this source tree.
157
+ */const Dc=d=>d.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,r,n)=>n?n.toUpperCase():r.toLowerCase());/**
158
+ * @license lucide-vue-next v0.563.0 - ISC
159
+ *
160
+ * This source code is licensed under the ISC license.
161
+ * See the LICENSE file in the root directory of this source tree.
162
+ */const Rc=d=>{const t=Dc(d);return t.charAt(0).toUpperCase()+t.slice(1)};/**
163
+ * @license lucide-vue-next v0.563.0 - ISC
164
+ *
165
+ * This source code is licensed under the ISC license.
166
+ * See the LICENSE file in the root directory of this source tree.
167
+ */var wr={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"};/**
168
+ * @license lucide-vue-next v0.563.0 - ISC
169
+ *
170
+ * This source code is licensed under the ISC license.
171
+ * See the LICENSE file in the root directory of this source tree.
172
+ */const Mc=({name:d,iconNode:t,absoluteStrokeWidth:r,"absolute-stroke-width":n,strokeWidth:i,"stroke-width":s,size:o=wr.width,color:a=wr.stroke,...l},{slots:c})=>e.h("svg",{...wr,...l,width:o,height:o,stroke:a,"stroke-width":hs(r)||hs(n)||r===!0||n===!0?Number(i||s||wr["stroke-width"])*24/Number(o):i||s||wr["stroke-width"],class:Oc("lucide",l.class,...d?[`lucide-${ms(Rc(d))}-icon`,`lucide-${ms(d)}`]:["lucide-icon"]),...!c.default&&!Bc(l)&&{"aria-hidden":"true"}},[...t.map(u=>e.h(...u)),...c.default?[c.default()]:[]]);/**
173
+ * @license lucide-vue-next v0.563.0 - ISC
174
+ *
175
+ * This source code is licensed under the ISC license.
176
+ * See the LICENSE file in the root directory of this source tree.
177
+ */const st=(d,t)=>(r,{slots:n,attrs:i})=>e.h(Mc,{...i,...r,iconNode:t,name:d},n);/**
178
+ * @license lucide-vue-next v0.563.0 - ISC
179
+ *
180
+ * This source code is licensed under the ISC license.
181
+ * See the LICENSE file in the root directory of this source tree.
182
+ */const $c=st("align-end-horizontal",[["rect",{width:"6",height:"16",x:"4",y:"2",rx:"2",key:"z5wdxg"}],["rect",{width:"6",height:"9",x:"14",y:"9",rx:"2",key:"um7a8w"}],["path",{d:"M22 22H2",key:"19qnx5"}]]);/**
183
+ * @license lucide-vue-next v0.563.0 - ISC
184
+ *
185
+ * This source code is licensed under the ISC license.
186
+ * See the LICENSE file in the root directory of this source tree.
187
+ */const jc=st("align-end-vertical",[["rect",{width:"16",height:"6",x:"2",y:"4",rx:"2",key:"10wcwx"}],["rect",{width:"9",height:"6",x:"9",y:"14",rx:"2",key:"4p5bwg"}],["path",{d:"M22 22V2",key:"12ipfv"}]]);/**
188
+ * @license lucide-vue-next v0.563.0 - ISC
189
+ *
190
+ * This source code is licensed under the ISC license.
191
+ * See the LICENSE file in the root directory of this source tree.
192
+ */const Lc=st("align-horizontal-justify-center",[["rect",{width:"6",height:"14",x:"2",y:"5",rx:"2",key:"dy24zr"}],["rect",{width:"6",height:"10",x:"16",y:"7",rx:"2",key:"13zkjt"}],["path",{d:"M12 2v20",key:"t6zp3m"}]]);/**
193
+ * @license lucide-vue-next v0.563.0 - ISC
194
+ *
195
+ * This source code is licensed under the ISC license.
196
+ * See the LICENSE file in the root directory of this source tree.
197
+ */const Uc=st("align-horizontal-space-around",[["rect",{width:"6",height:"10",x:"9",y:"7",rx:"2",key:"yn7j0q"}],["path",{d:"M4 22V2",key:"tsjzd3"}],["path",{d:"M20 22V2",key:"1bnhr8"}]]);/**
198
+ * @license lucide-vue-next v0.563.0 - ISC
199
+ *
200
+ * This source code is licensed under the ISC license.
201
+ * See the LICENSE file in the root directory of this source tree.
202
+ */const Fc=st("align-start-vertical",[["rect",{width:"9",height:"6",x:"6",y:"14",rx:"2",key:"lpm2y7"}],["rect",{width:"16",height:"6",x:"6",y:"4",rx:"2",key:"rdj6ps"}],["path",{d:"M2 2v20",key:"1ivd8o"}]]);/**
203
+ * @license lucide-vue-next v0.563.0 - ISC
204
+ *
205
+ * This source code is licensed under the ISC license.
206
+ * See the LICENSE file in the root directory of this source tree.
207
+ */const zc=st("align-start-horizontal",[["rect",{width:"6",height:"16",x:"4",y:"6",rx:"2",key:"1n4dg1"}],["rect",{width:"6",height:"9",x:"14",y:"6",rx:"2",key:"17khns"}],["path",{d:"M22 2H2",key:"fhrpnj"}]]);/**
208
+ * @license lucide-vue-next v0.563.0 - ISC
209
+ *
210
+ * This source code is licensed under the ISC license.
211
+ * See the LICENSE file in the root directory of this source tree.
212
+ */const Wc=st("align-vertical-justify-center",[["rect",{width:"14",height:"6",x:"5",y:"16",rx:"2",key:"1i8z2d"}],["rect",{width:"10",height:"6",x:"7",y:"2",rx:"2",key:"ypihtt"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/**
213
+ * @license lucide-vue-next v0.563.0 - ISC
214
+ *
215
+ * This source code is licensed under the ISC license.
216
+ * See the LICENSE file in the root directory of this source tree.
217
+ */const qc=st("align-vertical-space-around",[["rect",{width:"10",height:"6",x:"7",y:"9",rx:"2",key:"b1zbii"}],["path",{d:"M22 20H2",key:"1p1f7z"}],["path",{d:"M22 4H2",key:"1b7qnq"}]]);/**
218
+ * @license lucide-vue-next v0.563.0 - ISC
219
+ *
220
+ * This source code is licensed under the ISC license.
221
+ * See the LICENSE file in the root directory of this source tree.
222
+ */const Gc=st("database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);/**
223
+ * @license lucide-vue-next v0.563.0 - ISC
224
+ *
225
+ * This source code is licensed under the ISC license.
226
+ * See the LICENSE file in the root directory of this source tree.
227
+ */const Hc=st("download",[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]);/**
228
+ * @license lucide-vue-next v0.563.0 - ISC
229
+ *
230
+ * This source code is licensed under the ISC license.
231
+ * See the LICENSE file in the root directory of this source tree.
232
+ */const gs=st("eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
233
+ * @license lucide-vue-next v0.563.0 - ISC
234
+ *
235
+ * This source code is licensed under the ISC license.
236
+ * See the LICENSE file in the root directory of this source tree.
237
+ */const Kc=st("folder-open",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);/**
238
+ * @license lucide-vue-next v0.563.0 - ISC
239
+ *
240
+ * This source code is licensed under the ISC license.
241
+ * See the LICENSE file in the root directory of this source tree.
242
+ */const Yc=st("save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);/**
243
+ * @license lucide-vue-next v0.563.0 - ISC
244
+ *
245
+ * This source code is licensed under the ISC license.
246
+ * See the LICENSE file in the root directory of this source tree.
247
+ */const Mr=st("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]);/**
248
+ * @license lucide-vue-next v0.563.0 - ISC
249
+ *
250
+ * This source code is licensed under the ISC license.
251
+ * See the LICENSE file in the root directory of this source tree.
252
+ */const Jc=st("workflow",[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]]);/**
253
+ * @license lucide-vue-next v0.563.0 - ISC
254
+ *
255
+ * This source code is licensed under the ISC license.
256
+ * See the LICENSE file in the root directory of this source tree.
257
+ */const Qc=st("zoom-in",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]);/**
258
+ * @license lucide-vue-next v0.563.0 - ISC
259
+ *
260
+ * This source code is licensed under the ISC license.
261
+ * See the LICENSE file in the root directory of this source tree.
262
+ */const Xc=st("zoom-out",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]),Zc={class:"scada-header"},ed={class:"header-left"},td={class:"version"},rd={class:"header-center"},nd={class:"toolbar-container"},od={class:"tool-group"},id={key:0,class:"divider"},sd={key:1,class:"tool-group"},ad={key:2,class:"divider"},ld={key:3,class:"tool-group"},cd={key:4,class:"divider"},dd={key:5,class:"tool-group"},ud={class:"header-right"},fd={class:"tool-group"},pd=e.defineComponent({__name:"Header",props:{selectedNodesCount:{default:0}},emits:["save","import","workflow","preview","export","dataSource","zoomIn","zoomOut","clearAll","alignLeft","alignCenter","alignRight","alignTop","alignMiddle","alignBottom","distributeHorizontal","distributeVertical"],setup(d,{emit:t}){const r=Pc.version,n=d,i=t;return(s,o)=>(e.openBlock(),e.createElementBlock("header",Zc,[e.createElementVNode("div",ed,[e.renderSlot(s.$slots,"left",{},()=>[o[17]||(o[17]=e.createElementVNode("h1",{class:"logo"},"SCADA 组态引擎",-1)),e.createElementVNode("span",td,"v"+e.toDisplayString(e.unref(r)),1)],!0)]),e.createElementVNode("div",rd,[e.createElementVNode("div",nd,[e.createElementVNode("div",od,[e.createElementVNode("button",{class:"toolbar-btn",onClick:o[0]||(o[0]=a=>i("zoomIn")),title:"放大"},[e.createVNode(e.unref(Qc),{class:"icon-svg"})]),e.createElementVNode("button",{class:"toolbar-btn",onClick:o[1]||(o[1]=a=>i("zoomOut")),title:"缩小"},[e.createVNode(e.unref(Xc),{class:"icon-svg"})]),e.createElementVNode("button",{class:"toolbar-btn",onClick:o[2]||(o[2]=a=>i("clearAll")),title:"清空画布"},[e.createVNode(e.unref(Mr),{class:"icon-svg"})])]),n.selectedNodesCount>=2?(e.openBlock(),e.createElementBlock("div",id)):e.createCommentVNode("",!0),n.selectedNodesCount>=2?(e.openBlock(),e.createElementBlock("div",sd,[e.createElementVNode("button",{class:"toolbar-btn",onClick:o[3]||(o[3]=a=>i("alignLeft")),title:"左对齐"},[e.createVNode(e.unref(Fc),{class:"icon-svg"})]),e.createElementVNode("button",{class:"toolbar-btn",onClick:o[4]||(o[4]=a=>i("alignCenter")),title:"水平居中"},[e.createVNode(e.unref(Wc),{class:"icon-svg"})]),e.createElementVNode("button",{class:"toolbar-btn",onClick:o[5]||(o[5]=a=>i("alignRight")),title:"右对齐"},[e.createVNode(e.unref(jc),{class:"icon-svg"})])])):e.createCommentVNode("",!0),n.selectedNodesCount>=2?(e.openBlock(),e.createElementBlock("div",ad)):e.createCommentVNode("",!0),n.selectedNodesCount>=2?(e.openBlock(),e.createElementBlock("div",ld,[e.createElementVNode("button",{class:"toolbar-btn",onClick:o[6]||(o[6]=a=>i("alignTop")),title:"顶部对齐"},[e.createVNode(e.unref(zc),{class:"icon-svg"})]),e.createElementVNode("button",{class:"toolbar-btn",onClick:o[7]||(o[7]=a=>i("alignMiddle")),title:"垂直居中"},[e.createVNode(e.unref(Lc),{class:"icon-svg"})]),e.createElementVNode("button",{class:"toolbar-btn",onClick:o[8]||(o[8]=a=>i("alignBottom")),title:"底部对齐"},[e.createVNode(e.unref($c),{class:"icon-svg"})])])):e.createCommentVNode("",!0),n.selectedNodesCount>=3?(e.openBlock(),e.createElementBlock("div",cd)):e.createCommentVNode("",!0),n.selectedNodesCount>=3?(e.openBlock(),e.createElementBlock("div",dd,[e.createElementVNode("button",{class:"toolbar-btn",onClick:o[9]||(o[9]=a=>i("distributeHorizontal")),title:"横向分布"},[e.createVNode(e.unref(Uc),{class:"icon-svg"})]),e.createElementVNode("button",{class:"toolbar-btn",onClick:o[10]||(o[10]=a=>i("distributeVertical")),title:"纵向分布"},[e.createVNode(e.unref(qc),{class:"icon-svg"})])])):e.createCommentVNode("",!0)])]),e.createElementVNode("div",ud,[e.createElementVNode("div",fd,[e.createElementVNode("button",{class:"header-btn",onClick:o[11]||(o[11]=a=>i("dataSource")),title:"数据源管理"},[e.createVNode(e.unref(Gc),{class:"icon-svg"}),o[18]||(o[18]=e.createElementVNode("span",null,"数据源",-1))]),e.createElementVNode("button",{class:"header-btn",onClick:o[12]||(o[12]=a=>i("workflow")),title:"流程编排"},[e.createVNode(e.unref(Jc),{class:"icon-svg"}),o[19]||(o[19]=e.createElementVNode("span",null,"流程编排",-1))]),e.createElementVNode("button",{class:"header-btn",onClick:o[13]||(o[13]=a=>i("import")),title:"导入"},[e.createVNode(e.unref(Kc),{class:"icon-svg"}),o[20]||(o[20]=e.createElementVNode("span",null,"导入",-1))]),e.createElementVNode("button",{class:"header-btn",onClick:o[14]||(o[14]=a=>i("export")),title:"导出"},[e.createVNode(e.unref(Hc),{class:"icon-svg"}),o[21]||(o[21]=e.createElementVNode("span",null,"导出",-1))]),e.createElementVNode("button",{class:"header-btn",onClick:o[15]||(o[15]=a=>i("preview")),title:"预览"},[e.createVNode(e.unref(gs),{class:"icon-svg"}),o[22]||(o[22]=e.createElementVNode("span",null,"预览",-1))]),e.createElementVNode("button",{class:"header-btn",onClick:o[16]||(o[16]=a=>i("save")),title:"保存"},[e.createVNode(e.unref(Yc),{class:"icon-svg"}),o[23]||(o[23]=e.createElementVNode("span",null,"保存",-1))])])])]))}}),Le=(d,t)=>{const r=d.__vccOpts||d;for(const[n,i]of t)r[n]=i;return r},In=Le(pd,[["__scopeId","data-v-9c1057e1"]]),ys=[{id:"basic",name:"基础仪表盘",config:{min:0,max:100,splitNumber:5,radius:"100%",axisLine:{lineStyle:{width:10,color:[[.3,"#67e0e3"],[.7,"#37a2da"],[1,"#fd666d"]]}},axisTick:{distance:2,length:5,lineStyle:{color:"#fff",width:1}},splitLine:{distance:2,length:10,lineStyle:{color:"#fff",width:2}},axisLabel:{distance:20,fontSize:12,color:"#999"},title:{offsetCenter:[0,"90%"],fontSize:14,color:"#999"},detail:{fontSize:30,offsetCenter:[0,"45%"],color:"#fff",formatter:"{value}"}}},{id:"temperature",name:"温度仪表盘",config:{min:-20,max:50,splitNumber:5,radius:"100%",axisLine:{lineStyle:{width:10,color:[[.2,"#2563eb"],[.5,"#22c55e"],[.8,"#f59e0b"],[1,"#ef4444"]]}},axisTick:{distance:2,length:5,lineStyle:{color:"#fff",width:1}},splitLine:{distance:2,length:10,lineStyle:{color:"#fff",width:2}},axisLabel:{distance:10,fontSize:12,color:"#999"},title:{offsetCenter:[0,"90%"],fontSize:14,color:"#999"},detail:{fontSize:30,offsetCenter:[0,"45%"],color:"#fff",formatter:"{value}°C"}}},{id:"humidity",name:"湿度仪表盘",config:{min:0,max:100,splitNumber:5,radius:"100%",axisLine:{lineStyle:{width:10,color:[[.3,"#fbbf24"],[.7,"#3b82f6"],[1,"#1e40af"]]}},axisTick:{distance:2,length:5,lineStyle:{color:"#fff",width:1}},splitLine:{distance:2,length:10,lineStyle:{color:"#fff",width:2}},axisLabel:{distance:20,fontSize:12,color:"#999"},title:{offsetCenter:[0,"90%"],fontSize:14,color:"#999"},detail:{fontSize:30,offsetCenter:[0,"45%"],color:"#fff",formatter:"{value}%"}}},{id:"speed",name:"速度仪表盘",config:{min:0,max:200,splitNumber:10,startAngle:225,endAngle:-45,radius:"100%",axisLine:{lineStyle:{width:10,color:[[.4,"#10b981"],[.7,"#f59e0b"],[1,"#ef4444"]]}},axisTick:{distance:2,length:5,lineStyle:{color:"#fff",width:1}},splitLine:{distance:2,length:10,lineStyle:{color:"#fff",width:2}},axisLabel:{distance:20,fontSize:12,color:"#999"},title:{offsetCenter:[0,"90%"],fontSize:14,color:"#999"},detail:{fontSize:30,offsetCenter:[0,"45%"],color:"#fff",formatter:"{value} km/h"}}},{id:"pressure",name:"压力仪表盘",config:{min:0,max:10,splitNumber:5,radius:"100%",axisLine:{lineStyle:{width:10,color:[[.5,"#22c55e"],[.8,"#f59e0b"],[1,"#dc2626"]]}},axisTick:{distance:2,length:5,lineStyle:{color:"#fff",width:1}},splitLine:{distance:2,length:10,lineStyle:{color:"#fff",width:2}},axisLabel:{distance:20,fontSize:12,color:"#999"},title:{offsetCenter:[0,"90%"],fontSize:14,color:"#999"},detail:{fontSize:30,offsetCenter:[0,"45%"],color:"#fff",formatter:"{value} MPa"}}},{id:"rpm",name:"转速仪表盘",config:{min:0,max:8e3,splitNumber:8,startAngle:225,endAngle:-45,radius:"100%",axisLine:{lineStyle:{width:10,color:[[.6,"#06b6d4"],[.85,"#eab308"],[1,"#dc2626"]]}},axisTick:{distance:2,length:5,lineStyle:{color:"#fff",width:1}},splitLine:{distance:2,length:10,lineStyle:{color:"#fff",width:2}},axisLabel:{distance:20,fontSize:12,color:"#999"},title:{offsetCenter:[0,"90%"],fontSize:14,color:"#999"},detail:{fontSize:30,offsetCenter:[0,"45%"],color:"#fff",formatter:"{value} RPM"}}},{id:"battery",name:"电池仪表盘",config:{min:0,max:100,splitNumber:5,radius:"100%",axisLine:{lineStyle:{width:10,color:[[.2,"#dc2626"],[.5,"#f59e0b"],[1,"#22c55e"]]}},axisTick:{distance:2,length:5,lineStyle:{color:"#fff",width:1}},splitLine:{distance:2,length:10,lineStyle:{color:"#fff",width:2}},axisLabel:{distance:10,fontSize:12,color:"#999"},title:{offsetCenter:[0,"80%"],fontSize:12,color:"#999"},detail:{fontSize:20,offsetCenter:[0,"45%"],color:"#fff",formatter:"{value}%"}}},{id:"power",name:"功率仪表盘",config:{min:0,max:100,splitNumber:5,radius:"100%",axisLine:{lineStyle:{width:10,color:[[.3,"#64748b"],[.7,"#3b82f6"],[1,"#8b5cf6"]]}},axisTick:{distance:2,length:5,lineStyle:{color:"#fff",width:1}},splitLine:{distance:2,length:10,lineStyle:{color:"#fff",width:2}},axisLabel:{distance:10,fontSize:12,color:"#999"},title:{offsetCenter:[0,"90%"],fontSize:12,color:"#999"},detail:{fontSize:20,offsetCenter:[0,"45%"],color:"#fff",formatter:"{value} kW"}}}];function hd(d){return ys.find(t=>t.id===d)}const bs={metadata:{id:"echarts-gauge",name:"ECharts仪表盘",category:"chart",icon:"📈",description:"ECharts 仪表盘数据展示组件,支持丰富的配置选项",version:"1.0.0"},shape:"echarts-vue",component:Le(e.defineComponent({__name:"EChartsGauge",props:{node:{}},setup(d){const t=d,r=e.ref();let n=null;const i=()=>t.node?t.node.getData?t.node.getData():t.node.data||{}:{},s=()=>{r.value&&(n&&n.dispose(),n=ds.init(r.value),o())},o=()=>{if(!n)return;const a=i(),l=a.presetId||"basic",c=hd(l),u={tooltip:{formatter:"{a} <br/>{b} : {c}%"},series:[{name:a.name||"Pressure",type:"gauge",data:[{value:a.value??50,name:a.title||"SCORE"}]}]};c&&c.config&&Object.assign(u.series[0],c.config),n.setOption(u,!0)};return e.watch(()=>{var a;return(a=t.node)==null?void 0:a.data},(a,l)=>{o()},{deep:!0}),e.watch(()=>{var a,l;return(l=(a=t.node)==null?void 0:a.data)==null?void 0:l.presetId},(a,l)=>{a!==l&&o()}),e.watch(()=>{var a;return(a=t.node)==null?void 0:a.size},()=>{if(n&&t.node){const a=t.node.getSize?t.node.getSize():t.node.size||{width:200,height:200};n.resize({width:a.width,height:a.height})}},{deep:!0}),e.onMounted(()=>{setTimeout(()=>{s(),t.node&&typeof t.node.on=="function"&&t.node.on("change:data",({current:a})=>{o()})},100)}),e.onUnmounted(()=>{n&&(n.dispose(),n=null)}),(a,l)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"chartRef",ref:r,class:"echarts-gauge-component",style:{width:"100%",height:"100%"}},null,512))}}),[["__scopeId","data-v-9b5f60e8"]]),width:200,height:200,label:"",attrs:{body:{fill:"transparent",stroke:"transparent"}},data:{type:"echarts-gauge",presetId:"basic",value:50,title:"SCORE",name:"Pressure"},ports:{groups:{top:{position:"top",attrs:{circle:{r:4,magnet:!0,stroke:"#31d0c6",strokeWidth:2,fill:"#fff"}}},right:{position:"right",attrs:{circle:{r:4,magnet:!0,stroke:"#31d0c6",strokeWidth:2,fill:"#fff"}}},bottom:{position:"bottom",attrs:{circle:{r:4,magnet:!0,stroke:"#31d0c6",strokeWidth:2,fill:"#fff"}}},left:{position:"left",attrs:{circle:{r:4,magnet:!0,stroke:"#31d0c6",strokeWidth:2,fill:"#fff"}}}},items:[{id:"port-top",group:"top"},{id:"port-right",group:"right"},{id:"port-bottom",group:"bottom"},{id:"port-left",group:"left"}]},props:[{key:"presetId",label:"仪表盘类型",type:"select",path:"data.presetId",defaultValue:"basic",options:ys.map(d=>({label:d.name,value:d.id})),description:"选择预设的仪表盘类型,会自动应用对应的配置"},{key:"value",label:"当前值",type:"number",path:"data.value",defaultValue:50,description:"仪表盘当前显示值",bindable:!0},{key:"title",label:"标题",type:"text",path:"data.title",defaultValue:"SCORE",description:"仪表盘标题"},{key:"name",label:"系列名称",type:"text",path:"data.name",defaultValue:"Pressure",description:"显示在 tooltip 中的系列名称"}],points:[{id:"value",name:"当前值",description:"仪表盘当前显示的数值",dataType:"number",defaultValue:50,required:!0,range:{min:0,max:100}},{id:"min",name:"最小值",description:"仪表盘刻度最小值",dataType:"number",defaultValue:0,required:!1},{id:"max",name:"最大值",description:"仪表盘刻度最大值",dataType:"number",defaultValue:100,required:!1},{id:"title",name:"标题",description:"仪表盘显示标题",dataType:"string",defaultValue:"SCORE",required:!1}]},ws=[{id:"basic",name:"基础折线图",config:{smooth:!1,lineStyle:{width:2,color:"#5470c6"},areaStyle:null,symbol:"circle",symbolSize:6,radius:"100%"}},{id:"smooth",name:"平滑曲线",config:{smooth:!0,lineStyle:{width:2,color:"#91cc75"},areaStyle:null,symbol:"circle",symbolSize:6}},{id:"area",name:"区域折线图",config:{smooth:!1,lineStyle:{width:2,color:"#5470c6"},areaStyle:{color:{type:"linear",x:0,y:0,x2:0,y2:1,colorStops:[{offset:0,color:"rgba(84, 112, 198, 0.3)"},{offset:1,color:"rgba(84, 112, 198, 0.05)"}]}},symbol:"circle",symbolSize:6}},{id:"smooth-area",name:"平滑区域图",config:{smooth:!0,lineStyle:{width:2,color:"#91cc75"},areaStyle:{color:{type:"linear",x:0,y:0,x2:0,y2:1,colorStops:[{offset:0,color:"rgba(145, 204, 117, 0.3)"},{offset:1,color:"rgba(145, 204, 117, 0.05)"}]}},symbol:"circle",symbolSize:6}},{id:"dashed",name:"虚线折线图",config:{smooth:!1,lineStyle:{width:2,color:"#fac858",type:"dashed"},areaStyle:null,symbol:"circle",symbolSize:6}},{id:"step",name:"阶梯折线图",config:{smooth:!1,step:"middle",lineStyle:{width:2,color:"#ee6666"},areaStyle:null,symbol:"circle",symbolSize:6}}];function md(d){return ws.find(t=>t.id===d)}const vs={metadata:{id:"echarts-line",name:"ECharts折线图",category:"chart",icon:"📉",description:"ECharts 折线图数据展示组件,支持时序数据可视化",version:"1.0.0"},shape:"echarts-line-vue",component:e.defineComponent({__name:"EChartsLine",props:{node:{}},setup(d){const t=d,r=e.ref();let n=null;const i=()=>t.node?t.node.getData?t.node.getData():t.node.data||{}:{},s=()=>{r.value&&(n=ds.init(r.value),o())},o=()=>{if(!n)return;const a=i(),l=a.presetId||"basic",c=md(l),u={title:{text:a.title||"数据趋势",left:"center",top:10,textStyle:{color:"#fff",fontSize:14}},tooltip:{trigger:"axis",backgroundColor:"rgba(0, 0, 0, 0.7)",borderColor:"#333",textStyle:{color:"#fff"}},grid:{left:"10%",right:"10%",top:"20%",bottom:"15%",containLabel:!0},xAxis:{type:"category",boundaryGap:!1,data:a.xAxisData||["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],axisLine:{lineStyle:{color:"#999"}},axisLabel:{color:"#999"}},yAxis:{type:"value",axisLine:{lineStyle:{color:"#999"}},axisLabel:{color:"#999"},splitLine:{lineStyle:{color:"rgba(255, 255, 255, 0.1)"}}},series:[{name:a.seriesName||"Data",type:"line",data:a.seriesData||[120,200,150,80,70,110,130]}]};c&&c.config&&Object.assign(u.series[0],c.config),n.setOption(u,!0)};return e.onMounted(()=>{setTimeout(()=>{s(),t.node&&typeof t.node.on=="function"&&t.node.on("change:data",({current:a})=>{o()})},100)}),e.onUnmounted(()=>{n&&(n.dispose(),n=null)}),(a,l)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"chartContainer",ref:r,style:{width:"100%",height:"100%"}},null,512))}}),width:400,height:300,label:"",attrs:{body:{fill:"transparent",stroke:"transparent"}},data:{type:"echarts-line",presetId:"basic",title:"数据趋势",xAxisData:["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],seriesData:[120,200,150,80,70,110,130],seriesName:"Data"},ports:{groups:{top:{position:"top",attrs:{circle:{r:4,magnet:!0,stroke:"#31d0c6",strokeWidth:2,fill:"#fff"}}},right:{position:"right",attrs:{circle:{r:4,magnet:!0,stroke:"#31d0c6",strokeWidth:2,fill:"#fff"}}},bottom:{position:"bottom",attrs:{circle:{r:4,magnet:!0,stroke:"#31d0c6",strokeWidth:2,fill:"#fff"}}},left:{position:"left",attrs:{circle:{r:4,magnet:!0,stroke:"#31d0c6",strokeWidth:2,fill:"#fff"}}}},items:[{id:"port-top",group:"top"},{id:"port-right",group:"right"},{id:"port-bottom",group:"bottom"},{id:"port-left",group:"left"}]},props:[{key:"presetId",label:"折线图类型",type:"select",path:"data.presetId",defaultValue:"basic",options:ws.map(d=>({label:d.name,value:d.id})),description:"选择预设的折线图类型"},{key:"title",label:"图表标题",type:"text",path:"data.title",defaultValue:"数据趋势",description:"折线图标题"},{key:"seriesName",label:"系列名称",type:"text",path:"data.seriesName",defaultValue:"Data",description:"显示在 tooltip 和 legend 中的系列名称"}],points:[{id:"series_data",name:"系列数据",description:"折线图Y轴数据数组",dataType:"json",defaultValue:[120,200,150,80,70,110,130],required:!0},{id:"x_axis_data",name:"X轴数据",description:"折线图X轴标签数组",dataType:"json",defaultValue:["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],required:!1},{id:"title",name:"图表标题",description:"折线图显示标题",dataType:"string",defaultValue:"数据趋势",required:!1}]},gd=Object.freeze(Object.defineProperty({__proto__:null,EChartsGaugeComponent:bs,EChartsLineComponent:vs},Symbol.toStringTag,{value:"Module"}));class yd{constructor(){he(this,"registry",{});he(this,"lazyRegistry",new Map);he(this,"loadingPromises",new Map);this.registerDefaultComponents(),this.registerLazyComponents()}registerDefaultComponents(){this.register(bs),this.register(vs)}registerLazyComponents(){Object.entries(Object.assign({})).forEach(([r,n])=>{const i=`__module__${r}`;this.lazyRegistry.set(i,{loader:async()=>{const s=await n();return Object.values(s).forEach(o=>{if(o&&typeof o=="object"&&o.metadata){const a=o,l=a.metadata.id;this.registry[l]||(this.registry[l]=a,this.registerVueShape(a))}}),{default:{}}},loading:!1,loaded:!1})})}registerVueShape(t){if(t.component)try{An({shape:t.shape,width:t.width,height:t.height,component:t.component,ports:t.ports})}catch{}}register(t){const{id:r}=t.metadata;this.registry[r]&&console.warn(`组件 ${r} 已存在,将被覆盖`),this.registry[r]=t,this.registerVueShape(t)}registerLazy(t,r){this.lazyRegistry.has(t)&&console.warn(`懒加载组件 ${t} 已存在,将被覆盖`),this.lazyRegistry.set(t,{loader:r,loading:!1,loaded:!1})}registerBatch(t){t.forEach(r=>this.register(r))}async getComponent(t){if(this.registry[t])return this.registry[t];const r=this.lazyRegistry.get(t);if(r)return this.loadComponent(t,r)}getComponentSync(t){return this.registry[t]}async loadComponent(t,r){if(r.loaded&&r.config)return r.config;if(r.loading){const i=this.loadingPromises.get(t);if(i)return i}r.loading=!0;const n=(async()=>{try{if(!r.loader)throw new Error(`组件 ${t} 没有 loader`);const s=(await r.loader()).default;return r.config=s,r.loaded=!0,r.loading=!1,this.registry[t]=s,this.registerVueShape(s),this.loadingPromises.delete(t),s}catch(i){throw r.loading=!1,this.loadingPromises.delete(t),console.error(`[懒加载] 组件 ${t} 加载失败:`,i),i}})();return this.loadingPromises.set(t,n),n}async preloadComponent(t){const r=this.lazyRegistry.get(t);if(!r||r.loaded)return!1;try{return await this.loadComponent(t,r),!0}catch{return!1}}async preloadComponents(t){await Promise.all(t.map(r=>this.preloadComponent(r)))}async preloadAllComponents(){const t=Array.from(this.lazyRegistry.keys()),r=t.filter(i=>i.startsWith("__module__")),n=t.filter(i=>!i.startsWith("__module__"));await Promise.all(r.map(async i=>{const s=this.lazyRegistry.get(i);if(s&&!s.loaded)try{await s.loader(),s.loaded=!0}catch(o){console.error(`[预加载] 模块 ${i} 加载失败:`,o)}})),await this.preloadComponents(n)}getComponentByShape(t){return Object.values(this.registry).find(r=>r.shape===t)}getAllComponents(){return{...this.registry}}getAllComponentIds(){const t=Object.keys(this.registry),r=Array.from(this.lazyRegistry.keys());return[...new Set([...t,...r])]}getComponentsByCategory(t){return Object.values(this.registry).filter(r=>r.metadata.category===t)}getComponentList(){return Object.values(this.registry)}hasComponent(t){return t in this.registry}unregister(t){return this.registry[t]?(delete this.registry[t],!0):(console.warn(`组件 ${t} 不存在`),!1)}getCount(){return Object.keys(this.registry).length+this.lazyRegistry.size}getLoadedCount(){return Object.keys(this.registry).length}getLazyLoadStats(){const t=this.lazyRegistry.size,r=Array.from(this.lazyRegistry.values()).filter(s=>s.loaded).length,n=t-r,i=t>0?(r/t*100).toFixed(1):"0.0";return{total:t,loaded:r,pending:n,loadRate:`${i}%`}}clear(){this.registry={}}}const at=new yd,Tn={size:{width:1920,height:1080,preset:"1920*1080"},zoom:{scale:1,min:.1,max:5},offset:{x:0,y:0},background:{color:"#1e293b",size:"origin",repeat:"repeat"},grid:{enabled:!0,size:10,color:"#475569",type:"dot"},snap:{enabled:!0,threshold:10},guides:{enabled:!1,color:"#3b82f6"},magnetism:{enabled:!0,threshold:10}},bd=[{key:"sizePreset",label:"画布尺寸",type:"select",category:"basic",path:"size.preset",defaultValue:"1920*1080",options:[{label:"1920*1080",value:"1920*1080"},{label:"1366*768",value:"1366*768"},{label:"1280*720",value:"1280*720"},{label:"800*600",value:"800*600"}],description:"预设画布尺寸"},{key:"scale",label:"缩放倍数",type:"slider",category:"transform",path:"zoom.scale",defaultValue:1,min:.1,max:5,step:.1,description:"画布缩放比例"},{key:"offsetX",label:"画布X轴偏移",type:"number",category:"transform",path:"offset.x",defaultValue:0,description:"X轴偏移量"},{key:"offsetY",label:"画布Y轴偏移",type:"number",category:"transform",path:"offset.y",defaultValue:0,description:"Y轴偏移量"},{key:"backgroundColor",label:"背景颜色",type:"color",category:"background",path:"background.color",defaultValue:"#1e293b",description:"画布背景颜色"},{key:"backgroundImage",label:"背景图片",type:"image",category:"background",path:"background.image",defaultValue:"",description:"背景图片URL"},{key:"backgroundSize",label:"背景大小",type:"select",category:"background",path:"background.size",defaultValue:"origin",options:[{label:"原始",value:"origin"},{label:"包含",value:"contain"},{label:"覆盖",value:"cover"},{label:"拉伸",value:"stretch"}],description:"背景图片尺寸模式"},{key:"backgroundRepeat",label:"图像重复",type:"select",category:"background",path:"background.repeat",defaultValue:"repeat",options:[{label:"重复",value:"repeat"},{label:"X轴重复",value:"repeat-x"},{label:"Y轴重复",value:"repeat-y"},{label:"不重复",value:"no-repeat"}],description:"背景图片重复模式"},{key:"gridEnabled",label:"网格",type:"boolean",category:"assist",path:"grid.enabled",defaultValue:!0,description:"显示网格"},{key:"gridSize",label:"网格大小",type:"number",category:"assist",path:"grid.size",defaultValue:10,min:5,max:50,description:"网格单元格大小"},{key:"snapEnabled",label:"网格对齐",type:"boolean",category:"assist",path:"snap.enabled",defaultValue:!0,description:"启用网格对齐"},{key:"guidesEnabled",label:"参考线",type:"boolean",category:"assist",path:"guides.enabled",defaultValue:!0,description:"显示参考线"},{key:"magnetismEnabled",label:"吸附",type:"boolean",category:"assist",path:"magnetism.enabled",defaultValue:!0,description:"启用吸附功能"}],vr={"1920*1080":{width:1920,height:1080},"1366*768":{width:1366,height:768},"1280*720":{width:1280,height:720},"800*600":{width:800,height:600}};class wd{constructor(){he(this,"config");this.config=e.reactive({...Tn})}getConfig(){return this.config}updateConfig(t){Object.assign(this.config,t)}updateByPath(t,r){const n=t.split(".");let i=this.config;for(let s=0;s<n.length-1;s++)i=i[n[s]];if(i[n[n.length-1]]=r,t==="size.preset"&&r in vr){const{width:s,height:o}=vr[r];this.config.size.width=s,this.config.size.height=o}}getByPath(t){const r=t.split(".");let n=this.config;for(const i of r)n=n==null?void 0:n[i];return n}setSize(t,r,n){this.config.size.width=t,this.config.size.height=r,n&&(this.config.size.preset=n)}updateSize(t){this.config.size.width=t.width,this.config.size.height=t.height}setZoom(t){const{min:r=.1,max:n=5}=this.config.zoom;this.config.zoom.scale=Math.max(r,Math.min(n,t))}setOffset(t,r){this.config.offset.x=t,this.config.offset.y=r}setBackgroundColor(t){this.config.background.color=t}updateBackground(t){t.color!==void 0&&(this.config.background.color=t.color),t.image!==void 0&&(this.config.background.image=t.image),t.size!==void 0&&(this.config.background.size=t.size),t.repeat!==void 0&&(this.config.background.repeat=t.repeat)}setBackgroundImage(t){this.config.background.image=t}toggleGrid(t){this.config.grid.enabled=t??!this.config.grid.enabled}setGridSize(t){this.config.grid.size=t}toggleSnap(t){this.config.snap.enabled=t??!this.config.snap.enabled}toggleGuides(t){this.config.guides.enabled=t??!this.config.guides.enabled}toggleMagnetism(t){this.config.magnetism.enabled=t??!this.config.magnetism.enabled}reset(){Object.assign(this.config,Tn)}export(){return JSON.stringify(this.config,null,2)}import(t){try{const r=JSON.parse(t);Object.assign(this.config,r)}catch(r){console.error("导入画布配置失败:",r)}}}const $e=new wd,vd=["title"],Ed={class:"library-content"},kd={key:0,class:"component-section"},_d={class:"component-grid"},Sd=["onClick","title"],Nd={class:"component-icon"},Cd={class:"component-name"},xd={key:1,class:"component-section"},Ad={class:"component-grid"},Id=["onClick","title"],Td={class:"component-icon"},Vd={class:"component-name"},Pd={key:2,class:"component-section"},Bd={class:"component-grid"},Od=["onClick","title"],Dd={class:"component-icon"},Rd={class:"component-name"},Vn=Le(e.defineComponent({__name:"ComponentLibrary",props:{isCollapsed:{type:Boolean,default:!1}},emits:["addComponent","update:collapsed"],setup(d,{emit:t}){const r=d,n=t,i=()=>{n("update:collapsed",!r.isCollapsed)},s=e.reactive({basic:!1,chart:!1,iot:!1}),o=m=>{s[m]=!s[m]},a=e.ref(0);let l;const c=e.computed(()=>(a.value,at.getComponentsByCategory("basic"))),u=e.computed(()=>(a.value,at.getComponentsByCategory("chart"))),p=e.computed(()=>(a.value,at.getComponentsByCategory("iot"))),h=m=>{n("addComponent",m.metadata.id)};return e.onMounted(async()=>{try{await at.preloadAllComponents(),a.value++}catch(E){console.error("[组件库] 预加载组件失败:",E)}let m=Object.keys(at.getAllComponents()).length;l=setInterval(()=>{const E=Object.keys(at.getAllComponents()).length;E!==m&&(m=E,a.value++)},500)}),e.onBeforeUnmount(()=>{l&&clearInterval(l)}),(m,f)=>(e.openBlock(),e.createElementBlock("aside",{class:e.normalizeClass(["component-library",{collapsed:d.isCollapsed}])},[e.createElementVNode("button",{class:"collapse-btn",onClick:i,title:d.isCollapsed?"展开组件库":"折叠组件库"},[...f[3]||(f[3]=[e.createElementVNode("span",{class:"collapse-icon"},"◀",-1)])],8,vd),f[7]||(f[7]=e.createElementVNode("div",{class:"library-header"},[e.createElementVNode("h3",null,"组件库")],-1)),e.createElementVNode("div",Ed,[c.value.length>0?(e.openBlock(),e.createElementBlock("div",kd,[e.createElementVNode("div",{class:"section-header",onClick:f[0]||(f[0]=E=>o("basic"))},[f[4]||(f[4]=e.createElementVNode("h4",{class:"section-title"},"基础组件",-1)),e.createElementVNode("span",{class:e.normalizeClass(["toggle-icon",{collapsed:s.basic}])},"▼",2)]),e.withDirectives(e.createElementVNode("div",_d,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value,E=>(e.openBlock(),e.createElementBlock("div",{key:E.metadata.id,class:"component-item",onClick:N=>h(E),title:E.metadata.description||E.metadata.name},[e.createElementVNode("span",Nd,e.toDisplayString(E.metadata.icon),1),e.createElementVNode("span",Cd,e.toDisplayString(E.metadata.name),1)],8,Sd))),128))],512),[[e.vShow,!s.basic]])])):e.createCommentVNode("",!0),u.value.length>0?(e.openBlock(),e.createElementBlock("div",xd,[e.createElementVNode("div",{class:"section-header",onClick:f[1]||(f[1]=E=>o("chart"))},[f[5]||(f[5]=e.createElementVNode("h4",{class:"section-title"},"图表组件",-1)),e.createElementVNode("span",{class:e.normalizeClass(["toggle-icon",{collapsed:s.chart}])},"▼",2)]),e.withDirectives(e.createElementVNode("div",Ad,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.value,E=>(e.openBlock(),e.createElementBlock("div",{key:E.metadata.id,class:"component-item",onClick:N=>h(E),title:E.metadata.description||E.metadata.name},[e.createElementVNode("span",Td,e.toDisplayString(E.metadata.icon),1),e.createElementVNode("span",Vd,e.toDisplayString(E.metadata.name),1)],8,Id))),128))],512),[[e.vShow,!s.chart]])])):e.createCommentVNode("",!0),p.value.length>0?(e.openBlock(),e.createElementBlock("div",Pd,[e.createElementVNode("div",{class:"section-header",onClick:f[2]||(f[2]=E=>o("iot"))},[f[6]||(f[6]=e.createElementVNode("h4",{class:"section-title"},"IoT组件",-1)),e.createElementVNode("span",{class:e.normalizeClass(["toggle-icon",{collapsed:s.iot}])},"▼",2)]),e.withDirectives(e.createElementVNode("div",Bd,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p.value,E=>(e.openBlock(),e.createElementBlock("div",{key:E.metadata.id,class:"component-item",onClick:N=>h(E),title:E.metadata.description||E.metadata.name},[e.createElementVNode("span",Dd,e.toDisplayString(E.metadata.icon),1),e.createElementVNode("span",Rd,e.toDisplayString(E.metadata.name),1)],8,Od))),128))],512),[[e.vShow,!s.iot]])])):e.createCommentVNode("",!0)])],2))}}),[["__scopeId","data-v-6b27e82b"]]),Md={class:"canvas-area"},$d=Le(e.defineComponent({__name:"CanvasArea",setup(d,{expose:t}){const r=e.ref();return t({containerRef:r}),(n,i)=>(e.openBlock(),e.createElementBlock("div",Md,[e.createElementVNode("div",{ref_key:"containerRef",ref:r,class:"canvas-container"},null,512)]))}}),[["__scopeId","data-v-728397ea"]]),jd={class:"canvas-config-panel"},Ld={class:"panel-content"},Ud={class:"config-section"},Fd={class:"config-item"},zd={key:0,class:"config-item"},Wd={class:"number-input-group"},qd={key:1,class:"config-item"},Gd={class:"number-input-group"},Hd={class:"config-section"},Kd={class:"config-item"},Yd={class:"slider-group"},Jd={class:"value-display"},Qd={class:"config-item"},Xd={class:"number-input-group"},Zd={class:"config-item"},eu={class:"number-input-group"},tu={class:"config-section"},ru={class:"config-item"},nu={class:"config-item"},ou={class:"image-upload"},iu={class:"config-item"},su={class:"config-item"},au={class:"config-section"},lu={class:"config-item"},cu={class:"switch"},du={class:"config-item"},uu={class:"switch"},fu={class:"config-item"},pu={class:"switch"},hu={class:"config-item"},mu={class:"switch"},gu={key:0,class:"config-item"},yu={class:"number-input-group"},Pn=Le(e.defineComponent({__name:"CanvasConfigPanel",setup(d){const t=e.computed(()=>$e.getConfig()),r=e.ref(),n=e.ref(t.value.size.width),i=e.ref(t.value.size.height),s=()=>{const m=t.value.size.preset;if(m==="custom")n.value=t.value.size.width,i.value=t.value.size.height;else if(m&&m in vr){const{width:f,height:E}=vr[m];$e.setSize(f,E,m)}},o=()=>{t.value.size.preset==="custom"&&$e.setSize(n.value,i.value,"custom")},a=(m,f)=>{m==="width"?n.value=Math.max(800,Math.min(7680,n.value+f)):i.value=Math.max(600,Math.min(4320,i.value+f)),o()},l=(m,f)=>{const E=t.value.offset[m];$e.setOffset(m==="x"?E+f:t.value.offset.x,m==="y"?E+f:t.value.offset.y)},c=m=>{const f=Math.max(5,Math.min(50,t.value.grid.size+m));$e.setGridSize(f)},u=()=>{var m;(m=r.value)==null||m.click()},p=m=>{var N;const E=(N=m.target.files)==null?void 0:N[0];if(E){const k=new FileReader;k.onload=g=>{var _;const v=(_=g.target)==null?void 0:_.result;$e.updateByPath("background.image",v)},k.readAsDataURL(E)}},h=()=>{$e.updateByPath("background.image",""),r.value&&(r.value.value="")};return(m,f)=>(e.openBlock(),e.createElementBlock("div",jd,[f[51]||(f[51]=e.createElementVNode("div",{class:"panel-header"},[e.createElementVNode("h3",null,"画布配置")],-1)),e.createElementVNode("div",Ld,[e.createElementVNode("div",Ud,[f[28]||(f[28]=e.createElementVNode("h4",{class:"section-title"},"基础配置",-1)),e.createElementVNode("div",Fd,[f[25]||(f[25]=e.createElementVNode("label",null,"画布尺寸",-1)),e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":f[0]||(f[0]=E=>t.value.size.preset=E),onChange:s,class:"config-select"},[...f[24]||(f[24]=[e.createStaticVNode('<option value="1920*1080" data-v-6f650ae1>1920*1080</option><option value="1366*768" data-v-6f650ae1>1366*768</option><option value="1280*720" data-v-6f650ae1>1280*720</option><option value="800*600" data-v-6f650ae1>800*600</option><option value="custom" data-v-6f650ae1>自定义</option>',5)])],544),[[e.vModelSelect,t.value.size.preset]])]),t.value.size.preset==="custom"?(e.openBlock(),e.createElementBlock("div",zd,[f[26]||(f[26]=e.createElementVNode("label",null,"宽度",-1)),e.createElementVNode("div",Wd,[e.createElementVNode("button",{onClick:f[1]||(f[1]=E=>a("width",-100)),class:"adjust-btn"},"-"),e.withDirectives(e.createElementVNode("input",{type:"number","onUpdate:modelValue":f[2]||(f[2]=E=>n.value=E),onChange:o,min:800,max:7680,class:"config-number"},null,544),[[e.vModelText,n.value,void 0,{number:!0}]]),e.createElementVNode("button",{onClick:f[3]||(f[3]=E=>a("width",100)),class:"adjust-btn"},"+")])])):e.createCommentVNode("",!0),t.value.size.preset==="custom"?(e.openBlock(),e.createElementBlock("div",qd,[f[27]||(f[27]=e.createElementVNode("label",null,"高度",-1)),e.createElementVNode("div",Gd,[e.createElementVNode("button",{onClick:f[4]||(f[4]=E=>a("height",-100)),class:"adjust-btn"},"-"),e.withDirectives(e.createElementVNode("input",{type:"number","onUpdate:modelValue":f[5]||(f[5]=E=>i.value=E),onChange:o,min:600,max:4320,class:"config-number"},null,544),[[e.vModelText,i.value,void 0,{number:!0}]]),e.createElementVNode("button",{onClick:f[6]||(f[6]=E=>a("height",100)),class:"adjust-btn"},"+")])])):e.createCommentVNode("",!0)]),e.createElementVNode("div",Hd,[f[32]||(f[32]=e.createElementVNode("h4",{class:"section-title"},"变换",-1)),e.createElementVNode("div",Kd,[f[29]||(f[29]=e.createElementVNode("label",null,"缩放倍数",-1)),e.createElementVNode("div",Yd,[e.withDirectives(e.createElementVNode("input",{type:"range","onUpdate:modelValue":f[7]||(f[7]=E=>t.value.zoom.scale=E),min:.1,max:5,step:.1,class:"config-slider"},null,512),[[e.vModelText,t.value.zoom.scale,void 0,{number:!0}]]),e.createElementVNode("span",Jd,e.toDisplayString(t.value.zoom.scale.toFixed(1)),1)])]),e.createElementVNode("div",Qd,[f[30]||(f[30]=e.createElementVNode("label",null,"画布X轴偏移",-1)),e.createElementVNode("div",Xd,[e.createElementVNode("button",{onClick:f[8]||(f[8]=E=>l("x",-10)),class:"adjust-btn"},"-"),e.withDirectives(e.createElementVNode("input",{type:"number","onUpdate:modelValue":f[9]||(f[9]=E=>t.value.offset.x=E),class:"config-number"},null,512),[[e.vModelText,t.value.offset.x,void 0,{number:!0}]]),e.createElementVNode("button",{onClick:f[10]||(f[10]=E=>l("x",10)),class:"adjust-btn"},"+")])]),e.createElementVNode("div",Zd,[f[31]||(f[31]=e.createElementVNode("label",null,"画布Y轴偏移",-1)),e.createElementVNode("div",eu,[e.createElementVNode("button",{onClick:f[11]||(f[11]=E=>l("y",-10)),class:"adjust-btn"},"-"),e.withDirectives(e.createElementVNode("input",{type:"number","onUpdate:modelValue":f[12]||(f[12]=E=>t.value.offset.y=E),class:"config-number"},null,512),[[e.vModelText,t.value.offset.y,void 0,{number:!0}]]),e.createElementVNode("button",{onClick:f[13]||(f[13]=E=>l("y",10)),class:"adjust-btn"},"+")])])]),e.createElementVNode("div",tu,[f[40]||(f[40]=e.createElementVNode("h4",{class:"section-title"},"背景",-1)),e.createElementVNode("div",ru,[f[33]||(f[33]=e.createElementVNode("label",null,"背景颜色",-1)),e.withDirectives(e.createElementVNode("input",{type:"color","onUpdate:modelValue":f[14]||(f[14]=E=>t.value.background.color=E),class:"config-color"},null,512),[[e.vModelText,t.value.background.color]])]),e.createElementVNode("div",nu,[f[35]||(f[35]=e.createElementVNode("label",null,"背景图片",-1)),e.createElementVNode("div",ou,[e.createElementVNode("input",{type:"file",accept:"image/*",onChange:p,ref_key:"fileInput",ref:r,style:{display:"none"}},null,544),e.createElementVNode("button",{onClick:u,class:"upload-btn"},[...f[34]||(f[34]=[e.createElementVNode("span",null,"📄",-1)])]),t.value.background.image?(e.openBlock(),e.createElementBlock("button",{key:0,onClick:h,class:"clear-btn",title:"清除背景图"}," ✕ ")):e.createCommentVNode("",!0)])]),e.createElementVNode("div",iu,[f[37]||(f[37]=e.createElementVNode("label",null,"背景大小",-1)),e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":f[15]||(f[15]=E=>t.value.background.size=E),class:"config-select"},[...f[36]||(f[36]=[e.createElementVNode("option",{value:"origin"},"原始",-1),e.createElementVNode("option",{value:"contain"},"包含",-1),e.createElementVNode("option",{value:"cover"},"覆盖",-1),e.createElementVNode("option",{value:"stretch"},"拉伸",-1)])],512),[[e.vModelSelect,t.value.background.size]])]),e.createElementVNode("div",su,[f[39]||(f[39]=e.createElementVNode("label",null,"图像重复",-1)),e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":f[16]||(f[16]=E=>t.value.background.repeat=E),class:"config-select"},[...f[38]||(f[38]=[e.createElementVNode("option",{value:"repeat"},"重复",-1),e.createElementVNode("option",{value:"repeat-x"},"X轴重复",-1),e.createElementVNode("option",{value:"repeat-y"},"Y轴重复",-1),e.createElementVNode("option",{value:"no-repeat"},"不重复",-1)])],512),[[e.vModelSelect,t.value.background.repeat]])])]),e.createElementVNode("div",au,[f[50]||(f[50]=e.createElementVNode("h4",{class:"section-title"},"辅助",-1)),e.createElementVNode("div",lu,[f[42]||(f[42]=e.createElementVNode("label",null,"吸附",-1)),e.createElementVNode("label",cu,[e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":f[17]||(f[17]=E=>t.value.magnetism.enabled=E)},null,512),[[e.vModelCheckbox,t.value.magnetism.enabled]]),f[41]||(f[41]=e.createElementVNode("span",{class:"slider"},null,-1))])]),e.createElementVNode("div",du,[f[44]||(f[44]=e.createElementVNode("label",null,"网格",-1)),e.createElementVNode("label",uu,[e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":f[18]||(f[18]=E=>t.value.grid.enabled=E)},null,512),[[e.vModelCheckbox,t.value.grid.enabled]]),f[43]||(f[43]=e.createElementVNode("span",{class:"slider"},null,-1))])]),e.createElementVNode("div",fu,[f[46]||(f[46]=e.createElementVNode("label",null,"网格对齐",-1)),e.createElementVNode("label",pu,[e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":f[19]||(f[19]=E=>t.value.snap.enabled=E)},null,512),[[e.vModelCheckbox,t.value.snap.enabled]]),f[45]||(f[45]=e.createElementVNode("span",{class:"slider"},null,-1))])]),e.createElementVNode("div",hu,[f[48]||(f[48]=e.createElementVNode("label",null,"参考线",-1)),e.createElementVNode("label",mu,[e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":f[20]||(f[20]=E=>t.value.guides.enabled=E)},null,512),[[e.vModelCheckbox,t.value.guides.enabled]]),f[47]||(f[47]=e.createElementVNode("span",{class:"slider"},null,-1))])]),t.value.grid.enabled?(e.openBlock(),e.createElementBlock("div",gu,[f[49]||(f[49]=e.createElementVNode("label",null,"网格大小",-1)),e.createElementVNode("div",yu,[e.createElementVNode("button",{onClick:f[21]||(f[21]=E=>c(-5)),class:"adjust-btn"},"-"),e.withDirectives(e.createElementVNode("input",{type:"number","onUpdate:modelValue":f[22]||(f[22]=E=>t.value.grid.size=E),min:5,max:50,class:"config-number"},null,512),[[e.vModelText,t.value.grid.size,void 0,{number:!0}]]),e.createElementVNode("button",{onClick:f[23]||(f[23]=E=>c(5)),class:"adjust-btn"},"+")])])):e.createCommentVNode("",!0)])])]))}}),[["__scopeId","data-v-6f650ae1"]]),bu={class:"tab-pane"},wu={class:"property-section"},vu={class:"property-item-inline"},Eu=["value"],ku={class:"property-item-inline"},_u=["value"],Su={class:"property-item-inline"},Nu=["value"],Cu={class:"property-section"},xu={class:"property-row"},Au={class:"property-item"},Iu=["value"],Tu={class:"property-item"},Vu=["value"],Pu={class:"property-row"},Bu={class:"property-item"},Ou=["value"],Du={class:"property-item"},Ru=["value"],Mu={key:0,class:"property-section"},$u={key:0,class:"property-item-inline"},ju=["value"],Lu={key:1,class:"property-item-inline"},Uu={class:"color-input-wrapper"},Fu=["value"],zu={class:"color-value"},Wu={key:2,class:"property-item-inline"},qu={class:"color-input-wrapper"},Gu=["value"],Hu={class:"color-value"},Ku={key:3,class:"property-item-inline"},Yu=["value"],Ju={key:4,class:"property-item-inline"},Qu=["value"],Xu={key:1,class:"property-section"},Zu=["value","onInput","placeholder"],ef=["value","onInput","min","max","step"],tf={key:2,class:"color-input-wrapper"},rf=["value","onInput"],nf={class:"color-value"},of={key:3,class:"checkbox-wrapper"},sf=["checked","onChange"],af={class:"checkbox-label"},lf=["value","onChange"],cf=["value"],Bn=Le(e.defineComponent({__name:"BasicPropertiesTab",props:{selectedNode:{},nodePosition:{},nodeSize:{},nodeAttrs:{}},emits:["update-position","update-size","update-label","update-fill","update-stroke","update-stroke-width","update-opacity","update-component-name","update-dynamic-prop"],setup(d,{emit:t}){const r=d,n=e.computed(()=>{var g;const k=(g=r.selectedNode)==null?void 0:g.getData();return(k==null?void 0:k.presetBindings)||[]}),i=k=>n.value.some(g=>g.suggestedDriverProperty===k),s=e.computed(()=>i("text")||i("name")),o=e.computed(()=>i("fill")),a=e.computed(()=>i("stroke")),l=e.computed(()=>i("strokeWidth")),c=e.computed(()=>i("opacity")),u=e.computed(()=>s.value||o.value||a.value||l.value||c.value),p=k=>{var v;const g=n.value.find(_=>_.suggestedDriverProperty===k);return(v=g==null?void 0:g.suggestedParams)!=null&&v.defaultColor?g.suggestedParams.defaultColor:k==="fill"?"#3b82f6":"#2563eb"},h=t,m=e.computed(()=>{var g,v;if(!((v=(g=r.selectedNode)==null?void 0:g.data)!=null&&v.props))return[];const k=["label","fill","stroke","strokeWidth","opacity"];return r.selectedNode.data.props.filter(_=>!k.includes(_.key))}),f=k=>{if(!k.path)return k.defaultValue;const g=k.path.split(".");let v=r.selectedNode;for(const _ of g)if(v&&typeof v=="object")v=v[_];else return k.defaultValue;return v!==void 0?v:k.defaultValue},E=k=>!k||k==="transparent"?"#000000":typeof k=="string"&&k.startsWith("#")?k:"#000000",N=(k,g)=>{var S;const v=g.target;let _;if(k.type==="number")_=Number(v.value);else if(k.type==="boolean")_=v.checked;else if(k.type==="select"){const B=(S=k.options)==null?void 0:S.find(P=>String(P.value)===v.value);_=B?B.value:v.value}else _=v.value;h("update-dynamic-prop",k.path,_)};return(k,g)=>{var v,_,S,B,P,T,A,C,O,I,U,Y,j,le,ne,te,ue;return e.openBlock(),e.createElementBlock("div",bu,[e.createElementVNode("div",wu,[g[13]||(g[13]=e.createElementVNode("h4",null,"基础信息",-1)),e.createElementVNode("div",vu,[g[10]||(g[10]=e.createElementVNode("label",null,"组件名称",-1)),e.createElementVNode("input",{type:"text",value:((v=d.selectedNode.getData())==null?void 0:v.componentName)||"",onInput:g[0]||(g[0]=$=>k.$emit("update-component-name",$)),placeholder:"请输入组件名称"},null,40,Eu)]),e.createElementVNode("div",ku,[g[11]||(g[11]=e.createElementVNode("label",null,"ID",-1)),e.createElementVNode("input",{type:"text",value:d.selectedNode.id,disabled:""},null,8,_u)]),e.createElementVNode("div",Su,[g[12]||(g[12]=e.createElementVNode("label",null,"类型",-1)),e.createElementVNode("input",{type:"text",value:d.selectedNode.shape,disabled:""},null,8,Nu)])]),e.createElementVNode("div",Cu,[g[18]||(g[18]=e.createElementVNode("h4",null,"位置和尺寸",-1)),e.createElementVNode("div",xu,[e.createElementVNode("div",Au,[g[14]||(g[14]=e.createElementVNode("label",null,"X",-1)),e.createElementVNode("input",{type:"number",value:d.nodePosition.x,onInput:g[1]||(g[1]=$=>k.$emit("update-position","x",$))},null,40,Iu)]),e.createElementVNode("div",Tu,[g[15]||(g[15]=e.createElementVNode("label",null,"Y",-1)),e.createElementVNode("input",{type:"number",value:d.nodePosition.y,onInput:g[2]||(g[2]=$=>k.$emit("update-position","y",$))},null,40,Vu)])]),e.createElementVNode("div",Pu,[e.createElementVNode("div",Bu,[g[16]||(g[16]=e.createElementVNode("label",null,"宽度",-1)),e.createElementVNode("input",{type:"number",value:d.nodeSize.width,onInput:g[3]||(g[3]=$=>k.$emit("update-size","width",$))},null,40,Ou)]),e.createElementVNode("div",Du,[g[17]||(g[17]=e.createElementVNode("label",null,"高度",-1)),e.createElementVNode("input",{type:"number",value:d.nodeSize.height,onInput:g[4]||(g[4]=$=>k.$emit("update-size","height",$))},null,40,Ru)])])]),u.value?(e.openBlock(),e.createElementBlock("div",Mu,[g[24]||(g[24]=e.createElementVNode("h4",null,"样式",-1)),s.value?(e.openBlock(),e.createElementBlock("div",$u,[g[19]||(g[19]=e.createElementVNode("label",null,"初始文本",-1)),e.createElementVNode("input",{type:"text",value:((S=(_=d.nodeAttrs)==null?void 0:_.text)==null?void 0:S.text)||((P=(B=d.nodeAttrs)==null?void 0:B.label)==null?void 0:P.text)||d.selectedNode.getProp("label")||"",onInput:g[5]||(g[5]=$=>k.$emit("update-label",$)),placeholder:"设置默认显示文本"},null,40,ju)])):e.createCommentVNode("",!0),o.value?(e.openBlock(),e.createElementBlock("div",Lu,[g[20]||(g[20]=e.createElementVNode("label",null,"填充颜色",-1)),e.createElementVNode("div",Uu,[e.createElementVNode("input",{type:"color",value:E((A=(T=d.nodeAttrs)==null?void 0:T.body)==null?void 0:A.fill)||p("fill"),onInput:g[6]||(g[6]=$=>k.$emit("update-fill",$))},null,40,Fu),e.createElementVNode("span",zu,e.toDisplayString(((O=(C=d.nodeAttrs)==null?void 0:C.body)==null?void 0:O.fill)||p("fill")),1)])])):e.createCommentVNode("",!0),a.value?(e.openBlock(),e.createElementBlock("div",Wu,[g[21]||(g[21]=e.createElementVNode("label",null,"边框颜色",-1)),e.createElementVNode("div",qu,[e.createElementVNode("input",{type:"color",value:E((U=(I=d.nodeAttrs)==null?void 0:I.body)==null?void 0:U.stroke)||p("stroke"),onInput:g[7]||(g[7]=$=>k.$emit("update-stroke",$))},null,40,Gu),e.createElementVNode("span",Hu,e.toDisplayString(((j=(Y=d.nodeAttrs)==null?void 0:Y.body)==null?void 0:j.stroke)||p("stroke")),1)])])):e.createCommentVNode("",!0),l.value?(e.openBlock(),e.createElementBlock("div",Ku,[g[22]||(g[22]=e.createElementVNode("label",null,"边框宽度",-1)),e.createElementVNode("input",{type:"number",min:"0",max:"10",value:((ne=(le=d.nodeAttrs)==null?void 0:le.body)==null?void 0:ne.strokeWidth)||2,onInput:g[8]||(g[8]=$=>k.$emit("update-stroke-width",$))},null,40,Yu)])):e.createCommentVNode("",!0),c.value?(e.openBlock(),e.createElementBlock("div",Ju,[g[23]||(g[23]=e.createElementVNode("label",null,"透明度",-1)),e.createElementVNode("input",{type:"number",min:"0",max:"1",step:"0.1",value:((ue=(te=d.nodeAttrs)==null?void 0:te.body)==null?void 0:ue.opacity)!==void 0?d.nodeAttrs.body.opacity:1,onInput:g[9]||(g[9]=$=>k.$emit("update-opacity",$))},null,40,Qu)])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),m.value.length>0?(e.openBlock(),e.createElementBlock("div",Xu,[g[25]||(g[25]=e.createElementVNode("h4",null,"组件属性",-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(m.value,$=>(e.openBlock(),e.createElementBlock("div",{key:$.key,class:"property-item-inline"},[e.createElementVNode("label",null,e.toDisplayString($.label),1),$.type==="text"?(e.openBlock(),e.createElementBlock("input",{key:0,type:"text",value:f($),onInput:se=>N($,se),placeholder:$.defaultValue},null,40,Zu)):$.type==="number"?(e.openBlock(),e.createElementBlock("input",{key:1,type:"number",value:f($),onInput:se=>N($,se),min:$.min,max:$.max,step:$.step},null,40,ef)):$.type==="color"?(e.openBlock(),e.createElementBlock("div",tf,[e.createElementVNode("input",{type:"color",value:E(f($)),onInput:se=>N($,se)},null,40,rf),e.createElementVNode("span",nf,e.toDisplayString(f($)),1)])):$.type==="boolean"?(e.openBlock(),e.createElementBlock("div",of,[e.createElementVNode("input",{type:"checkbox",checked:f($),onChange:se=>N($,se)},null,40,sf),e.createElementVNode("span",af,e.toDisplayString(f($)?"是":"否"),1)])):$.type==="select"?(e.openBlock(),e.createElementBlock("select",{key:4,value:f($),onChange:se=>N($,se)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList($.options,se=>(e.openBlock(),e.createElementBlock("option",{key:se.value,value:se.value},e.toDisplayString(se.label),9,cf))),128))],40,lf)):e.createCommentVNode("",!0)]))),128))])):e.createCommentVNode("",!0)])}}}),[["__scopeId","data-v-6e462742"]]);var On=Object.defineProperty,df=Object.getOwnPropertyDescriptor,uf=Object.getOwnPropertyNames,ff=Object.prototype.hasOwnProperty,pt=(d,t)=>()=>(d&&(t=d(d=0)),t),_e=(d,t)=>()=>(t||d((t={exports:{}}).exports,t),t.exports),lr=(d,t)=>{for(var r in t)On(d,r,{get:t[r],enumerable:!0})},pf=(d,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of uf(t))!ff.call(d,i)&&i!==r&&On(d,i,{get:()=>t[i],enumerable:!(n=df(t,i))||n.enumerable});return d},We=d=>pf(On({},"__esModule",{value:!0}),d),be=pt(()=>{}),ze={};lr(ze,{_debugEnd:()=>go,_debugProcess:()=>mo,_events:()=>Po,_eventsCount:()=>Bo,_exiting:()=>eo,_fatalExceptions:()=>fo,_getActiveHandles:()=>xs,_getActiveRequests:()=>Cs,_kill:()=>no,_linkedBinding:()=>Ss,_maxListeners:()=>Vo,_preload_modules:()=>Ao,_rawDebug:()=>Qn,_startProfilerIdleNotifier:()=>yo,_stopProfilerIdleNotifier:()=>bo,_tickCallback:()=>ho,abort:()=>ko,addListener:()=>Oo,allowedNodeEnvironmentFlags:()=>co,arch:()=>Mn,argv:()=>Ln,argv0:()=>xo,assert:()=>As,binding:()=>qn,browser:()=>Jn,chdir:()=>Kn,config:()=>to,cpuUsage:()=>kr,cwd:()=>Hn,debugPort:()=>Co,default:()=>Fo,dlopen:()=>Ns,domain:()=>Zn,emit:()=>jo,emitWarning:()=>Wn,env:()=>jn,execArgv:()=>Un,execPath:()=>No,exit:()=>ao,features:()=>uo,hasUncaughtExceptionCaptureCallback:()=>Is,hrtime:()=>$r,kill:()=>so,listeners:()=>Vs,memoryUsage:()=>io,moduleLoadList:()=>Xn,nextTick:()=>ks,off:()=>Ro,on:()=>Nt,once:()=>Do,openStdin:()=>lo,pid:()=>_o,platform:()=>$n,ppid:()=>So,prependListener:()=>Lo,prependOnceListener:()=>Uo,reallyExit:()=>ro,release:()=>Yn,removeAllListeners:()=>$o,removeListener:()=>Mo,resourceUsage:()=>oo,setSourceMapsEnabled:()=>Io,setUncaughtExceptionCaptureCallback:()=>po,stderr:()=>vo,stdin:()=>Eo,stdout:()=>wo,title:()=>Rn,umask:()=>Gn,uptime:()=>Ts,version:()=>Fn,versions:()=>zn});function Dn(d){throw new Error("Node.js process "+d+" is not supported by JSPM core outside of Node.js")}function hf(){!Zt||!er||(Zt=!1,er.length?Et=er.concat(Et):Er=-1,Et.length&&Es())}function Es(){if(!Zt){var d=setTimeout(hf,0);Zt=!0;for(var t=Et.length;t;){for(er=Et,Et=[];++Er<t;)er&&er[Er].run();Er=-1,t=Et.length}er=null,Zt=!1,clearTimeout(d)}}function ks(d){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];Et.push(new _s(d,t)),Et.length===1&&!Zt&&setTimeout(Es,0)}function _s(d,t){this.fun=d,this.array=t}function lt(){}function Ss(d){Dn("_linkedBinding")}function Ns(d){Dn("dlopen")}function Cs(){return[]}function xs(){return[]}function As(d,t){if(!d)throw new Error(t||"assertion error")}function Is(){return!1}function Ts(){return Ct.now()/1e3}function $r(d){var t=Math.floor((Date.now()-Ct.now())*.001),r=Ct.now()*.001,n=Math.floor(r)+t,i=Math.floor(r%1*1e9);return d&&(n=n-d[0],i=i-d[1],i<0&&(n--,i+=jr)),[n,i]}function Nt(){return Fo}function Vs(d){return[]}var Et,Zt,er,Er,Rn,Mn,$n,jn,Ln,Un,Fn,zn,Wn,qn,Gn,Hn,Kn,Yn,Jn,Qn,Xn,Zn,eo,to,ro,no,kr,oo,io,so,ao,lo,co,uo,fo,po,ho,mo,go,yo,bo,wo,vo,Eo,ko,_o,So,No,Co,xo,Ao,Io,Ct,To,jr,Vo,Po,Bo,Oo,Do,Ro,Mo,$o,jo,Lo,Uo,Fo,mf=pt(()=>{be(),ve(),we(),Et=[],Zt=!1,Er=-1,_s.prototype.run=function(){this.fun.apply(null,this.array)},Rn="browser",Mn="x64",$n="browser",jn={PATH:"/usr/bin",LANG:typeof navigator<"u"?navigator.language+".UTF-8":void 0,PWD:"/",HOME:"/home",TMP:"/tmp"},Ln=["/usr/bin/node"],Un=[],Fn="v16.8.0",zn={},Wn=function(d,t){console.warn((t?t+": ":"")+d)},qn=function(d){Dn("binding")},Gn=function(d){return 0},Hn=function(){return"/"},Kn=function(d){},Yn={name:"node",sourceUrl:"",headersUrl:"",libUrl:""},Jn=!0,Qn=lt,Xn=[],Zn={},eo=!1,to={},ro=lt,no=lt,kr=function(){return{}},oo=kr,io=kr,so=lt,ao=lt,lo=lt,co={},uo={inspector:!1,debug:!1,uv:!1,ipv6:!1,tls_alpn:!1,tls_sni:!1,tls_ocsp:!1,tls:!1,cached_builtins:!0},fo=lt,po=lt,ho=lt,mo=lt,go=lt,yo=lt,bo=lt,wo=void 0,vo=void 0,Eo=void 0,ko=lt,_o=2,So=1,No="/bin/usr/node",Co=9229,xo="node",Ao=[],Io=lt,Ct={now:typeof performance<"u"?performance.now.bind(performance):void 0,timing:typeof performance<"u"?performance.timing:void 0},Ct.now===void 0&&(To=Date.now(),Ct.timing&&Ct.timing.navigationStart&&(To=Ct.timing.navigationStart),Ct.now=()=>Date.now()-To),jr=1e9,$r.bigint=function(d){var t=$r(d);return typeof BigInt>"u"?t[0]*jr+t[1]:BigInt(t[0]*jr)+BigInt(t[1])},Vo=10,Po={},Bo=0,Oo=Nt,Do=Nt,Ro=Nt,Mo=Nt,$o=Nt,jo=lt,Lo=Nt,Uo=Nt,Fo={version:Fn,versions:zn,arch:Mn,platform:$n,browser:Jn,release:Yn,_rawDebug:Qn,moduleLoadList:Xn,binding:qn,_linkedBinding:Ss,_events:Po,_eventsCount:Bo,_maxListeners:Vo,on:Nt,addListener:Oo,once:Do,off:Ro,removeListener:Mo,removeAllListeners:$o,emit:jo,prependListener:Lo,prependOnceListener:Uo,listeners:Vs,domain:Zn,_exiting:eo,config:to,dlopen:Ns,uptime:Ts,_getActiveRequests:Cs,_getActiveHandles:xs,reallyExit:ro,_kill:no,cpuUsage:kr,resourceUsage:oo,memoryUsage:io,kill:so,exit:ao,openStdin:lo,allowedNodeEnvironmentFlags:co,assert:As,features:uo,_fatalExceptions:fo,setUncaughtExceptionCaptureCallback:po,hasUncaughtExceptionCaptureCallback:Is,emitWarning:Wn,nextTick:ks,_tickCallback:ho,_debugProcess:mo,_debugEnd:go,_startProfilerIdleNotifier:yo,_stopProfilerIdleNotifier:bo,stdout:wo,stdin:Eo,stderr:vo,abort:ko,umask:Gn,chdir:Kn,cwd:Hn,env:jn,title:Rn,argv:Ln,execArgv:Un,pid:_o,ppid:So,execPath:No,debugPort:Co,hrtime:$r,argv0:xo,_preload_modules:Ao,setSourceMapsEnabled:Io}}),we=pt(()=>{mf()});function gf(){if(zo)return cr;zo=!0,cr.byteLength=a,cr.toByteArray=c,cr.fromByteArray=h;for(var d=[],t=[],r=typeof Uint8Array<"u"?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,s=n.length;i<s;++i)d[i]=n[i],t[n.charCodeAt(i)]=i;t[45]=62,t[95]=63;function o(m){var f=m.length;if(f%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var E=m.indexOf("=");E===-1&&(E=f);var N=E===f?0:4-E%4;return[E,N]}function a(m){var f=o(m),E=f[0],N=f[1];return(E+N)*3/4-N}function l(m,f,E){return(f+E)*3/4-E}function c(m){var f,E=o(m),N=E[0],k=E[1],g=new r(l(m,N,k)),v=0,_=k>0?N-4:N,S;for(S=0;S<_;S+=4)f=t[m.charCodeAt(S)]<<18|t[m.charCodeAt(S+1)]<<12|t[m.charCodeAt(S+2)]<<6|t[m.charCodeAt(S+3)],g[v++]=f>>16&255,g[v++]=f>>8&255,g[v++]=f&255;return k===2&&(f=t[m.charCodeAt(S)]<<2|t[m.charCodeAt(S+1)]>>4,g[v++]=f&255),k===1&&(f=t[m.charCodeAt(S)]<<10|t[m.charCodeAt(S+1)]<<4|t[m.charCodeAt(S+2)]>>2,g[v++]=f>>8&255,g[v++]=f&255),g}function u(m){return d[m>>18&63]+d[m>>12&63]+d[m>>6&63]+d[m&63]}function p(m,f,E){for(var N,k=[],g=f;g<E;g+=3)N=(m[g]<<16&16711680)+(m[g+1]<<8&65280)+(m[g+2]&255),k.push(u(N));return k.join("")}function h(m){for(var f,E=m.length,N=E%3,k=[],g=16383,v=0,_=E-N;v<_;v+=g)k.push(p(m,v,v+g>_?_:v+g));return N===1?(f=m[E-1],k.push(d[f>>2]+d[f<<4&63]+"==")):N===2&&(f=(m[E-2]<<8)+m[E-1],k.push(d[f>>10]+d[f>>4&63]+d[f<<2&63]+"=")),k.join("")}return cr}function yf(){return Wo?_r:(Wo=!0,_r.read=function(d,t,r,n,i){var s,o,a=i*8-n-1,l=(1<<a)-1,c=l>>1,u=-7,p=r?i-1:0,h=r?-1:1,m=d[t+p];for(p+=h,s=m&(1<<-u)-1,m>>=-u,u+=a;u>0;s=s*256+d[t+p],p+=h,u-=8);for(o=s&(1<<-u)-1,s>>=-u,u+=n;u>0;o=o*256+d[t+p],p+=h,u-=8);if(s===0)s=1-c;else{if(s===l)return o?NaN:(m?-1:1)*(1/0);o=o+Math.pow(2,n),s=s-c}return(m?-1:1)*o*Math.pow(2,s-n)},_r.write=function(d,t,r,n,i,s){var o,a,l,c=s*8-i-1,u=(1<<c)-1,p=u>>1,h=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,m=n?0:s-1,f=n?1:-1,E=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,o=u):(o=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-o))<1&&(o--,l*=2),o+p>=1?t+=h/l:t+=h*Math.pow(2,1-p),t*l>=2&&(o++,l/=2),o+p>=u?(a=0,o=u):o+p>=1?(a=(t*l-1)*Math.pow(2,i),o=o+p):(a=t*Math.pow(2,p-1)*Math.pow(2,i),o=0));i>=8;d[r+m]=a&255,m+=f,a/=256,i-=8);for(o=o<<i|a,c+=i;c>0;d[r+m]=o&255,m+=f,o/=256,c-=8);d[r+m-f]|=E*128},_r)}function bf(){if(qo)return Rt;qo=!0;let d=gf(),t=yf(),r=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Rt.Buffer=o,Rt.SlowBuffer=k,Rt.INSPECT_MAX_BYTES=50;let n=2147483647;Rt.kMaxLength=n,o.TYPED_ARRAY_SUPPORT=i(),!o.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function i(){try{let y=new Uint8Array(1),b={foo:function(){return 42}};return Object.setPrototypeOf(b,Uint8Array.prototype),Object.setPrototypeOf(y,b),y.foo()===42}catch{return!1}}Object.defineProperty(o.prototype,"parent",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.buffer}}),Object.defineProperty(o.prototype,"offset",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.byteOffset}});function s(y){if(y>n)throw new RangeError('The value "'+y+'" is invalid for option "size"');let b=new Uint8Array(y);return Object.setPrototypeOf(b,o.prototype),b}function o(y,b,w){if(typeof y=="number"){if(typeof b=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return u(y)}return a(y,b,w)}o.poolSize=8192;function a(y,b,w){if(typeof y=="string")return p(y,b);if(ArrayBuffer.isView(y))return m(y);if(y==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof y);if(J(y,ArrayBuffer)||y&&J(y.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(J(y,SharedArrayBuffer)||y&&J(y.buffer,SharedArrayBuffer)))return f(y,b,w);if(typeof y=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let x=y.valueOf&&y.valueOf();if(x!=null&&x!==y)return o.from(x,b,w);let D=E(y);if(D)return D;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof y[Symbol.toPrimitive]=="function")return o.from(y[Symbol.toPrimitive]("string"),b,w);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof y)}o.from=function(y,b,w){return a(y,b,w)},Object.setPrototypeOf(o.prototype,Uint8Array.prototype),Object.setPrototypeOf(o,Uint8Array);function l(y){if(typeof y!="number")throw new TypeError('"size" argument must be of type number');if(y<0)throw new RangeError('The value "'+y+'" is invalid for option "size"')}function c(y,b,w){return l(y),y<=0?s(y):b!==void 0?typeof w=="string"?s(y).fill(b,w):s(y).fill(b):s(y)}o.alloc=function(y,b,w){return c(y,b,w)};function u(y){return l(y),s(y<0?0:N(y)|0)}o.allocUnsafe=function(y){return u(y)},o.allocUnsafeSlow=function(y){return u(y)};function p(y,b){if((typeof b!="string"||b==="")&&(b="utf8"),!o.isEncoding(b))throw new TypeError("Unknown encoding: "+b);let w=g(y,b)|0,x=s(w),D=x.write(y,b);return D!==w&&(x=x.slice(0,D)),x}function h(y){let b=y.length<0?0:N(y.length)|0,w=s(b);for(let x=0;x<b;x+=1)w[x]=y[x]&255;return w}function m(y){if(J(y,Uint8Array)){let b=new Uint8Array(y);return f(b.buffer,b.byteOffset,b.byteLength)}return h(y)}function f(y,b,w){if(b<0||y.byteLength<b)throw new RangeError('"offset" is outside of buffer bounds');if(y.byteLength<b+(w||0))throw new RangeError('"length" is outside of buffer bounds');let x;return b===void 0&&w===void 0?x=new Uint8Array(y):w===void 0?x=new Uint8Array(y,b):x=new Uint8Array(y,b,w),Object.setPrototypeOf(x,o.prototype),x}function E(y){if(o.isBuffer(y)){let b=N(y.length)|0,w=s(b);return w.length===0||y.copy(w,0,0,b),w}if(y.length!==void 0)return typeof y.length!="number"||ge(y.length)?s(0):h(y);if(y.type==="Buffer"&&Array.isArray(y.data))return h(y.data)}function N(y){if(y>=n)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n.toString(16)+" bytes");return y|0}function k(y){return+y!=y&&(y=0),o.alloc(+y)}o.isBuffer=function(y){return y!=null&&y._isBuffer===!0&&y!==o.prototype},o.compare=function(y,b){if(J(y,Uint8Array)&&(y=o.from(y,y.offset,y.byteLength)),J(b,Uint8Array)&&(b=o.from(b,b.offset,b.byteLength)),!o.isBuffer(y)||!o.isBuffer(b))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(y===b)return 0;let w=y.length,x=b.length;for(let D=0,L=Math.min(w,x);D<L;++D)if(y[D]!==b[D]){w=y[D],x=b[D];break}return w<x?-1:x<w?1:0},o.isEncoding=function(y){switch(String(y).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},o.concat=function(y,b){if(!Array.isArray(y))throw new TypeError('"list" argument must be an Array of Buffers');if(y.length===0)return o.alloc(0);let w;if(b===void 0)for(b=0,w=0;w<y.length;++w)b+=y[w].length;let x=o.allocUnsafe(b),D=0;for(w=0;w<y.length;++w){let L=y[w];if(J(L,Uint8Array))D+L.length>x.length?(o.isBuffer(L)||(L=o.from(L)),L.copy(x,D)):Uint8Array.prototype.set.call(x,L,D);else if(o.isBuffer(L))L.copy(x,D);else throw new TypeError('"list" argument must be an Array of Buffers');D+=L.length}return x};function g(y,b){if(o.isBuffer(y))return y.length;if(ArrayBuffer.isView(y)||J(y,ArrayBuffer))return y.byteLength;if(typeof y!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof y);let w=y.length,x=arguments.length>2&&arguments[2]===!0;if(!x&&w===0)return 0;let D=!1;for(;;)switch(b){case"ascii":case"latin1":case"binary":return w;case"utf8":case"utf-8":return F(y).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return w*2;case"hex":return w>>>1;case"base64":return pe(y).length;default:if(D)return x?-1:F(y).length;b=(""+b).toLowerCase(),D=!0}}o.byteLength=g;function v(y,b,w){let x=!1;if((b===void 0||b<0)&&(b=0),b>this.length||((w===void 0||w>this.length)&&(w=this.length),w<=0)||(w>>>=0,b>>>=0,w<=b))return"";for(y||(y="utf8");;)switch(y){case"hex":return te(this,b,w);case"utf8":case"utf-8":return U(this,b,w);case"ascii":return le(this,b,w);case"latin1":case"binary":return ne(this,b,w);case"base64":return I(this,b,w);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ue(this,b,w);default:if(x)throw new TypeError("Unknown encoding: "+y);y=(y+"").toLowerCase(),x=!0}}o.prototype._isBuffer=!0;function _(y,b,w){let x=y[b];y[b]=y[w],y[w]=x}o.prototype.swap16=function(){let y=this.length;if(y%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let b=0;b<y;b+=2)_(this,b,b+1);return this},o.prototype.swap32=function(){let y=this.length;if(y%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let b=0;b<y;b+=4)_(this,b,b+3),_(this,b+1,b+2);return this},o.prototype.swap64=function(){let y=this.length;if(y%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let b=0;b<y;b+=8)_(this,b,b+7),_(this,b+1,b+6),_(this,b+2,b+5),_(this,b+3,b+4);return this},o.prototype.toString=function(){let y=this.length;return y===0?"":arguments.length===0?U(this,0,y):v.apply(this,arguments)},o.prototype.toLocaleString=o.prototype.toString,o.prototype.equals=function(y){if(!o.isBuffer(y))throw new TypeError("Argument must be a Buffer");return this===y?!0:o.compare(this,y)===0},o.prototype.inspect=function(){let y="",b=Rt.INSPECT_MAX_BYTES;return y=this.toString("hex",0,b).replace(/(.{2})/g,"$1 ").trim(),this.length>b&&(y+=" ... "),"<Buffer "+y+">"},r&&(o.prototype[r]=o.prototype.inspect),o.prototype.compare=function(y,b,w,x,D){if(J(y,Uint8Array)&&(y=o.from(y,y.offset,y.byteLength)),!o.isBuffer(y))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof y);if(b===void 0&&(b=0),w===void 0&&(w=y?y.length:0),x===void 0&&(x=0),D===void 0&&(D=this.length),b<0||w>y.length||x<0||D>this.length)throw new RangeError("out of range index");if(x>=D&&b>=w)return 0;if(x>=D)return-1;if(b>=w)return 1;if(b>>>=0,w>>>=0,x>>>=0,D>>>=0,this===y)return 0;let L=D-x,re=w-b,H=Math.min(L,re),ee=this.slice(x,D),xe=y.slice(b,w);for(let Ve=0;Ve<H;++Ve)if(ee[Ve]!==xe[Ve]){L=ee[Ve],re=xe[Ve];break}return L<re?-1:re<L?1:0};function S(y,b,w,x,D){if(y.length===0)return-1;if(typeof w=="string"?(x=w,w=0):w>2147483647?w=2147483647:w<-2147483648&&(w=-2147483648),w=+w,ge(w)&&(w=D?0:y.length-1),w<0&&(w=y.length+w),w>=y.length){if(D)return-1;w=y.length-1}else if(w<0)if(D)w=0;else return-1;if(typeof b=="string"&&(b=o.from(b,x)),o.isBuffer(b))return b.length===0?-1:B(y,b,w,x,D);if(typeof b=="number")return b=b&255,typeof Uint8Array.prototype.indexOf=="function"?D?Uint8Array.prototype.indexOf.call(y,b,w):Uint8Array.prototype.lastIndexOf.call(y,b,w):B(y,[b],w,x,D);throw new TypeError("val must be string, number or Buffer")}function B(y,b,w,x,D){let L=1,re=y.length,H=b.length;if(x!==void 0&&(x=String(x).toLowerCase(),x==="ucs2"||x==="ucs-2"||x==="utf16le"||x==="utf-16le")){if(y.length<2||b.length<2)return-1;L=2,re/=2,H/=2,w/=2}function ee(Ve,Pe){return L===1?Ve[Pe]:Ve.readUInt16BE(Pe*L)}let xe;if(D){let Ve=-1;for(xe=w;xe<re;xe++)if(ee(y,xe)===ee(b,Ve===-1?0:xe-Ve)){if(Ve===-1&&(Ve=xe),xe-Ve+1===H)return Ve*L}else Ve!==-1&&(xe-=xe-Ve),Ve=-1}else for(w+H>re&&(w=re-H),xe=w;xe>=0;xe--){let Ve=!0;for(let Pe=0;Pe<H;Pe++)if(ee(y,xe+Pe)!==ee(b,Pe)){Ve=!1;break}if(Ve)return xe}return-1}o.prototype.includes=function(y,b,w){return this.indexOf(y,b,w)!==-1},o.prototype.indexOf=function(y,b,w){return S(this,y,b,w,!0)},o.prototype.lastIndexOf=function(y,b,w){return S(this,y,b,w,!1)};function P(y,b,w,x){w=Number(w)||0;let D=y.length-w;x?(x=Number(x),x>D&&(x=D)):x=D;let L=b.length;x>L/2&&(x=L/2);let re;for(re=0;re<x;++re){let H=parseInt(b.substr(re*2,2),16);if(ge(H))return re;y[w+re]=H}return re}function T(y,b,w,x){return ye(F(b,y.length-w),y,w,x)}function A(y,b,w,x){return ye(ae(b),y,w,x)}function C(y,b,w,x){return ye(pe(b),y,w,x)}function O(y,b,w,x){return ye(fe(b,y.length-w),y,w,x)}o.prototype.write=function(y,b,w,x){if(b===void 0)x="utf8",w=this.length,b=0;else if(w===void 0&&typeof b=="string")x=b,w=this.length,b=0;else if(isFinite(b))b=b>>>0,isFinite(w)?(w=w>>>0,x===void 0&&(x="utf8")):(x=w,w=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let D=this.length-b;if((w===void 0||w>D)&&(w=D),y.length>0&&(w<0||b<0)||b>this.length)throw new RangeError("Attempt to write outside buffer bounds");x||(x="utf8");let L=!1;for(;;)switch(x){case"hex":return P(this,y,b,w);case"utf8":case"utf-8":return T(this,y,b,w);case"ascii":case"latin1":case"binary":return A(this,y,b,w);case"base64":return C(this,y,b,w);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,y,b,w);default:if(L)throw new TypeError("Unknown encoding: "+x);x=(""+x).toLowerCase(),L=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function I(y,b,w){return b===0&&w===y.length?d.fromByteArray(y):d.fromByteArray(y.slice(b,w))}function U(y,b,w){w=Math.min(y.length,w);let x=[],D=b;for(;D<w;){let L=y[D],re=null,H=L>239?4:L>223?3:L>191?2:1;if(D+H<=w){let ee,xe,Ve,Pe;switch(H){case 1:L<128&&(re=L);break;case 2:ee=y[D+1],(ee&192)===128&&(Pe=(L&31)<<6|ee&63,Pe>127&&(re=Pe));break;case 3:ee=y[D+1],xe=y[D+2],(ee&192)===128&&(xe&192)===128&&(Pe=(L&15)<<12|(ee&63)<<6|xe&63,Pe>2047&&(Pe<55296||Pe>57343)&&(re=Pe));break;case 4:ee=y[D+1],xe=y[D+2],Ve=y[D+3],(ee&192)===128&&(xe&192)===128&&(Ve&192)===128&&(Pe=(L&15)<<18|(ee&63)<<12|(xe&63)<<6|Ve&63,Pe>65535&&Pe<1114112&&(re=Pe))}}re===null?(re=65533,H=1):re>65535&&(re-=65536,x.push(re>>>10&1023|55296),re=56320|re&1023),x.push(re),D+=H}return j(x)}let Y=4096;function j(y){let b=y.length;if(b<=Y)return String.fromCharCode.apply(String,y);let w="",x=0;for(;x<b;)w+=String.fromCharCode.apply(String,y.slice(x,x+=Y));return w}function le(y,b,w){let x="";w=Math.min(y.length,w);for(let D=b;D<w;++D)x+=String.fromCharCode(y[D]&127);return x}function ne(y,b,w){let x="";w=Math.min(y.length,w);for(let D=b;D<w;++D)x+=String.fromCharCode(y[D]);return x}function te(y,b,w){let x=y.length;(!b||b<0)&&(b=0),(!w||w<0||w>x)&&(w=x);let D="";for(let L=b;L<w;++L)D+=ke[y[L]];return D}function ue(y,b,w){let x=y.slice(b,w),D="";for(let L=0;L<x.length-1;L+=2)D+=String.fromCharCode(x[L]+x[L+1]*256);return D}o.prototype.slice=function(y,b){let w=this.length;y=~~y,b=b===void 0?w:~~b,y<0?(y+=w,y<0&&(y=0)):y>w&&(y=w),b<0?(b+=w,b<0&&(b=0)):b>w&&(b=w),b<y&&(b=y);let x=this.subarray(y,b);return Object.setPrototypeOf(x,o.prototype),x};function $(y,b,w){if(y%1!==0||y<0)throw new RangeError("offset is not uint");if(y+b>w)throw new RangeError("Trying to access beyond buffer length")}o.prototype.readUintLE=o.prototype.readUIntLE=function(y,b,w){y=y>>>0,b=b>>>0,w||$(y,b,this.length);let x=this[y],D=1,L=0;for(;++L<b&&(D*=256);)x+=this[y+L]*D;return x},o.prototype.readUintBE=o.prototype.readUIntBE=function(y,b,w){y=y>>>0,b=b>>>0,w||$(y,b,this.length);let x=this[y+--b],D=1;for(;b>0&&(D*=256);)x+=this[y+--b]*D;return x},o.prototype.readUint8=o.prototype.readUInt8=function(y,b){return y=y>>>0,b||$(y,1,this.length),this[y]},o.prototype.readUint16LE=o.prototype.readUInt16LE=function(y,b){return y=y>>>0,b||$(y,2,this.length),this[y]|this[y+1]<<8},o.prototype.readUint16BE=o.prototype.readUInt16BE=function(y,b){return y=y>>>0,b||$(y,2,this.length),this[y]<<8|this[y+1]},o.prototype.readUint32LE=o.prototype.readUInt32LE=function(y,b){return y=y>>>0,b||$(y,4,this.length),(this[y]|this[y+1]<<8|this[y+2]<<16)+this[y+3]*16777216},o.prototype.readUint32BE=o.prototype.readUInt32BE=function(y,b){return y=y>>>0,b||$(y,4,this.length),this[y]*16777216+(this[y+1]<<16|this[y+2]<<8|this[y+3])},o.prototype.readBigUInt64LE=de(function(y){y=y>>>0,ie(y,"offset");let b=this[y],w=this[y+7];(b===void 0||w===void 0)&&Ee(y,this.length-8);let x=b+this[++y]*2**8+this[++y]*2**16+this[++y]*2**24,D=this[++y]+this[++y]*2**8+this[++y]*2**16+w*2**24;return BigInt(x)+(BigInt(D)<<BigInt(32))}),o.prototype.readBigUInt64BE=de(function(y){y=y>>>0,ie(y,"offset");let b=this[y],w=this[y+7];(b===void 0||w===void 0)&&Ee(y,this.length-8);let x=b*2**24+this[++y]*2**16+this[++y]*2**8+this[++y],D=this[++y]*2**24+this[++y]*2**16+this[++y]*2**8+w;return(BigInt(x)<<BigInt(32))+BigInt(D)}),o.prototype.readIntLE=function(y,b,w){y=y>>>0,b=b>>>0,w||$(y,b,this.length);let x=this[y],D=1,L=0;for(;++L<b&&(D*=256);)x+=this[y+L]*D;return D*=128,x>=D&&(x-=Math.pow(2,8*b)),x},o.prototype.readIntBE=function(y,b,w){y=y>>>0,b=b>>>0,w||$(y,b,this.length);let x=b,D=1,L=this[y+--x];for(;x>0&&(D*=256);)L+=this[y+--x]*D;return D*=128,L>=D&&(L-=Math.pow(2,8*b)),L},o.prototype.readInt8=function(y,b){return y=y>>>0,b||$(y,1,this.length),this[y]&128?(255-this[y]+1)*-1:this[y]},o.prototype.readInt16LE=function(y,b){y=y>>>0,b||$(y,2,this.length);let w=this[y]|this[y+1]<<8;return w&32768?w|4294901760:w},o.prototype.readInt16BE=function(y,b){y=y>>>0,b||$(y,2,this.length);let w=this[y+1]|this[y]<<8;return w&32768?w|4294901760:w},o.prototype.readInt32LE=function(y,b){return y=y>>>0,b||$(y,4,this.length),this[y]|this[y+1]<<8|this[y+2]<<16|this[y+3]<<24},o.prototype.readInt32BE=function(y,b){return y=y>>>0,b||$(y,4,this.length),this[y]<<24|this[y+1]<<16|this[y+2]<<8|this[y+3]},o.prototype.readBigInt64LE=de(function(y){y=y>>>0,ie(y,"offset");let b=this[y],w=this[y+7];(b===void 0||w===void 0)&&Ee(y,this.length-8);let x=this[y+4]+this[y+5]*2**8+this[y+6]*2**16+(w<<24);return(BigInt(x)<<BigInt(32))+BigInt(b+this[++y]*2**8+this[++y]*2**16+this[++y]*2**24)}),o.prototype.readBigInt64BE=de(function(y){y=y>>>0,ie(y,"offset");let b=this[y],w=this[y+7];(b===void 0||w===void 0)&&Ee(y,this.length-8);let x=(b<<24)+this[++y]*2**16+this[++y]*2**8+this[++y];return(BigInt(x)<<BigInt(32))+BigInt(this[++y]*2**24+this[++y]*2**16+this[++y]*2**8+w)}),o.prototype.readFloatLE=function(y,b){return y=y>>>0,b||$(y,4,this.length),t.read(this,y,!0,23,4)},o.prototype.readFloatBE=function(y,b){return y=y>>>0,b||$(y,4,this.length),t.read(this,y,!1,23,4)},o.prototype.readDoubleLE=function(y,b){return y=y>>>0,b||$(y,8,this.length),t.read(this,y,!0,52,8)},o.prototype.readDoubleBE=function(y,b){return y=y>>>0,b||$(y,8,this.length),t.read(this,y,!1,52,8)};function se(y,b,w,x,D,L){if(!o.isBuffer(y))throw new TypeError('"buffer" argument must be a Buffer instance');if(b>D||b<L)throw new RangeError('"value" argument is out of bounds');if(w+x>y.length)throw new RangeError("Index out of range")}o.prototype.writeUintLE=o.prototype.writeUIntLE=function(y,b,w,x){if(y=+y,b=b>>>0,w=w>>>0,!x){let re=Math.pow(2,8*w)-1;se(this,y,b,w,re,0)}let D=1,L=0;for(this[b]=y&255;++L<w&&(D*=256);)this[b+L]=y/D&255;return b+w},o.prototype.writeUintBE=o.prototype.writeUIntBE=function(y,b,w,x){if(y=+y,b=b>>>0,w=w>>>0,!x){let re=Math.pow(2,8*w)-1;se(this,y,b,w,re,0)}let D=w-1,L=1;for(this[b+D]=y&255;--D>=0&&(L*=256);)this[b+D]=y/L&255;return b+w},o.prototype.writeUint8=o.prototype.writeUInt8=function(y,b,w){return y=+y,b=b>>>0,w||se(this,y,b,1,255,0),this[b]=y&255,b+1},o.prototype.writeUint16LE=o.prototype.writeUInt16LE=function(y,b,w){return y=+y,b=b>>>0,w||se(this,y,b,2,65535,0),this[b]=y&255,this[b+1]=y>>>8,b+2},o.prototype.writeUint16BE=o.prototype.writeUInt16BE=function(y,b,w){return y=+y,b=b>>>0,w||se(this,y,b,2,65535,0),this[b]=y>>>8,this[b+1]=y&255,b+2},o.prototype.writeUint32LE=o.prototype.writeUInt32LE=function(y,b,w){return y=+y,b=b>>>0,w||se(this,y,b,4,4294967295,0),this[b+3]=y>>>24,this[b+2]=y>>>16,this[b+1]=y>>>8,this[b]=y&255,b+4},o.prototype.writeUint32BE=o.prototype.writeUInt32BE=function(y,b,w){return y=+y,b=b>>>0,w||se(this,y,b,4,4294967295,0),this[b]=y>>>24,this[b+1]=y>>>16,this[b+2]=y>>>8,this[b+3]=y&255,b+4};function M(y,b,w,x,D){oe(b,x,D,y,w,7);let L=Number(b&BigInt(4294967295));y[w++]=L,L=L>>8,y[w++]=L,L=L>>8,y[w++]=L,L=L>>8,y[w++]=L;let re=Number(b>>BigInt(32)&BigInt(4294967295));return y[w++]=re,re=re>>8,y[w++]=re,re=re>>8,y[w++]=re,re=re>>8,y[w++]=re,w}function Q(y,b,w,x,D){oe(b,x,D,y,w,7);let L=Number(b&BigInt(4294967295));y[w+7]=L,L=L>>8,y[w+6]=L,L=L>>8,y[w+5]=L,L=L>>8,y[w+4]=L;let re=Number(b>>BigInt(32)&BigInt(4294967295));return y[w+3]=re,re=re>>8,y[w+2]=re,re=re>>8,y[w+1]=re,re=re>>8,y[w]=re,w+8}o.prototype.writeBigUInt64LE=de(function(y,b=0){return M(this,y,b,BigInt(0),BigInt("0xffffffffffffffff"))}),o.prototype.writeBigUInt64BE=de(function(y,b=0){return Q(this,y,b,BigInt(0),BigInt("0xffffffffffffffff"))}),o.prototype.writeIntLE=function(y,b,w,x){if(y=+y,b=b>>>0,!x){let H=Math.pow(2,8*w-1);se(this,y,b,w,H-1,-H)}let D=0,L=1,re=0;for(this[b]=y&255;++D<w&&(L*=256);)y<0&&re===0&&this[b+D-1]!==0&&(re=1),this[b+D]=(y/L>>0)-re&255;return b+w},o.prototype.writeIntBE=function(y,b,w,x){if(y=+y,b=b>>>0,!x){let H=Math.pow(2,8*w-1);se(this,y,b,w,H-1,-H)}let D=w-1,L=1,re=0;for(this[b+D]=y&255;--D>=0&&(L*=256);)y<0&&re===0&&this[b+D+1]!==0&&(re=1),this[b+D]=(y/L>>0)-re&255;return b+w},o.prototype.writeInt8=function(y,b,w){return y=+y,b=b>>>0,w||se(this,y,b,1,127,-128),y<0&&(y=255+y+1),this[b]=y&255,b+1},o.prototype.writeInt16LE=function(y,b,w){return y=+y,b=b>>>0,w||se(this,y,b,2,32767,-32768),this[b]=y&255,this[b+1]=y>>>8,b+2},o.prototype.writeInt16BE=function(y,b,w){return y=+y,b=b>>>0,w||se(this,y,b,2,32767,-32768),this[b]=y>>>8,this[b+1]=y&255,b+2},o.prototype.writeInt32LE=function(y,b,w){return y=+y,b=b>>>0,w||se(this,y,b,4,2147483647,-2147483648),this[b]=y&255,this[b+1]=y>>>8,this[b+2]=y>>>16,this[b+3]=y>>>24,b+4},o.prototype.writeInt32BE=function(y,b,w){return y=+y,b=b>>>0,w||se(this,y,b,4,2147483647,-2147483648),y<0&&(y=4294967295+y+1),this[b]=y>>>24,this[b+1]=y>>>16,this[b+2]=y>>>8,this[b+3]=y&255,b+4},o.prototype.writeBigInt64LE=de(function(y,b=0){return M(this,y,b,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),o.prototype.writeBigInt64BE=de(function(y,b=0){return Q(this,y,b,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function me(y,b,w,x,D,L){if(w+x>y.length)throw new RangeError("Index out of range");if(w<0)throw new RangeError("Index out of range")}function K(y,b,w,x,D){return b=+b,w=w>>>0,D||me(y,b,w,4),t.write(y,b,w,x,23,4),w+4}o.prototype.writeFloatLE=function(y,b,w){return K(this,y,b,!0,w)},o.prototype.writeFloatBE=function(y,b,w){return K(this,y,b,!1,w)};function Se(y,b,w,x,D){return b=+b,w=w>>>0,D||me(y,b,w,8),t.write(y,b,w,x,52,8),w+8}o.prototype.writeDoubleLE=function(y,b,w){return Se(this,y,b,!0,w)},o.prototype.writeDoubleBE=function(y,b,w){return Se(this,y,b,!1,w)},o.prototype.copy=function(y,b,w,x){if(!o.isBuffer(y))throw new TypeError("argument should be a Buffer");if(w||(w=0),!x&&x!==0&&(x=this.length),b>=y.length&&(b=y.length),b||(b=0),x>0&&x<w&&(x=w),x===w||y.length===0||this.length===0)return 0;if(b<0)throw new RangeError("targetStart out of bounds");if(w<0||w>=this.length)throw new RangeError("Index out of range");if(x<0)throw new RangeError("sourceEnd out of bounds");x>this.length&&(x=this.length),y.length-b<x-w&&(x=y.length-b+w);let D=x-w;return this===y&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(b,w,x):Uint8Array.prototype.set.call(y,this.subarray(w,x),b),D},o.prototype.fill=function(y,b,w,x){if(typeof y=="string"){if(typeof b=="string"?(x=b,b=0,w=this.length):typeof w=="string"&&(x=w,w=this.length),x!==void 0&&typeof x!="string")throw new TypeError("encoding must be a string");if(typeof x=="string"&&!o.isEncoding(x))throw new TypeError("Unknown encoding: "+x);if(y.length===1){let L=y.charCodeAt(0);(x==="utf8"&&L<128||x==="latin1")&&(y=L)}}else typeof y=="number"?y=y&255:typeof y=="boolean"&&(y=Number(y));if(b<0||this.length<b||this.length<w)throw new RangeError("Out of range index");if(w<=b)return this;b=b>>>0,w=w===void 0?this.length:w>>>0,y||(y=0);let D;if(typeof y=="number")for(D=b;D<w;++D)this[D]=y;else{let L=o.isBuffer(y)?y:o.from(y,x),re=L.length;if(re===0)throw new TypeError('The value "'+y+'" is invalid for argument "value"');for(D=0;D<w-b;++D)this[D+b]=L[D%re]}return this};let Z={};function G(y,b,w){Z[y]=class extends w{constructor(){super(),Object.defineProperty(this,"message",{value:b.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${y}]`,this.stack,delete this.name}get code(){return y}set code(x){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:x,writable:!0})}toString(){return`${this.name} [${y}]: ${this.message}`}}}G("ERR_BUFFER_OUT_OF_BOUNDS",function(y){return y?`${y} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),G("ERR_INVALID_ARG_TYPE",function(y,b){return`The "${y}" argument must be of type number. Received type ${typeof b}`},TypeError),G("ERR_OUT_OF_RANGE",function(y,b,w){let x=`The value of "${y}" is out of range.`,D=w;return Number.isInteger(w)&&Math.abs(w)>2**32?D=ce(String(w)):typeof w=="bigint"&&(D=String(w),(w>BigInt(2)**BigInt(32)||w<-(BigInt(2)**BigInt(32)))&&(D=ce(D)),D+="n"),x+=` It must be ${b}. Received ${D}`,x},RangeError);function ce(y){let b="",w=y.length,x=y[0]==="-"?1:0;for(;w>=x+4;w-=3)b=`_${y.slice(w-3,w)}${b}`;return`${y.slice(0,w)}${b}`}function X(y,b,w){ie(b,"offset"),(y[b]===void 0||y[b+w]===void 0)&&Ee(b,y.length-(w+1))}function oe(y,b,w,x,D,L){if(y>w||y<b){let re=typeof b=="bigint"?"n":"",H;throw b===0||b===BigInt(0)?H=`>= 0${re} and < 2${re} ** ${(L+1)*8}${re}`:H=`>= -(2${re} ** ${(L+1)*8-1}${re}) and < 2 ** ${(L+1)*8-1}${re}`,new Z.ERR_OUT_OF_RANGE("value",H,y)}X(x,D,L)}function ie(y,b){if(typeof y!="number")throw new Z.ERR_INVALID_ARG_TYPE(b,"number",y)}function Ee(y,b,w){throw Math.floor(y)!==y?(ie(y,w),new Z.ERR_OUT_OF_RANGE("offset","an integer",y)):b<0?new Z.ERR_BUFFER_OUT_OF_BOUNDS:new Z.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${b}`,y)}let z=/[^+/0-9A-Za-z-_]/g;function V(y){if(y=y.split("=")[0],y=y.trim().replace(z,""),y.length<2)return"";for(;y.length%4!==0;)y=y+"=";return y}function F(y,b){b=b||1/0;let w,x=y.length,D=null,L=[];for(let re=0;re<x;++re){if(w=y.charCodeAt(re),w>55295&&w<57344){if(!D){if(w>56319){(b-=3)>-1&&L.push(239,191,189);continue}else if(re+1===x){(b-=3)>-1&&L.push(239,191,189);continue}D=w;continue}if(w<56320){(b-=3)>-1&&L.push(239,191,189),D=w;continue}w=(D-55296<<10|w-56320)+65536}else D&&(b-=3)>-1&&L.push(239,191,189);if(D=null,w<128){if((b-=1)<0)break;L.push(w)}else if(w<2048){if((b-=2)<0)break;L.push(w>>6|192,w&63|128)}else if(w<65536){if((b-=3)<0)break;L.push(w>>12|224,w>>6&63|128,w&63|128)}else if(w<1114112){if((b-=4)<0)break;L.push(w>>18|240,w>>12&63|128,w>>6&63|128,w&63|128)}else throw new Error("Invalid code point")}return L}function ae(y){let b=[];for(let w=0;w<y.length;++w)b.push(y.charCodeAt(w)&255);return b}function fe(y,b){let w,x,D,L=[];for(let re=0;re<y.length&&!((b-=2)<0);++re)w=y.charCodeAt(re),x=w>>8,D=w%256,L.push(D),L.push(x);return L}function pe(y){return d.toByteArray(V(y))}function ye(y,b,w,x){let D;for(D=0;D<x&&!(D+w>=b.length||D>=y.length);++D)b[D+w]=y[D];return D}function J(y,b){return y instanceof b||y!=null&&y.constructor!=null&&y.constructor.name!=null&&y.constructor.name===b.name}function ge(y){return y!==y}let ke=function(){let y="0123456789abcdef",b=new Array(256);for(let w=0;w<16;++w){let x=w*16;for(let D=0;D<16;++D)b[x+D]=y[w]+y[D]}return b}();function de(y){return typeof BigInt>"u"?Ce:y}function Ce(){throw new Error("BigInt not supported")}return Rt}var cr,zo,_r,Wo,Rt,qo,wf=pt(()=>{be(),ve(),we(),cr={},zo=!1,_r={},Wo=!1,Rt={},qo=!1}),nt={};lr(nt,{Buffer:()=>Lr,INSPECT_MAX_BYTES:()=>Ps,default:()=>xt,kMaxLength:()=>Bs});var xt,Lr,Ps,Bs,ot=pt(()=>{be(),ve(),we(),wf(),xt=bf(),xt.Buffer,xt.SlowBuffer,xt.INSPECT_MAX_BYTES,xt.kMaxLength,Lr=xt.Buffer,Ps=xt.INSPECT_MAX_BYTES,Bs=xt.kMaxLength}),ve=pt(()=>{ot()}),Qe=_e((d,t)=>{be(),ve(),we();var r=class extends Error{constructor(n){if(!Array.isArray(n))throw new TypeError(`Expected input to be an Array, got ${typeof n}`);let i="";for(let s=0;s<n.length;s++)i+=` ${n[s].stack}
263
+ `;super(i),this.name="AggregateError",this.errors=n}};t.exports={AggregateError:r,ArrayIsArray(n){return Array.isArray(n)},ArrayPrototypeIncludes(n,i){return n.includes(i)},ArrayPrototypeIndexOf(n,i){return n.indexOf(i)},ArrayPrototypeJoin(n,i){return n.join(i)},ArrayPrototypeMap(n,i){return n.map(i)},ArrayPrototypePop(n,i){return n.pop(i)},ArrayPrototypePush(n,i){return n.push(i)},ArrayPrototypeSlice(n,i,s){return n.slice(i,s)},Error,FunctionPrototypeCall(n,i,...s){return n.call(i,...s)},FunctionPrototypeSymbolHasInstance(n,i){return Function.prototype[Symbol.hasInstance].call(n,i)},MathFloor:Math.floor,Number,NumberIsInteger:Number.isInteger,NumberIsNaN:Number.isNaN,NumberMAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER,NumberMIN_SAFE_INTEGER:Number.MIN_SAFE_INTEGER,NumberParseInt:Number.parseInt,ObjectDefineProperties(n,i){return Object.defineProperties(n,i)},ObjectDefineProperty(n,i,s){return Object.defineProperty(n,i,s)},ObjectGetOwnPropertyDescriptor(n,i){return Object.getOwnPropertyDescriptor(n,i)},ObjectKeys(n){return Object.keys(n)},ObjectSetPrototypeOf(n,i){return Object.setPrototypeOf(n,i)},Promise,PromisePrototypeCatch(n,i){return n.catch(i)},PromisePrototypeThen(n,i,s){return n.then(i,s)},PromiseReject(n){return Promise.reject(n)},PromiseResolve(n){return Promise.resolve(n)},ReflectApply:Reflect.apply,RegExpPrototypeTest(n,i){return n.test(i)},SafeSet:Set,String,StringPrototypeSlice(n,i,s){return n.slice(i,s)},StringPrototypeToLowerCase(n){return n.toLowerCase()},StringPrototypeToUpperCase(n){return n.toUpperCase()},StringPrototypeTrim(n){return n.trim()},Symbol,SymbolFor:Symbol.for,SymbolAsyncIterator:Symbol.asyncIterator,SymbolHasInstance:Symbol.hasInstance,SymbolIterator:Symbol.iterator,SymbolDispose:Symbol.dispose||Symbol("Symbol.dispose"),SymbolAsyncDispose:Symbol.asyncDispose||Symbol("Symbol.asyncDispose"),TypedArrayPrototypeSet(n,i,s){return n.set(i,s)},Boolean,Uint8Array}}),Os=_e((d,t)=>{be(),ve(),we(),t.exports={format(r,...n){return r.replace(/%([sdifj])/g,function(...[i,s]){let o=n.shift();return s==="f"?o.toFixed(6):s==="j"?JSON.stringify(o):s==="s"&&typeof o=="object"?`${o.constructor!==Object?o.constructor.name:""} {}`.trim():o.toString()})},inspect(r){switch(typeof r){case"string":if(r.includes("'"))if(r.includes('"')){if(!r.includes("`")&&!r.includes("${"))return`\`${r}\``}else return`"${r}"`;return`'${r}'`;case"number":return isNaN(r)?"NaN":Object.is(r,-0)?String(r):r;case"bigint":return`${String(r)}n`;case"boolean":case"undefined":return String(r);case"object":return"{}"}}}}),ut=_e((d,t)=>{be(),ve(),we();var{format:r,inspect:n}=Os(),{AggregateError:i}=Qe(),s=globalThis.AggregateError||i,o=Symbol("kIsNodeError"),a=["string","function","number","object","Function","Object","boolean","bigint","symbol"],l=/^([A-Z][a-z0-9]*)+$/,c="__node_internal_",u={};function p(g,v){if(!g)throw new u.ERR_INTERNAL_ASSERTION(v)}function h(g){let v="",_=g.length,S=g[0]==="-"?1:0;for(;_>=S+4;_-=3)v=`_${g.slice(_-3,_)}${v}`;return`${g.slice(0,_)}${v}`}function m(g,v,_){if(typeof v=="function")return p(v.length<=_.length,`Code: ${g}; The provided arguments length (${_.length}) does not match the required ones (${v.length}).`),v(..._);let S=(v.match(/%[dfijoOs]/g)||[]).length;return p(S===_.length,`Code: ${g}; The provided arguments length (${_.length}) does not match the required ones (${S}).`),_.length===0?v:r(v,..._)}function f(g,v,_){_||(_=Error);class S extends _{constructor(...P){super(m(g,v,P))}toString(){return`${this.name} [${g}]: ${this.message}`}}Object.defineProperties(S.prototype,{name:{value:_.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${g}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),S.prototype.code=g,S.prototype[o]=!0,u[g]=S}function E(g){let v=c+g.name;return Object.defineProperty(g,"name",{value:v}),g}function N(g,v){if(g&&v&&g!==v){if(Array.isArray(v.errors))return v.errors.push(g),v;let _=new s([v,g],v.message);return _.code=v.code,_}return g||v}var k=class extends Error{constructor(g="The operation was aborted",v=void 0){if(v!==void 0&&typeof v!="object")throw new u.ERR_INVALID_ARG_TYPE("options","Object",v);super(g,v),this.code="ABORT_ERR",this.name="AbortError"}};f("ERR_ASSERTION","%s",Error),f("ERR_INVALID_ARG_TYPE",(g,v,_)=>{p(typeof g=="string","'name' must be a string"),Array.isArray(v)||(v=[v]);let S="The ";g.endsWith(" argument")?S+=`${g} `:S+=`"${g}" ${g.includes(".")?"property":"argument"} `,S+="must be ";let B=[],P=[],T=[];for(let C of v)p(typeof C=="string","All expected entries have to be of type string"),a.includes(C)?B.push(C.toLowerCase()):l.test(C)?P.push(C):(p(C!=="object",'The value "object" should be written as "Object"'),T.push(C));if(P.length>0){let C=B.indexOf("object");C!==-1&&(B.splice(B,C,1),P.push("Object"))}if(B.length>0){switch(B.length){case 1:S+=`of type ${B[0]}`;break;case 2:S+=`one of type ${B[0]} or ${B[1]}`;break;default:{let C=B.pop();S+=`one of type ${B.join(", ")}, or ${C}`}}(P.length>0||T.length>0)&&(S+=" or ")}if(P.length>0){switch(P.length){case 1:S+=`an instance of ${P[0]}`;break;case 2:S+=`an instance of ${P[0]} or ${P[1]}`;break;default:{let C=P.pop();S+=`an instance of ${P.join(", ")}, or ${C}`}}T.length>0&&(S+=" or ")}switch(T.length){case 0:break;case 1:T[0].toLowerCase()!==T[0]&&(S+="an "),S+=`${T[0]}`;break;case 2:S+=`one of ${T[0]} or ${T[1]}`;break;default:{let C=T.pop();S+=`one of ${T.join(", ")}, or ${C}`}}if(_==null)S+=`. Received ${_}`;else if(typeof _=="function"&&_.name)S+=`. Received function ${_.name}`;else if(typeof _=="object"){var A;if((A=_.constructor)!==null&&A!==void 0&&A.name)S+=`. Received an instance of ${_.constructor.name}`;else{let C=n(_,{depth:-1});S+=`. Received ${C}`}}else{let C=n(_,{colors:!1});C.length>25&&(C=`${C.slice(0,25)}...`),S+=`. Received type ${typeof _} (${C})`}return S},TypeError),f("ERR_INVALID_ARG_VALUE",(g,v,_="is invalid")=>{let S=n(v);return S.length>128&&(S=S.slice(0,128)+"..."),`The ${g.includes(".")?"property":"argument"} '${g}' ${_}. Received ${S}`},TypeError),f("ERR_INVALID_RETURN_VALUE",(g,v,_)=>{var S;let B=_!=null&&(S=_.constructor)!==null&&S!==void 0&&S.name?`instance of ${_.constructor.name}`:`type ${typeof _}`;return`Expected ${g} to be returned from the "${v}" function but got ${B}.`},TypeError),f("ERR_MISSING_ARGS",(...g)=>{p(g.length>0,"At least one arg needs to be specified");let v,_=g.length;switch(g=(Array.isArray(g)?g:[g]).map(S=>`"${S}"`).join(" or "),_){case 1:v+=`The ${g[0]} argument`;break;case 2:v+=`The ${g[0]} and ${g[1]} arguments`;break;default:{let S=g.pop();v+=`The ${g.join(", ")}, and ${S} arguments`}break}return`${v} must be specified`},TypeError),f("ERR_OUT_OF_RANGE",(g,v,_)=>{p(v,'Missing "range" argument');let S;if(Number.isInteger(_)&&Math.abs(_)>2**32)S=h(String(_));else if(typeof _=="bigint"){S=String(_);let B=BigInt(2)**BigInt(32);(_>B||_<-B)&&(S=h(S)),S+="n"}else S=n(_);return`The value of "${g}" is out of range. It must be ${v}. Received ${S}`},RangeError),f("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error),f("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error),f("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error),f("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error),f("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error),f("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),f("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error),f("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error),f("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error),f("ERR_STREAM_WRITE_AFTER_END","write after end",Error),f("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError),t.exports={AbortError:k,aggregateTwoErrors:E(N),hideStackFrames:E,codes:u}}),Sr=_e((d,t)=>{be(),ve(),we();var{AbortController:r,AbortSignal:n}=typeof self<"u"?self:typeof window<"u"?window:void 0;t.exports=r,t.exports.AbortSignal=n,t.exports.default=r}),Mt={};lr(Mt,{EventEmitter:()=>Ds,default:()=>dr,defaultMaxListeners:()=>Rs,init:()=>Ms,listenerCount:()=>$s,on:()=>js,once:()=>Ls});function vf(){if(Go)return Nr;Go=!0;var d=typeof Reflect=="object"?Reflect:null,t=d&&typeof d.apply=="function"?d.apply:function(_,S,B){return Function.prototype.apply.call(_,S,B)},r;d&&typeof d.ownKeys=="function"?r=d.ownKeys:Object.getOwnPropertySymbols?r=function(_){return Object.getOwnPropertyNames(_).concat(Object.getOwnPropertySymbols(_))}:r=function(_){return Object.getOwnPropertyNames(_)};function n(_){console&&console.warn&&console.warn(_)}var i=Number.isNaN||function(_){return _!==_};function s(){s.init.call(this)}Nr=s,Nr.once=k,s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var o=10;function a(_){if(typeof _!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof _)}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return o},set:function(_){if(typeof _!="number"||_<0||i(_))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+_+".");o=_}}),s.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},s.prototype.setMaxListeners=function(_){if(typeof _!="number"||_<0||i(_))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+_+".");return this._maxListeners=_,this};function l(_){return _._maxListeners===void 0?s.defaultMaxListeners:_._maxListeners}s.prototype.getMaxListeners=function(){return l(this)},s.prototype.emit=function(_){for(var S=[],B=1;B<arguments.length;B++)S.push(arguments[B]);var P=_==="error",T=this._events;if(T!==void 0)P=P&&T.error===void 0;else if(!P)return!1;if(P){var A;if(S.length>0&&(A=S[0]),A instanceof Error)throw A;var C=new Error("Unhandled error."+(A?" ("+A.message+")":""));throw C.context=A,C}var O=T[_];if(O===void 0)return!1;if(typeof O=="function")t(O,this,S);else for(var I=O.length,U=f(O,I),B=0;B<I;++B)t(U[B],this,S);return!0};function c(_,S,B,P){var T,A,C;if(a(B),A=_._events,A===void 0?(A=_._events=Object.create(null),_._eventsCount=0):(A.newListener!==void 0&&(_.emit("newListener",S,B.listener?B.listener:B),A=_._events),C=A[S]),C===void 0)C=A[S]=B,++_._eventsCount;else if(typeof C=="function"?C=A[S]=P?[B,C]:[C,B]:P?C.unshift(B):C.push(B),T=l(_),T>0&&C.length>T&&!C.warned){C.warned=!0;var O=new Error("Possible EventEmitter memory leak detected. "+C.length+" "+String(S)+" listeners added. Use emitter.setMaxListeners() to increase limit");O.name="MaxListenersExceededWarning",O.emitter=_,O.type=S,O.count=C.length,n(O)}return _}s.prototype.addListener=function(_,S){return c(this,_,S,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(_,S){return c(this,_,S,!0)};function u(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function p(_,S,B){var P={fired:!1,wrapFn:void 0,target:_,type:S,listener:B},T=u.bind(P);return T.listener=B,P.wrapFn=T,T}s.prototype.once=function(_,S){return a(S),this.on(_,p(this,_,S)),this},s.prototype.prependOnceListener=function(_,S){return a(S),this.prependListener(_,p(this,_,S)),this},s.prototype.removeListener=function(_,S){var B,P,T,A,C;if(a(S),P=this._events,P===void 0)return this;if(B=P[_],B===void 0)return this;if(B===S||B.listener===S)--this._eventsCount===0?this._events=Object.create(null):(delete P[_],P.removeListener&&this.emit("removeListener",_,B.listener||S));else if(typeof B!="function"){for(T=-1,A=B.length-1;A>=0;A--)if(B[A]===S||B[A].listener===S){C=B[A].listener,T=A;break}if(T<0)return this;T===0?B.shift():E(B,T),B.length===1&&(P[_]=B[0]),P.removeListener!==void 0&&this.emit("removeListener",_,C||S)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(_){var S,B,P;if(B=this._events,B===void 0)return this;if(B.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):B[_]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete B[_]),this;if(arguments.length===0){var T=Object.keys(B),A;for(P=0;P<T.length;++P)A=T[P],A!=="removeListener"&&this.removeAllListeners(A);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(S=B[_],typeof S=="function")this.removeListener(_,S);else if(S!==void 0)for(P=S.length-1;P>=0;P--)this.removeListener(_,S[P]);return this};function h(_,S,B){var P=_._events;if(P===void 0)return[];var T=P[S];return T===void 0?[]:typeof T=="function"?B?[T.listener||T]:[T]:B?N(T):f(T,T.length)}s.prototype.listeners=function(_){return h(this,_,!0)},s.prototype.rawListeners=function(_){return h(this,_,!1)},s.listenerCount=function(_,S){return typeof _.listenerCount=="function"?_.listenerCount(S):m.call(_,S)},s.prototype.listenerCount=m;function m(_){var S=this._events;if(S!==void 0){var B=S[_];if(typeof B=="function")return 1;if(B!==void 0)return B.length}return 0}s.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]};function f(_,S){for(var B=new Array(S),P=0;P<S;++P)B[P]=_[P];return B}function E(_,S){for(;S+1<_.length;S++)_[S]=_[S+1];_.pop()}function N(_){for(var S=new Array(_.length),B=0;B<S.length;++B)S[B]=_[B].listener||_[B];return S}function k(_,S){return new Promise(function(B,P){function T(C){_.removeListener(S,A),P(C)}function A(){typeof _.removeListener=="function"&&_.removeListener("error",T),B([].slice.call(arguments))}v(_,S,A,{once:!0}),S!=="error"&&g(_,T,{once:!0})})}function g(_,S,B){typeof _.on=="function"&&v(_,"error",S,B)}function v(_,S,B,P){if(typeof _.on=="function")P.once?_.once(S,B):_.on(S,B);else if(typeof _.addEventListener=="function")_.addEventListener(S,function T(A){P.once&&_.removeEventListener(S,T),B(A)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof _)}return Nr}var Nr,Go,dr,Ds,Rs,Ms,$s,js,Ls,tr=pt(()=>{be(),ve(),we(),Nr={},Go=!1,dr=vf(),dr.once,dr.once=function(d,t){return new Promise((r,n)=>{function i(...o){s!==void 0&&d.removeListener("error",s),r(o)}let s;t!=="error"&&(s=o=>{d.removeListener(name,i),n(o)},d.once("error",s)),d.once(t,i)})},dr.on=function(d,t){let r=[],n=[],i=null,s=!1,o={async next(){let c=r.shift();if(c)return createIterResult(c,!1);if(i){let u=Promise.reject(i);return i=null,u}return s?createIterResult(void 0,!0):new Promise((u,p)=>n.push({resolve:u,reject:p}))},async return(){d.removeListener(t,a),d.removeListener("error",l),s=!0;for(let c of n)c.resolve(createIterResult(void 0,!0));return createIterResult(void 0,!0)},throw(c){i=c,d.removeListener(t,a),d.removeListener("error",l)},[Symbol.asyncIterator](){return this}};return d.on(t,a),d.on("error",l),o;function a(...c){let u=n.shift();u?u.resolve(createIterResult(c,!1)):r.push(c)}function l(c){s=!0;let u=n.shift();u?u.reject(c):i=c,o.return()}},{EventEmitter:Ds,defaultMaxListeners:Rs,init:Ms,listenerCount:$s,on:js,once:Ls}=dr}),ht=_e((d,t)=>{be(),ve(),we();var r=(ot(),We(nt)),{format:n,inspect:i}=Os(),{codes:{ERR_INVALID_ARG_TYPE:s}}=ut(),{kResistStopPropagation:o,AggregateError:a,SymbolDispose:l}=Qe(),c=globalThis.AbortSignal||Sr().AbortSignal,u=globalThis.AbortController||Sr().AbortController,p=Object.getPrototypeOf(async function(){}).constructor,h=globalThis.Blob||r.Blob,m=typeof h<"u"?function(N){return N instanceof h}:function(N){return!1},f=(N,k)=>{if(N!==void 0&&(N===null||typeof N!="object"||!("aborted"in N)))throw new s(k,"AbortSignal",N)},E=(N,k)=>{if(typeof N!="function")throw new s(k,"Function",N)};t.exports={AggregateError:a,kEmptyObject:Object.freeze({}),once(N){let k=!1;return function(...g){k||(k=!0,N.apply(this,g))}},createDeferredPromise:function(){let N,k;return{promise:new Promise((g,v)=>{N=g,k=v}),resolve:N,reject:k}},promisify(N){return new Promise((k,g)=>{N((v,..._)=>v?g(v):k(..._))})},debuglog(){return function(){}},format:n,inspect:i,types:{isAsyncFunction(N){return N instanceof p},isArrayBufferView(N){return ArrayBuffer.isView(N)}},isBlob:m,deprecate(N,k){return N},addAbortListener:(tr(),We(Mt)).addAbortListener||function(N,k){if(N===void 0)throw new s("signal","AbortSignal",N);f(N,"signal"),E(k,"listener");let g;return N.aborted?queueMicrotask(()=>k()):(N.addEventListener("abort",k,{__proto__:null,once:!0,[o]:!0}),g=()=>{N.removeEventListener("abort",k)}),{__proto__:null,[l](){var v;(v=g)===null||v===void 0||v()}}},AbortSignalAny:c.any||function(N){if(N.length===1)return N[0];let k=new u,g=()=>k.abort();return N.forEach(v=>{f(v,"signals"),v.addEventListener("abort",g,{once:!0})}),k.signal.addEventListener("abort",()=>{N.forEach(v=>v.removeEventListener("abort",g))},{once:!0}),k.signal}},t.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")}),Cr=_e((d,t)=>{be(),ve(),we();var{ArrayIsArray:r,ArrayPrototypeIncludes:n,ArrayPrototypeJoin:i,ArrayPrototypeMap:s,NumberIsInteger:o,NumberIsNaN:a,NumberMAX_SAFE_INTEGER:l,NumberMIN_SAFE_INTEGER:c,NumberParseInt:u,ObjectPrototypeHasOwnProperty:p,RegExpPrototypeExec:h,String:m,StringPrototypeToUpperCase:f,StringPrototypeTrim:E}=Qe(),{hideStackFrames:N,codes:{ERR_SOCKET_BAD_PORT:k,ERR_INVALID_ARG_TYPE:g,ERR_INVALID_ARG_VALUE:v,ERR_OUT_OF_RANGE:_,ERR_UNKNOWN_SIGNAL:S}}=ut(),{normalizeEncoding:B}=ht(),{isAsyncFunction:P,isArrayBufferView:T}=ht().types,A={};function C(J){return J===(J|0)}function O(J){return J===J>>>0}var I=/^[0-7]+$/,U="must be a 32-bit unsigned integer or an octal string";function Y(J,ge,ke){if(typeof J>"u"&&(J=ke),typeof J=="string"){if(h(I,J)===null)throw new v(ge,J,U);J=u(J,8)}return ne(J,ge),J}var j=N((J,ge,ke=c,de=l)=>{if(typeof J!="number")throw new g(ge,"number",J);if(!o(J))throw new _(ge,"an integer",J);if(J<ke||J>de)throw new _(ge,`>= ${ke} && <= ${de}`,J)}),le=N((J,ge,ke=-2147483648,de=2147483647)=>{if(typeof J!="number")throw new g(ge,"number",J);if(!o(J))throw new _(ge,"an integer",J);if(J<ke||J>de)throw new _(ge,`>= ${ke} && <= ${de}`,J)}),ne=N((J,ge,ke=!1)=>{if(typeof J!="number")throw new g(ge,"number",J);if(!o(J))throw new _(ge,"an integer",J);let de=ke?1:0,Ce=4294967295;if(J<de||J>Ce)throw new _(ge,`>= ${de} && <= ${Ce}`,J)});function te(J,ge){if(typeof J!="string")throw new g(ge,"string",J)}function ue(J,ge,ke=void 0,de){if(typeof J!="number")throw new g(ge,"number",J);if(ke!=null&&J<ke||de!=null&&J>de||(ke!=null||de!=null)&&a(J))throw new _(ge,`${ke!=null?`>= ${ke}`:""}${ke!=null&&de!=null?" && ":""}${de!=null?`<= ${de}`:""}`,J)}var $=N((J,ge,ke)=>{if(!n(ke,J)){let de="must be one of: "+i(s(ke,Ce=>typeof Ce=="string"?`'${Ce}'`:m(Ce)),", ");throw new v(ge,J,de)}});function se(J,ge){if(typeof J!="boolean")throw new g(ge,"boolean",J)}function M(J,ge,ke){return J==null||!p(J,ge)?ke:J[ge]}var Q=N((J,ge,ke=null)=>{let de=M(ke,"allowArray",!1),Ce=M(ke,"allowFunction",!1);if(!M(ke,"nullable",!1)&&J===null||!de&&r(J)||typeof J!="object"&&(!Ce||typeof J!="function"))throw new g(ge,"Object",J)}),me=N((J,ge)=>{if(J!=null&&typeof J!="object"&&typeof J!="function")throw new g(ge,"a dictionary",J)}),K=N((J,ge,ke=0)=>{if(!r(J))throw new g(ge,"Array",J);if(J.length<ke){let de=`must be longer than ${ke}`;throw new v(ge,J,de)}});function Se(J,ge){K(J,ge);for(let ke=0;ke<J.length;ke++)te(J[ke],`${ge}[${ke}]`)}function Z(J,ge){K(J,ge);for(let ke=0;ke<J.length;ke++)se(J[ke],`${ge}[${ke}]`)}function G(J,ge){K(J,ge);for(let ke=0;ke<J.length;ke++){let de=J[ke],Ce=`${ge}[${ke}]`;if(de==null)throw new g(Ce,"AbortSignal",de);Ee(de,Ce)}}function ce(J,ge="signal"){if(te(J,ge),A[J]===void 0)throw A[f(J)]!==void 0?new S(J+" (signals must use all capital letters)"):new S(J)}var X=N((J,ge="buffer")=>{if(!T(J))throw new g(ge,["Buffer","TypedArray","DataView"],J)});function oe(J,ge){let ke=B(ge),de=J.length;if(ke==="hex"&&de%2!==0)throw new v("encoding",ge,`is invalid for data of length ${de}`)}function ie(J,ge="Port",ke=!0){if(typeof J!="number"&&typeof J!="string"||typeof J=="string"&&E(J).length===0||+J!==+J>>>0||J>65535||J===0&&!ke)throw new k(ge,J,ke);return J|0}var Ee=N((J,ge)=>{if(J!==void 0&&(J===null||typeof J!="object"||!("aborted"in J)))throw new g(ge,"AbortSignal",J)}),z=N((J,ge)=>{if(typeof J!="function")throw new g(ge,"Function",J)}),V=N((J,ge)=>{if(typeof J!="function"||P(J))throw new g(ge,"Function",J)}),F=N((J,ge)=>{if(J!==void 0)throw new g(ge,"undefined",J)});function ae(J,ge,ke){if(!n(ke,J))throw new g(ge,`('${i(ke,"|")}')`,J)}var fe=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function pe(J,ge){if(typeof J>"u"||!h(fe,J))throw new v(ge,J,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}function ye(J){if(typeof J=="string")return pe(J,"hints"),J;if(r(J)){let ge=J.length,ke="";if(ge===0)return ke;for(let de=0;de<ge;de++){let Ce=J[de];pe(Ce,"hints"),ke+=Ce,de!==ge-1&&(ke+=", ")}return ke}throw new v("hints",J,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}t.exports={isInt32:C,isUint32:O,parseFileMode:Y,validateArray:K,validateStringArray:Se,validateBooleanArray:Z,validateAbortSignalArray:G,validateBoolean:se,validateBuffer:X,validateDictionary:me,validateEncoding:oe,validateFunction:z,validateInt32:le,validateInteger:j,validateNumber:ue,validateObject:Q,validateOneOf:$,validatePlainFunction:V,validatePort:ie,validateSignalName:ce,validateString:te,validateUint32:ne,validateUndefined:F,validateUnion:ae,validateAbortSignal:Ee,validateLinkHeaderValue:ye}}),rr=_e((d,t)=>{be(),ve(),we();var r=t.exports={},n,i;function s(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?n=setTimeout:n=s}catch{n=s}try{typeof clearTimeout=="function"?i=clearTimeout:i=o}catch{i=o}})();function a(k){if(n===setTimeout)return setTimeout(k,0);if((n===s||!n)&&setTimeout)return n=setTimeout,setTimeout(k,0);try{return n(k,0)}catch{try{return n.call(null,k,0)}catch{return n.call(this,k,0)}}}function l(k){if(i===clearTimeout)return clearTimeout(k);if((i===o||!i)&&clearTimeout)return i=clearTimeout,clearTimeout(k);try{return i(k)}catch{try{return i.call(null,k)}catch{return i.call(this,k)}}}var c=[],u=!1,p,h=-1;function m(){!u||!p||(u=!1,p.length?c=p.concat(c):h=-1,c.length&&f())}function f(){if(!u){var k=a(m);u=!0;for(var g=c.length;g;){for(p=c,c=[];++h<g;)p&&p[h].run();h=-1,g=c.length}p=null,u=!1,l(k)}}r.nextTick=function(k){var g=new Array(arguments.length-1);if(arguments.length>1)for(var v=1;v<arguments.length;v++)g[v-1]=arguments[v];c.push(new E(k,g)),c.length===1&&!u&&a(f)};function E(k,g){this.fun=k,this.array=g}E.prototype.run=function(){this.fun.apply(null,this.array)},r.title="browser",r.browser=!0,r.env={},r.argv=[],r.version="",r.versions={};function N(){}r.on=N,r.addListener=N,r.once=N,r.off=N,r.removeListener=N,r.removeAllListeners=N,r.emit=N,r.prependListener=N,r.prependOnceListener=N,r.listeners=function(k){return[]},r.binding=function(k){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(k){throw new Error("process.chdir is not supported")},r.umask=function(){return 0}}),At=_e((d,t)=>{be(),ve(),we();var{SymbolAsyncIterator:r,SymbolIterator:n,SymbolFor:i}=Qe(),s=i("nodejs.stream.destroyed"),o=i("nodejs.stream.errored"),a=i("nodejs.stream.readable"),l=i("nodejs.stream.writable"),c=i("nodejs.stream.disturbed"),u=i("nodejs.webstream.isClosedPromise"),p=i("nodejs.webstream.controllerErrorFunction");function h(M,Q=!1){var me;return!!(M&&typeof M.pipe=="function"&&typeof M.on=="function"&&(!Q||typeof M.pause=="function"&&typeof M.resume=="function")&&(!M._writableState||((me=M._readableState)===null||me===void 0?void 0:me.readable)!==!1)&&(!M._writableState||M._readableState))}function m(M){var Q;return!!(M&&typeof M.write=="function"&&typeof M.on=="function"&&(!M._readableState||((Q=M._writableState)===null||Q===void 0?void 0:Q.writable)!==!1))}function f(M){return!!(M&&typeof M.pipe=="function"&&M._readableState&&typeof M.on=="function"&&typeof M.write=="function")}function E(M){return M&&(M._readableState||M._writableState||typeof M.write=="function"&&typeof M.on=="function"||typeof M.pipe=="function"&&typeof M.on=="function")}function N(M){return!!(M&&!E(M)&&typeof M.pipeThrough=="function"&&typeof M.getReader=="function"&&typeof M.cancel=="function")}function k(M){return!!(M&&!E(M)&&typeof M.getWriter=="function"&&typeof M.abort=="function")}function g(M){return!!(M&&!E(M)&&typeof M.readable=="object"&&typeof M.writable=="object")}function v(M){return N(M)||k(M)||g(M)}function _(M,Q){return M==null?!1:Q===!0?typeof M[r]=="function":Q===!1?typeof M[n]=="function":typeof M[r]=="function"||typeof M[n]=="function"}function S(M){if(!E(M))return null;let Q=M._writableState,me=M._readableState,K=Q||me;return!!(M.destroyed||M[s]||K!=null&&K.destroyed)}function B(M){if(!m(M))return null;if(M.writableEnded===!0)return!0;let Q=M._writableState;return Q!=null&&Q.errored?!1:typeof(Q==null?void 0:Q.ended)!="boolean"?null:Q.ended}function P(M,Q){if(!m(M))return null;if(M.writableFinished===!0)return!0;let me=M._writableState;return me!=null&&me.errored?!1:typeof(me==null?void 0:me.finished)!="boolean"?null:!!(me.finished||Q===!1&&me.ended===!0&&me.length===0)}function T(M){if(!h(M))return null;if(M.readableEnded===!0)return!0;let Q=M._readableState;return!Q||Q.errored?!1:typeof(Q==null?void 0:Q.ended)!="boolean"?null:Q.ended}function A(M,Q){if(!h(M))return null;let me=M._readableState;return me!=null&&me.errored?!1:typeof(me==null?void 0:me.endEmitted)!="boolean"?null:!!(me.endEmitted||Q===!1&&me.ended===!0&&me.length===0)}function C(M){return M&&M[a]!=null?M[a]:typeof(M==null?void 0:M.readable)!="boolean"?null:S(M)?!1:h(M)&&M.readable&&!A(M)}function O(M){return M&&M[l]!=null?M[l]:typeof(M==null?void 0:M.writable)!="boolean"?null:S(M)?!1:m(M)&&M.writable&&!B(M)}function I(M,Q){return E(M)?S(M)?!0:!((Q==null?void 0:Q.readable)!==!1&&C(M)||(Q==null?void 0:Q.writable)!==!1&&O(M)):null}function U(M){var Q,me;return E(M)?M.writableErrored?M.writableErrored:(Q=(me=M._writableState)===null||me===void 0?void 0:me.errored)!==null&&Q!==void 0?Q:null:null}function Y(M){var Q,me;return E(M)?M.readableErrored?M.readableErrored:(Q=(me=M._readableState)===null||me===void 0?void 0:me.errored)!==null&&Q!==void 0?Q:null:null}function j(M){if(!E(M))return null;if(typeof M.closed=="boolean")return M.closed;let Q=M._writableState,me=M._readableState;return typeof(Q==null?void 0:Q.closed)=="boolean"||typeof(me==null?void 0:me.closed)=="boolean"?(Q==null?void 0:Q.closed)||(me==null?void 0:me.closed):typeof M._closed=="boolean"&&le(M)?M._closed:null}function le(M){return typeof M._closed=="boolean"&&typeof M._defaultKeepAlive=="boolean"&&typeof M._removedConnection=="boolean"&&typeof M._removedContLen=="boolean"}function ne(M){return typeof M._sent100=="boolean"&&le(M)}function te(M){var Q;return typeof M._consuming=="boolean"&&typeof M._dumped=="boolean"&&((Q=M.req)===null||Q===void 0?void 0:Q.upgradeOrConnect)===void 0}function ue(M){if(!E(M))return null;let Q=M._writableState,me=M._readableState,K=Q||me;return!K&&ne(M)||!!(K&&K.autoDestroy&&K.emitClose&&K.closed===!1)}function $(M){var Q;return!!(M&&((Q=M[c])!==null&&Q!==void 0?Q:M.readableDidRead||M.readableAborted))}function se(M){var Q,me,K,Se,Z,G,ce,X,oe,ie;return!!(M&&((Q=(me=(K=(Se=(Z=(G=M[o])!==null&&G!==void 0?G:M.readableErrored)!==null&&Z!==void 0?Z:M.writableErrored)!==null&&Se!==void 0?Se:(ce=M._readableState)===null||ce===void 0?void 0:ce.errorEmitted)!==null&&K!==void 0?K:(X=M._writableState)===null||X===void 0?void 0:X.errorEmitted)!==null&&me!==void 0?me:(oe=M._readableState)===null||oe===void 0?void 0:oe.errored)!==null&&Q!==void 0?Q:!((ie=M._writableState)===null||ie===void 0)&&ie.errored))}t.exports={isDestroyed:S,kIsDestroyed:s,isDisturbed:$,kIsDisturbed:c,isErrored:se,kIsErrored:o,isReadable:C,kIsReadable:a,kIsClosedPromise:u,kControllerErrorFunction:p,kIsWritable:l,isClosed:j,isDuplexNodeStream:f,isFinished:I,isIterable:_,isReadableNodeStream:h,isReadableStream:N,isReadableEnded:T,isReadableFinished:A,isReadableErrored:Y,isNodeStream:E,isWebStream:v,isWritable:O,isWritableNodeStream:m,isWritableStream:k,isWritableEnded:B,isWritableFinished:P,isWritableErrored:U,isServerRequest:te,isServerResponse:ne,willEmitClose:ue,isTransformStream:g}}),$t=_e((d,t)=>{be(),ve(),we();var r=rr(),{AbortError:n,codes:i}=ut(),{ERR_INVALID_ARG_TYPE:s,ERR_STREAM_PREMATURE_CLOSE:o}=i,{kEmptyObject:a,once:l}=ht(),{validateAbortSignal:c,validateFunction:u,validateObject:p,validateBoolean:h}=Cr(),{Promise:m,PromisePrototypeThen:f,SymbolDispose:E}=Qe(),{isClosed:N,isReadable:k,isReadableNodeStream:g,isReadableStream:v,isReadableFinished:_,isReadableErrored:S,isWritable:B,isWritableNodeStream:P,isWritableStream:T,isWritableFinished:A,isWritableErrored:C,isNodeStream:O,willEmitClose:I,kIsClosedPromise:U}=At(),Y;function j($){return $.setHeader&&typeof $.abort=="function"}var le=()=>{};function ne($,se,M){var Q,me;if(arguments.length===2?(M=se,se=a):se==null?se=a:p(se,"options"),u(M,"callback"),c(se.signal,"options.signal"),M=l(M),v($)||T($))return te($,se,M);if(!O($))throw new s("stream",["ReadableStream","WritableStream","Stream"],$);let K=(Q=se.readable)!==null&&Q!==void 0?Q:g($),Se=(me=se.writable)!==null&&me!==void 0?me:P($),Z=$._writableState,G=$._readableState,ce=()=>{$.writable||ie()},X=I($)&&g($)===K&&P($)===Se,oe=A($,!1),ie=()=>{oe=!0,$.destroyed&&(X=!1),!(X&&(!$.readable||K))&&(!K||Ee)&&M.call($)},Ee=_($,!1),z=()=>{Ee=!0,$.destroyed&&(X=!1),!(X&&(!$.writable||Se))&&(!Se||oe)&&M.call($)},V=J=>{M.call($,J)},F=N($),ae=()=>{F=!0;let J=C($)||S($);if(J&&typeof J!="boolean")return M.call($,J);if(K&&!Ee&&g($,!0)&&!_($,!1))return M.call($,new o);if(Se&&!oe&&!A($,!1))return M.call($,new o);M.call($)},fe=()=>{F=!0;let J=C($)||S($);if(J&&typeof J!="boolean")return M.call($,J);M.call($)},pe=()=>{$.req.on("finish",ie)};j($)?($.on("complete",ie),X||$.on("abort",ae),$.req?pe():$.on("request",pe)):Se&&!Z&&($.on("end",ce),$.on("close",ce)),!X&&typeof $.aborted=="boolean"&&$.on("aborted",ae),$.on("end",z),$.on("finish",ie),se.error!==!1&&$.on("error",V),$.on("close",ae),F?r.nextTick(ae):Z!=null&&Z.errorEmitted||G!=null&&G.errorEmitted?X||r.nextTick(fe):(!K&&(!X||k($))&&(oe||B($)===!1)||!Se&&(!X||B($))&&(Ee||k($)===!1)||G&&$.req&&$.aborted)&&r.nextTick(fe);let ye=()=>{M=le,$.removeListener("aborted",ae),$.removeListener("complete",ie),$.removeListener("abort",ae),$.removeListener("request",pe),$.req&&$.req.removeListener("finish",ie),$.removeListener("end",ce),$.removeListener("close",ce),$.removeListener("finish",ie),$.removeListener("end",z),$.removeListener("error",V),$.removeListener("close",ae)};if(se.signal&&!F){let J=()=>{let ge=M;ye(),ge.call($,new n(void 0,{cause:se.signal.reason}))};if(se.signal.aborted)r.nextTick(J);else{Y=Y||ht().addAbortListener;let ge=Y(se.signal,J),ke=M;M=l((...de)=>{ge[E](),ke.apply($,de)})}}return ye}function te($,se,M){let Q=!1,me=le;if(se.signal)if(me=()=>{Q=!0,M.call($,new n(void 0,{cause:se.signal.reason}))},se.signal.aborted)r.nextTick(me);else{Y=Y||ht().addAbortListener;let Se=Y(se.signal,me),Z=M;M=l((...G)=>{Se[E](),Z.apply($,G)})}let K=(...Se)=>{Q||r.nextTick(()=>M.apply($,Se))};return f($[U].promise,K,K),le}function ue($,se){var M;let Q=!1;return se===null&&(se=a),(M=se)!==null&&M!==void 0&&M.cleanup&&(h(se.cleanup,"cleanup"),Q=se.cleanup),new m((me,K)=>{let Se=ne($,se,Z=>{Q&&Se(),Z?K(Z):me()})})}t.exports=ne,t.exports.finished=ue}),ur=_e((d,t)=>{be(),ve(),we();var r=rr(),{aggregateTwoErrors:n,codes:{ERR_MULTIPLE_CALLBACK:i},AbortError:s}=ut(),{Symbol:o}=Qe(),{kIsDestroyed:a,isDestroyed:l,isFinished:c,isServerRequest:u}=At(),p=o("kDestroy"),h=o("kConstruct");function m(I,U,Y){I&&(I.stack,U&&!U.errored&&(U.errored=I),Y&&!Y.errored&&(Y.errored=I))}function f(I,U){let Y=this._readableState,j=this._writableState,le=j||Y;return j!=null&&j.destroyed||Y!=null&&Y.destroyed?(typeof U=="function"&&U(),this):(m(I,j,Y),j&&(j.destroyed=!0),Y&&(Y.destroyed=!0),le.constructed?E(this,I,U):this.once(p,function(ne){E(this,n(ne,I),U)}),this)}function E(I,U,Y){let j=!1;function le(ne){if(j)return;j=!0;let te=I._readableState,ue=I._writableState;m(ne,ue,te),ue&&(ue.closed=!0),te&&(te.closed=!0),typeof Y=="function"&&Y(ne),ne?r.nextTick(N,I,ne):r.nextTick(k,I)}try{I._destroy(U||null,le)}catch(ne){le(ne)}}function N(I,U){g(I,U),k(I)}function k(I){let U=I._readableState,Y=I._writableState;Y&&(Y.closeEmitted=!0),U&&(U.closeEmitted=!0),(Y!=null&&Y.emitClose||U!=null&&U.emitClose)&&I.emit("close")}function g(I,U){let Y=I._readableState,j=I._writableState;j!=null&&j.errorEmitted||Y!=null&&Y.errorEmitted||(j&&(j.errorEmitted=!0),Y&&(Y.errorEmitted=!0),I.emit("error",U))}function v(){let I=this._readableState,U=this._writableState;I&&(I.constructed=!0,I.closed=!1,I.closeEmitted=!1,I.destroyed=!1,I.errored=null,I.errorEmitted=!1,I.reading=!1,I.ended=I.readable===!1,I.endEmitted=I.readable===!1),U&&(U.constructed=!0,U.destroyed=!1,U.closed=!1,U.closeEmitted=!1,U.errored=null,U.errorEmitted=!1,U.finalCalled=!1,U.prefinished=!1,U.ended=U.writable===!1,U.ending=U.writable===!1,U.finished=U.writable===!1)}function _(I,U,Y){let j=I._readableState,le=I._writableState;if(le!=null&&le.destroyed||j!=null&&j.destroyed)return this;j!=null&&j.autoDestroy||le!=null&&le.autoDestroy?I.destroy(U):U&&(U.stack,le&&!le.errored&&(le.errored=U),j&&!j.errored&&(j.errored=U),Y?r.nextTick(g,I,U):g(I,U))}function S(I,U){if(typeof I._construct!="function")return;let Y=I._readableState,j=I._writableState;Y&&(Y.constructed=!1),j&&(j.constructed=!1),I.once(h,U),!(I.listenerCount(h)>1)&&r.nextTick(B,I)}function B(I){let U=!1;function Y(j){if(U){_(I,j??new i);return}U=!0;let le=I._readableState,ne=I._writableState,te=ne||le;le&&(le.constructed=!0),ne&&(ne.constructed=!0),te.destroyed?I.emit(p,j):j?_(I,j,!0):r.nextTick(P,I)}try{I._construct(j=>{r.nextTick(Y,j)})}catch(j){r.nextTick(Y,j)}}function P(I){I.emit(h)}function T(I){return(I==null?void 0:I.setHeader)&&typeof I.abort=="function"}function A(I){I.emit("close")}function C(I,U){I.emit("error",U),r.nextTick(A,I)}function O(I,U){!I||l(I)||(!U&&!c(I)&&(U=new s),u(I)?(I.socket=null,I.destroy(U)):T(I)?I.abort():T(I.req)?I.req.abort():typeof I.destroy=="function"?I.destroy(U):typeof I.close=="function"?I.close():U?r.nextTick(C,I,U):r.nextTick(A,I),I.destroyed||(I[a]=!0))}t.exports={construct:S,destroyer:O,destroy:f,undestroy:v,errorOrDestroy:_}}),Ho=_e((d,t)=>{be(),ve(),we();var{ArrayIsArray:r,ObjectSetPrototypeOf:n}=Qe(),{EventEmitter:i}=(tr(),We(Mt));function s(a){i.call(this,a)}n(s.prototype,i.prototype),n(s,i),s.prototype.pipe=function(a,l){let c=this;function u(k){a.writable&&a.write(k)===!1&&c.pause&&c.pause()}c.on("data",u);function p(){c.readable&&c.resume&&c.resume()}a.on("drain",p),!a._isStdio&&(!l||l.end!==!1)&&(c.on("end",m),c.on("close",f));let h=!1;function m(){h||(h=!0,a.end())}function f(){h||(h=!0,typeof a.destroy=="function"&&a.destroy())}function E(k){N(),i.listenerCount(this,"error")===0&&this.emit("error",k)}o(c,"error",E),o(a,"error",E);function N(){c.removeListener("data",u),a.removeListener("drain",p),c.removeListener("end",m),c.removeListener("close",f),c.removeListener("error",E),a.removeListener("error",E),c.removeListener("end",N),c.removeListener("close",N),a.removeListener("close",N)}return c.on("end",N),c.on("close",N),a.on("close",N),a.emit("pipe",c),a};function o(a,l,c){if(typeof a.prependListener=="function")return a.prependListener(l,c);!a._events||!a._events[l]?a.on(l,c):r(a._events[l])?a._events[l].unshift(c):a._events[l]=[c,a._events[l]]}t.exports={Stream:s,prependListener:o}}),Ur=_e((d,t)=>{be(),ve(),we();var{SymbolDispose:r}=Qe(),{AbortError:n,codes:i}=ut(),{isNodeStream:s,isWebStream:o,kControllerErrorFunction:a}=At(),l=$t(),{ERR_INVALID_ARG_TYPE:c}=i,u,p=(h,m)=>{if(typeof h!="object"||!("aborted"in h))throw new c(m,"AbortSignal",h)};t.exports.addAbortSignal=function(h,m){if(p(h,"signal"),!s(m)&&!o(m))throw new c("stream",["ReadableStream","WritableStream","Stream"],m);return t.exports.addAbortSignalNoValidate(h,m)},t.exports.addAbortSignalNoValidate=function(h,m){if(typeof h!="object"||!("aborted"in h))return m;let f=s(m)?()=>{m.destroy(new n(void 0,{cause:h.reason}))}:()=>{m[a](new n(void 0,{cause:h.reason}))};if(h.aborted)f();else{u=u||ht().addAbortListener;let E=u(h,f);l(m,E[r])}return m}}),Ef=_e((d,t)=>{be(),ve(),we();var{StringPrototypeSlice:r,SymbolIterator:n,TypedArrayPrototypeSet:i,Uint8Array:s}=Qe(),{Buffer:o}=(ot(),We(nt)),{inspect:a}=ht();t.exports=class{constructor(){this.head=null,this.tail=null,this.length=0}push(l){let c={data:l,next:null};this.length>0?this.tail.next=c:this.head=c,this.tail=c,++this.length}unshift(l){let c={data:l,next:this.head};this.length===0&&(this.tail=c),this.head=c,++this.length}shift(){if(this.length===0)return;let l=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,l}clear(){this.head=this.tail=null,this.length=0}join(l){if(this.length===0)return"";let c=this.head,u=""+c.data;for(;(c=c.next)!==null;)u+=l+c.data;return u}concat(l){if(this.length===0)return o.alloc(0);let c=o.allocUnsafe(l>>>0),u=this.head,p=0;for(;u;)i(c,u.data,p),p+=u.data.length,u=u.next;return c}consume(l,c){let u=this.head.data;if(l<u.length){let p=u.slice(0,l);return this.head.data=u.slice(l),p}return l===u.length?this.shift():c?this._getString(l):this._getBuffer(l)}first(){return this.head.data}*[n](){for(let l=this.head;l;l=l.next)yield l.data}_getString(l){let c="",u=this.head,p=0;do{let h=u.data;if(l>h.length)c+=h,l-=h.length;else{l===h.length?(c+=h,++p,u.next?this.head=u.next:this.head=this.tail=null):(c+=r(h,0,l),this.head=u,u.data=r(h,l));break}++p}while((u=u.next)!==null);return this.length-=p,c}_getBuffer(l){let c=o.allocUnsafe(l),u=l,p=this.head,h=0;do{let m=p.data;if(l>m.length)i(c,m,u-l),l-=m.length;else{l===m.length?(i(c,m,u-l),++h,p.next?this.head=p.next:this.head=this.tail=null):(i(c,new s(m.buffer,m.byteOffset,l),u-l),this.head=p,p.data=m.slice(l));break}++h}while((p=p.next)!==null);return this.length-=h,c}[Symbol.for("nodejs.util.inspect.custom")](l,c){return a(this,{...c,depth:0,customInspect:!1})}}}),Fr=_e((d,t)=>{be(),ve(),we();var{MathFloor:r,NumberIsInteger:n}=Qe(),{validateInteger:i}=Cr(),{ERR_INVALID_ARG_VALUE:s}=ut().codes,o=16*1024,a=16;function l(h,m,f){return h.highWaterMark!=null?h.highWaterMark:m?h[f]:null}function c(h){return h?a:o}function u(h,m){i(m,"value",0),h?a=m:o=m}function p(h,m,f,E){let N=l(m,E,f);if(N!=null){if(!n(N)||N<0){let k=E?`options.${f}`:"options.highWaterMark";throw new s(k,N)}return r(N)}return c(h.objectMode)}t.exports={getHighWaterMark:p,getDefaultHighWaterMark:c,setDefaultHighWaterMark:u}}),kf=_e((d,t)=>{be(),ve(),we();var r=(ot(),We(nt)),n=r.Buffer;function i(o,a){for(var l in o)a[l]=o[l]}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?t.exports=r:(i(r,d),d.Buffer=s);function s(o,a,l){return n(o,a,l)}s.prototype=Object.create(n.prototype),i(n,s),s.from=function(o,a,l){if(typeof o=="number")throw new TypeError("Argument must not be a number");return n(o,a,l)},s.alloc=function(o,a,l){if(typeof o!="number")throw new TypeError("Argument must be a number");var c=n(o);return a!==void 0?typeof l=="string"?c.fill(a,l):c.fill(a):c.fill(0),c},s.allocUnsafe=function(o){if(typeof o!="number")throw new TypeError("Argument must be a number");return n(o)},s.allocUnsafeSlow=function(o){if(typeof o!="number")throw new TypeError("Argument must be a number");return r.SlowBuffer(o)}}),_f=_e(d=>{be(),ve(),we();var t=kf().Buffer,r=t.isEncoding||function(g){switch(g=""+g,g&&g.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function n(g){if(!g)return"utf8";for(var v;;)switch(g){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return g;default:if(v)return;g=(""+g).toLowerCase(),v=!0}}function i(g){var v=n(g);if(typeof v!="string"&&(t.isEncoding===r||!r(g)))throw new Error("Unknown encoding: "+g);return v||g}d.StringDecoder=s;function s(g){this.encoding=i(g);var v;switch(this.encoding){case"utf16le":this.text=h,this.end=m,v=4;break;case"utf8":this.fillLast=c,v=4;break;case"base64":this.text=f,this.end=E,v=3;break;default:this.write=N,this.end=k;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=t.allocUnsafe(v)}s.prototype.write=function(g){if(g.length===0)return"";var v,_;if(this.lastNeed){if(v=this.fillLast(g),v===void 0)return"";_=this.lastNeed,this.lastNeed=0}else _=0;return _<g.length?v?v+this.text(g,_):this.text(g,_):v||""},s.prototype.end=p,s.prototype.text=u,s.prototype.fillLast=function(g){if(this.lastNeed<=g.length)return g.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);g.copy(this.lastChar,this.lastTotal-this.lastNeed,0,g.length),this.lastNeed-=g.length};function o(g){return g<=127?0:g>>5===6?2:g>>4===14?3:g>>3===30?4:g>>6===2?-1:-2}function a(g,v,_){var S=v.length-1;if(S<_)return 0;var B=o(v[S]);return B>=0?(B>0&&(g.lastNeed=B-1),B):--S<_||B===-2?0:(B=o(v[S]),B>=0?(B>0&&(g.lastNeed=B-2),B):--S<_||B===-2?0:(B=o(v[S]),B>=0?(B>0&&(B===2?B=0:g.lastNeed=B-3),B):0))}function l(g,v,_){if((v[0]&192)!==128)return g.lastNeed=0,"�";if(g.lastNeed>1&&v.length>1){if((v[1]&192)!==128)return g.lastNeed=1,"�";if(g.lastNeed>2&&v.length>2&&(v[2]&192)!==128)return g.lastNeed=2,"�"}}function c(g){var v=this.lastTotal-this.lastNeed,_=l(this,g);if(_!==void 0)return _;if(this.lastNeed<=g.length)return g.copy(this.lastChar,v,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);g.copy(this.lastChar,v,0,g.length),this.lastNeed-=g.length}function u(g,v){var _=a(this,g,v);if(!this.lastNeed)return g.toString("utf8",v);this.lastTotal=_;var S=g.length-(_-this.lastNeed);return g.copy(this.lastChar,0,S),g.toString("utf8",v,S)}function p(g){var v=g&&g.length?this.write(g):"";return this.lastNeed?v+"�":v}function h(g,v){if((g.length-v)%2===0){var _=g.toString("utf16le",v);if(_){var S=_.charCodeAt(_.length-1);if(S>=55296&&S<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=g[g.length-2],this.lastChar[1]=g[g.length-1],_.slice(0,-1)}return _}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=g[g.length-1],g.toString("utf16le",v,g.length-1)}function m(g){var v=g&&g.length?this.write(g):"";if(this.lastNeed){var _=this.lastTotal-this.lastNeed;return v+this.lastChar.toString("utf16le",0,_)}return v}function f(g,v){var _=(g.length-v)%3;return _===0?g.toString("base64",v):(this.lastNeed=3-_,this.lastTotal=3,_===1?this.lastChar[0]=g[g.length-1]:(this.lastChar[0]=g[g.length-2],this.lastChar[1]=g[g.length-1]),g.toString("base64",v,g.length-_))}function E(g){var v=g&&g.length?this.write(g):"";return this.lastNeed?v+this.lastChar.toString("base64",0,3-this.lastNeed):v}function N(g){return g.toString(this.encoding)}function k(g){return g&&g.length?this.write(g):""}}),Us=_e((d,t)=>{be(),ve(),we();var r=rr(),{PromisePrototypeThen:n,SymbolAsyncIterator:i,SymbolIterator:s}=Qe(),{Buffer:o}=(ot(),We(nt)),{ERR_INVALID_ARG_TYPE:a,ERR_STREAM_NULL_VALUES:l}=ut().codes;function c(u,p,h){let m;if(typeof p=="string"||p instanceof o)return new u({objectMode:!0,...h,read(){this.push(p),this.push(null)}});let f;if(p&&p[i])f=!0,m=p[i]();else if(p&&p[s])f=!1,m=p[s]();else throw new a("iterable",["Iterable"],p);let E=new u({objectMode:!0,highWaterMark:1,...h}),N=!1;E._read=function(){N||(N=!0,g())},E._destroy=function(v,_){n(k(v),()=>r.nextTick(_,v),S=>r.nextTick(_,S||v))};async function k(v){let _=v!=null,S=typeof m.throw=="function";if(_&&S){let{value:B,done:P}=await m.throw(v);if(await B,P)return}if(typeof m.return=="function"){let{value:B}=await m.return();await B}}async function g(){for(;;){try{let{value:v,done:_}=f?await m.next():m.next();if(_)E.push(null);else{let S=v&&typeof v.then=="function"?await v:v;if(S===null)throw N=!1,new l;if(E.push(S))continue;N=!1}}catch(v){E.destroy(v)}break}}return E}t.exports=c}),zr=_e((d,t)=>{be(),ve(),we();var r=rr(),{ArrayPrototypeIndexOf:n,NumberIsInteger:i,NumberIsNaN:s,NumberParseInt:o,ObjectDefineProperties:a,ObjectKeys:l,ObjectSetPrototypeOf:c,Promise:u,SafeSet:p,SymbolAsyncDispose:h,SymbolAsyncIterator:m,Symbol:f}=Qe();t.exports=de,de.ReadableState=ke;var{EventEmitter:E}=(tr(),We(Mt)),{Stream:N,prependListener:k}=Ho(),{Buffer:g}=(ot(),We(nt)),{addAbortSignal:v}=Ur(),_=$t(),S=ht().debuglog("stream",R=>{S=R}),B=Ef(),P=ur(),{getHighWaterMark:T,getDefaultHighWaterMark:A}=Fr(),{aggregateTwoErrors:C,codes:{ERR_INVALID_ARG_TYPE:O,ERR_METHOD_NOT_IMPLEMENTED:I,ERR_OUT_OF_RANGE:U,ERR_STREAM_PUSH_AFTER_EOF:Y,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:j},AbortError:le}=ut(),{validateObject:ne}=Cr(),te=f("kPaused"),{StringDecoder:ue}=_f(),$=Us();c(de.prototype,N.prototype),c(de,N);var se=()=>{},{errorOrDestroy:M}=P,Q=1,me=2,K=4,Se=8,Z=16,G=32,ce=64,X=128,oe=256,ie=512,Ee=1024,z=2048,V=4096,F=8192,ae=16384,fe=32768,pe=65536,ye=1<<17,J=1<<18;function ge(R){return{enumerable:!1,get(){return(this.state&R)!==0},set(W){W?this.state|=R:this.state&=~R}}}a(ke.prototype,{objectMode:ge(Q),ended:ge(me),endEmitted:ge(K),reading:ge(Se),constructed:ge(Z),sync:ge(G),needReadable:ge(ce),emittedReadable:ge(X),readableListening:ge(oe),resumeScheduled:ge(ie),errorEmitted:ge(Ee),emitClose:ge(z),autoDestroy:ge(V),destroyed:ge(F),closed:ge(ae),closeEmitted:ge(fe),multiAwaitDrain:ge(pe),readingMore:ge(ye),dataEmitted:ge(J)});function ke(R,W,Ne){typeof Ne!="boolean"&&(Ne=W instanceof It()),this.state=z|V|Z|G,R&&R.objectMode&&(this.state|=Q),Ne&&R&&R.readableObjectMode&&(this.state|=Q),this.highWaterMark=R?T(this,R,"readableHighWaterMark",Ne):A(!1),this.buffer=new B,this.length=0,this.pipes=[],this.flowing=null,this[te]=null,R&&R.emitClose===!1&&(this.state&=~z),R&&R.autoDestroy===!1&&(this.state&=~V),this.errored=null,this.defaultEncoding=R&&R.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,R&&R.encoding&&(this.decoder=new ue(R.encoding),this.encoding=R.encoding)}function de(R){if(!(this instanceof de))return new de(R);let W=this instanceof It();this._readableState=new ke(R,this,W),R&&(typeof R.read=="function"&&(this._read=R.read),typeof R.destroy=="function"&&(this._destroy=R.destroy),typeof R.construct=="function"&&(this._construct=R.construct),R.signal&&!W&&v(R.signal,this)),N.call(this,R),P.construct(this,()=>{this._readableState.needReadable&&H(this,this._readableState)})}de.prototype.destroy=P.destroy,de.prototype._undestroy=P.undestroy,de.prototype._destroy=function(R,W){W(R)},de.prototype[E.captureRejectionSymbol]=function(R){this.destroy(R)},de.prototype[h]=function(){let R;return this.destroyed||(R=this.readableEnded?null:new le,this.destroy(R)),new u((W,Ne)=>_(this,Ie=>Ie&&Ie!==R?Ne(Ie):W(null)))},de.prototype.push=function(R,W){return Ce(this,R,W,!1)},de.prototype.unshift=function(R,W){return Ce(this,R,W,!0)};function Ce(R,W,Ne,Ie){S("readableAddChunk",W);let Be=R._readableState,rt;if(!(Be.state&Q)&&(typeof W=="string"?(Ne=Ne||Be.defaultEncoding,Be.encoding!==Ne&&(Ie&&Be.encoding?W=g.from(W,Ne).toString(Be.encoding):(W=g.from(W,Ne),Ne=""))):W instanceof g?Ne="":N._isUint8Array(W)?(W=N._uint8ArrayToBuffer(W),Ne=""):W!=null&&(rt=new O("chunk",["string","Buffer","Uint8Array"],W))),rt)M(R,rt);else if(W===null)Be.state&=~Se,D(R,Be);else if(Be.state&Q||W&&W.length>0)if(Ie)if(Be.state&K)M(R,new j);else{if(Be.destroyed||Be.errored)return!1;y(R,Be,W,!0)}else if(Be.ended)M(R,new Y);else{if(Be.destroyed||Be.errored)return!1;Be.state&=~Se,Be.decoder&&!Ne?(W=Be.decoder.write(W),Be.objectMode||W.length!==0?y(R,Be,W,!1):H(R,Be)):y(R,Be,W,!1)}else Ie||(Be.state&=~Se,H(R,Be));return!Be.ended&&(Be.length<Be.highWaterMark||Be.length===0)}function y(R,W,Ne,Ie){W.flowing&&W.length===0&&!W.sync&&R.listenerCount("data")>0?(W.state&pe?W.awaitDrainWriters.clear():W.awaitDrainWriters=null,W.dataEmitted=!0,R.emit("data",Ne)):(W.length+=W.objectMode?1:Ne.length,Ie?W.buffer.unshift(Ne):W.buffer.push(Ne),W.state&ce&&L(R)),H(R,W)}de.prototype.isPaused=function(){let R=this._readableState;return R[te]===!0||R.flowing===!1},de.prototype.setEncoding=function(R){let W=new ue(R);this._readableState.decoder=W,this._readableState.encoding=this._readableState.decoder.encoding;let Ne=this._readableState.buffer,Ie="";for(let Be of Ne)Ie+=W.write(Be);return Ne.clear(),Ie!==""&&Ne.push(Ie),this._readableState.length=Ie.length,this};var b=1073741824;function w(R){if(R>b)throw new U("size","<= 1GiB",R);return R--,R|=R>>>1,R|=R>>>2,R|=R>>>4,R|=R>>>8,R|=R>>>16,R++,R}function x(R,W){return R<=0||W.length===0&&W.ended?0:W.state&Q?1:s(R)?W.flowing&&W.length?W.buffer.first().length:W.length:R<=W.length?R:W.ended?W.length:0}de.prototype.read=function(R){S("read",R),R===void 0?R=NaN:i(R)||(R=o(R,10));let W=this._readableState,Ne=R;if(R>W.highWaterMark&&(W.highWaterMark=w(R)),R!==0&&(W.state&=~X),R===0&&W.needReadable&&((W.highWaterMark!==0?W.length>=W.highWaterMark:W.length>0)||W.ended))return S("read: emitReadable",W.length,W.ended),W.length===0&&W.ended?Ue(this):L(this),null;if(R=x(R,W),R===0&&W.ended)return W.length===0&&Ue(this),null;let Ie=(W.state&ce)!==0;if(S("need readable",Ie),(W.length===0||W.length-R<W.highWaterMark)&&(Ie=!0,S("length less than watermark",Ie)),W.ended||W.reading||W.destroyed||W.errored||!W.constructed)Ie=!1,S("reading, ended or constructing",Ie);else if(Ie){S("do read"),W.state|=Se|G,W.length===0&&(W.state|=ce);try{this._read(W.highWaterMark)}catch(rt){M(this,rt)}W.state&=~G,W.reading||(R=x(Ne,W))}let Be;return R>0?Be=De(R,W):Be=null,Be===null?(W.needReadable=W.length<=W.highWaterMark,R=0):(W.length-=R,W.multiAwaitDrain?W.awaitDrainWriters.clear():W.awaitDrainWriters=null),W.length===0&&(W.ended||(W.needReadable=!0),Ne!==R&&W.ended&&Ue(this)),Be!==null&&!W.errorEmitted&&!W.closeEmitted&&(W.dataEmitted=!0,this.emit("data",Be)),Be};function D(R,W){if(S("onEofChunk"),!W.ended){if(W.decoder){let Ne=W.decoder.end();Ne&&Ne.length&&(W.buffer.push(Ne),W.length+=W.objectMode?1:Ne.length)}W.ended=!0,W.sync?L(R):(W.needReadable=!1,W.emittedReadable=!0,re(R))}}function L(R){let W=R._readableState;S("emitReadable",W.needReadable,W.emittedReadable),W.needReadable=!1,W.emittedReadable||(S("emitReadable",W.flowing),W.emittedReadable=!0,r.nextTick(re,R))}function re(R){let W=R._readableState;S("emitReadable_",W.destroyed,W.length,W.ended),!W.destroyed&&!W.errored&&(W.length||W.ended)&&(R.emit("readable"),W.emittedReadable=!1),W.needReadable=!W.flowing&&!W.ended&&W.length<=W.highWaterMark,et(R)}function H(R,W){!W.readingMore&&W.constructed&&(W.readingMore=!0,r.nextTick(ee,R,W))}function ee(R,W){for(;!W.reading&&!W.ended&&(W.length<W.highWaterMark||W.flowing&&W.length===0);){let Ne=W.length;if(S("maybeReadMore read 0"),R.read(0),Ne===W.length)break}W.readingMore=!1}de.prototype._read=function(R){throw new I("_read()")},de.prototype.pipe=function(R,W){let Ne=this,Ie=this._readableState;Ie.pipes.length===1&&(Ie.multiAwaitDrain||(Ie.multiAwaitDrain=!0,Ie.awaitDrainWriters=new p(Ie.awaitDrainWriters?[Ie.awaitDrainWriters]:[]))),Ie.pipes.push(R),S("pipe count=%d opts=%j",Ie.pipes.length,W);let Be=(!W||W.end!==!1)&&R!==r.stdout&&R!==r.stderr?ft:ar;Ie.endEmitted?r.nextTick(Be):Ne.once("end",Be),R.on("unpipe",rt);function rt(St,Dt){S("onunpipe"),St===Ne&&Dt&&Dt.hasUnpiped===!1&&(Dt.hasUnpiped=!0,Pr())}function ft(){S("onend"),R.end()}let vt,Vr=!1;function Pr(){S("cleanup"),R.removeListener("close",_t),R.removeListener("finish",Ht),vt&&R.removeListener("drain",vt),R.removeListener("error",sr),R.removeListener("unpipe",rt),Ne.removeListener("end",ft),Ne.removeListener("end",ar),Ne.removeListener("data",Sn),Vr=!0,vt&&Ie.awaitDrainWriters&&(!R._writableState||R._writableState.needDrain)&&vt()}function Br(){Vr||(Ie.pipes.length===1&&Ie.pipes[0]===R?(S("false write response, pause",0),Ie.awaitDrainWriters=R,Ie.multiAwaitDrain=!1):Ie.pipes.length>1&&Ie.pipes.includes(R)&&(S("false write response, pause",Ie.awaitDrainWriters.size),Ie.awaitDrainWriters.add(R)),Ne.pause()),vt||(vt=xe(Ne,R),R.on("drain",vt))}Ne.on("data",Sn);function Sn(St){S("ondata");let Dt=R.write(St);S("dest.write",Dt),Dt===!1&&Br()}function sr(St){if(S("onerror",St),ar(),R.removeListener("error",sr),R.listenerCount("error")===0){let Dt=R._writableState||R._readableState;Dt&&!Dt.errorEmitted?M(R,St):R.emit("error",St)}}k(R,"error",sr);function _t(){R.removeListener("finish",Ht),ar()}R.once("close",_t);function Ht(){S("onfinish"),R.removeListener("close",_t),ar()}R.once("finish",Ht);function ar(){S("unpipe"),Ne.unpipe(R)}return R.emit("pipe",Ne),R.writableNeedDrain===!0?Br():Ie.flowing||(S("pipe resume"),Ne.resume()),R};function xe(R,W){return function(){let Ne=R._readableState;Ne.awaitDrainWriters===W?(S("pipeOnDrain",1),Ne.awaitDrainWriters=null):Ne.multiAwaitDrain&&(S("pipeOnDrain",Ne.awaitDrainWriters.size),Ne.awaitDrainWriters.delete(W)),(!Ne.awaitDrainWriters||Ne.awaitDrainWriters.size===0)&&R.listenerCount("data")&&R.resume()}}de.prototype.unpipe=function(R){let W=this._readableState,Ne={hasUnpiped:!1};if(W.pipes.length===0)return this;if(!R){let Be=W.pipes;W.pipes=[],this.pause();for(let rt=0;rt<Be.length;rt++)Be[rt].emit("unpipe",this,{hasUnpiped:!1});return this}let Ie=n(W.pipes,R);return Ie===-1?this:(W.pipes.splice(Ie,1),W.pipes.length===0&&this.pause(),R.emit("unpipe",this,Ne),this)},de.prototype.on=function(R,W){let Ne=N.prototype.on.call(this,R,W),Ie=this._readableState;return R==="data"?(Ie.readableListening=this.listenerCount("readable")>0,Ie.flowing!==!1&&this.resume()):R==="readable"&&!Ie.endEmitted&&!Ie.readableListening&&(Ie.readableListening=Ie.needReadable=!0,Ie.flowing=!1,Ie.emittedReadable=!1,S("on readable",Ie.length,Ie.reading),Ie.length?L(this):Ie.reading||r.nextTick(Pe,this)),Ne},de.prototype.addListener=de.prototype.on,de.prototype.removeListener=function(R,W){let Ne=N.prototype.removeListener.call(this,R,W);return R==="readable"&&r.nextTick(Ve,this),Ne},de.prototype.off=de.prototype.removeListener,de.prototype.removeAllListeners=function(R){let W=N.prototype.removeAllListeners.apply(this,arguments);return(R==="readable"||R===void 0)&&r.nextTick(Ve,this),W};function Ve(R){let W=R._readableState;W.readableListening=R.listenerCount("readable")>0,W.resumeScheduled&&W[te]===!1?W.flowing=!0:R.listenerCount("data")>0?R.resume():W.readableListening||(W.flowing=null)}function Pe(R){S("readable nexttick read 0"),R.read(0)}de.prototype.resume=function(){let R=this._readableState;return R.flowing||(S("resume"),R.flowing=!R.readableListening,Me(this,R)),R[te]=!1,this};function Me(R,W){W.resumeScheduled||(W.resumeScheduled=!0,r.nextTick(Xe,R,W))}function Xe(R,W){S("resume",W.reading),W.reading||R.read(0),W.resumeScheduled=!1,R.emit("resume"),et(R),W.flowing&&!W.reading&&R.read(0)}de.prototype.pause=function(){return S("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(S("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[te]=!0,this};function et(R){let W=R._readableState;for(S("flow",W.flowing);W.flowing&&R.read()!==null;);}de.prototype.wrap=function(R){let W=!1;R.on("data",Ie=>{!this.push(Ie)&&R.pause&&(W=!0,R.pause())}),R.on("end",()=>{this.push(null)}),R.on("error",Ie=>{M(this,Ie)}),R.on("close",()=>{this.destroy()}),R.on("destroy",()=>{this.destroy()}),this._read=()=>{W&&R.resume&&(W=!1,R.resume())};let Ne=l(R);for(let Ie=1;Ie<Ne.length;Ie++){let Be=Ne[Ie];this[Be]===void 0&&typeof R[Be]=="function"&&(this[Be]=R[Be].bind(R))}return this},de.prototype[m]=function(){return je(this)},de.prototype.iterator=function(R){return R!==void 0&&ne(R,"options"),je(this,R)};function je(R,W){typeof R.read!="function"&&(R=de.wrap(R,{objectMode:!0}));let Ne=Ge(R,W);return Ne.stream=R,Ne}async function*Ge(R,W){let Ne=se;function Ie(ft){this===R?(Ne(),Ne=se):Ne=ft}R.on("readable",Ie);let Be,rt=_(R,{writable:!1},ft=>{Be=ft?C(Be,ft):null,Ne(),Ne=se});try{for(;;){let ft=R.destroyed?null:R.read();if(ft!==null)yield ft;else{if(Be)throw Be;if(Be===null)return;await new u(Ie)}}}catch(ft){throw Be=C(Be,ft),Be}finally{(Be||(W==null?void 0:W.destroyOnReturn)!==!1)&&(Be===void 0||R._readableState.autoDestroy)?P.destroyer(R,null):(R.off("readable",Ie),rt())}}a(de.prototype,{readable:{__proto__:null,get(){let R=this._readableState;return!!R&&R.readable!==!1&&!R.destroyed&&!R.errorEmitted&&!R.endEmitted},set(R){this._readableState&&(this._readableState.readable=!!R)}},readableDidRead:{__proto__:null,enumerable:!1,get:function(){return this._readableState.dataEmitted}},readableAborted:{__proto__:null,enumerable:!1,get:function(){return!!(this._readableState.readable!==!1&&(this._readableState.destroyed||this._readableState.errored)&&!this._readableState.endEmitted)}},readableHighWaterMark:{__proto__:null,enumerable:!1,get:function(){return this._readableState.highWaterMark}},readableBuffer:{__proto__:null,enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}},readableFlowing:{__proto__:null,enumerable:!1,get:function(){return this._readableState.flowing},set:function(R){this._readableState&&(this._readableState.flowing=R)}},readableLength:{__proto__:null,enumerable:!1,get(){return this._readableState.length}},readableObjectMode:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.objectMode:!1}},readableEncoding:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.encoding:null}},errored:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.errored:null}},closed:{__proto__:null,get(){return this._readableState?this._readableState.closed:!1}},destroyed:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.destroyed:!1},set(R){this._readableState&&(this._readableState.destroyed=R)}},readableEnded:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.endEmitted:!1}}}),a(ke.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[te]!==!1},set(R){this[te]=!!R}}}),de._fromList=De;function De(R,W){if(W.length===0)return null;let Ne;return W.objectMode?Ne=W.buffer.shift():!R||R>=W.length?(W.decoder?Ne=W.buffer.join(""):W.buffer.length===1?Ne=W.buffer.first():Ne=W.buffer.concat(W.length),W.buffer.clear()):Ne=W.buffer.consume(R,W.decoder),Ne}function Ue(R){let W=R._readableState;S("endReadable",W.endEmitted),W.endEmitted||(W.ended=!0,r.nextTick(qe,W,R))}function qe(R,W){if(S("endReadableNT",R.endEmitted,R.length),!R.errored&&!R.closeEmitted&&!R.endEmitted&&R.length===0){if(R.endEmitted=!0,W.emit("end"),W.writable&&W.allowHalfOpen===!1)r.nextTick(Ze,W);else if(R.autoDestroy){let Ne=W._writableState;(!Ne||Ne.autoDestroy&&(Ne.finished||Ne.writable===!1))&&W.destroy()}}}function Ze(R){R.writable&&!R.writableEnded&&!R.destroyed&&R.end()}de.from=function(R,W){return $(de,R,W)};var it;function wt(){return it===void 0&&(it={}),it}de.fromWeb=function(R,W){return wt().newStreamReadableFromReadableStream(R,W)},de.toWeb=function(R,W){return wt().newReadableStreamFromStreamReadable(R,W)},de.wrap=function(R,W){var Ne,Ie;return new de({objectMode:(Ne=(Ie=R.readableObjectMode)!==null&&Ie!==void 0?Ie:R.objectMode)!==null&&Ne!==void 0?Ne:!0,...W,destroy(Be,rt){P.destroyer(R,Be),rt(Be)}}).wrap(R)}}),Ko=_e((d,t)=>{be(),ve(),we();var r=rr(),{ArrayPrototypeSlice:n,Error:i,FunctionPrototypeSymbolHasInstance:s,ObjectDefineProperty:o,ObjectDefineProperties:a,ObjectSetPrototypeOf:l,StringPrototypeToLowerCase:c,Symbol:u,SymbolHasInstance:p}=Qe();t.exports=ne,ne.WritableState=j;var{EventEmitter:h}=(tr(),We(Mt)),m=Ho().Stream,{Buffer:f}=(ot(),We(nt)),E=ur(),{addAbortSignal:N}=Ur(),{getHighWaterMark:k,getDefaultHighWaterMark:g}=Fr(),{ERR_INVALID_ARG_TYPE:v,ERR_METHOD_NOT_IMPLEMENTED:_,ERR_MULTIPLE_CALLBACK:S,ERR_STREAM_CANNOT_PIPE:B,ERR_STREAM_DESTROYED:P,ERR_STREAM_ALREADY_FINISHED:T,ERR_STREAM_NULL_VALUES:A,ERR_STREAM_WRITE_AFTER_END:C,ERR_UNKNOWN_ENCODING:O}=ut().codes,{errorOrDestroy:I}=E;l(ne.prototype,m.prototype),l(ne,m);function U(){}var Y=u("kOnFinished");function j(V,F,ae){typeof ae!="boolean"&&(ae=F instanceof It()),this.objectMode=!!(V&&V.objectMode),ae&&(this.objectMode=this.objectMode||!!(V&&V.writableObjectMode)),this.highWaterMark=V?k(this,V,"writableHighWaterMark",ae):g(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;let fe=!!(V&&V.decodeStrings===!1);this.decodeStrings=!fe,this.defaultEncoding=V&&V.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=M.bind(void 0,F),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,le(this),this.pendingcb=0,this.constructed=!0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!V||V.emitClose!==!1,this.autoDestroy=!V||V.autoDestroy!==!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[Y]=[]}function le(V){V.buffered=[],V.bufferedIndex=0,V.allBuffers=!0,V.allNoop=!0}j.prototype.getBuffer=function(){return n(this.buffered,this.bufferedIndex)},o(j.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function ne(V){let F=this instanceof It();if(!F&&!s(ne,this))return new ne(V);this._writableState=new j(V,this,F),V&&(typeof V.write=="function"&&(this._write=V.write),typeof V.writev=="function"&&(this._writev=V.writev),typeof V.destroy=="function"&&(this._destroy=V.destroy),typeof V.final=="function"&&(this._final=V.final),typeof V.construct=="function"&&(this._construct=V.construct),V.signal&&N(V.signal,this)),m.call(this,V),E.construct(this,()=>{let ae=this._writableState;ae.writing||Se(this,ae),X(this,ae)})}o(ne,p,{__proto__:null,value:function(V){return s(this,V)?!0:this!==ne?!1:V&&V._writableState instanceof j}}),ne.prototype.pipe=function(){I(this,new B)};function te(V,F,ae,fe){let pe=V._writableState;if(typeof ae=="function")fe=ae,ae=pe.defaultEncoding;else{if(!ae)ae=pe.defaultEncoding;else if(ae!=="buffer"&&!f.isEncoding(ae))throw new O(ae);typeof fe!="function"&&(fe=U)}if(F===null)throw new A;if(!pe.objectMode)if(typeof F=="string")pe.decodeStrings!==!1&&(F=f.from(F,ae),ae="buffer");else if(F instanceof f)ae="buffer";else if(m._isUint8Array(F))F=m._uint8ArrayToBuffer(F),ae="buffer";else throw new v("chunk",["string","Buffer","Uint8Array"],F);let ye;return pe.ending?ye=new C:pe.destroyed&&(ye=new P("write")),ye?(r.nextTick(fe,ye),I(V,ye,!0),ye):(pe.pendingcb++,ue(V,pe,F,ae,fe))}ne.prototype.write=function(V,F,ae){return te(this,V,F,ae)===!0},ne.prototype.cork=function(){this._writableState.corked++},ne.prototype.uncork=function(){let V=this._writableState;V.corked&&(V.corked--,V.writing||Se(this,V))},ne.prototype.setDefaultEncoding=function(V){if(typeof V=="string"&&(V=c(V)),!f.isEncoding(V))throw new O(V);return this._writableState.defaultEncoding=V,this};function ue(V,F,ae,fe,pe){let ye=F.objectMode?1:ae.length;F.length+=ye;let J=F.length<F.highWaterMark;return J||(F.needDrain=!0),F.writing||F.corked||F.errored||!F.constructed?(F.buffered.push({chunk:ae,encoding:fe,callback:pe}),F.allBuffers&&fe!=="buffer"&&(F.allBuffers=!1),F.allNoop&&pe!==U&&(F.allNoop=!1)):(F.writelen=ye,F.writecb=pe,F.writing=!0,F.sync=!0,V._write(ae,fe,F.onwrite),F.sync=!1),J&&!F.errored&&!F.destroyed}function $(V,F,ae,fe,pe,ye,J){F.writelen=fe,F.writecb=J,F.writing=!0,F.sync=!0,F.destroyed?F.onwrite(new P("write")):ae?V._writev(pe,F.onwrite):V._write(pe,ye,F.onwrite),F.sync=!1}function se(V,F,ae,fe){--F.pendingcb,fe(ae),K(F),I(V,ae)}function M(V,F){let ae=V._writableState,fe=ae.sync,pe=ae.writecb;if(typeof pe!="function"){I(V,new S);return}ae.writing=!1,ae.writecb=null,ae.length-=ae.writelen,ae.writelen=0,F?(F.stack,ae.errored||(ae.errored=F),V._readableState&&!V._readableState.errored&&(V._readableState.errored=F),fe?r.nextTick(se,V,ae,F,pe):se(V,ae,F,pe)):(ae.buffered.length>ae.bufferedIndex&&Se(V,ae),fe?ae.afterWriteTickInfo!==null&&ae.afterWriteTickInfo.cb===pe?ae.afterWriteTickInfo.count++:(ae.afterWriteTickInfo={count:1,cb:pe,stream:V,state:ae},r.nextTick(Q,ae.afterWriteTickInfo)):me(V,ae,1,pe))}function Q({stream:V,state:F,count:ae,cb:fe}){return F.afterWriteTickInfo=null,me(V,F,ae,fe)}function me(V,F,ae,fe){for(!F.ending&&!V.destroyed&&F.length===0&&F.needDrain&&(F.needDrain=!1,V.emit("drain"));ae-- >0;)F.pendingcb--,fe();F.destroyed&&K(F),X(V,F)}function K(V){if(V.writing)return;for(let pe=V.bufferedIndex;pe<V.buffered.length;++pe){var F;let{chunk:ye,callback:J}=V.buffered[pe],ge=V.objectMode?1:ye.length;V.length-=ge,J((F=V.errored)!==null&&F!==void 0?F:new P("write"))}let ae=V[Y].splice(0);for(let pe=0;pe<ae.length;pe++){var fe;ae[pe]((fe=V.errored)!==null&&fe!==void 0?fe:new P("end"))}le(V)}function Se(V,F){if(F.corked||F.bufferProcessing||F.destroyed||!F.constructed)return;let{buffered:ae,bufferedIndex:fe,objectMode:pe}=F,ye=ae.length-fe;if(!ye)return;let J=fe;if(F.bufferProcessing=!0,ye>1&&V._writev){F.pendingcb-=ye-1;let ge=F.allNoop?U:de=>{for(let Ce=J;Ce<ae.length;++Ce)ae[Ce].callback(de)},ke=F.allNoop&&J===0?ae:n(ae,J);ke.allBuffers=F.allBuffers,$(V,F,!0,F.length,ke,"",ge),le(F)}else{do{let{chunk:ge,encoding:ke,callback:de}=ae[J];ae[J++]=null;let Ce=pe?1:ge.length;$(V,F,!1,Ce,ge,ke,de)}while(J<ae.length&&!F.writing);J===ae.length?le(F):J>256?(ae.splice(0,J),F.bufferedIndex=0):F.bufferedIndex=J}F.bufferProcessing=!1}ne.prototype._write=function(V,F,ae){if(this._writev)this._writev([{chunk:V,encoding:F}],ae);else throw new _("_write()")},ne.prototype._writev=null,ne.prototype.end=function(V,F,ae){let fe=this._writableState;typeof V=="function"?(ae=V,V=null,F=null):typeof F=="function"&&(ae=F,F=null);let pe;if(V!=null){let ye=te(this,V,F);ye instanceof i&&(pe=ye)}return fe.corked&&(fe.corked=1,this.uncork()),pe||(!fe.errored&&!fe.ending?(fe.ending=!0,X(this,fe,!0),fe.ended=!0):fe.finished?pe=new T("end"):fe.destroyed&&(pe=new P("end"))),typeof ae=="function"&&(pe||fe.finished?r.nextTick(ae,pe):fe[Y].push(ae)),this};function Z(V){return V.ending&&!V.destroyed&&V.constructed&&V.length===0&&!V.errored&&V.buffered.length===0&&!V.finished&&!V.writing&&!V.errorEmitted&&!V.closeEmitted}function G(V,F){let ae=!1;function fe(pe){if(ae){I(V,pe??S());return}if(ae=!0,F.pendingcb--,pe){let ye=F[Y].splice(0);for(let J=0;J<ye.length;J++)ye[J](pe);I(V,pe,F.sync)}else Z(F)&&(F.prefinished=!0,V.emit("prefinish"),F.pendingcb++,r.nextTick(oe,V,F))}F.sync=!0,F.pendingcb++;try{V._final(fe)}catch(pe){fe(pe)}F.sync=!1}function ce(V,F){!F.prefinished&&!F.finalCalled&&(typeof V._final=="function"&&!F.destroyed?(F.finalCalled=!0,G(V,F)):(F.prefinished=!0,V.emit("prefinish")))}function X(V,F,ae){Z(F)&&(ce(V,F),F.pendingcb===0&&(ae?(F.pendingcb++,r.nextTick((fe,pe)=>{Z(pe)?oe(fe,pe):pe.pendingcb--},V,F)):Z(F)&&(F.pendingcb++,oe(V,F))))}function oe(V,F){F.pendingcb--,F.finished=!0;let ae=F[Y].splice(0);for(let fe=0;fe<ae.length;fe++)ae[fe]();if(V.emit("finish"),F.autoDestroy){let fe=V._readableState;(!fe||fe.autoDestroy&&(fe.endEmitted||fe.readable===!1))&&V.destroy()}}a(ne.prototype,{closed:{__proto__:null,get(){return this._writableState?this._writableState.closed:!1}},destroyed:{__proto__:null,get(){return this._writableState?this._writableState.destroyed:!1},set(V){this._writableState&&(this._writableState.destroyed=V)}},writable:{__proto__:null,get(){let V=this._writableState;return!!V&&V.writable!==!1&&!V.destroyed&&!V.errored&&!V.ending&&!V.ended},set(V){this._writableState&&(this._writableState.writable=!!V)}},writableFinished:{__proto__:null,get(){return this._writableState?this._writableState.finished:!1}},writableObjectMode:{__proto__:null,get(){return this._writableState?this._writableState.objectMode:!1}},writableBuffer:{__proto__:null,get(){return this._writableState&&this._writableState.getBuffer()}},writableEnded:{__proto__:null,get(){return this._writableState?this._writableState.ending:!1}},writableNeedDrain:{__proto__:null,get(){let V=this._writableState;return V?!V.destroyed&&!V.ending&&V.needDrain:!1}},writableHighWaterMark:{__proto__:null,get(){return this._writableState&&this._writableState.highWaterMark}},writableCorked:{__proto__:null,get(){return this._writableState?this._writableState.corked:0}},writableLength:{__proto__:null,get(){return this._writableState&&this._writableState.length}},errored:{__proto__:null,enumerable:!1,get(){return this._writableState?this._writableState.errored:null}},writableAborted:{__proto__:null,enumerable:!1,get:function(){return!!(this._writableState.writable!==!1&&(this._writableState.destroyed||this._writableState.errored)&&!this._writableState.finished)}}});var ie=E.destroy;ne.prototype.destroy=function(V,F){let ae=this._writableState;return!ae.destroyed&&(ae.bufferedIndex<ae.buffered.length||ae[Y].length)&&r.nextTick(K,ae),ie.call(this,V,F),this},ne.prototype._undestroy=E.undestroy,ne.prototype._destroy=function(V,F){F(V)},ne.prototype[h.captureRejectionSymbol]=function(V){this.destroy(V)};var Ee;function z(){return Ee===void 0&&(Ee={}),Ee}ne.fromWeb=function(V,F){return z().newStreamWritableFromWritableStream(V,F)},ne.toWeb=function(V){return z().newWritableStreamFromStreamWritable(V)}}),Sf=_e((d,t)=>{be(),ve(),we();var r=rr(),n=(ot(),We(nt)),{isReadable:i,isWritable:s,isIterable:o,isNodeStream:a,isReadableNodeStream:l,isWritableNodeStream:c,isDuplexNodeStream:u,isReadableStream:p,isWritableStream:h}=At(),m=$t(),{AbortError:f,codes:{ERR_INVALID_ARG_TYPE:E,ERR_INVALID_RETURN_VALUE:N}}=ut(),{destroyer:k}=ur(),g=It(),v=zr(),_=Ko(),{createDeferredPromise:S}=ht(),B=Us(),P=globalThis.Blob||n.Blob,T=typeof P<"u"?function(Y){return Y instanceof P}:function(Y){return!1},A=globalThis.AbortController||Sr().AbortController,{FunctionPrototypeCall:C}=Qe(),O=class extends g{constructor(Y){super(Y),(Y==null?void 0:Y.readable)===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),(Y==null?void 0:Y.writable)===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)}};t.exports=function Y(j,le){if(u(j))return j;if(l(j))return U({readable:j});if(c(j))return U({writable:j});if(a(j))return U({writable:!1,readable:!1});if(p(j))return U({readable:v.fromWeb(j)});if(h(j))return U({writable:_.fromWeb(j)});if(typeof j=="function"){let{value:te,write:ue,final:$,destroy:se}=I(j);if(o(te))return B(O,te,{objectMode:!0,write:ue,final:$,destroy:se});let M=te==null?void 0:te.then;if(typeof M=="function"){let Q,me=C(M,te,K=>{if(K!=null)throw new N("nully","body",K)},K=>{k(Q,K)});return Q=new O({objectMode:!0,readable:!1,write:ue,final(K){$(async()=>{try{await me,r.nextTick(K,null)}catch(Se){r.nextTick(K,Se)}})},destroy:se})}throw new N("Iterable, AsyncIterable or AsyncFunction",le,te)}if(T(j))return Y(j.arrayBuffer());if(o(j))return B(O,j,{objectMode:!0,writable:!1});if(p(j==null?void 0:j.readable)&&h(j==null?void 0:j.writable))return O.fromWeb(j);if(typeof(j==null?void 0:j.writable)=="object"||typeof(j==null?void 0:j.readable)=="object"){let te=j!=null&&j.readable?l(j==null?void 0:j.readable)?j==null?void 0:j.readable:Y(j.readable):void 0,ue=j!=null&&j.writable?c(j==null?void 0:j.writable)?j==null?void 0:j.writable:Y(j.writable):void 0;return U({readable:te,writable:ue})}let ne=j==null?void 0:j.then;if(typeof ne=="function"){let te;return C(ne,j,ue=>{ue!=null&&te.push(ue),te.push(null)},ue=>{k(te,ue)}),te=new O({objectMode:!0,writable:!1,read(){}})}throw new E(le,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],j)};function I(Y){let{promise:j,resolve:le}=S(),ne=new A,te=ne.signal;return{value:Y(async function*(){for(;;){let ue=j;j=null;let{chunk:$,done:se,cb:M}=await ue;if(r.nextTick(M),se)return;if(te.aborted)throw new f(void 0,{cause:te.reason});({promise:j,resolve:le}=S()),yield $}}(),{signal:te}),write(ue,$,se){let M=le;le=null,M({chunk:ue,done:!1,cb:se})},final(ue){let $=le;le=null,$({done:!0,cb:ue})},destroy(ue,$){ne.abort(),$(ue)}}}function U(Y){let j=Y.readable&&typeof Y.readable.read!="function"?v.wrap(Y.readable):Y.readable,le=Y.writable,ne=!!i(j),te=!!s(le),ue,$,se,M,Q;function me(K){let Se=M;M=null,Se?Se(K):K&&Q.destroy(K)}return Q=new O({readableObjectMode:!!(j!=null&&j.readableObjectMode),writableObjectMode:!!(le!=null&&le.writableObjectMode),readable:ne,writable:te}),te&&(m(le,K=>{te=!1,K&&k(j,K),me(K)}),Q._write=function(K,Se,Z){le.write(K,Se)?Z():ue=Z},Q._final=function(K){le.end(),$=K},le.on("drain",function(){if(ue){let K=ue;ue=null,K()}}),le.on("finish",function(){if($){let K=$;$=null,K()}})),ne&&(m(j,K=>{ne=!1,K&&k(j,K),me(K)}),j.on("readable",function(){if(se){let K=se;se=null,K()}}),j.on("end",function(){Q.push(null)}),Q._read=function(){for(;;){let K=j.read();if(K===null){se=Q._read;return}if(!Q.push(K))return}}),Q._destroy=function(K,Se){!K&&M!==null&&(K=new f),se=null,ue=null,$=null,M===null?Se(K):(M=Se,k(le,K),k(j,K))},Q}}),It=_e((d,t)=>{be(),ve(),we();var{ObjectDefineProperties:r,ObjectGetOwnPropertyDescriptor:n,ObjectKeys:i,ObjectSetPrototypeOf:s}=Qe();t.exports=l;var o=zr(),a=Ko();s(l.prototype,o.prototype),s(l,o);{let h=i(a.prototype);for(let m=0;m<h.length;m++){let f=h[m];l.prototype[f]||(l.prototype[f]=a.prototype[f])}}function l(h){if(!(this instanceof l))return new l(h);o.call(this,h),a.call(this,h),h?(this.allowHalfOpen=h.allowHalfOpen!==!1,h.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),h.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)):this.allowHalfOpen=!0}r(l.prototype,{writable:{__proto__:null,...n(a.prototype,"writable")},writableHighWaterMark:{__proto__:null,...n(a.prototype,"writableHighWaterMark")},writableObjectMode:{__proto__:null,...n(a.prototype,"writableObjectMode")},writableBuffer:{__proto__:null,...n(a.prototype,"writableBuffer")},writableLength:{__proto__:null,...n(a.prototype,"writableLength")},writableFinished:{__proto__:null,...n(a.prototype,"writableFinished")},writableCorked:{__proto__:null,...n(a.prototype,"writableCorked")},writableEnded:{__proto__:null,...n(a.prototype,"writableEnded")},writableNeedDrain:{__proto__:null,...n(a.prototype,"writableNeedDrain")},destroyed:{__proto__:null,get(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set(h){this._readableState&&this._writableState&&(this._readableState.destroyed=h,this._writableState.destroyed=h)}}});var c;function u(){return c===void 0&&(c={}),c}l.fromWeb=function(h,m){return u().newStreamDuplexFromReadableWritablePair(h,m)},l.toWeb=function(h){return u().newReadableWritablePairFromDuplex(h)};var p;l.from=function(h){return p||(p=Sf()),p(h,"body")}}),Fs=_e((d,t)=>{be(),ve(),we();var{ObjectSetPrototypeOf:r,Symbol:n}=Qe();t.exports=l;var{ERR_METHOD_NOT_IMPLEMENTED:i}=ut().codes,s=It(),{getHighWaterMark:o}=Fr();r(l.prototype,s.prototype),r(l,s);var a=n("kCallback");function l(p){if(!(this instanceof l))return new l(p);let h=p?o(this,p,"readableHighWaterMark",!0):null;h===0&&(p={...p,highWaterMark:null,readableHighWaterMark:h,writableHighWaterMark:p.writableHighWaterMark||0}),s.call(this,p),this._readableState.sync=!1,this[a]=null,p&&(typeof p.transform=="function"&&(this._transform=p.transform),typeof p.flush=="function"&&(this._flush=p.flush)),this.on("prefinish",u)}function c(p){typeof this._flush=="function"&&!this.destroyed?this._flush((h,m)=>{if(h){p?p(h):this.destroy(h);return}m!=null&&this.push(m),this.push(null),p&&p()}):(this.push(null),p&&p())}function u(){this._final!==c&&c.call(this)}l.prototype._final=c,l.prototype._transform=function(p,h,m){throw new i("_transform()")},l.prototype._write=function(p,h,m){let f=this._readableState,E=this._writableState,N=f.length;this._transform(p,h,(k,g)=>{if(k){m(k);return}g!=null&&this.push(g),E.ended||N===f.length||f.length<f.highWaterMark?m():this[a]=m})},l.prototype._read=function(){if(this[a]){let p=this[a];this[a]=null,p()}}}),zs=_e((d,t)=>{be(),ve(),we();var{ObjectSetPrototypeOf:r}=Qe();t.exports=i;var n=Fs();r(i.prototype,n.prototype),r(i,n);function i(s){if(!(this instanceof i))return new i(s);n.call(this,s)}i.prototype._transform=function(s,o,a){a(null,s)}}),Yo=_e((d,t)=>{be(),ve(),we();var r=rr(),{ArrayIsArray:n,Promise:i,SymbolAsyncIterator:s,SymbolDispose:o}=Qe(),a=$t(),{once:l}=ht(),c=ur(),u=It(),{aggregateTwoErrors:p,codes:{ERR_INVALID_ARG_TYPE:h,ERR_INVALID_RETURN_VALUE:m,ERR_MISSING_ARGS:f,ERR_STREAM_DESTROYED:E,ERR_STREAM_PREMATURE_CLOSE:N},AbortError:k}=ut(),{validateFunction:g,validateAbortSignal:v}=Cr(),{isIterable:_,isReadable:S,isReadableNodeStream:B,isNodeStream:P,isTransformStream:T,isWebStream:A,isReadableStream:C,isReadableFinished:O}=At(),I=globalThis.AbortController||Sr().AbortController,U,Y,j;function le(K,Se,Z){let G=!1;K.on("close",()=>{G=!0});let ce=a(K,{readable:Se,writable:Z},X=>{G=!X});return{destroy:X=>{G||(G=!0,c.destroyer(K,X||new E("pipe")))},cleanup:ce}}function ne(K){return g(K[K.length-1],"streams[stream.length - 1]"),K.pop()}function te(K){if(_(K))return K;if(B(K))return ue(K);throw new h("val",["Readable","Iterable","AsyncIterable"],K)}async function*ue(K){Y||(Y=zr()),yield*Y.prototype[s].call(K)}async function $(K,Se,Z,{end:G}){let ce,X=null,oe=z=>{if(z&&(ce=z),X){let V=X;X=null,V()}},ie=()=>new i((z,V)=>{ce?V(ce):X=()=>{ce?V(ce):z()}});Se.on("drain",oe);let Ee=a(Se,{readable:!1},oe);try{Se.writableNeedDrain&&await ie();for await(let z of K)Se.write(z)||await ie();G&&(Se.end(),await ie()),Z()}catch(z){Z(ce!==z?p(ce,z):z)}finally{Ee(),Se.off("drain",oe)}}async function se(K,Se,Z,{end:G}){T(Se)&&(Se=Se.writable);let ce=Se.getWriter();try{for await(let X of K)await ce.ready,ce.write(X).catch(()=>{});await ce.ready,G&&await ce.close(),Z()}catch(X){try{await ce.abort(X),Z(X)}catch(oe){Z(oe)}}}function M(...K){return Q(K,l(ne(K)))}function Q(K,Se,Z){if(K.length===1&&n(K[0])&&(K=K[0]),K.length<2)throw new f("streams");let G=new I,ce=G.signal,X=Z==null?void 0:Z.signal,oe=[];v(X,"options.signal");function ie(){pe(new k)}j=j||ht().addAbortListener;let Ee;X&&(Ee=j(X,ie));let z,V,F=[],ae=0;function fe(ke){pe(ke,--ae===0)}function pe(ke,de){var Ce;if(ke&&(!z||z.code==="ERR_STREAM_PREMATURE_CLOSE")&&(z=ke),!(!z&&!de)){for(;F.length;)F.shift()(z);(Ce=Ee)===null||Ce===void 0||Ce[o](),G.abort(),de&&(z||oe.forEach(y=>y()),r.nextTick(Se,z,V))}}let ye;for(let ke=0;ke<K.length;ke++){let de=K[ke],Ce=ke<K.length-1,y=ke>0,b=Ce||(Z==null?void 0:Z.end)!==!1,w=ke===K.length-1;if(P(de)){let x=function(D){D&&D.name!=="AbortError"&&D.code!=="ERR_STREAM_PREMATURE_CLOSE"&&fe(D)};if(b){let{destroy:D,cleanup:L}=le(de,Ce,y);F.push(D),S(de)&&w&&oe.push(L)}de.on("error",x),S(de)&&w&&oe.push(()=>{de.removeListener("error",x)})}if(ke===0)if(typeof de=="function"){if(ye=de({signal:ce}),!_(ye))throw new m("Iterable, AsyncIterable or Stream","source",ye)}else _(de)||B(de)||T(de)?ye=de:ye=u.from(de);else if(typeof de=="function"){if(T(ye)){var J;ye=te((J=ye)===null||J===void 0?void 0:J.readable)}else ye=te(ye);if(ye=de(ye,{signal:ce}),Ce){if(!_(ye,!0))throw new m("AsyncIterable",`transform[${ke-1}]`,ye)}else{var ge;U||(U=zs());let x=new U({objectMode:!0}),D=(ge=ye)===null||ge===void 0?void 0:ge.then;if(typeof D=="function")ae++,D.call(ye,H=>{V=H,H!=null&&x.write(H),b&&x.end(),r.nextTick(fe)},H=>{x.destroy(H),r.nextTick(fe,H)});else if(_(ye,!0))ae++,$(ye,x,fe,{end:b});else if(C(ye)||T(ye)){let H=ye.readable||ye;ae++,$(H,x,fe,{end:b})}else throw new m("AsyncIterable or Promise","destination",ye);ye=x;let{destroy:L,cleanup:re}=le(ye,!1,!0);F.push(L),w&&oe.push(re)}}else if(P(de)){if(B(ye)){ae+=2;let x=me(ye,de,fe,{end:b});S(de)&&w&&oe.push(x)}else if(T(ye)||C(ye)){let x=ye.readable||ye;ae++,$(x,de,fe,{end:b})}else if(_(ye))ae++,$(ye,de,fe,{end:b});else throw new h("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],ye);ye=de}else if(A(de)){if(B(ye))ae++,se(te(ye),de,fe,{end:b});else if(C(ye)||_(ye))ae++,se(ye,de,fe,{end:b});else if(T(ye))ae++,se(ye.readable,de,fe,{end:b});else throw new h("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],ye);ye=de}else ye=u.from(de)}return(ce!=null&&ce.aborted||X!=null&&X.aborted)&&r.nextTick(ie),ye}function me(K,Se,Z,{end:G}){let ce=!1;if(Se.on("close",()=>{ce||Z(new N)}),K.pipe(Se,{end:!1}),G){let X=function(){ce=!0,Se.end()};O(K)?r.nextTick(X):K.once("end",X)}else Z();return a(K,{readable:!0,writable:!1},X=>{let oe=K._readableState;X&&X.code==="ERR_STREAM_PREMATURE_CLOSE"&&oe&&oe.ended&&!oe.errored&&!oe.errorEmitted?K.once("end",Z).once("error",Z):Z(X)}),a(Se,{readable:!1,writable:!0},Z)}t.exports={pipelineImpl:Q,pipeline:M}}),Ws=_e((d,t)=>{be(),ve(),we();var{pipeline:r}=Yo(),n=It(),{destroyer:i}=ur(),{isNodeStream:s,isReadable:o,isWritable:a,isWebStream:l,isTransformStream:c,isWritableStream:u,isReadableStream:p}=At(),{AbortError:h,codes:{ERR_INVALID_ARG_VALUE:m,ERR_MISSING_ARGS:f}}=ut(),E=$t();t.exports=function(...N){if(N.length===0)throw new f("streams");if(N.length===1)return n.from(N[0]);let k=[...N];if(typeof N[0]=="function"&&(N[0]=n.from(N[0])),typeof N[N.length-1]=="function"){let I=N.length-1;N[I]=n.from(N[I])}for(let I=0;I<N.length;++I)if(!(!s(N[I])&&!l(N[I]))){if(I<N.length-1&&!(o(N[I])||p(N[I])||c(N[I])))throw new m(`streams[${I}]`,k[I],"must be readable");if(I>0&&!(a(N[I])||u(N[I])||c(N[I])))throw new m(`streams[${I}]`,k[I],"must be writable")}let g,v,_,S,B;function P(I){let U=S;S=null,U?U(I):I?B.destroy(I):!O&&!C&&B.destroy()}let T=N[0],A=r(N,P),C=!!(a(T)||u(T)||c(T)),O=!!(o(A)||p(A)||c(A));if(B=new n({writableObjectMode:!!(T!=null&&T.writableObjectMode),readableObjectMode:!!(A!=null&&A.readableObjectMode),writable:C,readable:O}),C){if(s(T))B._write=function(U,Y,j){T.write(U,Y)?j():g=j},B._final=function(U){T.end(),v=U},T.on("drain",function(){if(g){let U=g;g=null,U()}});else if(l(T)){let U=(c(T)?T.writable:T).getWriter();B._write=async function(Y,j,le){try{await U.ready,U.write(Y).catch(()=>{}),le()}catch(ne){le(ne)}},B._final=async function(Y){try{await U.ready,U.close().catch(()=>{}),v=Y}catch(j){Y(j)}}}let I=c(A)?A.readable:A;E(I,()=>{if(v){let U=v;v=null,U()}})}if(O){if(s(A))A.on("readable",function(){if(_){let I=_;_=null,I()}}),A.on("end",function(){B.push(null)}),B._read=function(){for(;;){let I=A.read();if(I===null){_=B._read;return}if(!B.push(I))return}};else if(l(A)){let I=(c(A)?A.readable:A).getReader();B._read=async function(){for(;;)try{let{value:U,done:Y}=await I.read();if(!B.push(U))return;if(Y){B.push(null);return}}catch{return}}}}return B._destroy=function(I,U){!I&&S!==null&&(I=new h),_=null,g=null,v=null,S===null?U(I):(S=U,s(A)&&i(A,I))},B}}),Nf=_e((d,t)=>{be(),ve(),we();var r=globalThis.AbortController||Sr().AbortController,{codes:{ERR_INVALID_ARG_VALUE:n,ERR_INVALID_ARG_TYPE:i,ERR_MISSING_ARGS:s,ERR_OUT_OF_RANGE:o},AbortError:a}=ut(),{validateAbortSignal:l,validateInteger:c,validateObject:u}=Cr(),p=Qe().Symbol("kWeak"),h=Qe().Symbol("kResistStopPropagation"),{finished:m}=$t(),f=Ws(),{addAbortSignalNoValidate:E}=Ur(),{isWritable:N,isNodeStream:k}=At(),{deprecate:g}=ht(),{ArrayPrototypePush:v,Boolean:_,MathFloor:S,Number:B,NumberIsNaN:P,Promise:T,PromiseReject:A,PromiseResolve:C,PromisePrototypeThen:O,Symbol:I}=Qe(),U=I("kEmpty"),Y=I("kEof");function j(X,oe){if(oe!=null&&u(oe,"options"),(oe==null?void 0:oe.signal)!=null&&l(oe.signal,"options.signal"),k(X)&&!N(X))throw new n("stream",X,"must be writable");let ie=f(this,X);return oe!=null&&oe.signal&&E(oe.signal,ie),ie}function le(X,oe){if(typeof X!="function")throw new i("fn",["Function","AsyncFunction"],X);oe!=null&&u(oe,"options"),(oe==null?void 0:oe.signal)!=null&&l(oe.signal,"options.signal");let ie=1;(oe==null?void 0:oe.concurrency)!=null&&(ie=S(oe.concurrency));let Ee=ie-1;return(oe==null?void 0:oe.highWaterMark)!=null&&(Ee=S(oe.highWaterMark)),c(ie,"options.concurrency",1),c(Ee,"options.highWaterMark",0),Ee+=ie,(async function*(){let z=ht().AbortSignalAny([oe==null?void 0:oe.signal].filter(_)),V=this,F=[],ae={signal:z},fe,pe,ye=!1,J=0;function ge(){ye=!0,ke()}function ke(){J-=1,de()}function de(){pe&&!ye&&J<ie&&F.length<Ee&&(pe(),pe=null)}async function Ce(){try{for await(let y of V){if(ye)return;if(z.aborted)throw new a;try{if(y=X(y,ae),y===U)continue;y=C(y)}catch(b){y=A(b)}J+=1,O(y,ke,ge),F.push(y),fe&&(fe(),fe=null),!ye&&(F.length>=Ee||J>=ie)&&await new T(b=>{pe=b})}F.push(Y)}catch(y){let b=A(y);O(b,ke,ge),F.push(b)}finally{ye=!0,fe&&(fe(),fe=null)}}Ce();try{for(;;){for(;F.length>0;){let y=await F[0];if(y===Y)return;if(z.aborted)throw new a;y!==U&&(yield y),F.shift(),de()}await new T(y=>{fe=y})}}finally{ye=!0,pe&&(pe(),pe=null)}}).call(this)}function ne(X=void 0){return X!=null&&u(X,"options"),(X==null?void 0:X.signal)!=null&&l(X.signal,"options.signal"),(async function*(){let oe=0;for await(let Ee of this){var ie;if(X!=null&&(ie=X.signal)!==null&&ie!==void 0&&ie.aborted)throw new a({cause:X.signal.reason});yield[oe++,Ee]}}).call(this)}async function te(X,oe=void 0){for await(let ie of M.call(this,X,oe))return!0;return!1}async function ue(X,oe=void 0){if(typeof X!="function")throw new i("fn",["Function","AsyncFunction"],X);return!await te.call(this,async(...ie)=>!await X(...ie),oe)}async function $(X,oe){for await(let ie of M.call(this,X,oe))return ie}async function se(X,oe){if(typeof X!="function")throw new i("fn",["Function","AsyncFunction"],X);async function ie(Ee,z){return await X(Ee,z),U}for await(let Ee of le.call(this,ie,oe));}function M(X,oe){if(typeof X!="function")throw new i("fn",["Function","AsyncFunction"],X);async function ie(Ee,z){return await X(Ee,z)?Ee:U}return le.call(this,ie,oe)}var Q=class extends s{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}};async function me(X,oe,ie){var Ee;if(typeof X!="function")throw new i("reducer",["Function","AsyncFunction"],X);ie!=null&&u(ie,"options"),(ie==null?void 0:ie.signal)!=null&&l(ie.signal,"options.signal");let z=arguments.length>1;if(ie!=null&&(Ee=ie.signal)!==null&&Ee!==void 0&&Ee.aborted){let pe=new a(void 0,{cause:ie.signal.reason});throw this.once("error",()=>{}),await m(this.destroy(pe)),pe}let V=new r,F=V.signal;if(ie!=null&&ie.signal){let pe={once:!0,[p]:this,[h]:!0};ie.signal.addEventListener("abort",()=>V.abort(),pe)}let ae=!1;try{for await(let pe of this){var fe;if(ae=!0,ie!=null&&(fe=ie.signal)!==null&&fe!==void 0&&fe.aborted)throw new a;z?oe=await X(oe,pe,{signal:F}):(oe=pe,z=!0)}if(!ae&&!z)throw new Q}finally{V.abort()}return oe}async function K(X){X!=null&&u(X,"options"),(X==null?void 0:X.signal)!=null&&l(X.signal,"options.signal");let oe=[];for await(let Ee of this){var ie;if(X!=null&&(ie=X.signal)!==null&&ie!==void 0&&ie.aborted)throw new a(void 0,{cause:X.signal.reason});v(oe,Ee)}return oe}function Se(X,oe){let ie=le.call(this,X,oe);return(async function*(){for await(let Ee of ie)yield*Ee}).call(this)}function Z(X){if(X=B(X),P(X))return 0;if(X<0)throw new o("number",">= 0",X);return X}function G(X,oe=void 0){return oe!=null&&u(oe,"options"),(oe==null?void 0:oe.signal)!=null&&l(oe.signal,"options.signal"),X=Z(X),(async function*(){var ie;if(oe!=null&&(ie=oe.signal)!==null&&ie!==void 0&&ie.aborted)throw new a;for await(let z of this){var Ee;if(oe!=null&&(Ee=oe.signal)!==null&&Ee!==void 0&&Ee.aborted)throw new a;X--<=0&&(yield z)}}).call(this)}function ce(X,oe=void 0){return oe!=null&&u(oe,"options"),(oe==null?void 0:oe.signal)!=null&&l(oe.signal,"options.signal"),X=Z(X),(async function*(){var ie;if(oe!=null&&(ie=oe.signal)!==null&&ie!==void 0&&ie.aborted)throw new a;for await(let z of this){var Ee;if(oe!=null&&(Ee=oe.signal)!==null&&Ee!==void 0&&Ee.aborted)throw new a;if(X-- >0&&(yield z),X<=0)return}}).call(this)}t.exports.streamReturningOperators={asIndexedPairs:g(ne,"readable.asIndexedPairs will be removed in a future version."),drop:G,filter:M,flatMap:Se,map:le,take:ce,compose:j},t.exports.promiseReturningOperators={every:ue,forEach:se,reduce:me,toArray:K,some:te,find:$}}),qs=_e((d,t)=>{be(),ve(),we();var{ArrayPrototypePop:r,Promise:n}=Qe(),{isIterable:i,isNodeStream:s,isWebStream:o}=At(),{pipelineImpl:a}=Yo(),{finished:l}=$t();Gs();function c(...u){return new n((p,h)=>{let m,f,E=u[u.length-1];if(E&&typeof E=="object"&&!s(E)&&!i(E)&&!o(E)){let N=r(u);m=N.signal,f=N.end}a(u,(N,k)=>{N?h(N):p(k)},{signal:m,end:f})})}t.exports={finished:l,pipeline:c}}),Gs=_e((d,t)=>{be(),ve(),we();var{Buffer:r}=(ot(),We(nt)),{ObjectDefineProperty:n,ObjectKeys:i,ReflectApply:s}=Qe(),{promisify:{custom:o}}=ht(),{streamReturningOperators:a,promiseReturningOperators:l}=Nf(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:c}}=ut(),u=Ws(),{setDefaultHighWaterMark:p,getDefaultHighWaterMark:h}=Fr(),{pipeline:m}=Yo(),{destroyer:f}=ur(),E=$t(),N=qs(),k=At(),g=t.exports=Ho().Stream;g.isDestroyed=k.isDestroyed,g.isDisturbed=k.isDisturbed,g.isErrored=k.isErrored,g.isReadable=k.isReadable,g.isWritable=k.isWritable,g.Readable=zr();for(let _ of i(a)){let S=function(...P){if(new.target)throw c();return g.Readable.from(s(B,this,P))},B=a[_];n(S,"name",{__proto__:null,value:B.name}),n(S,"length",{__proto__:null,value:B.length}),n(g.Readable.prototype,_,{__proto__:null,value:S,enumerable:!1,configurable:!0,writable:!0})}for(let _ of i(l)){let S=function(...P){if(new.target)throw c();return s(B,this,P)},B=l[_];n(S,"name",{__proto__:null,value:B.name}),n(S,"length",{__proto__:null,value:B.length}),n(g.Readable.prototype,_,{__proto__:null,value:S,enumerable:!1,configurable:!0,writable:!0})}g.Writable=Ko(),g.Duplex=It(),g.Transform=Fs(),g.PassThrough=zs(),g.pipeline=m;var{addAbortSignal:v}=Ur();g.addAbortSignal=v,g.finished=E,g.destroy=f,g.compose=u,g.setDefaultHighWaterMark=p,g.getDefaultHighWaterMark=h,n(g,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return N}}),n(m,o,{__proto__:null,enumerable:!0,get(){return N.pipeline}}),n(E,o,{__proto__:null,enumerable:!0,get(){return N.finished}}),g.Stream=g,g._isUint8Array=function(_){return _ instanceof Uint8Array},g._uint8ArrayToBuffer=function(_){return r.from(_.buffer,_.byteOffset,_.byteLength)}}),nr=_e((d,t)=>{be(),ve(),we();var r=Gs(),n=qs(),i=r.Readable.destroy;t.exports=r.Readable,t.exports._uint8ArrayToBuffer=r._uint8ArrayToBuffer,t.exports._isUint8Array=r._isUint8Array,t.exports.isDisturbed=r.isDisturbed,t.exports.isErrored=r.isErrored,t.exports.isReadable=r.isReadable,t.exports.Readable=r.Readable,t.exports.Writable=r.Writable,t.exports.Duplex=r.Duplex,t.exports.Transform=r.Transform,t.exports.PassThrough=r.PassThrough,t.exports.addAbortSignal=r.addAbortSignal,t.exports.finished=r.finished,t.exports.destroy=r.destroy,t.exports.destroy=i,t.exports.pipeline=r.pipeline,t.exports.compose=r.compose,Object.defineProperty(r,"promises",{configurable:!0,enumerable:!0,get(){return n}}),t.exports.Stream=r.Stream,t.exports.default=t.exports}),Cf=_e((d,t)=>{be(),ve(),we(),typeof Object.create=="function"?t.exports=function(r,n){n&&(r.super_=n,r.prototype=Object.create(n.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(r,n){if(n){r.super_=n;var i=function(){};i.prototype=n.prototype,r.prototype=new i,r.prototype.constructor=r}}}),xf=_e((d,t)=>{be(),ve(),we();var{Buffer:r}=(ot(),We(nt)),n=Symbol.for("BufferList");function i(s){if(!(this instanceof i))return new i(s);i._init.call(this,s)}i._init=function(s){Object.defineProperty(this,n,{value:!0}),this._bufs=[],this.length=0,s&&this.append(s)},i.prototype._new=function(s){return new i(s)},i.prototype._offset=function(s){if(s===0)return[0,0];let o=0;for(let a=0;a<this._bufs.length;a++){let l=o+this._bufs[a].length;if(s<l||a===this._bufs.length-1)return[a,s-o];o=l}},i.prototype._reverseOffset=function(s){let o=s[0],a=s[1];for(let l=0;l<o;l++)a+=this._bufs[l].length;return a},i.prototype.getBuffers=function(){return this._bufs},i.prototype.get=function(s){if(s>this.length||s<0)return;let o=this._offset(s);return this._bufs[o[0]][o[1]]},i.prototype.slice=function(s,o){return typeof s=="number"&&s<0&&(s+=this.length),typeof o=="number"&&o<0&&(o+=this.length),this.copy(null,0,s,o)},i.prototype.copy=function(s,o,a,l){if((typeof a!="number"||a<0)&&(a=0),(typeof l!="number"||l>this.length)&&(l=this.length),a>=this.length||l<=0)return s||r.alloc(0);let c=!!s,u=this._offset(a),p=l-a,h=p,m=c&&o||0,f=u[1];if(a===0&&l===this.length){if(!c)return this._bufs.length===1?this._bufs[0]:r.concat(this._bufs,this.length);for(let E=0;E<this._bufs.length;E++)this._bufs[E].copy(s,m),m+=this._bufs[E].length;return s}if(h<=this._bufs[u[0]].length-f)return c?this._bufs[u[0]].copy(s,o,f,f+h):this._bufs[u[0]].slice(f,f+h);c||(s=r.allocUnsafe(p));for(let E=u[0];E<this._bufs.length;E++){let N=this._bufs[E].length-f;if(h>N)this._bufs[E].copy(s,m,f),m+=N;else{this._bufs[E].copy(s,m,f,f+h),m+=N;break}h-=N,f&&(f=0)}return s.length>m?s.slice(0,m):s},i.prototype.shallowSlice=function(s,o){if(s=s||0,o=typeof o!="number"?this.length:o,s<0&&(s+=this.length),o<0&&(o+=this.length),s===o)return this._new();let a=this._offset(s),l=this._offset(o),c=this._bufs.slice(a[0],l[0]+1);return l[1]===0?c.pop():c[c.length-1]=c[c.length-1].slice(0,l[1]),a[1]!==0&&(c[0]=c[0].slice(a[1])),this._new(c)},i.prototype.toString=function(s,o,a){return this.slice(o,a).toString(s)},i.prototype.consume=function(s){if(s=Math.trunc(s),Number.isNaN(s)||s<=0)return this;for(;this._bufs.length;)if(s>=this._bufs[0].length)s-=this._bufs[0].length,this.length-=this._bufs[0].length,this._bufs.shift();else{this._bufs[0]=this._bufs[0].slice(s),this.length-=s;break}return this},i.prototype.duplicate=function(){let s=this._new();for(let o=0;o<this._bufs.length;o++)s.append(this._bufs[o]);return s},i.prototype.append=function(s){return this._attach(s,i.prototype._appendBuffer)},i.prototype.prepend=function(s){return this._attach(s,i.prototype._prependBuffer,!0)},i.prototype._attach=function(s,o,a){if(s==null)return this;if(s.buffer)o.call(this,r.from(s.buffer,s.byteOffset,s.byteLength));else if(Array.isArray(s)){let[l,c]=a?[s.length-1,-1]:[0,1];for(let u=l;u>=0&&u<s.length;u+=c)this._attach(s[u],o,a)}else if(this._isBufferList(s)){let[l,c]=a?[s._bufs.length-1,-1]:[0,1];for(let u=l;u>=0&&u<s._bufs.length;u+=c)this._attach(s._bufs[u],o,a)}else typeof s=="number"&&(s=s.toString()),o.call(this,r.from(s));return this},i.prototype._appendBuffer=function(s){this._bufs.push(s),this.length+=s.length},i.prototype._prependBuffer=function(s){this._bufs.unshift(s),this.length+=s.length},i.prototype.indexOf=function(s,o,a){if(a===void 0&&typeof o=="string"&&(a=o,o=void 0),typeof s=="function"||Array.isArray(s))throw new TypeError('The "value" argument must be one of type string, Buffer, BufferList, or Uint8Array.');if(typeof s=="number"?s=r.from([s]):typeof s=="string"?s=r.from(s,a):this._isBufferList(s)?s=s.slice():Array.isArray(s.buffer)?s=r.from(s.buffer,s.byteOffset,s.byteLength):r.isBuffer(s)||(s=r.from(s)),o=Number(o||0),isNaN(o)&&(o=0),o<0&&(o=this.length+o),o<0&&(o=0),s.length===0)return o>this.length?this.length:o;let l=this._offset(o),c=l[0],u=l[1];for(;c<this._bufs.length;c++){let p=this._bufs[c];for(;u<p.length;)if(p.length-u>=s.length){let h=p.indexOf(s,u);if(h!==-1)return this._reverseOffset([c,h]);u=p.length-s.length+1}else{let h=this._reverseOffset([c,u]);if(this._match(h,s))return h;u++}u=0}return-1},i.prototype._match=function(s,o){if(this.length-s<o.length)return!1;for(let a=0;a<o.length;a++)if(this.get(s+a)!==o[a])return!1;return!0},function(){let s={readDoubleBE:8,readDoubleLE:8,readFloatBE:4,readFloatLE:4,readBigInt64BE:8,readBigInt64LE:8,readBigUInt64BE:8,readBigUInt64LE:8,readInt32BE:4,readInt32LE:4,readUInt32BE:4,readUInt32LE:4,readInt16BE:2,readInt16LE:2,readUInt16BE:2,readUInt16LE:2,readInt8:1,readUInt8:1,readIntBE:null,readIntLE:null,readUIntBE:null,readUIntLE:null};for(let o in s)(function(a){s[a]===null?i.prototype[a]=function(l,c){return this.slice(l,l+c)[a](0,c)}:i.prototype[a]=function(l=0){return this.slice(l,l+s[a])[a](0)}})(o)}(),i.prototype._isBufferList=function(s){return s instanceof i||i.isBufferList(s)},i.isBufferList=function(s){return s!=null&&s[n]},t.exports=i}),Af=_e((d,t)=>{be(),ve(),we();var r=nr().Duplex,n=Cf(),i=xf();function s(o){if(!(this instanceof s))return new s(o);if(typeof o=="function"){this._callback=o;let a=(function(l){this._callback&&(this._callback(l),this._callback=null)}).bind(this);this.on("pipe",function(l){l.on("error",a)}),this.on("unpipe",function(l){l.removeListener("error",a)}),o=null}i._init.call(this,o),r.call(this)}n(s,r),Object.assign(s.prototype,i.prototype),s.prototype._new=function(o){return new s(o)},s.prototype._write=function(o,a,l){this._appendBuffer(o),typeof l=="function"&&l()},s.prototype._read=function(o){if(!this.length)return this.push(null);o=Math.min(o,this.length),this.push(this.slice(0,o)),this.consume(o)},s.prototype.end=function(o){r.prototype.end.call(this,o),this._callback&&(this._callback(null,this.slice()),this._callback=null)},s.prototype._destroy=function(o,a){this._bufs.length=0,this.length=0,a(o)},s.prototype._isBufferList=function(o){return o instanceof s||o instanceof i||s.isBufferList(o)},s.isBufferList=i.isBufferList,t.exports=s,t.exports.BufferListStream=s,t.exports.BufferList=i}),If=_e((d,t)=>{be(),ve(),we();var r=class{constructor(){this.cmd=null,this.retain=!1,this.qos=0,this.dup=!1,this.length=-1,this.topic=null,this.payload=null}};t.exports=r}),Hs=_e((d,t)=>{be(),ve(),we();var r=t.exports,{Buffer:n}=(ot(),We(nt));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.requiredHeaderFlags={1:0,2:0,4:0,5:0,6:2,7:0,8:2,9:0,10:2,11:0,12:0,13:0,14:0,15:0},r.requiredHeaderFlagsErrors={};for(let s in r.requiredHeaderFlags){let o=r.requiredHeaderFlags[s];r.requiredHeaderFlagsErrors[s]="Invalid header flag bits, must be 0x"+o.toString(16)+" for "+r.types[s]+" packet"}r.codes={};for(let s in r.types){let o=r.types[s];r.codes[o]=s}r.CMD_SHIFT=4,r.CMD_MASK=240,r.DUP_MASK=8,r.QOS_MASK=3,r.QOS_SHIFT=1,r.RETAIN_MASK=1,r.VARBYTEINT_MASK=127,r.VARBYTEINT_FIN_MASK=128,r.VARBYTEINT_MAX=268435455,r.SESSIONPRESENT_MASK=1,r.SESSIONPRESENT_HEADER=n.from([r.SESSIONPRESENT_MASK]),r.CONNACK_HEADER=n.from([r.codes.connack<<r.CMD_SHIFT]),r.USERNAME_MASK=128,r.PASSWORD_MASK=64,r.WILL_RETAIN_MASK=32,r.WILL_QOS_MASK=24,r.WILL_QOS_SHIFT=3,r.WILL_FLAG_MASK=4,r.CLEAN_SESSION_MASK=2,r.CONNECT_HEADER=n.from([r.codes.connect<<r.CMD_SHIFT]),r.properties={sessionExpiryInterval:17,willDelayInterval:24,receiveMaximum:33,maximumPacketSize:39,topicAliasMaximum:34,requestResponseInformation:25,requestProblemInformation:23,userProperties:38,authenticationMethod:21,authenticationData:22,payloadFormatIndicator:1,messageExpiryInterval:2,contentType:3,responseTopic:8,correlationData:9,maximumQoS:36,retainAvailable:37,assignedClientIdentifier:18,reasonString:31,wildcardSubscriptionAvailable:40,subscriptionIdentifiersAvailable:41,sharedSubscriptionAvailable:42,serverKeepAlive:19,responseInformation:26,serverReference:28,topicAlias:35,subscriptionIdentifier:11},r.propertiesCodes={};for(let s in r.properties){let o=r.properties[s];r.propertiesCodes[o]=s}r.propertiesTypes={sessionExpiryInterval:"int32",willDelayInterval:"int32",receiveMaximum:"int16",maximumPacketSize:"int32",topicAliasMaximum:"int16",requestResponseInformation:"byte",requestProblemInformation:"byte",userProperties:"pair",authenticationMethod:"string",authenticationData:"binary",payloadFormatIndicator:"byte",messageExpiryInterval:"int32",contentType:"string",responseTopic:"string",correlationData:"binary",maximumQoS:"int8",retainAvailable:"byte",assignedClientIdentifier:"string",reasonString:"string",wildcardSubscriptionAvailable:"byte",subscriptionIdentifiersAvailable:"byte",sharedSubscriptionAvailable:"byte",serverKeepAlive:"int16",responseInformation:"string",serverReference:"string",topicAlias:"int16",subscriptionIdentifier:"var"};function i(s){return[0,1,2].map(o=>[0,1].map(a=>[0,1].map(l=>{let c=n.alloc(1);return c.writeUInt8(r.codes[s]<<r.CMD_SHIFT|(a?r.DUP_MASK:0)|o<<r.QOS_SHIFT|l,0,!0),c})))}r.PUBLISH_HEADER=i("publish"),r.SUBSCRIBE_HEADER=i("subscribe"),r.SUBSCRIBE_OPTIONS_QOS_MASK=3,r.SUBSCRIBE_OPTIONS_NL_MASK=1,r.SUBSCRIBE_OPTIONS_NL_SHIFT=2,r.SUBSCRIBE_OPTIONS_RAP_MASK=1,r.SUBSCRIBE_OPTIONS_RAP_SHIFT=3,r.SUBSCRIBE_OPTIONS_RH_MASK=3,r.SUBSCRIBE_OPTIONS_RH_SHIFT=4,r.SUBSCRIBE_OPTIONS_RH=[0,16,32],r.SUBSCRIBE_OPTIONS_NL=4,r.SUBSCRIBE_OPTIONS_RAP=8,r.SUBSCRIBE_OPTIONS_QOS=[0,1,2],r.UNSUBSCRIBE_HEADER=i("unsubscribe"),r.ACKS={unsuback:i("unsuback"),puback:i("puback"),pubcomp:i("pubcomp"),pubrel:i("pubrel"),pubrec:i("pubrec")},r.SUBACK_HEADER=n.from([r.codes.suback<<r.CMD_SHIFT]),r.VERSION3=n.from([3]),r.VERSION4=n.from([4]),r.VERSION5=n.from([5]),r.VERSION131=n.from([131]),r.VERSION132=n.from([132]),r.QOS=[0,1,2].map(s=>n.from([s])),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])},r.MQTT5_PUBACK_PUBREC_CODES={0:"Success",16:"No matching subscribers",128:"Unspecified error",131:"Implementation specific error",135:"Not authorized",144:"Topic Name invalid",145:"Packet identifier in use",151:"Quota exceeded",153:"Payload format invalid"},r.MQTT5_PUBREL_PUBCOMP_CODES={0:"Success",146:"Packet Identifier not found"},r.MQTT5_SUBACK_CODES={0:"Granted QoS 0",1:"Granted QoS 1",2:"Granted QoS 2",128:"Unspecified error",131:"Implementation specific error",135:"Not authorized",143:"Topic Filter invalid",145:"Packet Identifier in use",151:"Quota exceeded",158:"Shared Subscriptions not supported",161:"Subscription Identifiers not supported",162:"Wildcard Subscriptions not supported"},r.MQTT5_UNSUBACK_CODES={0:"Success",17:"No subscription existed",128:"Unspecified error",131:"Implementation specific error",135:"Not authorized",143:"Topic Filter invalid",145:"Packet Identifier in use"},r.MQTT5_DISCONNECT_CODES={0:"Normal disconnection",4:"Disconnect with Will Message",128:"Unspecified error",129:"Malformed Packet",130:"Protocol Error",131:"Implementation specific error",135:"Not authorized",137:"Server busy",139:"Server shutting down",141:"Keep Alive timeout",142:"Session taken over",143:"Topic Filter invalid",144:"Topic Name invalid",147:"Receive Maximum exceeded",148:"Topic Alias invalid",149:"Packet too large",150:"Message rate too high",151:"Quota exceeded",152:"Administrative action",153:"Payload format invalid",154:"Retain not supported",155:"QoS not supported",156:"Use another server",157:"Server moved",158:"Shared Subscriptions not supported",159:"Connection rate exceeded",160:"Maximum connect time",161:"Subscription Identifiers not supported",162:"Wildcard Subscriptions not supported"},r.MQTT5_AUTH_CODES={0:"Success",24:"Continue authentication",25:"Re-authenticate"}}),Tf=_e((d,t)=>{be(),ve(),we();var r=1e3,n=r*60,i=n*60,s=i*24,o=s*7,a=s*365.25;t.exports=function(h,m){m=m||{};var f=typeof h;if(f==="string"&&h.length>0)return l(h);if(f==="number"&&isFinite(h))return m.long?u(h):c(h);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(h))};function l(h){if(h=String(h),!(h.length>100)){var m=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(h);if(m){var f=parseFloat(m[1]),E=(m[2]||"ms").toLowerCase();switch(E){case"years":case"year":case"yrs":case"yr":case"y":return f*a;case"weeks":case"week":case"w":return f*o;case"days":case"day":case"d":return f*s;case"hours":case"hour":case"hrs":case"hr":case"h":return f*i;case"minutes":case"minute":case"mins":case"min":case"m":return f*n;case"seconds":case"second":case"secs":case"sec":case"s":return f*r;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return f;default:return}}}}function c(h){var m=Math.abs(h);return m>=s?Math.round(h/s)+"d":m>=i?Math.round(h/i)+"h":m>=n?Math.round(h/n)+"m":m>=r?Math.round(h/r)+"s":h+"ms"}function u(h){var m=Math.abs(h);return m>=s?p(h,m,s,"day"):m>=i?p(h,m,i,"hour"):m>=n?p(h,m,n,"minute"):m>=r?p(h,m,r,"second"):h+" ms"}function p(h,m,f,E){var N=m>=f*1.5;return Math.round(h/f)+" "+E+(N?"s":"")}}),Vf=_e((d,t)=>{be(),ve(),we();function r(n){s.debug=s,s.default=s,s.coerce=p,s.disable=c,s.enable=a,s.enabled=u,s.humanize=Tf(),s.destroy=h,Object.keys(n).forEach(m=>{s[m]=n[m]}),s.names=[],s.skips=[],s.formatters={};function i(m){let f=0;for(let E=0;E<m.length;E++)f=(f<<5)-f+m.charCodeAt(E),f|=0;return s.colors[Math.abs(f)%s.colors.length]}s.selectColor=i;function s(m){let f,E=null,N,k;function g(...v){if(!g.enabled)return;let _=g,S=Number(new Date),B=S-(f||S);_.diff=B,_.prev=f,_.curr=S,f=S,v[0]=s.coerce(v[0]),typeof v[0]!="string"&&v.unshift("%O");let P=0;v[0]=v[0].replace(/%([a-zA-Z%])/g,(T,A)=>{if(T==="%%")return"%";P++;let C=s.formatters[A];if(typeof C=="function"){let O=v[P];T=C.call(_,O),v.splice(P,1),P--}return T}),s.formatArgs.call(_,v),(_.log||s.log).apply(_,v)}return g.namespace=m,g.useColors=s.useColors(),g.color=s.selectColor(m),g.extend=o,g.destroy=s.destroy,Object.defineProperty(g,"enabled",{enumerable:!0,configurable:!1,get:()=>E!==null?E:(N!==s.namespaces&&(N=s.namespaces,k=s.enabled(m)),k),set:v=>{E=v}}),typeof s.init=="function"&&s.init(g),g}function o(m,f){let E=s(this.namespace+(typeof f>"u"?":":f)+m);return E.log=this.log,E}function a(m){s.save(m),s.namespaces=m,s.names=[],s.skips=[];let f=(typeof m=="string"?m:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let E of f)E[0]==="-"?s.skips.push(E.slice(1)):s.names.push(E)}function l(m,f){let E=0,N=0,k=-1,g=0;for(;E<m.length;)if(N<f.length&&(f[N]===m[E]||f[N]==="*"))f[N]==="*"?(k=N,g=E,N++):(E++,N++);else if(k!==-1)N=k+1,g++,E=g;else return!1;for(;N<f.length&&f[N]==="*";)N++;return N===f.length}function c(){let m=[...s.names,...s.skips.map(f=>"-"+f)].join(",");return s.enable(""),m}function u(m){for(let f of s.skips)if(l(m,f))return!1;for(let f of s.names)if(l(m,f))return!0;return!1}function p(m){return m instanceof Error?m.stack||m.message:m}function h(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return s.enable(s.load()),s}t.exports=r}),Tt=_e((d,t)=>{be(),ve(),we(),d.formatArgs=n,d.save=i,d.load=s,d.useColors=r,d.storage=o(),d.destroy=(()=>{let l=!1;return()=>{l||(l=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),d.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"];function r(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let l;return 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&&(l=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(l[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function n(l){if(l[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+l[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),!this.useColors)return;let c="color: "+this.color;l.splice(1,0,c,"color: inherit");let u=0,p=0;l[0].replace(/%[a-zA-Z%]/g,h=>{h!=="%%"&&(u++,h==="%c"&&(p=u))}),l.splice(p,0,c)}d.log=console.debug||console.log||(()=>{});function i(l){try{l?d.storage.setItem("debug",l):d.storage.removeItem("debug")}catch{}}function s(){let l;try{l=d.storage.getItem("debug")||d.storage.getItem("DEBUG")}catch{}return!l&&typeof ze<"u"&&"env"in ze&&(l=ze.env.DEBUG),l}function o(){try{return localStorage}catch{}}t.exports=Vf()(d);var{formatters:a}=t.exports;a.j=function(l){try{return JSON.stringify(l)}catch(c){return"[UnexpectedJSONParseError]: "+c.message}}}),Pf=_e((d,t)=>{be(),ve(),we();var r=Af(),{EventEmitter:n}=(tr(),We(Mt)),i=If(),s=Hs(),o=Tt()("mqtt-packet:parser"),a=class is extends n{constructor(){super(),this.parser=this.constructor.parser}static parser(c){return this instanceof is?(this.settings=c||{},this._states=["_parseHeader","_parseLength","_parsePayload","_newPacket"],this._resetState(),this):new is().parser(c)}_resetState(){o("_resetState: resetting packet, error, _list, and _stateCounter"),this.packet=new i,this.error=null,this._list=r(),this._stateCounter=0}parse(c){for(this.error&&this._resetState(),this._list.append(c),o("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++,o("parse: state complete. _stateCounter is now: %d",this._stateCounter),o("parse: packet.length: %d, buffer list length: %d",this.packet.length,this._list.length),this._stateCounter>=this._states.length&&(this._stateCounter=0);return o("parse: exited while loop. packet: %d, buffer list length: %d",this.packet.length,this._list.length),this._list.length}_parseHeader(){let c=this._list.readUInt8(0),u=c>>s.CMD_SHIFT;this.packet.cmd=s.types[u];let p=c&15,h=s.requiredHeaderFlags[u];return h!=null&&p!==h?this._emitError(new Error(s.requiredHeaderFlagsErrors[u])):(this.packet.retain=(c&s.RETAIN_MASK)!==0,this.packet.qos=c>>s.QOS_SHIFT&s.QOS_MASK,this.packet.qos>2?this._emitError(new Error("Packet must not have both QoS bits set to 1")):(this.packet.dup=(c&s.DUP_MASK)!==0,o("_parseHeader: packet: %o",this.packet),this._list.consume(1),!0))}_parseLength(){let c=this._parseVarByteNum(!0);return c&&(this.packet.length=c.value,this._list.consume(c.bytes)),o("_parseLength %d",c.value),!!c}_parsePayload(){o("_parsePayload: payload %O",this._list);let c=!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"))}c=!0}return o("_parsePayload complete result: %s",c),c}_parseConnect(){o("_parseConnect");let c,u,p,h,m={},f=this.packet,E=this._parseString();if(E===null)return this._emitError(new Error("Cannot parse protocolId"));if(E!=="MQTT"&&E!=="MQIsdp")return this._emitError(new Error("Invalid protocolId"));if(f.protocolId=E,this._pos>=this._list.length)return this._emitError(new Error("Packet too short"));if(f.protocolVersion=this._list.readUInt8(this._pos),f.protocolVersion>=128&&(f.bridgeMode=!0,f.protocolVersion=f.protocolVersion-128),f.protocolVersion!==3&&f.protocolVersion!==4&&f.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(this._list.readUInt8(this._pos)&1)return this._emitError(new Error("Connect flag bit 0 must be 0, but got 1"));m.username=this._list.readUInt8(this._pos)&s.USERNAME_MASK,m.password=this._list.readUInt8(this._pos)&s.PASSWORD_MASK,m.will=this._list.readUInt8(this._pos)&s.WILL_FLAG_MASK;let N=!!(this._list.readUInt8(this._pos)&s.WILL_RETAIN_MASK),k=(this._list.readUInt8(this._pos)&s.WILL_QOS_MASK)>>s.WILL_QOS_SHIFT;if(m.will)f.will={},f.will.retain=N,f.will.qos=k;else{if(N)return this._emitError(new Error("Will Retain Flag must be set to zero when Will Flag is set to 0"));if(k)return this._emitError(new Error("Will QoS must be set to zero when Will Flag is set to 0"))}if(f.clean=(this._list.readUInt8(this._pos)&s.CLEAN_SESSION_MASK)!==0,this._pos++,f.keepalive=this._parseNum(),f.keepalive===-1)return this._emitError(new Error("Packet too short"));if(f.protocolVersion===5){let v=this._parseProperties();Object.getOwnPropertyNames(v).length&&(f.properties=v)}let g=this._parseString();if(g===null)return this._emitError(new Error("Packet too short"));if(f.clientId=g,o("_parseConnect: packet.clientId: %s",f.clientId),m.will){if(f.protocolVersion===5){let v=this._parseProperties();Object.getOwnPropertyNames(v).length&&(f.will.properties=v)}if(c=this._parseString(),c===null)return this._emitError(new Error("Cannot parse will topic"));if(f.will.topic=c,o("_parseConnect: packet.will.topic: %s",f.will.topic),u=this._parseBuffer(),u===null)return this._emitError(new Error("Cannot parse will payload"));f.will.payload=u,o("_parseConnect: packet.will.paylaod: %s",f.will.payload)}if(m.username){if(h=this._parseString(),h===null)return this._emitError(new Error("Cannot parse username"));f.username=h,o("_parseConnect: packet.username: %s",f.username)}if(m.password){if(p=this._parseBuffer(),p===null)return this._emitError(new Error("Cannot parse password"));f.password=p}return this.settings=f,o("_parseConnect: complete"),f}_parseConnack(){o("_parseConnack");let c=this.packet;if(this._list.length<1)return null;let u=this._list.readUInt8(this._pos++);if(u>1)return this._emitError(new Error("Invalid connack flags, bits 7-1 must be set to 0"));if(c.sessionPresent=!!(u&s.SESSIONPRESENT_MASK),this.settings.protocolVersion===5)this._list.length>=2?c.reasonCode=this._list.readUInt8(this._pos++):c.reasonCode=0;else{if(this._list.length<2)return null;c.returnCode=this._list.readUInt8(this._pos++)}if(c.returnCode===-1||c.reasonCode===-1)return this._emitError(new Error("Cannot parse return code"));if(this.settings.protocolVersion===5){let p=this._parseProperties();Object.getOwnPropertyNames(p).length&&(c.properties=p)}o("_parseConnack: complete")}_parsePublish(){o("_parsePublish");let c=this.packet;if(c.topic=this._parseString(),c.topic===null)return this._emitError(new Error("Cannot parse topic"));if(!(c.qos>0&&!this._parseMessageId())){if(this.settings.protocolVersion===5){let u=this._parseProperties();Object.getOwnPropertyNames(u).length&&(c.properties=u)}c.payload=this._list.slice(this._pos,c.length),o("_parsePublish: payload from buffer list: %o",c.payload)}}_parseSubscribe(){o("_parseSubscribe");let c=this.packet,u,p,h,m,f,E,N;if(c.subscriptions=[],!!this._parseMessageId()){if(this.settings.protocolVersion===5){let k=this._parseProperties();Object.getOwnPropertyNames(k).length&&(c.properties=k)}if(c.length<=0)return this._emitError(new Error("Malformed subscribe, no payload specified"));for(;this._pos<c.length;){if(u=this._parseString(),u===null)return this._emitError(new Error("Cannot parse topic"));if(this._pos>=c.length)return this._emitError(new Error("Malformed Subscribe Payload"));if(p=this._parseByte(),this.settings.protocolVersion===5){if(p&192)return this._emitError(new Error("Invalid subscribe topic flag bits, bits 7-6 must be 0"))}else if(p&252)return this._emitError(new Error("Invalid subscribe topic flag bits, bits 7-2 must be 0"));if(h=p&s.SUBSCRIBE_OPTIONS_QOS_MASK,h>2)return this._emitError(new Error("Invalid subscribe QoS, must be <= 2"));if(E=(p>>s.SUBSCRIBE_OPTIONS_NL_SHIFT&s.SUBSCRIBE_OPTIONS_NL_MASK)!==0,f=(p>>s.SUBSCRIBE_OPTIONS_RAP_SHIFT&s.SUBSCRIBE_OPTIONS_RAP_MASK)!==0,m=p>>s.SUBSCRIBE_OPTIONS_RH_SHIFT&s.SUBSCRIBE_OPTIONS_RH_MASK,m>2)return this._emitError(new Error("Invalid retain handling, must be <= 2"));N={topic:u,qos:h},this.settings.protocolVersion===5?(N.nl=E,N.rap=f,N.rh=m):this.settings.bridgeMode&&(N.rh=0,N.rap=!0,N.nl=!0),o("_parseSubscribe: push subscription `%s` to subscription",N),c.subscriptions.push(N)}}}_parseSuback(){o("_parseSuback");let c=this.packet;if(this.packet.granted=[],!!this._parseMessageId()){if(this.settings.protocolVersion===5){let u=this._parseProperties();Object.getOwnPropertyNames(u).length&&(c.properties=u)}if(c.length<=0)return this._emitError(new Error("Malformed suback, no payload specified"));for(;this._pos<this.packet.length;){let u=this._list.readUInt8(this._pos++);if(this.settings.protocolVersion===5){if(!s.MQTT5_SUBACK_CODES[u])return this._emitError(new Error("Invalid suback code"))}else if(u>2&&u!==128)return this._emitError(new Error("Invalid suback QoS, must be 0, 1, 2 or 128"));this.packet.granted.push(u)}}}_parseUnsubscribe(){o("_parseUnsubscribe");let c=this.packet;if(c.unsubscriptions=[],!!this._parseMessageId()){if(this.settings.protocolVersion===5){let u=this._parseProperties();Object.getOwnPropertyNames(u).length&&(c.properties=u)}if(c.length<=0)return this._emitError(new Error("Malformed unsubscribe, no payload specified"));for(;this._pos<c.length;){let u=this._parseString();if(u===null)return this._emitError(new Error("Cannot parse topic"));o("_parseUnsubscribe: push topic `%s` to unsubscriptions",u),c.unsubscriptions.push(u)}}}_parseUnsuback(){o("_parseUnsuback");let c=this.packet;if(!this._parseMessageId())return this._emitError(new Error("Cannot parse messageId"));if((this.settings.protocolVersion===3||this.settings.protocolVersion===4)&&c.length!==2)return this._emitError(new Error("Malformed unsuback, payload length must be 2"));if(c.length<=0)return this._emitError(new Error("Malformed unsuback, no payload specified"));if(this.settings.protocolVersion===5){let u=this._parseProperties();for(Object.getOwnPropertyNames(u).length&&(c.properties=u),c.granted=[];this._pos<this.packet.length;){let p=this._list.readUInt8(this._pos++);if(!s.MQTT5_UNSUBACK_CODES[p])return this._emitError(new Error("Invalid unsuback code"));this.packet.granted.push(p)}}}_parseConfirmation(){o("_parseConfirmation: packet.cmd: `%s`",this.packet.cmd);let c=this.packet;if(this._parseMessageId(),this.settings.protocolVersion===5){if(c.length>2){switch(c.reasonCode=this._parseByte(),this.packet.cmd){case"puback":case"pubrec":if(!s.MQTT5_PUBACK_PUBREC_CODES[c.reasonCode])return this._emitError(new Error("Invalid "+this.packet.cmd+" reason code"));break;case"pubrel":case"pubcomp":if(!s.MQTT5_PUBREL_PUBCOMP_CODES[c.reasonCode])return this._emitError(new Error("Invalid "+this.packet.cmd+" reason code"));break}o("_parseConfirmation: packet.reasonCode `%d`",c.reasonCode)}else c.reasonCode=0;if(c.length>3){let u=this._parseProperties();Object.getOwnPropertyNames(u).length&&(c.properties=u)}}return!0}_parseDisconnect(){let c=this.packet;if(o("_parseDisconnect"),this.settings.protocolVersion===5){this._list.length>0?(c.reasonCode=this._parseByte(),s.MQTT5_DISCONNECT_CODES[c.reasonCode]||this._emitError(new Error("Invalid disconnect reason code"))):c.reasonCode=0;let u=this._parseProperties();Object.getOwnPropertyNames(u).length&&(c.properties=u)}return o("_parseDisconnect result: true"),!0}_parseAuth(){o("_parseAuth");let c=this.packet;if(this.settings.protocolVersion!==5)return this._emitError(new Error("Not supported auth packet for this version MQTT"));if(c.reasonCode=this._parseByte(),!s.MQTT5_AUTH_CODES[c.reasonCode])return this._emitError(new Error("Invalid auth reason code"));let u=this._parseProperties();return Object.getOwnPropertyNames(u).length&&(c.properties=u),o("_parseAuth: result: true"),!0}_parseMessageId(){let c=this.packet;return c.messageId=this._parseNum(),c.messageId===null?(this._emitError(new Error("Cannot parse messageId")),!1):(o("_parseMessageId: packet.messageId %d",c.messageId),!0)}_parseString(c){let u=this._parseNum(),p=u+this._pos;if(u===-1||p>this._list.length||p>this.packet.length)return null;let h=this._list.toString("utf8",this._pos,p);return this._pos+=u,o("_parseString: result: %s",h),h}_parseStringPair(){return o("_parseStringPair"),{name:this._parseString(),value:this._parseString()}}_parseBuffer(){let c=this._parseNum(),u=c+this._pos;if(c===-1||u>this._list.length||u>this.packet.length)return null;let p=this._list.slice(this._pos,u);return this._pos+=c,o("_parseBuffer: result: %o",p),p}_parseNum(){if(this._list.length-this._pos<2)return-1;let c=this._list.readUInt16BE(this._pos);return this._pos+=2,o("_parseNum: result: %s",c),c}_parse4ByteNum(){if(this._list.length-this._pos<4)return-1;let c=this._list.readUInt32BE(this._pos);return this._pos+=4,o("_parse4ByteNum: result: %s",c),c}_parseVarByteNum(c){o("_parseVarByteNum");let u=4,p=0,h=1,m=0,f=!1,E,N=this._pos?this._pos:0;for(;p<u&&N+p<this._list.length;){if(E=this._list.readUInt8(N+p++),m+=h*(E&s.VARBYTEINT_MASK),h*=128,(E&s.VARBYTEINT_FIN_MASK)===0){f=!0;break}if(this._list.length<=p)break}return!f&&p===u&&this._list.length>=p&&this._emitError(new Error("Invalid variable byte integer")),N&&(this._pos+=p),f?c?f={bytes:p,value:m}:f=m:f=!1,o("_parseVarByteNum: result: %o",f),f}_parseByte(){let c;return this._pos<this._list.length&&(c=this._list.readUInt8(this._pos),this._pos++),o("_parseByte: result: %o",c),c}_parseByType(c){switch(o("_parseByType: type: %s",c),c){case"byte":return this._parseByte()!==0;case"int8":return this._parseByte();case"int16":return this._parseNum();case"int32":return this._parse4ByteNum();case"var":return this._parseVarByteNum();case"string":return this._parseString();case"pair":return this._parseStringPair();case"binary":return this._parseBuffer()}}_parseProperties(){o("_parseProperties");let c=this._parseVarByteNum(),u=this._pos+c,p={};for(;this._pos<u;){let h=this._parseByte();if(!h)return this._emitError(new Error("Cannot parse property code type")),!1;let m=s.propertiesCodes[h];if(!m)return this._emitError(new Error("Unknown property")),!1;if(m==="userProperties"){p[m]||(p[m]=Object.create(null));let f=this._parseByType(s.propertiesTypes[m]);if(p[m][f.name])if(Array.isArray(p[m][f.name]))p[m][f.name].push(f.value);else{let E=p[m][f.name];p[m][f.name]=[E],p[m][f.name].push(f.value)}else p[m][f.name]=f.value;continue}p[m]?Array.isArray(p[m])?p[m].push(this._parseByType(s.propertiesTypes[m])):(p[m]=[p[m]],p[m].push(this._parseByType(s.propertiesTypes[m]))):p[m]=this._parseByType(s.propertiesTypes[m])}return p}_newPacket(){return o("_newPacket"),this.packet&&(this._list.consume(this.packet.length),o("_newPacket: parser emit packet: packet.cmd: %s, packet.payload: %s, packet.length: %d",this.packet.cmd,this.packet.payload,this.packet.length),this.emit("packet",this.packet)),o("_newPacket: new packet"),this.packet=new i,this._pos=0,!0}_emitError(c){o("_emitError",c),this.error=c,this.emit("error",c)}};t.exports=a}),Bf=_e((d,t)=>{be(),ve(),we();var{Buffer:r}=(ot(),We(nt)),n=65536,i={},s=r.isBuffer(r.from([1,2]).subarray(0,1));function o(u){let p=r.allocUnsafe(2);return p.writeUInt8(u>>8,0),p.writeUInt8(u&255,1),p}function a(){for(let u=0;u<n;u++)i[u]=o(u)}function l(u){let p=0,h=0,m=r.allocUnsafe(4);do p=u%128|0,u=u/128|0,u>0&&(p=p|128),m.writeUInt8(p,h++);while(u>0&&h<4);return u>0&&(h=0),s?m.subarray(0,h):m.slice(0,h)}function c(u){let p=r.allocUnsafe(4);return p.writeUInt32BE(u,0),p}t.exports={cache:i,generateCache:a,generateNumber:o,genBufVariableByteInt:l,generate4ByteBuffer:c}}),Of=_e((d,t)=>{be(),ve(),we(),typeof ze>"u"||!ze.version||ze.version.indexOf("v0.")===0||ze.version.indexOf("v1.")===0&&ze.version.indexOf("v1.8.")!==0?t.exports={nextTick:r}:t.exports=ze;function r(n,i,s,o){if(typeof n!="function")throw new TypeError('"callback" argument must be a function');var a=arguments.length,l,c;switch(a){case 0:case 1:return ze.nextTick(n);case 2:return ze.nextTick(function(){n.call(null,i)});case 3:return ze.nextTick(function(){n.call(null,i,s)});case 4:return ze.nextTick(function(){n.call(null,i,s,o)});default:for(l=new Array(a-1),c=0;c<l.length;)l[c++]=arguments[c];return ze.nextTick(function(){n.apply(null,l)})}}}),Ks=_e((d,t)=>{be(),ve(),we();var r=Hs(),{Buffer:n}=(ot(),We(nt)),i=n.allocUnsafe(0),s=n.from([0]),o=Bf(),a=Of().nextTick,l=Tt()("mqtt-packet:writeToStream"),c=o.cache,u=o.generateNumber,p=o.generateCache,h=o.genBufVariableByteInt,m=o.generate4ByteBuffer,f=ne,E=!0;function N(Z,G,ce){switch(l("generate called"),G.cork&&(G.cork(),a(k,G)),E&&(E=!1,p()),l("generate: packet.cmd: %s",Z.cmd),Z.cmd){case"connect":return g(Z,G);case"connack":return v(Z,G,ce);case"publish":return _(Z,G,ce);case"puback":case"pubrec":case"pubrel":case"pubcomp":return S(Z,G,ce);case"subscribe":return B(Z,G,ce);case"suback":return P(Z,G,ce);case"unsubscribe":return T(Z,G,ce);case"unsuback":return A(Z,G,ce);case"pingreq":case"pingresp":return C(Z,G);case"disconnect":return O(Z,G,ce);case"auth":return I(Z,G,ce);default:return G.destroy(new Error("Unknown command")),!1}}Object.defineProperty(N,"cacheNumbers",{get(){return f===ne},set(Z){Z?((!c||Object.keys(c).length===0)&&(E=!0),f=ne):(E=!1,f=te)}});function k(Z){Z.uncork()}function g(Z,G,ce){let X=Z||{},oe=X.protocolId||"MQTT",ie=X.protocolVersion||4,Ee=X.will,z=X.clean,V=X.keepalive||0,F=X.clientId||"",ae=X.username,fe=X.password,pe=X.properties;z===void 0&&(z=!0);let ye=0;if(typeof oe!="string"&&!n.isBuffer(oe))return G.destroy(new Error("Invalid protocolId")),!1;if(ye+=oe.length+2,ie!==3&&ie!==4&&ie!==5)return G.destroy(new Error("Invalid protocol version")),!1;if(ye+=1,(typeof F=="string"||n.isBuffer(F))&&(F||ie>=4)&&(F||z))ye+=n.byteLength(F)+2;else{if(ie<4)return G.destroy(new Error("clientId must be supplied before 3.1.1")),!1;if(z*1===0)return G.destroy(new Error("clientId must be given if cleanSession set to 0")),!1}if(typeof V!="number"||V<0||V>65535||V%1!==0)return G.destroy(new Error("Invalid keepalive")),!1;ye+=2,ye+=1;let J,ge;if(ie===5){if(J=se(G,pe),!J)return!1;ye+=J.length}if(Ee){if(typeof Ee!="object")return G.destroy(new Error("Invalid will")),!1;if(!Ee.topic||typeof Ee.topic!="string")return G.destroy(new Error("Invalid will topic")),!1;if(ye+=n.byteLength(Ee.topic)+2,ye+=2,Ee.payload)if(Ee.payload.length>=0)typeof Ee.payload=="string"?ye+=n.byteLength(Ee.payload):ye+=Ee.payload.length;else return G.destroy(new Error("Invalid will payload")),!1;if(ge={},ie===5){if(ge=se(G,Ee.properties),!ge)return!1;ye+=ge.length}}let ke=!1;if(ae!=null)if(Se(ae))ke=!0,ye+=n.byteLength(ae)+2;else return G.destroy(new Error("Invalid username")),!1;if(fe!=null){if(!ke)return G.destroy(new Error("Username is required to use password")),!1;if(Se(fe))ye+=K(fe)+2;else return G.destroy(new Error("Invalid password")),!1}G.write(r.CONNECT_HEADER),Y(G,ye),$(G,oe),X.bridgeMode&&(ie+=128),G.write(ie===131?r.VERSION131:ie===132?r.VERSION132:ie===4?r.VERSION4:ie===5?r.VERSION5:r.VERSION3);let de=0;return de|=ae!=null?r.USERNAME_MASK:0,de|=fe!=null?r.PASSWORD_MASK:0,de|=Ee&&Ee.retain?r.WILL_RETAIN_MASK:0,de|=Ee&&Ee.qos?Ee.qos<<r.WILL_QOS_SHIFT:0,de|=Ee?r.WILL_FLAG_MASK:0,de|=z?r.CLEAN_SESSION_MASK:0,G.write(n.from([de])),f(G,V),ie===5&&J.write(),$(G,F),Ee&&(ie===5&&ge.write(),j(G,Ee.topic),$(G,Ee.payload)),ae!=null&&$(G,ae),fe!=null&&$(G,fe),!0}function v(Z,G,ce){let X=ce?ce.protocolVersion:4,oe=Z||{},ie=X===5?oe.reasonCode:oe.returnCode,Ee=oe.properties,z=2;if(typeof ie!="number")return G.destroy(new Error("Invalid return code")),!1;let V=null;if(X===5){if(V=se(G,Ee),!V)return!1;z+=V.length}return G.write(r.CONNACK_HEADER),Y(G,z),G.write(oe.sessionPresent?r.SESSIONPRESENT_HEADER:s),G.write(n.from([ie])),V==null||V.write(),!0}function _(Z,G,ce){l("publish: packet: %o",Z);let X=ce?ce.protocolVersion:4,oe=Z||{},ie=oe.qos||0,Ee=oe.retain?r.RETAIN_MASK:0,z=oe.topic,V=oe.payload||i,F=oe.messageId,ae=oe.properties,fe=0;if(typeof z=="string")fe+=n.byteLength(z)+2;else if(n.isBuffer(z))fe+=z.length+2;else return G.destroy(new Error("Invalid topic")),!1;if(n.isBuffer(V)?fe+=V.length:fe+=n.byteLength(V),ie&&typeof F!="number")return G.destroy(new Error("Invalid messageId")),!1;ie&&(fe+=2);let pe=null;if(X===5){if(pe=se(G,ae),!pe)return!1;fe+=pe.length}return G.write(r.PUBLISH_HEADER[ie][oe.dup?1:0][Ee?1:0]),Y(G,fe),f(G,K(z)),G.write(z),ie>0&&f(G,F),pe==null||pe.write(),l("publish: payload: %o",V),G.write(V)}function S(Z,G,ce){let X=ce?ce.protocolVersion:4,oe=Z||{},ie=oe.cmd||"puback",Ee=oe.messageId,z=oe.dup&&ie==="pubrel"?r.DUP_MASK:0,V=0,F=oe.reasonCode,ae=oe.properties,fe=X===5?3:2;if(ie==="pubrel"&&(V=1),typeof Ee!="number")return G.destroy(new Error("Invalid messageId")),!1;let pe=null;if(X===5&&typeof ae=="object"){if(pe=M(G,ae,ce,fe),!pe)return!1;fe+=pe.length}return G.write(r.ACKS[ie][V][z][0]),fe===3&&(fe+=F!==0?1:-1),Y(G,fe),f(G,Ee),X===5&&fe!==2&&G.write(n.from([F])),pe!==null?pe.write():fe===4&&G.write(n.from([0])),!0}function B(Z,G,ce){l("subscribe: packet: ");let X=ce?ce.protocolVersion:4,oe=Z||{},ie=oe.dup?r.DUP_MASK:0,Ee=oe.messageId,z=oe.subscriptions,V=oe.properties,F=0;if(typeof Ee!="number")return G.destroy(new Error("Invalid messageId")),!1;F+=2;let ae=null;if(X===5){if(ae=se(G,V),!ae)return!1;F+=ae.length}if(typeof z=="object"&&z.length)for(let pe=0;pe<z.length;pe+=1){let ye=z[pe].topic,J=z[pe].qos;if(typeof ye!="string")return G.destroy(new Error("Invalid subscriptions - invalid topic")),!1;if(typeof J!="number")return G.destroy(new Error("Invalid subscriptions - invalid qos")),!1;if(X===5){if(typeof(z[pe].nl||!1)!="boolean")return G.destroy(new Error("Invalid subscriptions - invalid No Local")),!1;if(typeof(z[pe].rap||!1)!="boolean")return G.destroy(new Error("Invalid subscriptions - invalid Retain as Published")),!1;let ge=z[pe].rh||0;if(typeof ge!="number"||ge>2)return G.destroy(new Error("Invalid subscriptions - invalid Retain Handling")),!1}F+=n.byteLength(ye)+2+1}else return G.destroy(new Error("Invalid subscriptions")),!1;l("subscribe: writing to stream: %o",r.SUBSCRIBE_HEADER),G.write(r.SUBSCRIBE_HEADER[1][ie?1:0][0]),Y(G,F),f(G,Ee),ae!==null&&ae.write();let fe=!0;for(let pe of z){let ye=pe.topic,J=pe.qos,ge=+pe.nl,ke=+pe.rap,de=pe.rh,Ce;j(G,ye),Ce=r.SUBSCRIBE_OPTIONS_QOS[J],X===5&&(Ce|=ge?r.SUBSCRIBE_OPTIONS_NL:0,Ce|=ke?r.SUBSCRIBE_OPTIONS_RAP:0,Ce|=de?r.SUBSCRIBE_OPTIONS_RH[de]:0),fe=G.write(n.from([Ce]))}return fe}function P(Z,G,ce){let X=ce?ce.protocolVersion:4,oe=Z||{},ie=oe.messageId,Ee=oe.granted,z=oe.properties,V=0;if(typeof ie!="number")return G.destroy(new Error("Invalid messageId")),!1;if(V+=2,typeof Ee=="object"&&Ee.length)for(let ae=0;ae<Ee.length;ae+=1){if(typeof Ee[ae]!="number")return G.destroy(new Error("Invalid qos vector")),!1;V+=1}else return G.destroy(new Error("Invalid qos vector")),!1;let F=null;if(X===5){if(F=M(G,z,ce,V),!F)return!1;V+=F.length}return G.write(r.SUBACK_HEADER),Y(G,V),f(G,ie),F!==null&&F.write(),G.write(n.from(Ee))}function T(Z,G,ce){let X=ce?ce.protocolVersion:4,oe=Z||{},ie=oe.messageId,Ee=oe.dup?r.DUP_MASK:0,z=oe.unsubscriptions,V=oe.properties,F=0;if(typeof ie!="number")return G.destroy(new Error("Invalid messageId")),!1;if(F+=2,typeof z=="object"&&z.length)for(let pe=0;pe<z.length;pe+=1){if(typeof z[pe]!="string")return G.destroy(new Error("Invalid unsubscriptions")),!1;F+=n.byteLength(z[pe])+2}else return G.destroy(new Error("Invalid unsubscriptions")),!1;let ae=null;if(X===5){if(ae=se(G,V),!ae)return!1;F+=ae.length}G.write(r.UNSUBSCRIBE_HEADER[1][Ee?1:0][0]),Y(G,F),f(G,ie),ae!==null&&ae.write();let fe=!0;for(let pe=0;pe<z.length;pe++)fe=j(G,z[pe]);return fe}function A(Z,G,ce){let X=ce?ce.protocolVersion:4,oe=Z||{},ie=oe.messageId,Ee=oe.dup?r.DUP_MASK:0,z=oe.granted,V=oe.properties,F=oe.cmd,ae=0,fe=2;if(typeof ie!="number")return G.destroy(new Error("Invalid messageId")),!1;if(X===5)if(typeof z=="object"&&z.length)for(let ye=0;ye<z.length;ye+=1){if(typeof z[ye]!="number")return G.destroy(new Error("Invalid qos vector")),!1;fe+=1}else return G.destroy(new Error("Invalid qos vector")),!1;let pe=null;if(X===5){if(pe=M(G,V,ce,fe),!pe)return!1;fe+=pe.length}return G.write(r.ACKS[F][ae][Ee][0]),Y(G,fe),f(G,ie),pe!==null&&pe.write(),X===5&&G.write(n.from(z)),!0}function C(Z,G,ce){return G.write(r.EMPTY[Z.cmd])}function O(Z,G,ce){let X=ce?ce.protocolVersion:4,oe=Z||{},ie=oe.reasonCode,Ee=oe.properties,z=X===5?1:0,V=null;if(X===5){if(V=M(G,Ee,ce,z),!V)return!1;z+=V.length}return G.write(n.from([r.codes.disconnect<<4])),Y(G,z),X===5&&G.write(n.from([ie])),V!==null&&V.write(),!0}function I(Z,G,ce){let X=ce?ce.protocolVersion:4,oe=Z||{},ie=oe.reasonCode,Ee=oe.properties,z=X===5?1:0;X!==5&&G.destroy(new Error("Invalid mqtt version for auth packet"));let V=M(G,Ee,ce,z);return V?(z+=V.length,G.write(n.from([r.codes.auth<<4])),Y(G,z),G.write(n.from([ie])),V!==null&&V.write(),!0):!1}var U={};function Y(Z,G){if(G>r.VARBYTEINT_MAX)return Z.destroy(new Error(`Invalid variable byte integer: ${G}`)),!1;let ce=U[G];return ce||(ce=h(G),G<16384&&(U[G]=ce)),l("writeVarByteInt: writing to stream: %o",ce),Z.write(ce)}function j(Z,G){let ce=n.byteLength(G);return f(Z,ce),l("writeString: %s",G),Z.write(G,"utf8")}function le(Z,G,ce){j(Z,G),j(Z,ce)}function ne(Z,G){return l("writeNumberCached: number: %d",G),l("writeNumberCached: %o",c[G]),Z.write(c[G])}function te(Z,G){let ce=u(G);return l("writeNumberGenerated: %o",ce),Z.write(ce)}function ue(Z,G){let ce=m(G);return l("write4ByteNumber: %o",ce),Z.write(ce)}function $(Z,G){typeof G=="string"?j(Z,G):G?(f(Z,G.length),Z.write(G)):f(Z,0)}function se(Z,G){if(typeof G!="object"||G.length!=null)return{length:1,write(){me(Z,{},0)}};let ce=0;function X(oe,ie){let Ee=r.propertiesTypes[oe],z=0;switch(Ee){case"byte":{if(typeof ie!="boolean")return Z.destroy(new Error(`Invalid ${oe}: ${ie}`)),!1;z+=2;break}case"int8":{if(typeof ie!="number"||ie<0||ie>255)return Z.destroy(new Error(`Invalid ${oe}: ${ie}`)),!1;z+=2;break}case"binary":{if(ie&&ie===null)return Z.destroy(new Error(`Invalid ${oe}: ${ie}`)),!1;z+=1+n.byteLength(ie)+2;break}case"int16":{if(typeof ie!="number"||ie<0||ie>65535)return Z.destroy(new Error(`Invalid ${oe}: ${ie}`)),!1;z+=3;break}case"int32":{if(typeof ie!="number"||ie<0||ie>4294967295)return Z.destroy(new Error(`Invalid ${oe}: ${ie}`)),!1;z+=5;break}case"var":{if(typeof ie!="number"||ie<0||ie>268435455)return Z.destroy(new Error(`Invalid ${oe}: ${ie}`)),!1;z+=1+n.byteLength(h(ie));break}case"string":{if(typeof ie!="string")return Z.destroy(new Error(`Invalid ${oe}: ${ie}`)),!1;z+=3+n.byteLength(ie.toString());break}case"pair":{if(typeof ie!="object")return Z.destroy(new Error(`Invalid ${oe}: ${ie}`)),!1;z+=Object.getOwnPropertyNames(ie).reduce((V,F)=>{let ae=ie[F];return Array.isArray(ae)?V+=ae.reduce((fe,pe)=>(fe+=3+n.byteLength(F.toString())+2+n.byteLength(pe.toString()),fe),0):V+=3+n.byteLength(F.toString())+2+n.byteLength(ie[F].toString()),V},0);break}default:return Z.destroy(new Error(`Invalid property ${oe}: ${ie}`)),!1}return z}if(G)for(let oe in G){let ie=0,Ee=0,z=G[oe];if(z!==void 0){if(Array.isArray(z))for(let V=0;V<z.length;V++){if(Ee=X(oe,z[V]),!Ee)return!1;ie+=Ee}else{if(Ee=X(oe,z),!Ee)return!1;ie=Ee}if(!ie)return!1;ce+=ie}}return{length:n.byteLength(h(ce))+ce,write(){me(Z,G,ce)}}}function M(Z,G,ce,X){let oe=["reasonString","userProperties"],ie=ce&&ce.properties&&ce.properties.maximumPacketSize?ce.properties.maximumPacketSize:0,Ee=se(Z,G);if(ie)for(;X+Ee.length>ie;){let z=oe.shift();if(z&&G[z])delete G[z],Ee=se(Z,G);else return!1}return Ee}function Q(Z,G,ce){switch(r.propertiesTypes[G]){case"byte":{Z.write(n.from([r.properties[G]])),Z.write(n.from([+ce]));break}case"int8":{Z.write(n.from([r.properties[G]])),Z.write(n.from([ce]));break}case"binary":{Z.write(n.from([r.properties[G]])),$(Z,ce);break}case"int16":{Z.write(n.from([r.properties[G]])),f(Z,ce);break}case"int32":{Z.write(n.from([r.properties[G]])),ue(Z,ce);break}case"var":{Z.write(n.from([r.properties[G]])),Y(Z,ce);break}case"string":{Z.write(n.from([r.properties[G]])),j(Z,ce);break}case"pair":{Object.getOwnPropertyNames(ce).forEach(X=>{let oe=ce[X];Array.isArray(oe)?oe.forEach(ie=>{Z.write(n.from([r.properties[G]])),le(Z,X.toString(),ie.toString())}):(Z.write(n.from([r.properties[G]])),le(Z,X.toString(),oe.toString()))});break}default:return Z.destroy(new Error(`Invalid property ${G} value: ${ce}`)),!1}}function me(Z,G,ce){Y(Z,ce);for(let X in G)if(Object.prototype.hasOwnProperty.call(G,X)&&G[X]!=null){let oe=G[X];if(Array.isArray(oe))for(let ie=0;ie<oe.length;ie++)Q(Z,X,oe[ie]);else Q(Z,X,oe)}}function K(Z){return Z?Z instanceof n?Z.length:n.byteLength(Z):0}function Se(Z){return typeof Z=="string"||Z instanceof n}t.exports=N}),Df=_e((d,t)=>{be(),ve(),we();var r=Ks(),{EventEmitter:n}=(tr(),We(Mt)),{Buffer:i}=(ot(),We(nt));function s(a,l){let c=new o;return r(a,c,l),c.concat()}var o=class extends n{constructor(){super(),this._array=new Array(20),this._i=0}write(a){return this._array[this._i++]=a,!0}concat(){let a=0,l=new Array(this._array.length),c=this._array,u=0,p;for(p=0;p<c.length&&c[p]!==void 0;p++)typeof c[p]!="string"?l[p]=c[p].length:l[p]=i.byteLength(c[p]),a+=l[p];let h=i.allocUnsafe(a);for(p=0;p<c.length&&c[p]!==void 0;p++)typeof c[p]!="string"?(c[p].copy(h,u),u+=l[p]):(h.write(c[p],u),u+=l[p]);return h}destroy(a){a&&this.emit("error",a)}};t.exports=s}),Rf=_e(d=>{be(),ve(),we(),d.parser=Pf().parser,d.generate=Df(),d.writeToStream=Ks()}),Mf=_e((d,t)=>{be(),ve(),we(),t.exports=n;function r(s){return s instanceof Lr?Lr.from(s):new s.constructor(s.buffer.slice(),s.byteOffset,s.length)}function n(s){if(s=s||{},s.circles)return i(s);let o=new Map;if(o.set(Date,p=>new Date(p)),o.set(Map,(p,h)=>new Map(l(Array.from(p),h))),o.set(Set,(p,h)=>new Set(l(Array.from(p),h))),s.constructorHandlers)for(let p of s.constructorHandlers)o.set(p[0],p[1]);let a=null;return s.proto?u:c;function l(p,h){let m=Object.keys(p),f=new Array(m.length);for(let E=0;E<m.length;E++){let N=m[E],k=p[N];typeof k!="object"||k===null?f[N]=k:k.constructor!==Object&&(a=o.get(k.constructor))?f[N]=a(k,h):ArrayBuffer.isView(k)?f[N]=r(k):f[N]=h(k)}return f}function c(p){if(typeof p!="object"||p===null)return p;if(Array.isArray(p))return l(p,c);if(p.constructor!==Object&&(a=o.get(p.constructor)))return a(p,c);let h={};for(let m in p){if(Object.hasOwnProperty.call(p,m)===!1)continue;let f=p[m];typeof f!="object"||f===null?h[m]=f:f.constructor!==Object&&(a=o.get(f.constructor))?h[m]=a(f,c):ArrayBuffer.isView(f)?h[m]=r(f):h[m]=c(f)}return h}function u(p){if(typeof p!="object"||p===null)return p;if(Array.isArray(p))return l(p,u);if(p.constructor!==Object&&(a=o.get(p.constructor)))return a(p,u);let h={};for(let m in p){let f=p[m];typeof f!="object"||f===null?h[m]=f:f.constructor!==Object&&(a=o.get(f.constructor))?h[m]=a(f,u):ArrayBuffer.isView(f)?h[m]=r(f):h[m]=u(f)}return h}}function i(s){let o=[],a=[],l=new Map;if(l.set(Date,m=>new Date(m)),l.set(Map,(m,f)=>new Map(u(Array.from(m),f))),l.set(Set,(m,f)=>new Set(u(Array.from(m),f))),s.constructorHandlers)for(let m of s.constructorHandlers)l.set(m[0],m[1]);let c=null;return s.proto?h:p;function u(m,f){let E=Object.keys(m),N=new Array(E.length);for(let k=0;k<E.length;k++){let g=E[k],v=m[g];if(typeof v!="object"||v===null)N[g]=v;else if(v.constructor!==Object&&(c=l.get(v.constructor)))N[g]=c(v,f);else if(ArrayBuffer.isView(v))N[g]=r(v);else{let _=o.indexOf(v);_!==-1?N[g]=a[_]:N[g]=f(v)}}return N}function p(m){if(typeof m!="object"||m===null)return m;if(Array.isArray(m))return u(m,p);if(m.constructor!==Object&&(c=l.get(m.constructor)))return c(m,p);let f={};o.push(m),a.push(f);for(let E in m){if(Object.hasOwnProperty.call(m,E)===!1)continue;let N=m[E];if(typeof N!="object"||N===null)f[E]=N;else if(N.constructor!==Object&&(c=l.get(N.constructor)))f[E]=c(N,p);else if(ArrayBuffer.isView(N))f[E]=r(N);else{let k=o.indexOf(N);k!==-1?f[E]=a[k]:f[E]=p(N)}}return o.pop(),a.pop(),f}function h(m){if(typeof m!="object"||m===null)return m;if(Array.isArray(m))return u(m,h);if(m.constructor!==Object&&(c=l.get(m.constructor)))return c(m,h);let f={};o.push(m),a.push(f);for(let E in m){let N=m[E];if(typeof N!="object"||N===null)f[E]=N;else if(N.constructor!==Object&&(c=l.get(N.constructor)))f[E]=c(N,h);else if(ArrayBuffer.isView(N))f[E]=r(N);else{let k=o.indexOf(N);k!==-1?f[E]=a[k]:f[E]=h(N)}}return o.pop(),a.pop(),f}}}),$f=_e((d,t)=>{be(),ve(),we(),t.exports=Mf()()}),Ys=_e(d=>{be(),ve(),we(),Object.defineProperty(d,"__esModule",{value:!0}),d.validateTopic=t,d.validateTopics=r;function t(n){let i=n.split("/");for(let s=0;s<i.length;s++)if(i[s]!=="+"){if(i[s]==="#")return s===i.length-1;if(i[s].indexOf("+")!==-1||i[s].indexOf("#")!==-1)return!1}return!0}function r(n){if(n.length===0)return"empty_topic_list";for(let i=0;i<n.length;i++)if(!t(n[i]))return n[i];return null}}),Js=_e(d=>{be(),ve(),we(),Object.defineProperty(d,"__esModule",{value:!0});var t=nr(),r={objectMode:!0},n={clean:!0},i=class{constructor(s){he(this,"options");he(this,"_inflights");this.options=s||{},this.options={...n,...s},this._inflights=new Map}put(s,o){return this._inflights.set(s.messageId,s),o&&o(),this}createStream(){let s=new t.Readable(r),o=[],a=!1,l=0;return this._inflights.forEach((c,u)=>{o.push(c)}),s._read=()=>{!a&&l<o.length?s.push(o[l++]):s.push(null)},s.destroy=c=>{if(!a)return a=!0,setTimeout(()=>{s.emit("close")},0),s},s}del(s,o){let a=this._inflights.get(s.messageId);return a?(this._inflights.delete(s.messageId),o(null,a)):o&&o(new Error("missing packet")),this}get(s,o){let a=this._inflights.get(s.messageId);return a?o(null,a):o&&o(new Error("missing packet")),this}close(s){this.options.clean&&(this._inflights=null),s&&s()}};d.default=i}),jf=_e(d=>{be(),ve(),we(),Object.defineProperty(d,"__esModule",{value:!0});var t=[0,16,128,131,135,144,145,151,153],r=(n,i,s)=>{n.log("handlePublish: packet %o",i),s=typeof s<"u"?s:n.noop;let o=i.topic.toString(),a=i.payload,{qos:l}=i,{messageId:c}=i,{options:u}=n;if(n.options.protocolVersion===5){let p;if(i.properties&&(p=i.properties.topicAlias),typeof p<"u")if(o.length===0)if(p>0&&p<=65535){let h=n.topicAliasRecv.getTopicByAlias(p);if(h)o=h,n.log("handlePublish :: topic complemented by alias. topic: %s - alias: %d",o,p);else{n.log("handlePublish :: unregistered topic alias. alias: %d",p),n.emit("error",new Error("Received unregistered Topic Alias"));return}}else{n.log("handlePublish :: topic alias out of range. alias: %d",p),n.emit("error",new Error("Received Topic Alias is out of range"));return}else if(n.topicAliasRecv.put(o,p))n.log("handlePublish :: registered topic: %s - alias: %d",o,p);else{n.log("handlePublish :: topic alias out of range. alias: %d",p),n.emit("error",new Error("Received Topic Alias is out of range"));return}}switch(n.log("handlePublish: qos %d",l),l){case 2:{u.customHandleAcks(o,a,i,(p,h)=>{if(typeof p=="number"&&(h=p,p=null),p)return n.emit("error",p);if(t.indexOf(h)===-1)return n.emit("error",new Error("Wrong reason code for pubrec"));h?n._sendPacket({cmd:"pubrec",messageId:c,reasonCode:h},s):n.incomingStore.put(i,()=>{n._sendPacket({cmd:"pubrec",messageId:c},s)})});break}case 1:{u.customHandleAcks(o,a,i,(p,h)=>{if(typeof p=="number"&&(h=p,p=null),p)return n.emit("error",p);if(t.indexOf(h)===-1)return n.emit("error",new Error("Wrong reason code for puback"));h||n.emit("message",o,a,i),n.handleMessage(i,m=>{if(m)return s&&s(m);n._sendPacket({cmd:"puback",messageId:c,reasonCode:h},s)})});break}case 0:n.emit("message",o,a,i),n.handleMessage(i,s);break;default:n.log("handlePublish: unknown QoS. Doing nothing.");break}};d.default=r}),Lf=_e((d,t)=>{t.exports={version:"5.15.0"}}),fr=_e(d=>{be(),ve(),we(),Object.defineProperty(d,"__esModule",{value:!0}),d.MQTTJS_VERSION=d.nextTick=d.ErrorWithSubackPacket=d.ErrorWithReasonCode=void 0,d.applyMixin=n;var t=class gc extends Error{constructor(o,a){super(o);he(this,"code");this.code=a,Object.setPrototypeOf(this,gc.prototype),Object.getPrototypeOf(this).name="ErrorWithReasonCode"}};d.ErrorWithReasonCode=t;var r=class yc extends Error{constructor(o,a){super(o);he(this,"packet");this.packet=a,Object.setPrototypeOf(this,yc.prototype),Object.getPrototypeOf(this).name="ErrorWithSubackPacket"}};d.ErrorWithSubackPacket=r;function n(i,s,o=!1){let a=[s];for(;;){let l=a[0],c=Object.getPrototypeOf(l);if(c!=null&&c.prototype)a.unshift(c);else break}for(let l of a)for(let c of Object.getOwnPropertyNames(l.prototype))(o||c!=="constructor")&&Object.defineProperty(i.prototype,c,Object.getOwnPropertyDescriptor(l.prototype,c)??Object.create(null))}d.nextTick=typeof(ze==null?void 0:ze.nextTick)=="function"?ze.nextTick:i=>{setTimeout(i,0)},d.MQTTJS_VERSION=Lf().version}),Wr=_e(d=>{be(),ve(),we(),Object.defineProperty(d,"__esModule",{value:!0}),d.ReasonCodes=void 0;var t=fr();d.ReasonCodes={0:"",1:"Unacceptable protocol version",2:"Identifier rejected",3:"Server unavailable",4:"Bad username or password",5:"Not authorized",16:"No matching subscribers",17:"No subscription existed",128:"Unspecified error",129:"Malformed Packet",130:"Protocol Error",131:"Implementation specific error",132:"Unsupported Protocol Version",133:"Client Identifier not valid",134:"Bad User Name or Password",135:"Not authorized",136:"Server unavailable",137:"Server busy",138:"Banned",139:"Server shutting down",140:"Bad authentication method",141:"Keep Alive timeout",142:"Session taken over",143:"Topic Filter invalid",144:"Topic Name invalid",145:"Packet identifier in use",146:"Packet Identifier not found",147:"Receive Maximum exceeded",148:"Topic Alias invalid",149:"Packet too large",150:"Message rate too high",151:"Quota exceeded",152:"Administrative action",153:"Payload format invalid",154:"Retain not supported",155:"QoS not supported",156:"Use another server",157:"Server moved",158:"Shared Subscriptions not supported",159:"Connection rate exceeded",160:"Maximum connect time",161:"Subscription Identifiers not supported",162:"Wildcard Subscriptions not supported"};var r=(n,i)=>{let{messageId:s}=i,o=i.cmd,a=null,l=n.outgoing[s]?n.outgoing[s].cb:null,c=null;if(!l){n.log("_handleAck :: Server sent an ack in error. Ignoring.");return}switch(n.log("_handleAck :: packet type",o),o){case"pubcomp":case"puback":{let u=i.reasonCode;u&&u>0&&u!==16?(c=new t.ErrorWithReasonCode(`Publish error: ${d.ReasonCodes[u]}`,u),n._removeOutgoingAndStoreMessage(s,()=>{l(c,i)})):n._removeOutgoingAndStoreMessage(s,l);break}case"pubrec":{a={cmd:"pubrel",qos:2,messageId:s};let u=i.reasonCode;u&&u>0&&u!==16?(c=new t.ErrorWithReasonCode(`Publish error: ${d.ReasonCodes[u]}`,u),n._removeOutgoingAndStoreMessage(s,()=>{l(c,i)})):n._sendPacket(a);break}case"suback":{delete n.outgoing[s],n.messageIdProvider.deallocate(s);let u=i.granted;for(let p=0;p<u.length;p++){let h=u[p];if(h&128){c=new Error(`Subscribe error: ${d.ReasonCodes[h]}`),c.code=h;let m=n.messageIdToTopic[s];m&&m.forEach(f=>{delete n._resubscribeTopics[f]})}}delete n.messageIdToTopic[s],n._invokeStoreProcessingQueue(),l(c,i);break}case"unsuback":{delete n.outgoing[s],n.messageIdProvider.deallocate(s),n._invokeStoreProcessingQueue(),l(null,i);break}default:n.emit("error",new Error("unrecognized packet type"))}n.disconnecting&&Object.keys(n.outgoing).length===0&&n.emit("outgoingEmpty")};d.default=r}),Uf=_e(d=>{be(),ve(),we(),Object.defineProperty(d,"__esModule",{value:!0});var t=fr(),r=Wr(),n=(i,s)=>{let{options:o}=i,a=o.protocolVersion,l=a===5?s.reasonCode:s.returnCode;if(a!==5){let c=new t.ErrorWithReasonCode(`Protocol error: Auth packets are only supported in MQTT 5. Your version:${a}`,l);i.emit("error",c);return}i.handleAuth(s,(c,u)=>{if(c){i.emit("error",c);return}if(l===24)i.reconnecting=!1,i._sendPacket(u);else{let p=new t.ErrorWithReasonCode(`Connection refused: ${r.ReasonCodes[l]}`,l);i.emit("error",p)}})};d.default=n}),Ff=_e(d=>{var m,f,E,N,k,g,v,_,S,B,P,T,A,C,O,I,U,Y,j,le,ne,te,ue,$,se,M,Q,me,K,ss,Z,G,ce,X,bc,ie,Ee,z,Kt,Yt,as,Cn,xn,Ke,ls,Or,Jt,cs,Ce;be(),ve(),we(),Object.defineProperty(d,"__esModule",{value:!0}),d.LRUCache=void 0;var t=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,r=new Set,n=typeof ze=="object"&&ze?ze:{},i=(y,b,w,x)=>{typeof n.emitWarning=="function"?n.emitWarning(y,b,w,x):console.error(`[${w}] ${b}: ${y}`)},s=globalThis.AbortController,o=globalThis.AbortSignal;if(typeof s>"u"){o=class{constructor(){he(this,"onabort");he(this,"_onabort",[]);he(this,"reason");he(this,"aborted",!1)}addEventListener(w,x){this._onabort.push(x)}},s=class{constructor(){he(this,"signal",new o);b()}abort(w){var x,D;if(!this.signal.aborted){this.signal.reason=w,this.signal.aborted=!0;for(let L of this.signal._onabort)L(w);(D=(x=this.signal).onabort)==null||D.call(x,w)}}};let y=((m=n.env)==null?void 0:m.LRU_CACHE_IGNORE_AC_WARNING)!=="1",b=()=>{y&&(y=!1,i("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",b))}}var a=y=>!r.has(y),l=y=>y&&y===Math.floor(y)&&y>0&&isFinite(y),c=y=>l(y)?y<=Math.pow(2,8)?Uint8Array:y<=Math.pow(2,16)?Uint16Array:y<=Math.pow(2,32)?Uint32Array:y<=Number.MAX_SAFE_INTEGER?u:null:null,u=class extends Array{constructor(y){super(y),this.fill(0)}},p=(f=class{constructor(b,w){he(this,"heap");he(this,"length");if(!q(f,E))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new w(b),this.length=0}static create(b){let w=c(b);if(!w)return[];Re(f,E,!0);let x=new f(b,w);return Re(f,E,!1),x}push(b){this.heap[this.length++]=b}pop(){return this.heap[--this.length]}},E=new WeakMap,Fe(f,E,!1),f),h=(Ce=class{constructor(b){Fe(this,K);Fe(this,g);Fe(this,v);Fe(this,_);Fe(this,S);Fe(this,B);Fe(this,P);he(this,"ttl");he(this,"ttlResolution");he(this,"ttlAutopurge");he(this,"updateAgeOnGet");he(this,"updateAgeOnHas");he(this,"allowStale");he(this,"noDisposeOnSet");he(this,"noUpdateTTL");he(this,"maxEntrySize");he(this,"sizeCalculation");he(this,"noDeleteOnFetchRejection");he(this,"noDeleteOnStaleGet");he(this,"allowStaleOnFetchAbort");he(this,"allowStaleOnFetchRejection");he(this,"ignoreFetchAbort");Fe(this,T);Fe(this,A);Fe(this,C);Fe(this,O);Fe(this,I);Fe(this,U);Fe(this,Y);Fe(this,j);Fe(this,le);Fe(this,ne);Fe(this,te);Fe(this,ue);Fe(this,$);Fe(this,se);Fe(this,M);Fe(this,Q);Fe(this,me);Fe(this,Z,()=>{});Fe(this,G,()=>{});Fe(this,ce,()=>{});Fe(this,X,()=>!1);Fe(this,ie,b=>{});Fe(this,Ee,(b,w,x)=>{});Fe(this,z,(b,w,x,D)=>{if(x||D)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});he(this,N,"LRUCache");let{max:w=0,ttl:x,ttlResolution:D=1,ttlAutopurge:L,updateAgeOnGet:re,updateAgeOnHas:H,allowStale:ee,dispose:xe,disposeAfter:Ve,noDisposeOnSet:Pe,noUpdateTTL:Me,maxSize:Xe=0,maxEntrySize:et=0,sizeCalculation:je,fetchMethod:Ge,memoMethod:De,noDeleteOnFetchRejection:Ue,noDeleteOnStaleGet:qe,allowStaleOnFetchRejection:Ze,allowStaleOnFetchAbort:it,ignoreFetchAbort:wt}=b;if(w!==0&&!l(w))throw new TypeError("max option must be a nonnegative integer");let R=w?c(w):Array;if(!R)throw new Error("invalid max value: "+w);if(Re(this,g,w),Re(this,v,Xe),this.maxEntrySize=et||q(this,v),this.sizeCalculation=je,this.sizeCalculation){if(!q(this,v)&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(De!==void 0&&typeof De!="function")throw new TypeError("memoMethod must be a function if defined");if(Re(this,P,De),Ge!==void 0&&typeof Ge!="function")throw new TypeError("fetchMethod must be a function if specified");if(Re(this,B,Ge),Re(this,Q,!!Ge),Re(this,C,new Map),Re(this,O,new Array(w).fill(void 0)),Re(this,I,new Array(w).fill(void 0)),Re(this,U,new R(w)),Re(this,Y,new R(w)),Re(this,j,0),Re(this,le,0),Re(this,ne,p.create(w)),Re(this,T,0),Re(this,A,0),typeof xe=="function"&&Re(this,_,xe),typeof Ve=="function"?(Re(this,S,Ve),Re(this,te,[])):(Re(this,S,void 0),Re(this,te,void 0)),Re(this,M,!!q(this,_)),Re(this,me,!!q(this,S)),this.noDisposeOnSet=!!Pe,this.noUpdateTTL=!!Me,this.noDeleteOnFetchRejection=!!Ue,this.allowStaleOnFetchRejection=!!Ze,this.allowStaleOnFetchAbort=!!it,this.ignoreFetchAbort=!!wt,this.maxEntrySize!==0){if(q(this,v)!==0&&!l(q(this,v)))throw new TypeError("maxSize must be a positive integer if specified");if(!l(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");Oe(this,K,bc).call(this)}if(this.allowStale=!!ee,this.noDeleteOnStaleGet=!!qe,this.updateAgeOnGet=!!re,this.updateAgeOnHas=!!H,this.ttlResolution=l(D)||D===0?D:1,this.ttlAutopurge=!!L,this.ttl=x||0,this.ttl){if(!l(this.ttl))throw new TypeError("ttl must be a positive integer if specified");Oe(this,K,ss).call(this)}if(q(this,g)===0&&this.ttl===0&&q(this,v)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!q(this,g)&&!q(this,v)){let W="LRU_CACHE_UNBOUNDED";a(W)&&(r.add(W),i("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",W,Ce))}}static unsafeExposeInternals(b){return{starts:q(b,$),ttls:q(b,se),sizes:q(b,ue),keyMap:q(b,C),keyList:q(b,O),valList:q(b,I),next:q(b,U),prev:q(b,Y),get head(){return q(b,j)},get tail(){return q(b,le)},free:q(b,ne),isBackgroundFetch:w=>{var x;return Oe(x=b,K,Ke).call(x,w)},backgroundFetch:(w,x,D,L)=>{var re;return Oe(re=b,K,xn).call(re,w,x,D,L)},moveToTail:w=>{var x;return Oe(x=b,K,Or).call(x,w)},indexes:w=>{var x;return Oe(x=b,K,Kt).call(x,w)},rindexes:w=>{var x;return Oe(x=b,K,Yt).call(x,w)},isStale:w=>{var x;return q(x=b,X).call(x,w)}}}get max(){return q(this,g)}get maxSize(){return q(this,v)}get calculatedSize(){return q(this,A)}get size(){return q(this,T)}get fetchMethod(){return q(this,B)}get memoMethod(){return q(this,P)}get dispose(){return q(this,_)}get disposeAfter(){return q(this,S)}getRemainingTTL(b){return q(this,C).has(b)?1/0:0}*entries(){for(let b of Oe(this,K,Kt).call(this))q(this,I)[b]!==void 0&&q(this,O)[b]!==void 0&&!Oe(this,K,Ke).call(this,q(this,I)[b])&&(yield[q(this,O)[b],q(this,I)[b]])}*rentries(){for(let b of Oe(this,K,Yt).call(this))q(this,I)[b]!==void 0&&q(this,O)[b]!==void 0&&!Oe(this,K,Ke).call(this,q(this,I)[b])&&(yield[q(this,O)[b],q(this,I)[b]])}*keys(){for(let b of Oe(this,K,Kt).call(this)){let w=q(this,O)[b];w!==void 0&&!Oe(this,K,Ke).call(this,q(this,I)[b])&&(yield w)}}*rkeys(){for(let b of Oe(this,K,Yt).call(this)){let w=q(this,O)[b];w!==void 0&&!Oe(this,K,Ke).call(this,q(this,I)[b])&&(yield w)}}*values(){for(let b of Oe(this,K,Kt).call(this))q(this,I)[b]!==void 0&&!Oe(this,K,Ke).call(this,q(this,I)[b])&&(yield q(this,I)[b])}*rvalues(){for(let b of Oe(this,K,Yt).call(this))q(this,I)[b]!==void 0&&!Oe(this,K,Ke).call(this,q(this,I)[b])&&(yield q(this,I)[b])}[(k=Symbol.iterator,N=Symbol.toStringTag,k)](){return this.entries()}find(b,w={}){for(let x of Oe(this,K,Kt).call(this)){let D=q(this,I)[x],L=Oe(this,K,Ke).call(this,D)?D.__staleWhileFetching:D;if(L!==void 0&&b(L,q(this,O)[x],this))return this.get(q(this,O)[x],w)}}forEach(b,w=this){for(let x of Oe(this,K,Kt).call(this)){let D=q(this,I)[x],L=Oe(this,K,Ke).call(this,D)?D.__staleWhileFetching:D;L!==void 0&&b.call(w,L,q(this,O)[x],this)}}rforEach(b,w=this){for(let x of Oe(this,K,Yt).call(this)){let D=q(this,I)[x],L=Oe(this,K,Ke).call(this,D)?D.__staleWhileFetching:D;L!==void 0&&b.call(w,L,q(this,O)[x],this)}}purgeStale(){let b=!1;for(let w of Oe(this,K,Yt).call(this,{allowStale:!0}))q(this,X).call(this,w)&&(Oe(this,K,Jt).call(this,q(this,O)[w],"expire"),b=!0);return b}info(b){let w=q(this,C).get(b);if(w===void 0)return;let x=q(this,I)[w],D=Oe(this,K,Ke).call(this,x)?x.__staleWhileFetching:x;if(D===void 0)return;let L={value:D};if(q(this,se)&&q(this,$)){let re=q(this,se)[w],H=q(this,$)[w];if(re&&H){let ee=re-(t.now()-H);L.ttl=ee,L.start=Date.now()}}return q(this,ue)&&(L.size=q(this,ue)[w]),L}dump(){let b=[];for(let w of Oe(this,K,Kt).call(this,{allowStale:!0})){let x=q(this,O)[w],D=q(this,I)[w],L=Oe(this,K,Ke).call(this,D)?D.__staleWhileFetching:D;if(L===void 0||x===void 0)continue;let re={value:L};if(q(this,se)&&q(this,$)){re.ttl=q(this,se)[w];let H=t.now()-q(this,$)[w];re.start=Math.floor(Date.now()-H)}q(this,ue)&&(re.size=q(this,ue)[w]),b.unshift([x,re])}return b}load(b){this.clear();for(let[w,x]of b){if(x.start){let D=Date.now()-x.start;x.start=t.now()-D}this.set(w,x.value,x)}}set(b,w,x={}){var Me,Xe,et,je,Ge;if(w===void 0)return this.delete(b),this;let{ttl:D=this.ttl,start:L,noDisposeOnSet:re=this.noDisposeOnSet,sizeCalculation:H=this.sizeCalculation,status:ee}=x,{noUpdateTTL:xe=this.noUpdateTTL}=x,Ve=q(this,z).call(this,b,w,x.size||0,H);if(this.maxEntrySize&&Ve>this.maxEntrySize)return ee&&(ee.set="miss",ee.maxEntrySizeExceeded=!0),Oe(this,K,Jt).call(this,b,"set"),this;let Pe=q(this,T)===0?void 0:q(this,C).get(b);if(Pe===void 0)Pe=q(this,T)===0?q(this,le):q(this,ne).length!==0?q(this,ne).pop():q(this,T)===q(this,g)?Oe(this,K,Cn).call(this,!1):q(this,T),q(this,O)[Pe]=b,q(this,I)[Pe]=w,q(this,C).set(b,Pe),q(this,U)[q(this,le)]=Pe,q(this,Y)[Pe]=q(this,le),Re(this,le,Pe),Nn(this,T)._++,q(this,Ee).call(this,Pe,Ve,ee),ee&&(ee.set="add"),xe=!1;else{Oe(this,K,Or).call(this,Pe);let De=q(this,I)[Pe];if(w!==De){if(q(this,Q)&&Oe(this,K,Ke).call(this,De)){De.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:Ue}=De;Ue!==void 0&&!re&&(q(this,M)&&((Me=q(this,_))==null||Me.call(this,Ue,b,"set")),q(this,me)&&((Xe=q(this,te))==null||Xe.push([Ue,b,"set"])))}else re||(q(this,M)&&((et=q(this,_))==null||et.call(this,De,b,"set")),q(this,me)&&((je=q(this,te))==null||je.push([De,b,"set"])));if(q(this,ie).call(this,Pe),q(this,Ee).call(this,Pe,Ve,ee),q(this,I)[Pe]=w,ee){ee.set="replace";let Ue=De&&Oe(this,K,Ke).call(this,De)?De.__staleWhileFetching:De;Ue!==void 0&&(ee.oldValue=Ue)}}else ee&&(ee.set="update")}if(D!==0&&!q(this,se)&&Oe(this,K,ss).call(this),q(this,se)&&(xe||q(this,ce).call(this,Pe,D,L),ee&&q(this,G).call(this,ee,Pe)),!re&&q(this,me)&&q(this,te)){let De=q(this,te),Ue;for(;Ue=De==null?void 0:De.shift();)(Ge=q(this,S))==null||Ge.call(this,...Ue)}return this}pop(){var b;try{for(;q(this,T);){let w=q(this,I)[q(this,j)];if(Oe(this,K,Cn).call(this,!0),Oe(this,K,Ke).call(this,w)){if(w.__staleWhileFetching)return w.__staleWhileFetching}else if(w!==void 0)return w}}finally{if(q(this,me)&&q(this,te)){let w=q(this,te),x;for(;x=w==null?void 0:w.shift();)(b=q(this,S))==null||b.call(this,...x)}}}has(b,w={}){let{updateAgeOnHas:x=this.updateAgeOnHas,status:D}=w,L=q(this,C).get(b);if(L!==void 0){let re=q(this,I)[L];if(Oe(this,K,Ke).call(this,re)&&re.__staleWhileFetching===void 0)return!1;if(q(this,X).call(this,L))D&&(D.has="stale",q(this,G).call(this,D,L));else return x&&q(this,Z).call(this,L),D&&(D.has="hit",q(this,G).call(this,D,L)),!0}else D&&(D.has="miss");return!1}peek(b,w={}){let{allowStale:x=this.allowStale}=w,D=q(this,C).get(b);if(D===void 0||!x&&q(this,X).call(this,D))return;let L=q(this,I)[D];return Oe(this,K,Ke).call(this,L)?L.__staleWhileFetching:L}async fetch(b,w={}){let{allowStale:x=this.allowStale,updateAgeOnGet:D=this.updateAgeOnGet,noDeleteOnStaleGet:L=this.noDeleteOnStaleGet,ttl:re=this.ttl,noDisposeOnSet:H=this.noDisposeOnSet,size:ee=0,sizeCalculation:xe=this.sizeCalculation,noUpdateTTL:Ve=this.noUpdateTTL,noDeleteOnFetchRejection:Pe=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:Me=this.allowStaleOnFetchRejection,ignoreFetchAbort:Xe=this.ignoreFetchAbort,allowStaleOnFetchAbort:et=this.allowStaleOnFetchAbort,context:je,forceRefresh:Ge=!1,status:De,signal:Ue}=w;if(!q(this,Q))return De&&(De.fetch="get"),this.get(b,{allowStale:x,updateAgeOnGet:D,noDeleteOnStaleGet:L,status:De});let qe={allowStale:x,updateAgeOnGet:D,noDeleteOnStaleGet:L,ttl:re,noDisposeOnSet:H,size:ee,sizeCalculation:xe,noUpdateTTL:Ve,noDeleteOnFetchRejection:Pe,allowStaleOnFetchRejection:Me,allowStaleOnFetchAbort:et,ignoreFetchAbort:Xe,status:De,signal:Ue},Ze=q(this,C).get(b);if(Ze===void 0){De&&(De.fetch="miss");let it=Oe(this,K,xn).call(this,b,Ze,qe,je);return it.__returned=it}else{let it=q(this,I)[Ze];if(Oe(this,K,Ke).call(this,it)){let Ne=x&&it.__staleWhileFetching!==void 0;return De&&(De.fetch="inflight",Ne&&(De.returnedStale=!0)),Ne?it.__staleWhileFetching:it.__returned=it}let wt=q(this,X).call(this,Ze);if(!Ge&&!wt)return De&&(De.fetch="hit"),Oe(this,K,Or).call(this,Ze),D&&q(this,Z).call(this,Ze),De&&q(this,G).call(this,De,Ze),it;let R=Oe(this,K,xn).call(this,b,Ze,qe,je),W=R.__staleWhileFetching!==void 0&&x;return De&&(De.fetch=wt?"stale":"refresh",W&&wt&&(De.returnedStale=!0)),W?R.__staleWhileFetching:R.__returned=R}}async forceFetch(b,w={}){let x=await this.fetch(b,w);if(x===void 0)throw new Error("fetch() returned undefined");return x}memo(b,w={}){let x=q(this,P);if(!x)throw new Error("no memoMethod provided to constructor");let{context:D,forceRefresh:L,...re}=w,H=this.get(b,re);if(!L&&H!==void 0)return H;let ee=x(b,H,{options:re,context:D});return this.set(b,ee,re),ee}get(b,w={}){let{allowStale:x=this.allowStale,updateAgeOnGet:D=this.updateAgeOnGet,noDeleteOnStaleGet:L=this.noDeleteOnStaleGet,status:re}=w,H=q(this,C).get(b);if(H!==void 0){let ee=q(this,I)[H],xe=Oe(this,K,Ke).call(this,ee);return re&&q(this,G).call(this,re,H),q(this,X).call(this,H)?(re&&(re.get="stale"),xe?(re&&x&&ee.__staleWhileFetching!==void 0&&(re.returnedStale=!0),x?ee.__staleWhileFetching:void 0):(L||Oe(this,K,Jt).call(this,b,"expire"),re&&x&&(re.returnedStale=!0),x?ee:void 0)):(re&&(re.get="hit"),xe?ee.__staleWhileFetching:(Oe(this,K,Or).call(this,H),D&&q(this,Z).call(this,H),ee))}else re&&(re.get="miss")}delete(b){return Oe(this,K,Jt).call(this,b,"delete")}clear(){return Oe(this,K,cs).call(this,"delete")}},g=new WeakMap,v=new WeakMap,_=new WeakMap,S=new WeakMap,B=new WeakMap,P=new WeakMap,T=new WeakMap,A=new WeakMap,C=new WeakMap,O=new WeakMap,I=new WeakMap,U=new WeakMap,Y=new WeakMap,j=new WeakMap,le=new WeakMap,ne=new WeakMap,te=new WeakMap,ue=new WeakMap,$=new WeakMap,se=new WeakMap,M=new WeakMap,Q=new WeakMap,me=new WeakMap,K=new WeakSet,ss=function(){let b=new u(q(this,g)),w=new u(q(this,g));Re(this,se,b),Re(this,$,w),Re(this,ce,(L,re,H=t.now())=>{if(w[L]=re!==0?H:0,b[L]=re,re!==0&&this.ttlAutopurge){let ee=setTimeout(()=>{q(this,X).call(this,L)&&Oe(this,K,Jt).call(this,q(this,O)[L],"expire")},re+1);ee.unref&&ee.unref()}}),Re(this,Z,L=>{w[L]=b[L]!==0?t.now():0}),Re(this,G,(L,re)=>{if(b[re]){let H=b[re],ee=w[re];if(!H||!ee)return;L.ttl=H,L.start=ee,L.now=x||D();let xe=L.now-ee;L.remainingTTL=H-xe}});let x=0,D=()=>{let L=t.now();if(this.ttlResolution>0){x=L;let re=setTimeout(()=>x=0,this.ttlResolution);re.unref&&re.unref()}return L};this.getRemainingTTL=L=>{let re=q(this,C).get(L);if(re===void 0)return 0;let H=b[re],ee=w[re];if(!H||!ee)return 1/0;let xe=(x||D())-ee;return H-xe},Re(this,X,L=>{let re=w[L],H=b[L];return!!H&&!!re&&(x||D())-re>H})},Z=new WeakMap,G=new WeakMap,ce=new WeakMap,X=new WeakMap,bc=function(){let b=new u(q(this,g));Re(this,A,0),Re(this,ue,b),Re(this,ie,w=>{Re(this,A,q(this,A)-b[w]),b[w]=0}),Re(this,z,(w,x,D,L)=>{if(Oe(this,K,Ke).call(this,x))return 0;if(!l(D))if(L){if(typeof L!="function")throw new TypeError("sizeCalculation must be a function");if(D=L(x,w),!l(D))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return D}),Re(this,Ee,(w,x,D)=>{if(b[w]=x,q(this,v)){let L=q(this,v)-b[w];for(;q(this,A)>L;)Oe(this,K,Cn).call(this,!0)}Re(this,A,q(this,A)+b[w]),D&&(D.entrySize=x,D.totalCalculatedSize=q(this,A))})},ie=new WeakMap,Ee=new WeakMap,z=new WeakMap,Kt=function*({allowStale:b=this.allowStale}={}){if(q(this,T))for(let w=q(this,le);!(!Oe(this,K,as).call(this,w)||((b||!q(this,X).call(this,w))&&(yield w),w===q(this,j)));)w=q(this,Y)[w]},Yt=function*({allowStale:b=this.allowStale}={}){if(q(this,T))for(let w=q(this,j);!(!Oe(this,K,as).call(this,w)||((b||!q(this,X).call(this,w))&&(yield w),w===q(this,le)));)w=q(this,U)[w]},as=function(b){return b!==void 0&&q(this,C).get(q(this,O)[b])===b},Cn=function(b){var L,re;let w=q(this,j),x=q(this,O)[w],D=q(this,I)[w];return q(this,Q)&&Oe(this,K,Ke).call(this,D)?D.__abortController.abort(new Error("evicted")):(q(this,M)||q(this,me))&&(q(this,M)&&((L=q(this,_))==null||L.call(this,D,x,"evict")),q(this,me)&&((re=q(this,te))==null||re.push([D,x,"evict"]))),q(this,ie).call(this,w),b&&(q(this,O)[w]=void 0,q(this,I)[w]=void 0,q(this,ne).push(w)),q(this,T)===1?(Re(this,j,Re(this,le,0)),q(this,ne).length=0):Re(this,j,q(this,U)[w]),q(this,C).delete(x),Nn(this,T)._--,w},xn=function(b,w,x,D){let L=w===void 0?void 0:q(this,I)[w];if(Oe(this,K,Ke).call(this,L))return L;let re=new s,{signal:H}=x;H==null||H.addEventListener("abort",()=>re.abort(H.reason),{signal:re.signal});let ee={signal:re.signal,options:x,context:D},xe=(je,Ge=!1)=>{let{aborted:De}=re.signal,Ue=x.ignoreFetchAbort&&je!==void 0;if(x.status&&(De&&!Ge?(x.status.fetchAborted=!0,x.status.fetchError=re.signal.reason,Ue&&(x.status.fetchAbortIgnored=!0)):x.status.fetchResolved=!0),De&&!Ue&&!Ge)return Pe(re.signal.reason);let qe=Xe;return q(this,I)[w]===Xe&&(je===void 0?qe.__staleWhileFetching?q(this,I)[w]=qe.__staleWhileFetching:Oe(this,K,Jt).call(this,b,"fetch"):(x.status&&(x.status.fetchUpdated=!0),this.set(b,je,ee.options))),je},Ve=je=>(x.status&&(x.status.fetchRejected=!0,x.status.fetchError=je),Pe(je)),Pe=je=>{let{aborted:Ge}=re.signal,De=Ge&&x.allowStaleOnFetchAbort,Ue=De||x.allowStaleOnFetchRejection,qe=Ue||x.noDeleteOnFetchRejection,Ze=Xe;if(q(this,I)[w]===Xe&&(!qe||Ze.__staleWhileFetching===void 0?Oe(this,K,Jt).call(this,b,"fetch"):De||(q(this,I)[w]=Ze.__staleWhileFetching)),Ue)return x.status&&Ze.__staleWhileFetching!==void 0&&(x.status.returnedStale=!0),Ze.__staleWhileFetching;if(Ze.__returned===Ze)throw je},Me=(je,Ge)=>{var Ue;let De=(Ue=q(this,B))==null?void 0:Ue.call(this,b,L,ee);De&&De instanceof Promise&&De.then(qe=>je(qe===void 0?void 0:qe),Ge),re.signal.addEventListener("abort",()=>{(!x.ignoreFetchAbort||x.allowStaleOnFetchAbort)&&(je(void 0),x.allowStaleOnFetchAbort&&(je=qe=>xe(qe,!0)))})};x.status&&(x.status.fetchDispatched=!0);let Xe=new Promise(Me).then(xe,Ve),et=Object.assign(Xe,{__abortController:re,__staleWhileFetching:L,__returned:void 0});return w===void 0?(this.set(b,et,{...ee.options,status:void 0}),w=q(this,C).get(b)):q(this,I)[w]=et,et},Ke=function(b){if(!q(this,Q))return!1;let w=b;return!!w&&w instanceof Promise&&w.hasOwnProperty("__staleWhileFetching")&&w.__abortController instanceof s},ls=function(b,w){q(this,Y)[w]=b,q(this,U)[b]=w},Or=function(b){b!==q(this,le)&&(b===q(this,j)?Re(this,j,q(this,U)[b]):Oe(this,K,ls).call(this,q(this,Y)[b],q(this,U)[b]),Oe(this,K,ls).call(this,q(this,le),b),Re(this,le,b))},Jt=function(b,w){var D,L,re,H;let x=!1;if(q(this,T)!==0){let ee=q(this,C).get(b);if(ee!==void 0)if(x=!0,q(this,T)===1)Oe(this,K,cs).call(this,w);else{q(this,ie).call(this,ee);let xe=q(this,I)[ee];if(Oe(this,K,Ke).call(this,xe)?xe.__abortController.abort(new Error("deleted")):(q(this,M)||q(this,me))&&(q(this,M)&&((D=q(this,_))==null||D.call(this,xe,b,w)),q(this,me)&&((L=q(this,te))==null||L.push([xe,b,w]))),q(this,C).delete(b),q(this,O)[ee]=void 0,q(this,I)[ee]=void 0,ee===q(this,le))Re(this,le,q(this,Y)[ee]);else if(ee===q(this,j))Re(this,j,q(this,U)[ee]);else{let Ve=q(this,Y)[ee];q(this,U)[Ve]=q(this,U)[ee];let Pe=q(this,U)[ee];q(this,Y)[Pe]=q(this,Y)[ee]}Nn(this,T)._--,q(this,ne).push(ee)}}if(q(this,me)&&((re=q(this,te))!=null&&re.length)){let ee=q(this,te),xe;for(;xe=ee==null?void 0:ee.shift();)(H=q(this,S))==null||H.call(this,...xe)}return x},cs=function(b){var w,x,D;for(let L of Oe(this,K,Yt).call(this,{allowStale:!0})){let re=q(this,I)[L];if(Oe(this,K,Ke).call(this,re))re.__abortController.abort(new Error("deleted"));else{let H=q(this,O)[L];q(this,M)&&((w=q(this,_))==null||w.call(this,re,H,b)),q(this,me)&&((x=q(this,te))==null||x.push([re,H,b]))}}if(q(this,C).clear(),q(this,I).fill(void 0),q(this,O).fill(void 0),q(this,se)&&q(this,$)&&(q(this,se).fill(0),q(this,$).fill(0)),q(this,ue)&&q(this,ue).fill(0),Re(this,j,0),Re(this,le,0),q(this,ne).length=0,Re(this,A,0),Re(this,T,0),q(this,me)&&q(this,te)){let L=q(this,te),re;for(;re=L==null?void 0:L.shift();)(D=q(this,S))==null||D.call(this,...re)}},Ce);d.LRUCache=h}),Vt=_e(d=>{be(),ve(),we(),Object.defineProperty(d,"t",{value:!0}),d.ContainerIterator=d.Container=d.Base=void 0;var t=class{constructor(i=0){this.iteratorType=i}equals(i){return this.o===i.o}};d.ContainerIterator=t;var r=class{constructor(){this.i=0}get length(){return this.i}size(){return this.i}empty(){return this.i===0}};d.Base=r;var n=class extends r{};d.Container=n}),zf=_e(d=>{be(),ve(),we(),Object.defineProperty(d,"t",{value:!0}),d.default=void 0;var t=Vt(),r=class extends t.Base{constructor(i=[]){super(),this.S=[];let s=this;i.forEach(function(o){s.push(o)})}clear(){this.i=0,this.S=[]}push(i){return this.S.push(i),this.i+=1,this.i}pop(){if(this.i!==0)return this.i-=1,this.S.pop()}top(){return this.S[this.i-1]}},n=r;d.default=n}),Wf=_e(d=>{be(),ve(),we(),Object.defineProperty(d,"t",{value:!0}),d.default=void 0;var t=Vt(),r=class extends t.Base{constructor(i=[]){super(),this.j=0,this.q=[];let s=this;i.forEach(function(o){s.push(o)})}clear(){this.q=[],this.i=this.j=0}push(i){let s=this.q.length;if(this.j/s>.5&&this.j+this.i>=s&&s>4096){let o=this.i;for(let a=0;a<o;++a)this.q[a]=this.q[this.j+a];this.j=0,this.q[this.i]=i}else this.q[this.j+this.i]=i;return++this.i}pop(){if(this.i===0)return;let i=this.q[this.j++];return this.i-=1,i}front(){if(this.i!==0)return this.q[this.j]}},n=r;d.default=n}),qf=_e(d=>{be(),ve(),we(),Object.defineProperty(d,"t",{value:!0}),d.default=void 0;var t=Vt(),r=class extends t.Base{constructor(i=[],s=function(a,l){return a>l?-1:a<l?1:0},o=!0){if(super(),this.v=s,Array.isArray(i))this.C=o?[...i]:i;else{this.C=[];let l=this;i.forEach(function(c){l.C.push(c)})}this.i=this.C.length;let a=this.i>>1;for(let l=this.i-1>>1;l>=0;--l)this.k(l,a)}m(i){let s=this.C[i];for(;i>0;){let o=i-1>>1,a=this.C[o];if(this.v(a,s)<=0)break;this.C[i]=a,i=o}this.C[i]=s}k(i,s){let o=this.C[i];for(;i<s;){let a=i<<1|1,l=a+1,c=this.C[a];if(l<this.i&&this.v(c,this.C[l])>0&&(a=l,c=this.C[l]),this.v(c,o)>=0)break;this.C[i]=c,i=a}this.C[i]=o}clear(){this.i=0,this.C.length=0}push(i){this.C.push(i),this.m(this.i),this.i+=1}pop(){if(this.i===0)return;let i=this.C[0],s=this.C.pop();return this.i-=1,this.i&&(this.C[0]=s,this.k(0,this.i>>1)),i}top(){return this.C[0]}find(i){return this.C.indexOf(i)>=0}remove(i){let s=this.C.indexOf(i);return s<0?!1:(s===0?this.pop():s===this.i-1?(this.C.pop(),this.i-=1):(this.C.splice(s,1,this.C.pop()),this.i-=1,this.m(s),this.k(s,this.i>>1)),!0)}updateItem(i){let s=this.C.indexOf(i);return s<0?!1:(this.m(s),this.k(s,this.i>>1),!0)}toArray(){return[...this.C]}},n=r;d.default=n}),Jo=_e(d=>{be(),ve(),we(),Object.defineProperty(d,"t",{value:!0}),d.default=void 0;var t=Vt(),r=class extends t.Container{},n=r;d.default=n}),Pt=_e(d=>{be(),ve(),we(),Object.defineProperty(d,"t",{value:!0}),d.throwIteratorAccessError=t;function t(){throw new RangeError("Iterator access denied!")}}),Qs=_e(d=>{be(),ve(),we(),Object.defineProperty(d,"t",{value:!0}),d.RandomIterator=void 0;var t=Vt(),r=Pt(),n=class extends t.ContainerIterator{constructor(i,s){super(s),this.o=i,this.iteratorType===0?(this.pre=function(){return this.o===0&&(0,r.throwIteratorAccessError)(),this.o-=1,this},this.next=function(){return this.o===this.container.size()&&(0,r.throwIteratorAccessError)(),this.o+=1,this}):(this.pre=function(){return this.o===this.container.size()-1&&(0,r.throwIteratorAccessError)(),this.o+=1,this},this.next=function(){return this.o===-1&&(0,r.throwIteratorAccessError)(),this.o-=1,this})}get pointer(){return this.container.getElementByPos(this.o)}set pointer(i){this.container.setElementByPos(this.o,i)}};d.RandomIterator=n}),Gf=_e(d=>{be(),ve(),we(),Object.defineProperty(d,"t",{value:!0}),d.default=void 0;var t=n(Jo()),r=Qs();function n(a){return a&&a.t?a:{default:a}}var i=class wc extends r.RandomIterator{constructor(l,c,u){super(l,u),this.container=c}copy(){return new wc(this.o,this.container,this.iteratorType)}},s=class extends t.default{constructor(a=[],l=!0){if(super(),Array.isArray(a))this.J=l?[...a]:a,this.i=a.length;else{this.J=[];let c=this;a.forEach(function(u){c.pushBack(u)})}}clear(){this.i=0,this.J.length=0}begin(){return new i(0,this)}end(){return new i(this.i,this)}rBegin(){return new i(this.i-1,this,1)}rEnd(){return new i(-1,this,1)}front(){return this.J[0]}back(){return this.J[this.i-1]}getElementByPos(a){if(a<0||a>this.i-1)throw new RangeError;return this.J[a]}eraseElementByPos(a){if(a<0||a>this.i-1)throw new RangeError;return this.J.splice(a,1),this.i-=1,this.i}eraseElementByValue(a){let l=0;for(let c=0;c<this.i;++c)this.J[c]!==a&&(this.J[l++]=this.J[c]);return this.i=this.J.length=l,this.i}eraseElementByIterator(a){let l=a.o;return a=a.next(),this.eraseElementByPos(l),a}pushBack(a){return this.J.push(a),this.i+=1,this.i}popBack(){if(this.i!==0)return this.i-=1,this.J.pop()}setElementByPos(a,l){if(a<0||a>this.i-1)throw new RangeError;this.J[a]=l}insert(a,l,c=1){if(a<0||a>this.i)throw new RangeError;return this.J.splice(a,0,...new Array(c).fill(l)),this.i+=c,this.i}find(a){for(let l=0;l<this.i;++l)if(this.J[l]===a)return new i(l,this);return this.end()}reverse(){this.J.reverse()}unique(){let a=1;for(let l=1;l<this.i;++l)this.J[l]!==this.J[l-1]&&(this.J[a++]=this.J[l]);return this.i=this.J.length=a,this.i}sort(a){this.J.sort(a)}forEach(a){for(let l=0;l<this.i;++l)a(this.J[l],l,this)}[Symbol.iterator](){return(function*(){yield*this.J}).bind(this)()}},o=s;d.default=o}),Hf=_e(d=>{be(),ve(),we(),Object.defineProperty(d,"t",{value:!0}),d.default=void 0;var t=i(Jo()),r=Vt(),n=Pt();function i(l){return l&&l.t?l:{default:l}}var s=class vc extends r.ContainerIterator{constructor(c,u,p,h){super(h),this.o=c,this.h=u,this.container=p,this.iteratorType===0?(this.pre=function(){return this.o.L===this.h&&(0,n.throwIteratorAccessError)(),this.o=this.o.L,this},this.next=function(){return this.o===this.h&&(0,n.throwIteratorAccessError)(),this.o=this.o.B,this}):(this.pre=function(){return this.o.B===this.h&&(0,n.throwIteratorAccessError)(),this.o=this.o.B,this},this.next=function(){return this.o===this.h&&(0,n.throwIteratorAccessError)(),this.o=this.o.L,this})}get pointer(){return this.o===this.h&&(0,n.throwIteratorAccessError)(),this.o.l}set pointer(c){this.o===this.h&&(0,n.throwIteratorAccessError)(),this.o.l=c}copy(){return new vc(this.o,this.h,this.container,this.iteratorType)}},o=class extends t.default{constructor(l=[]){super(),this.h={},this.p=this._=this.h.L=this.h.B=this.h;let c=this;l.forEach(function(u){c.pushBack(u)})}V(l){let{L:c,B:u}=l;c.B=u,u.L=c,l===this.p&&(this.p=u),l===this._&&(this._=c),this.i-=1}G(l,c){let u=c.B,p={l,L:c,B:u};c.B=p,u.L=p,c===this.h&&(this.p=p),u===this.h&&(this._=p),this.i+=1}clear(){this.i=0,this.p=this._=this.h.L=this.h.B=this.h}begin(){return new s(this.p,this.h,this)}end(){return new s(this.h,this.h,this)}rBegin(){return new s(this._,this.h,this,1)}rEnd(){return new s(this.h,this.h,this,1)}front(){return this.p.l}back(){return this._.l}getElementByPos(l){if(l<0||l>this.i-1)throw new RangeError;let c=this.p;for(;l--;)c=c.B;return c.l}eraseElementByPos(l){if(l<0||l>this.i-1)throw new RangeError;let c=this.p;for(;l--;)c=c.B;return this.V(c),this.i}eraseElementByValue(l){let c=this.p;for(;c!==this.h;)c.l===l&&this.V(c),c=c.B;return this.i}eraseElementByIterator(l){let c=l.o;return c===this.h&&(0,n.throwIteratorAccessError)(),l=l.next(),this.V(c),l}pushBack(l){return this.G(l,this._),this.i}popBack(){if(this.i===0)return;let l=this._.l;return this.V(this._),l}pushFront(l){return this.G(l,this.h),this.i}popFront(){if(this.i===0)return;let l=this.p.l;return this.V(this.p),l}setElementByPos(l,c){if(l<0||l>this.i-1)throw new RangeError;let u=this.p;for(;l--;)u=u.B;u.l=c}insert(l,c,u=1){if(l<0||l>this.i)throw new RangeError;if(u<=0)return this.i;if(l===0)for(;u--;)this.pushFront(c);else if(l===this.i)for(;u--;)this.pushBack(c);else{let p=this.p;for(let m=1;m<l;++m)p=p.B;let h=p.B;for(this.i+=u;u--;)p.B={l:c,L:p},p.B.L=p,p=p.B;p.B=h,h.L=p}return this.i}find(l){let c=this.p;for(;c!==this.h;){if(c.l===l)return new s(c,this.h,this);c=c.B}return this.end()}reverse(){if(this.i<=1)return;let l=this.p,c=this._,u=0;for(;u<<1<this.i;){let p=l.l;l.l=c.l,c.l=p,l=l.B,c=c.L,u+=1}}unique(){if(this.i<=1)return this.i;let l=this.p;for(;l!==this.h;){let c=l;for(;c.B!==this.h&&c.l===c.B.l;)c=c.B,this.i-=1;l.B=c.B,l.B.L=l,l=l.B}return this.i}sort(l){if(this.i<=1)return;let c=[];this.forEach(function(p){c.push(p)}),c.sort(l);let u=this.p;c.forEach(function(p){u.l=p,u=u.B})}merge(l){let c=this;if(this.i===0)l.forEach(function(u){c.pushBack(u)});else{let u=this.p;l.forEach(function(p){for(;u!==c.h&&u.l<=p;)u=u.B;c.G(p,u.L)})}return this.i}forEach(l){let c=this.p,u=0;for(;c!==this.h;)l(c.l,u++,this),c=c.B}[Symbol.iterator](){return(function*(){if(this.i===0)return;let l=this.p;for(;l!==this.h;)yield l.l,l=l.B}).bind(this)()}},a=o;d.default=a}),Kf=_e(d=>{be(),ve(),we(),Object.defineProperty(d,"t",{value:!0}),d.default=void 0;var t=n(Jo()),r=Qs();function n(a){return a&&a.t?a:{default:a}}var i=class Ec extends r.RandomIterator{constructor(l,c,u){super(l,u),this.container=c}copy(){return new Ec(this.o,this.container,this.iteratorType)}},s=class extends t.default{constructor(a=[],l=4096){super(),this.j=0,this.D=0,this.R=0,this.N=0,this.P=0,this.A=[];let c=(()=>{if(typeof a.length=="number")return a.length;if(typeof a.size=="number")return a.size;if(typeof a.size=="function")return a.size();throw new TypeError("Cannot get the length or size of the container")})();this.F=l,this.P=Math.max(Math.ceil(c/this.F),1);for(let h=0;h<this.P;++h)this.A.push(new Array(this.F));let u=Math.ceil(c/this.F);this.j=this.R=(this.P>>1)-(u>>1),this.D=this.N=this.F-c%this.F>>1;let p=this;a.forEach(function(h){p.pushBack(h)})}T(){let a=[],l=Math.max(this.P>>1,1);for(let c=0;c<l;++c)a[c]=new Array(this.F);for(let c=this.j;c<this.P;++c)a[a.length]=this.A[c];for(let c=0;c<this.R;++c)a[a.length]=this.A[c];a[a.length]=[...this.A[this.R]],this.j=l,this.R=a.length-1;for(let c=0;c<l;++c)a[a.length]=new Array(this.F);this.A=a,this.P=a.length}O(a){let l=this.D+a+1,c=l%this.F,u=c-1,p=this.j+(l-c)/this.F;return c===0&&(p-=1),p%=this.P,u<0&&(u+=this.F),{curNodeBucketIndex:p,curNodePointerIndex:u}}clear(){this.A=[new Array(this.F)],this.P=1,this.j=this.R=this.i=0,this.D=this.N=this.F>>1}begin(){return new i(0,this)}end(){return new i(this.i,this)}rBegin(){return new i(this.i-1,this,1)}rEnd(){return new i(-1,this,1)}front(){if(this.i!==0)return this.A[this.j][this.D]}back(){if(this.i!==0)return this.A[this.R][this.N]}pushBack(a){return this.i&&(this.N<this.F-1?this.N+=1:this.R<this.P-1?(this.R+=1,this.N=0):(this.R=0,this.N=0),this.R===this.j&&this.N===this.D&&this.T()),this.i+=1,this.A[this.R][this.N]=a,this.i}popBack(){if(this.i===0)return;let a=this.A[this.R][this.N];return this.i!==1&&(this.N>0?this.N-=1:this.R>0?(this.R-=1,this.N=this.F-1):(this.R=this.P-1,this.N=this.F-1)),this.i-=1,a}pushFront(a){return this.i&&(this.D>0?this.D-=1:this.j>0?(this.j-=1,this.D=this.F-1):(this.j=this.P-1,this.D=this.F-1),this.j===this.R&&this.D===this.N&&this.T()),this.i+=1,this.A[this.j][this.D]=a,this.i}popFront(){if(this.i===0)return;let a=this.A[this.j][this.D];return this.i!==1&&(this.D<this.F-1?this.D+=1:this.j<this.P-1?(this.j+=1,this.D=0):(this.j=0,this.D=0)),this.i-=1,a}getElementByPos(a){if(a<0||a>this.i-1)throw new RangeError;let{curNodeBucketIndex:l,curNodePointerIndex:c}=this.O(a);return this.A[l][c]}setElementByPos(a,l){if(a<0||a>this.i-1)throw new RangeError;let{curNodeBucketIndex:c,curNodePointerIndex:u}=this.O(a);this.A[c][u]=l}insert(a,l,c=1){if(a<0||a>this.i)throw new RangeError;if(a===0)for(;c--;)this.pushFront(l);else if(a===this.i)for(;c--;)this.pushBack(l);else{let u=[];for(let p=a;p<this.i;++p)u.push(this.getElementByPos(p));this.cut(a-1);for(let p=0;p<c;++p)this.pushBack(l);for(let p=0;p<u.length;++p)this.pushBack(u[p])}return this.i}cut(a){if(a<0)return this.clear(),0;let{curNodeBucketIndex:l,curNodePointerIndex:c}=this.O(a);return this.R=l,this.N=c,this.i=a+1,this.i}eraseElementByPos(a){if(a<0||a>this.i-1)throw new RangeError;if(a===0)this.popFront();else if(a===this.i-1)this.popBack();else{let l=[];for(let u=a+1;u<this.i;++u)l.push(this.getElementByPos(u));this.cut(a),this.popBack();let c=this;l.forEach(function(u){c.pushBack(u)})}return this.i}eraseElementByValue(a){if(this.i===0)return 0;let l=[];for(let u=0;u<this.i;++u){let p=this.getElementByPos(u);p!==a&&l.push(p)}let c=l.length;for(let u=0;u<c;++u)this.setElementByPos(u,l[u]);return this.cut(c-1)}eraseElementByIterator(a){let l=a.o;return this.eraseElementByPos(l),a=a.next(),a}find(a){for(let l=0;l<this.i;++l)if(this.getElementByPos(l)===a)return new i(l,this);return this.end()}reverse(){let a=0,l=this.i-1;for(;a<l;){let c=this.getElementByPos(a);this.setElementByPos(a,this.getElementByPos(l)),this.setElementByPos(l,c),a+=1,l-=1}}unique(){if(this.i<=1)return this.i;let a=1,l=this.getElementByPos(0);for(let c=1;c<this.i;++c){let u=this.getElementByPos(c);u!==l&&(l=u,this.setElementByPos(a++,u))}for(;this.i>a;)this.popBack();return this.i}sort(a){let l=[];for(let c=0;c<this.i;++c)l.push(this.getElementByPos(c));l.sort(a);for(let c=0;c<this.i;++c)this.setElementByPos(c,l[c])}shrinkToFit(){if(this.i===0)return;let a=[];this.forEach(function(l){a.push(l)}),this.P=Math.max(Math.ceil(this.i/this.F),1),this.i=this.j=this.R=this.D=this.N=0,this.A=[];for(let l=0;l<this.P;++l)this.A.push(new Array(this.F));for(let l=0;l<a.length;++l)this.pushBack(a[l])}forEach(a){for(let l=0;l<this.i;++l)a(this.getElementByPos(l),l,this)}[Symbol.iterator](){return(function*(){for(let a=0;a<this.i;++a)yield this.getElementByPos(a)}).bind(this)()}},o=s;d.default=o}),Yf=_e(d=>{be(),ve(),we(),Object.defineProperty(d,"t",{value:!0}),d.TreeNodeEnableIndex=d.TreeNode=void 0;var t=class{constructor(n,i){this.ee=1,this.u=void 0,this.l=void 0,this.U=void 0,this.W=void 0,this.tt=void 0,this.u=n,this.l=i}L(){let n=this;if(n.ee===1&&n.tt.tt===n)n=n.W;else if(n.U)for(n=n.U;n.W;)n=n.W;else{let i=n.tt;for(;i.U===n;)n=i,i=n.tt;n=i}return n}B(){let n=this;if(n.W){for(n=n.W;n.U;)n=n.U;return n}else{let i=n.tt;for(;i.W===n;)n=i,i=n.tt;return n.W!==i?i:n}}te(){let n=this.tt,i=this.W,s=i.U;return n.tt===this?n.tt=i:n.U===this?n.U=i:n.W=i,i.tt=n,i.U=this,this.tt=i,this.W=s,s&&(s.tt=this),i}se(){let n=this.tt,i=this.U,s=i.W;return n.tt===this?n.tt=i:n.U===this?n.U=i:n.W=i,i.tt=n,i.W=this,this.tt=i,this.U=s,s&&(s.tt=this),i}};d.TreeNode=t;var r=class extends t{constructor(){super(...arguments),this.rt=1}te(){let n=super.te();return this.ie(),n.ie(),n}se(){let n=super.se();return this.ie(),n.ie(),n}ie(){this.rt=1,this.U&&(this.rt+=this.U.rt),this.W&&(this.rt+=this.W.rt)}};d.TreeNodeEnableIndex=r}),Xs=_e(d=>{be(),ve(),we(),Object.defineProperty(d,"t",{value:!0}),d.default=void 0;var t=Yf(),r=Vt(),n=Pt(),i=class extends r.Container{constructor(o=function(l,c){return l<c?-1:l>c?1:0},a=!1){super(),this.Y=void 0,this.v=o,a?(this.re=t.TreeNodeEnableIndex,this.M=function(l,c,u){let p=this.ne(l,c,u);if(p){let h=p.tt;for(;h!==this.h;)h.rt+=1,h=h.tt;let m=this.he(p);if(m){let{parentNode:f,grandParent:E,curNode:N}=m;f.ie(),E.ie(),N.ie()}}return this.i},this.V=function(l){let c=this.fe(l);for(;c!==this.h;)c.rt-=1,c=c.tt}):(this.re=t.TreeNode,this.M=function(l,c,u){let p=this.ne(l,c,u);return p&&this.he(p),this.i},this.V=this.fe),this.h=new this.re}X(o,a){let l=this.h;for(;o;){let c=this.v(o.u,a);if(c<0)o=o.W;else if(c>0)l=o,o=o.U;else return o}return l}Z(o,a){let l=this.h;for(;o;)this.v(o.u,a)<=0?o=o.W:(l=o,o=o.U);return l}$(o,a){let l=this.h;for(;o;){let c=this.v(o.u,a);if(c<0)l=o,o=o.W;else if(c>0)o=o.U;else return o}return l}rr(o,a){let l=this.h;for(;o;)this.v(o.u,a)<0?(l=o,o=o.W):o=o.U;return l}ue(o){for(;;){let a=o.tt;if(a===this.h)return;if(o.ee===1){o.ee=0;return}if(o===a.U){let l=a.W;if(l.ee===1)l.ee=0,a.ee=1,a===this.Y?this.Y=a.te():a.te();else if(l.W&&l.W.ee===1){l.ee=a.ee,a.ee=0,l.W.ee=0,a===this.Y?this.Y=a.te():a.te();return}else l.U&&l.U.ee===1?(l.ee=1,l.U.ee=0,l.se()):(l.ee=1,o=a)}else{let l=a.U;if(l.ee===1)l.ee=0,a.ee=1,a===this.Y?this.Y=a.se():a.se();else if(l.U&&l.U.ee===1){l.ee=a.ee,a.ee=0,l.U.ee=0,a===this.Y?this.Y=a.se():a.se();return}else l.W&&l.W.ee===1?(l.ee=1,l.W.ee=0,l.te()):(l.ee=1,o=a)}}}fe(o){if(this.i===1)return this.clear(),this.h;let a=o;for(;a.U||a.W;){if(a.W)for(a=a.W;a.U;)a=a.U;else a=a.U;[o.u,a.u]=[a.u,o.u],[o.l,a.l]=[a.l,o.l],o=a}this.h.U===a?this.h.U=a.tt:this.h.W===a&&(this.h.W=a.tt),this.ue(a);let l=a.tt;return a===l.U?l.U=void 0:l.W=void 0,this.i-=1,this.Y.ee=0,l}oe(o,a){return o===void 0?!1:this.oe(o.U,a)||a(o)?!0:this.oe(o.W,a)}he(o){for(;;){let a=o.tt;if(a.ee===0)return;let l=a.tt;if(a===l.U){let c=l.W;if(c&&c.ee===1){if(c.ee=a.ee=0,l===this.Y)return;l.ee=1,o=l;continue}else if(o===a.W){if(o.ee=0,o.U&&(o.U.tt=a),o.W&&(o.W.tt=l),a.W=o.U,l.U=o.W,o.U=a,o.W=l,l===this.Y)this.Y=o,this.h.tt=o;else{let u=l.tt;u.U===l?u.U=o:u.W=o}return o.tt=l.tt,a.tt=o,l.tt=o,l.ee=1,{parentNode:a,grandParent:l,curNode:o}}else a.ee=0,l===this.Y?this.Y=l.se():l.se(),l.ee=1}else{let c=l.U;if(c&&c.ee===1){if(c.ee=a.ee=0,l===this.Y)return;l.ee=1,o=l;continue}else if(o===a.U){if(o.ee=0,o.U&&(o.U.tt=l),o.W&&(o.W.tt=a),l.W=o.U,a.U=o.W,o.U=l,o.W=a,l===this.Y)this.Y=o,this.h.tt=o;else{let u=l.tt;u.U===l?u.U=o:u.W=o}return o.tt=l.tt,a.tt=o,l.tt=o,l.ee=1,{parentNode:a,grandParent:l,curNode:o}}else a.ee=0,l===this.Y?this.Y=l.te():l.te(),l.ee=1}return}}ne(o,a,l){if(this.Y===void 0){this.i+=1,this.Y=new this.re(o,a),this.Y.ee=0,this.Y.tt=this.h,this.h.tt=this.Y,this.h.U=this.Y,this.h.W=this.Y;return}let c,u=this.h.U,p=this.v(u.u,o);if(p===0){u.l=a;return}else if(p>0)u.U=new this.re(o,a),u.U.tt=u,c=u.U,this.h.U=c;else{let h=this.h.W,m=this.v(h.u,o);if(m===0){h.l=a;return}else if(m<0)h.W=new this.re(o,a),h.W.tt=h,c=h.W,this.h.W=c;else{if(l!==void 0){let f=l.o;if(f!==this.h){let E=this.v(f.u,o);if(E===0){f.l=a;return}else if(E>0){let N=f.L(),k=this.v(N.u,o);if(k===0){N.l=a;return}else k<0&&(c=new this.re(o,a),N.W===void 0?(N.W=c,c.tt=N):(f.U=c,c.tt=f))}}}if(c===void 0)for(c=this.Y;;){let f=this.v(c.u,o);if(f>0){if(c.U===void 0){c.U=new this.re(o,a),c.U.tt=c,c=c.U;break}c=c.U}else if(f<0){if(c.W===void 0){c.W=new this.re(o,a),c.W.tt=c,c=c.W;break}c=c.W}else{c.l=a;return}}}}return this.i+=1,c}I(o,a){for(;o;){let l=this.v(o.u,a);if(l<0)o=o.W;else if(l>0)o=o.U;else return o}return o||this.h}clear(){this.i=0,this.Y=void 0,this.h.tt=void 0,this.h.U=this.h.W=void 0}updateKeyByIterator(o,a){let l=o.o;if(l===this.h&&(0,n.throwIteratorAccessError)(),this.i===1)return l.u=a,!0;if(l===this.h.U)return this.v(l.B().u,a)>0?(l.u=a,!0):!1;if(l===this.h.W)return this.v(l.L().u,a)<0?(l.u=a,!0):!1;let c=l.L().u;if(this.v(c,a)>=0)return!1;let u=l.B().u;return this.v(u,a)<=0?!1:(l.u=a,!0)}eraseElementByPos(o){if(o<0||o>this.i-1)throw new RangeError;let a=0,l=this;return this.oe(this.Y,function(c){return o===a?(l.V(c),!0):(a+=1,!1)}),this.i}eraseElementByKey(o){if(this.i===0)return!1;let a=this.I(this.Y,o);return a===this.h?!1:(this.V(a),!0)}eraseElementByIterator(o){let a=o.o;a===this.h&&(0,n.throwIteratorAccessError)();let l=a.W===void 0;return o.iteratorType===0?l&&o.next():(!l||a.U===void 0)&&o.next(),this.V(a),o}forEach(o){let a=0;for(let l of this)o(l,a++,this)}getElementByPos(o){if(o<0||o>this.i-1)throw new RangeError;let a,l=0;for(let c of this){if(l===o){a=c;break}l+=1}return a}getHeight(){if(this.i===0)return 0;let o=function(a){return a?Math.max(o(a.U),o(a.W))+1:0};return o(this.Y)}},s=i;d.default=s}),Zs=_e(d=>{be(),ve(),we(),Object.defineProperty(d,"t",{value:!0}),d.default=void 0;var t=Vt(),r=Pt(),n=class extends t.ContainerIterator{constructor(s,o,a){super(a),this.o=s,this.h=o,this.iteratorType===0?(this.pre=function(){return this.o===this.h.U&&(0,r.throwIteratorAccessError)(),this.o=this.o.L(),this},this.next=function(){return this.o===this.h&&(0,r.throwIteratorAccessError)(),this.o=this.o.B(),this}):(this.pre=function(){return this.o===this.h.W&&(0,r.throwIteratorAccessError)(),this.o=this.o.B(),this},this.next=function(){return this.o===this.h&&(0,r.throwIteratorAccessError)(),this.o=this.o.L(),this})}get index(){let s=this.o,o=this.h.tt;if(s===this.h)return o?o.rt-1:0;let a=0;for(s.U&&(a+=s.U.rt);s!==o;){let l=s.tt;s===l.W&&(a+=1,l.U&&(a+=l.U.rt)),s=l}return a}},i=n;d.default=i}),Jf=_e(d=>{be(),ve(),we(),Object.defineProperty(d,"t",{value:!0}),d.default=void 0;var t=i(Xs()),r=i(Zs()),n=Pt();function i(l){return l&&l.t?l:{default:l}}var s=class kc extends r.default{constructor(c,u,p,h){super(c,u,h),this.container=p}get pointer(){return this.o===this.h&&(0,n.throwIteratorAccessError)(),this.o.u}copy(){return new kc(this.o,this.h,this.container,this.iteratorType)}},o=class extends t.default{constructor(l=[],c,u){super(c,u);let p=this;l.forEach(function(h){p.insert(h)})}*K(l){l!==void 0&&(yield*this.K(l.U),yield l.u,yield*this.K(l.W))}begin(){return new s(this.h.U||this.h,this.h,this)}end(){return new s(this.h,this.h,this)}rBegin(){return new s(this.h.W||this.h,this.h,this,1)}rEnd(){return new s(this.h,this.h,this,1)}front(){return this.h.U?this.h.U.u:void 0}back(){return this.h.W?this.h.W.u:void 0}insert(l,c){return this.M(l,void 0,c)}find(l){let c=this.I(this.Y,l);return new s(c,this.h,this)}lowerBound(l){let c=this.X(this.Y,l);return new s(c,this.h,this)}upperBound(l){let c=this.Z(this.Y,l);return new s(c,this.h,this)}reverseLowerBound(l){let c=this.$(this.Y,l);return new s(c,this.h,this)}reverseUpperBound(l){let c=this.rr(this.Y,l);return new s(c,this.h,this)}union(l){let c=this;return l.forEach(function(u){c.insert(u)}),this.i}[Symbol.iterator](){return this.K(this.Y)}},a=o;d.default=a}),Qf=_e(d=>{be(),ve(),we(),Object.defineProperty(d,"t",{value:!0}),d.default=void 0;var t=i(Xs()),r=i(Zs()),n=Pt();function i(l){return l&&l.t?l:{default:l}}var s=class _c extends r.default{constructor(c,u,p,h){super(c,u,h),this.container=p}get pointer(){this.o===this.h&&(0,n.throwIteratorAccessError)();let c=this;return new Proxy([],{get(u,p){if(p==="0")return c.o.u;if(p==="1")return c.o.l},set(u,p,h){if(p!=="1")throw new TypeError("props must be 1");return c.o.l=h,!0}})}copy(){return new _c(this.o,this.h,this.container,this.iteratorType)}},o=class extends t.default{constructor(l=[],c,u){super(c,u);let p=this;l.forEach(function(h){p.setElement(h[0],h[1])})}*K(l){l!==void 0&&(yield*this.K(l.U),yield[l.u,l.l],yield*this.K(l.W))}begin(){return new s(this.h.U||this.h,this.h,this)}end(){return new s(this.h,this.h,this)}rBegin(){return new s(this.h.W||this.h,this.h,this,1)}rEnd(){return new s(this.h,this.h,this,1)}front(){if(this.i===0)return;let l=this.h.U;return[l.u,l.l]}back(){if(this.i===0)return;let l=this.h.W;return[l.u,l.l]}lowerBound(l){let c=this.X(this.Y,l);return new s(c,this.h,this)}upperBound(l){let c=this.Z(this.Y,l);return new s(c,this.h,this)}reverseLowerBound(l){let c=this.$(this.Y,l);return new s(c,this.h,this)}reverseUpperBound(l){let c=this.rr(this.Y,l);return new s(c,this.h,this)}setElement(l,c,u){return this.M(l,c,u)}find(l){let c=this.I(this.Y,l);return new s(c,this.h,this)}getElementByKey(l){return this.I(this.Y,l).l}union(l){let c=this;return l.forEach(function(u){c.setElement(u[0],u[1])}),this.i}[Symbol.iterator](){return this.K(this.Y)}},a=o;d.default=a}),ea=_e(d=>{be(),ve(),we(),Object.defineProperty(d,"t",{value:!0}),d.default=t;function t(r){let n=typeof r;return n==="object"&&r!==null||n==="function"}}),ta=_e(d=>{be(),ve(),we(),Object.defineProperty(d,"t",{value:!0}),d.HashContainerIterator=d.HashContainer=void 0;var t=Vt(),r=i(ea()),n=Pt();function i(a){return a&&a.t?a:{default:a}}var s=class extends t.ContainerIterator{constructor(a,l,c){super(c),this.o=a,this.h=l,this.iteratorType===0?(this.pre=function(){return this.o.L===this.h&&(0,n.throwIteratorAccessError)(),this.o=this.o.L,this},this.next=function(){return this.o===this.h&&(0,n.throwIteratorAccessError)(),this.o=this.o.B,this}):(this.pre=function(){return this.o.B===this.h&&(0,n.throwIteratorAccessError)(),this.o=this.o.B,this},this.next=function(){return this.o===this.h&&(0,n.throwIteratorAccessError)(),this.o=this.o.L,this})}};d.HashContainerIterator=s;var o=class extends t.Container{constructor(){super(),this.H=[],this.g={},this.HASH_TAG=Symbol("@@HASH_TAG"),Object.setPrototypeOf(this.g,null),this.h={},this.h.L=this.h.B=this.p=this._=this.h}V(a){let{L:l,B:c}=a;l.B=c,c.L=l,a===this.p&&(this.p=c),a===this._&&(this._=l),this.i-=1}M(a,l,c){c===void 0&&(c=(0,r.default)(a));let u;if(c){let p=a[this.HASH_TAG];if(p!==void 0)return this.H[p].l=l,this.i;Object.defineProperty(a,this.HASH_TAG,{value:this.H.length,configurable:!0}),u={u:a,l,L:this._,B:this.h},this.H.push(u)}else{let p=this.g[a];if(p)return p.l=l,this.i;u={u:a,l,L:this._,B:this.h},this.g[a]=u}return this.i===0?(this.p=u,this.h.B=u):this._.B=u,this._=u,this.h.L=u,++this.i}I(a,l){if(l===void 0&&(l=(0,r.default)(a)),l){let c=a[this.HASH_TAG];return c===void 0?this.h:this.H[c]}else return this.g[a]||this.h}clear(){let a=this.HASH_TAG;this.H.forEach(function(l){delete l.u[a]}),this.H=[],this.g={},Object.setPrototypeOf(this.g,null),this.i=0,this.p=this._=this.h.L=this.h.B=this.h}eraseElementByKey(a,l){let c;if(l===void 0&&(l=(0,r.default)(a)),l){let u=a[this.HASH_TAG];if(u===void 0)return!1;delete a[this.HASH_TAG],c=this.H[u],delete this.H[u]}else{if(c=this.g[a],c===void 0)return!1;delete this.g[a]}return this.V(c),!0}eraseElementByIterator(a){let l=a.o;return l===this.h&&(0,n.throwIteratorAccessError)(),this.V(l),a.next()}eraseElementByPos(a){if(a<0||a>this.i-1)throw new RangeError;let l=this.p;for(;a--;)l=l.B;return this.V(l),this.i}};d.HashContainer=o}),Xf=_e(d=>{be(),ve(),we(),Object.defineProperty(d,"t",{value:!0}),d.default=void 0;var t=ta(),r=Pt(),n=class Sc extends t.HashContainerIterator{constructor(a,l,c,u){super(a,l,u),this.container=c}get pointer(){return this.o===this.h&&(0,r.throwIteratorAccessError)(),this.o.u}copy(){return new Sc(this.o,this.h,this.container,this.iteratorType)}},i=class extends t.HashContainer{constructor(o=[]){super();let a=this;o.forEach(function(l){a.insert(l)})}begin(){return new n(this.p,this.h,this)}end(){return new n(this.h,this.h,this)}rBegin(){return new n(this._,this.h,this,1)}rEnd(){return new n(this.h,this.h,this,1)}front(){return this.p.u}back(){return this._.u}insert(o,a){return this.M(o,void 0,a)}getElementByPos(o){if(o<0||o>this.i-1)throw new RangeError;let a=this.p;for(;o--;)a=a.B;return a.u}find(o,a){let l=this.I(o,a);return new n(l,this.h,this)}forEach(o){let a=0,l=this.p;for(;l!==this.h;)o(l.u,a++,this),l=l.B}[Symbol.iterator](){return(function*(){let o=this.p;for(;o!==this.h;)yield o.u,o=o.B}).bind(this)()}},s=i;d.default=s}),Zf=_e(d=>{be(),ve(),we(),Object.defineProperty(d,"t",{value:!0}),d.default=void 0;var t=ta(),r=i(ea()),n=Pt();function i(l){return l&&l.t?l:{default:l}}var s=class Nc extends t.HashContainerIterator{constructor(c,u,p,h){super(c,u,h),this.container=p}get pointer(){this.o===this.h&&(0,n.throwIteratorAccessError)();let c=this;return new Proxy([],{get(u,p){if(p==="0")return c.o.u;if(p==="1")return c.o.l},set(u,p,h){if(p!=="1")throw new TypeError("props must be 1");return c.o.l=h,!0}})}copy(){return new Nc(this.o,this.h,this.container,this.iteratorType)}},o=class extends t.HashContainer{constructor(l=[]){super();let c=this;l.forEach(function(u){c.setElement(u[0],u[1])})}begin(){return new s(this.p,this.h,this)}end(){return new s(this.h,this.h,this)}rBegin(){return new s(this._,this.h,this,1)}rEnd(){return new s(this.h,this.h,this,1)}front(){if(this.i!==0)return[this.p.u,this.p.l]}back(){if(this.i!==0)return[this._.u,this._.l]}setElement(l,c,u){return this.M(l,c,u)}getElementByKey(l,c){if(c===void 0&&(c=(0,r.default)(l)),c){let p=l[this.HASH_TAG];return p!==void 0?this.H[p].l:void 0}let u=this.g[l];return u?u.l:void 0}getElementByPos(l){if(l<0||l>this.i-1)throw new RangeError;let c=this.p;for(;l--;)c=c.B;return[c.u,c.l]}find(l,c){let u=this.I(l,c);return new s(u,this.h,this)}forEach(l){let c=0,u=this.p;for(;u!==this.h;)l([u.u,u.l],c++,this),u=u.B}[Symbol.iterator](){return(function*(){let l=this.p;for(;l!==this.h;)yield[l.u,l.l],l=l.B}).bind(this)()}},a=o;d.default=a}),ep=_e(d=>{be(),ve(),we(),Object.defineProperty(d,"t",{value:!0}),Object.defineProperty(d,"Deque",{enumerable:!0,get:function(){return o.default}}),Object.defineProperty(d,"HashMap",{enumerable:!0,get:function(){return u.default}}),Object.defineProperty(d,"HashSet",{enumerable:!0,get:function(){return c.default}}),Object.defineProperty(d,"LinkList",{enumerable:!0,get:function(){return s.default}}),Object.defineProperty(d,"OrderedMap",{enumerable:!0,get:function(){return l.default}}),Object.defineProperty(d,"OrderedSet",{enumerable:!0,get:function(){return a.default}}),Object.defineProperty(d,"PriorityQueue",{enumerable:!0,get:function(){return n.default}}),Object.defineProperty(d,"Queue",{enumerable:!0,get:function(){return r.default}}),Object.defineProperty(d,"Stack",{enumerable:!0,get:function(){return t.default}}),Object.defineProperty(d,"Vector",{enumerable:!0,get:function(){return i.default}});var t=p(zf()),r=p(Wf()),n=p(qf()),i=p(Gf()),s=p(Hf()),o=p(Kf()),a=p(Jf()),l=p(Qf()),c=p(Xf()),u=p(Zf());function p(h){return h&&h.t?h:{default:h}}}),tp=_e((d,t)=>{be(),ve(),we();var r=ep().OrderedSet,n=Tt()("number-allocator:trace"),i=Tt()("number-allocator:error");function s(a,l){this.low=a,this.high=l}s.prototype.equals=function(a){return this.low===a.low&&this.high===a.high},s.prototype.compare=function(a){return this.low<a.low&&this.high<a.low?-1:a.low<this.low&&a.high<this.low?1:0};function o(a,l){if(!(this instanceof o))return new o(a,l);this.min=a,this.max=l,this.ss=new r([],(c,u)=>c.compare(u)),n("Create"),this.clear()}o.prototype.firstVacant=function(){return this.ss.size()===0?null:this.ss.front().low},o.prototype.alloc=function(){if(this.ss.size()===0)return n("alloc():empty"),null;let a=this.ss.begin(),l=a.pointer.low,c=a.pointer.high,u=l;return u+1<=c?this.ss.updateKeyByIterator(a,new s(l+1,c)):this.ss.eraseElementByPos(0),n("alloc():"+u),u},o.prototype.use=function(a){let l=new s(a,a),c=this.ss.lowerBound(l);if(!c.equals(this.ss.end())){let u=c.pointer.low,p=c.pointer.high;return c.pointer.equals(l)?(this.ss.eraseElementByIterator(c),n("use():"+a),!0):u>a?!1:u===a?(this.ss.updateKeyByIterator(c,new s(u+1,p)),n("use():"+a),!0):p===a?(this.ss.updateKeyByIterator(c,new s(u,p-1)),n("use():"+a),!0):(this.ss.updateKeyByIterator(c,new s(a+1,p)),this.ss.insert(new s(u,a-1)),n("use():"+a),!0)}return n("use():failed"),!1},o.prototype.free=function(a){if(a<this.min||a>this.max){i("free():"+a+" is out of range");return}let l=new s(a,a),c=this.ss.upperBound(l);if(c.equals(this.ss.end())){if(c.equals(this.ss.begin())){this.ss.insert(l);return}c.pre();let u=c.pointer.high;c.pointer.high+1===a?this.ss.updateKeyByIterator(c,new s(u,a)):this.ss.insert(l)}else if(c.equals(this.ss.begin()))if(a+1===c.pointer.low){let u=c.pointer.high;this.ss.updateKeyByIterator(c,new s(a,u))}else this.ss.insert(l);else{let u=c.pointer.low,p=c.pointer.high;c.pre();let h=c.pointer.low;c.pointer.high+1===a?a+1===u?(this.ss.eraseElementByIterator(c),this.ss.updateKeyByIterator(c,new s(h,p))):this.ss.updateKeyByIterator(c,new s(h,a)):a+1===u?(this.ss.eraseElementByIterator(c.next()),this.ss.insert(new s(a,p))):this.ss.insert(l)}n("free():"+a)},o.prototype.clear=function(){n("clear()"),this.ss.clear(),this.ss.insert(new s(this.min,this.max))},o.prototype.intervalCount=function(){return this.ss.size()},o.prototype.dump=function(){console.log("length:"+this.ss.size());for(let a of this.ss)console.log(a)},t.exports=o}),ra=_e((d,t)=>{be(),ve(),we();var r=tp();t.exports.NumberAllocator=r}),rp=_e(d=>{be(),ve(),we(),Object.defineProperty(d,"__esModule",{value:!0});var t=Ff(),r=ra(),n=class{constructor(i){he(this,"aliasToTopic");he(this,"topicToAlias");he(this,"max");he(this,"numberAllocator");he(this,"length");i>0&&(this.aliasToTopic=new t.LRUCache({max:i}),this.topicToAlias={},this.numberAllocator=new r.NumberAllocator(1,i),this.max=i,this.length=0)}put(i,s){if(s===0||s>this.max)return!1;let o=this.aliasToTopic.get(s);return o&&delete this.topicToAlias[o],this.aliasToTopic.set(s,i),this.topicToAlias[i]=s,this.numberAllocator.use(s),this.length=this.aliasToTopic.size,!0}getTopicByAlias(i){return this.aliasToTopic.get(i)}getAliasByTopic(i){let s=this.topicToAlias[i];return typeof s<"u"&&this.aliasToTopic.get(s),s}clear(){this.aliasToTopic.clear(),this.topicToAlias={},this.numberAllocator.clear(),this.length=0}getLruAlias(){return this.numberAllocator.firstVacant()||[...this.aliasToTopic.keys()][this.aliasToTopic.size-1]}};d.default=n}),np=_e(d=>{be(),ve(),we();var t=d&&d.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(d,"__esModule",{value:!0});var r=Wr(),n=t(rp()),i=fr(),s=(o,a)=>{o.log("_handleConnack");let{options:l}=o,c=l.protocolVersion===5?a.reasonCode:a.returnCode;if(clearTimeout(o.connackTimer),delete o.topicAliasSend,a.properties){if(a.properties.topicAliasMaximum){if(a.properties.topicAliasMaximum>65535){o.emit("error",new Error("topicAliasMaximum from broker is out of range"));return}a.properties.topicAliasMaximum>0&&(o.topicAliasSend=new n.default(a.properties.topicAliasMaximum))}a.properties.serverKeepAlive&&l.keepalive&&(l.keepalive=a.properties.serverKeepAlive),a.properties.maximumPacketSize&&(l.properties||(l.properties={}),l.properties.maximumPacketSize=a.properties.maximumPacketSize)}if(c===0)o.reconnecting=!1,o._onConnect(a);else if(c>0){let u=new i.ErrorWithReasonCode(`Connection refused: ${r.ReasonCodes[c]}`,c);o.emit("error",u),o.options.reconnectOnConnackError&&o._cleanUp(!0)}};d.default=s}),op=_e(d=>{be(),ve(),we(),Object.defineProperty(d,"__esModule",{value:!0});var t=(r,n,i)=>{r.log("handling pubrel packet");let s=typeof i<"u"?i:r.noop,{messageId:o}=n,a={cmd:"pubcomp",messageId:o};r.incomingStore.get(n,(l,c)=>{l?r._sendPacket(a,s):(r.emit("message",c.topic,c.payload,c),r.handleMessage(c,u=>{if(u)return s(u);r.incomingStore.del(c,r.noop),r._sendPacket(a,s)}))})};d.default=t}),ip=_e(d=>{be(),ve(),we();var t=d&&d.__importDefault||function(l){return l&&l.__esModule?l:{default:l}};Object.defineProperty(d,"__esModule",{value:!0});var r=t(jf()),n=t(Uf()),i=t(np()),s=t(Wr()),o=t(op()),a=(l,c,u)=>{let{options:p}=l;if(p.protocolVersion===5&&p.properties&&p.properties.maximumPacketSize&&p.properties.maximumPacketSize<c.length)return l.emit("error",new Error(`exceeding packets size ${c.cmd}`)),l.end({reasonCode:149,properties:{reasonString:"Maximum packet size was exceeded"}}),l;switch(l.log("_handlePacket :: emitting packetreceive"),l.emit("packetreceive",c),c.cmd){case"publish":(0,r.default)(l,c,u);break;case"puback":case"pubrec":case"pubcomp":case"suback":case"unsuback":l.reschedulePing(),(0,s.default)(l,c),u();break;case"pubrel":l.reschedulePing(),(0,o.default)(l,c,u);break;case"connack":(0,i.default)(l,c),u();break;case"auth":l.reschedulePing(),(0,n.default)(l,c),u();break;case"pingresp":l.log("_handlePacket :: received pingresp"),l.reschedulePing(!0),u();break;case"disconnect":l.emit("disconnect",c),u();break;default:l.log("_handlePacket :: unknown command"),u();break}};d.default=a}),na=_e(d=>{be(),ve(),we(),Object.defineProperty(d,"__esModule",{value:!0});var t=class{constructor(){he(this,"nextId");this.nextId=Math.max(1,Math.floor(Math.random()*65535))}allocate(){let r=this.nextId++;return this.nextId===65536&&(this.nextId=1),r}getLastAllocated(){return this.nextId===1?65535:this.nextId-1}register(r){return!0}deallocate(r){}clear(){}};d.default=t}),sp=_e(d=>{be(),ve(),we(),Object.defineProperty(d,"__esModule",{value:!0});var t=class{constructor(r){he(this,"aliasToTopic");he(this,"max");he(this,"length");this.aliasToTopic={},this.max=r}put(r,n){return n===0||n>this.max?!1:(this.aliasToTopic[n]=r,this.length=Object.keys(this.aliasToTopic).length,!0)}getTopicByAlias(r){return this.aliasToTopic[r]}clear(){this.aliasToTopic={}}};d.default=t}),ap=_e(d=>{be(),ve(),we();var t=d&&d.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(d,"__esModule",{value:!0}),d.TypedEventEmitter=void 0;var r=t((tr(),We(Mt))),n=fr(),i=class{};d.TypedEventEmitter=i,(0,n.applyMixin)(i,r.default)}),qr=_e((d,t)=>{be(),ve(),we();function r(n){"@babel/helpers - typeof";return t.exports=r=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(i){return typeof i}:function(i){return i&&typeof Symbol=="function"&&i.constructor===Symbol&&i!==Symbol.prototype?"symbol":typeof i},t.exports.__esModule=!0,t.exports.default=t.exports,r(n)}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports}),lp=_e((d,t)=>{be(),ve(),we();var r=qr().default;function n(i,s){if(r(i)!="object"||!i)return i;var o=i[Symbol.toPrimitive];if(o!==void 0){var a=o.call(i,s||"default");if(r(a)!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(s==="string"?String:Number)(i)}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}),cp=_e((d,t)=>{be(),ve(),we();var r=qr().default,n=lp();function i(s){var o=n(s,"string");return r(o)=="symbol"?o:o+""}t.exports=i,t.exports.__esModule=!0,t.exports.default=t.exports}),dp=_e((d,t)=>{be(),ve(),we();var r=cp();function n(i,s,o){return(s=r(s))in i?Object.defineProperty(i,s,{value:o,enumerable:!0,configurable:!0,writable:!0}):i[s]=o,i}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}),up=_e((d,t)=>{be(),ve(),we();function r(n){if(Array.isArray(n))return n}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports}),fp=_e((d,t)=>{be(),ve(),we();function r(n,i){var s=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(s!=null){var o,a,l,c,u=[],p=!0,h=!1;try{if(l=(s=s.call(n)).next,i===0){if(Object(s)!==s)return;p=!1}else for(;!(p=(o=l.call(s)).done)&&(u.push(o.value),u.length!==i);p=!0);}catch(m){h=!0,a=m}finally{try{if(!p&&s.return!=null&&(c=s.return(),Object(c)!==c))return}finally{if(h)throw a}}return u}}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports}),pp=_e((d,t)=>{be(),ve(),we();function r(n,i){(i==null||i>n.length)&&(i=n.length);for(var s=0,o=Array(i);s<i;s++)o[s]=n[s];return o}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports}),hp=_e((d,t)=>{be(),ve(),we();var r=pp();function n(i,s){if(i){if(typeof i=="string")return r(i,s);var o={}.toString.call(i).slice(8,-1);return o==="Object"&&i.constructor&&(o=i.constructor.name),o==="Map"||o==="Set"?Array.from(i):o==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?r(i,s):void 0}}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}),mp=_e((d,t)=>{be(),ve(),we();function r(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
264
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports}),gp=_e((d,t)=>{be(),ve(),we();var r=up(),n=fp(),i=hp(),s=mp();function o(a,l){return r(a)||n(a,l)||i(a,l)||s()}t.exports=o,t.exports.__esModule=!0,t.exports.default=t.exports}),oa=_e((d,t)=>{be(),ve(),we(),function(r,n){typeof d=="object"&&typeof t<"u"?n(d):typeof define=="function"&&define.amd?define(["exports"],n):(r=typeof globalThis<"u"?globalThis:r||self,n(r.fastUniqueNumbers={}))}(d,function(r){var n=function(m){return function(f){var E=m(f);return f.add(E),E}},i=function(m){return function(f,E){return m.set(f,E),E}},s=Number.MAX_SAFE_INTEGER===void 0?9007199254740991:Number.MAX_SAFE_INTEGER,o=536870912,a=o*2,l=function(m,f){return function(E){var N=f.get(E),k=N===void 0?E.size:N<a?N+1:0;if(!E.has(k))return m(E,k);if(E.size<o){for(;E.has(k);)k=Math.floor(Math.random()*a);return m(E,k)}if(E.size>s)throw new Error("Congratulations, you created a collection of unique numbers which uses all available integers!");for(;E.has(k);)k=Math.floor(Math.random()*s);return m(E,k)}},c=new WeakMap,u=i(c),p=l(u,c),h=n(p);r.addUniqueNumber=h,r.generateUniqueNumber=p})}),yp=_e((d,t)=>{be(),ve(),we();function r(i,s,o,a,l,c,u){try{var p=i[c](u),h=p.value}catch(m){return void o(m)}p.done?s(h):Promise.resolve(h).then(a,l)}function n(i){return function(){var s=this,o=arguments;return new Promise(function(a,l){var c=i.apply(s,o);function u(h){r(c,a,l,u,p,"next",h)}function p(h){r(c,a,l,u,p,"throw",h)}u(void 0)})}}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}),ia=_e((d,t)=>{be(),ve(),we();function r(n,i){this.v=n,this.k=i}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports}),sa=_e((d,t)=>{be(),ve(),we();function r(n,i,s,o){var a=Object.defineProperty;try{a({},"",{})}catch{a=0}t.exports=r=function(l,c,u,p){function h(m,f){r(l,m,function(E){return this._invoke(m,f,E)})}c?a?a(l,c,{value:u,enumerable:!p,configurable:!p,writable:!p}):l[c]=u:(h("next",0),h("throw",1),h("return",2))},t.exports.__esModule=!0,t.exports.default=t.exports,r(n,i,s,o)}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports}),aa=_e((d,t)=>{be(),ve(),we();var r=sa();function n(){var i,s,o=typeof Symbol=="function"?Symbol:{},a=o.iterator||"@@iterator",l=o.toStringTag||"@@toStringTag";function c(k,g,v,_){var S=g&&g.prototype instanceof p?g:p,B=Object.create(S.prototype);return r(B,"_invoke",function(P,T,A){var C,O,I,U=0,Y=A||[],j=!1,le={p:0,n:0,v:i,a:ne,f:ne.bind(i,4),d:function(te,ue){return C=te,O=0,I=i,le.n=ue,u}};function ne(te,ue){for(O=te,I=ue,s=0;!j&&U&&!$&&s<Y.length;s++){var $,se=Y[s],M=le.p,Q=se[2];te>3?($=Q===ue)&&(I=se[(O=se[4])?5:(O=3,3)],se[4]=se[5]=i):se[0]<=M&&(($=te<2&&M<se[1])?(O=0,le.v=ue,le.n=se[1]):M<Q&&($=te<3||se[0]>ue||ue>Q)&&(se[4]=te,se[5]=ue,le.n=Q,O=0))}if($||te>1)return u;throw j=!0,ue}return function(te,ue,$){if(U>1)throw TypeError("Generator is already running");for(j&&ue===1&&ne(ue,$),O=ue,I=$;(s=O<2?i:I)||!j;){C||(O?O<3?(O>1&&(le.n=-1),ne(O,I)):le.n=I:le.v=I);try{if(U=2,C){if(O||(te="next"),s=C[te]){if(!(s=s.call(C,I)))throw TypeError("iterator result is not an object");if(!s.done)return s;I=s.value,O<2&&(O=0)}else O===1&&(s=C.return)&&s.call(C),O<2&&(I=TypeError("The iterator does not provide a '"+te+"' method"),O=1);C=i}else if((s=(j=le.n<0)?I:P.call(T,le))!==u)break}catch(se){C=i,O=1,I=se}finally{U=1}}return{value:s,done:j}}}(k,v,_),!0),B}var u={};function p(){}function h(){}function m(){}s=Object.getPrototypeOf;var f=[][a]?s(s([][a]())):(r(s={},a,function(){return this}),s),E=m.prototype=p.prototype=Object.create(f);function N(k){return Object.setPrototypeOf?Object.setPrototypeOf(k,m):(k.__proto__=m,r(k,l,"GeneratorFunction")),k.prototype=Object.create(E),k}return h.prototype=m,r(E,"constructor",m),r(m,"constructor",h),h.displayName="GeneratorFunction",r(m,l,"GeneratorFunction"),r(E),r(E,l,"Generator"),r(E,a,function(){return this}),r(E,"toString",function(){return"[object Generator]"}),(t.exports=n=function(){return{w:c,m:N}},t.exports.__esModule=!0,t.exports.default=t.exports)()}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}),la=_e((d,t)=>{be(),ve(),we();var r=ia(),n=sa();function i(s,o){function a(c,u,p,h){try{var m=s[c](u),f=m.value;return f instanceof r?o.resolve(f.v).then(function(E){a("next",E,p,h)},function(E){a("throw",E,p,h)}):o.resolve(f).then(function(E){m.value=E,p(m)},function(E){return a("throw",E,p,h)})}catch(E){h(E)}}var l;this.next||(n(i.prototype),n(i.prototype,typeof Symbol=="function"&&Symbol.asyncIterator||"@asyncIterator",function(){return this})),n(this,"_invoke",function(c,u,p){function h(){return new o(function(m,f){a(c,p,m,f)})}return l=l?l.then(h,h):h()},!0)}t.exports=i,t.exports.__esModule=!0,t.exports.default=t.exports}),ca=_e((d,t)=>{be(),ve(),we();var r=aa(),n=la();function i(s,o,a,l,c){return new n(r().w(s,o,a,l),c||Promise)}t.exports=i,t.exports.__esModule=!0,t.exports.default=t.exports}),bp=_e((d,t)=>{be(),ve(),we();var r=ca();function n(i,s,o,a,l){var c=r(i,s,o,a,l);return c.next().then(function(u){return u.done?u.value:c.next()})}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}),wp=_e((d,t)=>{be(),ve(),we();function r(n){var i=Object(n),s=[];for(var o in i)s.unshift(o);return function a(){for(;s.length;)if((o=s.pop())in i)return a.value=o,a.done=!1,a;return a.done=!0,a}}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports}),vp=_e((d,t)=>{be(),ve(),we();var r=qr().default;function n(i){if(i!=null){var s=i[typeof Symbol=="function"&&Symbol.iterator||"@@iterator"],o=0;if(s)return s.call(i);if(typeof i.next=="function")return i;if(!isNaN(i.length))return{next:function(){return i&&o>=i.length&&(i=void 0),{value:i&&i[o++],done:!i}}}}throw new TypeError(r(i)+" is not iterable")}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}),Ep=_e((d,t)=>{be(),ve(),we();var r=ia(),n=aa(),i=bp(),s=ca(),o=la(),a=wp(),l=vp();function c(){var u=n(),p=u.m(c),h=(Object.getPrototypeOf?Object.getPrototypeOf(p):p.__proto__).constructor;function m(N){var k=typeof N=="function"&&N.constructor;return!!k&&(k===h||(k.displayName||k.name)==="GeneratorFunction")}var f={throw:1,return:2,break:3,continue:3};function E(N){var k,g;return function(v){k||(k={stop:function(){return g(v.a,2)},catch:function(){return v.v},abrupt:function(_,S){return g(v.a,f[_],S)},delegateYield:function(_,S,B){return k.resultName=S,g(v.d,l(_),B)},finish:function(_){return g(v.f,_)}},g=function(_,S,B){v.p=k.prev,v.n=k.next;try{return _(S,B)}finally{k.next=v.n}}),k.resultName&&(k[k.resultName]=v.v,k.resultName=void 0),k.sent=v.v,k.next=v.n;try{return N.call(this,k)}finally{v.p=k.prev,v.n=k.next}}}return(t.exports=c=function(){return{wrap:function(N,k,g,v){return u.w(E(N),k,g,v&&v.reverse())},isGeneratorFunction:m,mark:u.m,awrap:function(N,k){return new r(N,k)},AsyncIterator:o,async:function(N,k,g,v,_){return(m(k)?s:i)(E(N),k,g,v,_)},keys:a,values:l}},t.exports.__esModule=!0,t.exports.default=t.exports)()}t.exports=c,t.exports.__esModule=!0,t.exports.default=t.exports}),kp=_e((d,t)=>{be(),ve(),we();var r=Ep()();t.exports=r;try{regeneratorRuntime=r}catch{typeof globalThis=="object"?globalThis.regeneratorRuntime=r:Function("r","regeneratorRuntime = r")(r)}}),_p=_e((d,t)=>{be(),ve(),we(),function(r,n){typeof d=="object"&&typeof t<"u"?n(d,dp(),gp(),oa(),yp(),kp()):typeof define=="function"&&define.amd?define(["exports","@babel/runtime/helpers/defineProperty","@babel/runtime/helpers/slicedToArray","fast-unique-numbers","@babel/runtime/helpers/asyncToGenerator","@babel/runtime/regenerator"],n):(r=typeof globalThis<"u"?globalThis:r||self,n(r.brokerFactory={},r._defineProperty,r._slicedToArray,r.fastUniqueNumbers,r._asyncToGenerator,r._regeneratorRuntime))}(d,function(r,n,i,s,o,a){var l=function(g){return typeof g.start=="function"},c=new WeakMap;function u(g,v){var _=Object.keys(g);if(Object.getOwnPropertySymbols){var S=Object.getOwnPropertySymbols(g);v&&(S=S.filter(function(B){return Object.getOwnPropertyDescriptor(g,B).enumerable})),_.push.apply(_,S)}return _}function p(g){for(var v=1;v<arguments.length;v++){var _=arguments[v]!=null?arguments[v]:{};v%2?u(Object(_),!0).forEach(function(S){n(g,S,_[S])}):Object.getOwnPropertyDescriptors?Object.defineProperties(g,Object.getOwnPropertyDescriptors(_)):u(Object(_)).forEach(function(S){Object.defineProperty(g,S,Object.getOwnPropertyDescriptor(_,S))})}return g}var h=function(g){return p(p({},g),{},{connect:function(v){var _=v.call;return o(a.mark(function S(){var B,P,T,A;return a.wrap(function(C){for(;;)switch(C.prev=C.next){case 0:return B=new MessageChannel,P=B.port1,T=B.port2,C.next=1,_("connect",{port:P},[P]);case 1:return A=C.sent,c.set(T,A),C.abrupt("return",T);case 2:case"end":return C.stop()}},S)}))},disconnect:function(v){var _=v.call;return function(){var S=o(a.mark(function B(P){var T;return a.wrap(function(A){for(;;)switch(A.prev=A.next){case 0:if(T=c.get(P),T!==void 0){A.next=1;break}throw new Error("The given port is not connected.");case 1:return A.next=2,_("disconnect",{portId:T});case 2:case"end":return A.stop()}},B)}));return function(B){return S.apply(this,arguments)}}()},isSupported:function(v){var _=v.call;return function(){return _("isSupported")}}})};function m(g,v){var _=Object.keys(g);if(Object.getOwnPropertySymbols){var S=Object.getOwnPropertySymbols(g);v&&(S=S.filter(function(B){return Object.getOwnPropertyDescriptor(g,B).enumerable})),_.push.apply(_,S)}return _}function f(g){for(var v=1;v<arguments.length;v++){var _=arguments[v]!=null?arguments[v]:{};v%2?m(Object(_),!0).forEach(function(S){n(g,S,_[S])}):Object.getOwnPropertyDescriptors?Object.defineProperties(g,Object.getOwnPropertyDescriptors(_)):m(Object(_)).forEach(function(S){Object.defineProperty(g,S,Object.getOwnPropertyDescriptor(_,S))})}return g}var E=new WeakMap,N=function(g){if(E.has(g))return E.get(g);var v=new Map;return E.set(g,v),v},k=function(g){var v=h(g);return function(_){var S=N(_);_.addEventListener("message",function(Y){var j=Y.data,le=j.id;if(le!==null&&S.has(le)){var ne=S.get(le),te=ne.reject,ue=ne.resolve;S.delete(le),j.error===void 0?ue(j.result):te(new Error(j.error.message))}}),l(_)&&_.start();for(var B=function(Y){var j=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,le=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];return new Promise(function(ne,te){var ue=s.generateUniqueNumber(S);S.set(ue,{reject:te,resolve:ne}),j===null?_.postMessage({id:ue,method:Y},le):_.postMessage({id:ue,method:Y,params:j},le)})},P=function(Y,j){var le=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];_.postMessage({id:null,method:Y,params:j},le)},T={},A=0,C=Object.entries(v);A<C.length;A++){var O=i(C[A],2),I=O[0],U=O[1];T=f(f({},T),{},n({},I,U({call:B,notify:P})))}return f({},T)}};r.createBroker=k})}),Sp=_e((d,t)=>{be(),ve(),we(),function(r,n){typeof d=="object"&&typeof t<"u"?n(d,qr(),_p(),oa()):typeof define=="function"&&define.amd?define(["exports","@babel/runtime/helpers/typeof","broker-factory","fast-unique-numbers"],n):(r=typeof globalThis<"u"?globalThis:r||self,n(r.workerTimersBroker={},r._typeof,r.brokerFactory,r.fastUniqueNumbers))}(d,function(r,n,i,s){var o=new Map([[0,null]]),a=new Map([[0,null]]),l=i.createBroker({clearInterval:function(u){var p=u.call;return function(h){n(o.get(h))==="symbol"&&(o.set(h,null),p("clear",{timerId:h,timerType:"interval"}).then(function(){o.delete(h)}))}},clearTimeout:function(u){var p=u.call;return function(h){n(a.get(h))==="symbol"&&(a.set(h,null),p("clear",{timerId:h,timerType:"timeout"}).then(function(){a.delete(h)}))}},setInterval:function(u){var p=u.call;return function(h){for(var m=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,f=arguments.length,E=new Array(f>2?f-2:0),N=2;N<f;N++)E[N-2]=arguments[N];var k=Symbol(),g=s.generateUniqueNumber(o);o.set(g,k);var v=function(){return p("set",{delay:m,now:performance.timeOrigin+performance.now(),timerId:g,timerType:"interval"}).then(function(){var _=o.get(g);if(_===void 0)throw new Error("The timer is in an undefined state.");_===k&&(h.apply(void 0,E),o.get(g)===k&&v())})};return v(),g}},setTimeout:function(u){var p=u.call;return function(h){for(var m=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,f=arguments.length,E=new Array(f>2?f-2:0),N=2;N<f;N++)E[N-2]=arguments[N];var k=Symbol(),g=s.generateUniqueNumber(a);return a.set(g,k),p("set",{delay:m,now:performance.timeOrigin+performance.now(),timerId:g,timerType:"timeout"}).then(function(){var v=a.get(g);if(v===void 0)throw new Error("The timer is in an undefined state.");v===k&&(a.delete(g),h.apply(void 0,E))}),g}}}),c=function(u){var p=new Worker(u);return l(p)};r.load=c,r.wrap=l})}),Np=_e((d,t)=>{be(),ve(),we(),function(r,n){typeof d=="object"&&typeof t<"u"?n(d,Sp()):typeof define=="function"&&define.amd?define(["exports","worker-timers-broker"],n):(r=typeof globalThis<"u"?globalThis:r||self,n(r.workerTimers={},r.workerTimersBroker))}(d,function(r,n){var i=function(p,h){var m=null;return function(){if(m!==null)return m;var f=new Blob([h],{type:"application/javascript; charset=utf-8"}),E=URL.createObjectURL(f);return m=p(E),setTimeout(function(){return URL.revokeObjectURL(E)}),m}},s=`(()=>{var e={45:(e,t,r)=>{var n=r(738).default;e.exports=function(e,t){if("object"!=n(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t||"default");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)},e.exports.__esModule=!0,e.exports.default=e.exports},79:e=>{e.exports=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n},e.exports.__esModule=!0,e.exports.default=e.exports},122:(e,t,r)=>{var n=r(79);e.exports=function(e,t){if(e){if("string"==typeof e)return n(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(e,t):void 0}},e.exports.__esModule=!0,e.exports.default=e.exports},156:e=>{e.exports=function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,u,a,i=[],s=!0,c=!1;try{if(u=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=u.call(r)).done)&&(i.push(n.value),i.length!==t);s=!0);}catch(e){c=!0,o=e}finally{try{if(!s&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw o}}return i}},e.exports.__esModule=!0,e.exports.default=e.exports},172:e=>{e.exports=function(e,t){this.v=e,this.k=t},e.exports.__esModule=!0,e.exports.default=e.exports},293:e=>{function t(e,t,r,n,o,u,a){try{var i=e[u](a),s=i.value}catch(e){return void r(e)}i.done?t(s):Promise.resolve(s).then(n,o)}e.exports=function(e){return function(){var r=this,n=arguments;return new Promise((function(o,u){var a=e.apply(r,n);function i(e){t(a,o,u,i,s,"next",e)}function s(e){t(a,o,u,i,s,"throw",e)}i(void 0)}))}},e.exports.__esModule=!0,e.exports.default=e.exports},373:e=>{e.exports=function(e){var t=Object(e),r=[];for(var n in t)r.unshift(n);return function e(){for(;r.length;)if((n=r.pop())in t)return e.value=n,e.done=!1,e;return e.done=!0,e}},e.exports.__esModule=!0,e.exports.default=e.exports},389:function(e,t){!function(e){"use strict";var t=function(e){return function(t){var r=e(t);return t.add(r),r}},r=function(e){return function(t,r){return e.set(t,r),r}},n=void 0===Number.MAX_SAFE_INTEGER?9007199254740991:Number.MAX_SAFE_INTEGER,o=536870912,u=2*o,a=function(e,t){return function(r){var a=t.get(r),i=void 0===a?r.size:a<u?a+1:0;if(!r.has(i))return e(r,i);if(r.size<o){for(;r.has(i);)i=Math.floor(Math.random()*u);return e(r,i)}if(r.size>n)throw new Error("Congratulations, you created a collection of unique numbers which uses all available integers!");for(;r.has(i);)i=Math.floor(Math.random()*n);return e(r,i)}},i=new WeakMap,s=r(i),c=a(s,i),f=t(c);e.addUniqueNumber=f,e.generateUniqueNumber=c}(t)},472:function(e,t,r){!function(e,t,r,n){"use strict";var o=function(e,t){return function(r){var o=t.get(r);if(void 0===o)return Promise.resolve(!1);var u=n(o,2),a=u[0],i=u[1];return e(a),t.delete(r),i(!1),Promise.resolve(!0)}},u=function(e,t){var r=function(n,o,u,a){var i=n-e.now();i>0?o.set(a,[t(r,i,n,o,u,a),u]):(o.delete(a),u(!0))};return r},a=function(e,t,r,n){return function(o,u,a){var i=o+u-t.timeOrigin,s=i-t.now();return new Promise((function(t){e.set(a,[r(n,s,i,e,t,a),t])}))}},i=new Map,s=o(globalThis.clearTimeout,i),c=new Map,f=o(globalThis.clearTimeout,c),l=u(performance,globalThis.setTimeout),p=a(i,performance,globalThis.setTimeout,l),d=a(c,performance,globalThis.setTimeout,l);r.createWorker(self,{clear:function(){var r=e(t.mark((function e(r){var n,o,u;return t.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=r.timerId,o=r.timerType,e.next=1,"interval"===o?s(n):f(n);case 1:return u=e.sent,e.abrupt("return",{result:u});case 2:case"end":return e.stop()}}),e)})));function n(e){return r.apply(this,arguments)}return n}(),set:function(){var r=e(t.mark((function e(r){var n,o,u,a,i;return t.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=r.delay,o=r.now,u=r.timerId,a=r.timerType,e.next=1,("interval"===a?p:d)(n,o,u);case 1:return i=e.sent,e.abrupt("return",{result:i});case 2:case"end":return e.stop()}}),e)})));function n(e){return r.apply(this,arguments)}return n}()})}(r(293),r(756),r(623),r(715))},546:e=>{function t(r,n,o,u){var a=Object.defineProperty;try{a({},"",{})}catch(r){a=0}e.exports=t=function(e,r,n,o){if(r)a?a(e,r,{value:n,enumerable:!o,configurable:!o,writable:!o}):e[r]=n;else{var u=function(r,n){t(e,r,(function(e){return this._invoke(r,n,e)}))};u("next",0),u("throw",1),u("return",2)}},e.exports.__esModule=!0,e.exports.default=e.exports,t(r,n,o,u)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},579:(e,t,r)=>{var n=r(738).default;e.exports=function(e){if(null!=e){var t=e["function"==typeof Symbol&&Symbol.iterator||"@@iterator"],r=0;if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}}}throw new TypeError(n(e)+" is not iterable")},e.exports.__esModule=!0,e.exports.default=e.exports},623:function(e,t,r){!function(e,t,r,n,o){"use strict";var u={INTERNAL_ERROR:-32603,INVALID_PARAMS:-32602,METHOD_NOT_FOUND:-32601},a=function(e,t){return Object.assign(new Error(e),{status:t})},i=function(e){return a('The requested method called "'.concat(e,'" is not supported.'),u.METHOD_NOT_FOUND)},s=function(e){return a('The handler of the method called "'.concat(e,'" returned no required result.'),u.INTERNAL_ERROR)},c=function(e){return a('The handler of the method called "'.concat(e,'" returned an unexpected result.'),u.INTERNAL_ERROR)},f=function(e){return a('The specified parameter called "portId" with the given value "'.concat(e,'" does not identify a port connected to this worker.'),u.INVALID_PARAMS)},l=function(e,n){return function(){var o=t(r.mark((function t(o){var u,a,f,l,p,d,v,x,y,b,h,m,_,g,w;return r.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(u=o.data,a=u.id,f=u.method,l=u.params,p=n[f],t.prev=1,void 0!==p){t.next=2;break}throw i(f);case 2:if(void 0!==(d=void 0===l?p():p(l))){t.next=3;break}throw s(f);case 3:if(!(d instanceof Promise)){t.next=5;break}return t.next=4,d;case 4:g=t.sent,t.next=6;break;case 5:g=d;case 6:if(v=g,null!==a){t.next=8;break}if(void 0===v.result){t.next=7;break}throw c(f);case 7:t.next=10;break;case 8:if(void 0!==v.result){t.next=9;break}throw c(f);case 9:x=v.result,y=v.transferables,b=void 0===y?[]:y,e.postMessage({id:a,result:x},b);case 10:t.next=12;break;case 11:t.prev=11,w=t.catch(1),h=w.message,m=w.status,_=void 0===m?-32603:m,e.postMessage({error:{code:_,message:h},id:a});case 12:case"end":return t.stop()}}),t,null,[[1,11]])})));return function(e){return o.apply(this,arguments)}}()},p=function(){return new Promise((function(e){var t=new ArrayBuffer(0),r=new MessageChannel,n=r.port1,o=r.port2;n.onmessage=function(t){var r=t.data;return e(null!==r)},o.postMessage(t,[t])}))};function d(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function v(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?d(Object(r),!0).forEach((function(t){n(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):d(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var x=new Map,y=function(e,n,u){return v(v({},n),{},{connect:function(t){var r=t.port;r.start();var u=e(r,n),a=o.generateUniqueNumber(x);return x.set(a,(function(){u(),r.close(),x.delete(a)})),{result:a}},disconnect:function(e){var t=e.portId,r=x.get(t);if(void 0===r)throw f(t);return r(),{result:null}},isSupported:function(){var e=t(r.mark((function e(){var t,n,o;return r.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,p();case 1:if(!e.sent){e.next=5;break}if(!((t=u())instanceof Promise)){e.next=3;break}return e.next=2,t;case 2:o=e.sent,e.next=4;break;case 3:o=t;case 4:return n=o,e.abrupt("return",{result:n});case 5:return e.abrupt("return",{result:!1});case 6:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()})},b=function(e,t){var r=y(b,t,arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){return!0}),n=l(e,r);return e.addEventListener("message",n),function(){return e.removeEventListener("message",n)}};e.createWorker=b,e.isSupported=p}(t,r(293),r(756),r(693),r(389))},633:(e,t,r)=>{var n=r(172),o=r(993),u=r(869),a=r(887),i=r(791),s=r(373),c=r(579);function f(){"use strict";var t=o(),r=t.m(f),l=(Object.getPrototypeOf?Object.getPrototypeOf(r):r.__proto__).constructor;function p(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===l||"GeneratorFunction"===(t.displayName||t.name))}var d={throw:1,return:2,break:3,continue:3};function v(e){var t,r;return function(n){t||(t={stop:function(){return r(n.a,2)},catch:function(){return n.v},abrupt:function(e,t){return r(n.a,d[e],t)},delegateYield:function(e,o,u){return t.resultName=o,r(n.d,c(e),u)},finish:function(e){return r(n.f,e)}},r=function(e,r,o){n.p=t.prev,n.n=t.next;try{return e(r,o)}finally{t.next=n.n}}),t.resultName&&(t[t.resultName]=n.v,t.resultName=void 0),t.sent=n.v,t.next=n.n;try{return e.call(this,t)}finally{n.p=t.prev,n.n=t.next}}}return(e.exports=f=function(){return{wrap:function(e,r,n,o){return t.w(v(e),r,n,o&&o.reverse())},isGeneratorFunction:p,mark:t.m,awrap:function(e,t){return new n(e,t)},AsyncIterator:i,async:function(e,t,r,n,o){return(p(t)?a:u)(v(e),t,r,n,o)},keys:s,values:c}},e.exports.__esModule=!0,e.exports.default=e.exports)()}e.exports=f,e.exports.__esModule=!0,e.exports.default=e.exports},693:(e,t,r)=>{var n=r(736);e.exports=function(e,t,r){return(t=n(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e},e.exports.__esModule=!0,e.exports.default=e.exports},715:(e,t,r)=>{var n=r(987),o=r(156),u=r(122),a=r(752);e.exports=function(e,t){return n(e)||o(e,t)||u(e,t)||a()},e.exports.__esModule=!0,e.exports.default=e.exports},736:(e,t,r)=>{var n=r(738).default,o=r(45);e.exports=function(e){var t=o(e,"string");return"symbol"==n(t)?t:t+""},e.exports.__esModule=!0,e.exports.default=e.exports},738:e=>{function t(r){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(r)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},752:e=>{e.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},e.exports.__esModule=!0,e.exports.default=e.exports},756:(e,t,r)=>{var n=r(633)();e.exports=n;try{regeneratorRuntime=n}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=n:Function("r","regeneratorRuntime = r")(n)}},791:(e,t,r)=>{var n=r(172),o=r(546);e.exports=function e(t,r){function u(e,o,a,i){try{var s=t[e](o),c=s.value;return c instanceof n?r.resolve(c.v).then((function(e){u("next",e,a,i)}),(function(e){u("throw",e,a,i)})):r.resolve(c).then((function(e){s.value=e,a(s)}),(function(e){return u("throw",e,a,i)}))}catch(e){i(e)}}var a;this.next||(o(e.prototype),o(e.prototype,"function"==typeof Symbol&&Symbol.asyncIterator||"@asyncIterator",(function(){return this}))),o(this,"_invoke",(function(e,t,n){function o(){return new r((function(t,r){u(e,n,t,r)}))}return a=a?a.then(o,o):o()}),!0)},e.exports.__esModule=!0,e.exports.default=e.exports},869:(e,t,r)=>{var n=r(887);e.exports=function(e,t,r,o,u){var a=n(e,t,r,o,u);return a.next().then((function(e){return e.done?e.value:a.next()}))},e.exports.__esModule=!0,e.exports.default=e.exports},887:(e,t,r)=>{var n=r(993),o=r(791);e.exports=function(e,t,r,u,a){return new o(n().w(e,t,r,u),a||Promise)},e.exports.__esModule=!0,e.exports.default=e.exports},987:e=>{e.exports=function(e){if(Array.isArray(e))return e},e.exports.__esModule=!0,e.exports.default=e.exports},993:(e,t,r)=>{var n=r(546);function o(){var t,r,u="function"==typeof Symbol?Symbol:{},a=u.iterator||"@@iterator",i=u.toStringTag||"@@toStringTag";function s(e,o,u,a){var i=o&&o.prototype instanceof f?o:f,s=Object.create(i.prototype);return n(s,"_invoke",function(e,n,o){var u,a,i,s=0,f=o||[],l=!1,p={p:0,n:0,v:t,a:d,f:d.bind(t,4),d:function(e,r){return u=e,a=0,i=t,p.n=r,c}};function d(e,n){for(a=e,i=n,r=0;!l&&s&&!o&&r<f.length;r++){var o,u=f[r],d=p.p,v=u[2];e>3?(o=v===n)&&(i=u[(a=u[4])?5:(a=3,3)],u[4]=u[5]=t):u[0]<=d&&((o=e<2&&d<u[1])?(a=0,p.v=n,p.n=u[1]):d<v&&(o=e<3||u[0]>n||n>v)&&(u[4]=e,u[5]=n,p.n=v,a=0))}if(o||e>1)return c;throw l=!0,n}return function(o,f,v){if(s>1)throw TypeError("Generator is already running");for(l&&1===f&&d(f,v),a=f,i=v;(r=a<2?t:i)||!l;){u||(a?a<3?(a>1&&(p.n=-1),d(a,i)):p.n=i:p.v=i);try{if(s=2,u){if(a||(o="next"),r=u[o]){if(!(r=r.call(u,i)))throw TypeError("iterator result is not an object");if(!r.done)return r;i=r.value,a<2&&(a=0)}else 1===a&&(r=u.return)&&r.call(u),a<2&&(i=TypeError("The iterator does not provide a '"+o+"' method"),a=1);u=t}else if((r=(l=p.n<0)?i:e.call(n,p))!==c)break}catch(e){u=t,a=1,i=e}finally{s=1}}return{value:r,done:l}}}(e,u,a),!0),s}var c={};function f(){}function l(){}function p(){}r=Object.getPrototypeOf;var d=[][a]?r(r([][a]())):(n(r={},a,(function(){return this})),r),v=p.prototype=f.prototype=Object.create(d);function x(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,n(e,i,"GeneratorFunction")),e.prototype=Object.create(v),e}return l.prototype=p,n(v,"constructor",p),n(p,"constructor",l),l.displayName="GeneratorFunction",n(p,i,"GeneratorFunction"),n(v),n(v,i,"Generator"),n(v,a,(function(){return this})),n(v,"toString",(function(){return"[object Generator]"})),(e.exports=o=function(){return{w:s,m:x}},e.exports.__esModule=!0,e.exports.default=e.exports)()}e.exports=o,e.exports.__esModule=!0,e.exports.default=e.exports}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var u=t[n]={exports:{}};return e[n].call(u.exports,u,u.exports,r),u.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{"use strict";r(472)})()})();`,o=i(n.load,s),a=function(p){return o().clearInterval(p)},l=function(p){return o().clearTimeout(p)},c=function(){var p;return(p=o()).setInterval.apply(p,arguments)},u=function(){var p;return(p=o()).setTimeout.apply(p,arguments)};r.clearInterval=a,r.clearTimeout=l,r.setInterval=c,r.setTimeout=u})}),Gr=_e(d=>{be(),ve(),we(),Object.defineProperty(d,"__esModule",{value:!0}),d.isReactNativeBrowser=d.isWebWorker=void 0;var t=()=>{var s;return typeof window<"u"?typeof navigator<"u"&&((s=navigator.userAgent)==null?void 0:s.toLowerCase().indexOf(" electron/"))>-1&&(ze!=null&&ze.versions)?!Object.prototype.hasOwnProperty.call(ze.versions,"electron"):typeof window.document<"u":!1},r=()=>{var s,o;return!!(typeof self=="object"&&((o=(s=self==null?void 0:self.constructor)==null?void 0:s.name)!=null&&o.includes("WorkerGlobalScope"))&&typeof Deno>"u")},n=()=>typeof navigator<"u"&&navigator.product==="ReactNative",i=t()||r()||n();d.isWebWorker=r(),d.isReactNativeBrowser=n(),d.default=i}),Cp=_e(d=>{be(),ve(),we();var t=d&&d.__createBinding||(Object.create?function(c,u,p,h){h===void 0&&(h=p);var m=Object.getOwnPropertyDescriptor(u,p);(!m||("get"in m?!u.__esModule:m.writable||m.configurable))&&(m={enumerable:!0,get:function(){return u[p]}}),Object.defineProperty(c,h,m)}:function(c,u,p,h){h===void 0&&(h=p),c[h]=u[p]}),r=d&&d.__setModuleDefault||(Object.create?function(c,u){Object.defineProperty(c,"default",{enumerable:!0,value:u})}:function(c,u){c.default=u}),n=d&&d.__importStar||function(){var c=function(u){return c=Object.getOwnPropertyNames||function(p){var h=[];for(var m in p)Object.prototype.hasOwnProperty.call(p,m)&&(h[h.length]=m);return h},c(u)};return function(u){if(u&&u.__esModule)return u;var p={};if(u!=null)for(var h=c(u),m=0;m<h.length;m++)h[m]!=="default"&&t(p,u,h[m]);return r(p,u),p}}();Object.defineProperty(d,"__esModule",{value:!0});var i=Np(),s=n(Gr()),o={set:i.setInterval,clear:i.clearInterval},a={set:(c,u)=>setInterval(c,u),clear:c=>clearInterval(c)},l=c=>{switch(c){case"native":return a;case"worker":return o;case"auto":default:return s.default&&!s.isWebWorker&&!s.isReactNativeBrowser?o:a}};d.default=l}),da=_e(d=>{be(),ve(),we();var t=d&&d.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(d,"__esModule",{value:!0});var r=t(Cp()),n=class{constructor(i,s){he(this,"_keepalive");he(this,"timerId");he(this,"timer");he(this,"destroyed",!1);he(this,"counter");he(this,"client");he(this,"_keepaliveTimeoutTimestamp");he(this,"_intervalEvery");this.client=i,this.timer=typeof s=="object"&&"set"in s&&"clear"in s?s:(0,r.default)(s),this.setKeepalive(i.options.keepalive)}get keepaliveTimeoutTimestamp(){return this._keepaliveTimeoutTimestamp}get intervalEvery(){return this._intervalEvery}get keepalive(){return this._keepalive}clear(){this.timerId&&(this.timer.clear(this.timerId),this.timerId=null)}setKeepalive(i){if(i*=1e3,isNaN(i)||i<=0||i>2147483647)throw new Error(`Keepalive value must be an integer between 0 and 2147483647. Provided value is ${i}`);this._keepalive=i,this.reschedule(),this.client.log(`KeepaliveManager: set keepalive to ${i}ms`)}destroy(){this.clear(),this.destroyed=!0}reschedule(){if(this.destroyed)return;this.clear(),this.counter=0;let i=Math.ceil(this._keepalive*1.5);this._keepaliveTimeoutTimestamp=Date.now()+i,this._intervalEvery=Math.ceil(this._keepalive/2),this.timerId=this.timer.set(()=>{this.destroyed||(this.counter+=1,this.counter===2?this.client.sendPing():this.counter>2&&this.client.onKeepaliveTimeout())},this._intervalEvery)}};d.default=n}),Qo=_e(d=>{var S;be(),ve(),we();var t=d&&d.__createBinding||(Object.create?function(B,P,T,A){A===void 0&&(A=T);var C=Object.getOwnPropertyDescriptor(P,T);(!C||("get"in C?!P.__esModule:C.writable||C.configurable))&&(C={enumerable:!0,get:function(){return P[T]}}),Object.defineProperty(B,A,C)}:function(B,P,T,A){A===void 0&&(A=T),B[A]=P[T]}),r=d&&d.__setModuleDefault||(Object.create?function(B,P){Object.defineProperty(B,"default",{enumerable:!0,value:P})}:function(B,P){B.default=P}),n=d&&d.__importStar||function(){var B=function(P){return B=Object.getOwnPropertyNames||function(T){var A=[];for(var C in T)Object.prototype.hasOwnProperty.call(T,C)&&(A[A.length]=C);return A},B(P)};return function(P){if(P&&P.__esModule)return P;var T={};if(P!=null)for(var A=B(P),C=0;C<A.length;C++)A[C]!=="default"&&t(T,P,A[C]);return r(T,P),T}}(),i=d&&d.__importDefault||function(B){return B&&B.__esModule?B:{default:B}};Object.defineProperty(d,"__esModule",{value:!0});var s=i(Rf()),o=nr(),a=i($f()),l=i(Tt()),c=n(Ys()),u=i(Js()),p=i(ip()),h=i(na()),m=i(sp()),f=fr(),E=ap(),N=i(da()),k=n(Gr()),g=globalThis.setImmediate||((...B)=>{let P=B.shift();(0,f.nextTick)(()=>{P(...B)})}),v={keepalive:60,reschedulePings:!0,protocolId:"MQTT",protocolVersion:4,reconnectPeriod:1e3,connectTimeout:30*1e3,clean:!0,resubscribe:!0,subscribeBatchSize:null,writeCache:!0,timerVariant:"auto"},_=(S=class extends E.TypedEventEmitter{constructor(T,A){super();he(this,"connected");he(this,"disconnecting");he(this,"disconnected");he(this,"reconnecting");he(this,"incomingStore");he(this,"outgoingStore");he(this,"options");he(this,"queueQoSZero");he(this,"_reconnectCount");he(this,"log");he(this,"messageIdProvider");he(this,"outgoing");he(this,"messageIdToTopic");he(this,"noop");he(this,"keepaliveManager");he(this,"stream");he(this,"queue");he(this,"streamBuilder");he(this,"_resubscribeTopics");he(this,"connackTimer");he(this,"reconnectTimer");he(this,"_storeProcessing");he(this,"_packetIdsDuringStoreProcessing");he(this,"_storeProcessingQueue");he(this,"_firstConnection");he(this,"topicAliasRecv");he(this,"topicAliasSend");he(this,"_deferredReconnect");he(this,"connackPacket");this.options=A||{};for(let C in v)typeof this.options[C]>"u"?this.options[C]=v[C]:this.options[C]=A[C];this.log=this.options.log||(0,l.default)("mqttjs:client"),this.noop=this._noop.bind(this),this.log("MqttClient :: version:",S.VERSION),k.isWebWorker?this.log("MqttClient :: environment","webworker"):this.log("MqttClient :: environment",k.default?"browser":"node"),this.log("MqttClient :: options.protocol",A.protocol),this.log("MqttClient :: options.protocolVersion",A.protocolVersion),this.log("MqttClient :: options.username",A.username),this.log("MqttClient :: options.keepalive",A.keepalive),this.log("MqttClient :: options.reconnectPeriod",A.reconnectPeriod),this.log("MqttClient :: options.rejectUnauthorized",A.rejectUnauthorized),this.log("MqttClient :: options.properties.topicAliasMaximum",A.properties?A.properties.topicAliasMaximum:void 0),this.options.clientId=typeof A.clientId=="string"?A.clientId:S.defaultId(),this.log("MqttClient :: clientId",this.options.clientId),this.options.customHandleAcks=A.protocolVersion===5&&A.customHandleAcks?A.customHandleAcks:(...C)=>{C[3](null,0)},this.options.writeCache||(s.default.writeToStream.cacheNumbers=!1),this.streamBuilder=T,this.messageIdProvider=typeof this.options.messageIdProvider>"u"?new h.default:this.options.messageIdProvider,this.outgoingStore=A.outgoingStore||new u.default,this.incomingStore=A.incomingStore||new u.default,this.queueQoSZero=A.queueQoSZero===void 0?!0:A.queueQoSZero,this._resubscribeTopics={},this.messageIdToTopic={},this.keepaliveManager=null,this.connected=!1,this.disconnecting=!1,this.reconnecting=!1,this.queue=[],this.connackTimer=null,this.reconnectTimer=null,this._storeProcessing=!1,this._packetIdsDuringStoreProcessing={},this._storeProcessingQueue=[],this.outgoing={},this._firstConnection=!0,A.properties&&A.properties.topicAliasMaximum>0&&(A.properties.topicAliasMaximum>65535?this.log("MqttClient :: options.properties.topicAliasMaximum is out of range"):this.topicAliasRecv=new m.default(A.properties.topicAliasMaximum)),this.on("connect",()=>{let{queue:C}=this,O=()=>{let I=C.shift();this.log("deliver :: entry %o",I);let U=null;if(!I){this._resubscribe();return}U=I.packet,this.log("deliver :: call _sendPacket for %o",U);let Y=!0;U.messageId&&U.messageId!==0&&(this.messageIdProvider.register(U.messageId)||(Y=!1)),Y?this._sendPacket(U,j=>{I.cb&&I.cb(j),O()}):(this.log("messageId: %d has already used. The message is skipped and removed.",U.messageId),O())};this.log("connect :: sending queued packets"),O()}),this.on("close",()=>{this.log("close :: connected set to `false`"),this.connected=!1,this.log("close :: clearing connackTimer"),clearTimeout(this.connackTimer),this._destroyKeepaliveManager(),this.topicAliasRecv&&this.topicAliasRecv.clear(),this.log("close :: calling _setupReconnect"),this._setupReconnect()}),this.options.manualConnect||(this.log("MqttClient :: setting up stream"),this.connect())}static defaultId(){return`mqttjs_${Math.random().toString(16).substr(2,8)}`}handleAuth(T,A){A()}handleMessage(T,A){A()}_nextId(){return this.messageIdProvider.allocate()}getLastMessageId(){return this.messageIdProvider.getLastAllocated()}connect(){var le;let T=new o.Writable,A=s.default.parser(this.options),C=null,O=[];this.log("connect :: calling method to clear reconnect"),this._clearReconnect(),this.disconnected&&!this.reconnecting&&(this.incomingStore=this.options.incomingStore||new u.default,this.outgoingStore=this.options.outgoingStore||new u.default,this.disconnecting=!1,this.disconnected=!1),this.log("connect :: using streamBuilder provided to client to create stream"),this.stream=this.streamBuilder(this),A.on("packet",ne=>{this.log("parser :: on packet push to packets array."),O.push(ne)});let I=()=>{this.log("work :: getting next packet in queue");let ne=O.shift();if(ne)this.log("work :: packet pulled from queue"),(0,p.default)(this,ne,U);else{this.log("work :: no packets in queue");let te=C;C=null,this.log("work :: done flag is %s",!!te),te&&te()}},U=()=>{if(O.length)(0,f.nextTick)(I);else{let ne=C;C=null,ne()}};T._write=(ne,te,ue)=>{C=ue,this.log("writable stream :: parsing buffer"),A.parse(ne),I()};let Y=ne=>{this.log("streamErrorHandler :: error",ne.message),ne.code?(this.log("streamErrorHandler :: emitting error"),this.emit("error",ne)):this.noop(ne)};this.log("connect :: pipe stream to writable stream"),this.stream.pipe(T),this.stream.on("error",Y),this.stream.on("close",()=>{this.log("(%s)stream :: on close",this.options.clientId),this._flushVolatile(),this.log("stream: emit close to MqttClient"),this.emit("close")}),this.log("connect: sending packet `connect`");let j={cmd:"connect",protocolId:this.options.protocolId,protocolVersion:this.options.protocolVersion,clean:this.options.clean,clientId:this.options.clientId,keepalive:this.options.keepalive,username:this.options.username,password:this.options.password,properties:this.options.properties};if(this.options.will&&(j.will={...this.options.will,payload:(le=this.options.will)==null?void 0:le.payload}),this.topicAliasRecv&&(j.properties||(j.properties={}),this.topicAliasRecv&&(j.properties.topicAliasMaximum=this.topicAliasRecv.max)),this._writePacket(j),A.on("error",this.emit.bind(this,"error")),this.options.properties){if(!this.options.properties.authenticationMethod&&this.options.properties.authenticationData)return this.end(()=>this.emit("error",new Error("Packet has no Authentication Method"))),this;if(this.options.properties.authenticationMethod&&this.options.authPacket&&typeof this.options.authPacket=="object"){let ne={cmd:"auth",reasonCode:0,...this.options.authPacket};this._writePacket(ne)}}return this.stream.setMaxListeners(1e3),clearTimeout(this.connackTimer),this.connackTimer=setTimeout(()=>{this.log("!!connectTimeout hit!! Calling _cleanUp with force `true`"),this.emit("error",new Error("connack timeout")),this._cleanUp(!0)},this.options.connectTimeout),this}publish(T,A,C,O){this.log("publish :: message `%s` to topic `%s`",A,T);let{options:I}=this;typeof C=="function"&&(O=C,C=null),C=C||{},C={qos:0,retain:!1,dup:!1,...C};let{qos:U,retain:Y,dup:j,properties:le,cbStorePut:ne}=C;if(this._checkDisconnecting(O))return this;let te=()=>{let ue=0;if((U===1||U===2)&&(ue=this._nextId(),ue===null))return this.log("No messageId left"),!1;let $={cmd:"publish",topic:T,payload:A,qos:U,retain:Y,messageId:ue,dup:j};switch(I.protocolVersion===5&&($.properties=le),this.log("publish :: qos",U),U){case 1:case 2:this.outgoing[$.messageId]={volatile:!1,cb:O||this.noop},this.log("MqttClient:publish: packet cmd: %s",$.cmd),this._sendPacket($,void 0,ne);break;default:this.log("MqttClient:publish: packet cmd: %s",$.cmd),this._sendPacket($,O,ne);break}return!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!te())&&this._storeProcessingQueue.push({invoke:te,cbStorePut:C.cbStorePut,callback:O}),this}publishAsync(T,A,C){return new Promise((O,I)=>{this.publish(T,A,C,(U,Y)=>{U?I(U):O(Y)})})}subscribe(T,A,C){let O=this.options.protocolVersion;typeof A=="function"&&(C=A),C=C||this.noop;let I=!1,U=[];typeof T=="string"?(T=[T],U=T):Array.isArray(T)?U=T:typeof T=="object"&&(I=T.resubscribe,delete T.resubscribe,U=Object.keys(T));let Y=c.validateTopics(U);if(Y!==null)return g(C,new Error(`Invalid topic ${Y}`)),this;if(this._checkDisconnecting(C))return this.log("subscribe: discconecting true"),this;let j={qos:0};O===5&&(j.nl=!1,j.rap=!1,j.rh=0),A={...j,...A};let{properties:le}=A,ne=[],te=(se,M)=>{if(M=M||A,!Object.prototype.hasOwnProperty.call(this._resubscribeTopics,se)||this._resubscribeTopics[se].qos<M.qos||I){let Q={topic:se,qos:M.qos};O===5&&(Q.nl=M.nl,Q.rap=M.rap,Q.rh=M.rh,Q.properties=le),this.log("subscribe: pushing topic `%s` and qos `%s` to subs list",Q.topic,Q.qos),ne.push(Q)}};if(Array.isArray(T)?T.forEach(se=>{this.log("subscribe: array topic %s",se),te(se)}):Object.keys(T).forEach(se=>{this.log("subscribe: object topic %s, %o",se,T[se]),te(se,T[se])}),!ne.length)return C(null,[]),this;let ue=(se,M)=>{let Q={cmd:"subscribe",subscriptions:se,messageId:M};if(le&&(Q.properties=le),this.options.resubscribe){this.log("subscribe :: resubscribe true");let K=[];se.forEach(Se=>{if(this.options.reconnectPeriod>0){let Z={qos:Se.qos};O===5&&(Z.nl=Se.nl||!1,Z.rap=Se.rap||!1,Z.rh=Se.rh||0,Z.properties=Se.properties),this._resubscribeTopics[Se.topic]=Z,K.push(Se.topic)}}),this.messageIdToTopic[Q.messageId]=K}let me=new Promise((K,Se)=>{this.outgoing[Q.messageId]={volatile:!0,cb(Z,G){if(!Z){let{granted:ce}=G;for(let X=0;X<ce.length;X+=1)se[X].qos=ce[X]}Z?Se(new f.ErrorWithSubackPacket(Z.message,G)):K(G)}}});return this.log("subscribe :: call _sendPacket"),this._sendPacket(Q),me},$=()=>{let se=this.options.subscribeBatchSize??ne.length,M=[];for(let Q=0;Q<ne.length;Q+=se){let me=ne.slice(Q,Q+se),K=this._nextId();if(K===null)return this.log("No messageId left"),!1;M.push(ue(me,K))}return Promise.all(M).then(Q=>{C(null,ne,Q.at(-1))}).catch(Q=>{C(Q,ne,Q.packet)}),!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!$())&&this._storeProcessingQueue.push({invoke:$,callback:C}),this}subscribeAsync(T,A){return new Promise((C,O)=>{this.subscribe(T,A,(I,U)=>{I?O(I):C(U)})})}unsubscribe(T,A,C){typeof T=="string"&&(T=[T]),typeof A=="function"&&(C=A),C=C||this.noop;let O=c.validateTopics(T);if(O!==null)return g(C,new Error(`Invalid topic ${O}`)),this;if(this._checkDisconnecting(C))return this;let I=()=>{let U=this._nextId();if(U===null)return this.log("No messageId left"),!1;let Y={cmd:"unsubscribe",messageId:U,unsubscriptions:[]};return typeof T=="string"?Y.unsubscriptions=[T]:Array.isArray(T)&&(Y.unsubscriptions=T),this.options.resubscribe&&Y.unsubscriptions.forEach(j=>{delete this._resubscribeTopics[j]}),typeof A=="object"&&A.properties&&(Y.properties=A.properties),this.outgoing[Y.messageId]={volatile:!0,cb:C},this.log("unsubscribe: call _sendPacket"),this._sendPacket(Y),!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!I())&&this._storeProcessingQueue.push({invoke:I,callback:C}),this}unsubscribeAsync(T,A){return new Promise((C,O)=>{this.unsubscribe(T,A,(I,U)=>{I?O(I):C(U)})})}end(T,A,C){this.log("end :: (%s)",this.options.clientId),(T==null||typeof T!="boolean")&&(C=C||A,A=T,T=!1),typeof A!="object"&&(C=C||A,A=null),this.log("end :: cb? %s",!!C),(!C||typeof C!="function")&&(C=this.noop);let O=()=>{this.log("end :: closeStores: closing incoming and outgoing stores"),this.disconnected=!0,this.incomingStore.close(U=>{this.outgoingStore.close(Y=>{if(this.log("end :: closeStores: emitting end"),this.emit("end"),C){let j=U||Y;this.log("end :: closeStores: invoking callback with args"),C(j)}})}),this._deferredReconnect?this._deferredReconnect():(this.options.reconnectPeriod===0||this.options.manualConnect)&&(this.disconnecting=!1)},I=()=>{this.log("end :: (%s) :: finish :: calling _cleanUp with force %s",this.options.clientId,T),this._cleanUp(T,()=>{this.log("end :: finish :: calling process.nextTick on closeStores"),(0,f.nextTick)(O)},A)};return this.disconnecting?(C(),this):(this._clearReconnect(),this.disconnecting=!0,!T&&Object.keys(this.outgoing).length>0?(this.log("end :: (%s) :: calling finish in 10ms once outgoing is empty",this.options.clientId),this.once("outgoingEmpty",setTimeout.bind(null,I,10))):(this.log("end :: (%s) :: immediately calling finish",this.options.clientId),I()),this)}endAsync(T,A){return new Promise((C,O)=>{this.end(T,A,I=>{I?O(I):C()})})}removeOutgoingMessage(T){if(this.outgoing[T]){let{cb:A}=this.outgoing[T];this._removeOutgoingAndStoreMessage(T,()=>{A(new Error("Message removed"))})}return this}reconnect(T){this.log("client reconnect");let A=()=>{T?(this.options.incomingStore=T.incomingStore,this.options.outgoingStore=T.outgoingStore):(this.options.incomingStore=null,this.options.outgoingStore=null),this.incomingStore=this.options.incomingStore||new u.default,this.outgoingStore=this.options.outgoingStore||new u.default,this.disconnecting=!1,this.disconnected=!1,this._deferredReconnect=null,this._reconnect()};return this.disconnecting&&!this.disconnected?this._deferredReconnect=A:A(),this}_flushVolatile(){this.outgoing&&(this.log("_flushVolatile :: deleting volatile messages from the queue and setting their callbacks as error function"),Object.keys(this.outgoing).forEach(T=>{this.outgoing[T].volatile&&typeof this.outgoing[T].cb=="function"&&(this.outgoing[T].cb(new Error("Connection closed")),delete this.outgoing[T])}))}_flush(){this.outgoing&&(this.log("_flush: queue exists? %b",!!this.outgoing),Object.keys(this.outgoing).forEach(T=>{typeof this.outgoing[T].cb=="function"&&(this.outgoing[T].cb(new Error("Connection closed")),delete this.outgoing[T])}))}_removeTopicAliasAndRecoverTopicName(T){let A;T.properties&&(A=T.properties.topicAlias);let C=T.topic.toString();if(this.log("_removeTopicAliasAndRecoverTopicName :: alias %d, topic %o",A,C),C.length===0){if(typeof A>"u")return new Error("Unregistered Topic Alias");if(C=this.topicAliasSend.getTopicByAlias(A),typeof C>"u")return new Error("Unregistered Topic Alias");T.topic=C}A&&delete T.properties.topicAlias}_checkDisconnecting(T){return this.disconnecting&&(T&&T!==this.noop?T(new Error("client disconnecting")):this.emit("error",new Error("client disconnecting"))),this.disconnecting}_reconnect(){this.log("_reconnect: emitting reconnect to client"),this.emit("reconnect"),this.connected?(this.end(()=>{this.connect()}),this.log("client already connected. disconnecting first.")):(this.log("_reconnect: calling connect"),this.connect())}_setupReconnect(){!this.disconnecting&&!this.reconnectTimer&&this.options.reconnectPeriod>0?(this.reconnecting||(this.log("_setupReconnect :: emit `offline` state"),this.emit("offline"),this.log("_setupReconnect :: set `reconnecting` to `true`"),this.reconnecting=!0),this.log("_setupReconnect :: setting reconnectTimer for %d ms",this.options.reconnectPeriod),this.reconnectTimer=setInterval(()=>{this.log("reconnectTimer :: reconnect triggered!"),this._reconnect()},this.options.reconnectPeriod)):this.log("_setupReconnect :: doing nothing...")}_clearReconnect(){this.log("_clearReconnect : clearing reconnect timer"),this.reconnectTimer&&(clearInterval(this.reconnectTimer),this.reconnectTimer=null)}_cleanUp(T,A,C={}){if(A&&(this.log("_cleanUp :: done callback provided for on stream close"),this.stream.on("close",A)),this.log("_cleanUp :: forced? %s",T),T)this.options.reconnectPeriod===0&&this.options.clean&&this._flush(),this.log("_cleanUp :: (%s) :: destroying stream",this.options.clientId),this.stream.destroy();else{let O={cmd:"disconnect",...C};this.log("_cleanUp :: (%s) :: call _sendPacket with disconnect packet",this.options.clientId),this._sendPacket(O,()=>{this.log("_cleanUp :: (%s) :: destroying stream",this.options.clientId),g(()=>{this.stream.end(()=>{this.log("_cleanUp :: (%s) :: stream destroyed",this.options.clientId)})})})}!this.disconnecting&&!this.reconnecting&&(this.log("_cleanUp :: client not disconnecting/reconnecting. Clearing and resetting reconnect."),this._clearReconnect(),this._setupReconnect()),this._destroyKeepaliveManager(),A&&!this.connected&&(this.log("_cleanUp :: (%s) :: removing stream `done` callback `close` listener",this.options.clientId),this.stream.removeListener("close",A),A())}_storeAndSend(T,A,C){this.log("storeAndSend :: store packet with cmd %s to outgoingStore",T.cmd);let O=T,I;if(O.cmd==="publish"&&(O=(0,a.default)(T),I=this._removeTopicAliasAndRecoverTopicName(O),I))return A&&A(I);this.outgoingStore.put(O,U=>{if(U)return A&&A(U);C(),this._writePacket(T,A)})}_applyTopicAlias(T){if(this.options.protocolVersion===5&&T.cmd==="publish"){let A;T.properties&&(A=T.properties.topicAlias);let C=T.topic.toString();if(this.topicAliasSend)if(A){if(C.length!==0&&(this.log("applyTopicAlias :: register topic: %s - alias: %d",C,A),!this.topicAliasSend.put(C,A)))return this.log("applyTopicAlias :: error out of range. topic: %s - alias: %d",C,A),new Error("Sending Topic Alias out of range")}else C.length!==0&&(this.options.autoAssignTopicAlias?(A=this.topicAliasSend.getAliasByTopic(C),A?(T.topic="",T.properties={...T.properties,topicAlias:A},this.log("applyTopicAlias :: auto assign(use) topic: %s - alias: %d",C,A)):(A=this.topicAliasSend.getLruAlias(),this.topicAliasSend.put(C,A),T.properties={...T.properties,topicAlias:A},this.log("applyTopicAlias :: auto assign topic: %s - alias: %d",C,A))):this.options.autoUseTopicAlias&&(A=this.topicAliasSend.getAliasByTopic(C),A&&(T.topic="",T.properties={...T.properties,topicAlias:A},this.log("applyTopicAlias :: auto use topic: %s - alias: %d",C,A))));else if(A)return this.log("applyTopicAlias :: error out of range. topic: %s - alias: %d",C,A),new Error("Sending Topic Alias out of range")}}_noop(T){this.log("noop ::",T)}_writePacket(T,A){this.log("_writePacket :: packet: %O",T),this.log("_writePacket :: emitting `packetsend`"),this.emit("packetsend",T),this.log("_writePacket :: writing to stream");let C=s.default.writeToStream(T,this.stream,this.options);this.log("_writePacket :: writeToStream result %s",C),!C&&A&&A!==this.noop?(this.log("_writePacket :: handle events on `drain` once through callback."),this.stream.once("drain",A)):A&&(this.log("_writePacket :: invoking cb"),A())}_sendPacket(T,A,C,O){this.log("_sendPacket :: (%s) :: start",this.options.clientId),C=C||this.noop,A=A||this.noop;let I=this._applyTopicAlias(T);if(I){A(I);return}if(!this.connected){if(T.cmd==="auth"){this._writePacket(T,A);return}this.log("_sendPacket :: client not connected. Storing packet offline."),this._storePacket(T,A,C);return}if(O){this._writePacket(T,A);return}switch(T.cmd){case"publish":break;case"pubrel":this._storeAndSend(T,A,C);return;default:this._writePacket(T,A);return}switch(T.qos){case 2:case 1:this._storeAndSend(T,A,C);break;case 0:default:this._writePacket(T,A);break}this.log("_sendPacket :: (%s) :: end",this.options.clientId)}_storePacket(T,A,C){this.log("_storePacket :: packet: %o",T),this.log("_storePacket :: cb? %s",!!A),C=C||this.noop;let O=T;if(O.cmd==="publish"){O=(0,a.default)(T);let U=this._removeTopicAliasAndRecoverTopicName(O);if(U)return A&&A(U)}let I=O.qos||0;I===0&&this.queueQoSZero||O.cmd!=="publish"?this.queue.push({packet:O,cb:A}):I>0?(A=this.outgoing[O.messageId]?this.outgoing[O.messageId].cb:null,this.outgoingStore.put(O,U=>{if(U)return A&&A(U);C()})):A&&A(new Error("No connection to broker"))}_setupKeepaliveManager(){this.log("_setupKeepaliveManager :: keepalive %d (seconds)",this.options.keepalive),!this.keepaliveManager&&this.options.keepalive&&(this.keepaliveManager=new N.default(this,this.options.timerVariant))}_destroyKeepaliveManager(){this.keepaliveManager&&(this.log("_destroyKeepaliveManager :: destroying keepalive manager"),this.keepaliveManager.destroy(),this.keepaliveManager=null)}reschedulePing(T=!1){this.keepaliveManager&&this.options.keepalive&&(T||this.options.reschedulePings)&&this._reschedulePing()}_reschedulePing(){this.log("_reschedulePing :: rescheduling ping"),this.keepaliveManager.reschedule()}sendPing(){this.log("_sendPing :: sending pingreq"),this._sendPacket({cmd:"pingreq"})}onKeepaliveTimeout(){this.emit("error",new Error("Keepalive timeout")),this.log("onKeepaliveTimeout :: calling _cleanUp with force true"),this._cleanUp(!0)}_resubscribe(){this.log("_resubscribe");let T=Object.keys(this._resubscribeTopics);if(!this._firstConnection&&(this.options.clean||this.options.protocolVersion>=4&&!this.connackPacket.sessionPresent)&&T.length>0)if(this.options.resubscribe)if(this.options.protocolVersion===5){this.log("_resubscribe: protocolVersion 5");for(let A=0;A<T.length;A++){let C={};C[T[A]]=this._resubscribeTopics[T[A]],C.resubscribe=!0,this.subscribe(C,{properties:C[T[A]].properties})}}else this._resubscribeTopics.resubscribe=!0,this.subscribe(this._resubscribeTopics);else this._resubscribeTopics={};this._firstConnection=!1}_onConnect(T){if(this.disconnected){this.emit("connect",T);return}this.connackPacket=T,this.messageIdProvider.clear(),this._setupKeepaliveManager(),this.connected=!0;let A=()=>{let C=this.outgoingStore.createStream(),O=()=>{C.destroy(),C=null,this._flushStoreProcessingQueue(),I()},I=()=>{this._storeProcessing=!1,this._packetIdsDuringStoreProcessing={}};this.once("close",O),C.on("error",Y=>{I(),this._flushStoreProcessingQueue(),this.removeListener("close",O),this.emit("error",Y)});let U=()=>{if(!C)return;let Y=C.read(1),j;if(!Y){C.once("readable",U);return}if(this._storeProcessing=!0,this._packetIdsDuringStoreProcessing[Y.messageId]){U();return}!this.disconnecting&&!this.reconnectTimer?(j=this.outgoing[Y.messageId]?this.outgoing[Y.messageId].cb:null,this.outgoing[Y.messageId]={volatile:!1,cb(le,ne){j&&j(le,ne),U()}},this._packetIdsDuringStoreProcessing[Y.messageId]=!0,this.messageIdProvider.register(Y.messageId)?this._sendPacket(Y,void 0,void 0,!0):this.log("messageId: %d has already used.",Y.messageId)):C.destroy&&C.destroy()};C.on("end",()=>{let Y=!0;for(let j in this._packetIdsDuringStoreProcessing)if(!this._packetIdsDuringStoreProcessing[j]){Y=!1;break}this.removeListener("close",O),Y?(I(),this._invokeAllStoreProcessingQueue(),this.emit("connect",T)):A()}),U()};A()}_invokeStoreProcessingQueue(){if(!this._storeProcessing&&this._storeProcessingQueue.length>0){let T=this._storeProcessingQueue[0];if(T&&T.invoke())return this._storeProcessingQueue.shift(),!0}return!1}_invokeAllStoreProcessingQueue(){for(;this._invokeStoreProcessingQueue(););}_flushStoreProcessingQueue(){for(let T of this._storeProcessingQueue)T.cbStorePut&&T.cbStorePut(new Error("Connection closed")),T.callback&&T.callback(new Error("Connection closed"));this._storeProcessingQueue.splice(0)}_removeOutgoingAndStoreMessage(T,A){delete this.outgoing[T],this.outgoingStore.del({messageId:T},(C,O)=>{A(C,O),this.messageIdProvider.deallocate(T),this._invokeStoreProcessingQueue()})}},he(S,"VERSION",f.MQTTJS_VERSION),S);d.default=_}),xp=_e(d=>{be(),ve(),we(),Object.defineProperty(d,"__esModule",{value:!0});var t=ra(),r=class{constructor(){he(this,"numberAllocator");he(this,"lastId");this.numberAllocator=new t.NumberAllocator(1,65535)}allocate(){return this.lastId=this.numberAllocator.alloc(),this.lastId}getLastAllocated(){return this.lastId}register(n){return this.numberAllocator.use(n)}deallocate(n){this.numberAllocator.free(n)}clear(){this.numberAllocator.clear()}};d.default=r});function Ap(){if(Xo)return Hr;Xo=!0;let d=2147483647,t=36,r=1,n=26,i=38,s=700,o=72,a=128,l="-",c=/^xn--/,u=/[^\0-\x7F]/,p=/[\x2E\u3002\uFF0E\uFF61]/g,h={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},m=t-r,f=Math.floor,E=String.fromCharCode;function N(C){throw new RangeError(h[C])}function k(C,O){let I=[],U=C.length;for(;U--;)I[U]=O(C[U]);return I}function g(C,O){let I=C.split("@"),U="";I.length>1&&(U=I[0]+"@",C=I[1]),C=C.replace(p,".");let Y=C.split("."),j=k(Y,O).join(".");return U+j}function v(C){let O=[],I=0,U=C.length;for(;I<U;){let Y=C.charCodeAt(I++);if(Y>=55296&&Y<=56319&&I<U){let j=C.charCodeAt(I++);(j&64512)==56320?O.push(((Y&1023)<<10)+(j&1023)+65536):(O.push(Y),I--)}else O.push(Y)}return O}let _=C=>String.fromCodePoint(...C),S=function(C){return C>=48&&C<58?26+(C-48):C>=65&&C<91?C-65:C>=97&&C<123?C-97:t},B=function(C,O){return C+22+75*(C<26)-((O!=0)<<5)},P=function(C,O,I){let U=0;for(C=I?f(C/s):C>>1,C+=f(C/O);C>m*n>>1;U+=t)C=f(C/m);return f(U+(m+1)*C/(C+i))},T=function(C){let O=[],I=C.length,U=0,Y=a,j=o,le=C.lastIndexOf(l);le<0&&(le=0);for(let ne=0;ne<le;++ne)C.charCodeAt(ne)>=128&&N("not-basic"),O.push(C.charCodeAt(ne));for(let ne=le>0?le+1:0;ne<I;){let te=U;for(let $=1,se=t;;se+=t){ne>=I&&N("invalid-input");let M=S(C.charCodeAt(ne++));M>=t&&N("invalid-input"),M>f((d-U)/$)&&N("overflow"),U+=M*$;let Q=se<=j?r:se>=j+n?n:se-j;if(M<Q)break;let me=t-Q;$>f(d/me)&&N("overflow"),$*=me}let ue=O.length+1;j=P(U-te,ue,te==0),f(U/ue)>d-Y&&N("overflow"),Y+=f(U/ue),U%=ue,O.splice(U++,0,Y)}return String.fromCodePoint(...O)},A=function(C){let O=[];C=v(C);let I=C.length,U=a,Y=0,j=o;for(let te of C)te<128&&O.push(E(te));let le=O.length,ne=le;for(le&&O.push(l);ne<I;){let te=d;for(let $ of C)$>=U&&$<te&&(te=$);let ue=ne+1;te-U>f((d-Y)/ue)&&N("overflow"),Y+=(te-U)*ue,U=te;for(let $ of C)if($<U&&++Y>d&&N("overflow"),$===U){let se=Y;for(let M=t;;M+=t){let Q=M<=j?r:M>=j+n?n:M-j;if(se<Q)break;let me=se-Q,K=t-Q;O.push(E(B(Q+me%K,0))),se=f(me/K)}O.push(E(B(se,0))),j=P(Y,ue,ne===le),Y=0,++ne}++Y,++U}return O.join("")};return Hr={version:"2.3.1",ucs2:{decode:v,encode:_},decode:T,encode:A,toASCII:function(C){return g(C,function(O){return u.test(O)?"xn--"+A(O):O})},toUnicode:function(C){return g(C,function(O){return c.test(O)?T(O.slice(4).toLowerCase()):O})}},Hr}var Hr,Xo,jt,Ip=pt(()=>{be(),ve(),we(),Hr={},Xo=!1,jt=Ap(),jt.decode,jt.encode,jt.toASCII,jt.toUnicode,jt.ucs2,jt.version});function Tp(){return ri||(ri=!0,ti=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var d={},t=Symbol("test"),r=Object(t);if(typeof t=="string"||Object.prototype.toString.call(t)!=="[object Symbol]"||Object.prototype.toString.call(r)!=="[object Symbol]")return!1;var n=42;d[t]=n;for(t in d)return!1;if(typeof Object.keys=="function"&&Object.keys(d).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(d).length!==0)return!1;var i=Object.getOwnPropertySymbols(d);if(i.length!==1||i[0]!==t||!Object.prototype.propertyIsEnumerable.call(d,t))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var s=Object.getOwnPropertyDescriptor(d,t);if(s.value!==n||s.enumerable!==!0)return!1}return!0}),ti}function Vp(){return oi||(oi=!0,ni=Error),ni}function Pp(){return si||(si=!0,ii=EvalError),ii}function Bp(){return li||(li=!0,ai=RangeError),ai}function Op(){return di||(di=!0,ci=ReferenceError),ci}function ua(){return fi||(fi=!0,ui=SyntaxError),ui}function xr(){return hi||(hi=!0,pi=TypeError),pi}function Dp(){return gi||(gi=!0,mi=URIError),mi}function Rp(){if(yi)return Kr;yi=!0;var d=typeof Symbol<"u"&&Symbol,t=Tp();return Kr=function(){return typeof d!="function"||typeof Symbol!="function"||typeof d("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:t()},Kr}function Mp(){if(bi)return Yr;bi=!0;var d={__proto__:null,foo:{}},t=Object;return Yr=function(){return{__proto__:d}.foo===d.foo&&!(d instanceof t)},Yr}function $p(){if(wi)return Jr;wi=!0;var d="Function.prototype.bind called on incompatible ",t=Object.prototype.toString,r=Math.max,n="[object Function]",i=function(a,l){for(var c=[],u=0;u<a.length;u+=1)c[u]=a[u];for(var p=0;p<l.length;p+=1)c[p+a.length]=l[p];return c},s=function(a,l){for(var c=[],u=l,p=0;u<a.length;u+=1,p+=1)c[p]=a[u];return c},o=function(a,l){for(var c="",u=0;u<a.length;u+=1)c+=a[u],u+1<a.length&&(c+=l);return c};return Jr=function(a){var l=this;if(typeof l!="function"||t.apply(l)!==n)throw new TypeError(d+l);for(var c=s(arguments,1),u,p=function(){if(this instanceof u){var N=l.apply(this,i(c,arguments));return Object(N)===N?N:this}return l.apply(a,i(c,arguments))},h=r(0,l.length-c.length),m=[],f=0;f<h;f++)m[f]="$"+f;if(u=Function("binder","return function ("+o(m,",")+"){ return binder.apply(this,arguments); }")(p),l.prototype){var E=function(){};E.prototype=l.prototype,u.prototype=new E,E.prototype=null}return u},Jr}function Zo(){if(vi)return Qr;vi=!0;var d=$p();return Qr=Function.prototype.bind||d,Qr}function jp(){if(Ei)return Xr;Ei=!0;var d=Function.prototype.call,t=Object.prototype.hasOwnProperty,r=Zo();return Xr=r.call(d,t),Xr}function pr(){if(ki)return Zr;ki=!0;var d,t=Vp(),r=Pp(),n=Bp(),i=Op(),s=ua(),o=xr(),a=Dp(),l=Function,c=function(ne){try{return l('"use strict"; return ('+ne+").constructor;")()}catch{}},u=Object.getOwnPropertyDescriptor;if(u)try{u({},"")}catch{u=null}var p=function(){throw new o},h=u?function(){try{return arguments.callee,p}catch{try{return u(arguments,"callee").get}catch{return p}}}():p,m=Rp()(),f=Mp()(),E=Object.getPrototypeOf||(f?function(ne){return ne.__proto__}:null),N={},k=typeof Uint8Array>"u"||!E?d:E(Uint8Array),g={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?d:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?d:ArrayBuffer,"%ArrayIteratorPrototype%":m&&E?E([][Symbol.iterator]()):d,"%AsyncFromSyncIteratorPrototype%":d,"%AsyncFunction%":N,"%AsyncGenerator%":N,"%AsyncGeneratorFunction%":N,"%AsyncIteratorPrototype%":N,"%Atomics%":typeof Atomics>"u"?d:Atomics,"%BigInt%":typeof BigInt>"u"?d:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?d:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?d:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?d:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":t,"%eval%":eval,"%EvalError%":r,"%Float32Array%":typeof Float32Array>"u"?d:Float32Array,"%Float64Array%":typeof Float64Array>"u"?d:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?d:FinalizationRegistry,"%Function%":l,"%GeneratorFunction%":N,"%Int8Array%":typeof Int8Array>"u"?d:Int8Array,"%Int16Array%":typeof Int16Array>"u"?d:Int16Array,"%Int32Array%":typeof Int32Array>"u"?d:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":m&&E?E(E([][Symbol.iterator]())):d,"%JSON%":typeof JSON=="object"?JSON:d,"%Map%":typeof Map>"u"?d:Map,"%MapIteratorPrototype%":typeof Map>"u"||!m||!E?d:E(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?d:Promise,"%Proxy%":typeof Proxy>"u"?d:Proxy,"%RangeError%":n,"%ReferenceError%":i,"%Reflect%":typeof Reflect>"u"?d:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?d:Set,"%SetIteratorPrototype%":typeof Set>"u"||!m||!E?d:E(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?d:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":m&&E?E(""[Symbol.iterator]()):d,"%Symbol%":m?Symbol:d,"%SyntaxError%":s,"%ThrowTypeError%":h,"%TypedArray%":k,"%TypeError%":o,"%Uint8Array%":typeof Uint8Array>"u"?d:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?d:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?d:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?d:Uint32Array,"%URIError%":a,"%WeakMap%":typeof WeakMap>"u"?d:WeakMap,"%WeakRef%":typeof WeakRef>"u"?d:WeakRef,"%WeakSet%":typeof WeakSet>"u"?d:WeakSet};if(E)try{null.error}catch(ne){var v=E(E(ne));g["%Error.prototype%"]=v}var _=function ne(te){var ue;if(te==="%AsyncFunction%")ue=c("async function () {}");else if(te==="%GeneratorFunction%")ue=c("function* () {}");else if(te==="%AsyncGeneratorFunction%")ue=c("async function* () {}");else if(te==="%AsyncGenerator%"){var $=ne("%AsyncGeneratorFunction%");$&&(ue=$.prototype)}else if(te==="%AsyncIteratorPrototype%"){var se=ne("%AsyncGenerator%");se&&E&&(ue=E(se.prototype))}return g[te]=ue,ue},S={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},B=Zo(),P=jp(),T=B.call(Function.call,Array.prototype.concat),A=B.call(Function.apply,Array.prototype.splice),C=B.call(Function.call,String.prototype.replace),O=B.call(Function.call,String.prototype.slice),I=B.call(Function.call,RegExp.prototype.exec),U=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Y=/\\(\\)?/g,j=function(ne){var te=O(ne,0,1),ue=O(ne,-1);if(te==="%"&&ue!=="%")throw new s("invalid intrinsic syntax, expected closing `%`");if(ue==="%"&&te!=="%")throw new s("invalid intrinsic syntax, expected opening `%`");var $=[];return C(ne,U,function(se,M,Q,me){$[$.length]=Q?C(me,Y,"$1"):M||se}),$},le=function(ne,te){var ue=ne,$;if(P(S,ue)&&($=S[ue],ue="%"+$[0]+"%"),P(g,ue)){var se=g[ue];if(se===N&&(se=_(ue)),typeof se>"u"&&!te)throw new o("intrinsic "+ne+" exists, but is not available. Please file an issue!");return{alias:$,name:ue,value:se}}throw new s("intrinsic "+ne+" does not exist!")};return Zr=function(ne,te){if(typeof ne!="string"||ne.length===0)throw new o("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof te!="boolean")throw new o('"allowMissing" argument must be a boolean');if(I(/^%?[^%]*%?$/,ne)===null)throw new s("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var ue=j(ne),$=ue.length>0?ue[0]:"",se=le("%"+$+"%",te),M=se.name,Q=se.value,me=!1,K=se.alias;K&&($=K[0],A(ue,T([0,1],K)));for(var Se=1,Z=!0;Se<ue.length;Se+=1){var G=ue[Se],ce=O(G,0,1),X=O(G,-1);if((ce==='"'||ce==="'"||ce==="`"||X==='"'||X==="'"||X==="`")&&ce!==X)throw new s("property names with quotes must have matching quotes");if((G==="constructor"||!Z)&&(me=!0),$+="."+G,M="%"+$+"%",P(g,M))Q=g[M];else if(Q!=null){if(!(G in Q)){if(!te)throw new o("base intrinsic for "+ne+" exists, but the property is not available.");return}if(u&&Se+1>=ue.length){var oe=u(Q,G);Z=!!oe,Z&&"get"in oe&&!("originalValue"in oe.get)?Q=oe.get:Q=Q[G]}else Z=P(Q,G),Q=Q[G];Z&&!me&&(g[M]=Q)}}return Q},Zr}function ei(){if(_i)return en;_i=!0;var d=pr(),t=d("%Object.defineProperty%",!0)||!1;if(t)try{t({},"a",{value:1})}catch{t=!1}return en=t,en}function fa(){if(Si)return tn;Si=!0;var d=pr(),t=d("%Object.getOwnPropertyDescriptor%",!0);if(t)try{t([],"length")}catch{t=null}return tn=t,tn}function Lp(){if(Ni)return rn;Ni=!0;var d=ei(),t=ua(),r=xr(),n=fa();return rn=function(i,s,o){if(!i||typeof i!="object"&&typeof i!="function")throw new r("`obj` must be an object or a function`");if(typeof s!="string"&&typeof s!="symbol")throw new r("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new r("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new r("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new r("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new r("`loose`, if provided, must be a boolean");var a=arguments.length>3?arguments[3]:null,l=arguments.length>4?arguments[4]:null,c=arguments.length>5?arguments[5]:null,u=arguments.length>6?arguments[6]:!1,p=!!n&&n(i,s);if(d)d(i,s,{configurable:c===null&&p?p.configurable:!c,enumerable:a===null&&p?p.enumerable:!a,value:o,writable:l===null&&p?p.writable:!l});else if(u||!a&&!l&&!c)i[s]=o;else throw new t("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},rn}function Up(){if(Ci)return nn;Ci=!0;var d=ei(),t=function(){return!!d};return t.hasArrayLengthDefineBug=function(){if(!d)return null;try{return d([],"length",{value:1}).length!==1}catch{return!0}},nn=t,nn}function Fp(){if(xi)return on;xi=!0;var d=pr(),t=Lp(),r=Up()(),n=fa(),i=xr(),s=d("%Math.floor%");return on=function(o,a){if(typeof o!="function")throw new i("`fn` is not a function");if(typeof a!="number"||a<0||a>4294967295||s(a)!==a)throw new i("`length` must be a positive 32-bit integer");var l=arguments.length>2&&!!arguments[2],c=!0,u=!0;if("length"in o&&n){var p=n(o,"length");p&&!p.configurable&&(c=!1),p&&!p.writable&&(u=!1)}return(c||u||!l)&&(r?t(o,"length",a,!0,!0):t(o,"length",a)),o},on}function zp(){if(Ai)return hr;Ai=!0;var d=Zo(),t=pr(),r=Fp(),n=xr(),i=t("%Function.prototype.apply%"),s=t("%Function.prototype.call%"),o=t("%Reflect.apply%",!0)||d.call(s,i),a=ei(),l=t("%Math.max%");hr=function(u){if(typeof u!="function")throw new n("a function is required");var p=o(d,s,arguments);return r(p,1+l(0,u.length-(arguments.length-1)),!0)};var c=function(){return o(d,i,arguments)};return a?a(hr,"apply",{value:c}):hr.apply=c,hr}function Wp(){if(Ii)return sn;Ii=!0;var d=pr(),t=zp(),r=t(d("String.prototype.indexOf"));return sn=function(n,i){var s=d(n,!!i);return typeof s=="function"&&r(n,".prototype.")>-1?t(s):s},sn}var ti,ri,ni,oi,ii,si,ai,li,ci,di,ui,fi,pi,hi,mi,gi,Kr,yi,Yr,bi,Jr,wi,Qr,vi,Xr,Ei,Zr,ki,en,_i,tn,Si,rn,Ni,nn,Ci,on,xi,hr,Ai,sn,Ii,qp=pt(()=>{be(),ve(),we(),ti={},ri=!1,ni={},oi=!1,ii={},si=!1,ai={},li=!1,ci={},di=!1,ui={},fi=!1,pi={},hi=!1,mi={},gi=!1,Kr={},yi=!1,Yr={},bi=!1,Jr={},wi=!1,Qr={},vi=!1,Xr={},Ei=!1,Zr={},ki=!1,en={},_i=!1,tn={},Si=!1,rn={},Ni=!1,nn={},Ci=!1,on={},xi=!1,hr={},Ai=!1,sn={},Ii=!1});function Ti(d){throw new Error("Node.js process "+d+" is not supported by JSPM core outside of Node.js")}function Gp(){!or||!ir||(or=!1,ir.length?kt=ir.concat(kt):Ar=-1,kt.length&&pa())}function pa(){if(!or){var d=setTimeout(Gp,0);or=!0;for(var t=kt.length;t;){for(ir=kt,kt=[];++Ar<t;)ir&&ir[Ar].run();Ar=-1,t=kt.length}ir=null,or=!1,clearTimeout(d)}}function Hp(d){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];kt.push(new ha(d,t)),kt.length===1&&!or&&setTimeout(pa,0)}function ha(d,t){this.fun=d,this.array=t}function ct(){}function Kp(d){Ti("_linkedBinding")}function Yp(d){Ti("dlopen")}function Jp(){return[]}function Qp(){return[]}function Xp(d,t){if(!d)throw new Error(t||"assertion error")}function Zp(){return!1}function eh(){return Bt.now()/1e3}function Vi(d){var t=Math.floor((Date.now()-Bt.now())*.001),r=Bt.now()*.001,n=Math.floor(r)+t,i=Math.floor(r%1*1e9);return d&&(n=n-d[0],i=i-d[1],i<0&&(n--,i+=ln)),[n,i]}function Lt(){return Bi}function th(d){return[]}var kt,or,ir,Ar,ma,ga,ya,ba,wa,va,Ea,ka,_a,Sa,Na,Ca,xa,Aa,Ia,Ta,Va,Pa,Ba,Oa,Da,an,Ra,Ma,$a,ja,La,Ua,Fa,za,Wa,qa,Ga,Ha,Ka,Ya,Ja,Qa,Xa,Za,el,tl,rl,nl,ol,il,sl,Bt,Pi,ln,al,ll,cl,dl,ul,fl,pl,hl,ml,gl,yl,Bi,bl=pt(()=>{be(),ve(),we(),kt=[],or=!1,Ar=-1,ha.prototype.run=function(){this.fun.apply(null,this.array)},ma="browser",ga="x64",ya="browser",ba={PATH:"/usr/bin",LANG:navigator.language+".UTF-8",PWD:"/",HOME:"/home",TMP:"/tmp"},wa=["/usr/bin/node"],va=[],Ea="v16.8.0",ka={},_a=function(d,t){console.warn((t?t+": ":"")+d)},Sa=function(d){Ti("binding")},Na=function(d){return 0},Ca=function(){return"/"},xa=function(d){},Aa={name:"node",sourceUrl:"",headersUrl:"",libUrl:""},Ia=ct,Ta=[],Va={},Pa=!1,Ba={},Oa=ct,Da=ct,an=function(){return{}},Ra=an,Ma=an,$a=ct,ja=ct,La=ct,Ua={},Fa={inspector:!1,debug:!1,uv:!1,ipv6:!1,tls_alpn:!1,tls_sni:!1,tls_ocsp:!1,tls:!1,cached_builtins:!0},za=ct,Wa=ct,qa=ct,Ga=ct,Ha=ct,Ka=ct,Ya=ct,Ja=void 0,Qa=void 0,Xa=void 0,Za=ct,el=2,tl=1,rl="/bin/usr/node",nl=9229,ol="node",il=[],sl=ct,Bt={now:typeof performance<"u"?performance.now.bind(performance):void 0,timing:typeof performance<"u"?performance.timing:void 0},Bt.now===void 0&&(Pi=Date.now(),Bt.timing&&Bt.timing.navigationStart&&(Pi=Bt.timing.navigationStart),Bt.now=()=>Date.now()-Pi),ln=1e9,Vi.bigint=function(d){var t=Vi(d);return typeof BigInt>"u"?t[0]*ln+t[1]:BigInt(t[0]*ln)+BigInt(t[1])},al=10,ll={},cl=0,dl=Lt,ul=Lt,fl=Lt,pl=Lt,hl=Lt,ml=ct,gl=Lt,yl=Lt,Bi={version:Ea,versions:ka,arch:ga,platform:ya,release:Aa,_rawDebug:Ia,moduleLoadList:Ta,binding:Sa,_linkedBinding:Kp,_events:ll,_eventsCount:cl,_maxListeners:al,on:Lt,addListener:dl,once:ul,off:fl,removeListener:pl,removeAllListeners:hl,emit:ml,prependListener:gl,prependOnceListener:yl,listeners:th,domain:Va,_exiting:Pa,config:Ba,dlopen:Yp,uptime:eh,_getActiveRequests:Jp,_getActiveHandles:Qp,reallyExit:Oa,_kill:Da,cpuUsage:an,resourceUsage:Ra,memoryUsage:Ma,kill:$a,exit:ja,openStdin:La,allowedNodeEnvironmentFlags:Ua,assert:Xp,features:Fa,_fatalExceptions:za,setUncaughtExceptionCaptureCallback:Wa,hasUncaughtExceptionCaptureCallback:Zp,emitWarning:_a,nextTick:Hp,_tickCallback:qa,_debugProcess:Ga,_debugEnd:Ha,_startProfilerIdleNotifier:Ka,_stopProfilerIdleNotifier:Ya,stdout:Ja,stdin:Xa,stderr:Qa,abort:Za,umask:Na,chdir:xa,cwd:Ca,env:ba,title:ma,argv:wa,execArgv:va,pid:el,ppid:tl,execPath:rl,debugPort:nl,hrtime:Vi,argv0:ol,_preload_modules:il,setSourceMapsEnabled:sl}});function rh(){if(Oi)return cn;Oi=!0;var d=Bi;function t(s){if(typeof s!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(s))}function r(s,o){for(var a="",l=0,c=-1,u=0,p,h=0;h<=s.length;++h){if(h<s.length)p=s.charCodeAt(h);else{if(p===47)break;p=47}if(p===47){if(!(c===h-1||u===1))if(c!==h-1&&u===2){if(a.length<2||l!==2||a.charCodeAt(a.length-1)!==46||a.charCodeAt(a.length-2)!==46){if(a.length>2){var m=a.lastIndexOf("/");if(m!==a.length-1){m===-1?(a="",l=0):(a=a.slice(0,m),l=a.length-1-a.lastIndexOf("/")),c=h,u=0;continue}}else if(a.length===2||a.length===1){a="",l=0,c=h,u=0;continue}}o&&(a.length>0?a+="/..":a="..",l=2)}else a.length>0?a+="/"+s.slice(c+1,h):a=s.slice(c+1,h),l=h-c-1;c=h,u=0}else p===46&&u!==-1?++u:u=-1}return a}function n(s,o){var a=o.dir||o.root,l=o.base||(o.name||"")+(o.ext||"");return a?a===o.root?a+l:a+s+l:l}var i={resolve:function(){for(var s="",o=!1,a,l=arguments.length-1;l>=-1&&!o;l--){var c;l>=0?c=arguments[l]:(a===void 0&&(a=d.cwd()),c=a),t(c),c.length!==0&&(s=c+"/"+s,o=c.charCodeAt(0)===47)}return s=r(s,!o),o?s.length>0?"/"+s:"/":s.length>0?s:"."},normalize:function(s){if(t(s),s.length===0)return".";var o=s.charCodeAt(0)===47,a=s.charCodeAt(s.length-1)===47;return s=r(s,!o),s.length===0&&!o&&(s="."),s.length>0&&a&&(s+="/"),o?"/"+s:s},isAbsolute:function(s){return t(s),s.length>0&&s.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var s,o=0;o<arguments.length;++o){var a=arguments[o];t(a),a.length>0&&(s===void 0?s=a:s+="/"+a)}return s===void 0?".":i.normalize(s)},relative:function(s,o){if(t(s),t(o),s===o||(s=i.resolve(s),o=i.resolve(o),s===o))return"";for(var a=1;a<s.length&&s.charCodeAt(a)===47;++a);for(var l=s.length,c=l-a,u=1;u<o.length&&o.charCodeAt(u)===47;++u);for(var p=o.length,h=p-u,m=c<h?c:h,f=-1,E=0;E<=m;++E){if(E===m){if(h>m){if(o.charCodeAt(u+E)===47)return o.slice(u+E+1);if(E===0)return o.slice(u+E)}else c>m&&(s.charCodeAt(a+E)===47?f=E:E===0&&(f=0));break}var N=s.charCodeAt(a+E),k=o.charCodeAt(u+E);if(N!==k)break;N===47&&(f=E)}var g="";for(E=a+f+1;E<=l;++E)(E===l||s.charCodeAt(E)===47)&&(g.length===0?g+="..":g+="/..");return g.length>0?g+o.slice(u+f):(u+=f,o.charCodeAt(u)===47&&++u,o.slice(u))},_makeLong:function(s){return s},dirname:function(s){if(t(s),s.length===0)return".";for(var o=s.charCodeAt(0),a=o===47,l=-1,c=!0,u=s.length-1;u>=1;--u)if(o=s.charCodeAt(u),o===47){if(!c){l=u;break}}else c=!1;return l===-1?a?"/":".":a&&l===1?"//":s.slice(0,l)},basename:function(s,o){if(o!==void 0&&typeof o!="string")throw new TypeError('"ext" argument must be a string');t(s);var a=0,l=-1,c=!0,u;if(o!==void 0&&o.length>0&&o.length<=s.length){if(o.length===s.length&&o===s)return"";var p=o.length-1,h=-1;for(u=s.length-1;u>=0;--u){var m=s.charCodeAt(u);if(m===47){if(!c){a=u+1;break}}else h===-1&&(c=!1,h=u+1),p>=0&&(m===o.charCodeAt(p)?--p===-1&&(l=u):(p=-1,l=h))}return a===l?l=h:l===-1&&(l=s.length),s.slice(a,l)}else{for(u=s.length-1;u>=0;--u)if(s.charCodeAt(u)===47){if(!c){a=u+1;break}}else l===-1&&(c=!1,l=u+1);return l===-1?"":s.slice(a,l)}},extname:function(s){t(s);for(var o=-1,a=0,l=-1,c=!0,u=0,p=s.length-1;p>=0;--p){var h=s.charCodeAt(p);if(h===47){if(!c){a=p+1;break}continue}l===-1&&(c=!1,l=p+1),h===46?o===-1?o=p:u!==1&&(u=1):o!==-1&&(u=-1)}return o===-1||l===-1||u===0||u===1&&o===l-1&&o===a+1?"":s.slice(o,l)},format:function(s){if(s===null||typeof s!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof s);return n("/",s)},parse:function(s){t(s);var o={root:"",dir:"",base:"",ext:"",name:""};if(s.length===0)return o;var a=s.charCodeAt(0),l=a===47,c;l?(o.root="/",c=1):c=0;for(var u=-1,p=0,h=-1,m=!0,f=s.length-1,E=0;f>=c;--f){if(a=s.charCodeAt(f),a===47){if(!m){p=f+1;break}continue}h===-1&&(m=!1,h=f+1),a===46?u===-1?u=f:E!==1&&(E=1):u!==-1&&(E=-1)}return u===-1||h===-1||E===0||E===1&&u===h-1&&u===p+1?h!==-1&&(p===0&&l?o.base=o.name=s.slice(1,h):o.base=o.name=s.slice(p,h)):(p===0&&l?(o.name=s.slice(1,u),o.base=s.slice(1,h)):(o.name=s.slice(p,u),o.base=s.slice(p,h)),o.ext=s.slice(u,h)),p>0?o.dir=s.slice(0,p-1):l&&(o.dir="/"),o},sep:"/",delimiter:":",win32:null,posix:null};return i.posix=i,cn=i,cn}var cn,Oi,Di,nh=pt(()=>{be(),ve(),we(),bl(),cn={},Oi=!1,Di=rh()}),wl={};lr(wl,{URL:()=>Tl,Url:()=>Nl,default:()=>dt,fileURLToPath:()=>El,format:()=>Cl,parse:()=>Il,pathToFileURL:()=>kl,resolve:()=>xl,resolveObject:()=>Al});function oh(){if(Mi)return dn;Mi=!0;var d=typeof Map=="function"&&Map.prototype,t=Object.getOwnPropertyDescriptor&&d?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,r=d&&t&&typeof t.get=="function"?t.get:null,n=d&&Map.prototype.forEach,i=typeof Set=="function"&&Set.prototype,s=Object.getOwnPropertyDescriptor&&i?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,o=i&&s&&typeof s.get=="function"?s.get:null,a=i&&Set.prototype.forEach,l=typeof WeakMap=="function"&&WeakMap.prototype,c=l?WeakMap.prototype.has:null,u=typeof WeakSet=="function"&&WeakSet.prototype,p=u?WeakSet.prototype.has:null,h=typeof WeakRef=="function"&&WeakRef.prototype,m=h?WeakRef.prototype.deref:null,f=Boolean.prototype.valueOf,E=Object.prototype.toString,N=Function.prototype.toString,k=String.prototype.match,g=String.prototype.slice,v=String.prototype.replace,_=String.prototype.toUpperCase,S=String.prototype.toLowerCase,B=RegExp.prototype.test,P=Array.prototype.concat,T=Array.prototype.join,A=Array.prototype.slice,C=Math.floor,O=typeof BigInt=="function"?BigInt.prototype.valueOf:null,I=Object.getOwnPropertySymbols,U=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,Y=typeof Symbol=="function"&&typeof Symbol.iterator=="object",j=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===Y||!0)?Symbol.toStringTag:null,le=Object.prototype.propertyIsEnumerable,ne=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(H){return H.__proto__}:null);function te(H,ee){if(H===1/0||H===-1/0||H!==H||H&&H>-1e3&&H<1e3||B.call(/e/,ee))return ee;var xe=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof H=="number"){var Ve=H<0?-C(-H):C(H);if(Ve!==H){var Pe=String(Ve),Me=g.call(ee,Pe.length+1);return v.call(Pe,xe,"$&_")+"."+v.call(v.call(Me,/([0-9]{3})/g,"$&_"),/_$/,"")}}return v.call(ee,xe,"$&_")}var ue=_l,$=ue.custom,se=oe($)?$:null;dn=function H(ee,xe,Ve,Pe){var Me=xe||{};if(z(Me,"quoteStyle")&&Me.quoteStyle!=="single"&&Me.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(z(Me,"maxStringLength")&&(typeof Me.maxStringLength=="number"?Me.maxStringLength<0&&Me.maxStringLength!==1/0:Me.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var Xe=z(Me,"customInspect")?Me.customInspect:!0;if(typeof Xe!="boolean"&&Xe!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(z(Me,"indent")&&Me.indent!==null&&Me.indent!==" "&&!(parseInt(Me.indent,10)===Me.indent&&Me.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(z(Me,"numericSeparator")&&typeof Me.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var et=Me.numericSeparator;if(typeof ee>"u")return"undefined";if(ee===null)return"null";if(typeof ee=="boolean")return ee?"true":"false";if(typeof ee=="string")return de(ee,Me);if(typeof ee=="number"){if(ee===0)return 1/0/ee>0?"0":"-0";var je=String(ee);return et?te(ee,je):je}if(typeof ee=="bigint"){var Ge=String(ee)+"n";return et?te(ee,Ge):Ge}var De=typeof Me.depth>"u"?5:Me.depth;if(typeof Ve>"u"&&(Ve=0),Ve>=De&&De>0&&typeof ee=="object")return me(ee)?"[Array]":"[Object]";var Ue=D(Me,Ve);if(typeof Pe>"u")Pe=[];else if(ae(Pe,ee)>=0)return"[Circular]";function qe(_t,Ht,ar){if(Ht&&(Pe=A.call(Pe),Pe.push(Ht)),ar){var St={depth:Me.depth};return z(Me,"quoteStyle")&&(St.quoteStyle=Me.quoteStyle),H(_t,St,Ve+1,Pe)}return H(_t,Me,Ve+1,Pe)}if(typeof ee=="function"&&!Se(ee)){var Ze=F(ee),it=re(ee,qe);return"[Function"+(Ze?": "+Ze:" (anonymous)")+"]"+(it.length>0?" { "+T.call(it,", ")+" }":"")}if(oe(ee)){var wt=Y?v.call(String(ee),/^(Symbol\(.*\))_[^)]*$/,"$1"):U.call(ee);return typeof ee=="object"&&!Y?y(wt):wt}if(ke(ee)){for(var R="<"+S.call(String(ee.nodeName)),W=ee.attributes||[],Ne=0;Ne<W.length;Ne++)R+=" "+W[Ne].name+"="+M(Q(W[Ne].value),"double",Me);return R+=">",ee.childNodes&&ee.childNodes.length&&(R+="..."),R+="</"+S.call(String(ee.nodeName))+">",R}if(me(ee)){if(ee.length===0)return"[]";var Ie=re(ee,qe);return Ue&&!x(Ie)?"["+L(Ie,Ue)+"]":"[ "+T.call(Ie,", ")+" ]"}if(Z(ee)){var Be=re(ee,qe);return!("cause"in Error.prototype)&&"cause"in ee&&!le.call(ee,"cause")?"{ ["+String(ee)+"] "+T.call(P.call("[cause]: "+qe(ee.cause),Be),", ")+" }":Be.length===0?"["+String(ee)+"]":"{ ["+String(ee)+"] "+T.call(Be,", ")+" }"}if(typeof ee=="object"&&Xe){if(se&&typeof ee[se]=="function"&&ue)return ue(ee,{depth:De-Ve});if(Xe!=="symbol"&&typeof ee.inspect=="function")return ee.inspect()}if(fe(ee)){var rt=[];return n&&n.call(ee,function(_t,Ht){rt.push(qe(Ht,ee,!0)+" => "+qe(_t,ee))}),w("Map",r.call(ee),rt,Ue)}if(J(ee)){var ft=[];return a&&a.call(ee,function(_t){ft.push(qe(_t,ee))}),w("Set",o.call(ee),ft,Ue)}if(pe(ee))return b("WeakMap");if(ge(ee))return b("WeakSet");if(ye(ee))return b("WeakRef");if(ce(ee))return y(qe(Number(ee)));if(ie(ee))return y(qe(O.call(ee)));if(X(ee))return y(f.call(ee));if(G(ee))return y(qe(String(ee)));if(typeof window<"u"&&ee===window)return"{ [object Window] }";if(typeof globalThis<"u"&&ee===globalThis||typeof un<"u"&&ee===un)return"{ [object globalThis] }";if(!K(ee)&&!Se(ee)){var vt=re(ee,qe),Vr=ne?ne(ee)===Object.prototype:ee instanceof Object||ee.constructor===Object,Pr=ee instanceof Object?"":"null prototype",Br=!Vr&&j&&Object(ee)===ee&&j in ee?g.call(V(ee),8,-1):Pr?"Object":"",Sn=Vr||typeof ee.constructor!="function"?"":ee.constructor.name?ee.constructor.name+" ":"",sr=Sn+(Br||Pr?"["+T.call(P.call([],Br||[],Pr||[]),": ")+"] ":"");return vt.length===0?sr+"{}":Ue?sr+"{"+L(vt,Ue)+"}":sr+"{ "+T.call(vt,", ")+" }"}return String(ee)};function M(H,ee,xe){var Ve=(xe.quoteStyle||ee)==="double"?'"':"'";return Ve+H+Ve}function Q(H){return v.call(String(H),/"/g,"&quot;")}function me(H){return V(H)==="[object Array]"&&(!j||!(typeof H=="object"&&j in H))}function K(H){return V(H)==="[object Date]"&&(!j||!(typeof H=="object"&&j in H))}function Se(H){return V(H)==="[object RegExp]"&&(!j||!(typeof H=="object"&&j in H))}function Z(H){return V(H)==="[object Error]"&&(!j||!(typeof H=="object"&&j in H))}function G(H){return V(H)==="[object String]"&&(!j||!(typeof H=="object"&&j in H))}function ce(H){return V(H)==="[object Number]"&&(!j||!(typeof H=="object"&&j in H))}function X(H){return V(H)==="[object Boolean]"&&(!j||!(typeof H=="object"&&j in H))}function oe(H){if(Y)return H&&typeof H=="object"&&H instanceof Symbol;if(typeof H=="symbol")return!0;if(!H||typeof H!="object"||!U)return!1;try{return U.call(H),!0}catch{}return!1}function ie(H){if(!H||typeof H!="object"||!O)return!1;try{return O.call(H),!0}catch{}return!1}var Ee=Object.prototype.hasOwnProperty||function(H){return H in(this||un)};function z(H,ee){return Ee.call(H,ee)}function V(H){return E.call(H)}function F(H){if(H.name)return H.name;var ee=k.call(N.call(H),/^function\s*([\w$]+)/);return ee?ee[1]:null}function ae(H,ee){if(H.indexOf)return H.indexOf(ee);for(var xe=0,Ve=H.length;xe<Ve;xe++)if(H[xe]===ee)return xe;return-1}function fe(H){if(!r||!H||typeof H!="object")return!1;try{r.call(H);try{o.call(H)}catch{return!0}return H instanceof Map}catch{}return!1}function pe(H){if(!c||!H||typeof H!="object")return!1;try{c.call(H,c);try{p.call(H,p)}catch{return!0}return H instanceof WeakMap}catch{}return!1}function ye(H){if(!m||!H||typeof H!="object")return!1;try{return m.call(H),!0}catch{}return!1}function J(H){if(!o||!H||typeof H!="object")return!1;try{o.call(H);try{r.call(H)}catch{return!0}return H instanceof Set}catch{}return!1}function ge(H){if(!p||!H||typeof H!="object")return!1;try{p.call(H,p);try{c.call(H,c)}catch{return!0}return H instanceof WeakSet}catch{}return!1}function ke(H){return!H||typeof H!="object"?!1:typeof HTMLElement<"u"&&H instanceof HTMLElement?!0:typeof H.nodeName=="string"&&typeof H.getAttribute=="function"}function de(H,ee){if(H.length>ee.maxStringLength){var xe=H.length-ee.maxStringLength,Ve="... "+xe+" more character"+(xe>1?"s":"");return de(g.call(H,0,ee.maxStringLength),ee)+Ve}var Pe=v.call(v.call(H,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,Ce);return M(Pe,"single",ee)}function Ce(H){var ee=H.charCodeAt(0),xe={8:"b",9:"t",10:"n",12:"f",13:"r"}[ee];return xe?"\\"+xe:"\\x"+(ee<16?"0":"")+_.call(ee.toString(16))}function y(H){return"Object("+H+")"}function b(H){return H+" { ? }"}function w(H,ee,xe,Ve){var Pe=Ve?L(xe,Ve):T.call(xe,", ");return H+" ("+ee+") {"+Pe+"}"}function x(H){for(var ee=0;ee<H.length;ee++)if(ae(H[ee],`
265
+ `)>=0)return!1;return!0}function D(H,ee){var xe;if(H.indent===" ")xe=" ";else if(typeof H.indent=="number"&&H.indent>0)xe=T.call(Array(H.indent+1)," ");else return null;return{base:xe,prev:T.call(Array(ee+1),xe)}}function L(H,ee){if(H.length===0)return"";var xe=`
266
+ `+ee.prev+ee.base;return xe+T.call(H,","+xe)+`
267
+ `+ee.prev}function re(H,ee){var xe=me(H),Ve=[];if(xe){Ve.length=H.length;for(var Pe=0;Pe<H.length;Pe++)Ve[Pe]=z(H,Pe)?ee(H[Pe],H):""}var Me=typeof I=="function"?I(H):[],Xe;if(Y){Xe={};for(var et=0;et<Me.length;et++)Xe["$"+Me[et]]=Me[et]}for(var je in H)z(H,je)&&(xe&&String(Number(je))===je&&je<H.length||Y&&Xe["$"+je]instanceof Symbol||(B.call(/[^\w$]/,je)?Ve.push(ee(je,H)+": "+ee(H[je],H)):Ve.push(je+": "+ee(H[je],H))));if(typeof I=="function")for(var Ge=0;Ge<Me.length;Ge++)le.call(H,Me[Ge])&&Ve.push("["+ee(Me[Ge])+"]: "+ee(H[Me[Ge]],H));return Ve}return dn}function ih(){if($i)return fn;$i=!0;var d=pr(),t=Wp(),r=oh(),n=xr(),i=d("%WeakMap%",!0),s=d("%Map%",!0),o=t("WeakMap.prototype.get",!0),a=t("WeakMap.prototype.set",!0),l=t("WeakMap.prototype.has",!0),c=t("Map.prototype.get",!0),u=t("Map.prototype.set",!0),p=t("Map.prototype.has",!0),h=function(N,k){for(var g=N,v;(v=g.next)!==null;g=v)if(v.key===k)return g.next=v.next,v.next=N.next,N.next=v,v},m=function(N,k){var g=h(N,k);return g&&g.value},f=function(N,k,g){var v=h(N,k);v?v.value=g:N.next={key:k,next:N.next,value:g}},E=function(N,k){return!!h(N,k)};return fn=function(){var N,k,g,v={assert:function(_){if(!v.has(_))throw new n("Side channel does not contain "+r(_))},get:function(_){if(i&&_&&(typeof _=="object"||typeof _=="function")){if(N)return o(N,_)}else if(s){if(k)return c(k,_)}else if(g)return m(g,_)},has:function(_){if(i&&_&&(typeof _=="object"||typeof _=="function")){if(N)return l(N,_)}else if(s){if(k)return p(k,_)}else if(g)return E(g,_);return!1},set:function(_,S){i&&_&&(typeof _=="object"||typeof _=="function")?(N||(N=new i),a(N,_,S)):s?(k||(k=new s),u(k,_,S)):(g||(g={key:{},next:null}),f(g,_,S))}};return v},fn}function Ri(){if(ji)return pn;ji=!0;var d=String.prototype.replace,t=/%20/g,r={RFC1738:"RFC1738",RFC3986:"RFC3986"};return pn={default:r.RFC3986,formatters:{RFC1738:function(n){return d.call(n,t,"+")},RFC3986:function(n){return String(n)}},RFC1738:r.RFC1738,RFC3986:r.RFC3986},pn}function vl(){if(Li)return hn;Li=!0;var d=Ri(),t=Object.prototype.hasOwnProperty,r=Array.isArray,n=function(){for(var N=[],k=0;k<256;++k)N.push("%"+((k<16?"0":"")+k.toString(16)).toUpperCase());return N}(),i=function(N){for(;N.length>1;){var k=N.pop(),g=k.obj[k.prop];if(r(g)){for(var v=[],_=0;_<g.length;++_)typeof g[_]<"u"&&v.push(g[_]);k.obj[k.prop]=v}}},s=function(N,k){for(var g=k&&k.plainObjects?Object.create(null):{},v=0;v<N.length;++v)typeof N[v]<"u"&&(g[v]=N[v]);return g},o=function N(k,g,v){if(!g)return k;if(typeof g!="object"){if(r(k))k.push(g);else if(k&&typeof k=="object")(v&&(v.plainObjects||v.allowPrototypes)||!t.call(Object.prototype,g))&&(k[g]=!0);else return[k,g];return k}if(!k||typeof k!="object")return[k].concat(g);var _=k;return r(k)&&!r(g)&&(_=s(k,v)),r(k)&&r(g)?(g.forEach(function(S,B){if(t.call(k,B)){var P=k[B];P&&typeof P=="object"&&S&&typeof S=="object"?k[B]=N(P,S,v):k.push(S)}else k[B]=S}),k):Object.keys(g).reduce(function(S,B){var P=g[B];return t.call(S,B)?S[B]=N(S[B],P,v):S[B]=P,S},_)},a=function(N,k){return Object.keys(k).reduce(function(g,v){return g[v]=k[v],g},N)},l=function(N,k,g){var v=N.replace(/\+/g," ");if(g==="iso-8859-1")return v.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(v)}catch{return v}},c=1024,u=function(N,k,g,v,_){if(N.length===0)return N;var S=N;if(typeof N=="symbol"?S=Symbol.prototype.toString.call(N):typeof N!="string"&&(S=String(N)),g==="iso-8859-1")return escape(S).replace(/%u[0-9a-f]{4}/gi,function(I){return"%26%23"+parseInt(I.slice(2),16)+"%3B"});for(var B="",P=0;P<S.length;P+=c){for(var T=S.length>=c?S.slice(P,P+c):S,A=[],C=0;C<T.length;++C){var O=T.charCodeAt(C);if(O===45||O===46||O===95||O===126||O>=48&&O<=57||O>=65&&O<=90||O>=97&&O<=122||_===d.RFC1738&&(O===40||O===41)){A[A.length]=T.charAt(C);continue}if(O<128){A[A.length]=n[O];continue}if(O<2048){A[A.length]=n[192|O>>6]+n[128|O&63];continue}if(O<55296||O>=57344){A[A.length]=n[224|O>>12]+n[128|O>>6&63]+n[128|O&63];continue}C+=1,O=65536+((O&1023)<<10|T.charCodeAt(C)&1023),A[A.length]=n[240|O>>18]+n[128|O>>12&63]+n[128|O>>6&63]+n[128|O&63]}B+=A.join("")}return B},p=function(N){for(var k=[{obj:{o:N},prop:"o"}],g=[],v=0;v<k.length;++v)for(var _=k[v],S=_.obj[_.prop],B=Object.keys(S),P=0;P<B.length;++P){var T=B[P],A=S[T];typeof A=="object"&&A!==null&&g.indexOf(A)===-1&&(k.push({obj:S,prop:T}),g.push(A))}return i(k),N},h=function(N){return Object.prototype.toString.call(N)==="[object RegExp]"},m=function(N){return!N||typeof N!="object"?!1:!!(N.constructor&&N.constructor.isBuffer&&N.constructor.isBuffer(N))},f=function(N,k){return[].concat(N,k)},E=function(N,k){if(r(N)){for(var g=[],v=0;v<N.length;v+=1)g.push(k(N[v]));return g}return k(N)};return hn={arrayToObject:s,assign:a,combine:f,compact:p,decode:l,encode:u,isBuffer:m,isRegExp:h,maybeMap:E,merge:o},hn}function sh(){if(Ui)return mn;Ui=!0;var d=ih(),t=vl(),r=Ri(),n=Object.prototype.hasOwnProperty,i={brackets:function(E){return E+"[]"},comma:"comma",indices:function(E,N){return E+"["+N+"]"},repeat:function(E){return E}},s=Array.isArray,o=Array.prototype.push,a=function(E,N){o.apply(E,s(N)?N:[N])},l=Date.prototype.toISOString,c=r.default,u={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:t.encode,encodeValuesOnly:!1,format:c,formatter:r.formatters[c],indices:!1,serializeDate:function(E){return l.call(E)},skipNulls:!1,strictNullHandling:!1},p=function(E){return typeof E=="string"||typeof E=="number"||typeof E=="boolean"||typeof E=="symbol"||typeof E=="bigint"},h={},m=function E(N,k,g,v,_,S,B,P,T,A,C,O,I,U,Y,j,le,ne){for(var te=N,ue=ne,$=0,se=!1;(ue=ue.get(h))!==void 0&&!se;){var M=ue.get(N);if($+=1,typeof M<"u"){if(M===$)throw new RangeError("Cyclic object value");se=!0}typeof ue.get(h)>"u"&&($=0)}if(typeof A=="function"?te=A(k,te):te instanceof Date?te=I(te):g==="comma"&&s(te)&&(te=t.maybeMap(te,function(V){return V instanceof Date?I(V):V})),te===null){if(S)return T&&!j?T(k,u.encoder,le,"key",U):k;te=""}if(p(te)||t.isBuffer(te)){if(T){var Q=j?k:T(k,u.encoder,le,"key",U);return[Y(Q)+"="+Y(T(te,u.encoder,le,"value",U))]}return[Y(k)+"="+Y(String(te))]}var me=[];if(typeof te>"u")return me;var K;if(g==="comma"&&s(te))j&&T&&(te=t.maybeMap(te,T)),K=[{value:te.length>0?te.join(",")||null:void 0}];else if(s(A))K=A;else{var Se=Object.keys(te);K=C?Se.sort(C):Se}var Z=P?k.replace(/\./g,"%2E"):k,G=v&&s(te)&&te.length===1?Z+"[]":Z;if(_&&s(te)&&te.length===0)return G+"[]";for(var ce=0;ce<K.length;++ce){var X=K[ce],oe=typeof X=="object"&&typeof X.value<"u"?X.value:te[X];if(!(B&&oe===null)){var ie=O&&P?X.replace(/\./g,"%2E"):X,Ee=s(te)?typeof g=="function"?g(G,ie):G:G+(O?"."+ie:"["+ie+"]");ne.set(N,$);var z=d();z.set(h,ne),a(me,E(oe,Ee,g,v,_,S,B,P,g==="comma"&&j&&s(te)?null:T,A,C,O,I,U,Y,j,le,z))}}return me},f=function(E){if(!E)return u;if(typeof E.allowEmptyArrays<"u"&&typeof E.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof E.encodeDotInKeys<"u"&&typeof E.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(E.encoder!==null&&typeof E.encoder<"u"&&typeof E.encoder!="function")throw new TypeError("Encoder has to be a function.");var N=E.charset||u.charset;if(typeof E.charset<"u"&&E.charset!=="utf-8"&&E.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var k=r.default;if(typeof E.format<"u"){if(!n.call(r.formatters,E.format))throw new TypeError("Unknown format option provided.");k=E.format}var g=r.formatters[k],v=u.filter;(typeof E.filter=="function"||s(E.filter))&&(v=E.filter);var _;if(E.arrayFormat in i?_=E.arrayFormat:"indices"in E?_=E.indices?"indices":"repeat":_=u.arrayFormat,"commaRoundTrip"in E&&typeof E.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var S=typeof E.allowDots>"u"?E.encodeDotInKeys===!0?!0:u.allowDots:!!E.allowDots;return{addQueryPrefix:typeof E.addQueryPrefix=="boolean"?E.addQueryPrefix:u.addQueryPrefix,allowDots:S,allowEmptyArrays:typeof E.allowEmptyArrays=="boolean"?!!E.allowEmptyArrays:u.allowEmptyArrays,arrayFormat:_,charset:N,charsetSentinel:typeof E.charsetSentinel=="boolean"?E.charsetSentinel:u.charsetSentinel,commaRoundTrip:E.commaRoundTrip,delimiter:typeof E.delimiter>"u"?u.delimiter:E.delimiter,encode:typeof E.encode=="boolean"?E.encode:u.encode,encodeDotInKeys:typeof E.encodeDotInKeys=="boolean"?E.encodeDotInKeys:u.encodeDotInKeys,encoder:typeof E.encoder=="function"?E.encoder:u.encoder,encodeValuesOnly:typeof E.encodeValuesOnly=="boolean"?E.encodeValuesOnly:u.encodeValuesOnly,filter:v,format:k,formatter:g,serializeDate:typeof E.serializeDate=="function"?E.serializeDate:u.serializeDate,skipNulls:typeof E.skipNulls=="boolean"?E.skipNulls:u.skipNulls,sort:typeof E.sort=="function"?E.sort:null,strictNullHandling:typeof E.strictNullHandling=="boolean"?E.strictNullHandling:u.strictNullHandling}};return mn=function(E,N){var k=E,g=f(N),v,_;typeof g.filter=="function"?(_=g.filter,k=_("",k)):s(g.filter)&&(_=g.filter,v=_);var S=[];if(typeof k!="object"||k===null)return"";var B=i[g.arrayFormat],P=B==="comma"&&g.commaRoundTrip;v||(v=Object.keys(k)),g.sort&&v.sort(g.sort);for(var T=d(),A=0;A<v.length;++A){var C=v[A];g.skipNulls&&k[C]===null||a(S,m(k[C],C,B,P,g.allowEmptyArrays,g.strictNullHandling,g.skipNulls,g.encodeDotInKeys,g.encode?g.encoder:null,g.filter,g.sort,g.allowDots,g.serializeDate,g.format,g.formatter,g.encodeValuesOnly,g.charset,T))}var O=S.join(g.delimiter),I=g.addQueryPrefix===!0?"?":"";return g.charsetSentinel&&(g.charset==="iso-8859-1"?I+="utf8=%26%2310003%3B&":I+="utf8=%E2%9C%93&"),O.length>0?I+O:""},mn}function ah(){if(Fi)return gn;Fi=!0;var d=vl(),t=Object.prototype.hasOwnProperty,r=Array.isArray,n={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:d.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictNullHandling:!1},i=function(h){return h.replace(/&#(\d+);/g,function(m,f){return String.fromCharCode(parseInt(f,10))})},s=function(h,m){return h&&typeof h=="string"&&m.comma&&h.indexOf(",")>-1?h.split(","):h},o="utf8=%26%2310003%3B",a="utf8=%E2%9C%93",l=function(h,m){var f={__proto__:null},E=m.ignoreQueryPrefix?h.replace(/^\?/,""):h;E=E.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var N=m.parameterLimit===1/0?void 0:m.parameterLimit,k=E.split(m.delimiter,N),g=-1,v,_=m.charset;if(m.charsetSentinel)for(v=0;v<k.length;++v)k[v].indexOf("utf8=")===0&&(k[v]===a?_="utf-8":k[v]===o&&(_="iso-8859-1"),g=v,v=k.length);for(v=0;v<k.length;++v)if(v!==g){var S=k[v],B=S.indexOf("]="),P=B===-1?S.indexOf("="):B+1,T,A;P===-1?(T=m.decoder(S,n.decoder,_,"key"),A=m.strictNullHandling?null:""):(T=m.decoder(S.slice(0,P),n.decoder,_,"key"),A=d.maybeMap(s(S.slice(P+1),m),function(O){return m.decoder(O,n.decoder,_,"value")})),A&&m.interpretNumericEntities&&_==="iso-8859-1"&&(A=i(A)),S.indexOf("[]=")>-1&&(A=r(A)?[A]:A);var C=t.call(f,T);C&&m.duplicates==="combine"?f[T]=d.combine(f[T],A):(!C||m.duplicates==="last")&&(f[T]=A)}return f},c=function(h,m,f,E){for(var N=E?m:s(m,f),k=h.length-1;k>=0;--k){var g,v=h[k];if(v==="[]"&&f.parseArrays)g=f.allowEmptyArrays&&(N===""||f.strictNullHandling&&N===null)?[]:[].concat(N);else{g=f.plainObjects?Object.create(null):{};var _=v.charAt(0)==="["&&v.charAt(v.length-1)==="]"?v.slice(1,-1):v,S=f.decodeDotInKeys?_.replace(/%2E/g,"."):_,B=parseInt(S,10);!f.parseArrays&&S===""?g={0:N}:!isNaN(B)&&v!==S&&String(B)===S&&B>=0&&f.parseArrays&&B<=f.arrayLimit?(g=[],g[B]=N):S!=="__proto__"&&(g[S]=N)}N=g}return N},u=function(h,m,f,E){if(h){var N=f.allowDots?h.replace(/\.([^.[]+)/g,"[$1]"):h,k=/(\[[^[\]]*])/,g=/(\[[^[\]]*])/g,v=f.depth>0&&k.exec(N),_=v?N.slice(0,v.index):N,S=[];if(_){if(!f.plainObjects&&t.call(Object.prototype,_)&&!f.allowPrototypes)return;S.push(_)}for(var B=0;f.depth>0&&(v=g.exec(N))!==null&&B<f.depth;){if(B+=1,!f.plainObjects&&t.call(Object.prototype,v[1].slice(1,-1))&&!f.allowPrototypes)return;S.push(v[1])}if(v){if(f.strictDepth===!0)throw new RangeError("Input depth exceeded depth option of "+f.depth+" and strictDepth is true");S.push("["+N.slice(v.index)+"]")}return c(S,m,f,E)}},p=function(h){if(!h)return n;if(typeof h.allowEmptyArrays<"u"&&typeof h.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof h.decodeDotInKeys<"u"&&typeof h.decodeDotInKeys!="boolean")throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(h.decoder!==null&&typeof h.decoder<"u"&&typeof h.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof h.charset<"u"&&h.charset!=="utf-8"&&h.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var m=typeof h.charset>"u"?n.charset:h.charset,f=typeof h.duplicates>"u"?n.duplicates:h.duplicates;if(f!=="combine"&&f!=="first"&&f!=="last")throw new TypeError("The duplicates option must be either combine, first, or last");var E=typeof h.allowDots>"u"?h.decodeDotInKeys===!0?!0:n.allowDots:!!h.allowDots;return{allowDots:E,allowEmptyArrays:typeof h.allowEmptyArrays=="boolean"?!!h.allowEmptyArrays:n.allowEmptyArrays,allowPrototypes:typeof h.allowPrototypes=="boolean"?h.allowPrototypes:n.allowPrototypes,allowSparse:typeof h.allowSparse=="boolean"?h.allowSparse:n.allowSparse,arrayLimit:typeof h.arrayLimit=="number"?h.arrayLimit:n.arrayLimit,charset:m,charsetSentinel:typeof h.charsetSentinel=="boolean"?h.charsetSentinel:n.charsetSentinel,comma:typeof h.comma=="boolean"?h.comma:n.comma,decodeDotInKeys:typeof h.decodeDotInKeys=="boolean"?h.decodeDotInKeys:n.decodeDotInKeys,decoder:typeof h.decoder=="function"?h.decoder:n.decoder,delimiter:typeof h.delimiter=="string"||d.isRegExp(h.delimiter)?h.delimiter:n.delimiter,depth:typeof h.depth=="number"||h.depth===!1?+h.depth:n.depth,duplicates:f,ignoreQueryPrefix:h.ignoreQueryPrefix===!0,interpretNumericEntities:typeof h.interpretNumericEntities=="boolean"?h.interpretNumericEntities:n.interpretNumericEntities,parameterLimit:typeof h.parameterLimit=="number"?h.parameterLimit:n.parameterLimit,parseArrays:h.parseArrays!==!1,plainObjects:typeof h.plainObjects=="boolean"?h.plainObjects:n.plainObjects,strictDepth:typeof h.strictDepth=="boolean"?!!h.strictDepth:n.strictDepth,strictNullHandling:typeof h.strictNullHandling=="boolean"?h.strictNullHandling:n.strictNullHandling}};return gn=function(h,m){var f=p(m);if(h===""||h===null||typeof h>"u")return f.plainObjects?Object.create(null):{};for(var E=typeof h=="string"?l(h,f):h,N=f.plainObjects?Object.create(null):{},k=Object.keys(E),g=0;g<k.length;++g){var v=k[g],_=u(v,E[v],f,typeof h=="string");N=d.merge(N,_,f)}return f.allowSparse===!0?N:d.compact(N)},gn}function lh(){if(zi)return yn;zi=!0;var d=sh(),t=ah(),r=Ri();return yn={formats:r,parse:t,stringify:d},yn}function ch(){if(Wi)return Ut;Wi=!0;var d=jt;function t(){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}var r=/^([a-z0-9.+-]+:)/i,n=/:[0-9]*$/,i=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,s=["<",">",'"',"`"," ","\r",`
268
+ `," "],o=["{","}","|","\\","^","`"].concat(s),a=["'"].concat(o),l=["%","/","?",";","#"].concat(a),c=["/","?","#"],u=255,p=/^[+a-z0-9A-Z_-]{0,63}$/,h=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,m={javascript:!0,"javascript:":!0},f={javascript:!0,"javascript:":!0},E={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},N=lh();function k(S,B,P){if(S&&typeof S=="object"&&S instanceof t)return S;var T=new t;return T.parse(S,B,P),T}t.prototype.parse=function(S,B,P){if(typeof S!="string")throw new TypeError("Parameter 'url' must be a string, not "+typeof S);var T=S.indexOf("?"),A=T!==-1&&T<S.indexOf("#")?"?":"#",C=S.split(A),O=/\\/g;C[0]=C[0].replace(O,"/"),S=C.join(A);var I=S;if(I=I.trim(),!P&&S.split("#").length===1){var U=i.exec(I);if(U)return this.path=I,this.href=I,this.pathname=U[1],U[2]?(this.search=U[2],B?this.query=N.parse(this.search.substr(1)):this.query=this.search.substr(1)):B&&(this.search="",this.query={}),this}var Y=r.exec(I);if(Y){Y=Y[0];var j=Y.toLowerCase();this.protocol=j,I=I.substr(Y.length)}if(P||Y||I.match(/^\/\/[^@/]+@[^@/]+/)){var le=I.substr(0,2)==="//";le&&!(Y&&f[Y])&&(I=I.substr(2),this.slashes=!0)}if(!f[Y]&&(le||Y&&!E[Y])){for(var ne=-1,te=0;te<c.length;te++){var ue=I.indexOf(c[te]);ue!==-1&&(ne===-1||ue<ne)&&(ne=ue)}var $,se;ne===-1?se=I.lastIndexOf("@"):se=I.lastIndexOf("@",ne),se!==-1&&($=I.slice(0,se),I=I.slice(se+1),this.auth=decodeURIComponent($)),ne=-1;for(var te=0;te<l.length;te++){var ue=I.indexOf(l[te]);ue!==-1&&(ne===-1||ue<ne)&&(ne=ue)}ne===-1&&(ne=I.length),this.host=I.slice(0,ne),I=I.slice(ne),this.parseHost(),this.hostname=this.hostname||"";var M=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!M)for(var Q=this.hostname.split(/\./),te=0,me=Q.length;te<me;te++){var K=Q[te];if(K&&!K.match(p)){for(var Se="",Z=0,G=K.length;Z<G;Z++)K.charCodeAt(Z)>127?Se+="x":Se+=K[Z];if(!Se.match(p)){var ce=Q.slice(0,te),X=Q.slice(te+1),oe=K.match(h);oe&&(ce.push(oe[1]),X.unshift(oe[2])),X.length&&(I="/"+X.join(".")+I),this.hostname=ce.join(".");break}}}this.hostname.length>u?this.hostname="":this.hostname=this.hostname.toLowerCase(),M||(this.hostname=d.toASCII(this.hostname));var ie=this.port?":"+this.port:"",Ee=this.hostname||"";this.host=Ee+ie,this.href+=this.host,M&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),I[0]!=="/"&&(I="/"+I))}if(!m[j])for(var te=0,me=a.length;te<me;te++){var z=a[te];if(I.indexOf(z)!==-1){var V=encodeURIComponent(z);V===z&&(V=escape(z)),I=I.split(z).join(V)}}var F=I.indexOf("#");F!==-1&&(this.hash=I.substr(F),I=I.slice(0,F));var ae=I.indexOf("?");if(ae!==-1?(this.search=I.substr(ae),this.query=I.substr(ae+1),B&&(this.query=N.parse(this.query)),I=I.slice(0,ae)):B&&(this.search="",this.query={}),I&&(this.pathname=I),E[j]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var ie=this.pathname||"",fe=this.search||"";this.path=ie+fe}return this.href=this.format(),this};function g(S){return typeof S=="string"&&(S=k(S)),S instanceof t?S.format():t.prototype.format.call(S)}t.prototype.format=function(){var S=this.auth||"";S&&(S=encodeURIComponent(S),S=S.replace(/%3A/i,":"),S+="@");var B=this.protocol||"",P=this.pathname||"",T=this.hash||"",A=!1,C="";this.host?A=S+this.host:this.hostname&&(A=S+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(A+=":"+this.port)),this.query&&typeof this.query=="object"&&Object.keys(this.query).length&&(C=N.stringify(this.query,{arrayFormat:"repeat",addQueryPrefix:!1}));var O=this.search||C&&"?"+C||"";return B&&B.substr(-1)!==":"&&(B+=":"),this.slashes||(!B||E[B])&&A!==!1?(A="//"+(A||""),P&&P.charAt(0)!=="/"&&(P="/"+P)):A||(A=""),T&&T.charAt(0)!=="#"&&(T="#"+T),O&&O.charAt(0)!=="?"&&(O="?"+O),P=P.replace(/[?#]/g,function(I){return encodeURIComponent(I)}),O=O.replace("#","%23"),B+A+P+O+T};function v(S,B){return k(S,!1,!0).resolve(B)}t.prototype.resolve=function(S){return this.resolveObject(k(S,!1,!0)).format()};function _(S,B){return S?k(S,!1,!0).resolveObject(B):B}return t.prototype.resolveObject=function(S){if(typeof S=="string"){var B=new t;B.parse(S,!1,!0),S=B}for(var P=new t,T=Object.keys(this),A=0;A<T.length;A++){var C=T[A];P[C]=this[C]}if(P.hash=S.hash,S.href==="")return P.href=P.format(),P;if(S.slashes&&!S.protocol){for(var O=Object.keys(S),I=0;I<O.length;I++){var U=O[I];U!=="protocol"&&(P[U]=S[U])}return E[P.protocol]&&P.hostname&&!P.pathname&&(P.pathname="/",P.path=P.pathname),P.href=P.format(),P}if(S.protocol&&S.protocol!==P.protocol){if(!E[S.protocol]){for(var Y=Object.keys(S),j=0;j<Y.length;j++){var le=Y[j];P[le]=S[le]}return P.href=P.format(),P}if(P.protocol=S.protocol,!S.host&&!f[S.protocol]){for(var me=(S.pathname||"").split("/");me.length&&!(S.host=me.shift()););S.host||(S.host=""),S.hostname||(S.hostname=""),me[0]!==""&&me.unshift(""),me.length<2&&me.unshift(""),P.pathname=me.join("/")}else P.pathname=S.pathname;if(P.search=S.search,P.query=S.query,P.host=S.host||"",P.auth=S.auth,P.hostname=S.hostname||S.host,P.port=S.port,P.pathname||P.search){var ne=P.pathname||"",te=P.search||"";P.path=ne+te}return P.slashes=P.slashes||S.slashes,P.href=P.format(),P}var ue=P.pathname&&P.pathname.charAt(0)==="/",$=S.host||S.pathname&&S.pathname.charAt(0)==="/",se=$||ue||P.host&&S.pathname,M=se,Q=P.pathname&&P.pathname.split("/")||[],me=S.pathname&&S.pathname.split("/")||[],K=P.protocol&&!E[P.protocol];if(K&&(P.hostname="",P.port=null,P.host&&(Q[0]===""?Q[0]=P.host:Q.unshift(P.host)),P.host="",S.protocol&&(S.hostname=null,S.port=null,S.host&&(me[0]===""?me[0]=S.host:me.unshift(S.host)),S.host=null),se=se&&(me[0]===""||Q[0]==="")),$)P.host=S.host||S.host===""?S.host:P.host,P.hostname=S.hostname||S.hostname===""?S.hostname:P.hostname,P.search=S.search,P.query=S.query,Q=me;else if(me.length)Q||(Q=[]),Q.pop(),Q=Q.concat(me),P.search=S.search,P.query=S.query;else if(S.search!=null){if(K){P.host=Q.shift(),P.hostname=P.host;var Se=P.host&&P.host.indexOf("@")>0?P.host.split("@"):!1;Se&&(P.auth=Se.shift(),P.hostname=Se.shift(),P.host=P.hostname)}return P.search=S.search,P.query=S.query,(P.pathname!==null||P.search!==null)&&(P.path=(P.pathname?P.pathname:"")+(P.search?P.search:"")),P.href=P.format(),P}if(!Q.length)return P.pathname=null,P.search?P.path="/"+P.search:P.path=null,P.href=P.format(),P;for(var Z=Q.slice(-1)[0],G=(P.host||S.host||Q.length>1)&&(Z==="."||Z==="..")||Z==="",ce=0,X=Q.length;X>=0;X--)Z=Q[X],Z==="."?Q.splice(X,1):Z===".."?(Q.splice(X,1),ce++):ce&&(Q.splice(X,1),ce--);if(!se&&!M)for(;ce--;ce)Q.unshift("..");se&&Q[0]!==""&&(!Q[0]||Q[0].charAt(0)!=="/")&&Q.unshift(""),G&&Q.join("/").substr(-1)!=="/"&&Q.push("");var oe=Q[0]===""||Q[0]&&Q[0].charAt(0)==="/";if(K){P.hostname=oe?"":Q.length?Q.shift():"",P.host=P.hostname;var Se=P.host&&P.host.indexOf("@")>0?P.host.split("@"):!1;Se&&(P.auth=Se.shift(),P.hostname=Se.shift(),P.host=P.hostname)}return se=se||P.host&&Q.length,se&&!oe&&Q.unshift(""),Q.length>0?P.pathname=Q.join("/"):(P.pathname=null,P.path=null),(P.pathname!==null||P.search!==null)&&(P.path=(P.pathname?P.pathname:"")+(P.search?P.search:"")),P.auth=S.auth||P.auth,P.slashes=P.slashes||S.slashes,P.href=P.format(),P},t.prototype.parseHost=function(){var S=this.host,B=n.exec(S);B&&(B=B[0],B!==":"&&(this.port=B.substr(1)),S=S.substr(0,S.length-B.length)),S&&(this.hostname=S)},Ut.parse=k,Ut.resolve=v,Ut.resolveObject=_,Ut.format=g,Ut.Url=t,Ut}function El(d){if(typeof d=="string")d=new URL(d);else if(!(d instanceof URL))throw new Deno.errors.InvalidData("invalid argument path , must be a string or URL");if(d.protocol!=="file:")throw new Deno.errors.InvalidData("invalid url scheme");return bn?dh(d):uh(d)}function dh(d){let t=d.hostname,r=d.pathname;for(let n=0;n<r.length;n++)if(r[n]==="%"){let i=r.codePointAt(n+2)||32;if(r[n+1]==="2"&&i===102||r[n+1]==="5"&&i===99)throw new Deno.errors.InvalidData("must not include encoded \\ or / characters")}if(r=r.replace(Dl,"\\"),r=decodeURIComponent(r),t!=="")return`\\\\${t}${r}`;{let n=r.codePointAt(1)|32,i=r[2];if(n<Bl||n>Ol||i!==":")throw new Deno.errors.InvalidData("file url path must be absolute");return r.slice(1)}}function uh(d){if(d.hostname!=="")throw new Deno.errors.InvalidData("invalid file url hostname");let t=d.pathname;for(let r=0;r<t.length;r++)if(t[r]==="%"){let n=t.codePointAt(r+2)||32;if(t[r+1]==="2"&&n===102)throw new Deno.errors.InvalidData("must not include encoded / characters")}return decodeURIComponent(t)}function kl(d){let t=Di.resolve(d),r=d.charCodeAt(d.length-1);(r===Pl||bn&&r===Vl)&&t[t.length-1]!==Di.sep&&(t+="/");let n=new URL("file://");return t.includes("%")&&(t=t.replace(Rl,"%25")),!bn&&t.includes("\\")&&(t=t.replace(Ml,"%5C")),t.includes(`
269
+ `)&&(t=t.replace($l,"%0A")),t.includes("\r")&&(t=t.replace(jl,"%0D")),t.includes(" ")&&(t=t.replace(Ll,"%09")),n.pathname=t,n}var _l,dn,Mi,un,fn,$i,pn,ji,hn,Li,mn,Ui,gn,Fi,yn,zi,Ut,Wi,dt,Sl,Nl,Cl,xl,Al,Il,Tl,Vl,Pl,Bl,Ol,bn,Dl,Rl,Ml,$l,jl,Ll,fh=pt(()=>{be(),ve(),we(),Ip(),qp(),nh(),bl(),_l=Object.freeze(Object.create(null)),dn={},Mi=!1,un=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global,fn={},$i=!1,pn={},ji=!1,hn={},Li=!1,mn={},Ui=!1,gn={},Fi=!1,yn={},zi=!1,Ut={},Wi=!1,dt=ch(),dt.parse,dt.resolve,dt.resolveObject,dt.format,dt.Url,Sl=typeof Deno<"u"?Deno.build.os==="windows"?"win32":Deno.build.os:void 0,dt.URL=typeof URL<"u"?URL:null,dt.pathToFileURL=kl,dt.fileURLToPath=El,Nl=dt.Url,Cl=dt.format,xl=dt.resolve,Al=dt.resolveObject,Il=dt.parse,Tl=dt.URL,Vl=92,Pl=47,Bl=97,Ol=122,bn=Sl==="win32",Dl=/\//g,Rl=/%/g,Ml=/\\/g,$l=/\n/g,jl=/\r/g,Ll=/\t/g}),ph=_e((d,t)=>{be(),ve(),we(),t.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}}),qi=_e(d=>{be(),ve(),we(),Object.defineProperty(d,"__esModule",{value:!0}),d.BufferedDuplex=void 0,d.writev=n;var t=nr(),r=(ot(),We(nt));function n(s,o){let a=new Array(s.length);for(let l=0;l<s.length;l++)typeof s[l].chunk=="string"?a[l]=r.Buffer.from(s[l].chunk,"utf8"):a[l]=s[l].chunk;this._write(r.Buffer.concat(a),"binary",o)}var i=class extends t.Duplex{constructor(o,a,l){super({objectMode:!0});he(this,"socket");he(this,"proxy");he(this,"isSocketOpen");he(this,"writeQueue");this.proxy=a,this.socket=l,this.writeQueue=[],o.objectMode||(this._writev=n.bind(this)),this.isSocketOpen=!1,this.proxy.on("data",c=>{!this.destroyed&&this.readable&&this.push(c)})}_read(o){this.proxy.read(o)}_write(o,a,l){this.isSocketOpen?this.writeToProxy(o,a,l):this.writeQueue.push({chunk:o,encoding:a,cb:l})}_final(o){this.writeQueue=[],this.proxy.end(o)}_destroy(o,a){this.writeQueue=[],this.proxy.destroy(),a(o)}socketReady(){this.emit("connect"),this.isSocketOpen=!0,this.processWriteQueue()}writeToProxy(o,a,l){this.proxy.write(o,a)===!1?this.proxy.once("drain",l):l()}processWriteQueue(){for(;this.writeQueue.length>0;){let{chunk:o,encoding:a,cb:l}=this.writeQueue.shift();this.writeToProxy(o,a,l)}}};d.BufferedDuplex=i}),wn=_e(d=>{be(),ve(),we();var t=d&&d.__importDefault||function(k){return k&&k.__esModule?k:{default:k}};Object.defineProperty(d,"__esModule",{value:!0}),d.streamBuilder=d.browserStreamBuilder=void 0;var r=(ot(),We(nt)),n=t(ph()),i=t(Tt()),s=nr(),o=t(Gr()),a=qi(),l=(0,i.default)("mqttjs:ws"),c=["rejectUnauthorized","ca","cert","key","pfx","passphrase"];function u(k,g){let v=`${k.protocol}://${k.hostname}:${k.port}${k.path}`;return typeof k.transformWsUrl=="function"&&(v=k.transformWsUrl(v,k,g)),v}function p(k){let g=k;return k.port||(k.protocol==="wss"?g.port=443:g.port=80),k.path||(g.path="/"),k.wsOptions||(g.wsOptions={}),!o.default&&!k.forceNativeWebSocket&&k.protocol==="wss"&&c.forEach(v=>{Object.prototype.hasOwnProperty.call(k,v)&&!Object.prototype.hasOwnProperty.call(k.wsOptions,v)&&(g.wsOptions[v]=k[v])}),g}function h(k){let g=p(k);if(g.hostname||(g.hostname=g.host),!g.hostname){if(typeof document>"u")throw new Error("Could not determine host. Specify host manually.");let v=new URL(document.URL);g.hostname=v.hostname,g.port||(g.port=Number(v.port))}return g.objectMode===void 0&&(g.objectMode=!(g.binary===!0||g.binary===void 0)),g}function m(k,g,v){l("createWebSocket"),l(`protocol: ${v.protocolId} ${v.protocolVersion}`);let _=v.protocolId==="MQIsdp"&&v.protocolVersion===3?"mqttv3.1":"mqtt";l(`creating new Websocket for url: ${g} and protocol: ${_}`);let S;return v.createWebsocket?S=v.createWebsocket(g,[_],v):S=new n.default(g,[_],v.wsOptions),S}function f(k,g){let v=g.protocolId==="MQIsdp"&&g.protocolVersion===3?"mqttv3.1":"mqtt",_=u(g,k),S;return g.createWebsocket?S=g.createWebsocket(_,[v],g):S=new WebSocket(_,[v]),S.binaryType="arraybuffer",S}var E=(k,g)=>{l("streamBuilder");let v=p(g);v.hostname=v.hostname||v.host||"localhost";let _=u(v,k),S=m(k,_,v),B=n.default.createWebSocketStream(S,v.wsOptions);return B.url=_,S.on("close",()=>{B.destroy()}),B};d.streamBuilder=E;var N=(k,g)=>{l("browserStreamBuilder");let v,_=h(g).browserBufferSize||1024*512,S=g.browserBufferTimeout||1e3,B=!g.objectMode,P=f(k,g),T=C(g,j,le);g.objectMode||(T._writev=a.writev.bind(T)),T.on("close",()=>{P.close()});let A=typeof P.addEventListener<"u";P.readyState===P.OPEN?(v=T,v.socket=P):(v=new a.BufferedDuplex(g,T,P),A?P.addEventListener("open",O):P.onopen=O),A?(P.addEventListener("close",I),P.addEventListener("error",U),P.addEventListener("message",Y)):(P.onclose=I,P.onerror=U,P.onmessage=Y);function C(ne,te,ue){let $=new s.Transform({objectMode:ne.objectMode});return $._write=te,$._flush=ue,$}function O(){l("WebSocket onOpen"),v instanceof a.BufferedDuplex&&v.socketReady()}function I(ne){l("WebSocket onClose",ne),v.end(),v.destroy()}function U(ne){l("WebSocket onError",ne);let te=new Error("WebSocket error");te.event=ne,v.destroy(te)}async function Y(ne){if(!T||!T.readable||!T.writable)return;let{data:te}=ne;te instanceof ArrayBuffer?te=r.Buffer.from(te):te instanceof Blob?te=r.Buffer.from(await new Response(te).arrayBuffer()):te=r.Buffer.from(te,"utf8"),T.push(te)}function j(ne,te,ue){if(P.bufferedAmount>_){setTimeout(j,S,ne,te,ue);return}B&&typeof ne=="string"&&(ne=r.Buffer.from(ne,"utf8"));try{P.send(ne)}catch($){return ue($)}ue()}function le(ne){P.close(),ne()}return v};d.browserStreamBuilder=N}),Gi={};lr(Gi,{Server:()=>Ye,Socket:()=>Ye,Stream:()=>Ye,_createServerHandle:()=>Ye,_normalizeArgs:()=>Ye,_setSimultaneousAccepts:()=>Ye,connect:()=>Ye,createConnection:()=>Ye,createServer:()=>Ye,default:()=>Ul,isIP:()=>Ye,isIPv4:()=>Ye,isIPv6:()=>Ye});function Ye(){throw new Error("Node.js net module is not supported by JSPM core outside of Node.js")}var Ul,Fl=pt(()=>{be(),ve(),we(),Ul={_createServerHandle:Ye,_normalizeArgs:Ye,_setSimultaneousAccepts:Ye,connect:Ye,createConnection:Ye,createServer:Ye,isIP:Ye,isIPv4:Ye,isIPv6:Ye,Server:Ye,Socket:Ye,Stream:Ye}}),zl=_e((d,t)=>{be(),ve(),we(),t.exports={}}),Wl=_e(d=>{be(),ve(),we();var t=d&&d.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(d,"__esModule",{value:!0});var r=t((Fl(),We(Gi))),n=t(Tt()),i=t(zl()),s=(0,n.default)("mqttjs:tcp"),o=(a,l)=>{if(l.port=l.port||1883,l.hostname=l.hostname||l.host||"localhost",l.socksProxy)return(0,i.default)(l.hostname,l.port,l.socksProxy,{timeout:l.socksTimeout});let{port:c,path:u}=l,p=l.hostname;return s("port %d and host %s",c,p),r.default.createConnection({port:c,host:p,path:u})};d.default=o}),ql={};lr(ql,{default:()=>Gl});var Gl,hh=pt(()=>{be(),ve(),we(),Gl={}}),Hl=_e(d=>{be(),ve(),we();var t=d&&d.__importDefault||function(c){return c&&c.__esModule?c:{default:c}};Object.defineProperty(d,"__esModule",{value:!0});var r=(hh(),We(ql)),n=t((Fl(),We(Gi))),i=t(Tt()),s=t(zl()),o=(0,i.default)("mqttjs:tls");function a(c){let{host:u,port:p,socksProxy:h,...m}=c;if(h!==void 0){let f=(0,s.default)(u,p,h,{timeout:c.socksTimeout});return(0,r.connect)({...m,socket:f})}return(0,r.connect)(c)}var l=(c,u)=>{u.port=u.port||8883,u.host=u.hostname||u.host||"localhost",n.default.isIP(u.host)===0&&(u.servername=u.host),u.rejectUnauthorized=u.rejectUnauthorized!==!1,delete u.path,o("port %d host %s rejectUnauthorized %b",u.port,u.host,u.rejectUnauthorized);let p=a(u);p.on("secureConnect",()=>{u.rejectUnauthorized&&!p.authorized?p.emit("error",new Error("TLS not authorized")):p.removeListener("error",h)});function h(m){u.rejectUnauthorized&&c.emit("error",m),p.end()}return p.on("error",h),p};d.default=l}),Kl=_e(d=>{be(),ve(),we(),Object.defineProperty(d,"__esModule",{value:!0});var t=(ot(),We(nt)),r=nr(),n=qi(),i,s,o;function a(){let h=new r.Transform;return h._write=(m,f,E)=>{i.send({data:m.buffer,success(){E()},fail(N){E(new Error(N))}})},h._flush=m=>{i.close({success(){m()}})},h}function l(h){h.hostname||(h.hostname="localhost"),h.path||(h.path="/"),h.wsOptions||(h.wsOptions={})}function c(h,m){let f=h.protocol==="wxs"?"wss":"ws",E=`${f}://${h.hostname}${h.path}`;return h.port&&h.port!==80&&h.port!==443&&(E=`${f}://${h.hostname}:${h.port}${h.path}`),typeof h.transformWsUrl=="function"&&(E=h.transformWsUrl(E,h,m)),E}function u(){i.onOpen(()=>{o.socketReady()}),i.onMessage(h=>{let{data:m}=h;m instanceof ArrayBuffer?m=t.Buffer.from(m):m=t.Buffer.from(m,"utf8"),s.push(m)}),i.onClose(()=>{o.emit("close"),o.end(),o.destroy()}),i.onError(h=>{let m=new Error(h.errMsg);o.destroy(m)})}var p=(h,m)=>{if(m.hostname=m.hostname||m.host,!m.hostname)throw new Error("Could not determine host. Specify host manually.");let f=m.protocolId==="MQIsdp"&&m.protocolVersion===3?"mqttv3.1":"mqtt";l(m);let E=c(m,h);i=wx.connectSocket({url:E,protocols:[f]}),s=a(),o=new n.BufferedDuplex(m,s,i),o._destroy=(k,g)=>{i.close({success(){g&&g(k)}})};let N=o.destroy;return o.destroy=(k,g)=>(o.destroy=N,setTimeout(()=>{i.close({fail(){o._destroy(k,g)}})},0),o),u(),o};d.default=p}),Yl=_e(d=>{be(),ve(),we(),Object.defineProperty(d,"__esModule",{value:!0});var t=(ot(),We(nt)),r=nr(),n=qi(),i,s,o,a=!1;function l(){let m=new r.Transform;return m._write=(f,E,N)=>{i.sendSocketMessage({data:f.buffer,success(){N()},fail(){N(new Error)}})},m._flush=f=>{i.closeSocket({success(){f()}})},m}function c(m){m.hostname||(m.hostname="localhost"),m.path||(m.path="/"),m.wsOptions||(m.wsOptions={})}function u(m,f){let E=m.protocol==="alis"?"wss":"ws",N=`${E}://${m.hostname}${m.path}`;return m.port&&m.port!==80&&m.port!==443&&(N=`${E}://${m.hostname}:${m.port}${m.path}`),typeof m.transformWsUrl=="function"&&(N=m.transformWsUrl(N,m,f)),N}function p(){a||(a=!0,i.onSocketOpen(()=>{o.socketReady()}),i.onSocketMessage(m=>{if(typeof m.data=="string"){let f=t.Buffer.from(m.data,"base64");s.push(f)}else{let f=new FileReader;f.addEventListener("load",()=>{if(f.result instanceof ArrayBuffer){s.push(t.Buffer.from(f.result));return}s.push(t.Buffer.from(f.result,"utf-8"))}),f.readAsArrayBuffer(m.data)}}),i.onSocketClose(()=>{o.end(),o.destroy()}),i.onSocketError(m=>{o.destroy(m)}))}var h=(m,f)=>{if(f.hostname=f.hostname||f.host,!f.hostname)throw new Error("Could not determine host. Specify host manually.");let E=f.protocolId==="MQIsdp"&&f.protocolVersion===3?"mqttv3.1":"mqtt";c(f);let N=u(f,m);return i=f.my,i.connectSocket({url:N,protocols:E}),s=l(),o=new n.BufferedDuplex(f,s,i),p(),o};d.default=h}),mh=_e(d=>{be(),ve(),we();var t=d&&d.__importDefault||function(p){return p&&p.__esModule?p:{default:p}};Object.defineProperty(d,"__esModule",{value:!0}),d.connectAsync=u;var r=t(Tt()),n=t((fh(),We(wl))),i=t(Qo()),s=t(Gr());typeof(ze==null?void 0:ze.nextTick)!="function"&&(ze.nextTick=setImmediate);var o=(0,r.default)("mqttjs"),a=null;function l(p){let h;if(p.auth)if(h=p.auth.match(/^(.+):(.+)$/),h){let[,m,f]=h;p.username=m,p.password=f}else p.username=p.auth}function c(p,h){var E,N,k;if(o("connecting to an MQTT broker..."),typeof p=="object"&&!h&&(h=p,p=""),h=h||{},p&&typeof p=="string"){let g=n.default.parse(p,!0),v={};if(g.port!=null&&(v.port=Number(g.port)),v.host=g.hostname,v.query=g.query,v.auth=g.auth,v.protocol=g.protocol,v.path=g.path,h={...v,...h},!h.protocol)throw new Error("Missing protocol");h.protocol=h.protocol.replace(/:$/,"")}if(h.unixSocket=h.unixSocket||((E=h.protocol)==null?void 0:E.includes("+unix")),h.unixSocket?h.protocol=h.protocol.replace("+unix",""):!((N=h.protocol)!=null&&N.startsWith("ws"))&&!((k=h.protocol)!=null&&k.startsWith("wx"))&&delete h.path,l(h),h.query&&typeof h.query.clientId=="string"&&(h.clientId=h.query.clientId),s.default||h.unixSocket?h.socksProxy=void 0:h.socksProxy===void 0&&typeof ze<"u"&&(h.socksProxy=ze.env.MQTTJS_SOCKS_PROXY),h.cert&&h.key)if(h.protocol){if(["mqtts","wss","wxs","alis"].indexOf(h.protocol)===-1)switch(h.protocol){case"mqtt":h.protocol="mqtts";break;case"ws":h.protocol="wss";break;case"wx":h.protocol="wxs";break;case"ali":h.protocol="alis";break;default:throw new Error(`Unknown protocol for secure connection: "${h.protocol}"!`)}}else throw new Error("Missing secure protocol key");if(a||(a={},!s.default&&!h.forceNativeWebSocket?(a.ws=wn().streamBuilder,a.wss=wn().streamBuilder,a.mqtt=Wl().default,a.tcp=Wl().default,a.ssl=Hl().default,a.tls=a.ssl,a.mqtts=Hl().default):(a.ws=wn().browserStreamBuilder,a.wss=wn().browserStreamBuilder,a.wx=Kl().default,a.wxs=Kl().default,a.ali=Yl().default,a.alis=Yl().default)),!a[h.protocol]){let g=["mqtts","wss"].indexOf(h.protocol)!==-1;h.protocol=["mqtt","mqtts","ws","wss","wx","wxs","ali","alis"].filter((v,_)=>g&&_%2===0?!1:typeof a[v]=="function")[0]}if(h.clean===!1&&!h.clientId)throw new Error("Missing clientId for unclean clients");h.protocol&&(h.defaultProtocol=h.protocol);function m(g){return h.servers&&((!g._reconnectCount||g._reconnectCount===h.servers.length)&&(g._reconnectCount=0),h.host=h.servers[g._reconnectCount].host,h.port=h.servers[g._reconnectCount].port,h.protocol=h.servers[g._reconnectCount].protocol?h.servers[g._reconnectCount].protocol:h.defaultProtocol,h.hostname=h.host,g._reconnectCount++),o("calling streambuilder for",h.protocol),a[h.protocol](g,h)}let f=new i.default(m,h);return f.on("error",()=>{}),f}function u(p,h,m=!0){return new Promise((f,E)=>{let N=c(p,h),k={connect:v=>{g(),f(N)},end:()=>{g(),f(N)},error:v=>{g(),N.end(),E(v)}};m===!1&&(k.close=()=>{k.error(new Error("Couldn't connect to server"))});function g(){Object.keys(k).forEach(v=>{N.off(v,k[v])})}Object.keys(k).forEach(v=>{N.on(v,k[v])})})}d.default=c}),Jl=_e(d=>{be(),ve(),we();var t=d&&d.__createBinding||(Object.create?function(m,f,E,N){N===void 0&&(N=E);var k=Object.getOwnPropertyDescriptor(f,E);(!k||("get"in k?!f.__esModule:k.writable||k.configurable))&&(k={enumerable:!0,get:function(){return f[E]}}),Object.defineProperty(m,N,k)}:function(m,f,E,N){N===void 0&&(N=E),m[N]=f[E]}),r=d&&d.__setModuleDefault||(Object.create?function(m,f){Object.defineProperty(m,"default",{enumerable:!0,value:f})}:function(m,f){m.default=f}),n=d&&d.__importStar||function(){var m=function(f){return m=Object.getOwnPropertyNames||function(E){var N=[];for(var k in E)Object.prototype.hasOwnProperty.call(E,k)&&(N[N.length]=k);return N},m(f)};return function(f){if(f&&f.__esModule)return f;var E={};if(f!=null)for(var N=m(f),k=0;k<N.length;k++)N[k]!=="default"&&t(E,f,N[k]);return r(E,f),E}}(),i=d&&d.__exportStar||function(m,f){for(var E in m)E!=="default"&&!Object.prototype.hasOwnProperty.call(f,E)&&t(f,m,E)},s=d&&d.__importDefault||function(m){return m&&m.__esModule?m:{default:m}};Object.defineProperty(d,"__esModule",{value:!0}),d.ReasonCodes=d.KeepaliveManager=d.UniqueMessageIdProvider=d.DefaultMessageIdProvider=d.Store=d.MqttClient=d.connectAsync=d.connect=d.Client=void 0;var o=s(Qo());d.MqttClient=o.default;var a=s(na());d.DefaultMessageIdProvider=a.default;var l=s(xp());d.UniqueMessageIdProvider=l.default;var c=s(Js());d.Store=c.default;var u=n(mh());d.connect=u.default,Object.defineProperty(d,"connectAsync",{enumerable:!0,get:function(){return u.connectAsync}});var p=s(da());d.KeepaliveManager=p.default,d.Client=o.default,i(Qo(),d),i(fr(),d),i(Ys(),d);var h=Wr();Object.defineProperty(d,"ReasonCodes",{enumerable:!0,get:function(){return h.ReasonCodes}})}),gh=_e(d=>{be(),ve(),we();var t=d&&d.__createBinding||(Object.create?function(o,a,l,c){c===void 0&&(c=l);var u=Object.getOwnPropertyDescriptor(a,l);(!u||("get"in u?!a.__esModule:u.writable||u.configurable))&&(u={enumerable:!0,get:function(){return a[l]}}),Object.defineProperty(o,c,u)}:function(o,a,l,c){c===void 0&&(c=l),o[c]=a[l]}),r=d&&d.__setModuleDefault||(Object.create?function(o,a){Object.defineProperty(o,"default",{enumerable:!0,value:a})}:function(o,a){o.default=a}),n=d&&d.__importStar||function(){var o=function(a){return o=Object.getOwnPropertyNames||function(l){var c=[];for(var u in l)Object.prototype.hasOwnProperty.call(l,u)&&(c[c.length]=u);return c},o(a)};return function(a){if(a&&a.__esModule)return a;var l={};if(a!=null)for(var c=o(a),u=0;u<c.length;u++)c[u]!=="default"&&t(l,a,c[u]);return r(l,a),l}}(),i=d&&d.__exportStar||function(o,a){for(var l in o)l!=="default"&&!Object.prototype.hasOwnProperty.call(a,l)&&t(a,o,l)};Object.defineProperty(d,"__esModule",{value:!0});var s=n(Jl());d.default=s,i(Jl(),d)});const yh=gh();/*! Bundled license information:
270
+
271
+ @jspm/core/nodelibs/browser/chunk-DtuTasat.js:
272
+ (*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> *)
273
+
274
+ safe-buffer/index.js:
275
+ (*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> *)
276
+
277
+ @babel/runtime/helpers/regenerator.js:
278
+ (*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE *)
279
+ */class bh{constructor(){he(this,"client",null);he(this,"config",null);he(this,"onDataCallback",null);he(this,"onErrorCallback",null);he(this,"onStatusChangeCallback",null);he(this,"isConnected",!1)}connect(t){return new Promise((r,n)=>{if(!t.enabled){n(new Error("MQTT 连接未启用"));return}this.config=t;let i=t.broker;if(i.startsWith("mqtt://")){const o=i.replace("mqtt://","");o.includes("broker.emqx.io")?i="ws://broker.emqx.io:8083/mqtt":i=`ws://${o}:8083/mqtt`}else if(i.startsWith("mqtts://")){const o=i.replace("mqtts://","");o.includes("broker.emqx.io")?i="wss://broker.emqx.io:8084/mqtt":i=`wss://${o}:8084/mqtt`}else!i.startsWith("ws://")&&!i.startsWith("wss://")&&(i=`ws://${i}:8083/mqtt`);const s={clientId:t.clientId||`scada_${Math.random().toString(16).substring(2,8)}`,clean:!0,reconnectPeriod:0,connectTimeout:30*1e3,keepalive:60};t.username&&t.username.trim()&&(s.username=t.username),t.password&&t.password.trim()&&(s.password=t.password);try{this.client=yh.connect(i,s);const o=setTimeout(()=>{n(new Error("MQTT 连接超时")),this.client&&this.client.end(!0)},15e3);this.client.on("connect",a=>{clearTimeout(o),this.isConnected=!0,this.onStatusChangeCallback&&this.onStatusChangeCallback(!0),this.client&&t.topic?this.client.subscribe(t.topic,l=>{l?(console.error("[MQTT] 订阅失败:",l),n(l)):(console.log(`[MQTT] 订阅主题成功: ${t.topic}`),r())}):r()}),this.client.on("message",(a,l)=>{try{const c=l.toString();let p=JSON.parse(c);if(t.dataPath){const h=t.dataPath.split(".");for(const m of h)p=p==null?void 0:p[m]}this.onDataCallback&&p&&this.onDataCallback(p)}catch(c){console.error("[MQTT] 消息解析失败:",c),this.onErrorCallback&&this.onErrorCallback(c)}}),this.client.on("error",a=>{clearTimeout(o),console.error("[MQTT] 连接错误:",a.message),this.isConnected=!1,this.onStatusChangeCallback&&this.onStatusChangeCallback(!1),this.onErrorCallback&&this.onErrorCallback(a),n(a)}),this.client.on("close",()=>{clearTimeout(o),this.isConnected=!1,this.onStatusChangeCallback&&this.onStatusChangeCallback(!1)}),this.client.on("offline",()=>{}),this.client.on("end",()=>{})}catch(o){console.error("[MQTT] 创建客户端失败:",o),n(o)}})}onData(t){this.onDataCallback=t}onError(t){this.onErrorCallback=t}onStatusChange(t){this.onStatusChangeCallback=t}publish(t,r){if(!this.client||!this.isConnected){console.warn("[MQTT] 未连接,无法发布消息");return}const n=typeof r=="string"?r:JSON.stringify(r);this.client.publish(t,n,i=>{i&&console.error("[MQTT] 消息发布失败:",i)})}disconnect(){if(this.client){try{this.client.removeAllListeners(),this.client.end(!0)}catch(t){console.warn("[MQTT] 断开连接时出错:",t)}this.client=null,this.isConnected=!1}}getConnectionStatus(){return this.isConnected}getConfig(){return this.config}}function wh(){return new bh}class vh{constructor(){he(this,"ws",null);he(this,"config",null);he(this,"onDataCallback",null);he(this,"onErrorCallback",null);he(this,"onStatusChangeCallback",null);he(this,"isConnected",!1);he(this,"reconnectTimer",null)}connect(t){return new Promise((r,n)=>{if(!t.enabled){n(new Error("WebSocket 连接未启用"));return}if(!t.url){n(new Error("WebSocket URL 未配置"));return}this.config=t;try{this.ws=new WebSocket(t.url),this.ws.onopen=()=>{var i;console.log(`[WebSocket] 连接成功: ${t.url}`),this.isConnected=!0,(i=this.onStatusChangeCallback)==null||i.call(this,!0),this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),r()},this.ws.onmessage=i=>{try{let o=JSON.parse(i.data);if(t.dataPath){const a=t.dataPath.split(".");for(const l of a)if(o=o==null?void 0:o[l],!o)break}this.onDataCallback&&o&&this.onDataCallback(o)}catch(s){console.error("[WebSocket] 消息解析失败:",s),this.onErrorCallback&&this.onErrorCallback(s)}},this.ws.onerror=i=>{var s;console.error("[WebSocket] 连接错误:",i),this.isConnected=!1,(s=this.onStatusChangeCallback)==null||s.call(this,!1),this.onErrorCallback&&this.onErrorCallback(new Error("WebSocket 连接错误")),n(new Error("WebSocket 连接错误"))},this.ws.onclose=i=>{var s;if(console.log(`[WebSocket] 连接关闭: ${i.code} ${i.reason}`),this.isConnected=!1,(s=this.onStatusChangeCallback)==null||s.call(this,!1),t.autoReconnect!==!1&&t.enabled){const o=t.reconnectDelay||5e3;console.log(`[WebSocket] ${o}ms 后尝试重连...`),this.reconnectTimer=window.setTimeout(()=>{t.enabled&&this.connect(t).catch(console.error)},o)}}}catch(i){console.error("[WebSocket] 创建连接失败:",i),n(i)}})}send(t){if(!this.ws||!this.isConnected){console.warn("[WebSocket] 未连接,无法发送消息");return}const r=typeof t=="string"?t:JSON.stringify(t);this.ws.send(r)}onData(t){this.onDataCallback=t}onError(t){this.onErrorCallback=t}onStatusChange(t){this.onStatusChangeCallback=t}disconnect(){this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.ws&&(console.log("[WebSocket] 断开连接"),this.ws.close(),this.ws=null,this.isConnected=!1)}getConnectionStatus(){return this.isConnected}getConfig(){return this.config}}function Eh(){return new vh}class kh{constructor(){he(this,"config",null);he(this,"onDataCallback",null);he(this,"onErrorCallback",null);he(this,"onStatusChangeCallback",null);he(this,"intervalId",null);he(this,"isPolling",!1);he(this,"abortController",null)}async start(t){if(!t.enabled)throw new Error("HTTP 轮询未启用");if(!t.url)throw new Error("HTTP URL 未配置");this.config=t,this.isPolling=!0,await this.poll();const r=t.pollInterval||5e3;this.intervalId=window.setInterval(()=>{this.poll()},r),console.log(`[HTTP] 启动轮询: ${t.url}, 间隔: ${r}ms`)}async poll(){var t,r;if(!(!this.config||!this.isPolling))try{this.abortController=new AbortController;const n=this.config.timeout||3e4,i=setTimeout(()=>{var h;(h=this.abortController)==null||h.abort()},n),s={method:this.config.method||"GET",signal:this.abortController.signal},o=this.config.headers||{},a=Object.keys(o).some(h=>h.toLowerCase()==="content-type"),l=this.config.body&&(this.config.method==="POST"||this.config.method==="PUT");s.headers={...l&&!a?{"Content-Type":"application/json"}:{},...o},this.config.body&&(this.config.method==="POST"||this.config.method==="PUT")&&(s.body=typeof this.config.body=="string"?this.config.body:JSON.stringify(this.config.body));const c=await fetch(this.config.url,s);if(clearTimeout(i),!c.ok)throw new Error(`HTTP ${c.status}: ${c.statusText}`);let p=await c.json();if(this.config.dataPath){const h=this.config.dataPath.split(".");for(const m of h)if(p=p==null?void 0:p[m],!p)break}this.onDataCallback&&(Array.isArray(p)?p.forEach(h=>{h&&this.onDataCallback(h)}):p&&this.onDataCallback(p)),(t=this.onStatusChangeCallback)==null||t.call(this,!0)}catch(n){n.name==="AbortError"?console.error("[HTTP] 请求超时"):console.error("[HTTP] 轮询错误:",n),(r=this.onStatusChangeCallback)==null||r.call(this,!1),this.onErrorCallback&&this.onErrorCallback(n)}}onData(t){this.onDataCallback=t}onError(t){this.onErrorCallback=t}onStatusChange(t){this.onStatusChangeCallback=t}stop(){console.log("[HTTP] 停止轮询"),this.isPolling=!1,this.intervalId&&(clearInterval(this.intervalId),this.intervalId=null),this.abortController&&(this.abortController.abort(),this.abortController=null)}getPollingStatus(){return this.isPolling}getConfig(){return this.config}}function _h(){return new kh}class Sh{constructor(){he(this,"eventSource",null);he(this,"config",null);he(this,"onDataCallback",null);he(this,"onErrorCallback",null);he(this,"onStatusChangeCallback",null);he(this,"isConnected",!1);he(this,"reconnectTimer",null)}connect(t){return new Promise((r,n)=>{if(!t.enabled){n(new Error("SSE 连接未启用"));return}if(!t.url){n(new Error("SSE URL 未配置"));return}this.config=t;try{const i={};t.withCredentials&&(i.withCredentials=!0),this.eventSource=new EventSource(t.url,i),this.eventSource.onopen=()=>{var o;console.log(`[SSE] 连接成功: ${t.url}`),this.isConnected=!0,(o=this.onStatusChangeCallback)==null||o.call(this,!0),this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),r()},this.eventSource.onmessage=o=>{this.handleMessage(o.data)};const s=t.eventType||"message";s&&s!=="message"&&this.eventSource.addEventListener(s,o=>{this.handleMessage(o.data)}),this.eventSource.onerror=o=>{var a,l;if(console.error("[SSE] 连接错误:",o),this.isConnected=!1,(a=this.onStatusChangeCallback)==null||a.call(this,!1),(l=this.eventSource)==null||l.close(),this.onErrorCallback&&this.onErrorCallback(new Error("SSE 连接错误")),t.autoReconnect!==!1&&t.enabled){const c=t.reconnectDelay||5e3;console.log(`[SSE] ${c}ms 后尝试重连...`),this.reconnectTimer=window.setTimeout(()=>{t.enabled&&this.connect(t).catch(console.error)},c)}}}catch(i){console.error("[SSE] 创建连接失败:",i),n(i)}})}handleMessage(t){var r;try{let i=JSON.parse(t);if((r=this.config)!=null&&r.dataPath){const s=this.config.dataPath.split(".");for(const o of s)if(i=i==null?void 0:i[o],!i)break}this.onDataCallback&&i&&this.onDataCallback(i)}catch(n){console.error("[SSE] 消息解析失败:",n),this.onErrorCallback&&this.onErrorCallback(n)}}onData(t){this.onDataCallback=t}onError(t){this.onErrorCallback=t}onStatusChange(t){this.onStatusChangeCallback=t}disconnect(){this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.eventSource&&(console.log("[SSE] 断开连接"),this.eventSource.close(),this.eventSource=null,this.isConnected=!1)}getConnectionStatus(){return this.isConnected}getConfig(){return this.config}getReadyState(){var t;return((t=this.eventSource)==null?void 0:t.readyState)??EventSource.CLOSED}}function Nh(){return new Sh}class Ft{static parseDeviceData(t,r,n){return t?this.isSimplifiedPointsArray(t)?this.parseSimplifiedPointsArray(t,r,n):this.isStandardFormat(t)?this.parseStandardFormat(t):this.isSinglePointFormat(t)?this.parseSinglePointFormat(t):this.isFlatFormat(t)?this.parseFlatFormat(t):this.isNestedFormat(t)?this.parseNestedFormat(t):(console.warn("[DataParser] 无法识别的数据格式:",t),null):null}static isSimplifiedPointsArray(t){return Array.isArray(t)&&t.length>0&&t[0].id!==void 0&&t[0].value!==void 0&&!t[0].points}static parseSimplifiedPointsArray(t,r,n){return{id:r||"default-device",name:n||"Default Device",points:t.map(i=>({id:i.id||i.pointId,name:i.name||i.pointName||i.id||i.pointId,value:i.value,quality:i.quality||"good",timestamp:i.timestamp||new Date().toISOString(),unit:i.unit,dataType:i.dataType||this.inferDataType(i.value)}))}}static isStandardFormat(t){return(t.id||t.deviceId)&&Array.isArray(t.points)&&t.points.length>0}static parseStandardFormat(t){return{id:t.id||t.deviceId,name:t.name||t.deviceName||t.id||t.deviceId,points:t.points.map(r=>({id:r.id||r.pointId,name:r.name||r.pointName||r.id||r.pointId,value:r.value,quality:r.quality||"good",timestamp:r.timestamp||new Date().toISOString(),unit:r.unit,dataType:r.dataType||this.inferDataType(r.value)}))}}static isSinglePointFormat(t){return(t.deviceId||t.id)&&(t.pointId||t.point)&&t.value!==void 0}static parseSinglePointFormat(t){const r=t.deviceId||t.id,n=t.pointId||t.point;return{id:r,name:t.deviceName||r,points:[{id:n,name:t.pointName||n,value:t.value,quality:t.quality||"good",timestamp:t.timestamp||new Date().toISOString(),unit:t.unit,dataType:t.dataType||this.inferDataType(t.value)}]}}static isFlatFormat(t){const r=t.deviceId||t.id,n=Object.keys(t).some(i=>!["deviceId","id","deviceName","name","timestamp"].includes(i));return r&&n}static parseFlatFormat(t){const r=t.deviceId||t.id,n=[],i=["deviceId","id","deviceName","name","timestamp"];for(const s in t)i.includes(s)||n.push({id:s,name:s,value:t[s],quality:"good",timestamp:t.timestamp||new Date().toISOString(),dataType:this.inferDataType(t[s])});return{id:r,name:t.deviceName||t.name||r,points:n}}static isNestedFormat(t){return t.device&&(t.device.id||t.device.deviceId)}static parseNestedFormat(t){const r=t.device;return r?r.data||r.points?this.parseDeviceData({...r.data,deviceId:r.id||r.deviceId,deviceName:r.name||r.deviceName,points:r.points}):this.parseDeviceData(r):null}static inferDataType(t){return typeof t=="boolean"?"boolean":typeof t=="number"?"number":"string"}static createCustomParser(t){return r=>{const n=typeof t.deviceId=="function"?t.deviceId(r):this.getValueByPath(r,t.deviceId),i=t.deviceName?typeof t.deviceName=="function"?t.deviceName(r):this.getValueByPath(r,t.deviceName):n;let s=typeof t.points=="function"?t.points(r):this.getValueByPath(r,t.points);Array.isArray(s)||(s=[s]);const o=s.map(a=>{const l=t.pointId?typeof t.pointId=="function"?t.pointId(r,a):this.getValueByPath(a,t.pointId):a.id||a.pointId,c=t.pointValue?typeof t.pointValue=="function"?t.pointValue(r,a):this.getValueByPath(a,t.pointValue):a.value;return{id:l,name:a.name||l,value:c,quality:a.quality||"good",timestamp:a.timestamp||new Date().toISOString(),unit:a.unit,dataType:this.inferDataType(c)}});return{id:n,name:i,points:o}}}static getValueByPath(t,r){if(!r)return t;const n=r.split(".");let i=t;for(const s of n){if(i==null)return;i=i[s]}return i}}Ft.createCustomParser({deviceId:"deviceInfo.id",deviceName:"deviceInfo.name",points:"telemetry",pointId:(d,t)=>t.key,pointValue:(d,t)=>t.value}),Ft.createCustomParser({deviceId:"slaveId",deviceName:"slaveName",points:"registers",pointId:(d,t)=>`reg_${t.address}`,pointValue:(d,t)=>t.value}),Ft.createCustomParser({deviceId:"nodeId",deviceName:"displayName",points:"values",pointId:(d,t)=>t.browseName,pointValue:(d,t)=>t.value.value}),Ft.parseDeviceData.bind(Ft);class Ch{constructor(){he(this,"dataSources",e.reactive(new Map));he(this,"connections",new Map);he(this,"onDataCallbacks",[])}addDataSource(t){this.dataSources.set(t.id,t),t.enabled&&this.connectDataSource(t.id)}updateDataSource(t,r){const n=this.dataSources.get(t);n&&(Object.assign(n,r),(r.config||r.enabled!==void 0)&&this.reconnectDataSource(t))}removeDataSource(t){this.disconnectDataSource(t),this.dataSources.delete(t)}getDataSource(t){return this.dataSources.get(t)}getAllDataSources(){return Array.from(this.dataSources.values())}getAllDevices(){const t=[];return this.dataSources.forEach(r=>{r.devices.forEach(n=>{t.push({dataSourceId:r.id,dataSourceName:r.name,device:n})})}),t}async connectDataSource(t){const r=this.dataSources.get(t);if(r)try{switch(this.disconnectDataSource(t),r.type){case"MQTT":await this.connectMqtt(t,r);break;case"WebSocket":await this.connectWebSocket(t,r);break;case"HTTP":await this.connectHttp(t,r);break;case"SSE":await this.connectSSE(t,r);break}}catch(n){console.error(`[DataSource] 连接失败: ${r.name}`,n),r.status&&(r.status.connected=!1,r.status.error=n.message)}}disconnectDataSource(t){const r=this.connections.get(t);if(!r)return;const n=this.dataSources.get(t);if(n){try{n.type==="MQTT"||n.type==="WebSocket"?r.disconnect():n.type==="HTTP"?r.stop():n.type==="SSE"&&r.disconnect()}catch(i){console.error("[DataSource] 断开连接失败:",i)}this.connections.delete(t),n.status&&(n.status.connected=!1)}}async reconnectDataSource(t){const r=this.dataSources.get(t);r&&(r.enabled?await this.connectDataSource(t):this.disconnectDataSource(t))}async connectMqtt(t,r){const n=wh();n.onData(s=>{this.handleDeviceData(t,s)}),n.onError(s=>{console.error(`[MQTT] 数据源 ${r.name} 错误:`,s),r.status&&(r.status.error=s.message,r.status.connected=!1)}),n.onStatusChange(s=>{r.status&&(r.status.connected=s,s&&(r.status.error=void 0))});const i={broker:r.config.broker||"",topic:r.config.topic||"",clientId:r.config.clientId,username:r.config.username,password:r.config.password,dataPath:r.config.dataPath,enabled:!0,retryCount:r.config.retryCount||3};await n.connect(i),this.connections.set(t,n)}async connectWebSocket(t,r){const n=Eh();n.onData(s=>{this.handleDeviceData(t,s)}),n.onError(s=>{console.error(`[WebSocket] 数据源 ${r.name} 错误:`,s),r.status&&(r.status.error=s.message)}),n.onStatusChange(s=>{r.status&&(r.status.connected=s)});const i={url:r.config.wsUrl||"",dataPath:r.config.dataPath,enabled:!0,autoReconnect:!0,reconnectDelay:5e3};await n.connect(i),this.connections.set(t,n)}async connectHttp(t,r){const n=_h();n.onData(s=>{this.handleDeviceData(t,s)}),n.onError(s=>{console.error(`[HTTP] 数据源 ${r.name} 错误:`,s),r.status&&(r.status.error=s.message,r.status.connected=!1)}),n.onStatusChange(s=>{r.status&&(r.status.connected=s)});const i={url:r.config.url||"",method:r.config.method||"GET",pollInterval:r.config.pollInterval||5e3,headers:r.config.headers,dataPath:r.config.dataPath,enabled:!0};await n.start(i),this.connections.set(t,n)}async connectSSE(t,r){const n=Nh();n.onData(s=>{this.handleDeviceData(t,s)}),n.onError(s=>{console.error(`[SSE] 数据源 ${r.name} 错误:`,s),r.status&&(r.status.error=s.message)}),n.onStatusChange(s=>{r.status&&(r.status.connected=s)});const i={url:r.config.sseUrl||"",eventType:r.config.eventType||"message",dataPath:r.config.dataPath,enabled:!0,autoReconnect:!0,reconnectDelay:5e3};await n.connect(i),this.connections.set(t,n)}handleDeviceData(t,r){const n=this.dataSources.get(t);n&&(n.status&&(n.status.lastUpdate=new Date().toISOString()),this.parseAndUpdateDevices(n,r),this.onDataCallbacks.forEach(i=>{i(t,r)}))}parseAndUpdateDevices(t,r){try{let n=r;if(t.config.customParser&&(n=t.config.customParser(r)),n&&Array.isArray(n.devices)){const s=[];for(const o of n.devices){const a=Ft.parseDeviceData(o,o.id||o.deviceId||`device-${s.length}`,o.name||o.deviceName);a&&s.push({id:a.id,name:a.name,points:a.points.map(l=>({id:l.id,name:l.name||l.id,code:l.code||l.id,value:l.value,unit:l.unit||"",dataType:l.dataType||"number",accessMode:"read",quality:l.quality,timestamp:l.timestamp}))})}if(s.length>0){t.devices=s;return}}if(Array.isArray(n)&&n.length>0){const s=[];for(const o of n){const a=Ft.parseDeviceData(o,o.id||o.deviceId||`device-${s.length}`,o.name||o.deviceName);a&&s.push({id:a.id,name:a.name,points:a.points.map(l=>({id:l.id,name:l.name||l.id,code:l.code||l.id,value:l.value,unit:l.unit||"",dataType:l.dataType||"number",accessMode:"read",quality:l.quality,timestamp:l.timestamp}))})}if(s.length>0){t.devices=s;return}}const i=Ft.parseDeviceData(n,"default-device",t.name);if(i){t.devices=[{id:i.id,name:i.name,points:i.points.map(s=>({id:s.id,name:s.name||s.id,code:s.code||s.id,value:s.value,unit:s.unit||"",dataType:s.dataType||"number",accessMode:"read",quality:s.quality,timestamp:s.timestamp}))}];return}console.warn(`[DataSourceManager] 数据源 "${t.name}" 接收到不支持的数据格式:`,n),console.warn("[DataSourceManager] 支持的格式:"),console.warn(" 1. 简化点位数组: [{ id, value }, ...]"),console.warn(" 2. 单设备格式: { id, name, points: [...] }"),console.warn(" 3. 多设备格式: { devices: [{ id, name, points: [...] }] }")}catch(n){console.error(`[DataSourceManager] 解析数据源 "${t.name}" 的数据失败:`,n)}}onData(t){this.onDataCallbacks.push(t)}disconnectAll(){this.dataSources.forEach((t,r)=>{this.disconnectDataSource(r)})}getDataSourceStatus(t){const r=this.dataSources.get(t);return(r==null?void 0:r.status)||null}}const He=new Ch,xh={class:"compact-data-binding"},Ah={class:"compact-row"},Ih=["value"],Th=["value"],Vh=["title"],Ph={key:0,class:"component-points"},Bh={class:"points-header-left"},Oh={class:"collapse-icon"},Dh={class:"points-header-right"},Rh={class:"points-count"},Mh={class:"points-list"},$h={class:"point-main"},jh={class:"point-name"},Lh={class:"point-id"},Uh={class:"point-meta"},Fh={class:"point-type"},zh={key:0,class:"point-unit"},Wh={key:1,class:"point-required"},qh={class:"json-example"},Gh={class:"json-code"},Hh={key:1,class:"compact-hint warning"},Kh=Le(e.defineComponent({__name:"DataPropertiesTab",props:{selectedNode:{}},emits:["update-data-source"],setup(d,{emit:t}){const r=d,n=t,i=e.computed(()=>He.getAllDataSources()),s=e.ref(""),o=e.ref(!1),a=e.ref("list"),l=e.computed(()=>{if(!u.value||u.value.length===0)return"[]";const m=u.value.map(f=>{let E;return f.dataType==="boolean"?E=f.defaultValue??!1:f.dataType==="number"?E=f.defaultValue??(f.range?f.range.min:0):f.dataType==="string"?E=f.defaultValue??"":f.dataType==="json"?E=f.defaultValue??[]:E=null,{id:f.id,value:E}});return JSON.stringify(m,null,2)}),c=e.computed(()=>s.value?He.getDataSource(s.value):null),u=e.computed(()=>{if(!r.selectedNode)return[];const m=r.selectedNode.shape;if(!m)return[];const f=at.getComponentByShape(m);return!f||!f.points?[]:f.points});e.watch(()=>r.selectedNode,m=>{if(m){const f=m.getData();f!=null&&f.dataBinding?s.value=f.dataBinding.dataSourceId||"":s.value=""}},{immediate:!0});const p=m=>{const f=m.target.value;s.value=f,h()},h=()=>{n("update-data-source",{dataSourceId:s.value})};return(m,f)=>{var E,N,k,g;return e.openBlock(),e.createElementBlock("div",xh,[e.createElementVNode("div",Ah,[f[5]||(f[5]=e.createElementVNode("label",null,"数据源",-1)),e.createElementVNode("select",{value:s.value,onChange:p,class:"compact-select"},[f[4]||(f[4]=e.createElementVNode("option",{value:""},"无",-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.value,v=>(e.openBlock(),e.createElementBlock("option",{key:v.id,value:v.id},e.toDisplayString(v.name)+" ("+e.toDisplayString(v.type.toUpperCase())+") ",9,Th))),128))],40,Ih),s.value?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(["status-dot",(N=(E=c.value)==null?void 0:E.status)!=null&&N.connected?"connected":"disconnected"]),title:(g=(k=c.value)==null?void 0:k.status)!=null&&g.connected?"已连接":"未连接"},null,10,Vh)):e.createCommentVNode("",!0)]),u.value.length>0?(e.openBlock(),e.createElementBlock("div",Ph,[e.createElementVNode("div",{class:"points-header",onClick:f[3]||(f[3]=v=>o.value=!o.value)},[e.createElementVNode("div",Bh,[e.createElementVNode("span",Oh,e.toDisplayString(o.value?"▼":"▶"),1),f[6]||(f[6]=e.createElementVNode("span",{class:"points-title"},"📊 组件数据点位",-1))]),e.createElementVNode("div",Dh,[e.createElementVNode("span",Rh,e.toDisplayString(u.value.length)+" 个",1),o.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"display-mode-toggle",onClick:f[2]||(f[2]=e.withModifiers(()=>{},["stop"]))},[e.createElementVNode("button",{class:e.normalizeClass(["mode-btn",{active:a.value==="list"}]),onClick:f[0]||(f[0]=v=>a.value="list"),title:"列表模式"}," 📋 ",2),e.createElementVNode("button",{class:e.normalizeClass(["mode-btn",{active:a.value==="json"}]),onClick:f[1]||(f[1]=v=>a.value="json"),title:"JSON模式"}," { } ",2)])):e.createCommentVNode("",!0)])]),e.withDirectives(e.createElementVNode("div",Mh,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.value,v=>(e.openBlock(),e.createElementBlock("div",{key:v.id,class:"point-item"},[e.createElementVNode("div",$h,[e.createElementVNode("span",jh,e.toDisplayString(v.name),1),e.createElementVNode("span",Lh,e.toDisplayString(v.id),1)]),e.createElementVNode("div",Uh,[e.createElementVNode("span",Fh,e.toDisplayString(v.dataType),1),v.unit?(e.openBlock(),e.createElementBlock("span",zh,e.toDisplayString(v.unit),1)):e.createCommentVNode("",!0),v.required?(e.openBlock(),e.createElementBlock("span",Wh,"必需")):e.createCommentVNode("",!0)])]))),128))],512),[[e.vShow,o.value&&a.value==="list"]]),e.withDirectives(e.createElementVNode("div",qh,[f[7]||(f[7]=e.createElementVNode("div",{class:"json-header"},[e.createElementVNode("span",{class:"json-title"},"📝 后端数据格式示例")],-1)),e.createElementVNode("pre",Gh,e.toDisplayString(l.value),1)],512),[[e.vShow,o.value&&a.value==="json"]]),e.withDirectives(e.createElementVNode("div",{class:"points-tip"}," ℹ️ "+e.toDisplayString(a.value==="list"?"点击右上JSON按钮查看数据格式示例":"后端应返回包含上述点位ID的JSON数据"),513),[[e.vShow,o.value]])])):!u.value||u.value.length===0?(e.openBlock(),e.createElementBlock("div",Hh," ⚠️ 该组件没有定义数据点位,无法进行数据绑定 ")):e.createCommentVNode("",!0)])}}}),[["__scopeId","data-v-b3e4a104"]]),Yh={class:"edge-properties-tab"},Jh={class:"property-section"},Qh={class:"property-item"},Xh=["value"],Zh={key:0,class:"property-item"},em={class:"number-input-wrapper"},tm=["value"],rm={class:"property-item"},nm={class:"color-input-wrapper"},om=["value"],im=["value"],sm={key:1,class:"property-item"},am={class:"number-input-wrapper"},lm=["value"],cm={class:"property-item"},dm=["value"],um={class:"property-item"},fm={class:"slider-wrapper"},pm=["value"],hm={class:"slider-value"},mm={class:"property-item"},gm=["value"],ym={key:2,class:"property-item"},bm={class:"number-input-wrapper"},wm=["value"],vm={class:"property-section"},Em={class:"property-item"},km=["value"],_m={class:"property-item"},Sm=["value"],Nm={class:"property-section"},Cm={class:"property-item"},xm=["value"],Am={class:"property-item"},Im=["value"],Tm=Le(e.defineComponent({__name:"EdgePropertiesTab",props:{selectedEdge:{}},emits:["updateEdge","deleteEdge"],setup(d,{emit:t}){const r=d,n=t,i=e.computed(()=>{var A;return((A=r.selectedEdge)==null?void 0:A.getAttrs())||{}}),s=()=>{var A;return((A=r.selectedEdge)==null?void 0:A.shape)||"animated-edge"},o=A=>{var Y,j,le;const C=A.target.value;if(!r.selectedEdge)return;const O=r.selectedEdge.getData(),I=r.selectedEdge.getAttrs();let U={...I};C==="pipeline-edge"?U={shadow:{connection:!0,stroke:"#1e293b",strokeWidth:10,strokeLinecap:"round",strokeLinejoin:"round"},line:{...I.line,stroke:((Y=I.line)==null?void 0:Y.stroke)||"#475569",strokeWidth:8,strokeLinecap:"round",strokeLinejoin:"round"},highlight:{connection:!0,stroke:"#94a3b8",strokeWidth:3,strokeLinecap:"round",strokeLinejoin:"round"}}:C==="animated-edge"&&(U={line:{...I.line,stroke:((j=I.line)==null?void 0:j.stroke)||"#10b981",strokeWidth:((le=I.line)==null?void 0:le.strokeWidth)||2}}),n("updateEdge",{shape:C,attrs:U,data:O})},a=()=>{var A;return!r.selectedEdge||r.selectedEdge.shape!=="pipeline-edge"?8:((A=i.value.line)==null?void 0:A.strokeWidth)||8},l=A=>{const C=Number(A.target.value);if(!r.selectedEdge||r.selectedEdge.shape!=="pipeline-edge")return;const O=C*.5,I=Math.max(2,C*.375);n("updateEdge",{attrs:{line:{strokeWidth:O},highlight:{strokeWidth:I}}})},c=A=>{const C=A.target.value;n("updateEdge",{attrs:{line:{stroke:C}}})},u=A=>{const C=Number(A.target.value);n("updateEdge",{attrs:{line:{strokeWidth:C}}})},p=()=>{var C;const A=(C=i.value.line)==null?void 0:C.strokeDasharray;return A?A==="5,5"?"5,5":A==="2,2"?"2,2":A==="10,5,2,5"?"10,5,2,5":"none":"none"},h=A=>{const C=A.target.value;n("updateEdge",{attrs:{line:{strokeDasharray:C==="none"?void 0:C}}})},m=A=>{const C=Number(A.target.value);n("updateEdge",{attrs:{line:{opacity:C}}})},f=A=>{var O;const C=(O=i.value.line)==null?void 0:O[`${A}Marker`];return!C||typeof C!="object"||!C.name?"none":C.name},E=()=>{var O;const A=(O=i.value.line)==null?void 0:O.opacity;return((A!==void 0&&typeof A=="number"?A:1)*100).toFixed(0)},N=A=>{const C=A.target.value;n("updateEdge",{attrs:{line:{sourceMarker:C==="none"?void 0:{name:C,width:8,height:6}}}})},k=A=>{const C=A.target.value;n("updateEdge",{attrs:{line:{targetMarker:C==="none"?void 0:{name:C,width:8,height:6}}}})},g=A=>{const C=A.target.value;n("updateEdge",{router:C})},v=A=>{const C=A.target.value;n("updateEdge",{connector:{name:C,args:C==="rounded"?{radius:8}:void 0}})},_=()=>{n("deleteEdge")},S=()=>{var C,O;const A=(O=(C=r.selectedEdge)==null?void 0:C.data)==null?void 0:O.animation;return A!=null&&A.enabled?"true":"false"},B=()=>{var C,O;const A=(O=(C=r.selectedEdge)==null?void 0:C.data)==null?void 0:O.animation;return A!=null&&A.duration?A.duration/1e3:2},P=A=>{if(!(A.target.value==="true"))n("updateEdge",{data:{animation:{enabled:!1}},animation:{enabled:!1}});else{const O=B()*1e3;n("updateEdge",{data:{animation:{enabled:!0,duration:O}},animation:{enabled:!0,duration:O}})}},T=A=>{const O=Number(A.target.value)*1e3;n("updateEdge",{data:{animation:{enabled:!0,duration:O}},animation:{enabled:!0,duration:O}})};return(A,C)=>{var O,I,U,Y,j,le,ne,te;return e.openBlock(),e.createElementBlock("div",Yh,[e.createElementVNode("div",Jh,[C[15]||(C[15]=e.createElementVNode("h4",{class:"section-title"},"线条样式",-1)),e.createElementVNode("div",Qh,[C[1]||(C[1]=e.createElementVNode("label",{class:"property-label"},"边类型",-1)),e.createElementVNode("select",{class:"property-select",value:s(),onChange:o},[...C[0]||(C[0]=[e.createElementVNode("option",{value:"animated-edge"},"普通线条",-1),e.createElementVNode("option",{value:"pipeline-edge"},"管道样式",-1)])],40,Xh)]),s()==="pipeline-edge"?(e.openBlock(),e.createElementBlock("div",Zh,[C[3]||(C[3]=e.createElementVNode("label",{class:"property-label"},"管道内径",-1)),e.createElementVNode("div",em,[e.createElementVNode("input",{type:"number",class:"property-input",min:"2",max:"30",step:"1",value:a(),onInput:l},null,40,tm),C[2]||(C[2]=e.createElementVNode("span",{class:"input-unit"},"px",-1))]),C[4]||(C[4]=e.createElementVNode("div",{class:"property-hint"},"调整管道的粗细,影响所有层的宽度",-1))])):e.createCommentVNode("",!0),e.createElementVNode("div",rm,[C[5]||(C[5]=e.createElementVNode("label",{class:"property-label"},"线条颜色",-1)),e.createElementVNode("div",nm,[e.createElementVNode("input",{type:"color",class:"color-input",value:((O=i.value.line)==null?void 0:O.stroke)||"#10b981",onInput:c},null,40,om),e.createElementVNode("input",{type:"text",class:"color-text",value:((I=i.value.line)==null?void 0:I.stroke)||"#10b981",onInput:c},null,40,im)])]),s()==="animated-edge"?(e.openBlock(),e.createElementBlock("div",sm,[C[7]||(C[7]=e.createElementVNode("label",{class:"property-label"},"线条粗细",-1)),e.createElementVNode("div",am,[e.createElementVNode("input",{type:"number",class:"property-input",min:"1",max:"20",step:"1",value:((U=i.value.line)==null?void 0:U.strokeWidth)||2,onInput:u},null,40,lm),C[6]||(C[6]=e.createElementVNode("span",{class:"input-unit"},"px",-1))])])):e.createCommentVNode("",!0),e.createElementVNode("div",cm,[C[9]||(C[9]=e.createElementVNode("label",{class:"property-label"},"线条样式",-1)),e.createElementVNode("select",{class:"property-select",value:p(),onChange:h},[...C[8]||(C[8]=[e.createElementVNode("option",{value:"none"},"实线",-1),e.createElementVNode("option",{value:"5,5"},"虚线",-1),e.createElementVNode("option",{value:"2,2"},"点线",-1),e.createElementVNode("option",{value:"10,5,2,5"},"点划线",-1)])],40,dm)]),e.createElementVNode("div",um,[C[10]||(C[10]=e.createElementVNode("label",{class:"property-label"},"透明度",-1)),e.createElementVNode("div",fm,[e.createElementVNode("input",{type:"range",class:"property-slider",min:"0",max:"1",step:"0.1",value:((Y=i.value.line)==null?void 0:Y.opacity)!==void 0?i.value.line.opacity:1,onInput:m},null,40,pm),e.createElementVNode("span",hm,e.toDisplayString(E())+"%",1)])]),e.createElementVNode("div",mm,[C[12]||(C[12]=e.createElementVNode("label",{class:"property-label"},"流动动画",-1)),e.createElementVNode("select",{class:"property-select",value:S(),onChange:P},[...C[11]||(C[11]=[e.createElementVNode("option",{value:"false"},"关闭",-1),e.createElementVNode("option",{value:"true"},"开启",-1)])],40,gm)]),S()==="true"?(e.openBlock(),e.createElementBlock("div",ym,[C[14]||(C[14]=e.createElementVNode("label",{class:"property-label"},"动画速度",-1)),e.createElementVNode("div",bm,[e.createElementVNode("input",{type:"number",class:"property-input",min:"0.5",max:"10",step:"0.5",value:B(),onInput:T},null,40,wm),C[13]||(C[13]=e.createElementVNode("span",{class:"input-unit"},"秒",-1))])])):e.createCommentVNode("",!0)]),e.createElementVNode("div",vm,[C[20]||(C[20]=e.createElementVNode("h4",{class:"section-title"},"箭头样式",-1)),e.createElementVNode("div",Em,[C[17]||(C[17]=e.createElementVNode("label",{class:"property-label"},"起点箭头",-1)),e.createElementVNode("select",{class:"property-select",value:f("source"),onChange:N},[...C[16]||(C[16]=[e.createStaticVNode('<option value="none" data-v-bd60a1db>无</option><option value="block" data-v-bd60a1db>实心箭头</option><option value="classic" data-v-bd60a1db>经典箭头</option><option value="diamond" data-v-bd60a1db>菱形</option><option value="circle" data-v-bd60a1db>圆形</option>',5)])],40,km)]),e.createElementVNode("div",_m,[C[19]||(C[19]=e.createElementVNode("label",{class:"property-label"},"终点箭头",-1)),e.createElementVNode("select",{class:"property-select",value:f("target"),onChange:k},[...C[18]||(C[18]=[e.createStaticVNode('<option value="none" data-v-bd60a1db>无</option><option value="block" data-v-bd60a1db>实心箭头</option><option value="classic" data-v-bd60a1db>经典箭头</option><option value="diamond" data-v-bd60a1db>菱形</option><option value="circle" data-v-bd60a1db>圆形</option>',5)])],40,Sm)])]),e.createElementVNode("div",Nm,[C[25]||(C[25]=e.createElementVNode("h4",{class:"section-title"},"连接器",-1)),e.createElementVNode("div",Cm,[C[22]||(C[22]=e.createElementVNode("label",{class:"property-label"},"路由方式",-1)),e.createElementVNode("select",{class:"property-select",value:((le=(j=d.selectedEdge)==null?void 0:j.getRouter())==null?void 0:le.name)||"orth",onChange:g},[...C[21]||(C[21]=[e.createElementVNode("option",{value:"orth"},"正交",-1),e.createElementVNode("option",{value:"manhattan"},"曼哈顿",-1),e.createElementVNode("option",{value:"normal"},"直线",-1)])],40,xm)]),e.createElementVNode("div",Am,[C[24]||(C[24]=e.createElementVNode("label",{class:"property-label"},"连接器类型",-1)),e.createElementVNode("select",{class:"property-select",value:((te=(ne=d.selectedEdge)==null?void 0:ne.getConnector())==null?void 0:te.name)||"rounded",onChange:v},[...C[23]||(C[23]=[e.createElementVNode("option",{value:"rounded"},"圆角",-1),e.createElementVNode("option",{value:"smooth"},"平滑",-1),e.createElementVNode("option",{value:"normal"},"普通",-1)])],40,Im)])]),e.createElementVNode("div",{class:"property-section"},[e.createElementVNode("button",{class:"delete-btn",onClick:_}," 删除连线 ")])])}}}),[["__scopeId","data-v-bd60a1db"]]),Vm={class:"event-card"},Pm={class:"header-left"},Bm={class:"collapse-icon"},Om={class:"event-title"},Dm={class:"event-card-body"},Rm={class:"event-field"},Mm=["value"],$m={class:"event-field"},jm=["value"],Lm={class:"event-field"},Um=["value"],Fm={class:"condition-config"},zm=["value"],Wm=["value"],qm=["value"],Gm=["value"],Hm={key:0,class:"config-section"},Km={key:1,class:"config-section"},Ym={key:2,class:"config-section"},Jm={key:0,class:"selected-workflow-info"},Qm={class:"info-row"},Xm={class:"info-value"},Zm={class:"event-field"},eg=["value"],Hi=Le(e.defineComponent({__name:"EventCard",props:{event:{},index:{},isCollapsed:{type:Boolean},nodeProperties:{}},emits:["toggle-collapse","remove","update-field","update-condition","update-params","open-attribute-config","open-custom-code","open-workflow-selector"],setup(d){return(t,r)=>{var n,i,s,o,a,l,c;return e.openBlock(),e.createElementBlock("div",Vm,[e.createElementVNode("div",{class:"event-card-header",onClick:r[1]||(r[1]=u=>t.$emit("toggle-collapse"))},[e.createElementVNode("div",Pm,[e.createElementVNode("span",Bm,e.toDisplayString(d.isCollapsed?"▶":"▼"),1),e.createElementVNode("span",Om,"事件"+e.toDisplayString(d.index+1),1)]),e.createElementVNode("button",{class:"btn-remove",onClick:r[0]||(r[0]=e.withModifiers(u=>t.$emit("remove"),["stop"])),title:"删除事件"},[e.createVNode(e.unref(Mr),{class:"icon-svg"})])]),e.withDirectives(e.createElementVNode("div",Dm,[e.createElementVNode("div",Rm,[r[12]||(r[12]=e.createElementVNode("label",null,"事件名称",-1)),e.createElementVNode("input",{type:"text",value:d.event.name||"",onInput:r[2]||(r[2]=u=>t.$emit("update-field","name",u)),placeholder:"输入事件名称,如:温度报警、湿度预警"},null,40,Mm)]),e.createElementVNode("div",$m,[r[14]||(r[14]=e.createElementVNode("label",null,"事件类型",-1)),e.createElementVNode("select",{value:d.event.type,onChange:r[3]||(r[3]=u=>t.$emit("update-field","type",u))},[...r[13]||(r[13]=[e.createStaticVNode('<option value="click" data-v-b4c5f1a9>单击</option><option value="dblclick" data-v-b4c5f1a9>双击</option><option value="mouseenter" data-v-b4c5f1a9>鼠标移入</option><option value="mouseleave" data-v-b4c5f1a9>鼠标移出</option><option value="focus" data-v-b4c5f1a9>获取焦点</option><option value="blur" data-v-b4c5f1a9>失去焦点</option><option value="input" data-v-b4c5f1a9>输入</option><option value="change" data-v-b4c5f1a9>值变化</option>',8)])],40,jm)]),e.createElementVNode("div",Lm,[r[16]||(r[16]=e.createElementVNode("label",null,"事件行为",-1)),e.createElementVNode("select",{value:d.event.action,onChange:r[4]||(r[4]=u=>t.$emit("update-field","action",u))},[...r[15]||(r[15]=[e.createElementVNode("option",{value:"attributeChange"},"更改属性",-1),e.createElementVNode("option",{value:"customCode"},"自定义代码",-1),e.createElementVNode("option",{value:"callProcess"},"调用流程",-1)])],40,Um)]),r[30]||(r[30]=e.createElementVNode("div",{class:"section-title"},"形参配置",-1)),r[31]||(r[31]=e.createElementVNode("div",{class:"field-hint"},"(不填直接触发)",-1)),r[32]||(r[32]=e.createElementVNode("div",{class:"section-title"},"触发规则",-1)),r[33]||(r[33]=e.createElementVNode("div",{class:"field-hint"},"(不填写条件则直接触发,填写后按条件触发)",-1)),e.createElementVNode("div",Fm,[r[19]||(r[19]=e.createElementVNode("div",{class:"condition-label"},"当",-1)),r[20]||(r[20]=e.createElementVNode("div",{class:"condition-label"},"当前节点属性",-1)),e.createElementVNode("select",{class:"condition-select",value:((n=d.event.condition)==null?void 0:n.attribute)||"",onChange:r[5]||(r[5]=u=>t.$emit("update-condition","attribute",u))},[r[17]||(r[17]=e.createElementVNode("option",{value:""},"选择属性",-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.nodeProperties,u=>(e.openBlock(),e.createElementBlock("option",{key:u.key,value:u.key},e.toDisplayString(u.label),9,Wm))),128))],40,zm),r[21]||(r[21]=e.createElementVNode("div",{class:"condition-label"},"运算符",-1)),e.createElementVNode("select",{class:"condition-select",value:((i=d.event.condition)==null?void 0:i.operator)||"==",onChange:r[6]||(r[6]=u=>t.$emit("update-condition","operator",u))},[...r[18]||(r[18]=[e.createStaticVNode('<option value="==" data-v-b4c5f1a9>等于</option><option value="!=" data-v-b4c5f1a9>不等于</option><option value="&gt;" data-v-b4c5f1a9>大于</option><option value="&gt;=" data-v-b4c5f1a9>大于等于</option><option value="&lt;" data-v-b4c5f1a9>小于</option><option value="&lt;=" data-v-b4c5f1a9>小于等于</option><option value="contains" data-v-b4c5f1a9>包含</option>',7)])],40,qm),r[22]||(r[22]=e.createElementVNode("div",{class:"condition-label"},"值",-1)),e.createElementVNode("input",{type:"text",class:"condition-input",value:((s=d.event.condition)==null?void 0:s.value)||"",onInput:r[7]||(r[7]=u=>t.$emit("update-condition","value",u)),placeholder:"输入值"},null,40,Gm),r[23]||(r[23]=e.createElementVNode("div",{class:"condition-label"},"时",-1)),r[24]||(r[24]=e.createElementVNode("div",{class:"condition-label"},"触发该事件",-1))]),d.event.action==="attributeChange"?(e.openBlock(),e.createElementBlock("div",Hm,[r[25]||(r[25]=e.createElementVNode("div",{class:"section-title"},"属性更改",-1)),e.createElementVNode("button",{class:"btn-config",onClick:r[8]||(r[8]=u=>t.$emit("open-attribute-config"))},"点击配置")])):e.createCommentVNode("",!0),d.event.action==="customCode"?(e.openBlock(),e.createElementBlock("div",Km,[r[26]||(r[26]=e.createElementVNode("div",{class:"section-title"},"自定义代码",-1)),e.createElementVNode("button",{class:"btn-config",onClick:r[9]||(r[9]=u=>t.$emit("open-custom-code"))},"点击配置")])):e.createCommentVNode("",!0),d.event.action==="callProcess"?(e.openBlock(),e.createElementBlock("div",Ym,[r[29]||(r[29]=e.createElementVNode("div",{class:"section-title"},"调用流程",-1)),e.createElementVNode("button",{class:"btn-config",onClick:r[10]||(r[10]=u=>t.$emit("open-workflow-selector"))},"选择流程"),(o=d.event.params)!=null&&o.processId?(e.openBlock(),e.createElementBlock("div",Jm,[e.createElementVNode("div",Qm,[r[27]||(r[27]=e.createElementVNode("span",{class:"info-label"},"已选择:",-1)),e.createElementVNode("span",Xm,e.toDisplayString(((a=d.event.params)==null?void 0:a.processName)||((l=d.event.params)==null?void 0:l.processId)),1)]),e.createElementVNode("div",Zm,[r[28]||(r[28]=e.createElementVNode("label",null,"传入参数",-1)),e.createElementVNode("textarea",{value:((c=d.event.params)==null?void 0:c.processParams)||"",onInput:r[11]||(r[11]=u=>t.$emit("update-params","processParams",u)),placeholder:'JSON格式: {"param1":"value1","param2":"value2"}',rows:"3"},null,40,eg)])])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)],512),[[e.vShow,!d.isCollapsed]])])}}}),[["__scopeId","data-v-b4c5f1a9"]]),tg={class:"point-selector"},rg={class:"point-list-panel"},ng={class:"panel-header"},og={class:"point-count"},ig={class:"search-box"},sg={class:"point-list"},ag={key:0,class:"empty-hint"},lg=["onClick"],cg={class:"point-info"},dg={class:"point-name"},ug={key:0,class:"required-badge"},fg={class:"point-meta"},pg={class:"point-code"},hg={key:0,class:"point-unit"},mg={class:"point-type"},gg={key:0,class:"point-description"},yg={key:1,class:"point-range"},bg={class:"modal-footer"},wg=["disabled"],vg=Le(e.defineComponent({__name:"ComponentPointSelector",props:{visible:{type:Boolean},modelValue:{},componentPoints:{}},emits:["update:visible","update:modelValue","confirm"],setup(d,{emit:t}){const r=d,n=t,i=e.ref(""),s=e.ref("");e.watch(()=>r.modelValue,p=>{p&&(i.value=p)},{immediate:!0});const o=e.computed(()=>{if(!s.value)return r.componentPoints||[];const p=s.value.toLowerCase();return(r.componentPoints||[]).filter(h=>{var m,f,E;return((m=h.name)==null?void 0:m.toLowerCase().includes(p))||((f=h.id)==null?void 0:f.toLowerCase().includes(p))||((E=h.description)==null?void 0:E.toLowerCase().includes(p))})}),a=p=>{i.value=p.id},l=()=>{n("update:visible",!1)},c=()=>{if(!i.value)return;const p=r.componentPoints.find(h=>h.id===i.value);p&&(n("update:modelValue",i.value),n("confirm",i.value,p),n("update:visible",!1))},u=p=>({boolean:"布尔",number:"数值",string:"字符",json:"JSON"})[p]||p;return(p,h)=>d.visible?(e.openBlock(),e.createElementBlock("div",{key:0,class:"modal-overlay",onClick:l},[e.createElementVNode("div",{class:"modal-container",onClick:h[1]||(h[1]=e.withModifiers(()=>{},["stop"]))},[e.createElementVNode("div",{class:"modal-header"},[h[2]||(h[2]=e.createElementVNode("h3",null,"选择组件点位",-1)),e.createElementVNode("button",{class:"btn-close",onClick:l},"✕")]),e.createElementVNode("div",tg,[e.createElementVNode("div",rg,[e.createElementVNode("div",ng,[h[3]||(h[3]=e.createElementVNode("h4",null,"点位列表",-1)),e.createElementVNode("span",og,e.toDisplayString(d.componentPoints.length),1)]),e.createElementVNode("div",ig,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":h[0]||(h[0]=m=>s.value=m),type:"text",placeholder:"搜索点位...",class:"search-input"},null,512),[[e.vModelText,s.value]])]),e.createElementVNode("div",sg,[o.value.length===0?(e.openBlock(),e.createElementBlock("div",ag," 暂无点位 ")):(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(o.value,m=>(e.openBlock(),e.createElementBlock("div",{key:m.id,class:e.normalizeClass(["point-item",{active:i.value===m.id}]),onClick:f=>a(m)},[e.createElementVNode("div",cg,[e.createElementVNode("div",dg,[e.createTextVNode(e.toDisplayString(m.name)+" ",1),m.required?(e.openBlock(),e.createElementBlock("span",ug,"必需")):e.createCommentVNode("",!0)]),e.createElementVNode("div",fg,[e.createElementVNode("span",pg,e.toDisplayString(m.id),1),m.unit?(e.openBlock(),e.createElementBlock("span",hg,e.toDisplayString(m.unit),1)):e.createCommentVNode("",!0),e.createElementVNode("span",mg,e.toDisplayString(u(m.dataType)),1)]),m.description?(e.openBlock(),e.createElementBlock("div",gg,e.toDisplayString(m.description),1)):e.createCommentVNode("",!0),m.range?(e.openBlock(),e.createElementBlock("div",yg," 范围: "+e.toDisplayString(m.range.min!==void 0?m.range.min:"-")+" ~ "+e.toDisplayString(m.range.max!==void 0?m.range.max:"-"),1)):e.createCommentVNode("",!0)])],10,lg))),128))])])]),e.createElementVNode("div",bg,[e.createElementVNode("button",{class:"btn-cancel",onClick:l},"取消"),e.createElementVNode("button",{class:"btn-confirm",disabled:!i.value,onClick:c}," 确定 ",8,wg)])])])):e.createCommentVNode("",!0)}}),[["__scopeId","data-v-6daa96b8"]]);var gt=(d=>(d.DIRECT="direct",d.BOOLEAN="boolean",d.RANGE="range",d.ENUM="enum",d))(gt||{}),Ir=(d=>(d.BOOLEAN="boolean",d.NUMBER="number",d.STRING="string",d))(Ir||{});const Eg={class:"mapping-configurator"},kg={class:"config-item"},_g={key:0,class:"field-hint error"},Sg={key:1,class:"field-hint"},Ng={class:"config-item"},Cg={key:0,class:"field-hint error"},xg={key:1,class:"field-hint"},Ag={key:0,class:"config-item"},Ig={class:"unit-config"},Tg={class:"checkbox-label"},Vg={key:0,class:"custom-unit"},Pg={key:1,class:"mapping-details"},Bg={class:"config-item"},Og={class:"config-item"},Dg={key:2,class:"mapping-details"},Rg={class:"range-rules"},Mg=["onUpdate:modelValue"],$g=["onUpdate:modelValue"],jg=["onUpdate:modelValue"],Lg=["onClick"],Ug={key:3,class:"mapping-details"},Fg={class:"enum-mappings"},zg=["value","onInput"],Wg=["onUpdate:modelValue"],qg=["onClick"],Gg={key:4,class:"mapping-preview"},Hg={class:"preview-content"},Kg={class:"preview-item"},Yg={class:"preview-output"},Jg={class:"preview-item"},Qg={class:"preview-output"},Xg={class:"preview-input"},Zg={class:"preview-output"},ey={class:"preview-input"},ty={class:"preview-output"},ry=Le(e.defineComponent({__name:"MappingConfigurator",props:{visible:{type:Boolean},modelValue:{}},emits:["update:visible","update:modelValue","confirm"],setup(d,{emit:t}){const r=d,n=t,i=e.ref(r.modelValue||{type:"",valueType:""});e.watch(()=>r.modelValue,k=>{k&&(i.value={...k})},{deep:!0});const s=()=>{i.value.type||(i.value.valueType===Ir.BOOLEAN?i.value.type=gt.BOOLEAN:i.value.valueType===Ir.NUMBER?i.value.type=gt.RANGE:i.value.type=gt.DIRECT),i.value.valueType!==Ir.NUMBER&&(delete i.value.keepOriginalUnit,delete i.value.customUnit)},o=k=>({boolean:"适用于开关状态、是否判断等场景",number:"适用于温度、压力、流量等数值型数据",string:"适用于文本、状态码等字符型数据"})[k]||"",a=k=>({direct:"不做任何转换,直接使用原始值",boolean:"根据 true/false 转换为不同的值",range:"根据数值范围转换为对应值",enum:"根据枚举键值对转换"})[k]||"",l=()=>{const k=i.value.valueType;i.value={type:i.value.type,valueType:k},i.value.type===gt.RANGE?i.value.rangeRules=[]:i.value.type===gt.ENUM&&(i.value.enumMappings={})},c=()=>{i.value.rangeRules||(i.value.rangeRules=[]),i.value.rangeRules.push({min:0,max:100,value:""})},u=k=>{var g;(g=i.value.rangeRules)==null||g.splice(k,1)},p=()=>{i.value.enumMappings||(i.value.enumMappings={});const k=`key_${Object.keys(i.value.enumMappings).length+1}`;i.value.enumMappings[k]=""},h=k=>{i.value.enumMappings&&delete i.value.enumMappings[k]},m=(k,g)=>{const v=k.target.value;if(!i.value.enumMappings||v===g)return;const _=i.value.enumMappings[g];delete i.value.enumMappings[g],i.value.enumMappings[v]=_},f=()=>{},E=()=>{n("update:visible",!1)},N=()=>{if(!i.value.valueType){alert("请选择值类型!");return}if(!i.value.type){alert("请选择映射类型!");return}n("update:modelValue",{...i.value}),n("confirm",{...i.value}),n("update:visible",!1)};return(k,g)=>d.visible?(e.openBlock(),e.createElementBlock("div",{key:0,class:"modal-overlay",onClick:E},[e.createElementVNode("div",{class:"modal-container",onClick:g[6]||(g[6]=e.withModifiers(()=>{},["stop"]))},[e.createElementVNode("div",{class:"modal-header"},[g[7]||(g[7]=e.createElementVNode("h3",null,"值映射配置",-1)),e.createElementVNode("button",{class:"btn-close",onClick:E},"✕")]),e.createElementVNode("div",Eg,[e.createElementVNode("div",kg,[g[9]||(g[9]=e.createElementVNode("label",null,[e.createTextVNode("值类型 "),e.createElementVNode("span",{class:"required"},"*")],-1)),e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":g[0]||(g[0]=v=>i.value.valueType=v),onChange:s},[...g[8]||(g[8]=[e.createElementVNode("option",{value:""},"请选择值类型",-1),e.createElementVNode("option",{value:"boolean"},"布尔型 (true/false)",-1),e.createElementVNode("option",{value:"number"},"数值型 (123, 45.6)",-1),e.createElementVNode("option",{value:"string"},'字符串型 ("abc")',-1)])],544),[[e.vModelSelect,i.value.valueType]]),i.value.valueType?(e.openBlock(),e.createElementBlock("div",Sg,e.toDisplayString(o(i.value.valueType)),1)):(e.openBlock(),e.createElementBlock("div",_g," 值类型为必填项 "))]),e.createElementVNode("div",Ng,[g[11]||(g[11]=e.createElementVNode("label",null,[e.createTextVNode("映射类型 "),e.createElementVNode("span",{class:"required"},"*")],-1)),e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":g[1]||(g[1]=v=>i.value.type=v),onChange:l},[...g[10]||(g[10]=[e.createStaticVNode('<option value="" data-v-5d12f404>请选择映射类型</option><option value="direct" data-v-5d12f404>直接映射(无转换)</option><option value="boolean" data-v-5d12f404>布尔映射</option><option value="range" data-v-5d12f404>范围映射</option><option value="enum" data-v-5d12f404>枚举映射</option>',5)])],544),[[e.vModelSelect,i.value.type]]),i.value.type?(e.openBlock(),e.createElementBlock("div",xg,e.toDisplayString(a(i.value.type)),1)):(e.openBlock(),e.createElementBlock("div",Cg," 映射类型为必填项 "))]),i.value.valueType==="number"?(e.openBlock(),e.createElementBlock("div",Ag,[g[13]||(g[13]=e.createElementVNode("label",null,"单位配置",-1)),e.createElementVNode("div",Ig,[e.createElementVNode("label",Tg,[e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":g[2]||(g[2]=v=>i.value.keepOriginalUnit=v),onChange:f},null,544),[[e.vModelCheckbox,i.value.keepOriginalUnit]]),g[12]||(g[12]=e.createTextVNode(" 保留点位原始单位 ",-1))]),i.value.keepOriginalUnit?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Vg,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":g[3]||(g[3]=v=>i.value.customUnit=v),type:"text",placeholder:"自定义单位,如: °C, MPa, %",onInput:f},null,544),[[e.vModelText,i.value.customUnit]])]))])])):e.createCommentVNode("",!0),i.value.type==="boolean"?(e.openBlock(),e.createElementBlock("div",Pg,[e.createElementVNode("div",Bg,[g[14]||(g[14]=e.createElementVNode("label",null,"True 时的值",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":g[4]||(g[4]=v=>i.value.trueValue=v),type:"text",placeholder:"例如: 运行、#00ff00",onInput:f},null,544),[[e.vModelText,i.value.trueValue]])]),e.createElementVNode("div",Og,[g[15]||(g[15]=e.createElementVNode("label",null,"False 时的值",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":g[5]||(g[5]=v=>i.value.falseValue=v),type:"text",placeholder:"例如: 停止、#ff0000",onInput:f},null,544),[[e.vModelText,i.value.falseValue]])])])):e.createCommentVNode("",!0),i.value.type==="range"?(e.openBlock(),e.createElementBlock("div",Dg,[e.createElementVNode("div",Rg,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.value.rangeRules,(v,_)=>(e.openBlock(),e.createElementBlock("div",{key:_,class:"range-rule"},[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":S=>v.min=S,type:"number",placeholder:"最小值",onInput:f},null,40,Mg),[[e.vModelText,v.min,void 0,{number:!0}]]),g[16]||(g[16]=e.createElementVNode("span",{class:"range-separator"},"~",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":S=>v.max=S,type:"number",placeholder:"最大值",onInput:f},null,40,$g),[[e.vModelText,v.max,void 0,{number:!0}]]),g[17]||(g[17]=e.createElementVNode("span",{class:"range-arrow"},"→",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":S=>v.value=S,type:"text",placeholder:"映射值",onInput:f},null,40,jg),[[e.vModelText,v.value]]),e.createElementVNode("button",{class:"btn-remove-rule",onClick:S=>u(_),title:"删除规则"}," ✕ ",8,Lg)]))),128))]),e.createElementVNode("button",{class:"btn-add-rule",onClick:c}," + 添加范围规则 ")])):e.createCommentVNode("",!0),i.value.type==="enum"?(e.openBlock(),e.createElementBlock("div",Ug,[e.createElementVNode("div",Fg,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.value.enumMappings,(v,_,S)=>(e.openBlock(),e.createElementBlock("div",{key:S,class:"enum-mapping"},[e.createElementVNode("input",{value:_,type:"text",placeholder:"原始值",onInput:B=>m(B,_)},null,40,zg),g[18]||(g[18]=e.createElementVNode("span",{class:"enum-arrow"},"→",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":B=>i.value.enumMappings[_]=B,type:"text",placeholder:"映射值",onInput:f},null,40,Wg),[[e.vModelText,i.value.enumMappings[_]]]),e.createElementVNode("button",{class:"btn-remove-rule",onClick:B=>h(_),title:"删除映射"}," ✕ ",8,qg)]))),128))]),e.createElementVNode("button",{class:"btn-add-rule",onClick:p}," + 添加枚举映射 ")])):e.createCommentVNode("",!0),i.value.type!=="direct"?(e.openBlock(),e.createElementBlock("div",Gg,[g[25]||(g[25]=e.createElementVNode("label",null,"映射预览",-1)),e.createElementVNode("div",Hg,[i.value.type==="boolean"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("div",Kg,[g[19]||(g[19]=e.createElementVNode("span",{class:"preview-input"},"true",-1)),g[20]||(g[20]=e.createElementVNode("span",{class:"preview-arrow"},"→",-1)),e.createElementVNode("span",Yg,e.toDisplayString(i.value.trueValue||"true"),1)]),e.createElementVNode("div",Jg,[g[21]||(g[21]=e.createElementVNode("span",{class:"preview-input"},"false",-1)),g[22]||(g[22]=e.createElementVNode("span",{class:"preview-arrow"},"→",-1)),e.createElementVNode("span",Qg,e.toDisplayString(i.value.falseValue||"false"),1)])],64)):i.value.type==="range"?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(i.value.rangeRules,(v,_)=>(e.openBlock(),e.createElementBlock("div",{key:_,class:"preview-item"},[e.createElementVNode("span",Xg,"["+e.toDisplayString(v.min)+" ~ "+e.toDisplayString(v.max)+"]",1),g[23]||(g[23]=e.createElementVNode("span",{class:"preview-arrow"},"→",-1)),e.createElementVNode("span",Zg,e.toDisplayString(v.value),1)]))),128)):i.value.type==="enum"?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:2},e.renderList(i.value.enumMappings,(v,_)=>(e.openBlock(),e.createElementBlock("div",{key:_,class:"preview-item"},[e.createElementVNode("span",ey,e.toDisplayString(_),1),g[24]||(g[24]=e.createElementVNode("span",{class:"preview-arrow"},"→",-1)),e.createElementVNode("span",ty,e.toDisplayString(v),1)]))),128)):e.createCommentVNode("",!0)])])):e.createCommentVNode("",!0)]),e.createElementVNode("div",{class:"modal-footer"},[e.createElementVNode("button",{class:"btn-cancel",onClick:E},"取消"),e.createElementVNode("button",{class:"btn-confirm",onClick:N},"确定")])])])):e.createCommentVNode("",!0)}}),[["__scopeId","data-v-5d12f404"]]),ny={class:"binding-row"},oy={key:0,class:"cell-content-vertical"},iy={class:"point-name"},sy={class:"point-id"},ay={key:1,class:"cell-placeholder"},ly={class:"binding-col-property"},cy=["value"],dy=["value"],uy={key:0,class:"mapping-label"},fy={key:1,class:"cell-placeholder"},py={class:"binding-col-actions"},Ki=Le(e.defineComponent({__name:"BindingCard",props:{binding:{},index:{},isCollapsed:{type:Boolean},nodeProperties:{},componentPoints:{}},emits:["toggle-collapse","remove","update-field"],setup(d,{emit:t}){const r=d,n=t,i=e.ref(""),s=e.ref(!1),o=e.ref(!1),a=e.ref(r.binding.mapping||{type:gt.DIRECT,valueType:Ir.NUMBER});r.binding.devicePointId&&(i.value=r.binding.devicePointId),e.watch(()=>r.binding.devicePointId,h=>{h?i.value=h:i.value=""}),e.watch(()=>r.binding.mapping,h=>{h&&(a.value=h)},{deep:!0});const l=e.computed(()=>{if(!i.value)return null;const h=r.componentPoints.find(m=>m.id===i.value);return h?{pointId:h.id,pointName:h.name,dataType:h.dataType,pointUnit:h.unit}:null}),c=(h,m)=>{const f=new Event("change");Object.defineProperty(f,"target",{value:{value:h},writable:!1}),n("update-field","devicePointId",f)},u=h=>{const m=new Event("change");Object.defineProperty(m,"target",{value:{value:h},writable:!1}),n("update-field","mapping",m)},p=h=>({direct:"直接映射",boolean:"布尔映射",range:"范围映射",enum:"枚举映射"})[h]||h;return(h,m)=>(e.openBlock(),e.createElementBlock("div",ny,[e.createElementVNode("div",{class:"binding-col-point",onClick:m[0]||(m[0]=f=>s.value=!0)},[l.value?(e.openBlock(),e.createElementBlock("div",oy,[e.createElementVNode("span",iy,e.toDisplayString(l.value.pointName),1),e.createElementVNode("span",sy,e.toDisplayString(l.value.pointId),1)])):(e.openBlock(),e.createElementBlock("span",ay,"选择点位"))]),e.createElementVNode("div",ly,[e.createElementVNode("select",{class:"table-select",value:d.binding.targetProperty||"",onChange:m[1]||(m[1]=f=>h.$emit("update-field","targetProperty",f))},[m[8]||(m[8]=e.createElementVNode("option",{value:""},"选择属性",-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.nodeProperties,f=>(e.openBlock(),e.createElementBlock("option",{key:f.key,value:f.key},e.toDisplayString(f.label),9,dy))),128))],40,cy)]),e.createElementVNode("div",{class:"binding-col-mapping",onClick:m[2]||(m[2]=f=>o.value=!0)},[a.value.type!=="direct"?(e.openBlock(),e.createElementBlock("span",uy,e.toDisplayString(p(a.value.type)),1)):(e.openBlock(),e.createElementBlock("span",fy,"直接映射"))]),e.createElementVNode("div",py,[e.createElementVNode("button",{class:"btn-delete",onClick:m[3]||(m[3]=f=>h.$emit("remove")),title:"删除"},[e.createVNode(e.unref(Mr),{class:"icon-svg"})])]),e.createVNode(vg,{visible:s.value,"onUpdate:visible":m[4]||(m[4]=f=>s.value=f),modelValue:i.value,"onUpdate:modelValue":m[5]||(m[5]=f=>i.value=f),"component-points":d.componentPoints,onConfirm:c},null,8,["visible","modelValue","component-points"]),e.createVNode(ry,{visible:o.value,"onUpdate:visible":m[6]||(m[6]=f=>o.value=f),modelValue:a.value,"onUpdate:modelValue":m[7]||(m[7]=f=>a.value=f),onConfirm:u},null,8,["visible","modelValue"])]))}}),[["__scopeId","data-v-6e180bf6"]]),hy={class:"dialog-content"},my={class:"dialog-header"},gy={class:"dialog-body"},yy={class:"group-row"},by={class:"group-field"},wy=["value","onChange"],vy=["value"],Ey={class:"group-field group-field-value"},ky=["value","onInput"],_y=["value","onInput"],Sy={key:2,class:"color-input-wrapper"},Ny=["value","onInput"],Cy={class:"color-value"},xy=["value","onChange"],Ay=["onClick"],Iy={key:0,class:"empty-hint"},Ty={class:"dialog-footer"},Yi=Le(e.defineComponent({__name:"AttributeConfigDialog",props:{attributeGroups:{},nodeProperties:{}},emits:["close","save","add-group","remove-group","update-group"],setup(d,{emit:t}){const r=d,n=t,i=a=>{const l=r.nodeProperties.find(c=>c.key===a);return(l==null?void 0:l.type)||"text"},s=(a,l,c)=>{const u=c.target.value;n("update-group",a,l,u)},o=()=>{for(const a of r.attributeGroups)if(!a.property){alert("请为每组配置选择目标属性");return}n("save")};return(a,l)=>(e.openBlock(),e.createElementBlock("div",{class:"dialog-overlay",onClick:l[3]||(l[3]=e.withModifiers(c=>a.$emit("close"),["self"]))},[e.createElementVNode("div",hy,[e.createElementVNode("div",my,[l[4]||(l[4]=e.createElementVNode("h3",null,"事件属性更改配置",-1)),e.createElementVNode("button",{class:"btn-close",onClick:l[0]||(l[0]=c=>a.$emit("close"))},"×")]),e.createElementVNode("div",gy,[e.createElementVNode("button",{class:"btn-add-group",onClick:l[1]||(l[1]=c=>a.$emit("add-group"))},"新增一组"),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.attributeGroups,(c,u)=>(e.openBlock(),e.createElementBlock("div",{key:u,class:"attribute-group"},[e.createElementVNode("div",yy,[e.createElementVNode("div",by,[l[6]||(l[6]=e.createElementVNode("label",null,"目标属性",-1)),e.createElementVNode("select",{value:c.property,onChange:p=>s(u,"property",p)},[l[5]||(l[5]=e.createElementVNode("option",{value:""},"选择目标属性",-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.nodeProperties,p=>(e.openBlock(),e.createElementBlock("option",{key:p.key,value:p.key},e.toDisplayString(p.label),9,vy))),128))],40,wy)]),e.createElementVNode("div",Ey,[l[8]||(l[8]=e.createElementVNode("label",null,"期望值",-1)),!c.property||i(c.property)==="text"?(e.openBlock(),e.createElementBlock("input",{key:0,value:c.value,type:"text",onInput:p=>s(u,"value",p),placeholder:"输入值"},null,40,ky)):i(c.property)==="number"?(e.openBlock(),e.createElementBlock("input",{key:1,value:c.value,type:"number",onInput:p=>s(u,"value",p),placeholder:"输入数字"},null,40,_y)):i(c.property)==="color"?(e.openBlock(),e.createElementBlock("div",Sy,[e.createElementVNode("input",{value:c.value,type:"color",onInput:p=>s(u,"value",p)},null,40,Ny),e.createElementVNode("span",Cy,e.toDisplayString(c.value||"#000000"),1)])):i(c.property)==="boolean"?(e.openBlock(),e.createElementBlock("select",{key:3,value:c.value,onChange:p=>s(u,"value",p)},[...l[7]||(l[7]=[e.createElementVNode("option",{value:"true"},"是",-1),e.createElementVNode("option",{value:"false"},"否",-1)])],40,xy)):e.createCommentVNode("",!0)]),e.createElementVNode("button",{class:"btn-delete-group",onClick:p=>a.$emit("remove-group",u),title:"删除"},[e.createVNode(e.unref(Mr),{class:"icon-svg"})],8,Ay)])]))),128)),d.attributeGroups.length===0?(e.openBlock(),e.createElementBlock("div",Iy,' 请点击"新增一组"按钮添加属性配置 ')):e.createCommentVNode("",!0)]),e.createElementVNode("div",Ty,[e.createElementVNode("button",{class:"btn-cancel",onClick:l[2]||(l[2]=c=>a.$emit("close"))},"取消"),e.createElementVNode("button",{class:"btn-confirm",onClick:o},"确定")])])]))}}),[["__scopeId","data-v-443bb2dd"]]),Vy={class:"dialog-content dialog-large"},Py={class:"dialog-header"},By={class:"dialog-body dialog-body-split"},Oy={class:"code-editor-section"},Dy=["value"],Ry={class:"code-preview-section"},My={class:"section-header"},$y={class:"preview-status"},jy={key:0,class:"status-success"},Ly={key:1,class:"status-error"},Uy={class:"preview-canvas"},Fy={key:0,class:"preview-empty"},zy={key:1,class:"preview-error-box"},Wy={class:"error-message"},qy={key:2,class:"preview-node-container"},Gy={key:0,class:"console-output"},Hy={class:"console-logs"},Ky={class:"dialog-footer"},Yy=`function execute(node) {
280
+ // 修改节点填充颜色为红色
281
+ node.attr('body/fill', '#ff0000');
282
+
283
+ // 修改节点文本内容
284
+ node.attr('text/text', '已点击');
285
+
286
+ // 获取当前节点位置
287
+ const pos = node.getPosition();
288
+ console.log('X:', pos.x, 'Y:', pos.y);
289
+ }`,Ji=Le(e.defineComponent({__name:"CustomCodeDialog",props:{code:{},selectedNode:{}},emits:["update:code","close","save"],setup(d,{expose:t}){const r=d,n=e.ref(null),i=e.ref(null);let s=null,o=null;const a=async()=>{var h;if(!r.selectedNode){i.value={success:!1,logs:[],error:"没有选中的节点"};return}const c=(h=r.selectedNode.model)==null?void 0:h.graph;if(!c){i.value={success:!1,logs:[],error:"无法获取画布对象"};return}i.value={success:!0,logs:[],result:void 0};const u=[],p=console.log;try{if(await e.nextTick(),await l(),!o||!s){i.value={success:!1,logs:[],error:"预览画布初始化失败"};return}console.log=(...k)=>{u.push(k.map(g=>typeof g=="object"?JSON.stringify(g,null,2):String(g)).join(" ")),p(...k)};let m=r.code.trim();m.startsWith("function")&&(m=`${m}; execute(node, graph, event);`);const f=new Function("node","graph","event",m),E=new Proxy(r.selectedNode,{get(k,g){return g==="attr"?function(...v){return v.length===1?k.attr(v[0]):o?o.attr(v[0],v[1]):void 0}:k[g]}}),N=f(E,c,{});o&&s&&(o.removeTools(),s.drawBackground(),o.toJSON()),i.value={success:!0,logs:u,result:N!==void 0?typeof N=="object"?JSON.stringify(N,null,2):String(N):void 0}}catch(m){i.value={success:!1,logs:u,error:m.message||String(m)}}finally{console.log=p}},l=async()=>{var h;if(!n.value||!r.selectedNode)return;await e.nextTick();const c=n.value.clientWidth,u=n.value.clientHeight;if(c===0||u===0)return;n.value.innerHTML="",s&&(s.dispose(),s=null,o=null),s=new Ae.Graph({container:n.value,width:c,height:Math.max(u-100,300),background:{color:"#0f172a"},grid:{size:10,visible:!0,type:"dot",args:{color:"#1e293b",thickness:1}},interacting:!1});const p=r.selectedNode.toJSON();try{o=s.addNode({...p,position:{x:c/2-(((h=p.size)==null?void 0:h.width)||100)/2,y:100}})}catch(m){console.error("添加预览节点失败:",m)}};return t({previewContainer:n,DEFAULT_CODE:Yy}),(c,u)=>{var p,h;return e.openBlock(),e.createElementBlock("div",{class:"dialog-overlay",onClick:u[4]||(u[4]=e.withModifiers(m=>c.$emit("close"),["self"]))},[e.createElementVNode("div",Vy,[e.createElementVNode("div",Py,[u[5]||(u[5]=e.createElementVNode("h3",null,"自定义代码配置",-1)),e.createElementVNode("button",{class:"btn-close",onClick:u[0]||(u[0]=m=>c.$emit("close"))},"×")]),e.createElementVNode("div",By,[e.createElementVNode("div",Oy,[e.createElementVNode("div",{class:"section-header"},[u[6]||(u[6]=e.createElementVNode("label",null,"JavaScript代码",-1)),e.createElementVNode("button",{class:"btn-test",onClick:a},"测试执行")]),e.createElementVNode("textarea",{value:d.code,onInput:u[1]||(u[1]=m=>c.$emit("update:code",m.target.value)),placeholder:`function execute(node) {
290
+ // 修改节点填充颜色为红色
291
+ node.attr('body/fill', '#ff0000');
292
+
293
+ // 修改节点文本内容
294
+ node.attr('text/text', '已点击');
295
+
296
+ // 获取当前节点位置
297
+ const pos = node.getPosition();
298
+ console.log('X:', pos.x, 'Y:', pos.y);
299
+ }`,class:"code-textarea code-textarea-full"},null,40,Dy)]),e.createElementVNode("div",Ry,[e.createElementVNode("div",My,[u[7]||(u[7]=e.createElementVNode("label",null,"组件预览",-1)),e.createElementVNode("div",$y,[(p=i.value)!=null&&p.success?(e.openBlock(),e.createElementBlock("span",jy,"✓ 执行成功")):(h=i.value)!=null&&h.error?(e.openBlock(),e.createElementBlock("span",Ly,"✗ 执行失败")):e.createCommentVNode("",!0)])]),e.createElementVNode("div",Uy,[i.value?i.value.error?(e.openBlock(),e.createElementBlock("div",zy,[u[8]||(u[8]=e.createElementVNode("div",{class:"error-title"},"错误信息:",-1)),e.createElementVNode("div",Wy,e.toDisplayString(i.value.error),1)])):(e.openBlock(),e.createElementBlock("div",qy,[e.createElementVNode("div",{ref_key:"previewContainer",ref:n,class:"node-preview"},null,512),i.value.logs.length>0?(e.openBlock(),e.createElementBlock("div",Gy,[u[9]||(u[9]=e.createElementVNode("div",{class:"console-title"},"控制台输出:",-1)),e.createElementVNode("div",Hy,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.value.logs,(m,f)=>(e.openBlock(),e.createElementBlock("div",{key:f,class:"log-item"},e.toDisplayString(m),1))),128))])])):e.createCommentVNode("",!0)])):(e.openBlock(),e.createElementBlock("div",Fy,' 点击"测试执行"按钮查看组件预览效果 '))])])]),e.createElementVNode("div",Ky,[e.createElementVNode("button",{class:"btn-cancel",onClick:u[2]||(u[2]=m=>c.$emit("close"))},"取消"),e.createElementVNode("button",{class:"btn-confirm",onClick:u[3]||(u[3]=m=>c.$emit("save"))},"确定")])])])}}}),[["__scopeId","data-v-04bbdfbe"]]),Jy={class:"dialog-container"},Qy={class:"dialog-header"},Xy={class:"dialog-body"},Zy={key:0,class:"empty-state"},eb={key:1,class:"workflow-list"},tb=["onClick"],rb={class:"workflow-info"},nb={class:"workflow-name"},ob={class:"workflow-meta"},ib={class:"workflow-id"},sb={class:"workflow-date"},ab={class:"workflow-actions"},lb=["onClick"],cb={class:"dialog-footer"},db=["disabled"],ub=Le(e.defineComponent({__name:"WorkflowSelectorDialog",emits:["close","select"],setup(d,{emit:t}){const r=t,n=e.ref([]),i=e.ref(null),s=()=>{try{const u=localStorage.getItem("saved-workflows");u&&(n.value=JSON.parse(u))}catch(u){console.error("加载流程列表失败:",u)}},o=u=>{i.value=u},a=u=>{},l=()=>{i.value&&r("select",i.value)},c=u=>new Date(u).toLocaleString("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"});return e.onMounted(()=>{s()}),(u,p)=>(e.openBlock(),e.createElementBlock("div",{class:"dialog-overlay",onClick:p[2]||(p[2]=e.withModifiers(h=>u.$emit("close"),["self"]))},[e.createElementVNode("div",Jy,[e.createElementVNode("div",Qy,[p[3]||(p[3]=e.createElementVNode("h3",null,"选择流程",-1)),e.createElementVNode("button",{class:"btn-close",onClick:p[0]||(p[0]=h=>u.$emit("close"))},"×")]),e.createElementVNode("div",Xy,[n.value.length===0?(e.openBlock(),e.createElementBlock("div",Zy,[...p[4]||(p[4]=[e.createElementVNode("p",null,"暂无已保存的流程",-1),e.createElementVNode("p",{class:"hint"},"请先在流程编辑器中创建并保存流程",-1)])])):(e.openBlock(),e.createElementBlock("div",eb,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.value,h=>{var m;return e.openBlock(),e.createElementBlock("div",{key:h.id,class:e.normalizeClass(["workflow-item",{selected:((m=i.value)==null?void 0:m.id)===h.id}]),onClick:f=>o(h)},[e.createElementVNode("div",rb,[e.createElementVNode("div",nb,e.toDisplayString(h.name),1),e.createElementVNode("div",ob,[e.createElementVNode("span",ib,"ID: "+e.toDisplayString(h.id),1),e.createElementVNode("span",sb,e.toDisplayString(c(h.createdAt)),1)])]),e.createElementVNode("div",ab,[e.createElementVNode("button",{class:"btn-icon",onClick:e.withModifiers(f=>a(),["stop"]),title:"预览"},[e.createVNode(e.unref(gs),{class:"icon-svg"})],8,lb)])],10,tb)}),128))]))]),e.createElementVNode("div",cb,[e.createElementVNode("button",{class:"btn-secondary",onClick:p[1]||(p[1]=h=>u.$emit("close"))},"取消"),e.createElementVNode("button",{class:"btn-primary",disabled:!i.value,onClick:l}," 确定 ",8,db)])])]))}}),[["__scopeId","data-v-f7c6d333"]]),Qi=(d="")=>{const t=Date.now(),r=Math.random().toString(36).substring(2,11);return d?`${d}_${t}_${r}`:`${t}_${r}`},Ql=()=>Qi("evt"),fb=()=>Qi("node"),mr=(d,t="YYYY-MM-DD HH:mm:ss")=>{const r=new Date(d),n=r.getFullYear(),i=String(r.getMonth()+1).padStart(2,"0"),s=String(r.getDate()).padStart(2,"0"),o=String(r.getHours()).padStart(2,"0"),a=String(r.getMinutes()).padStart(2,"0"),l=String(r.getSeconds()).padStart(2,"0");return t.replace("YYYY",String(n)).replace("MM",i).replace("DD",s).replace("HH",o).replace("mm",a).replace("ss",l)},gr=()=>Date.now(),Xl=(d=50,t=50,r=400,n=300)=>({x:Math.random()*r+d,y:Math.random()*n+t}),pb=(d,t)=>{try{const r=JSON.stringify(d,null,2),n=new Blob([r],{type:"application/json;charset=utf-8"}),i=URL.createObjectURL(n),s=document.createElement("a");return s.href=i,s.download=`${t}.json`,s.click(),URL.revokeObjectURL(i),!0}catch(r){return console.error("导出 JSON 文件失败:",r),!1}},Je=(d,t="info",r=3e3)=>{const n=document.createElement("div");n.className=`scada-toast scada-toast-${t}`,n.textContent=d,Object.assign(n.style,{position:"fixed",top:"20px",left:"50%",transform:"translateX(-50%)",padding:"12px 24px",borderRadius:"6px",fontSize:"14px",fontWeight:"500",zIndex:"10000",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",maxWidth:"80%",wordBreak:"break-word",opacity:"0",transition:"opacity 0.3s ease, transform 0.3s ease"});const s={success:{bg:"#10b981",text:"#fff"},error:{bg:"#ef4444",text:"#fff"},warning:{bg:"#f59e0b",text:"#fff"},info:{bg:"#3b82f6",text:"#fff"}}[t];n.style.backgroundColor=s.bg,n.style.color=s.text,document.body.appendChild(n),requestAnimationFrame(()=>{n.style.opacity="1"}),setTimeout(()=>{n.style.opacity="0",setTimeout(()=>{n.parentNode&&document.body.removeChild(n)},300)},r)},yt={SCADA_EDITOR_DATA:"scada_editor_data"},yr=(d,t)=>{try{const r=JSON.stringify(t);return localStorage.setItem(d,r),!0}catch(r){return console.error(`保存到 localStorage 失败 [${d}]:`,r),!1}},Xi=d=>{try{const t=localStorage.getItem(d);return t?JSON.parse(t):null}catch(t){return console.error(`从 localStorage 读取失败 [${d}]:`,t),null}},vn=d=>{try{localStorage.removeItem(d)}catch(t){console.error(`从 localStorage 删除失败 [${d}]:`,t)}},hb=(d,t)=>{const r=t.split(".");let n=d;for(const i of r)if(n&&typeof n=="object"&&i in n)n=n[i];else return;return n},mb=(d,t,r)=>{const n=t.split(".");let i=d;for(let s=0;s<n.length-1;s++)i[n[s]]||(i[n[s]]={}),i=i[n[s]];i[n[n.length-1]]=r},gb=(d,t)=>{var s;const r=d.getData(),n=(s=r==null?void 0:r.props)==null?void 0:s.find(o=>o.key===t);if(!n||!n.path)return;const i=n.path.split(".");if(i[0]==="attrs"){const o=i.slice(1).join("/");return d.attr(o)}else if(i[0]==="data"){const o=i.slice(1).join(".");return hb(d.getData(),o)}},yb=(d,t,r)=>{var o;const n=d.getData(),i=(o=n==null?void 0:n.props)==null?void 0:o.find(a=>a.key===t);if(!i||!i.path)return console.warn(`未找到属性配置: ${t}`),!1;const s=i.path.split(".");if(s[0]==="attrs"){const a=s.slice(1).join("/");return d.setAttrByPath(a,r),console.log(`属性已更改: ${t} (${a}) = ${r}`),!0}else if(s[0]==="data"){const a=s.slice(1).join("."),l=d.getData()||{};return mb(l,a,r),d.setData(l),console.log(`数据已更改: ${t} (${a}) = ${r}`),!0}else return console.warn(`未知的属性路径类型: ${i.path}`),!1},Zi=(d,t)=>{if(t.conditionType==="always")return!0;if(t.condition&&t.condition.attribute){const r=gb(d,t.condition.attribute),n=r===t.condition.value;return console.log(`条件检查: ${t.condition.attribute} = ${r}, 期望: ${t.condition.value}, 结果: ${n}`),n}return!1},bb=(d,t)=>{t!=null&&t.attributeGroups&&t.attributeGroups.forEach(r=>{const n=r.target==="current"?d:null;n&&yb(n,r.property,r.value)})},wb=(d,t,r)=>{if(r!=null&&r.code)try{new Function("node","event",r.code)(d,t)}catch(n){console.error("自定义代码执行失败:",n)}},vb=(d,t,r)=>{if(!(r!=null&&r.processId)||!(r!=null&&r.processData)){console.error("流程配置不完整:",r);return}try{console.log("开始执行流程:",r.processName||r.processId);let n={};if(r.processParams)try{n=JSON.parse(r.processParams)}catch(s){console.error("流程参数解析失败:",s)}console.log("流程数据:",r.processData),console.log("传入参数:",n);const i=new CustomEvent("workflow-execute",{detail:{processId:r.processId,processName:r.processName,processData:r.processData,params:n,triggerNode:d}});window.dispatchEvent(i)}catch(n){console.error("流程执行失败:",n)}},es=(d,t)=>{if(t.action)switch(console.log("执行事件动作:",t.action,t.params),t.action){case"attributeChange":bb(d,t.params);break;case"customCode":wb(d,t,t.params);break;case"callProcess":vb(d,t,t.params);break;default:console.warn("未知的事件动作:",t.action)}},Eb=(d,t)=>{const r=t.getData();!(r!=null&&r.events)||!Array.isArray(r.events)||r.events.forEach(n=>{const i=n.type;switch(i){case"click":case"dblclick":case"mouseenter":case"mouseleave":d.on(`node:${i}`,({node:s})=>{s.id===t.id&&(console.log(`触发 ${i} 事件:`,n),Zi(s,n)&&es(s,n))});break;case"change":d.on("node:change:attrs",({node:s})=>{s.id===t.id&&(console.log("检查 change 事件:",n),Zi(s,n)&&(console.log("条件满足,触发 change 事件:",n),es(s,n)))});break;case"input":d.on("node:change:data",({node:s})=>{s.id===t.id&&(console.log("触发 input 事件:",n),Zi(s,n)&&es(s,n))});break;case"focus":case"blur":console.warn(`事件类型 ${i} 在预览模式下不支持`);break;default:console.warn(`未知的事件类型: ${i}`)}})};function Zl(d,t){if(!d||typeof d.attr!="function"){console.warn("[EdgeAnimation] edge 对象无效",d);return}if(!t||!t.enabled){d.attr("line/strokeDasharray",void 0),d.attr("circle",void 0),typeof d.stopTransition=="function"&&d.stopTransition("attrs/circle/atConnectionRatio");return}const r=t.duration||2e3,n=Number(d.attr("line/strokeWidth"))||4,i=Math.max(n*.6,3);d.attr("circle",{r:i,atConnectionRatio:0,fill:{type:"radialGradient",stops:[{offset:"0%",color:"#FFFFFF"},{offset:"50%",color:"#FFF59D"},{offset:"100%",color:d.attr("line/stroke")||"#10b981"}]},stroke:"#FFFFFF",strokeWidth:1.5,opacity:.95});const s=()=>{d.attr("circle/atConnectionRatio",0,{silent:!0}),d.transition("attrs/circle/atConnectionRatio",1,{delay:0,duration:r,timing:"linear",complete:()=>{s()}})};s()}const kb=["title"],_b={key:1,class:"properties"},Sb={key:2,class:"properties"},Nb={class:"tabs"},Cb={class:"tab-content"},xb={class:"tab-pane"},Ab={class:"property-section"},Ib={key:0,class:"empty-hint"},Tb={key:1,class:"binding-table"},Vb={class:"binding-table-body"},Pb={class:"tab-pane"},Bb={class:"property-section"},Ob={key:0,class:"empty-hint"},Db={class:"event-list"},ts=Le(e.defineComponent({__name:"PropertyPanel",props:{selectedNode:{},selectedEdge:{},deviceData:{},isCollapsed:{type:Boolean,default:!1}},emits:["updateNode","deleteNode","updateEdge","deleteEdge","update:collapsed"],setup(d,{emit:t}){const r=d,n=t,i=()=>{n("update:collapsed",!r.isCollapsed)},s=e.ref("basic"),o=e.ref([]),a=e.ref(new Set),l=e.ref([]),c=e.ref(new Set),u=e.computed(()=>{if(!r.selectedNode)return[];const w=r.selectedNode.shape;if(!w)return[];const x=at.getComponentByShape(w);return!x||!x.points?[]:x.points});e.watch(()=>r.selectedNode,(w,x)=>{var D,L;if(x&&(x.off("change:position"),x.off("change:size")),(D=w==null?void 0:w.data)!=null&&D.events){const re=JSON.parse(JSON.stringify(w.data.events));re.forEach(H=>{H.id||(H.id=C())}),o.value=re}else o.value=[];a.value.clear(),(L=w==null?void 0:w.data)!=null&&L.bindings?l.value=JSON.parse(JSON.stringify(w.data.bindings)):l.value=[],c.value.clear(),w&&(w.on("change:position",()=>{p.value++}),w.on("change:size",()=>{h.value++}))},{immediate:!0});const p=e.ref(0),h=e.ref(0),m=e.computed(()=>{var x;return p.value,((x=r.selectedNode)==null?void 0:x.getPosition())||{x:0,y:0}}),f=e.computed(()=>{var x;return h.value,((x=r.selectedNode)==null?void 0:x.getSize())||{width:0,height:0}}),E=e.computed(()=>{var x;return((x=r.selectedNode)==null?void 0:x.getAttrs())||{}}),N=(w,x)=>{const D=Number(x.target.value),L=r.selectedNode.getPosition(),re=w==="x"?{x:D,y:L.y}:{x:L.x,y:D};n("updateNode",{position:re})},k=(w,x)=>{const D=Number(x.target.value),L=r.selectedNode.getSize(),re=w==="width"?{width:D,height:L.height}:{width:L.width,height:D};n("updateNode",{size:re})},g=w=>{const x=w.target.value;n("updateNode",{attrs:{text:{text:x},label:{text:x}}})},v=w=>{var L;const x=w.target.value,D=(L=r.selectedNode)==null?void 0:L.getData();if((D==null?void 0:D.type)==="svg"&&(D!=null&&D.internalAnimations)){const re={...D,fill:x};n("updateNode",{data:re})}else n("updateNode",{attrs:{body:{fill:x}}})},_=w=>{var L;const x=w.target.value,D=(L=r.selectedNode)==null?void 0:L.getData();if((D==null?void 0:D.type)==="svg"&&(D!=null&&D.internalAnimations)){const re={...D,stroke:x};n("updateNode",{data:re})}else n("updateNode",{attrs:{body:{stroke:x}}})},S=w=>{const x=Number(w.target.value);n("updateNode",{attrs:{body:{strokeWidth:x}}})},B=w=>{const x=Number(w.target.value);n("updateNode",{attrs:{body:{opacity:x}}})},P=w=>{const x=w.target.value,D={...r.selectedNode.data,componentName:x};n("updateNode",{data:D})},T=(w,x)=>{if(!r.selectedNode)return;const D=w.split(".");if(D[0]==="attrs"){const L=D.slice(1).join("/");n("updateNode",{attrs:{[L]:x}})}else if(D[0]==="data"){const L=JSON.parse(JSON.stringify(r.selectedNode.data||{}));let re=L;for(let H=1;H<D.length-1;H++){const ee=D[H];re[ee]||(re[ee]={}),re=re[ee]}re[D[D.length-1]]=x,w==="data.presetId"&&r.selectedNode.shape,n("updateNode",{data:L})}},A=w=>{if(!r.selectedNode)return;const x={...r.selectedNode.data,dataBinding:w};n("updateNode",{data:x})},C=Ql,O=()=>{const w={id:C(),name:"",type:"click",conditionType:"always",action:"attributeChange",params:{}};o.value.push(w),le()},I=w=>{o.value.splice(w,1),le()},U=(w,x,D)=>{const L=D.target.value;o.value[w][x]=L,le()},Y=(w,x,D)=>{const re=D.target.value;o.value[w].condition||(o.value[w].condition={}),o.value[w].condition[x]=re,le()},j=(w,x,D)=>{const re=D.target.value;o.value[w].params||(o.value[w].params={}),o.value[w].params[x]=re,le()},le=()=>{o.value.forEach(x=>{x.id||(x.id=C())});const w={...r.selectedNode.data,events:o.value};n("updateNode",{data:w})},ne=w=>{a.value.has(w)?a.value.delete(w):a.value.add(w)},te=w=>a.value.has(w),ue=()=>{const w={devicePointId:"",targetProperty:"",enabled:!0};l.value.push(w),M()},$=w=>{l.value.splice(w,1),M()},se=(w,x,D)=>{const re=D.target.value;l.value[w][x]=re,M()},M=()=>{const w={...r.selectedNode.data,bindings:l.value};n("updateNode",{data:w})},Q=w=>{c.value.has(w)?c.value.delete(w):c.value.add(w)},me=w=>c.value.has(w),K=e.ref(!1),Se=e.ref(-1),Z=e.ref([]),G=w=>{var D;Se.value=w;const x=o.value[w];(D=x.params)!=null&&D.attributeGroups&&Array.isArray(x.params.attributeGroups)?Z.value=JSON.parse(JSON.stringify(x.params.attributeGroups)):Z.value=[{target:"current",property:"",value:""}],K.value=!0},ce=()=>{K.value=!1},X=()=>{Z.value.push({target:"current",property:"",value:""})},oe=w=>{Z.value.splice(w,1)},ie=(w,x,D)=>{Z.value[w][x]=D},Ee=()=>{for(const w of Z.value)if(!w.property){alert("请为每组配置选择目标属性");return}o.value[Se.value].params||(o.value[Se.value].params={}),o.value[Se.value].params.attributeGroups=JSON.parse(JSON.stringify(Z.value)),le(),ce()},z=e.ref(!1),V=e.ref(""),F=e.ref(-1),ae=w=>{var D;F.value=w;const x=o.value[w];V.value=((D=x.params)==null?void 0:D.code)||"",z.value=!0},fe=()=>{z.value=!1},pe=()=>{o.value[F.value].params||(o.value[F.value].params={}),o.value[F.value].params.code=V.value,le(),fe()},ye=e.ref(!1),J=e.ref(-1),ge=w=>{J.value=w,ye.value=!0},ke=()=>{ye.value=!1},de=w=>{o.value[J.value].params||(o.value[J.value].params={});const x=o.value[J.value].params;x.processId=w.id,x.processName=w.name,x.processData=w.data,le(),ke()},Ce=()=>{var x;if(!r.selectedNode)return[];const w=[];return(x=r.selectedNode.data)!=null&&x.props&&Array.isArray(r.selectedNode.data.props)&&r.selectedNode.data.props.forEach(D=>{D.bindable!==!1&&w.push({key:D.key,label:D.label,type:D.type||"text"})}),w},y=w=>{n("updateEdge",w)},b=()=>{n("deleteEdge")};return(w,x)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",{class:e.normalizeClass(["property-panel",{collapsed:d.isCollapsed}])},[e.createElementVNode("button",{class:"collapse-btn",onClick:i,title:d.isCollapsed?"展开属性面板":"折叠属性面板"},[...x[4]||(x[4]=[e.createElementVNode("span",{class:"collapse-icon"},"▶",-1)])],8,kb),!d.selectedNode&&!d.selectedEdge?(e.openBlock(),e.createBlock(Pn,{key:0})):d.selectedEdge?(e.openBlock(),e.createElementBlock("div",_b,[x[5]||(x[5]=e.createElementVNode("h3",{class:"panel-title"},"连线属性",-1)),e.createVNode(Tm,{"selected-edge":d.selectedEdge,onUpdateEdge:y,onDeleteEdge:b},null,8,["selected-edge"])])):d.selectedNode?(e.openBlock(),e.createElementBlock("div",Sb,[x[12]||(x[12]=e.createElementVNode("h3",{class:"panel-title"},"节点属性",-1)),e.createElementVNode("div",Nb,[e.createElementVNode("button",{class:e.normalizeClass(["tab-btn",{active:s.value==="basic"}]),onClick:x[0]||(x[0]=D=>s.value="basic")}," 基础 ",2),e.createElementVNode("button",{class:e.normalizeClass(["tab-btn",{active:s.value==="binding"}]),onClick:x[1]||(x[1]=D=>s.value="binding")}," 数据绑定 ",2),e.createElementVNode("button",{class:e.normalizeClass(["tab-btn",{active:s.value==="event"}]),onClick:x[2]||(x[2]=D=>s.value="event")}," 事件 ",2)]),e.createElementVNode("div",Cb,[e.withDirectives(e.createVNode(Bn,{"selected-node":d.selectedNode,"node-position":m.value,"node-size":f.value,"node-attrs":E.value,onUpdatePosition:N,onUpdateSize:k,onUpdateLabel:g,onUpdateFill:v,onUpdateStroke:_,onUpdateStrokeWidth:S,onUpdateOpacity:B,onUpdateComponentName:P,onUpdateDynamicProp:T},null,8,["selected-node","node-position","node-size","node-attrs"]),[[e.vShow,s.value==="basic"]]),e.withDirectives(e.createElementVNode("div",xb,[e.createVNode(Kh,{"selected-node":d.selectedNode,onUpdateDataSource:A},null,8,["selected-node"]),x[9]||(x[9]=e.createElementVNode("div",{class:"divider"},null,-1)),e.createElementVNode("div",Ab,[e.createElementVNode("div",{class:"section-header"},[x[6]||(x[6]=e.createElementVNode("h4",null,"点位映射",-1)),e.createElementVNode("button",{class:"btn-add",onClick:ue},"+ 添加映射")]),l.value.length===0?(e.openBlock(),e.createElementBlock("div",Ib,[...x[7]||(x[7]=[e.createElementVNode("span",null,"暂无点位映射,请先选择设备后点击上方按钮添加",-1)])])):(e.openBlock(),e.createElementBlock("div",Tb,[x[8]||(x[8]=e.createStaticVNode('<div class="binding-table-header" data-v-06fd9006><div class="binding-col-point" data-v-06fd9006>组件点位</div><div class="binding-col-property" data-v-06fd9006>目标属性</div><div class="binding-col-mapping" data-v-06fd9006>值映射</div><div class="binding-col-actions" data-v-06fd9006>操作</div></div>',1)),e.createElementVNode("div",Vb,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value,(D,L)=>(e.openBlock(),e.createBlock(Ki,{key:L,binding:D,index:L,"is-collapsed":me(L),"node-properties":Ce(),"component-points":u.value,onToggleCollapse:re=>Q(L),onRemove:re=>$(L),onUpdateField:(re,H)=>se(L,re,H)},null,8,["binding","index","is-collapsed","node-properties","component-points","onToggleCollapse","onRemove","onUpdateField"]))),128))])]))])],512),[[e.vShow,s.value==="binding"]]),e.withDirectives(e.createElementVNode("div",Pb,[e.createElementVNode("div",Bb,[e.createElementVNode("div",{class:"section-header"},[x[10]||(x[10]=e.createElementVNode("h4",null,"节点事件",-1)),e.createElementVNode("button",{class:"btn-add",onClick:O},"+ 添加事件")]),o.value.length===0?(e.openBlock(),e.createElementBlock("div",Ob,[...x[11]||(x[11]=[e.createElementVNode("span",null,"暂无事件,点击上方按钮添加",-1)])])):e.createCommentVNode("",!0),e.createElementVNode("div",Db,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value,(D,L)=>(e.openBlock(),e.createBlock(Hi,{key:L,event:D,index:L,"is-collapsed":te(L),"node-properties":Ce(),onToggleCollapse:re=>ne(L),onRemove:re=>I(L),onUpdateField:(re,H)=>U(L,re,H),onUpdateCondition:(re,H)=>Y(L,re,H),onUpdateParams:(re,H)=>j(L,re,H),onOpenAttributeConfig:re=>G(L),onOpenCustomCode:re=>ae(L),onOpenWorkflowSelector:re=>ge(L)},null,8,["event","index","is-collapsed","node-properties","onToggleCollapse","onRemove","onUpdateField","onUpdateCondition","onUpdateParams","onOpenAttributeConfig","onOpenCustomCode","onOpenWorkflowSelector"]))),128))])])],512),[[e.vShow,s.value==="event"]])])])):e.createCommentVNode("",!0)],2),K.value?(e.openBlock(),e.createBlock(Yi,{key:0,"attribute-groups":Z.value,"node-properties":Ce(),onClose:ce,onSave:Ee,onAddGroup:X,onRemoveGroup:oe,onUpdateGroup:ie},null,8,["attribute-groups","node-properties"])):e.createCommentVNode("",!0),z.value?(e.openBlock(),e.createBlock(Ji,{key:1,code:V.value,"onUpdate:code":x[3]||(x[3]=D=>V.value=D),"selected-node":d.selectedNode,onClose:fe,onSave:pe},null,8,["code","selected-node"])):e.createCommentVNode("",!0),ye.value?(e.openBlock(),e.createBlock(ub,{key:2,onClose:ke,onSelect:de})):e.createCommentVNode("",!0)],64))}}),[["__scopeId","data-v-06fd9006"]]);function rs(d){const t=d.replace(/-/g,"+").replace(/_/g,"/"),r=t.length%4?"=".repeat(4-t.length%4):"",n=t+r,i=(typeof atob<"u"?atob:o=>Buffer.from(o,"base64").toString("binary"))(n),s=new Uint8Array(i.length);for(let o=0;o<i.length;o++)s[o]=i.charCodeAt(o);return s}function ec(d){const t=new ArrayBuffer(d.byteLength);return new Uint8Array(t).set(d),t}function Rb(d){const t=d.replace("-----BEGIN PUBLIC KEY-----","").replace("-----END PUBLIC KEY-----","").replace(/\s+/g,""),r=(typeof atob<"u"?atob:i=>Buffer.from(i,"base64").toString("binary"))(t),n=new Uint8Array(r.length);for(let i=0;i<r.length;i++)n[i]=r.charCodeAt(i);return n.buffer}async function Mb(d){const t=Rb(d);return await crypto.subtle.importKey("spki",t,{name:"ECDSA",namedCurve:"P-256"},!1,["verify"])}async function $b(d,t){try{const[r,n]=d.split(".");if(!r||!n)return!1;const i=await Mb(t),s=rs(r),o=rs(n),a=ec(s),l=ec(o);return await crypto.subtle.verify({name:"ECDSA",hash:{name:"SHA-256"}},i,l,a)}catch{return!1}}async function jb(d,t){const r=await $b(d,t);if(!r)return null;const n=d.split(".")[0],i=rs(n),s=new TextDecoder().decode(i),o=JSON.parse(s),a=o.expiryDate?new Date().getTime()<=new Date(o.expiryDate).getTime():!0;return{company:o.company||"未知",expiryDate:o.expiryDate,isValid:!!(r&&a)}}const Lb={key:0,class:"scada-footer"},Ub={key:1,class:"scada-footer"},Fb={class:"footer-content"},zb={class:"footer-left"},Wb={class:"copyright",style:{color:"#94a3b8 !important"}},qb={key:0,class:"divider",style:{color:"#475569 !important"}},Gb={key:1,class:"license",style:{color:"#94a3b8 !important"}},Hb={key:0,class:"footer-right"},Kb={class:"text",style:{color:"#94a3b8 !important"}},Yb={key:2,class:"scada-footer"},Jb={class:"footer-content"},Qb={class:"footer-left"},Xb={class:"authorized-text",style:{color:"#10b981 !important"}},Zb={class:"footer-right"},e0={key:0,class:"expiry-text",style:{color:"#94a3b8 !important"}},t0={key:1,class:"expiry-text",style:{color:"#94a3b8 !important"}},r0=Le(e.defineComponent({__name:"Footer",props:{authCode:{default:""},publicKeyPem:{default:void 0},customFooter:{default:void 0}},setup(d){const t=d,r=e.ref(null),n=e.ref(!1);e.watch(()=>[t.authCode,t.publicKeyPem],async()=>{if(!t.authCode||!t.publicKeyPem){n.value=!1,r.value=null;return}const s=await jb(t.authCode,t.publicKeyPem);n.value=!!(s!=null&&s.isValid),r.value=s||null},{immediate:!0});const i=e.computed(()=>n.value);return(s,o)=>{var a,l;return i.value?d.customFooter?(e.openBlock(),e.createElementBlock("footer",Ub,[e.createElementVNode("div",Fb,[e.createElementVNode("div",zb,[e.createElementVNode("span",Wb,e.toDisplayString(d.customFooter.copyright),1),d.customFooter.license?(e.openBlock(),e.createElementBlock("span",qb,"|")):e.createCommentVNode("",!0),d.customFooter.license?(e.openBlock(),e.createElementBlock("span",Gb,e.toDisplayString(d.customFooter.license),1)):e.createCommentVNode("",!0)]),d.customFooter.contact?(e.openBlock(),e.createElementBlock("div",Hb,[e.createElementVNode("span",Kb,e.toDisplayString(d.customFooter.contact),1)])):e.createCommentVNode("",!0)])])):(e.openBlock(),e.createElementBlock("footer",Yb,[e.createElementVNode("div",Jb,[e.createElementVNode("div",Qb,[o[1]||(o[1]=e.createElementVNode("span",{class:"authorized-icon"},"✅",-1)),e.createElementVNode("span",Xb,"已授权: "+e.toDisplayString(((a=r.value)==null?void 0:a.company)||"未知"),1)]),e.createElementVNode("div",Zb,[(l=r.value)!=null&&l.expiryDate?(e.openBlock(),e.createElementBlock("span",e0," 📅 有效期至: "+e.toDisplayString(r.value.expiryDate),1)):(e.openBlock(),e.createElementBlock("span",t0," ∞ 永久授权 "))])])])):(e.openBlock(),e.createElementBlock("footer",Lb,[...o[0]||(o[0]=[e.createStaticVNode('<div class="footer-content" data-v-79209486><div class="footer-left" data-v-79209486><span class="copyright" style="color:#94a3b8 !important;" data-v-79209486>© 2025 leoncheng</span><span class="divider" style="color:#475569 !important;" data-v-79209486>|</span><span class="license" style="color:#94a3b8 !important;" data-v-79209486>仅供学习研究使用,禁止商业用途</span></div><div class="footer-right" data-v-79209486><div class="contact-item" data-v-79209486><span class="icon" data-v-79209486>📧</span><span class="text" style="color:#94a3b8 !important;" data-v-79209486>nywqs@outlook.com</span></div><span class="divider" style="color:#475569 !important;" data-v-79209486>|</span><div class="contact-item" data-v-79209486><span class="icon" data-v-79209486>📱</span><span class="text" style="color:#94a3b8 !important;" data-v-79209486>18637762001</span></div></div></div>',1)])]))}}}),[["__scopeId","data-v-79209486"]]);var zt=(d=>(d.START="start",d.END="end",d.GET_PROPERTY="getProperty",d.SET_PROPERTY="setProperty",d.CONDITION="condition",d.HTTP_REQUEST="httpRequest",d.CUSTOM_CODE="customCode",d.TIMER="timer",d.CLEAR_TIMER="clearTimer",d))(zt||{});const n0={class:"dialog-body"},o0={class:"search-box"},i0={class:"element-list"},s0=["onClick"],a0={class:"element-icon"},l0={class:"element-info"},c0={class:"element-name"},d0={class:"element-type"},u0={key:0,class:"element-check"},f0={key:0,class:"empty-state"},p0={class:"dialog-footer"},h0=["disabled"],tc=Le(e.defineComponent({__name:"ElementSelector",props:{visible:{type:Boolean},elements:{default:()=>[]}},emits:["close","select"],setup(d,{emit:t}){const r=d,n=t,i=e.ref(""),s=e.ref(null),o=e.computed(()=>{if(!i.value)return r.elements;const u=i.value.toLowerCase();return r.elements.filter(p=>p.name.toLowerCase().includes(u)||p.id.toLowerCase().includes(u)||p.type.toLowerCase().includes(u))}),a=u=>{s.value=u},l=()=>{i.value="",s.value=null,n("close")},c=()=>{s.value&&(n("select",s.value),l())};return(u,p)=>d.visible?(e.openBlock(),e.createElementBlock("div",{key:0,class:"element-selector-overlay",onClick:l},[e.createElementVNode("div",{class:"element-selector-dialog",onClick:p[1]||(p[1]=e.withModifiers(()=>{},["stop"]))},[e.createElementVNode("div",{class:"dialog-header"},[p[2]||(p[2]=e.createElementVNode("h3",null,"选择图元",-1)),e.createElementVNode("button",{class:"btn-close",onClick:l},"×")]),e.createElementVNode("div",n0,[e.createElementVNode("div",o0,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":p[0]||(p[0]=h=>i.value=h),type:"text",placeholder:"搜索图元名称或ID..."},null,512),[[e.vModelText,i.value]])]),e.createElementVNode("div",i0,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value,h=>{var m,f;return e.openBlock(),e.createElementBlock("div",{key:h.id,class:e.normalizeClass(["element-item",{active:((m=s.value)==null?void 0:m.id)===h.id}]),onClick:E=>a(h)},[e.createElementVNode("div",a0,e.toDisplayString(h.icon),1),e.createElementVNode("div",l0,[e.createElementVNode("div",c0,e.toDisplayString(h.name),1),e.createElementVNode("div",d0,e.toDisplayString(h.type),1)]),((f=s.value)==null?void 0:f.id)===h.id?(e.openBlock(),e.createElementBlock("div",u0," ✓ ")):e.createCommentVNode("",!0)],10,s0)}),128)),o.value.length===0?(e.openBlock(),e.createElementBlock("div",f0,[...p[3]||(p[3]=[e.createElementVNode("p",null,"未找到图元",-1),e.createElementVNode("p",{class:"empty-hint"},"请尝试其他搜索关键词",-1)])])):e.createCommentVNode("",!0)])]),e.createElementVNode("div",p0,[e.createElementVNode("button",{class:"btn-secondary",onClick:l},"取消"),e.createElementVNode("button",{class:"btn-primary",disabled:!s.value,onClick:c}," 确定 ",8,h0)])])])):e.createCommentVNode("",!0)}}),[["__scopeId","data-v-92f3b8dc"]]),m0={class:"node-config"},g0={class:"config-group"},y0={class:"element-selector"},b0={class:"config-group"},w0=["disabled"],v0=["value"],E0=Le(e.defineComponent({__name:"GetPropertyConfig",props:{modelValue:{}},emits:["update:modelValue"],setup(d,{emit:t}){const r=d,n=t,i=e.reactive({elementId:r.modelValue.elementId||"",propertyName:r.modelValue.propertyName||""}),s=e.ref(""),o=e.ref(!1),a=e.ref([]),l=e.inject("canvasElementService"),c=e.computed(()=>{if(!i.elementId)return[];const m=a.value.find(f=>f.id===i.elementId);return(m==null?void 0:m.properties)||[]}),u=()=>{n("update:modelValue",{...i})},p=async()=>{l&&(a.value=await l.getElements()),o.value=!0},h=m=>{i.elementId=m.id,s.value=m.name,i.propertyName="",u()};return e.onMounted(async()=>{if(l&&(a.value=await l.getElements()),i.elementId){const m=a.value.find(f=>f.id===i.elementId);m&&(s.value=m.name)}}),(m,f)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",m0,[e.createElementVNode("div",g0,[f[3]||(f[3]=e.createElementVNode("label",null,"图元选择",-1)),e.createElementVNode("div",y0,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":f[0]||(f[0]=E=>s.value=E),type:"text",placeholder:"点击选择按钮从画布中选择图元",readonly:""},null,512),[[e.vModelText,s.value]]),e.createElementVNode("button",{class:"btn-select",onClick:p}," 选择图元 ")])]),e.createElementVNode("div",b0,[f[5]||(f[5]=e.createElementVNode("label",null,"属性选择",-1)),e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":f[1]||(f[1]=E=>i.propertyName=E),onChange:u,disabled:!i.elementId},[f[4]||(f[4]=e.createElementVNode("option",{value:""},"请先选择图元",-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value,E=>(e.openBlock(),e.createElementBlock("option",{key:E.key,value:E.key},e.toDisplayString(E.label),9,v0))),128))],40,w0),[[e.vModelSelect,i.propertyName]])])]),e.createVNode(tc,{visible:o.value,elements:a.value,onClose:f[2]||(f[2]=E=>o.value=!1),onSelect:h},null,8,["visible","elements"])],64))}}),[["__scopeId","data-v-0f2da798"]]),k0={class:"node-config"},_0={class:"config-group"},S0={class:"element-selector"},N0={class:"config-group"},C0=["disabled"],x0=["value"],A0={class:"config-group"},I0=Le(e.defineComponent({__name:"SetPropertyConfig",props:{modelValue:{}},emits:["update:modelValue"],setup(d,{emit:t}){const r=d,n=t,i=e.reactive({elementId:r.modelValue.elementId||"",propertyName:r.modelValue.propertyName||"",value:r.modelValue.value||""}),s=e.ref(""),o=e.ref(!1),a=e.ref([]),l=e.inject("canvasElementService"),c=e.computed(()=>{if(!i.elementId)return[];const m=a.value.find(f=>f.id===i.elementId);return(m==null?void 0:m.properties)||[]}),u=()=>{n("update:modelValue",{...i})},p=async()=>{l&&(a.value=await l.getElements()),o.value=!0},h=m=>{i.elementId=m.id,s.value=m.name,i.propertyName="",u()};return e.onMounted(async()=>{if(l&&(a.value=await l.getElements()),i.elementId){const m=a.value.find(f=>f.id===i.elementId);m&&(s.value=m.name)}}),(m,f)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",k0,[e.createElementVNode("div",_0,[f[4]||(f[4]=e.createElementVNode("label",null,"图元选择",-1)),e.createElementVNode("div",S0,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":f[0]||(f[0]=E=>s.value=E),type:"text",placeholder:"点击选择按钮从画布中选择图元",readonly:""},null,512),[[e.vModelText,s.value]]),e.createElementVNode("button",{class:"btn-select",onClick:p}," 选择图元 ")])]),e.createElementVNode("div",N0,[f[6]||(f[6]=e.createElementVNode("label",null,"属性选择",-1)),e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":f[1]||(f[1]=E=>i.propertyName=E),onChange:u,disabled:!i.elementId},[f[5]||(f[5]=e.createElementVNode("option",{value:""},"请先选择图元",-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value,E=>(e.openBlock(),e.createElementBlock("option",{key:E.key,value:E.key},e.toDisplayString(E.label),9,x0))),128))],40,C0),[[e.vModelSelect,i.propertyName]])]),e.createElementVNode("div",A0,[f[7]||(f[7]=e.createElementVNode("label",null,"属性值",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":f[2]||(f[2]=E=>i.value=E),type:"text",placeholder:"请输入属性值",onInput:u},null,544),[[e.vModelText,i.value]])])]),e.createVNode(tc,{visible:o.value,elements:a.value,onClose:f[3]||(f[3]=E=>o.value=!1),onSelect:h},null,8,["visible","elements"])],64))}}),[["__scopeId","data-v-d7c953d1"]]),T0={class:"node-config"},V0={class:"config-group"},P0={class:"config-group"},B0={class:"branches-section"},O0={class:"branch-list"},D0={class:"branch-header"},R0={class:"branch-number"},M0=["onClick"],$0={key:0,class:"branch-config"},j0={class:"config-row"},L0=["onUpdate:modelValue"],U0={key:0,class:"config-row"},F0=["onUpdate:modelValue"],z0={key:1,class:"config-row"},W0=["onUpdate:modelValue","type"],q0={key:1,class:"default-branch-label"},G0=Le(e.defineComponent({__name:"ConditionConfig",props:{modelValue:{}},emits:["update:modelValue"],setup(d,{emit:t}){const r=d,n=t,i=()=>`branch_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,s=()=>r.modelValue.branches&&r.modelValue.branches.length>0?r.modelValue.branches:(r.modelValue.dataType||"boolean")==="boolean"?[{id:i(),label:"True",value:!0},{id:i(),label:"False",value:!1,isDefault:!0}]:[{id:i(),label:"分支1",operator:"eq",value:""},{id:i(),label:"默认",isDefault:!0}],o=e.reactive({sourceNodeId:r.modelValue.sourceNodeId||"prev",dataType:r.modelValue.dataType||"boolean",branches:s()}),a=()=>{n("update:modelValue",{...o})},l=()=>{o.dataType==="boolean"?o.branches=[{id:i(),label:"True",value:!0},{id:i(),label:"False",value:!1,isDefault:!0}]:o.branches=[{id:i(),label:"分支1",operator:"eq",value:""},{id:i(),label:"默认",isDefault:!0}],a()},c=()=>{const p={id:i(),label:`分支${o.branches.length}`,operator:"eq",value:""},h=o.branches.findIndex(m=>m.isDefault);h>-1?o.branches.splice(h,0,p):o.branches.push(p),a()},u=p=>{o.branches.length>2&&(o.branches.splice(p,1),a())};return(p,h)=>(e.openBlock(),e.createElementBlock("div",T0,[e.createElementVNode("div",V0,[h[3]||(h[3]=e.createElementVNode("label",null,"数据来源节点",-1)),e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":h[0]||(h[0]=m=>o.sourceNodeId=m),onChange:a},[...h[2]||(h[2]=[e.createElementVNode("option",{value:""},"请选择数据来源节点",-1),e.createElementVNode("option",{value:"prev"},"上一个节点",-1)])],544),[[e.vModelSelect,o.sourceNodeId]])]),e.createElementVNode("div",P0,[h[5]||(h[5]=e.createElementVNode("label",null,"数据类型",-1)),e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":h[1]||(h[1]=m=>o.dataType=m),onChange:l},[...h[4]||(h[4]=[e.createElementVNode("option",{value:"boolean"},"布尔类型",-1),e.createElementVNode("option",{value:"number"},"数字类型",-1),e.createElementVNode("option",{value:"string"},"字符串类型",-1),e.createElementVNode("option",{value:"any"},"自定义",-1)])],544),[[e.vModelSelect,o.dataType]])]),e.createElementVNode("div",B0,[e.createElementVNode("div",{class:"section-header"},[h[6]||(h[6]=e.createElementVNode("label",null,"条件分支",-1)),e.createElementVNode("button",{class:"btn-add",onClick:c},"添加分支")]),e.createElementVNode("div",O0,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.branches,(m,f)=>(e.openBlock(),e.createElementBlock("div",{key:m.id,class:"branch-item"},[e.createElementVNode("div",D0,[e.createElementVNode("span",R0,"分支 "+e.toDisplayString(f+1),1),!m.isDefault&&o.branches&&o.branches.length>1?(e.openBlock(),e.createElementBlock("button",{key:0,class:"btn-remove",onClick:E=>u(f)},"×",8,M0)):e.createCommentVNode("",!0)]),m.isDefault?(e.openBlock(),e.createElementBlock("div",q0," 默认分支(其他情况) ")):(e.openBlock(),e.createElementBlock("div",$0,[e.createElementVNode("div",j0,[h[7]||(h[7]=e.createElementVNode("label",null,"分支标签",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":E=>m.label=E,type:"text",placeholder:"如: >10, =A, True",onInput:a},null,40,L0),[[e.vModelText,m.label]])]),o.dataType!=="boolean"?(e.openBlock(),e.createElementBlock("div",U0,[h[9]||(h[9]=e.createElementVNode("label",null,"运算符",-1)),e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":E=>m.operator=E,onChange:a},[...h[8]||(h[8]=[e.createStaticVNode('<option value="eq" data-v-33c4fdf2>等于 (==)</option><option value="ne" data-v-33c4fdf2>不等于 (!=)</option><option value="gt" data-v-33c4fdf2>大于 (&gt;)</option><option value="gte" data-v-33c4fdf2>大于等于 (&gt;=)</option><option value="lt" data-v-33c4fdf2>小于 (&lt;)</option><option value="lte" data-v-33c4fdf2>小于等于 (&lt;=)</option><option value="contains" data-v-33c4fdf2>包含</option><option value="notContains" data-v-33c4fdf2>不包含</option>',8)])],40,F0),[[e.vModelSelect,m.operator]])])):e.createCommentVNode("",!0),o.dataType!=="boolean"?(e.openBlock(),e.createElementBlock("div",z0,[h[10]||(h[10]=e.createElementVNode("label",null,"比较值",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":E=>m.value=E,type:o.dataType==="number"?"number":"text",placeholder:"请输入比较值",onInput:a},null,40,W0),[[e.vModelDynamic,m.value]])])):e.createCommentVNode("",!0)]))]))),128))])])]))}}),[["__scopeId","data-v-33c4fdf2"]]),H0={class:"node-config"},K0={class:"config-group"},Y0={class:"config-group"},J0={class:"config-group"},Q0={class:"config-group"},X0={class:"config-group"},Z0=Le(e.defineComponent({__name:"HttpRequestConfig",props:{modelValue:{}},emits:["update:modelValue"],setup(d,{emit:t}){const r=d,n=t,i=e.reactive({url:r.modelValue.url||"",method:r.modelValue.method||"GET",headers:r.modelValue.headers||{},body:r.modelValue.body||"",outputVariable:r.modelValue.outputVariable||""}),s=e.ref(JSON.stringify(i.headers,null,2)),o=()=>{n("update:modelValue",{...i})},a=()=>{try{i.headers=JSON.parse(s.value),o()}catch{}};return e.watch(()=>r.modelValue.headers,l=>{l&&(s.value=JSON.stringify(l,null,2))}),(l,c)=>(e.openBlock(),e.createElementBlock("div",H0,[e.createElementVNode("div",K0,[c[5]||(c[5]=e.createElementVNode("label",null,"请求URL",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":c[0]||(c[0]=u=>i.url=u),type:"text",placeholder:"请输入请求URL",onInput:o},null,544),[[e.vModelText,i.url]])]),e.createElementVNode("div",Y0,[c[7]||(c[7]=e.createElementVNode("label",null,"请求方法",-1)),e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":c[1]||(c[1]=u=>i.method=u),onChange:o},[...c[6]||(c[6]=[e.createElementVNode("option",{value:"GET"},"GET",-1),e.createElementVNode("option",{value:"POST"},"POST",-1),e.createElementVNode("option",{value:"PUT"},"PUT",-1),e.createElementVNode("option",{value:"DELETE"},"DELETE",-1)])],544),[[e.vModelSelect,i.method]])]),e.createElementVNode("div",J0,[c[8]||(c[8]=e.createElementVNode("label",null,"请求头 (JSON格式)",-1)),e.withDirectives(e.createElementVNode("textarea",{"onUpdate:modelValue":c[2]||(c[2]=u=>s.value=u),rows:"3",placeholder:'{"Content-Type": "application/json"}',onInput:a},null,544),[[e.vModelText,s.value]])]),e.createElementVNode("div",Q0,[c[9]||(c[9]=e.createElementVNode("label",null,"请求体",-1)),e.withDirectives(e.createElementVNode("textarea",{"onUpdate:modelValue":c[3]||(c[3]=u=>i.body=u),rows:"4",placeholder:"请输入请求体内容",onInput:o},null,544),[[e.vModelText,i.body]])]),e.createElementVNode("div",X0,[c[10]||(c[10]=e.createElementVNode("label",null,"输出变量",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":c[4]||(c[4]=u=>i.outputVariable=u),type:"text",placeholder:"请输入输出变量名",onInput:o},null,544),[[e.vModelText,i.outputVariable]])])]))}}),[["__scopeId","data-v-9279d630"]]),ew={class:"node-config"},tw={class:"config-group"},rw=Le(e.defineComponent({__name:"CustomCodeConfig",props:{modelValue:{}},emits:["update:modelValue"],setup(d,{emit:t}){const r=d,n=t,i=e.reactive({code:r.modelValue.code||""}),s=()=>{n("update:modelValue",{...i})};return(o,a)=>(e.openBlock(),e.createElementBlock("div",ew,[e.createElementVNode("div",tw,[a[1]||(a[1]=e.createElementVNode("label",null,"JavaScript代码",-1)),e.withDirectives(e.createElementVNode("textarea",{"onUpdate:modelValue":a[0]||(a[0]=l=>i.code=l),rows:"10",placeholder:"请输入JavaScript代码",onInput:s},null,544),[[e.vModelText,i.code]])]),a[2]||(a[2]=e.createElementVNode("div",{class:"code-hint"},[e.createElementVNode("p",null,"提示:"),e.createElementVNode("ul",null,[e.createElementVNode("li",null,"可以使用 context 对象访问上下文变量"),e.createElementVNode("li",null,"使用 return 返回结果")])],-1))]))}}),[["__scopeId","data-v-78bd2a05"]]),nw={class:"node-config"},ow={class:"config-group"},iw={class:"config-group"},sw=Le(e.defineComponent({__name:"TimerConfig",props:{modelValue:{}},emits:["update:modelValue"],setup(d,{emit:t}){const r=d,n=t,i=e.reactive({interval:r.modelValue.interval||1e3,unit:r.modelValue.unit||"ms"}),s=()=>{n("update:modelValue",{...i})};return(o,a)=>(e.openBlock(),e.createElementBlock("div",nw,[e.createElementVNode("div",ow,[a[2]||(a[2]=e.createElementVNode("label",null,"时间间隔",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":a[0]||(a[0]=l=>i.interval=l),type:"number",min:"1",placeholder:"请输入时间间隔",onInput:s},null,544),[[e.vModelText,i.interval,void 0,{number:!0}]])]),e.createElementVNode("div",iw,[a[4]||(a[4]=e.createElementVNode("label",null,"时间单位",-1)),e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":a[1]||(a[1]=l=>i.unit=l),onChange:s},[...a[3]||(a[3]=[e.createElementVNode("option",{value:"ms"},"毫秒 (ms)",-1),e.createElementVNode("option",{value:"s"},"秒 (s)",-1),e.createElementVNode("option",{value:"m"},"分钟 (m)",-1),e.createElementVNode("option",{value:"h"},"小时 (h)",-1)])],544),[[e.vModelSelect,i.unit]])])]))}}),[["__scopeId","data-v-95ecb4d4"]]),aw={class:"node-config"},lw={class:"config-group"},cw=["value"],dw={key:0,class:"timer-hint warning"},uw={key:1,class:"timer-hint"},fw=Le(e.defineComponent({__name:"ClearTimerConfig",props:{modelValue:{}},emits:["update:modelValue"],setup(d,{emit:t}){const r=d,n=t,i=e.reactive({timerId:r.modelValue.timerId||""}),s=e.ref([]),o=e.inject("getGraph"),a=()=>{if(!o)return[];const c=o();if(!c)return[];const u=c.getNodes(),p=[];return u.forEach(h=>{const m=h.getData();if((m==null?void 0:m.nodeType)==="timer"){const f=h.getAttrByPath("label/text")||"定时器";p.push({id:h.id,label:f})}}),p};e.onMounted(()=>{s.value=a()}),e.watch(()=>r.modelValue,()=>{s.value=a()},{deep:!0});const l=()=>{n("update:modelValue",{...i})};return(c,u)=>(e.openBlock(),e.createElementBlock("div",aw,[e.createElementVNode("div",lw,[u[2]||(u[2]=e.createElementVNode("label",null,"选择定时器节点",-1)),e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":u[0]||(u[0]=p=>i.timerId=p),onChange:l},[u[1]||(u[1]=e.createElementVNode("option",{value:""},"请选择要清除的定时器",-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.value,p=>(e.openBlock(),e.createElementBlock("option",{key:p.id,value:p.id},e.toDisplayString(p.label),9,cw))),128))],544),[[e.vModelSelect,i.timerId]])]),s.value.length===0?(e.openBlock(),e.createElementBlock("div",dw,[...u[3]||(u[3]=[e.createElementVNode("p",null,"提示:当前流程中没有定时器节点",-1)])])):(e.openBlock(),e.createElementBlock("div",uw,[...u[4]||(u[4]=[e.createElementVNode("p",null,"提示:选择要清除的定时器节点",-1)])]))]))}}),[["__scopeId","data-v-992e9d4f"]]),pw={[zt.GET_PROPERTY]:E0,[zt.SET_PROPERTY]:I0,[zt.CONDITION]:G0,[zt.HTTP_REQUEST]:Z0,[zt.CUSTOM_CODE]:rw,[zt.TIMER]:sw,[zt.CLEAR_TIMER]:fw};function hw(d){return pw[d]||null}const mw={class:"property-panel"},gw={key:0,class:"property-content"},yw={class:"property-group"},bw=["value"],ww={class:"property-group"},vw=["value"],Ew={key:0,class:"divider"},kw={key:1,class:"property-empty"},_w=Le(e.defineComponent({__name:"PropertyPanel",props:{selectedCell:{}},emits:["update:label","update:config"],setup(d,{emit:t}){const r=d,n=t,i=()=>{var u,p,h;return((h=(p=(u=r.selectedCell)==null?void 0:u.cell)==null?void 0:p.model)==null?void 0:h.graph)||null};e.provide("getGraph",i);const s=e.ref({}),o=e.computed(()=>r.selectedCell?hw(r.selectedCell.nodeType):null);e.watch(()=>r.selectedCell,u=>{if(u!=null&&u.cell){const p=u.cell.getData();s.value=(p==null?void 0:p.config)||{}}else s.value={}},{immediate:!0});const a=u=>{const p=u.target;n("update:label",p.value)},l=u=>{var p;if(s.value=u,(p=r.selectedCell)!=null&&p.cell){const h=r.selectedCell.cell.getData()||{};r.selectedCell.cell.setData({...h,config:u}),r.selectedCell.nodeType==="condition"&&u.branches&&c(u.branches)}n("update:config",u)},c=u=>{var A,C;if(!((A=r.selectedCell)!=null&&A.cell))return;const p=r.selectedCell.cell,h=(C=p.model)==null?void 0:C.graph;if(!h)return;const m=[];h.getConnectedEdges(p,{outgoing:!0}).forEach(O=>{const I=O.getSourcePortId(),U=O.getTargetCell(),Y=O.getTargetPortId();I&&U&&m.push({sourcePortId:I,targetCell:U,targetPortId:Y})});const E=m.length>0?m[0].targetCell:null,N=m.length>0?m[0].targetPortId:"port-in";p.getPorts().forEach(O=>{O.group==="out"&&p.removePort(O.id)});const g=30,v=60,_=Math.max(u.length,1),S=Math.max(v,_*g),B=p.size(),P=p.position(),T=S-B.height;T!==0&&p.position(P.x,P.y-T/2),p.resize(B.width,S),u.forEach((O,I)=>{p.addPort({id:`port-out-${I}`,group:"out",attrs:{circle:{r:5,magnet:!0,stroke:"#34d399",strokeWidth:2,fill:"#1e293b"},portLabel:{text:O.label||`分支${I+1}`,fontSize:10,fill:"#94a3b8"}}})}),setTimeout(()=>{E&&u.forEach((O,I)=>{h.addEdge({source:{cell:p,port:`port-out-${I}`},target:{cell:E,port:N},labels:[{attrs:{label:{text:O.label||`分支${I+1}`,fill:"#e2e8f0",fontSize:12},rect:{fill:"#334155",stroke:"#34d399",strokeWidth:1,rx:4,ry:4}},position:.5}]})})},100)};return(u,p)=>(e.openBlock(),e.createElementBlock("div",mw,[p[4]||(p[4]=e.createElementVNode("h3",null,"属性配置",-1)),d.selectedCell?(e.openBlock(),e.createElementBlock("div",gw,[e.createElementVNode("div",yw,[p[1]||(p[1]=e.createElementVNode("label",null,"节点名称",-1)),e.createElementVNode("input",{value:d.selectedCell.label,type:"text",placeholder:"输入节点名称",onInput:a},null,40,bw)]),e.createElementVNode("div",ww,[p[2]||(p[2]=e.createElementVNode("label",null,"节点类型",-1)),e.createElementVNode("input",{value:d.selectedCell.nodeType,type:"text",readonly:"",disabled:""},null,8,vw)]),o.value?(e.openBlock(),e.createElementBlock("div",Ew)):e.createCommentVNode("",!0),o.value?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(o.value),{key:1,modelValue:s.value,"onUpdate:modelValue":[p[0]||(p[0]=h=>s.value=h),l]},null,8,["modelValue"])):e.createCommentVNode("",!0)])):(e.openBlock(),e.createElementBlock("div",kw,[...p[3]||(p[3]=[e.createElementVNode("div",{class:"empty-text"},"选择节点以配置属性",-1)])]))]))}}),[["__scopeId","data-v-5d112bee"]]),Sw={class:"toolbar"},Nw={class:"toolbar-right"},Cw=Le(e.defineComponent({__name:"WorkflowToolbar",props:{showClose:{type:Boolean}},emits:["clear","validate","save","close"],setup(d){return(t,r)=>(e.openBlock(),e.createElementBlock("div",Sw,[r[5]||(r[5]=e.createElementVNode("div",{class:"toolbar-left"},[e.createElementVNode("h2",null,"流程编排")],-1)),e.createElementVNode("div",Nw,[e.createElementVNode("button",{class:"btn-secondary",onClick:r[0]||(r[0]=n=>t.$emit("clear"))},"清空"),e.createElementVNode("button",{class:"btn-secondary",onClick:r[1]||(r[1]=n=>t.$emit("validate"))},"验证"),e.createElementVNode("button",{class:"btn-primary",onClick:r[2]||(r[2]=n=>t.$emit("save"))},"保存"),d.showClose?(e.openBlock(),e.createElementBlock("button",{key:0,class:"btn-close",onClick:r[3]||(r[3]=n=>t.$emit("close")),title:"关闭"},[...r[4]||(r[4]=[e.createElementVNode("span",{class:"close-icon"},"×",-1)])])):e.createCommentVNode("",!0)])]))}}),[["__scopeId","data-v-932917de"]]),xw={class:"menu-header"},Aw={class:"menu-list"},Iw=["onClick"],Tw={class:"menu-item-info"},Vw={class:"menu-item-name"},Pw={class:"menu-item-desc"},Bw=Le(e.defineComponent({__name:"AddNodeMenu",props:{visible:{type:Boolean},position:{},nodeTypes:{}},emits:["close","select"],setup(d,{emit:t}){const r=d,n=t,i=e.computed(()=>r.nodeTypes.filter(o=>o.type!=="start"&&o.type!=="end")),s=o=>{n("select",o)};return(o,a)=>(e.openBlock(),e.createElementBlock("div",null,[d.visible?(e.openBlock(),e.createElementBlock("div",{key:0,class:"menu-overlay",onClick:a[0]||(a[0]=l=>o.$emit("close"))})):e.createCommentVNode("",!0),d.visible?(e.openBlock(),e.createElementBlock("div",{key:1,class:"add-node-menu",style:e.normalizeStyle({left:d.position.x+"px",top:d.position.y+"px"})},[e.createElementVNode("div",xw,[a[2]||(a[2]=e.createElementVNode("span",null,"选择节点类型",-1)),e.createElementVNode("button",{class:"btn-close",onClick:a[1]||(a[1]=l=>o.$emit("close"))},"×")]),e.createElementVNode("div",Aw,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.value,l=>(e.openBlock(),e.createElementBlock("div",{key:l.type,class:"menu-item",onClick:c=>s(l)},[e.createElementVNode("div",{class:e.normalizeClass(["menu-item-icon",`node-icon-${l.type}`])},e.toDisplayString(l.icon),3),e.createElementVNode("div",Tw,[e.createElementVNode("div",Vw,e.toDisplayString(l.name),1),e.createElementVNode("div",Pw,e.toDisplayString(l.description),1)])],8,Iw))),128))])],4)):e.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-f8f444fa"]]);class Ow{constructor(){he(this,"graph",null)}setGraph(t){this.graph=t}async getElements(){if(!this.graph)return console.warn("画布实例未初始化"),[];const t=this.graph.getNodes();return await Promise.all(t.map(async n=>{const i=n.getData()||{},s=i.type||n.shape,o=await at.getComponent(s),a=this.getElementProperties(n,o);return{id:n.id,name:i.componentName||n.getAttrByPath("label/text")||`图元_${n.id.slice(0,8)}`,type:(o==null?void 0:o.metadata.name)||s,icon:(o==null?void 0:o.metadata.icon)||"📦",properties:a}}))}getElementProperties(t,r){const n=[],i=new Set;return r!=null&&r.props&&r.props.forEach(s=>{const o=s.path.split("."),a=o[o.length-1];a&&!i.has(a)&&(n.push({key:a,label:s.label||a}),i.add(a))}),n}async getElementById(t){return(await this.getElements()).find(n=>n.id===t)||null}async searchElements(t){const r=await this.getElements(),n=t.toLowerCase();return r.filter(i=>i.name.toLowerCase().includes(n)||i.id.toLowerCase().includes(n)||i.type.toLowerCase().includes(n))}}const rc=new Ow,Dw={class:"workflow-editor"},Rw={class:"editor-main"},Mw={class:"canvas-area"},$w=Le(e.defineComponent({__name:"WorkflowEditor",props:{scadaGraph:{default:null},showClose:{type:Boolean,default:!1}},emits:["close"],setup(d){const t=d,r=e.ref([{type:"start",name:"开始",icon:"▶",description:"流程起点",color:"#52c41a"},{type:"end",name:"结束",icon:"⏹",description:"流程终点",color:"#ff4d4f"},{type:"getProperty",name:"获取图元属性",icon:"📥",description:"获取图元的属性值",color:"#1890ff"},{type:"setProperty",name:"设置图元属性",icon:"📤",description:"设置图元的属性值",color:"#13c2c2"},{type:"condition",name:"条件节点",icon:"◆",description:"条件分支判断",color:"#faad14"},{type:"httpRequest",name:"http请求",icon:"🌐",description:"HTTP网络请求",color:"#722ed1"},{type:"customCode",name:"自定义代码",icon:"💻",description:"执行自定义JavaScript代码",color:"#eb2f96"},{type:"timer",name:"定时器节点",icon:"⏰",description:"设置定时执行",color:"#52c41a"},{type:"clearTimer",name:"清除定时器",icon:"🗑",description:"清除定时器",color:"#ff4d4f"}]),n=e.ref();let i=null;t.scadaGraph&&rc.setGraph(t.scadaGraph),e.provide("canvasElementService",rc);const s=e.ref(null),o=e.ref(!1),a=e.ref({x:0,y:0});let l=null;const c=()=>{r.value.forEach(v=>{const _={inherit:"rect",width:150,height:60,markup:[{tagName:"rect",selector:"body"},{tagName:"text",selector:"icon"},{tagName:"text",selector:"label"}],attrs:{body:{strokeWidth:1,stroke:v.color,fill:"#ffffff",rx:6,ry:6},icon:{text:v.icon,fontSize:24,fill:v.color,refX:20,refY:"50%",textAnchor:"middle",textVerticalAnchor:"middle"},label:{text:v.name,fontSize:14,fill:"#333333",refX:75,refY:"50%",textAnchor:"middle",textVerticalAnchor:"middle"}},ports:{groups:{in:{position:"left",attrs:{circle:{r:5,magnet:!0,stroke:"#10b981",strokeWidth:2,fill:"#1e293b"}}},out:{position:{name:"right"},attrs:{circle:{r:5,magnet:!0,stroke:"#10b981",strokeWidth:2,fill:"#1e293b"},portLabel:{fontSize:10,fill:"#94a3b8"}},markup:[{tagName:"circle",selector:"circle"},{tagName:"text",selector:"portLabel"}],label:{position:{name:"right",args:{x:10,y:0}}}}},items:[]},data:{nodeType:v.type}};v.type==="start"?_.ports.items=[{id:"port-out",group:"out"}]:v.type==="end"?_.ports.items=[{id:"port-in",group:"in"}]:v.type==="condition"?_.ports.items=[{id:"port-in",group:"in"},{id:"port-out-0",group:"out",args:{text:"True"}},{id:"port-out-1",group:"out",args:{text:"False"}}]:_.ports.items=[{id:"port-in",group:"in"},{id:"port-out",group:"out"}],Ae.Graph.registerNode(v.type,_,!0)})},u=()=>{if(!n.value)return;c(),i=new Ae.Graph({container:n.value,width:n.value.clientWidth,height:n.value.clientHeight,grid:{size:10,visible:!0,type:"dot",args:{color:"#333",thickness:1}},panning:{enabled:!0,modifiers:"shift"},mousewheel:{enabled:!0,modifiers:["ctrl","meta"]},connecting:{router:"manhattan",connector:{name:"rounded",args:{radius:8}},anchor:"center",connectionPoint:"anchor",snap:{radius:20},allowBlank:!1,allowLoop:!1,allowNode:!1,createEdge(){return new Ae.Shape.Edge({attrs:{line:{stroke:"#64748b",strokeWidth:3,targetMarker:{name:"block",width:12,height:8,fill:"#64748b"}}},zIndex:0})},validateConnection({targetMagnet:_}){return!!_}},highlighting:{magnetAvailable:{name:"stroke",args:{attrs:{fill:"#34d399",stroke:"#34d399"}}}}}),i.use(new Qt.Selection({enabled:!0,rubberband:!1,showNodeSelectionBox:!0,showEdgeSelectionBox:!0,multiple:!0,movable:!0,strict:!1}));const v=_=>{var S;if(console.log("键盘事件触发:",_.key,"selectedCell存在:",!!s.value),_.key==="Delete"||_.key==="Backspace"){if(!i){console.log("graph不存在,无法删除");return}if((S=s.value)!=null&&S.cell){_.preventDefault();const P=s.value.cell;console.log("删除选中的节点:",s.value.label);const T=i.getIncomingEdges(P),A=i.getOutgoingEdges(P);T&&T.length>0&&A&&A.length>0&&T.forEach(C=>{const O=C.getSourceCell(),I=C.getSourcePortId();A.forEach(U=>{const Y=U.getTargetCell(),j=U.getTargetPortId();O&&Y&&i&&(i.addEdge({source:{cell:O,port:I},target:{cell:Y,port:j}}),console.log("已连接前后节点"))})}),i.removeCells([P]),s.value=null,console.log("已删除节点");return}const B=i.getSelectedCells();console.log("选中的cells数量:",B.length,B),B.length?(_.preventDefault(),i.removeCells(B),console.log("已删除cells")):console.log("没有选中的cells")}};document.addEventListener("keydown",v),i.on("node:click",({node:_})=>{var P;const S=_.getAttrByPath("label/text")||"",B=((P=_.getData())==null?void 0:P.nodeType)||_.shape||"";s.value={label:S,nodeType:B,cell:_},console.log("节点已点击,保存到selectedCell:",S)}),i.on("blank:click",()=>{s.value=null,i&&i.cleanSelection()}),i.on("edge:mouseenter",({edge:_})=>{_.setAttrs({line:{stroke:"#10b981",strokeWidth:4}}),_.addTools([{name:"button",args:{markup:[{tagName:"circle",selector:"button",attrs:{r:12,stroke:"#10b981",strokeWidth:2,fill:"#1e293b",cursor:"pointer"}},{tagName:"path",selector:"icon",attrs:{d:"M -5 0 L 5 0 M 0 -5 L 0 5",stroke:"#10b981",strokeWidth:2,fill:"none",pointerEvents:"none"}}],distance:.5,onClick:({e:S,view:B})=>{l=B.cell,o.value=!0,a.value={x:S.clientX,y:S.clientY}}}},{name:"vertices"}])}),i.on("edge:mouseleave",({edge:_})=>{_.setAttrs({line:{stroke:"#64748b",strokeWidth:3}}),_.removeTools()}),i.on("edge:connected",({isNew:_,edge:S})=>{_&&S.setAttrs({line:{stroke:"#64748b",strokeWidth:3}})}),i.on("node:selected",({node:_})=>{_.toFront()}),i.on("edge:selected",({edge:_})=>{_.toFront()}),p()},p=()=>{if(!i)return;const v=i.addNode({shape:"start",x:100,y:200,label:"开始",data:{nodeType:"start"}}),_=i.addNode({shape:"end",x:500,y:200,label:"结束",data:{nodeType:"end"}});i.addEdge({source:{cell:v,port:"port-out"},target:{cell:_,port:"port-in"}})},h=v=>{var _;(_=s.value)!=null&&_.cell&&(s.value.label=v,s.value.cell.setAttrByPath("label/text",v))},m=v=>{if(!i||!l)return;const _=l.getSourceCell(),S=l.getTargetCell();if(!_||!S)return;const B=_.position(),P=S.position(),T=(B.x+P.x)/2,A=(B.y+P.y)/2,C=i.addNode({shape:v.type,x:T,y:A,label:v.name,data:{nodeType:v.type}});l.remove(),i.addEdge({source:{cell:_,port:"port-out"},target:{cell:C,port:"port-in"}}),v.type==="condition"?(i.addEdge({source:{cell:C,port:"port-out-0"},target:{cell:S,port:"port-in"},labels:[{attrs:{label:{text:"True",fill:"#e2e8f0",fontSize:12},rect:{fill:"#334155",stroke:"#64748b",strokeWidth:1,rx:4,ry:4}},position:.5}]}),i.addEdge({source:{cell:C,port:"port-out-1"},target:{cell:S,port:"port-in"},labels:[{attrs:{label:{text:"False",fill:"#e2e8f0",fontSize:12},rect:{fill:"#334155",stroke:"#64748b",strokeWidth:1,rx:4,ry:4}},position:.5}]})):i.addEdge({source:{cell:C,port:"port-out"},target:{cell:S,port:"port-in"}}),o.value=!1,l=null},f=()=>{i&&i.clearCells()},E=()=>{if(!i)return console.log("画布不存在"),{errors:["画布不存在"],warnings:[]};const v=[],_=[],S=i.getNodes(),B=S.filter(T=>{var A;return((A=T.getData())==null?void 0:A.nodeType)==="start"});return B.length===0?v.push("流程中缺少开始节点"):B.length>1&&_.push("流程中有多个开始节点"),S.filter(T=>{var A;return((A=T.getData())==null?void 0:A.nodeType)==="end"}).length===0&&_.push("流程中缺少结束节点"),S.forEach(T=>{const A=T.getData(),C=A==null?void 0:A.nodeType,O=(A==null?void 0:A.config)||{},I=T.getAttrByPath("label/text")||"未命名节点";(C==="getProperty"||C==="setProperty")&&(O.elementId||v.push(`节点「${I}」未配置图元`),O.propertyName||v.push(`节点「${I}」未配置属性`),C==="setProperty"&&!O.value&&_.push(`节点「${I}」未配置属性值`)),C==="httpRequest"&&(O.url||v.push(`节点「${I}」未配置请求URL`)),C==="condition"&&(!O.branches||O.branches.length===0)&&v.push(`节点「${I}」未配置条件分支`),C==="timer"&&(!O.interval||O.interval<=0)&&v.push(`节点「${I}」未配置有效的时间间隔`),C==="clearTimer"&&(O.timerId||v.push(`节点「${I}」未选择定时器`)),C==="customCode"&&(O.code||_.push(`节点「${I}」未编写代码`))}),S.forEach(T=>{var O;const A=(O=T.getData())==null?void 0:O.nodeType,C=T.getAttrByPath("label/text")||"未命名节点";if(A==="start"&&i){const I=i.getOutgoingEdges(T);(!I||I.length===0)&&v.push(`开始节点「${C}」没有连接到下一个节点`)}if(A==="end"&&i){const I=i.getOutgoingEdges(T);I&&I.length>0&&_.push(`结束节点「${C}」不应该有输出连线`)}if(A!=="start"&&A!=="end"&&i){const I=i.getIncomingEdges(T),U=i.getOutgoingEdges(T);(!I||I.length===0)&&_.push(`节点「${C}」没有输入连线`),A!=="clearTimer"&&(!U||U.length===0)&&_.push(`节点「${C}」没有输出连线`)}}),i&&S.forEach(T=>{var U;const A=i.getIncomingEdges(T),C=i.getOutgoingEdges(T),O=(U=T.getData())==null?void 0:U.nodeType,I=T.getAttrByPath("label/text")||"未命名节点";O!=="start"&&(!A||A.length===0)&&(!C||C.length===0)&&_.push(`节点「${I}」是孤立节点`)}),{errors:v,warnings:_}},N=()=>{const{errors:v,warnings:_}=E();if(v.length===0&&_.length===0)alert("✓ 流程验证通过!"),console.log("流程验证通过");else{let S="";v.length>0&&(S+=`错误:
300
+ `+v.map(B=>" • "+B).join(`
301
+ `)),_.length>0&&(S&&(S+=`
302
+
303
+ `),S+=`警告:
304
+ `+_.map(B=>" • "+B).join(`
305
+ `)),alert(S),console.log("验证结果:",{errors:v,warnings:_})}},k=()=>{if(!i)return;const{errors:v,warnings:_}=E();if(v.length>0){let O=`流程验证失败,无法保存!
306
+
307
+ `;O+=`错误:
308
+ `+v.map(I=>" • "+I).join(`
309
+ `),_.length>0&&(O+=`
310
+
311
+ 警告:
312
+ `+_.map(I=>" • "+I).join(`
313
+ `)),alert(O);return}if(_.length>0){let O=`流程存在以下警告:
314
+
315
+ `;if(O+=_.map(I=>" • "+I).join(`
316
+ `),O+=`
317
+
318
+ 是否继续保存?`,!confirm(O))return}const S=prompt("请输入流程名称:","未命名流程");if(!S||!S.trim())return;const B=i.toJSON(),P=i.getNodes().map(O=>({id:O.id,shape:O.shape,position:O.getPosition(),size:O.getSize(),attrs:O.getAttrs(),data:O.getData()})),T=i.getEdges().map(O=>({id:O.id,source:O.getSourceCellId(),target:O.getTargetCellId(),attrs:O.getAttrs(),data:O.getData()})),C={id:"workflow_"+Date.now(),name:S.trim(),data:{...B,nodes:P,edges:T},createdAt:Date.now(),updatedAt:Date.now()};try{const O=localStorage.getItem("saved-workflows"),I=O?JSON.parse(O):[];I.push(C),localStorage.setItem("saved-workflows",JSON.stringify(I)),alert("✓ 流程保存成功!"),console.log("流程已保存:",C)}catch(O){console.error("保存流程失败:",O),alert("保存失败,请重试")}};e.onMounted(()=>{u(),window.addEventListener("resize",g)});const g=()=>{!i||!n.value||i.resize(n.value.clientWidth,n.value.clientHeight)};return e.onBeforeUnmount(()=>{window.removeEventListener("resize",g);const v=_=>{if(_.key==="Delete"||_.key==="Backspace"){if(!i)return;const S=i.getSelectedCells();S.length&&(_.preventDefault(),i.removeCells(S),s.value&&S.includes(s.value.cell)&&(s.value=null))}};document.removeEventListener("keydown",v),i&&i.dispose()}),(v,_)=>(e.openBlock(),e.createElementBlock("div",Dw,[e.createVNode(Cw,{"show-close":d.showClose,onClear:f,onValidate:N,onSave:k,onClose:_[0]||(_[0]=S=>v.$emit("close"))},null,8,["show-close"]),e.createElementVNode("div",Rw,[e.createElementVNode("div",Mw,[e.createElementVNode("div",{id:"workflow-container",ref_key:"containerRef",ref:n},null,512)]),e.createVNode(_w,{"selected-cell":s.value,"onUpdate:label":h},null,8,["selected-cell"])]),e.createVNode(Bw,{visible:o.value,position:a.value,"node-types":r.value,onClose:_[1]||(_[1]=S=>o.value=!1),onSelect:m},null,8,["visible","position","node-types"])]))}}),[["__scopeId","data-v-4ad1caa5"]]),jw={key:0,class:"workflow-dialog-overlay"},Lw={class:"workflow-dialog"},Uw=Le(e.defineComponent({__name:"WorkflowDialog",props:{visible:{type:Boolean},scadaGraph:{default:null}},emits:["update:visible","close"],setup(d,{emit:t}){const r=d,n=t;e.watch(()=>r.visible,o=>{o?document.body.style.overflow="hidden":document.body.style.overflow=""});const i=()=>{n("update:visible",!1),n("close")},s=o=>{o.key==="Escape"&&r.visible&&i()};return typeof window<"u"&&window.addEventListener("keydown",s),(o,a)=>d.visible?(e.openBlock(),e.createElementBlock("div",jw,[e.createElementVNode("div",Lw,[e.createVNode($w,{"scada-graph":d.scadaGraph,"show-close":!0,onClose:i},null,8,["scada-graph"])])])):e.createCommentVNode("",!0)}}),[["__scopeId","data-v-917d8758"]]),Fw={class:"dialog-container"},zw={class:"dialog-body"},Ww={class:"datasource-list-panel"},qw={class:"datasource-list"},Gw={key:0,class:"empty-hint"},Hw=["onClick"],Kw={class:"datasource-header"},Yw={class:"datasource-info"},Jw={class:"datasource-name"},Qw={class:"datasource-type"},Xw=["title"],Zw={class:"datasource-meta"},e1={class:"device-count"},t1={class:"datasource-detail-panel"},r1={key:0,class:"empty-state"},n1={key:1,class:"detail-content"},o1={class:"detail-header"},i1={class:"detail-actions"},s1={class:"detail-form"},a1={class:"form-section"},l1={class:"form-item"},c1={class:"form-item"},d1=["disabled"],u1={class:"form-item"},f1={class:"switch"},p1={key:0,class:"form-section"},h1={class:"form-item"},m1={class:"form-item"},g1={class:"form-item"},y1={class:"form-item"},b1={class:"form-item"},w1={key:1,class:"form-section"},v1={class:"form-item"},E1={key:2,class:"form-section"},k1={class:"form-item"},_1={class:"form-item"},S1={class:"form-item"},N1={class:"form-item"},C1={class:"headers-list"},x1={key:0,class:"empty-headers"},A1=["onUpdate:modelValue"],I1=["onUpdate:modelValue"],T1=["onClick"],V1={class:"form-item"},P1={key:3,class:"form-section"},B1={class:"form-item"},O1={class:"form-item"},D1={key:4,class:"form-section"},R1={class:"device-list"},M1={class:"device-info"},$1={class:"device-name"},j1={class:"device-id"},L1={class:"point-count"},U1={key:5,class:"form-section"},F1={class:"status-info"},z1={class:"status-row"},W1={key:0,class:"status-row"},q1={class:"status-value"},G1={key:1,class:"status-row error"},H1={class:"status-value"},K1=Le(e.defineComponent({__name:"DataSourceDialog",props:{dataSources:{}},emits:["close","save","delete","add"],setup(d,{emit:t}){const r=t,n=e.ref(null),i=e.ref(!1),s=e.ref([]),o=e.ref({name:"",type:"MQTT",enabled:!0,config:{broker:"",topic:"",clientId:"",username:"",password:"",wsUrl:"",url:"",method:"GET",pollInterval:5e3,headers:{},body:"",sseUrl:"",eventType:""}}),a=N=>{n.value=N,i.value=!1,o.value={name:N.name,type:N.type,enabled:N.enabled,config:{...N.config}},N.type==="HTTP"&&N.config.headers?s.value=Object.entries(N.config.headers).map(([k,g])=>({key:k,value:String(g)})):s.value=[]},l=()=>{n.value=null,i.value=!0,o.value={name:"",type:"MQTT",enabled:!0,config:{broker:"mqtt://broker.emqx.io",topic:"/devices/+/data",clientId:"scada_"+Date.now(),username:"",password:""}}},c=()=>{if(!o.value.name){alert("请输入数据源名称");return}i.value?(r("add",{name:o.value.name,type:o.value.type,enabled:o.value.enabled,config:o.value.config}),i.value=!1):n.value&&r("save",{...n.value,name:o.value.name,type:o.value.type,enabled:o.value.enabled,config:o.value.config})},u=()=>{n.value&&confirm(`确定要删除数据源"${n.value.name}"吗?`)&&(r("delete",n.value.id),n.value=null,i.value=!1)},p=()=>{r("close")},h=N=>new Date(N).toLocaleString("zh-CN"),m=()=>{s.value.push({key:"",value:""})},f=N=>{s.value.splice(N,1),E()},E=()=>{const N={};s.value.forEach(k=>{k.key.trim()&&(N[k.key.trim()]=k.value)}),o.value.config.headers=N};return(N,k)=>{var g;return e.openBlock(),e.createElementBlock("div",{class:"dialog-overlay",onClick:e.withModifiers(p,["self"])},[e.createElementVNode("div",Fw,[e.createElementVNode("div",{class:"dialog-header"},[k[15]||(k[15]=e.createElementVNode("h3",null,"数据源管理",-1)),e.createElementVNode("button",{class:"btn-close",onClick:p},"✕")]),e.createElementVNode("div",zw,[e.createElementVNode("div",Ww,[e.createElementVNode("div",{class:"panel-header"},[k[16]||(k[16]=e.createElementVNode("span",null,"数据源列表",-1)),e.createElementVNode("button",{class:"btn-add",onClick:l},"+ 添加")]),e.createElementVNode("div",qw,[d.dataSources.length===0?(e.openBlock(),e.createElementBlock("div",Gw," 暂无数据源 ")):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.dataSources,v=>{var _,S,B;return e.openBlock(),e.createElementBlock("div",{key:v.id,class:e.normalizeClass(["datasource-item",{active:((_=n.value)==null?void 0:_.id)===v.id}]),onClick:P=>a(v)},[e.createElementVNode("div",Kw,[e.createElementVNode("div",Yw,[e.createElementVNode("span",Jw,e.toDisplayString(v.name),1),e.createElementVNode("span",Qw,e.toDisplayString(v.type),1)]),e.createElementVNode("span",{class:e.normalizeClass(["status-dot",(S=v.status)!=null&&S.connected?"connected":"disconnected"]),title:(B=v.status)!=null&&B.connected?"已连接":"未连接"},null,10,Xw)]),e.createElementVNode("div",Zw,[e.createElementVNode("span",e1,e.toDisplayString(v.devices.length)+" 个设备",1)])],10,Hw)}),128))])]),e.createElementVNode("div",t1,[!n.value&&!i.value?(e.openBlock(),e.createElementBlock("div",r1,[...k[17]||(k[17]=[e.createElementVNode("p",null,"请选择左侧数据源查看详情",-1)])])):(e.openBlock(),e.createElementBlock("div",n1,[e.createElementVNode("div",o1,[e.createElementVNode("h4",null,e.toDisplayString(i.value?"新建数据源":"数据源详情"),1),e.createElementVNode("div",i1,[i.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("button",{key:0,class:"btn-secondary",onClick:u}," 删除 ")),e.createElementVNode("button",{class:"btn-primary",onClick:c},e.toDisplayString(i.value?"创建":"保存"),1)])]),e.createElementVNode("div",s1,[e.createElementVNode("div",a1,[k[23]||(k[23]=e.createElementVNode("h5",null,"基本信息",-1)),e.createElementVNode("div",l1,[k[18]||(k[18]=e.createElementVNode("label",null,"名称",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":k[0]||(k[0]=v=>o.value.name=v),type:"text",placeholder:"例如:主机房 MQTT"},null,512),[[e.vModelText,o.value.name]])]),e.createElementVNode("div",c1,[k[20]||(k[20]=e.createElementVNode("label",null,"类型",-1)),e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":k[1]||(k[1]=v=>o.value.type=v),disabled:!i.value},[...k[19]||(k[19]=[e.createElementVNode("option",{value:"MQTT"},"MQTT",-1),e.createElementVNode("option",{value:"WebSocket"},"WebSocket",-1),e.createElementVNode("option",{value:"HTTP"},"HTTP",-1),e.createElementVNode("option",{value:"SSE"},"SSE",-1)])],8,d1),[[e.vModelSelect,o.value.type]])]),e.createElementVNode("div",u1,[k[22]||(k[22]=e.createElementVNode("label",null,"启用",-1)),e.createElementVNode("label",f1,[e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":k[2]||(k[2]=v=>o.value.enabled=v)},null,512),[[e.vModelCheckbox,o.value.enabled]]),k[21]||(k[21]=e.createElementVNode("span",{class:"slider"},null,-1))])])]),o.value.type==="MQTT"?(e.openBlock(),e.createElementBlock("div",p1,[k[30]||(k[30]=e.createElementVNode("h5",null,"MQTT 配置",-1)),e.createElementVNode("div",h1,[k[24]||(k[24]=e.createElementVNode("label",null,"Broker 地址",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":k[3]||(k[3]=v=>o.value.config.broker=v),type:"text",placeholder:"mqtt://broker.emqx.io 或 ws://broker.emqx.io:8083/mqtt"},null,512),[[e.vModelText,o.value.config.broker]]),k[25]||(k[25]=e.createElementVNode("span",{class:"form-hint"},"💡 浏览器会自动转换为 WebSocket,EMQX 公共服务器使用 8083 端口",-1))]),e.createElementVNode("div",m1,[k[26]||(k[26]=e.createElementVNode("label",null,"订阅主题",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":k[4]||(k[4]=v=>o.value.config.topic=v),type:"text",placeholder:"/devices/+/data"},null,512),[[e.vModelText,o.value.config.topic]])]),e.createElementVNode("div",g1,[k[27]||(k[27]=e.createElementVNode("label",null,"客户端 ID",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":k[5]||(k[5]=v=>o.value.config.clientId=v),type:"text",placeholder:"自动生成"},null,512),[[e.vModelText,o.value.config.clientId]])]),e.createElementVNode("div",y1,[k[28]||(k[28]=e.createElementVNode("label",null,"用户名",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":k[6]||(k[6]=v=>o.value.config.username=v),type:"text",placeholder:"可选"},null,512),[[e.vModelText,o.value.config.username]])]),e.createElementVNode("div",b1,[k[29]||(k[29]=e.createElementVNode("label",null,"密码",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":k[7]||(k[7]=v=>o.value.config.password=v),type:"password",placeholder:"可选"},null,512),[[e.vModelText,o.value.config.password]])])])):e.createCommentVNode("",!0),o.value.type==="WebSocket"?(e.openBlock(),e.createElementBlock("div",w1,[k[32]||(k[32]=e.createElementVNode("h5",null,"WebSocket 配置",-1)),e.createElementVNode("div",v1,[k[31]||(k[31]=e.createElementVNode("label",null,"服务地址",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":k[8]||(k[8]=v=>o.value.config.wsUrl=v),type:"text",placeholder:"ws://localhost:8080"},null,512),[[e.vModelText,o.value.config.wsUrl]])])])):e.createCommentVNode("",!0),o.value.type==="HTTP"?(e.openBlock(),e.createElementBlock("div",E1,[k[42]||(k[42]=e.createElementVNode("h5",null,"HTTP 配置",-1)),e.createElementVNode("div",k1,[k[33]||(k[33]=e.createElementVNode("label",null,"接口地址",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":k[9]||(k[9]=v=>o.value.config.url=v),type:"text",placeholder:"https://api.example.com/data"},null,512),[[e.vModelText,o.value.config.url]])]),e.createElementVNode("div",_1,[k[35]||(k[35]=e.createElementVNode("label",null,"请求方法",-1)),e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":k[10]||(k[10]=v=>o.value.config.method=v)},[...k[34]||(k[34]=[e.createElementVNode("option",{value:"GET"},"GET",-1),e.createElementVNode("option",{value:"POST"},"POST",-1)])],512),[[e.vModelSelect,o.value.config.method]])]),e.createElementVNode("div",S1,[k[36]||(k[36]=e.createElementVNode("label",null,"轮询间隔 (ms)",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":k[11]||(k[11]=v=>o.value.config.pollInterval=v),type:"number",min:"1000",step:"1000"},null,512),[[e.vModelText,o.value.config.pollInterval,void 0,{number:!0}]])]),e.createElementVNode("div",N1,[e.createElementVNode("div",{class:"header-label-row"},[k[38]||(k[38]=e.createElementVNode("label",null,"请求头 (Headers)",-1)),e.createElementVNode("button",{class:"btn-icon-add",onClick:m,type:"button",title:"添加请求头"},[...k[37]||(k[37]=[e.createElementVNode("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[e.createElementVNode("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),e.createElementVNode("line",{x1:"5",y1:"12",x2:"19",y2:"12"})],-1),e.createTextVNode(" 添加 ",-1)])])]),e.createElementVNode("div",C1,[s.value.length===0?(e.openBlock(),e.createElementBlock("div",x1," 暂无自定义请求头 ")):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.value,(v,_)=>(e.openBlock(),e.createElementBlock("div",{key:_,class:"header-item"},[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":S=>v.key=S,type:"text",placeholder:"Key",class:"header-input key-input",onInput:E},null,40,A1),[[e.vModelText,v.key]]),k[40]||(k[40]=e.createElementVNode("div",{class:"separator"},":",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":S=>v.value=S,type:"text",placeholder:"Value",class:"header-input value-input",onInput:E},null,40,I1),[[e.vModelText,v.value]]),e.createElementVNode("button",{class:"btn-icon-remove",onClick:S=>f(_),type:"button",title:"删除"},[...k[39]||(k[39]=[e.createElementVNode("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[e.createElementVNode("polyline",{points:"3 6 5 6 21 6"}),e.createElementVNode("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})],-1)])],8,T1)]))),128))])]),e.createElementVNode("div",V1,[k[41]||(k[41]=e.createElementVNode("label",null,"请求体",-1)),e.withDirectives(e.createElementVNode("textarea",{"onUpdate:modelValue":k[12]||(k[12]=v=>o.value.config.body=v),rows:"3",placeholder:"POST/PUT方法的请求体"},null,512),[[e.vModelText,o.value.config.body]])])])):e.createCommentVNode("",!0),o.value.type==="SSE"?(e.openBlock(),e.createElementBlock("div",P1,[k[45]||(k[45]=e.createElementVNode("h5",null,"SSE 配置",-1)),e.createElementVNode("div",B1,[k[43]||(k[43]=e.createElementVNode("label",null,"服务地址",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":k[13]||(k[13]=v=>o.value.config.sseUrl=v),type:"text",placeholder:"https://api.example.com/events"},null,512),[[e.vModelText,o.value.config.sseUrl]])]),e.createElementVNode("div",O1,[k[44]||(k[44]=e.createElementVNode("label",null,"事件类型",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":k[14]||(k[14]=v=>o.value.config.eventType=v),type:"text",placeholder:"留空表示所有事件"},null,512),[[e.vModelText,o.value.config.eventType]])])])):e.createCommentVNode("",!0),n.value&&n.value.devices.length>0?(e.openBlock(),e.createElementBlock("div",D1,[k[46]||(k[46]=e.createElementVNode("h5",null,"已接收设备",-1)),e.createElementVNode("div",R1,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.value.devices,v=>(e.openBlock(),e.createElementBlock("div",{key:v.id,class:"device-item"},[e.createElementVNode("div",M1,[e.createElementVNode("span",$1,e.toDisplayString(v.name),1),e.createElementVNode("span",j1,e.toDisplayString(v.id),1)]),e.createElementVNode("span",L1,e.toDisplayString(v.points.length)+" 个点位",1)]))),128))])])):e.createCommentVNode("",!0),(g=n.value)!=null&&g.status?(e.openBlock(),e.createElementBlock("div",U1,[k[50]||(k[50]=e.createElementVNode("h5",null,"连接状态",-1)),e.createElementVNode("div",F1,[e.createElementVNode("div",z1,[k[47]||(k[47]=e.createElementVNode("span",null,"状态:",-1)),e.createElementVNode("span",{class:e.normalizeClass(["status-badge",n.value.status.connected?"connected":"disconnected"])},e.toDisplayString(n.value.status.connected?"已连接":"未连接"),3)]),n.value.status.lastUpdate?(e.openBlock(),e.createElementBlock("div",W1,[k[48]||(k[48]=e.createElementVNode("span",null,"最后更新:",-1)),e.createElementVNode("span",q1,e.toDisplayString(h(n.value.status.lastUpdate)),1)])):e.createCommentVNode("",!0),n.value.status.error?(e.openBlock(),e.createElementBlock("div",G1,[k[49]||(k[49]=e.createElementVNode("span",null,"错误:",-1)),e.createElementVNode("span",H1,e.toDisplayString(n.value.status.error),1)])):e.createCommentVNode("",!0)])])):e.createCommentVNode("",!0)])]))])])])])}}}),[["__scopeId","data-v-a49f0b56"]]),Y1=["onClick"],J1={key:0,class:"scada-menu-icon"},Q1={class:"scada-menu-text"},X1={key:1,class:"scada-menu-hotkey"},Z1=e.defineComponent({__name:"ContextMenu",props:{visible:{type:Boolean,default:!1},position:{default:()=>({x:0,y:0})},menuItems:{default:()=>[]}},emits:["update:visible","menu-click"],setup(d,{emit:t}){const r=d,n=t,i=e.ref(),s=e.computed(()=>({position:"fixed",left:r.position.x+"px",top:r.position.y+"px",zIndex:99999,background:"#1f1f1f",border:"1px solid #3c3c3c",borderRadius:"4px",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.5)",minWidth:"180px",padding:"6px 0",userSelect:"none",pointerEvents:"auto",margin:"0",boxSizing:"border-box",color:"#fff",fontSize:"13px"})),o=u=>u.divider?{height:"1px",margin:"4px 8px",padding:"0",backgroundColor:"#3c3c3c",border:"none"}:{display:"flex",alignItems:"center",padding:"6px 12px",fontSize:"13px",color:u.disabled?"#666666":"#fff",cursor:u.disabled?"not-allowed":"pointer",margin:"0",border:"none",lineHeight:"1.2",minHeight:"28px",backgroundColor:"transparent"},a=u=>{var p;u.disabled||u.divider||(n("menu-click",u.key),(p=u.onClick)==null||p.call(u),n("update:visible",!1))},l=u=>{i.value&&!i.value.contains(u.target)&&n("update:visible",!1)},c=()=>{};return e.watch(()=>r.visible,u=>{u?(setTimeout(c,0),setTimeout(()=>{document.addEventListener("click",l,!0),document.addEventListener("contextmenu",l,!0)},50)):(document.removeEventListener("click",l,!0),document.removeEventListener("contextmenu",l,!0))}),e.onUnmounted(()=>{document.removeEventListener("click",l,!0),document.removeEventListener("contextmenu",l,!0)}),(u,p)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[d.visible?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"menuRef",ref:i,class:"scada-context-menu",style:e.normalizeStyle(s.value),onClick:p[0]||(p[0]=e.withModifiers(()=>{},["stop"])),onContextmenu:p[1]||(p[1]=e.withModifiers(()=>{},["prevent"]))},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.menuItems,h=>(e.openBlock(),e.createElementBlock("div",{key:h.key,class:e.normalizeClass(["scada-context-menu-item",{disabled:h.disabled,divider:h.divider}]),style:e.normalizeStyle(o(h)),onClick:m=>a(h)},[h.divider?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[h.icon?(e.openBlock(),e.createElementBlock("span",J1,e.toDisplayString(h.icon),1)):e.createCommentVNode("",!0),e.createElementVNode("span",Q1,e.toDisplayString(h.label),1),h.hotkey?(e.openBlock(),e.createElementBlock("span",X1,e.toDisplayString(h.hotkey),1)):e.createCommentVNode("",!0)],64))],14,Y1))),128))],36)):e.createCommentVNode("",!0)]))}});class ev{constructor(){he(this,"graph",null)}setGraph(t){this.graph=t}getGraph(){return this.graph}zoomIn(){if(!this.graph)return;const t=$e.getConfig().zoom.scale,r=Math.min(5,t+.1);$e.setZoom(r)}zoomOut(){if(!this.graph)return;const t=$e.getConfig().zoom.scale,r=Math.max(.1,t-.1);$e.setZoom(r)}setZoom(t){if(!this.graph)return;const r=Math.max(.1,Math.min(5,t));$e.setZoom(r)}clearAll(t){this.graph&&confirm("确定要清空画布吗?")&&(this.graph.clearCells(),t==null||t(),Je("画布已清空","success"))}getSelectedNodes(){return this.graph?this.graph.getSelectedCells().filter(t=>t.isNode()):[]}validateSelection(t,r){const n=this.getSelectedNodes();return n.length<t?(Je(r,"warning"),null):n}alignLeft(){const t=this.validateSelection(2,"请选择至少两个节点");if(!t)return;const r=Math.min(...t.map(n=>n.getPosition().x));t.forEach(n=>{n.setPosition({x:r,y:n.getPosition().y})})}alignCenter(){const t=this.validateSelection(2,"请选择至少两个节点");if(!t)return;const r=t.map(i=>i.getPosition().x+i.getSize().width/2),n=r.reduce((i,s)=>i+s,0)/r.length;t.forEach(i=>{const s=n-i.getSize().width/2;i.setPosition({x:s,y:i.getPosition().y})})}alignRight(){const t=this.validateSelection(2,"请选择至少两个节点");if(!t)return;const r=Math.max(...t.map(n=>n.getPosition().x+n.getSize().width));t.forEach(n=>{const i=r-n.getSize().width;n.setPosition({x:i,y:n.getPosition().y})})}alignTop(){const t=this.validateSelection(2,"请选择至少两个节点");if(!t)return;const r=Math.min(...t.map(n=>n.getPosition().y));t.forEach(n=>{n.setPosition({x:n.getPosition().x,y:r})})}alignMiddle(){const t=this.validateSelection(2,"请选择至少两个节点");if(!t)return;const r=t.map(i=>i.getPosition().y+i.getSize().height/2),n=r.reduce((i,s)=>i+s,0)/r.length;t.forEach(i=>{const s=n-i.getSize().height/2;i.setPosition({x:i.getPosition().x,y:s})})}alignBottom(){const t=this.validateSelection(2,"请选择至少两个节点");if(!t)return;const r=Math.max(...t.map(n=>n.getPosition().y+n.getSize().height));t.forEach(n=>{const i=r-n.getSize().height;n.setPosition({x:n.getPosition().x,y:i})})}distributeHorizontal(){const t=this.validateSelection(3,"请选择至少三个节点");if(!t)return;const r=t.sort((a,l)=>a.getPosition().x-l.getPosition().x),n=r[0],o=(r[r.length-1].getPosition().x-n.getPosition().x)/(r.length-1);r.forEach((a,l)=>{if(l===0||l===r.length-1)return;const c=n.getPosition().x+o*l;a.setPosition({x:c,y:a.getPosition().y})})}distributeVertical(){const t=this.validateSelection(3,"请选择至少三个节点");if(!t)return;const r=t.sort((a,l)=>a.getPosition().y-l.getPosition().y),n=r[0],o=(r[r.length-1].getPosition().y-n.getPosition().y)/(r.length-1);r.forEach((a,l)=>{if(l===0||l===r.length-1)return;const c=n.getPosition().y+o*l;a.setPosition({x:a.getPosition().x,y:c})})}selectAll(){this.graph&&this.graph.select(this.graph.getNodes())}clearSelection(){this.graph&&this.graph.unselect(this.graph.getSelectedCells())}calculateFitScale(t,r){const n=$e.getConfig(),i=n.size.width,s=n.size.height,o=40,a=t-o,l=r-o,c=a/i,u=l/s;return Math.min(c,u,1)}}const bt=new ev;class tv{constructor(){he(this,"animations",new Map)}startAnimation(t,r){if(!t||r.type==="none")return;this.stopAnimation(t.id);const n=t.id;let i=null;switch(r.type){case"blink":i=this.createBlinkAnimation(t,r);break;case"scale":i=this.createScaleAnimation(t,r);break;case"rotate":i=this.createRotateAnimation(t,r);break;case"float":i=this.createFloatAnimation(t,r);break;case"pulse":i=this.createPulseAnimation(t,r);break}i&&this.animations.set(n,i)}stopAnimation(t){const r=this.animations.get(t);r&&(r.stop&&r.stop(),r.intervalId&&clearInterval(r.intervalId),this.animations.delete(t))}createBlinkAnimation(t,r){const n=t.getAttrByPath("body/opacity")||1;let i=!0;const s=setInterval(()=>{i=!i,t.setAttrByPath("body/opacity",i?n:.2),r.loop||(clearInterval(s),t.setAttrByPath("body/opacity",n))},r.duration/2);return{intervalId:s,stop:()=>{clearInterval(s),t.setAttrByPath("body/opacity",n)}}}createScaleAnimation(t,r){const n=t.getSize();let i=!0;const s=.05;let o=1;const a=setInterval(()=>{i?(o+=s,o>=1.2&&(i=!1)):(o-=s,o<=.8&&(i=!0)),t.resize(n.width*o,n.height*o),!r.loop&&o>=.99&&o<=1.01&&(clearInterval(a),t.resize(n.width,n.height))},r.duration/20);return{intervalId:a,stop:()=>{clearInterval(a),t.resize(n.width,n.height)}}}createRotateAnimation(t,r){let n=0;const i=360/(r.duration/50),s=setInterval(()=>{n=(n+i)%360,t.rotate(n,{absolute:!0}),!r.loop&&n>=360&&(clearInterval(s),t.rotate(0,{absolute:!0}))},50);return{intervalId:s,stop:()=>{clearInterval(s),t.rotate(0,{absolute:!0})}}}createFloatAnimation(t,r){const n=t.position();let i=!0;const s=2;let o=n.y;const a=setInterval(()=>{i?(o-=s,o<=n.y-10&&(i=!1)):(o+=s,o>=n.y+10&&(i=!0)),t.position(n.x,o),!r.loop&&Math.abs(o-n.y)<1&&(clearInterval(a),t.position(n.x,n.y))},r.duration/40);return{intervalId:a,stop:()=>{clearInterval(a),t.position(n.x,n.y)}}}createPulseAnimation(t,r){const n=t.getAttrByPath("body/fill"),i=t.getAttrByPath("body/stroke");let s=0,o=!0;const a=setInterval(()=>{o?(s+=.1,s>=1&&(o=!1)):(s-=.1,s<=0&&(o=!0)),t.setAttrByPath("body/opacity",.5+s*.5),!r.loop&&s<=.05&&(clearInterval(a),t.setAttrByPath("body/fill",n),t.setAttrByPath("body/stroke",i),t.setAttrByPath("body/opacity",1))},r.duration/20);return{intervalId:a,stop:()=>{clearInterval(a),t.setAttrByPath("body/fill",n),t.setAttrByPath("body/stroke",i),t.setAttrByPath("body/opacity",1)}}}clearAll(){this.animations.forEach((t,r)=>{this.stopAnimation(r)}),this.animations.clear()}}const Wt=new tv;class rv{constructor(){he(this,"graph",null);he(this,"componentCounters",{})}setGraph(t){this.graph=t}generateComponentName(t,r){return this.componentCounters[t]||(this.componentCounters[t]=0),this.componentCounters[t]++,`${r}_${this.componentCounters[t]}`}async addNode(t,r){var c,u,p,h;if(!this.graph)return null;const n=await at.getComponent(t);if(!n)return console.error(`未找到组件配置: ${t}`),null;const i=this.generateComponentName(t,n.metadata.name),s={enabled:!1,type:"none",duration:1e3,loop:!0},o=r||Xl(50,50,400,300),a={x:o.x,y:o.y,shape:n.shape,width:n.width,height:n.height,label:n.label,attrs:n.attrs,ports:n.ports,data:{...n.data,componentType:t,componentName:i,props:n.props,animation:s,originalStroke:((u=(c=n.attrs)==null?void 0:c.body)==null?void 0:u.stroke)||"#2563eb",originalStrokeWidth:((h=(p=n.attrs)==null?void 0:p.body)==null?void 0:h.strokeWidth)||2}},l=this.graph.addNode(a);return console.log("[Node] 添加节点:",n.shape,l.id,a),l}updateNode(t,r){if(t&&(r.attrs&&Object.keys(r.attrs).forEach(n=>{const i=r.attrs[n];typeof i=="object"?Object.keys(i).forEach(s=>{t.attr(`${n}/${s}`,i[s])}):t.attr(n,i)}),r.position&&(typeof r.position.x=="number"&&typeof r.position.y=="number"?t.setPosition(r.position):console.error("position 数据格式错误:",r.position)),r.size&&(typeof r.size.width=="number"&&typeof r.size.height=="number"?t.setSize(r.size):console.error("size 数据格式错误:",r.size)),r.data)){const n={...r.data};delete n.position,delete n.size,t.setData(n)}}deleteNode(t){if(!this.graph)return!1;Wt.stopAnimation(t);try{return this.graph.removeNode(t),!0}catch(r){return console.error("删除节点失败:",r),!1}}selectNode(t){if(!this.graph)return!1;const r=this.graph.getCellById(t);return r?(this.graph.select(r),!0):!1}getNodeById(t){if(!this.graph)return null;const r=this.graph.getCellById(t);return!r||!r.isNode()?null:r}getAllNodes(){return this.graph?this.graph.getNodes().map(t=>({id:t.id,type:t.shape,position:t.getPosition(),size:t.getSize(),label:t.attr("label/text"),data:t.getData()})):[]}cloneNode(t,r={x:20,y:20}){if(!this.graph)return null;try{const n=t.clone();return n.translate(r.x,r.y),this.graph.addNode(n),n}catch(n){return console.error("复制节点失败:",n),null}}deleteNodes(t){if(!this.graph)return 0;let r=0;return t.forEach(n=>{this.deleteNode(n)&&r++}),r}bringToFront(t){const r=this.getNodeById(t);r&&r.toFront()}sendToBack(t){const r=this.getNodeById(t);r&&r.toBack()}}const br=new rv;class nv{constructor(){he(this,"graph",null)}setGraph(t){this.graph=t}applyEdgeAnimation(t,r){Zl(t,r)}updateEdge(t,r){if(t){if(r.shape&&r.shape!==t.shape){if(!this.graph)return;const n=t.getSourceCell(),i=t.getTargetCell(),s=t.getSourcePortId(),o=t.getTargetPortId(),a=t.getData(),l=t.getRouter(),c=t.getConnector();if(!n||!i)return;this.graph.removeEdge(t.id);const u=this.graph.addEdge({shape:r.shape,source:{cell:n.id,port:s},target:{cell:i.id,port:o},attrs:r.attrs||{},data:r.data||a,router:l,connector:c,zIndex:0});this.graph.select(u),(r.animation||a!=null&&a.animation)&&this.applyEdgeAnimation(u,r.animation||a.animation);return}if(r.attrs){t.getAttrs(),Object.keys(r.attrs).forEach(s=>{const o=r.attrs[s];typeof o=="object"?Object.keys(o).forEach(a=>{t.attr(`${s}/${a}`,o[a])}):t.attr(s,o)});const n=t.getAttrs(),i=Object.assign({},t.data,{originalAttrs:n});t.setData(i)}r.router&&t.setRouter(r.router),r.connector&&t.setConnector(r.connector),r.animation&&this.applyEdgeAnimation(t,r.animation),r.data&&t.setData(Object.assign({},t.data,r.data))}}deleteEdge(t){if(!this.graph)return!1;try{return this.graph.removeEdge(t),!0}catch(r){return console.error("删除边失败:",r),!1}}getEdgeById(t){if(!this.graph)return null;const r=this.graph.getCellById(t);return!r||!r.isEdge()?null:r}getAllEdges(){return this.graph?this.graph.getEdges().map(t=>({id:t.id,source:t.getSourceCellId(),target:t.getTargetCellId(),data:t.getData()})):[]}applySelectedStyle(t){if(!t)return;const r=t.getAttrs();t.data={...t.data,originalAttrs:r},t.attr("line/stroke","#3b82f6")}restoreOriginalStyle(t){var n,i;if(!t||!((n=t.data)!=null&&n.originalAttrs))return;const r=t.data.originalAttrs;t.attr("line/stroke",((i=r.line)==null?void 0:i.stroke)||"#10b981")}restoreAllEdgeAnimations(){this.graph&&this.graph.getEdges().forEach(t=>{var n;const r=t.getData();(n=r==null?void 0:r.animation)!=null&&n.enabled&&this.applyEdgeAnimation(t,r.animation)})}}const Tr=new nv;class ov{constructor(){he(this,"graph",null)}setGraph(t){this.graph=t}saveToLocal(){if(!this.graph)return!1;try{const t={cells:this.graph.toJSON().cells,dataSources:He.getAllDataSources().map(r=>({id:r.id,name:r.name,type:r.type,enabled:r.enabled,config:r.config}))};return yr(yt.SCADA_EDITOR_DATA,t),!0}catch(t){return console.error("保存画布数据失败:",t),!1}}loadFromLocal(t){var r;if(!this.graph)return!1;try{const n=Xi(yt.SCADA_EDITOR_DATA);if(!((r=n==null?void 0:n.cells)!=null&&r.length))return!1;const i=this.cleanCellsData(n.cells);return this.graph.fromJSON({cells:i}),t&&this.graph.getEdges().forEach(s=>{var a;const o=s.getData();(a=o==null?void 0:o.animation)!=null&&a.enabled&&t(s)}),!0}catch(n){return console.error("恢复画布数据失败,清空缓存:",n),vn(yt.SCADA_EDITOR_DATA),!1}}cleanCellsData(t){return t.map(r=>{var n;return r.position&&typeof r.position=="object"&&(typeof r.position.x!="number"||typeof r.position.y!="number")&&(r.position={x:100,y:100}),(r.shape==="edge"||r.shape==="animated-edge")&&(r.router==="manhattan"||((n=r.router)==null?void 0:n.name)==="manhattan")&&(r.router={name:"orth",args:{padding:10}}),r})}exportData(){if(!this.graph)return null;try{const t={version:"1.0.0",timestamp:mr(gr()),config:{size:$e.getConfig().size,background:$e.getConfig().background,grid:$e.getConfig().grid,guides:$e.getConfig().guides,magnetism:$e.getConfig().magnetism,zoom:$e.getConfig().zoom},cells:this.graph.toJSON().cells,nodes:this.graph.getNodes().map(r=>({id:r.id,type:r.shape,position:r.getPosition(),size:r.getSize(),label:r.attr("label/text"),data:r.getData()})),edges:this.graph.getEdges().map(r=>({id:r.id,source:r.getSourceCellId(),target:r.getTargetCellId()})),dataSources:He.getAllDataSources().map(r=>({id:r.id,name:r.name,type:r.type,enabled:r.enabled,config:r.config})),workflows:[]};return t.workflows=this.collectReferencedWorkflows(),t}catch(t){return console.error("导出数据失败:",t),null}}collectReferencedWorkflows(){if(!this.graph)return[];const t=new Set;if(this.graph.getNodes().forEach(r=>{const n=r.getData();n!=null&&n.events&&Array.isArray(n.events)&&n.events.forEach(i=>{var s;i.action==="callProcess"&&((s=i.params)!=null&&s.processId)&&t.add(i.params.processId)})}),t.size===0)return[];try{const r=localStorage.getItem("saved-workflows");if(r)return JSON.parse(r).filter(i=>t.has(i.id))}catch(r){console.error("加载流程数据失败:",r)}return[]}importData(t,r){if(!this.graph)return!1;try{if(!t.cells)return Je("无效的JSON文件格式","error"),!1;if(!confirm("导入将清空当前画布,是否继续?"))return!1;this.graph.clearCells(),this.graph.fromJSON({cells:t.cells}),r&&this.graph.getEdges().forEach(i=>{var o;const s=i.getData();(o=s==null?void 0:s.animation)!=null&&o.enabled&&r(i)}),t.config&&$e.updateConfig(t.config),this.importDataSources(t.dataSources);const n=this.importWorkflows(t.workflows);return n.imported>0||n.updated>0?Je(`导入成功 画布已加载,流程: 新增${n.imported}个,更新${n.updated}个`,"success"):Je("导入成功","success"),!0}catch(n){return console.error("导入失败",n),Je("导入失败,JSON格式错误","error"),!1}}importDataSources(t){!t||!Array.isArray(t)||(He.disconnectAll(),He.getAllDataSources().forEach(r=>{He.removeDataSource(r.id)}),t.forEach(r=>{const n={id:r.id,name:r.name,type:r.type,enabled:r.enabled,config:r.config,devices:[],status:{connected:!1}};He.addDataSource(n)}),console.log(`[CanvasDataHandler] 已导入 ${t.length} 个数据源`))}importWorkflows(t){if(!t||!Array.isArray(t)||t.length===0)return{imported:0,updated:0};try{const r=localStorage.getItem("saved-workflows"),n=r?JSON.parse(r):[];let i=0,s=0;return t.forEach(o=>{const a=n.findIndex(l=>l.id===o.id);a>=0?(n[a]={...o,updatedAt:Date.now()},s++):(n.push(o),i++)}),localStorage.setItem("saved-workflows",JSON.stringify(n)),{imported:i,updated:s}}catch(r){return console.error("导入流程数据失败:",r),Je("画布导入成功, 但流程数据导入失败","warning"),{imported:0,updated:0}}}exportToFile(t){const r=this.exportData();if(!r)return null;try{const n=new Blob([JSON.stringify(r,null,2)],{type:"application/json"}),i=URL.createObjectURL(n),s=document.createElement("a"),o=t||`scada-export-${Date.now()}.json`;return s.href=i,s.download=o,s.click(),URL.revokeObjectURL(i),o}catch(n){return console.error("导出文件失败:",n),null}}clearCache(){vn(yt.SCADA_EDITOR_DATA)}getCanvasData(){return this.graph?{version:"1.0.0",timestamp:mr(gr()),config:$e.getConfig(),cells:this.graph.toJSON().cells,nodes:this.graph.getNodes().map(t=>({id:t.id,type:t.shape,position:t.getPosition(),size:t.getSize(),label:t.attr("label/text"),data:t.getData()})),edges:this.graph.getEdges().map(t=>({id:t.id,source:t.getSourceCellId(),target:t.getTargetCellId()}))}:null}}const mt=new ov;class iv{constructor(){he(this,"graph",null);he(this,"dataCallbackRegistered",!1);he(this,"updateQueue",new Map);he(this,"flushTimer",null);he(this,"FLUSH_DELAY",16)}setGraph(t){this.graph=t,t&&!this.dataCallbackRegistered&&this.initDataBinding()}initDataBinding(){this.dataCallbackRegistered||(He.onData((t,r)=>{this.handleDataUpdate(t,r)}),this.dataCallbackRegistered=!0)}handleDataUpdate(t,r){if(!this.graph){console.warn("[DataBindingService] Graph 未初始化");return}this.graph.getNodes().forEach(i=>{this.updateNodeData(i,t,r)}),this.scheduleFlush()}updateNodeData(t,r,n){const i=t.getData();if(!(i!=null&&i.dataBinding)||i.dataBinding.dataSourceId!==r||!i.bindings||!Array.isArray(i.bindings)||i.bindings.length===0)return!1;let s=!1;const o={};return i.bindings.forEach(a=>{if(!(!a.enabled&&a.enabled!==void 0)&&!(!a.devicePointId||!a.targetProperty))try{const l=this.extractPointValue(n,a.devicePointId);if(l==null)return;const c=this.applyValueMapping(l,a.mapping);o[a.targetProperty]=c,s=!0}catch(l){console.error("[DataBindingService] 绑定处理错误:",l,a)}}),s?(this.queueUpdates(t.id,o),!0):!1}queueUpdates(t,r){const n=this.updateQueue.get(t)||{};this.updateQueue.set(t,{...n,...r})}scheduleFlush(){this.flushTimer||(this.flushTimer=window.setTimeout(()=>{this.flush(),this.flushTimer=null},this.FLUSH_DELAY))}flush(){this.updateQueue.size!==0&&requestAnimationFrame(()=>{const t=performance.now();this.updateQueue.forEach((n,i)=>{if(!this.graph)return;const s=this.graph.getCellById(i);s&&s.isNode()&&this.applyUpdatesToNode(s,n)});const r=performance.now()-t;r>16&&console.warn(`[DataBindingService] 批量更新耗时 ${r.toFixed(2)}ms, 超过一帧时间`),this.updateQueue.clear()})}extractPointValue(t,r){if(!(!r||!t)){if(Array.isArray(t)){const n=t.find(i=>i.id===r);if(n&&n.value!==void 0)return n.value}if(t[r]!==void 0)return t[r];if(t.devices&&Array.isArray(t.devices)){for(const n of t.devices)if(n.points&&Array.isArray(n.points)){for(const i of n.points)if(i.id===r)return i.value}}}}applyValueMapping(t,r){if(!r||r.type===gt.DIRECT)return t;try{switch(r.type){case gt.BOOLEAN:return this.applyBooleanMapping(t,r);case gt.RANGE:return this.applyRangeMapping(t,r);case gt.ENUM:return this.applyEnumMapping(t,r);default:return console.warn(`[DataBindingService] 未知的映射类型: ${r.type}`),t}}catch(n){return console.error("[DataBindingService] 值映射错误:",n,{value:t,mapping:r}),t}}applyBooleanMapping(t,r){return!!t?r.trueValue:r.falseValue}applyRangeMapping(t,r){const n=Number(t);if(isNaN(n))return t;if(r.rangeRules&&Array.isArray(r.rangeRules))for(const i of r.rangeRules){const s=i.min!==void 0?Number(i.min):-1/0,o=i.max!==void 0?Number(i.max):1/0;if(n>=s&&n<=o)return i.value}return t}applyEnumMapping(t,r){if(!r.enumMappings)return t;const n=String(t);return r.enumMappings[n]!==void 0?r.enumMappings[n]:t}applyUpdatesToNode(t,r){const n=t.getData(),i={...n,...r};t.setData(i,{overwrite:!0}),t.trigger("change:data",{current:i,previous:n})}getNodeBindings(t){if(!this.graph)return[];const r=this.graph.getCellById(t);if(!r||!r.isNode())return[];const n=r.getData();return(n==null?void 0:n.bindings)||[]}updateNodeBindings(t,r){if(!this.graph)return!1;const n=this.graph.getCellById(t);if(!n||!n.isNode())return!1;const i=n.getData();return n.setData({...i,bindings:r}),console.log(`[DataBindingService] 更新节点 ${t} 的绑定配置:`,r),!0}destroy(){this.flushTimer&&(clearTimeout(this.flushTimer),this.flushTimer=null),this.updateQueue.clear(),this.graph=null,this.dataCallbackRegistered=!1,console.log("[DataBindingService] 服务已销毁")}}const sv=new iv;class av{getNodeMenuItems(){return[{key:"delete",label:"删除",icon:"❌",hotkey:"Delete"},{key:"copy",label:"复制",icon:"📋",hotkey:"Ctrl+C"},{key:"divider1",divider:!0},{key:"to-front",label:"置于顶层",icon:"⬆️"},{key:"to-back",label:"置于底层",icon:"⬇️"}]}getEdgeMenuItems(){return[{key:"delete",label:"删除",icon:"❌",hotkey:"Delete"},{key:"divider1",divider:!0},{key:"to-front",label:"置于顶层",icon:"⬆️"},{key:"to-back",label:"置于底层",icon:"⬇️"}]}getCanvasMenuItems(){return[{key:"paste",label:"粘贴",icon:"📋",hotkey:"Ctrl+V",disabled:!0},{key:"divider1",divider:!0},{key:"select-all",label:"全选",icon:"✅",hotkey:"Ctrl+A"},{key:"clear-all",label:"清空画布",icon:"🗑️"}]}getMenuItems(t){switch(t){case"node":return this.getNodeMenuItems();case"edge":return this.getEdgeMenuItems();case"canvas":return this.getCanvasMenuItems();default:return[]}}}const ns=new av;class lv{constructor(){he(this,"graph",null);he(this,"config",null);he(this,"keydownHandler",null)}initialize(t,r){this.graph=t,this.config=r,this.registerSelectionEvents(),this.registerClickEvents(),this.registerChangeEvents(),this.registerContextMenuEvents(),this.registerKeyboardEvents()}registerSelectionEvents(){if(!this.graph||!this.config)return;const{selectedNode:t,selectedEdge:r,selectedNodesCount:n}=this.config;this.graph.on("selection:changed",({selected:i})=>{const s=i?i.filter(o=>o.isNode()):[];if(n.value=s.length,i&&i.length>0){const o=i[0];if(o.isNode())t.value=o,r.value=null;else if(o.isEdge()){r.value=o,t.value=null;const a=o.getAttrs();requestAnimationFrame(()=>{o.shape==="pipeline-edge"?(a.shadow&&(o.attr("shadow/stroke",a.shadow.stroke),o.attr("shadow/strokeWidth",a.shadow.strokeWidth)),a.line&&(o.attr("line/stroke",a.line.stroke),o.attr("line/strokeWidth",a.line.strokeWidth)),a.highlight&&(o.attr("highlight/stroke",a.highlight.stroke),o.attr("highlight/strokeWidth",a.highlight.strokeWidth))):a.line&&(o.attr("line/stroke",a.line.stroke),o.attr("line/strokeWidth",a.line.strokeWidth)),o.attr("wrap/stroke","rgba(0,0,0,0)")})}}else r.value,t.value=null,r.value=null})}registerClickEvents(){if(!this.graph||!this.config)return;const{selectedNode:t,selectedEdge:r}=this.config;this.graph.on("blank:click",()=>{r.value=null,t.value=null})}registerChangeEvents(){!this.graph||!this.config||(this.graph.on("edge:connected",({isNew:t})=>{t&&this.graph&&setTimeout(()=>{mt.saveToLocal()},100)}),this.graph.on("node:change:position",()=>{}),this.graph.on("node:moved",()=>{mt.saveToLocal()}),this.graph.on("node:change:size",()=>{}),this.graph.on("node:change:data",({node:t})=>{const r=t.getData();if(r.animation)if(r.animation.enabled===!0){const n={type:r.animation.type||"none",duration:r.animation.duration||1e3,loop:r.animation.loop!==!1};Wt.startAnimation(t,n)}else Wt.stopAnimation(t.id)}),this.graph.on("edge:change:data",({edge:t})=>{var n;const r=t.getData();r!=null&&r.animation&&((n=this.config)!=null&&n.applyEdgeAnimation)&&this.config.applyEdgeAnimation(t,r.animation)}))}registerContextMenuEvents(){if(!this.graph||!this.config)return;const{contextMenu:t}=this.config;this.graph.on("cell:contextmenu",({e:r,cell:n})=>{r.preventDefault(),t.value.targetCell=n,t.value.position={x:r.clientX,y:r.clientY},n.isNode()?t.value.items=ns.getNodeMenuItems():n.isEdge()&&(t.value.items=ns.getEdgeMenuItems()),t.value.visible=!0}),this.graph.on("blank:contextmenu",({e:r})=>{r.preventDefault(),t.value.targetCell=null,t.value.position={x:r.clientX,y:r.clientY},t.value.items=ns.getCanvasMenuItems(),t.value.visible=!0})}registerKeyboardEvents(){if(!this.graph||!this.config)return;const{selectedNode:t,selectedEdge:r}=this.config,n=this.graph;this.keydownHandler=i=>{if(i.key==="Delete"&&n){if(t.value){const s=t.value.id;Wt.stopAnimation(s),n.removeNode(s),t.value=null,mt.saveToLocal()}else if(r.value){const s=r.value.id;n.removeEdge(s),r.value=null,mt.saveToLocal()}}},document.addEventListener("keydown",this.keydownHandler)}destroy(){this.keydownHandler&&(document.removeEventListener("keydown",this.keydownHandler),this.keydownHandler=null),this.graph=null,this.config=null}}const nc=new lv;class cv{constructor(){he(this,"graph",null);he(this,"containerRef",null);he(this,"calculateFitScale",null);he(this,"updateContainerSizeFn",null);he(this,"snaplinePlugin",null)}initialize(t,r,n,i){this.graph=t,this.containerRef=r,this.calculateFitScale=n,this.updateContainerSizeFn=i||null,this.initializeSnapline()}initializeSnapline(){if(!this.graph)return;$e.getConfig().guides.enabled&&(this.snaplinePlugin=new Dr.Snapline({enabled:!0,sharp:!0,clean:!0}),this.graph.use(this.snaplinePlugin))}applyConfigChanges(){if(!this.graph)return;const t=$e.getConfig();this.updateBackground(t.background),this.updateSizeAndScale(t.size,t.zoom.scale),this.updateGrid(t.grid),this.updateGuides(t.guides),this.graph.translate(t.offset.x,t.offset.y)}updateBackground(t){this.graph&&(t.image?this.graph.drawBackground({color:t.color||"#1e293b",image:t.image,size:t.size||"cover",repeat:t.repeat||"no-repeat",position:"center"}):this.graph.drawBackground({color:t.color||"#1e293b"}))}updateSizeAndScale(t,r){var i;if(!this.graph||!this.containerRef)return;const n=(i=this.containerRef.value)==null?void 0:i.containerRef;if(n){if(this.graph.resize(t.width,t.height),this.updateContainerSizeFn)this.updateContainerSizeFn();else if(n.style.width=`${t.width}px`,n.style.height=`${t.height}px`,this.calculateFitScale){const s=this.calculateFitScale(),o=r>s?r:s;this.graph.scale(o,o),this.graph.centerContent()}}}updateGrid(t){this.graph&&(t.enabled?(this.graph.drawGrid({type:t.type||"dot",args:{color:t.color||"#475569",thickness:1}}),this.graph.showGrid(),t.size&&this.graph.setGridSize(t.size)):this.graph.hideGrid())}updateGuides(t){this.graph&&(t.enabled?this.snaplinePlugin?this.snaplinePlugin.enable():(this.snaplinePlugin=new Dr.Snapline({enabled:!0,sharp:!0,clean:!0}),this.graph.use(this.snaplinePlugin)):this.snaplinePlugin&&this.snaplinePlugin.disable())}destroy(){this.graph=null,this.containerRef=null,this.calculateFitScale=null,this.updateContainerSizeFn=null,this.snaplinePlugin=null}}const oc=new cv,dv={class:"scada-layout","data-scada-theme":"dark"},uv={class:"scada-canvas-container"},ic=Le(e.defineComponent({name:"ScadaCanvas",inheritAttrs:!0,__name:"ScadaCanvas",props:{authCode:{default:""},customFooter:{default:void 0},previewMode:{type:Boolean,default:!1},onSave:{type:Function,default:void 0},deviceData:{default:()=>({})},dataSource:{default:()=>({})}},emits:["preview"],setup(d,{expose:t,emit:r}){const n=d,i=r,s=e.ref(null),o=e.ref(null),a=e.ref(null),l=e.ref(0),c=e.ref(null),u=e.ref(!1),p=e.ref(!1),h=e.ref(!1),m=e.ref(!1);let f=null;const E=e.ref({visible:!1,position:{x:0,y:0},items:[],targetCell:null}),N=e.ref([]),k=e.computed(()=>n.deviceData&&Object.keys(n.deviceData).length>0?n.deviceData:{devices:He.getAllDevices().map(V=>({...V.device,_dataSourceId:V.dataSourceId,_dataSourceName:V.dataSourceName}))}),g=()=>{var b,w;const z=(w=(b=s.value)==null?void 0:b.containerRef)==null?void 0:w.parentElement;if(!z)return 1;const V=$e.getConfig(),F=V.size.width,ae=V.size.height,fe=z.clientWidth,pe=z.clientHeight,ye=40,J=fe-ye,ge=pe-ye,ke=F/ae,de=J/ge;let Ce;return ke>de?Ce=J/F:Ce=ge/ae,Math.min(Ce,1)},v=()=>{var b;if(!((b=s.value)!=null&&b.containerRef))return null;const z=$e.getConfig(),V=z.size.width,F=z.size.height,ae=V/F,fe=s.value.containerRef.parentElement;if(!fe)return null;const pe=fe.clientWidth,ye=fe.clientHeight,J=40,ge=pe-J,ke=ye-J,de=ge/ke;let Ce,y;return ae>de?(Ce=ge,y=ge/ae):(y=ke,Ce=ke*ae),Ce=Math.min(Ce,V),y=Math.min(y,F),{width:Ce,height:y,canvasWidth:V,canvasHeight:F}},_=()=>{var pe;if(!f||!((pe=s.value)!=null&&pe.containerRef))return;const z=s.value.containerRef,V=v();if(!V)return;const{width:F,height:ae,canvasWidth:fe}=V;if(z.style.width=`${F}px`,z.style.height=`${ae}px`,f){const ye=F/fe;f.scale(ye,ye),f.centerContent(),$e.updateByPath("zoom.scale",Number(ye.toFixed(2)))}};e.onMounted(async()=>{var J,ge;if(!((J=s.value)!=null&&J.containerRef))return;const z=$e.getConfig(),V=()=>{const ke=window.innerWidth;ke<1024?(h.value=!0,m.value=!0):ke<1440&&(h.value=!0,m.value=!1)};V(),window.addEventListener("resize",V),Ae.Graph.registerEdge("animated-edge",{inherit:"edge",markup:[{tagName:"path",selector:"line",attrs:{fill:"none"}},{tagName:"path",selector:"wrap",attrs:{fill:"none",stroke:"rgba(0,0,0,0)",strokeWidth:20}},{tagName:"circle",selector:"circle"}],attrs:{line:{connection:!0,stroke:"#10b981",strokeWidth:2,targetMarker:{name:"block",width:8,height:6}},wrap:{connection:!0,strokeLinecap:"round",strokeLinejoin:"round"}}},!0),Ae.Graph.registerEdge("pipeline-edge",{inherit:"edge",markup:[{tagName:"path",selector:"shadow",attrs:{fill:"none"}},{tagName:"path",selector:"line",attrs:{fill:"none"}},{tagName:"path",selector:"highlight",attrs:{fill:"none"}},{tagName:"path",selector:"wrap",attrs:{fill:"none",stroke:"rgba(0,0,0,0)",strokeWidth:20}},{tagName:"circle",selector:"circle"}],attrs:{shadow:{connection:!0,stroke:"#1e293b",strokeWidth:10,strokeLinecap:"butt",strokeLinejoin:"miter"},line:{connection:!0,stroke:"#475569",strokeWidth:8,strokeLinecap:"butt",strokeLinejoin:"miter",targetMarker:{name:"block",width:10,height:8,fill:"#475569"}},highlight:{connection:!0,stroke:"#94a3b8",strokeWidth:3,strokeLinecap:"butt",strokeLinejoin:"miter",strokeDasharray:"0",strokeDashoffset:0},wrap:{connection:!0,strokeLinecap:"butt",strokeLinejoin:"miter"}}},!0);const F=at.getAllComponents();Object.values(F).forEach(ke=>{ke.component&&An({shape:ke.shape,width:ke.width,height:ke.height,component:ke.component,ports:ke.ports})});const ae=s.value.containerRef,fe=z.size.width,pe=z.size.height;g();const ye=()=>{_()};if(window.addEventListener("resize",ye),f=new Ae.Graph({container:ae,width:fe,height:pe,background:z.background.image?{color:z.background.color||"#1e293b",image:z.background.image,size:z.background.size||"cover",repeat:z.background.repeat||"no-repeat",position:"center"}:{color:z.background.color||"#1e293b"},grid:z.grid.enabled?{size:z.grid.size,visible:!0,type:z.grid.type||"dot",args:{color:z.grid.color||"#475569",thickness:1}}:!1,interacting:{nodeMovable:!n.previewMode},panning:{enabled:!0,modifiers:"shift"},mousewheel:{enabled:!0,modifiers:["ctrl","meta"]},connecting:{router:{name:"orth",args:{padding:10}},connector:{name:"rounded",args:{radius:8}},snap:z.magnetism.enabled?{radius:z.magnetism.threshold||10}:!1,allowBlank:!1,allowLoop:!1,allowNode:!1,allowEdge:!1,highlight:!0,createEdge(){return f.createEdge({shape:"animated-edge",zIndex:0})},validateConnection({targetMagnet:ke}){return!!ke}}}),n.previewMode||(f.use(new Qt.Selection({enabled:!0,movable:!0,rubberband:!0,showNodeSelectionBox:!1,showEdgeSelectionBox:!1,multiple:!0,pointerEvents:"none"})),f.use(new Xt({resizing:{enabled:!0,preserveAspectRatio:!0,orthogonal:!1,restrict:!1},rotating:{enabled:!0,grid:15}}))),Promise.resolve().then(()=>{setTimeout(()=>{_()},100)}),bt.setGraph(f),br.setGraph(f),Tr.setGraph(f),mt.setGraph(f),sv.setGraph(f),oc.initialize(f,s,g,()=>{_()}),await at.preloadAllComponents(),!n.previewMode){const ke=Xi(yt.SCADA_EDITOR_DATA);if(((ge=ke==null?void 0:ke.cells)==null?void 0:ge.length)>0)try{const de=ke.cells.map(Ce=>{var y;return Ce.position&&typeof Ce.position=="object"&&(typeof Ce.position.x!="number"||typeof Ce.position.y!="number")&&(Ce.position={x:100,y:100}),(Ce.shape==="edge"||Ce.shape==="animated-edge")&&(Ce.router==="manhattan"||((y=Ce.router)==null?void 0:y.name)==="manhattan")&&(Ce.router={name:"orth",args:{padding:10}}),Ce});f.fromJSON({cells:de}),f.getEdges().forEach(Ce=>{var b;const y=Ce.getData();(b=y==null?void 0:y.animation)!=null&&b.enabled&&O(Ce,y.animation)})}catch(de){console.error("恢复画布数据失败,清空缓存:",de),vn(yt.SCADA_EDITOR_DATA)}try{const de=localStorage.getItem("scada-data-sources");if(de){const Ce=JSON.parse(de);Array.isArray(Ce)&&Ce.length>0&&(Ce.forEach(y=>{const b={id:y.id,name:y.name,type:y.type,enabled:y.enabled!==!1,config:y.config,devices:[],status:{connected:!1}};He.addDataSource(b)}),N.value=He.getAllDataSources())}}catch(de){console.error("[恢复数据源失败:",de)}}nc.initialize(f,{selectedNode:o,selectedEdge:a,selectedNodesCount:l,contextMenu:E,applyEdgeAnimation:O}),e.onUnmounted(()=>{nc.destroy(),window.removeEventListener("resize",ye),window.removeEventListener("resize",V)})}),e.onUnmounted(()=>{if(He.disconnectAll(),f){Wt.clearAll();const z={cells:f.toJSON().cells,dataSources:He.getAllDataSources().map(V=>({id:V.id,name:V.name,type:V.type,enabled:V.enabled,config:V.config}))};yr(yt.SCADA_EDITOR_DATA,z),f.dispose()}}),e.watch(()=>$e.getConfig(),()=>oc.applyConfigChanges(),{deep:!0}),e.watch([h,m],()=>{setTimeout(()=>{f&&_()},350)});const S=async z=>{const V=await br.addNode(z);V&&f&&(f.cleanSelection(),f.select(V),yr(yt.SCADA_EDITOR_DATA,f.toJSON()))},B=z=>{o.value&&(br.updateNode(o.value,z),f&&yr(yt.SCADA_EDITOR_DATA,f.toJSON()))},P=()=>{if(!o.value||!f)return;const z=o.value.id;br.deleteNode(z),o.value=null,yr(yt.SCADA_EDITOR_DATA,f.toJSON())},T=z=>{a.value&&Tr.updateEdge(a.value,z)},A=()=>{a.value&&(Tr.deleteEdge(a.value.id),a.value=null)},C=z=>{var F,ae;if(!f)return;const V=E.value.targetCell;switch(z){case"delete":V&&(V.isNode()?(br.deleteNode(V.id),((F=o.value)==null?void 0:F.id)===V.id&&(o.value=null)):V.isEdge()&&(Tr.deleteEdge(V.id),((ae=a.value)==null?void 0:ae.id)===V.id&&(a.value=null)),mt.saveToLocal());break;case"copy":if(V!=null&&V.isNode()){const fe=br.cloneNode(V);fe&&f&&(f.cleanSelection(),f.select(fe),mt.saveToLocal())}break;case"to-front":V&&(V.toFront(),mt.saveToLocal());break;case"to-back":V&&(V.toBack(),mt.saveToLocal());break;case"select-all":f.select(f.getNodes());break;case"clear-all":I();break}},O=(z,V)=>{Tr.applyEdgeAnimation(z,V)},I=()=>{f&&confirm("确定要清空画布吗?")&&(Wt.clearAll(),f.clearCells(),o.value=null,mt.clearCache(),Je("画布已清空","success"))},U=()=>bt.zoomIn(),Y=()=>bt.zoomOut(),j=()=>bt.alignLeft(),le=()=>bt.alignCenter(),ne=()=>bt.alignRight(),te=()=>bt.alignTop(),ue=()=>bt.alignMiddle(),$=()=>bt.alignBottom(),se=()=>bt.distributeHorizontal(),M=()=>bt.distributeVertical(),Q=async()=>{if(!f){Je("画布未初始化","error");return}try{const z={version:"1.0.0",timestamp:mr(gr()),config:$e.getConfig(),cells:f.toJSON().cells,nodes:f.getNodes().map(V=>({id:V.id,type:V.shape,position:V.getPosition(),size:V.getSize(),label:V.attr("label/text"),data:V.getData()})),edges:f.getEdges().map(V=>({id:V.id,source:V.getSourceCellId(),target:V.getTargetCellId()}))};if(localStorage.setItem("scada-canvas-data",JSON.stringify(z)),n.onSave){const V=n.onSave();V instanceof Promise&&await V,Je("保存成功","success");return}Je("保存成功","success")}catch(z){console.error("保存失败",z),Je("保存失败,请查看控制台","error")}},me=()=>{c.value&&c.value.click()},K=z=>{var fe;const F=(fe=z.target.files)==null?void 0:fe[0];if(!F){Je("请选择文件","error");return}const ae=new FileReader;ae.onload=pe=>{var ye;try{const J=JSON.parse((ye=pe.target)==null?void 0:ye.result);mt.importData(J,ke=>{var Ce;const de=ke.getData();(Ce=de==null?void 0:de.animation)!=null&&Ce.enabled&&O(ke,de.animation)})&&(N.value=He.getAllDataSources()),c.value&&(c.value.value="")}catch(J){console.error("导入失败",J),Je("导入失败,JSON格式错误","error"),c.value&&(c.value.value="")}},ae.readAsText(F)},Se=()=>{if(!f){Je("画布未初始化","error");return}try{const z={version:"1.0.0",timestamp:mr(gr()),config:$e.getConfig(),cells:f.toJSON().cells,nodes:f.getNodes().map(V=>({id:V.id,type:V.shape,position:V.getPosition(),size:V.getSize(),label:V.attr("label/text"),data:V.getData()})),edges:f.getEdges().map(V=>({id:V.id,source:V.getSourceCellId(),target:V.getTargetCellId()}))};localStorage.setItem("scada-canvas-data",JSON.stringify(z)),i("preview")}catch(z){console.error("保存预览数据失败:",z),Je("预览失败,请查看控制台","error")}},Z=()=>{u.value=!0},G=()=>{p.value=!0,N.value=He.getAllDataSources();const z=setInterval(()=>{if(!p.value){clearInterval(z);return}N.value=He.getAllDataSources()},1e3)},ce=()=>{try{const z=He.getAllDataSources().map(V=>({id:V.id,name:V.name,type:V.type,enabled:V.enabled,config:V.config}));localStorage.setItem("scada-data-sources",JSON.stringify(z))}catch(z){console.error("保存数据源失败:",z)}},X=z=>{const V={id:"ds_"+Date.now(),...z,devices:[],status:{connected:!1}};He.addDataSource(V),setTimeout(()=>{N.value=He.getAllDataSources(),ce()},1e3),Je(`数据源 "${V.name}" 创建成功`,"success")},oe=z=>{He.updateDataSource(z.id,z),N.value=He.getAllDataSources(),ce(),Je(`数据源 "${z.name}" 更新成功`,"success")},ie=z=>{const V=He.getDataSource(z);He.removeDataSource(z),N.value=He.getAllDataSources(),ce(),Je(`数据源 "${V==null?void 0:V.name}" 已删除`,"success")},Ee=()=>{if(!f){Je("画布未初始化","error");return}try{const z=mt.exportToFile("scada-export.json");z?Je(`已导出为 ${z}`,"success"):Je("导出失败","error")}catch(z){console.error("导出失败",z),Je("导出失败,请查看控制台","error")}};return t({save:Q,importFile:me,exportFile:Ee,preview:Se,workflow:Z,zoomIn:U,zoomOut:Y,clearAll:I,alignLeft:j,alignCenter:le,alignRight:ne,alignTop:te,alignMiddle:ue,alignBottom:$,distributeHorizontal:se,distributeVertical:M,addNode:S,updateNode:B,deleteNode:P,getSelectedNode:()=>o.value,selectNode:z=>{if(!f)return!1;const V=f.getCellById(z);return V?(f.select(V),!0):!1},clearSelection:()=>{f&&(f.unselect(f.getSelectedCells()),o.value=null)},getGraph:()=>f,getCanvasData:()=>f?{version:"1.0.0",timestamp:mr(gr()),config:$e.getConfig(),cells:f.toJSON().cells,nodes:f.getNodes().map(z=>({id:z.id,type:z.shape,position:z.getPosition(),size:z.getSize(),label:z.attr("label/text"),data:z.getData()})),edges:f.getEdges().map(z=>({id:z.id,source:z.getSourceCellId(),target:z.getTargetCellId()}))}:null,loadCanvasData:z=>{if(!f)return!1;try{return f.clearCells(),f.fromJSON({cells:z.cells}),z.config&&$e.updateConfig(z.config),f.getEdges().forEach(V=>{var ae;const F=V.getData();(ae=F==null?void 0:F.animation)!=null&&ae.enabled&&O(V,F.animation)}),!0}catch(V){return console.error("加载画布数据失败:",V),!1}},getAllNodes:()=>f?f.getNodes().map(z=>({id:z.id,type:z.shape,position:z.getPosition(),size:z.getSize(),label:z.attr("label/text"),data:z.getData()})):[],getNodeById:z=>{if(!f)return null;const V=f.getCellById(z);if(!V||!V.isNode())return null;const F=V;return{id:F.id,type:F.shape,position:F.getPosition(),size:F.getSize(),label:F.attr("label/text"),data:F.getData()}},getConfigManager:()=>$e,updateCanvasConfig:z=>{$e.updateConfig(z)},setZoom:z=>{$e.setZoom(z)},setCanvasSize:(z,V)=>{$e.updateSize({width:z,height:V})},setBackgroundColor:z=>{$e.updateBackground({color:z})},updateDeviceData:z=>{f&&(z!=null&&z.devices)&&z.devices.forEach(V=>{var F;(F=V.points)==null||F.forEach(ae=>{f&&f.getNodes().forEach(fe=>{const pe=fe.getData();pe!=null&&pe.bindings&&Object.entries(pe.bindings).forEach(([ye,J])=>{if(J.deviceId===V.id&&J.dataPoint===ae.id){const ge=ae.value;if(ye==="attrs/text/text")fe.attr("text/text",ge);else if(ye==="attrs/body/fill")fe.attr("body/fill",ge);else{const ke=ye.split(".");let de=fe;for(let y=0;y<ke.length-1;y++)de=de[ke[y]];const Ce=ke[ke.length-1];de&&Ce&&(de[Ce]=ge)}}})})})})},getAnimationEngine:()=>Wt}),(z,V)=>(e.openBlock(),e.createElementBlock("div",dv,[n.previewMode?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(In,{key:0,"selected-nodes-count":l.value,onSave:Q,onImport:me,onWorkflow:Z,onDataSource:G,onPreview:Se,onExport:Ee,onZoomIn:U,onZoomOut:Y,onClearAll:I,onAlignLeft:j,onAlignCenter:le,onAlignRight:ne,onAlignTop:te,onAlignMiddle:ue,onAlignBottom:$,onDistributeHorizontal:se,onDistributeVertical:M},null,8,["selected-nodes-count"])),n.previewMode?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("input",{key:1,ref_key:"fileInputRef",ref:c,type:"file",accept:".json",style:{display:"none"},onChange:K},null,544)),e.createElementVNode("div",uv,[n.previewMode?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(Vn,{key:0,"is-collapsed":h.value,"onUpdate:collapsed":V[0]||(V[0]=F=>h.value=F),onAddComponent:S},null,8,["is-collapsed"])),e.createVNode($d,{ref_key:"canvasAreaRef",ref:s},null,512),n.previewMode?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(ts,{key:1,ref:"propertyPanelRef","selected-node":o.value,"selected-edge":a.value,"device-data":k.value,"is-collapsed":m.value,"onUpdate:collapsed":V[1]||(V[1]=F=>m.value=F),onUpdateNode:B,onDeleteNode:P,onUpdateEdge:T,onDeleteEdge:A},null,8,["selected-node","selected-edge","device-data","is-collapsed"]))]),e.createVNode(r0,{"auth-code":d.authCode,"custom-footer":d.customFooter},null,8,["auth-code","custom-footer"]),n.previewMode?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(Uw,{key:2,visible:u.value,"onUpdate:visible":V[2]||(V[2]=F=>u.value=F),"scada-graph":e.unref(f),onClose:V[3]||(V[3]=F=>u.value=!1)},null,8,["visible","scada-graph"])),p.value&&!n.previewMode?(e.openBlock(),e.createBlock(K1,{key:3,"data-sources":N.value,onClose:V[4]||(V[4]=F=>p.value=!1),onAdd:X,onSave:oe,onDelete:ie},null,8,["data-sources"])):e.createCommentVNode("",!0),n.previewMode?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(Z1,{key:4,visible:E.value.visible,"onUpdate:visible":V[5]||(V[5]=F=>E.value.visible=F),position:E.value.position,"menu-items":E.value.items,onMenuClick:C},null,8,["visible","position","menu-items"]))]))}}),[["__scopeId","data-v-4fbb3618"]]),fv={class:"tooltip-title"},pv={class:"tooltip-content"},hv={class:"tooltip-label"},mv={class:"tooltip-value"},gv=Le(e.defineComponent({__name:"NodeTooltip",props:{visible:{type:Boolean},node:{},x:{},y:{},offset:{default:()=>({x:15,y:15})}},setup(d){const t=d,r=e.computed(()=>{var o;return((o=t.node)==null?void 0:o.getData())||{}}),n=e.computed(()=>{var o,a;return((o=r.value)==null?void 0:o.name)||((a=r.value)==null?void 0:a.type)||"组件属性"}),i=e.computed(()=>{const o=r.value,a=[];if(!o)return a;o.id&&a.push({label:"ID",value:o.id}),o.name&&a.push({label:"名称",value:o.name}),o.type&&a.push({label:"类型",value:o.type}),o.fill!==void 0&&a.push({label:"填充色",value:o.fill}),o.stroke!==void 0&&a.push({label:"边框色",value:o.stroke}),o.dataSource&&a.push({label:"数据源",value:o.dataSource}),o.bindings&&o.bindings.length>0&&a.push({label:"绑定数量",value:o.bindings.length});const l=["id","name","type","fill","stroke","dataSource","bindings","presetBindings","internalAnimations","shape","ports","component"];return Object.keys(o).forEach(c=>{if(!l.includes(c)&&o[c]!==void 0&&o[c]!==null){let u=o[c];typeof u=="object"&&(u=JSON.stringify(u)),a.push({label:c,value:u})}}),a}),s=e.computed(()=>({left:`${t.x+t.offset.x}px`,top:`${t.y+t.offset.y}px`}));return(o,a)=>d.visible?(e.openBlock(),e.createElementBlock("div",{key:0,class:"component-tooltip",style:e.normalizeStyle(s.value)},[e.renderSlot(o.$slots,"default",{node:d.node,data:r.value,properties:i.value},()=>[e.createElementVNode("div",fv,e.toDisplayString(n.value),1),e.createElementVNode("div",pv,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.value,l=>(e.openBlock(),e.createElementBlock("div",{key:l.label,class:"tooltip-item"},[e.createElementVNode("span",hv,e.toDisplayString(l.label)+":",1),e.createElementVNode("span",mv,e.toDisplayString(l.value),1)]))),128))])],!0)],4)):e.createCommentVNode("",!0)}}),[["__scopeId","data-v-370644c6"]]),yv={key:0,class:"empty-state"},sc=Le(e.defineComponent({__name:"Preview",setup(d){const t=e.ref(),r=e.ref(!1),n=e.ref({width:1920,height:1080,background:{color:"#1e293b"}}),i=e.ref({visible:!1,node:null,x:0,y:0});let s=null;const o=e.computed(()=>({width:`${n.value.width}px`,height:`${n.value.height}px`})),a=e.computed(()=>({width:`${n.value.width}px`,height:`${n.value.height}px`}));e.onMounted(async()=>{if(!t.value)return;await at.preloadAllComponents(),console.log("组件预加载完成");const c=at.getAllComponents();Object.values(c).forEach(u=>{const p=u;if(p.component)try{An({shape:p.shape,width:p.width,height:p.height,component:p.component,ports:p.ports})}catch{}}),Ae.Graph.registerEdge("animated-edge",{inherit:"edge",markup:[{tagName:"path",selector:"line",attrs:{fill:"none"}},{tagName:"path",selector:"wrap",attrs:{fill:"none",stroke:"rgba(0,0,0,0)",strokeWidth:20}},{tagName:"circle",selector:"circle"}],attrs:{line:{connection:!0,stroke:"#10b981",strokeWidth:2,targetMarker:{name:"block",width:8,height:6}},wrap:{connection:!0,strokeLinecap:"round",strokeLinejoin:"round"}}},!0),Ae.Graph.registerEdge("pipeline-edge",{inherit:"edge",markup:[{tagName:"path",selector:"shadow",attrs:{fill:"none"}},{tagName:"path",selector:"line",attrs:{fill:"none"}},{tagName:"path",selector:"highlight",attrs:{fill:"none"}},{tagName:"path",selector:"wrap",attrs:{fill:"none",stroke:"rgba(0,0,0,0)",strokeWidth:20}},{tagName:"circle",selector:"circle"}],attrs:{shadow:{connection:!0,stroke:"#1e293b",strokeWidth:10,strokeLinecap:"butt",strokeLinejoin:"miter"},line:{connection:!0,stroke:"#475569",strokeWidth:8,strokeLinecap:"butt",strokeLinejoin:"miter",targetMarker:{name:"block",width:10,height:8,fill:"#475569"}},highlight:{connection:!0,stroke:"#94a3b8",strokeWidth:3,strokeLinecap:"butt",strokeLinejoin:"miter",strokeDasharray:"0",strokeDashoffset:0},wrap:{connection:!0,strokeLinecap:"butt",strokeLinejoin:"miter"}}},!0),l()});const l=()=>{var c;try{const u=localStorage.getItem("scada-canvas-data");if(!u){console.warn("localStorage 中没有找到画布数据");return}const p=JSON.parse(u);if(console.log("加载的原始数据:",p),p.config&&(n.value={...n.value,...p.config},console.log("画布配置:",n.value)),!t.value)return;if(s=new Ae.Graph({container:t.value,width:n.value.width,height:n.value.height,background:n.value.background.image?{color:n.value.background.color||"#1e293b",image:n.value.background.image,size:n.value.background.size||"cover",repeat:n.value.background.repeat||"no-repeat",position:"center"}:{color:n.value.background.color||"#1e293b"},grid:(c=n.value.grid)!=null&&c.enabled?{size:n.value.grid.size,visible:!0,type:n.value.grid.type||"dot",args:{color:n.value.grid.color||"#475569",thickness:1}}:!1,interacting:{nodeMovable:!1,edgeMovable:!1,edgeLabelMovable:!1,arrowheadMovable:!1,vertexMovable:!1,vertexAddable:!1,vertexDeletable:!1},panning:!1,mousewheel:!1}),s.on("node:mouseenter",({node:h,e:m})=>{console.log("[Preview] 鼠标进入组件:",h.id);const f=h.getData(),E=[];if(f){f.id&&E.push({label:"ID",value:f.id}),f.name&&E.push({label:"名称",value:f.name}),f.type&&E.push({label:"类型",value:f.type}),f.fill!==void 0&&E.push({label:"填充色",value:f.fill}),f.stroke!==void 0&&E.push({label:"边框色",value:f.stroke}),f.dataSource&&E.push({label:"数据源",value:f.dataSource}),f.bindings&&f.bindings.length>0&&E.push({label:"绑定数量",value:f.bindings.length});const N=["id","name","type","fill","stroke","dataSource","bindings","presetBindings","internalAnimations","shape","ports","component"];Object.keys(f).forEach(k=>{if(!N.includes(k)&&f[k]!==void 0&&f[k]!==null){let g=f[k];typeof g=="object"&&(g=JSON.stringify(g)),E.push({label:k,value:g})}})}console.log("[Preview] 显示属性:",{node:h.id,x:m.clientX,y:m.clientY}),i.value={visible:!0,node:h,x:m.clientX,y:m.clientY}}),s.on("node:mousemove",({e:h})=>{i.value.visible&&(i.value.x=h.clientX,i.value.y=h.clientY)}),s.on("node:mouseleave",()=>{i.value.visible=!1}),p.cells&&p.cells.length>0){console.log("🔍 完整的 cells 数据:",p.cells);const h=p.cells.filter((m,f)=>m.shape?(console.log(`Cell ${f}:`,m),!0):(console.error(`Cell ${f} 缺少 shape 字段:`,m),!1));if(h.length===0){console.error("所有 cells 都缺少 shape 字段");return}s.fromJSON({cells:h}),r.value=!0,console.log("画布数据加载成功,节点数:",s.getNodes().length,"连线数:",s.getEdges().length),s.getEdges().forEach(m=>{var E;const f=m.getData();(E=f==null?void 0:f.animation)!=null&&E.enabled&&Zl(m,f.animation)})}}catch(u){console.error("加载画布数据失败:",u)}};return(c,u)=>(e.openBlock(),e.createElementBlock("div",{class:"scada-layout","data-scada-theme":"dark",style:e.normalizeStyle(o.value)},[e.createElementVNode("div",{class:"canvas-container",ref_key:"canvasContainer",ref:t,style:e.normalizeStyle(a.value)},[r.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",yv,[...u[0]||(u[0]=[e.createElementVNode("div",{class:"empty-icon"},"📭",-1),e.createElementVNode("div",{class:"empty-text"},"暂无内容",-1),e.createElementVNode("div",{class:"empty-hint"},"请先在编辑模式下添加组件并保存",-1)])])),e.createVNode(gv,{visible:i.value.visible,node:i.value.node,x:i.value.x,y:i.value.y},null,8,["visible","node","x","y"])],4)],4))}}),[["__scopeId","data-v-7a9e4c7e"]]);var qt=(d=>(d.PARSE_DEVICE_DATA="PARSE_DEVICE_DATA",d.TRANSFORM_BINDING_DATA="TRANSFORM_BINDING_DATA",d.BATCH_CALCULATE="BATCH_CALCULATE",d.ERROR="ERROR",d))(qt||{});self.onmessage=d=>{const{id:t,type:r,payload:n}=d.data;try{let i;switch(r){case"PARSE_DEVICE_DATA":i=bv(n);break;case"TRANSFORM_BINDING_DATA":i=Ev(n);break;case"BATCH_CALCULATE":i=Sv(n);break;default:throw new Error(`未知的消息类型: ${r}`)}const s={id:t,type:r,result:i};self.postMessage(s)}catch(i){const s={id:t,type:"ERROR",error:i.message};self.postMessage(s)}};function bv(d){return Array.isArray(d.devices)?d.devices.map(t=>({id:t.id||t.deviceId,name:t.name||t.deviceName,points:wv(t.points||t.data||[])})):Array.isArray(d)?[{id:"default",name:"Default Device",points:d.map(t=>({id:t.id,value:t.value,quality:t.quality||"good",timestamp:t.timestamp||new Date().toISOString()}))}]:d}function wv(d){return d.map(t=>typeof t=="object"&&t.id!==void 0?{id:t.id,value:t.value,dataType:vv(t.value),quality:t.quality||"good",timestamp:t.timestamp||new Date().toISOString()}:t)}function vv(d){return typeof d=="number"?"number":typeof d=="boolean"?"boolean":typeof d=="string"?"string":"unknown"}function Ev(d){const{bindings:t,deviceData:r}=d,n=[];return t.forEach(i=>{const s=kv(r,i.devicePointId);if(s!==void 0){const o=_v(s,i.mapping);n.push({nodeId:i.nodeId,targetProperty:i.targetProperty,value:o})}}),n}function kv(d,t){if(Array.isArray(d)){const r=d.find(n=>n.id===t);return r==null?void 0:r.value}if(d[t]!==void 0)return d[t];if(d.devices&&Array.isArray(d.devices)){for(const r of d.devices)if(r.points&&Array.isArray(r.points)){const n=r.points.find(i=>i.id===t);if(n)return n.value}}}function _v(d,t){var r;if(!t||t.type==="DIRECT")return d;switch(t.type){case"BOOLEAN":return d?t.trueValue:t.falseValue;case"RANGE":const n=Number(d);if(t.rangeRules&&Array.isArray(t.rangeRules))for(const s of t.rangeRules){const o=s.min!==void 0?Number(s.min):-1/0,a=s.max!==void 0?Number(s.max):1/0;if(n>=o&&n<=a)return s.value}return d;case"ENUM":const i=String(d);return((r=t.enumMappings)==null?void 0:r[i])??d;default:return d}}function Sv(d){const{calculations:t}=d;return t.map(r=>{switch(r.type){case"average":return Nv(r.params.values);case"sum":return Cv(r.params.values);case"interpolate":return xv(r.params.from,r.params.to,r.params.t);default:return null}})}function Nv(d){return d.length===0?0:d.reduce((t,r)=>t+r,0)/d.length}function Cv(d){return d.reduce((t,r)=>t+r,0)}function xv(d,t,r){return d+(t-d)*Math.max(0,Math.min(1,r))}class Av{constructor(){he(this,"worker",null);he(this,"pendingTasks",new Map);he(this,"messageIdCounter",0);he(this,"TASK_TIMEOUT",5e3);he(this,"handleMessage",t=>{const{id:r,type:n,result:i,error:s}=t.data,o=this.pendingTasks.get(r);o&&(clearTimeout(o.timeout),this.pendingTasks.delete(r),n===qt.ERROR||s?o.reject(new Error(s||"未知错误")):o.resolve(i))});he(this,"handleError",t=>{console.error("[WorkerManager] Worker 错误:",t),this.pendingTasks.forEach(r=>{clearTimeout(r.timeout),r.reject(new Error("Worker 执行错误"))}),this.pendingTasks.clear()})}init(){if(!this.worker)try{console.warn("[WorkerManager] Worker 未初始化,将使用主线程处理数据")}catch(t){console.error("[WorkerManager] Worker 初始化失败:",t),console.warn("[WorkerManager] 将使用主线程处理数据")}}sendMessage(t,r){return new Promise((n,i)=>{if(!this.worker){console.warn("[WorkerManager] Worker 不可用,使用主线程处理"),n(this.fallbackProcess(t,r));return}const s=`task_${++this.messageIdCounter}`,o=window.setTimeout(()=>{this.pendingTasks.delete(s),i(new Error(`任务超时: ${t}`))},this.TASK_TIMEOUT);this.pendingTasks.set(s,{resolve:n,reject:i,timeout:o});const a={id:s,type:t,payload:r};this.worker.postMessage(a)})}fallbackProcess(t,r){switch(t){case qt.PARSE_DEVICE_DATA:return r;case qt.TRANSFORM_BINDING_DATA:return[];case qt.BATCH_CALCULATE:return[];default:return null}}async parseDeviceData(t){return this.sendMessage(qt.PARSE_DEVICE_DATA,t)}async transformBindingData(t,r){return this.sendMessage(qt.TRANSFORM_BINDING_DATA,{bindings:t,deviceData:r})}async batchCalculate(t){return this.sendMessage(qt.BATCH_CALCULATE,{calculations:t})}getStatus(){return{isActive:this.worker!==null,pendingTasks:this.pendingTasks.size}}terminate(){this.worker&&(this.worker.terminate(),this.worker=null),this.pendingTasks.forEach(t=>{clearTimeout(t.timeout),t.reject(new Error("Worker 已终止"))}),this.pendingTasks.clear(),console.log("[WorkerManager] Worker 已终止")}}const Iv=new Av;typeof window<"u"&&Iv.init();class ac{static parse(t,r){var n,i;try{const o=new DOMParser().parseFromString(t,"image/svg+xml"),a=o.querySelector("parsererror");if(a)return console.error("[SVGParser] SVG 解析失败:",a.textContent),null;const l=o.documentElement;if(l.tagName.toLowerCase()!=="svg")return console.error("[SVGParser] 不是有效的 SVG 文件"),null;const c=this.extractMetadata(l,r);if(!c)return console.error("[SVGParser] 无法提取组件元数据"),null;const u=this.extractSize(l),p=this.extractParts(l),h=this.cleanSvgContent(l);return{metadata:{id:c.component.id,name:c.component.name,category:c.component.category||"custom",icon:c.component.icon||"🎨",description:c.component.description,version:c.component.version||"1.0.0",author:c.component.author,svgSource:{fileName:r,uploadTime:new Date().toISOString()}},size:{width:((n=c.size)==null?void 0:n.width)||u.width||120,height:((i=c.size)==null?void 0:i.height)||u.height||120},svgContent:h,parts:p,internalAnimations:[],presetBindings:c.presetBindings||[],ports:c.ports}}catch(s){return console.error("[SVGParser] 解析异常:",s),null}}static extractMetadata(t,r){var s,o,a;const n=t.querySelector("metadata");if(!n)return this.generateDefaultMetadata(t,r);const i=n.querySelector("scada-config");if(!i)return this.generateDefaultMetadata(t,r);try{const l=((s=i.textContent)==null?void 0:s.trim())||"{}",c=JSON.parse(l);return!((o=c.component)!=null&&o.id)||!((a=c.component)!=null&&a.name)?(console.warn("[SVGParser] 元数据缺少必需字段,使用默认值"),this.generateDefaultMetadata(t,r)):c}catch(l){return console.error("[SVGParser] 元数据 JSON 解析失败:",l),this.generateDefaultMetadata(t,r)}}static generateDefaultMetadata(t,r){const n=r?r.replace(/\.[^/.]+$/,"").replace(/[^a-zA-Z0-9-_]/g,"-").toLowerCase():`svg-${Date.now()}`,i=r?r.replace(/\.[^/.]+$/,""):"SVG 组件";return{component:{id:n,name:i,category:"custom",icon:"🎨",description:"自定义 SVG 组件",version:"1.0.0"}}}static extractSize(t){const r=t.getAttribute("viewBox");if(r){const s=r.split(/\s+/).map(Number);if(s.length===4)return{width:s[2]-s[0],height:s[3]-s[1]}}const n=t.getAttribute("width"),i=t.getAttribute("height");return n&&i?{width:parseFloat(n),height:parseFloat(i)}:{width:120,height:120}}static extractParts(t){const r=[];return t.querySelectorAll("[id]").forEach(i=>{const s=i.getAttribute("id");if(!s||!s.startsWith("part-"))return;const o=s.replace(/^part-/,"").replace(/-/g," ").replace(/\b\w/g,l=>l.toUpperCase()),a={id:s,name:o,elementType:i.tagName.toLowerCase(),description:i.getAttribute("data-description")||void 0};r.push(a)}),r}static cleanSvgContent(t){const r=t.cloneNode(!0);if(r.querySelectorAll("metadata").forEach(i=>i.remove()),!r.getAttribute("viewBox")){const i=r.getAttribute("width")||"120",s=r.getAttribute("height")||"120";r.setAttribute("viewBox",`0 0 ${i} ${s}`)}return r.removeAttribute("width"),r.removeAttribute("height"),r.setAttribute("preserveAspectRatio","xMidYMid meet"),r.outerHTML}static validate(t){var n,i,s,o;const r=[];return(n=t.metadata)!=null&&n.id||r.push("缺少组件 ID"),(i=t.metadata)!=null&&i.name||r.push("缺少组件名称"),t.svgContent||r.push("缺少 SVG 内容"),(!((s=t.size)!=null&&s.width)||!((o=t.size)!=null&&o.height))&&r.push("缺少尺寸信息"),{valid:r.length===0,errors:r}}}var Ot=(d=>(d.OPENING_ROTATE="opening-rotate",d.LEVEL_HEIGHT="level-height",d.STATUS_COLOR="status-color",d.VALUE_POSITION="value-position",d.SPEED_FLOW="speed-flow",d.VALUE_OPACITY="value-opacity",d.VALUE_TEXT="value-text",d.CUSTOM="custom",d))(Ot||{});const Tv="#cccccc";class Vv{constructor(){he(this,"states",new Map)}applyTemplate(t,r,n,i,s){if(t&&!(i==null&&r!==Ot.VALUE_TEXT))try{switch(r){case Ot.OPENING_ROTATE:this.applyOpeningRotate(t,n,i,s);break;case Ot.LEVEL_HEIGHT:this.applyLevelHeight(t,n,i,s);break;case Ot.STATUS_COLOR:this.applyStatusColor(t,n,i);break;case Ot.VALUE_POSITION:this.applyValuePosition(t,n,i,s);break;case Ot.SPEED_FLOW:this.applySpeedFlow(t,n,i,s);break;case Ot.VALUE_OPACITY:this.applyValueOpacity(t,n,i,s);break;case Ot.VALUE_TEXT:this.applyValueText(t,n,i);break;default:console.warn(`[AnimationTemplateEngine] 未实现的模板类型: ${r}`)}}catch(o){console.error("[AnimationTemplateEngine] 应用模板失败:",o)}}applyOpeningRotate(t,r,n,i){if(!r.inputRange||!r.outputRange){console.error("[AnimationTemplateEngine] OpeningRotate 参数不完整:",r);return}const s=this.mapRange(n,r.inputRange.min,r.inputRange.max,r.outputRange.min,r.outputRange.max),o=this.getTransformOrigin(t,r.origin||"center");i!=null&&i.transitionDuration&&(t.style.transition=`transform ${i.transitionDuration}ms ${i.easing||"ease-out"}`),t.style.transformOrigin=o,t.style.transform=`rotate(${s}deg)`}applyLevelHeight(t,r,n,i){if(!r.inputRange){console.error("[AnimationTemplateEngine] LevelHeight 参数不完整:",r);return}const s=this.mapRange(n,r.inputRange.min,r.inputRange.max,0,100),o=r.direction||"bottom-up",a=t.tagName.toLowerCase();a==="rect"?this.applyLevelToRect(t,s,o,i):a==="path"?this.applyLevelToPath(t,s,o,i):this.applyLevelWithClipPath(t,s,o,i)}applyLevelToRect(t,r,n,i){const s=parseFloat(t.getAttribute("data-original-height")||t.getAttribute("height")||"100"),o=parseFloat(t.getAttribute("data-original-y")||t.getAttribute("y")||"0");t.hasAttribute("data-original-height")||(t.setAttribute("data-original-height",String(s)),t.setAttribute("data-original-y",String(o)));const a=s*r/100;i!=null&&i.transitionDuration&&(t.style.transition=`height ${i.transitionDuration}ms ${i.easing||"ease-out"}, y ${i.transitionDuration}ms ${i.easing||"ease-out"}`),n==="bottom-up"?(t.setAttribute("height",String(a)),t.setAttribute("y",String(o+s-a))):n==="top-down"&&(t.setAttribute("height",String(a)),t.setAttribute("y",String(o)))}applyLevelToPath(t,r,n,i){this.applyLevelWithClipPath(t,r,n,i)}applyLevelWithClipPath(t,r,n,i){const s=t.getBBox();let o;if(n==="bottom-up"){const a=s.height*r/100;s.y+s.height-a,o=`inset(${s.height-a}px 0px 0px 0px)`}else if(n==="top-down"){const a=s.height*r/100;o=`inset(0px 0px ${s.height-a}px 0px)`}else o="none";i!=null&&i.transitionDuration&&(t.style.transition=`clip-path ${i.transitionDuration}ms ${i.easing||"ease-out"}`),t.style.clipPath=o}applyStatusColor(t,r,n){if(!r.colorMap){console.error("[AnimationTemplateEngine] StatusColor 参数不完整:",r);return}const i=String(n),o=typeof n=="string"&&/^#[0-9a-fA-F]{3,8}$/.test(n)?n:r.colorMap[i]||r.defaultColor||Tv,a=r.applyTo||"fill";(a==="fill"||a==="both")&&t.setAttribute("fill",o),(a==="stroke"||a==="both")&&t.setAttribute("stroke",o)}applyValuePosition(t,r,n,i){let s;if(r.movement&&typeof r.movement.distance=="number")s=r.movement;else if(r.axis&&typeof r.distance=="number")s={axis:r.axis,distance:r.distance};else{console.error("[AnimationTemplateEngine] ValuePosition 参数不完整:",r);return}const o=this.mapRange(n,r.inputRange.min,r.inputRange.max,0,s.distance);i!=null&&i.transitionDuration&&(t.style.transition=`transform ${i.transitionDuration}ms ${i.easing||"ease-out"}`),s.axis==="x"?t.style.transform=`translateX(${o}px)`:t.style.transform=`translateY(${o}px)`}applySpeedFlow(t,r,n,i){if(!r.inputRange||!r.speedRange){console.error("[AnimationTemplateEngine] SpeedFlow 参数不完整:",r);return}const s=this.mapRange(n,r.inputRange.min,r.inputRange.max,r.speedRange.min,r.speedRange.max),o=r.dashLength||10;if(t.setAttribute("stroke-dasharray",`${o} ${o}`),s>0){const a=o*2/s;t.style.animation=`dash-flow ${a}s linear infinite`}else t.style.animation="none";this.ensureFlowAnimation()}applyValueOpacity(t,r,n,i){if(!r.inputRange||!r.outputRange){console.error("[AnimationTemplateEngine] ValueOpacity 参数不完整:",r);return}const s=this.mapRange(n,r.inputRange.min,r.inputRange.max,r.outputRange.min,r.outputRange.max);i!=null&&i.transitionDuration&&(t.style.transition=`opacity ${i.transitionDuration}ms ${i.easing||"ease-out"}`),t.style.opacity=String(Math.max(0,Math.min(1,s)))}applyValueText(t,r,n){const i=n!=null&&n!==""?String(n):r.defaultText??"";t.textContent=i}mapRange(t,r,n,i,s){const a=(Math.max(r,Math.min(n,t))-r)/(n-r);return i+a*(s-i)}getTransformOrigin(t,r){return r==="center"?"center center":{"top-left":"0% 0%","top-right":"100% 0%","bottom-left":"0% 100%","bottom-right":"100% 100%"}[r]||r}ensureFlowAnimation(){if(document.getElementById("svg-flow-animation-style"))return;const t=document.createElement("style");t.id="svg-flow-animation-style",t.textContent=`
319
+ @keyframes dash-flow {
320
+ to {
321
+ stroke-dashoffset: -20;
322
+ }
323
+ }
324
+ `,document.head.appendChild(t)}clearState(t){this.states.delete(t)}clearAllStates(){this.states.clear()}}const lc=new Vv,Pv={class:"svg-renderer-container"},Bv=["innerHTML"],Ov=300,Dv=Le(e.defineComponent({__name:"SVGRenderer",props:{node:{},config:{}},setup(d){const t=d,r=e.ref(),n=e.computed(()=>{var o;return((o=t.config)==null?void 0:o.svgContent)||""}),i=e.computed(()=>{var a,l;const o=(a=t.node)==null?void 0:a.getData();return o!=null&&o.internalAnimations&&Array.isArray(o.internalAnimations)?o.internalAnimations:((l=t.config)==null?void 0:l.internalAnimations)||[]}),s=()=>{if(!r.value||!t.node)return;const o=r.value.querySelector("svg");if(!o)return;const a=t.node.getData();a&&i.value.forEach(l=>{if(l.enabled===!1)return;const c=o.querySelector(`#${l.partId}`);if(!c){console.warn(`[SVGRenderer] 找不到部件: ${l.partId}`);return}const u=a[l.driverProperty];if(u!=null)try{lc.applyTemplate(c,l.templateType,l.templateParams,u,{transitionDuration:l.transitionDuration??Ov,easing:l.easing||"ease-out",stateKey:`${t.node.id}:${l.id}`})}catch(p){console.error("[SVGRenderer] 应用动画失败:",p,l)}})};return e.watch(()=>{var o;return(o=t.node)==null?void 0:o.getData()},()=>{s()},{deep:!1}),e.watch(()=>i.value,()=>{s()},{deep:!0}),e.onMounted(()=>{setTimeout(()=>{s()},100),t.node&&typeof t.node.on=="function"&&t.node.on("change:data",()=>{s()})}),e.onBeforeUnmount(()=>{i.value.forEach(o=>{var l;const a=`${(l=t.node)==null?void 0:l.id}:${o.id}`;lc.clearState(a)})}),(o,a)=>(e.openBlock(),e.createElementBlock("div",Pv,[e.createElementVNode("div",{innerHTML:n.value,ref_key:"svgRef",ref:r},null,8,Bv)]))}}),[["__scopeId","data-v-6b6b65e7"]]),Gt=4,En="#31d0c6",kn="#fff",_n=2,Rv=300;class Mv{loadFromString(t,r){try{const n=ac.parse(t,r);if(!n)return console.error("[SVGLoader] SVG 解析失败"),!1;const i=ac.validate(n);if(!i.valid)return console.error("[SVGLoader] SVG 配置验证失败:",i.errors),!1;const s=this.convertToComponentConfig(n);return at.register(s),!0}catch(n){return console.error("[SVGLoader] 加载失败:",n),!1}}async loadFromFile(t){try{const r=await this.readFileAsText(t);return this.loadFromString(r,t.name)}catch(r){return console.error("[SVGLoader] 读取文件失败:",r),!1}}async loadBatch(t){let r=0;for(const n of t)await this.loadFromFile(n)&&r++;return console.log(`[SVGLoader] 批量加载完成: ${r}/${t.length}`),r}async loadFromUrl(t){try{const r=await fetch(t);if(!r.ok)throw new Error(`HTTP ${r.status}: ${r.statusText}`);const n=await r.text(),i=t.split("/").pop()||"remote.svg";return this.loadFromString(n,i)}catch(r){return console.error("[SVGLoader] 从 URL 加载失败:",r),!1}}convertToComponentConfig(t){const r=e.defineComponent({name:`SVG_${t.metadata.id}`,props:{node:{type:Object,required:!1}},setup(o){return()=>e.h(Dv,{node:o.node,config:t})}}),n=this.generateInternalAnimations(t),i=this.generateDefaultDriverValues(t);return{metadata:{id:t.metadata.id,name:t.metadata.name,category:t.metadata.category,icon:t.metadata.icon,description:t.metadata.description,version:t.metadata.version,author:t.metadata.author},shape:`svg-${t.metadata.id}`,width:t.size.width,height:t.size.height,label:t.metadata.name,attrs:{body:{fill:"transparent",stroke:"transparent"}},data:{type:"svg",svgComponentId:t.metadata.id,parts:t.parts,internalAnimations:n,presetBindings:t.presetBindings||[],...i,...t.defaultData},props:this.generateProps(t),points:this.generatePoints(t,i),component:r,ports:this.generatePorts(t)}}generateInternalAnimations(t){return!t.presetBindings||t.presetBindings.length===0?[]:t.presetBindings.map((r,n)=>({id:`anim-${n+1}`,partId:r.partId,driverProperty:r.suggestedDriverProperty,templateType:r.suggestedTemplate,templateParams:r.suggestedParams,enabled:!0,transitionDuration:Rv,easing:"ease-out"}))}generateDefaultDriverValues(t){const r={};return!t.presetBindings||t.presetBindings.length===0||t.presetBindings.forEach(n=>{var s;const i=n.suggestedDriverProperty;switch(n.suggestedTemplate){case"opening-rotate":r[i]=0;break;case"level-height":r[i]=50;break;case"status-color":r[i]=0;break;case"value-position":r[i]=.5;break;case"speed-flow":r[i]=0;break;case"value-opacity":r[i]=0;break;case"value-text":r[i]=((s=n.suggestedParams)==null?void 0:s.defaultText)??"";break;default:r[i]=0}}),r}generatePorts(t){const r={top:{position:{name:"top",args:{dy:Gt}},attrs:{circle:{r:Gt,magnet:!0,stroke:En,strokeWidth:_n,fill:kn}}},bottom:{position:{name:"bottom",args:{dy:-Gt}},attrs:{circle:{r:Gt,magnet:!0,stroke:En,strokeWidth:_n,fill:kn}}},left:{position:{name:"left",args:{dx:Gt}},attrs:{circle:{r:Gt,magnet:!0,stroke:En,strokeWidth:_n,fill:kn}}},right:{position:{name:"right",args:{dx:-Gt}},attrs:{circle:{r:Gt,magnet:!0,stroke:En,strokeWidth:_n,fill:kn}}}};if(t.ports&&t.ports.length>0){const n=t.ports.map(i=>({id:i.id,group:i.group,args:i.args}));return{groups:r,items:n}}return{groups:r,items:[{id:"port-top",group:"top"},{id:"port-bottom",group:"bottom"},{id:"port-left",group:"left"},{id:"port-right",group:"right"}]}}generateProps(t){const r=[],n=new Set;return t.presetBindings&&t.presetBindings.length>0&&t.presetBindings.forEach(i=>{const s=i.suggestedDriverProperty;if(n.has(s))return;n.add(s);const o=i.label||s,a=i.valueType||"number";let l;a==="boolean"?l="boolean":a==="color"?l="color":a==="string"?l="text":l="number";const c={key:s,label:o,type:l,path:`data.${s}`,bindable:!0,description:`驱动 ${i.partId} 的数据字段`};a==="boolean"&&i.booleanOptions&&i.booleanOptions.length>0&&(c.options=i.booleanOptions.map(h=>({label:h.label,value:h.value})));const u=i.suggestedParams,p=u==null?void 0:u.inputRange;l==="number"&&p&&typeof p.min=="number"&&typeof p.max=="number"?(c.min=p.min,c.max=p.max,c.defaultValue=(u==null?void 0:u.defaultValue)??p.min,c.step=(u==null?void 0:u.step)??this.inferStep(p.min,p.max)):l==="number"?(c.min=0,c.max=1,c.defaultValue=0,c.step=.1):l==="color"&&(u!=null&&u.defaultColor)?c.defaultValue=u.defaultColor:l!=="boolean"&&(c.defaultValue=""),r.push(c)}),r.push({key:"componentName",label:"组件名称",type:"text",path:"data.componentName",defaultValue:t.metadata.name,bindable:!1}),r}inferStep(t,r){const n=r-t;return n<=0||n<=1?.1:n<=10?.5:n<=100?1:Math.max(1,Math.pow(10,Math.floor(Math.log10(n))-1))}generatePoints(t,r){const n=[],i=new Set;return!t.presetBindings||t.presetBindings.length===0||t.presetBindings.forEach(s=>{const o=s.suggestedDriverProperty;if(i.has(o))return;i.add(o);const a=s.label||o,l=s.valueType||"number";let c="number";l==="boolean"?c="boolean":(l==="string"||l==="color")&&(c="string");const u={id:o,name:a,description:`驱动部件 ${s.partId} 的数据点`,dataType:c,defaultValue:r[o],required:!0};n.push(u)}),n}readFileAsText(t){return new Promise((r,n)=>{const i=new FileReader;i.onload=s=>{var a;const o=(a=s.target)==null?void 0:a.result;typeof o=="string"?r(o):n(new Error("文件内容不是文本格式"))},i.onerror=()=>{n(new Error("读取文件失败"))},i.readAsText(t,"UTF-8")})}}const cc=new Mv;var dc=(d=>(d.BOOLEAN="boolean",d.NUMBER="number",d.STRING="string",d))(dc||{}),uc=(d=>(d.READ="read",d.WRITE="write",d.READ_WRITE="readWrite",d))(uc||{}),fc=(d=>(d.ONLINE="online",d.OFFLINE="offline",d.ERROR="error",d.MAINTENANCE="maintenance",d))(fc||{}),pc=(d=>(d.PLC="plc",d.SENSOR="sensor",d.ACTUATOR="actuator",d.METER="meter",d.CAMERA="camera",d.OTHER="other",d))(pc||{});const $v={ScadaCanvas:ic,PropertyPanel:ts,Header:In,ComponentLibrary:Vn,CanvasConfigPanel:Pn,BindingCard:Ki,EventCard:Hi,BasicPropertiesTab:Bn,AttributeConfigDialog:Yi,CustomCodeDialog:Ji,Preview:sc},hc=d=>{Object.entries($v).forEach(([t,r])=>{d.component(t,r)}),typeof window<"u"&&Promise.resolve().then(()=>Kv).then(({loadExampleSvgComponents:t})=>{t().catch(r=>{})})},jv={install:hc,version:"1.0.0"},Lv=`<?xml version="1.0" encoding="UTF-8"?>
325
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 80 80">
326
+ <metadata>
327
+ <scada-config><![CDATA[
328
+ {
329
+ "component": {
330
+ "id": "circle",
331
+ "name": "\\u5706\\u5f62",
332
+ "category": "basic",
333
+ "icon": "\\u25CB",
334
+ "description": "\\u57fa\\u7840\\u5706\\u5f62\\u56fe\\u5f62\\u7ec4\\u4ef6",
335
+ "version": "1.0.0",
336
+ "author": "SCADA Engine"
337
+ },
338
+ "size": {
339
+ "width": 80,
340
+ "height": 80
341
+ },
342
+ "presetBindings": [
343
+ {
344
+ "partId": "part-label",
345
+ "suggestedDriverProperty": "text",
346
+ "label": "\\u663e\\u793a\\u6587\\u672c",
347
+ "valueType": "string",
348
+ "suggestedTemplate": "value-text",
349
+ "suggestedParams": {
350
+ "type": "value-text",
351
+ "defaultText": "\\u5706\\u5f62"
352
+ }
353
+ },
354
+ {
355
+ "partId": "part-body",
356
+ "suggestedDriverProperty": "fill",
357
+ "label": "\\u586b\\u5145\\u8272",
358
+ "valueType": "color",
359
+ "suggestedTemplate": "status-color",
360
+ "suggestedParams": {
361
+ "type": "status-color",
362
+ "colorMap": {},
363
+ "defaultColor": "#10b981",
364
+ "applyTo": "fill"
365
+ }
366
+ }
367
+ ],
368
+ "ports": [
369
+ { "id": "port-top", "group": "top" },
370
+ { "id": "port-right", "group": "right" },
371
+ { "id": "port-bottom", "group": "bottom" },
372
+ { "id": "port-left", "group": "left" }
373
+ ]
374
+ }
375
+ ]]></scada-config>
376
+ </metadata>
377
+ <defs>
378
+ <radialGradient id="circle-gradient" cx="30%" cy="30%">
379
+ <stop offset="0%" stop-color="#34d399" />
380
+ <stop offset="100%" stop-color="#10b981" />
381
+ </radialGradient>
382
+ </defs>
383
+ <g id="root">
384
+ <circle
385
+ id="part-body"
386
+ cx="40"
387
+ cy="40"
388
+ r="35"
389
+ fill="url(#circle-gradient)"
390
+ stroke="#059669"
391
+ stroke-width="2"
392
+ />
393
+ <text
394
+ id="part-label"
395
+ x="40"
396
+ y="40"
397
+ text-anchor="middle"
398
+ dominant-baseline="middle"
399
+ font-size="14"
400
+ fill="#ffffff"
401
+ font-family="system-ui, sans-serif"
402
+ >\\u5706\\u5f62</text>
403
+ </g>
404
+ </svg>
405
+ `,Uv=`<?xml version="1.0" encoding="UTF-8"?>\r
406
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100">\r
407
+ <!-- 组件元数据 -->\r
408
+ <metadata>\r
409
+ <scada-config><![CDATA[\r
410
+ {\r
411
+ "component": {\r
412
+ "id": "light-bulb",\r
413
+ "name": "灯泡",\r
414
+ "category": "iot",\r
415
+ "icon": "💡",\r
416
+ "description": "可控制开关状态和颜色的灯泡组件",\r
417
+ "version": "1.0.0",\r
418
+ "author": "SCADA Engine"\r
419
+ },\r
420
+ "size": {\r
421
+ "width": 100,\r
422
+ "height": 120\r
423
+ },\r
424
+ "presetBindings": [\r
425
+ {\r
426
+ "partId": "part-bulbGlow",\r
427
+ "suggestedDriverProperty": "state",\r
428
+ "label": "开关状态",\r
429
+ "valueType": "boolean",\r
430
+ "booleanOptions": [\r
431
+ { "value": 0, "label": "关闭" },\r
432
+ { "value": 1, "label": "开启" }\r
433
+ ],\r
434
+ "suggestedTemplate": "value-opacity",\r
435
+ "suggestedParams": {\r
436
+ "type": "value-opacity",\r
437
+ "inputRange": { "min": 0, "max": 1 },\r
438
+ "outputRange": { "min": 0, "max": 1 }\r
439
+ }\r
440
+ },\r
441
+ {\r
442
+ "partId": "part-outerGlow",\r
443
+ "suggestedDriverProperty": "state",\r
444
+ "label": "开关状态",\r
445
+ "valueType": "boolean",\r
446
+ "booleanOptions": [\r
447
+ { "value": 0, "label": "关闭" },\r
448
+ { "value": 1, "label": "开启" }\r
449
+ ],\r
450
+ "suggestedTemplate": "value-opacity",\r
451
+ "suggestedParams": {\r
452
+ "type": "value-opacity",\r
453
+ "inputRange": { "min": 0, "max": 1 },\r
454
+ "outputRange": { "min": 0, "max": 0.3 }\r
455
+ }\r
456
+ },\r
457
+ {\r
458
+ "partId": "part-filament",\r
459
+ "suggestedDriverProperty": "state",\r
460
+ "label": "开关状态",\r
461
+ "valueType": "boolean",\r
462
+ "booleanOptions": [\r
463
+ { "value": 0, "label": "关闭" },\r
464
+ { "value": 1, "label": "开启" }\r
465
+ ],\r
466
+ "suggestedTemplate": "value-opacity",\r
467
+ "suggestedParams": {\r
468
+ "type": "value-opacity",\r
469
+ "inputRange": { "min": 0, "max": 1 },\r
470
+ "outputRange": { "min": 0, "max": 0.8 }\r
471
+ }\r
472
+ }\r
473
+ ],\r
474
+ "ports": [\r
475
+ {\r
476
+ "id": "port-power-in",\r
477
+ "group": "bottom"\r
478
+ },\r
479
+ {\r
480
+ "id": "port-control",\r
481
+ "group": "left",\r
482
+ "args": {\r
483
+ "y": "50%"\r
484
+ }\r
485
+ }\r
486
+ ]\r
487
+ }\r
488
+ ]]></scada-config>\r
489
+ </metadata>\r
490
+ \r
491
+ <!-- 渐变定义 -->\r
492
+ <defs>\r
493
+ <!-- 灯泡玻璃渐变(关闭状态) -->\r
494
+ <radialGradient id="bulb-gradient-off" cx="40%" cy="30%">\r
495
+ <stop offset="0%" stop-color="#e5e7eb" />\r
496
+ <stop offset="50%" stop-color="#d1d5db" />\r
497
+ <stop offset="100%" stop-color="#9ca3af" />\r
498
+ </radialGradient>\r
499
+ \r
500
+ <!-- 灯泡玻璃渐变(开启状态) -->\r
501
+ <radialGradient id="bulb-gradient-on" cx="40%" cy="30%">\r
502
+ <stop offset="0%" stop-color="#fff9e6" />\r
503
+ <stop offset="50%" stop-color="#fbbf24" />\r
504
+ <stop offset="100%" stop-color="#d97706" />\r
505
+ </radialGradient>\r
506
+ \r
507
+ <!-- 灯泡底座渐变 -->\r
508
+ <linearGradient id="base-gradient" x1="0%" y1="0%" x2="0%" y2="100%">\r
509
+ <stop offset="0%" stop-color="#94a3b8" />\r
510
+ <stop offset="50%" stop-color="#64748b" />\r
511
+ <stop offset="100%" stop-color="#475569" />\r
512
+ </linearGradient>\r
513
+ \r
514
+ <!-- 光晕滤镜 -->\r
515
+ <filter id="glow-filter">\r
516
+ <feGaussianBlur stdDeviation="3" result="coloredBlur"/>\r
517
+ <feMerge>\r
518
+ <feMergeNode in="coloredBlur"/>\r
519
+ <feMergeNode in="SourceGraphic"/>\r
520
+ </feMerge>\r
521
+ </filter>\r
522
+ \r
523
+ <!-- 外发光滤镜 -->\r
524
+ <filter id="outer-glow-filter">\r
525
+ <feGaussianBlur stdDeviation="5" result="blur"/>\r
526
+ <feFlood flood-color="#fbbf24" flood-opacity="0.6" result="color"/>\r
527
+ <feComposite in="color" in2="blur" operator="in" result="glow"/>\r
528
+ <feMerge>\r
529
+ <feMergeNode in="glow"/>\r
530
+ <feMergeNode in="SourceGraphic"/>\r
531
+ </feMerge>\r
532
+ </filter>\r
533
+ </defs>\r
534
+ \r
535
+ <!-- 组件主体 -->\r
536
+ <g id="root">\r
537
+ <!-- 外发光(根据状态控制透明度) -->\r
538
+ <circle \r
539
+ id="part-outerGlow"\r
540
+ cx="50" \r
541
+ cy="35" \r
542
+ r="32"\r
543
+ fill="#fbbf24"\r
544
+ opacity="0"\r
545
+ filter="url(#outer-glow-filter)"\r
546
+ />\r
547
+ \r
548
+ <!-- 灯泡玻璃球体 -->\r
549
+ <ellipse\r
550
+ cx="50"\r
551
+ cy="35"\r
552
+ rx="25"\r
553
+ ry="28"\r
554
+ fill="url(#bulb-gradient-off)"\r
555
+ stroke="#cbd5e1"\r
556
+ stroke-width="0.5"\r
557
+ />\r
558
+ \r
559
+ <!-- 灯泡发光层(根据状态控制) -->\r
560
+ <ellipse\r
561
+ id="part-bulbGlow"\r
562
+ cx="50"\r
563
+ cy="35"\r
564
+ rx="25"\r
565
+ ry="28"\r
566
+ fill="url(#bulb-gradient-on)"\r
567
+ opacity="0"\r
568
+ filter="url(#glow-filter)"\r
569
+ />\r
570
+ \r
571
+ <!-- 灯泡高光 -->\r
572
+ <ellipse\r
573
+ cx="42"\r
574
+ cy="25"\r
575
+ rx="8"\r
576
+ ry="10"\r
577
+ fill="#ffffff"\r
578
+ opacity="0.3"\r
579
+ />\r
580
+ \r
581
+ <!-- 灯丝(根据状态显示) -->\r
582
+ <g id="part-filament" opacity="0">\r
583
+ <path\r
584
+ d="M 45 30 Q 47 35 45 40"\r
585
+ stroke="#ff9500"\r
586
+ stroke-width="1.5"\r
587
+ fill="none"\r
588
+ />\r
589
+ <path\r
590
+ d="M 55 30 Q 53 35 55 40"\r
591
+ stroke="#ff9500"\r
592
+ stroke-width="1.5"\r
593
+ fill="none"\r
594
+ />\r
595
+ </g>\r
596
+ \r
597
+ <!-- 灯泡底部连接部分 -->\r
598
+ <ellipse\r
599
+ cx="50"\r
600
+ cy="60"\r
601
+ rx="15"\r
602
+ ry="4"\r
603
+ fill="#94a3b8"\r
604
+ />\r
605
+ \r
606
+ <!-- 灯泡螺纹底座 -->\r
607
+ <g>\r
608
+ <!-- 螺纹线条 -->\r
609
+ <rect x="40" y="63" width="20" height="3" fill="url(#base-gradient)" rx="1"/>\r
610
+ <rect x="40" y="67" width="20" height="3" fill="url(#base-gradient)" rx="1"/>\r
611
+ <rect x="40" y="71" width="20" height="3" fill="url(#base-gradient)" rx="1"/>\r
612
+ <rect x="40" y="75" width="20" height="3" fill="url(#base-gradient)" rx="1"/>\r
613
+ \r
614
+ <!-- 螺纹阴影 -->\r
615
+ <rect x="40" y="66" width="20" height="1" fill="#1e293b" opacity="0.3"/>\r
616
+ <rect x="40" y="70" width="20" height="1" fill="#1e293b" opacity="0.3"/>\r
617
+ <rect x="40" y="74" width="20" height="1" fill="#1e293b" opacity="0.3"/>\r
618
+ <rect x="40" y="78" width="20" height="1" fill="#1e293b" opacity="0.3"/>\r
619
+ </g>\r
620
+ \r
621
+ <!-- 底座 -->\r
622
+ <ellipse\r
623
+ cx="50"\r
624
+ cy="80"\r
625
+ rx="12"\r
626
+ ry="5"\r
627
+ fill="url(#base-gradient)"\r
628
+ />\r
629
+ \r
630
+ <!-- 底座底部 -->\r
631
+ <ellipse\r
632
+ cx="50"\r
633
+ cy="83"\r
634
+ rx="8"\r
635
+ ry="3"\r
636
+ fill="#334155"\r
637
+ />\r
638
+ \r
639
+ <!-- 底部接触点 -->\r
640
+ <circle\r
641
+ cx="50"\r
642
+ cy="85"\r
643
+ r="2"\r
644
+ fill="#475569"\r
645
+ />\r
646
+ </g>\r
647
+ </svg>\r
648
+ `,Fv=`<?xml version="1.0" encoding="UTF-8"?>
649
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 120 60">
650
+ <metadata>
651
+ <scada-config><![CDATA[
652
+ {
653
+ "component": {
654
+ "id": "rect",
655
+ "name": "\\u77e9\\u5f62",
656
+ "category": "basic",
657
+ "icon": "\\u25A2",
658
+ "description": "\\u57fa\\u7840\\u77e9\\u5f62\\u56fe\\u5f62\\u7ec4\\u4ef6",
659
+ "version": "1.0.0",
660
+ "author": "SCADA Engine"
661
+ },
662
+ "size": {
663
+ "width": 120,
664
+ "height": 60
665
+ },
666
+ "presetBindings": [
667
+ {
668
+ "partId": "part-label",
669
+ "suggestedDriverProperty": "name",
670
+ "label": "\\u663e\\u793a\\u6587\\u672c",
671
+ "valueType": "string",
672
+ "suggestedTemplate": "value-text",
673
+ "suggestedParams": {
674
+ "type": "value-text",
675
+ "defaultText": "\\u77e9\\u5f62"
676
+ }
677
+ },
678
+ {
679
+ "partId": "part-body",
680
+ "suggestedDriverProperty": "fill",
681
+ "label": "\\u586b\\u5145\\u8272",
682
+ "valueType": "color",
683
+ "suggestedTemplate": "status-color",
684
+ "suggestedParams": {
685
+ "type": "status-color",
686
+ "colorMap": {},
687
+ "defaultColor": "#3b82f6",
688
+ "applyTo": "fill"
689
+ }
690
+ }
691
+ ],
692
+ "ports": [
693
+ { "id": "port-top", "group": "top" },
694
+ { "id": "port-right", "group": "right" },
695
+ { "id": "port-bottom", "group": "bottom" },
696
+ { "id": "port-left", "group": "left" }
697
+ ]
698
+ }
699
+ ]]></scada-config>
700
+ </metadata>
701
+ <defs>
702
+ <linearGradient id="rect-gradient" x1="0%" y1="0%" x2="0%" y2="100%">
703
+ <stop offset="0%" stop-color="#60a5fa" />
704
+ <stop offset="100%" stop-color="#3b82f6" />
705
+ </linearGradient>
706
+ </defs>
707
+ <g id="root">
708
+ <rect
709
+ id="part-body"
710
+ x="10"
711
+ y="10"
712
+ width="100"
713
+ height="40"
714
+ rx="4"
715
+ fill="url(#rect-gradient)"
716
+ stroke="#2563eb"
717
+ stroke-width="2"
718
+ />
719
+ <text
720
+ id="part-label"
721
+ x="60"
722
+ y="30"
723
+ text-anchor="middle"
724
+ dominant-baseline="middle"
725
+ font-size="14"
726
+ fill="#ffffff"
727
+ font-family="system-ui, sans-serif"
728
+ >\\u77e9\\u5f62</text>
729
+ </g>
730
+ </svg>
731
+ `,zv=`<?xml version="1.0" encoding="UTF-8"?>\r
732
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 120 80">\r
733
+ <!-- 组件元数据 -->\r
734
+ <metadata>\r
735
+ <scada-config><![CDATA[\r
736
+ {\r
737
+ "component": {\r
738
+ "id": "switch-toggle",\r
739
+ "name": "拨动开关",\r
740
+ "category": "iot",\r
741
+ "icon": "🔘",\r
742
+ "description": "可控制开关状态的拨动开关组件",\r
743
+ "version": "1.0.0",\r
744
+ "author": "SCADA Engine"\r
745
+ },\r
746
+ "size": {\r
747
+ "width": 140,\r
748
+ "height": 100\r
749
+ },\r
750
+ "presetBindings": [\r
751
+ {\r
752
+ "partId": "part-handle",\r
753
+ "suggestedDriverProperty": "state",\r
754
+ "label": "开关状态",\r
755
+ "valueType": "boolean",\r
756
+ "booleanOptions": [\r
757
+ { "value": 0, "label": "关闭" },\r
758
+ { "value": 1, "label": "开启" }\r
759
+ ],\r
760
+ "suggestedTemplate": "value-position",\r
761
+ "suggestedParams": {\r
762
+ "type": "value-position",\r
763
+ "inputRange": { "min": 0, "max": 1 },\r
764
+ "movement": {\r
765
+ "axis": "x",\r
766
+ "distance": 24\r
767
+ }\r
768
+ }\r
769
+ },\r
770
+ {\r
771
+ "partId": "part-indicatorOff",\r
772
+ "suggestedDriverProperty": "state",\r
773
+ "label": "开关状态",\r
774
+ "valueType": "boolean",\r
775
+ "booleanOptions": [\r
776
+ { "value": 0, "label": "关闭" },\r
777
+ { "value": 1, "label": "开启" }\r
778
+ ],\r
779
+ "suggestedTemplate": "value-opacity",\r
780
+ "suggestedParams": {\r
781
+ "type": "value-opacity",\r
782
+ "inputRange": { "min": 0, "max": 1 },\r
783
+ "outputRange": { "min": 1, "max": 0 }\r
784
+ }\r
785
+ },\r
786
+ {\r
787
+ "partId": "part-indicatorOn",\r
788
+ "suggestedDriverProperty": "state",\r
789
+ "label": "开关状态",\r
790
+ "valueType": "boolean",\r
791
+ "booleanOptions": [\r
792
+ { "value": 0, "label": "关闭" },\r
793
+ { "value": 1, "label": "开启" }\r
794
+ ],\r
795
+ "suggestedTemplate": "value-opacity",\r
796
+ "suggestedParams": {\r
797
+ "type": "value-opacity",\r
798
+ "inputRange": { "min": 0, "max": 1 },\r
799
+ "outputRange": { "min": 0, "max": 1 }\r
800
+ }\r
801
+ }\r
802
+ ],\r
803
+ "ports": [\r
804
+ {\r
805
+ "id": "port-power-in",\r
806
+ "group": "left",\r
807
+ "args": {\r
808
+ "y": "50%"\r
809
+ }\r
810
+ },\r
811
+ {\r
812
+ "id": "port-power-out",\r
813
+ "group": "right",\r
814
+ "args": {\r
815
+ "y": "50%"\r
816
+ }\r
817
+ },\r
818
+ {\r
819
+ "id": "port-control",\r
820
+ "group": "bottom"\r
821
+ }\r
822
+ ]\r
823
+ }\r
824
+ ]]></scada-config>\r
825
+ </metadata>\r
826
+ \r
827
+ <!-- 渐变定义 -->\r
828
+ <defs>\r
829
+ <!-- 开关底座渐变 -->\r
830
+ <linearGradient id="base-gradient-switch" x1="0%" y1="0%" x2="0%" y2="100%">\r
831
+ <stop offset="0%" stop-color="#475569" />\r
832
+ <stop offset="50%" stop-color="#334155" />\r
833
+ <stop offset="100%" stop-color="#1e293b" />\r
834
+ </linearGradient>\r
835
+ \r
836
+ <!-- 开关轨道渐变 -->\r
837
+ <linearGradient id="track-gradient-switch" x1="0%" y1="0%" x2="0%" y2="100%">\r
838
+ <stop offset="0%" stop-color="#1e293b" />\r
839
+ <stop offset="50%" stop-color="#0f172a" />\r
840
+ <stop offset="100%" stop-color="#1e293b" />\r
841
+ </linearGradient>\r
842
+ \r
843
+ <!-- 拨杆渐变 -->\r
844
+ <linearGradient id="handle-gradient-switch" x1="0%" y1="0%" x2="0%" y2="100%">\r
845
+ <stop offset="0%" stop-color="#e2e8f0" />\r
846
+ <stop offset="50%" stop-color="#cbd5e1" />\r
847
+ <stop offset="100%" stop-color="#94a3b8" />\r
848
+ </linearGradient>\r
849
+ \r
850
+ <!-- 指示灯光晕 -->\r
851
+ <filter id="indicator-glow-switch">\r
852
+ <feGaussianBlur stdDeviation="3" result="coloredBlur"/>\r
853
+ <feMerge>\r
854
+ <feMergeNode in="coloredBlur"/>\r
855
+ <feMergeNode in="SourceGraphic"/>\r
856
+ </feMerge>\r
857
+ </filter>\r
858
+ </defs>\r
859
+ \r
860
+ <!-- 组件主体 -->\r
861
+ <g id="root">\r
862
+ <!-- 底座 -->\r
863
+ <rect x="20" y="25" width="80" height="50" rx="8" fill="url(#base-gradient-switch)" stroke="#0f172a" stroke-width="1"/>\r
864
+ \r
865
+ <!-- 固定螺丝 -->\r
866
+ <g>\r
867
+ <circle cx="30" cy="35" r="3" fill="#0f172a"/>\r
868
+ <circle cx="30" cy="35" r="1.5" fill="#475569"/>\r
869
+ <line x1="28" y1="35" x2="32" y2="35" stroke="#1e293b" stroke-width="0.5"/>\r
870
+ \r
871
+ <circle cx="90" cy="35" r="3" fill="#0f172a"/>\r
872
+ <circle cx="90" cy="35" r="1.5" fill="#475569"/>\r
873
+ <line x1="88" y1="35" x2="92" y2="35" stroke="#1e293b" stroke-width="0.5"/>\r
874
+ \r
875
+ <circle cx="30" cy="65" r="3" fill="#0f172a"/>\r
876
+ <circle cx="30" cy="65" r="1.5" fill="#475569"/>\r
877
+ <line x1="28" y1="65" x2="32" y2="65" stroke="#1e293b" stroke-width="0.5"/>\r
878
+ \r
879
+ <circle cx="90" cy="65" r="3" fill="#0f172a"/>\r
880
+ <circle cx="90" cy="65" r="1.5" fill="#475569"/>\r
881
+ <line x1="88" y1="65" x2="92" y2="65" stroke="#1e293b" stroke-width="0.5"/>\r
882
+ </g>\r
883
+ \r
884
+ <!-- 开关轨道槽 -->\r
885
+ <rect x="40" y="38" width="40" height="24" rx="12" fill="url(#track-gradient-switch)" stroke="#0f172a" stroke-width="1"/>\r
886
+ \r
887
+ <!-- OFF标记 -->\r
888
+ <text x="48" y="53" font-size="8" fill="#64748b" text-anchor="middle" font-weight="bold">OFF</text>\r
889
+ \r
890
+ <!-- ON标记 -->\r
891
+ <text x="72" y="53" font-size="8" fill="#64748b" text-anchor="middle" font-weight="bold">ON</text>\r
892
+ \r
893
+ <!-- 拨杆(可移动部分,基准位置 48px,value-position 动画叠加 0~24px) -->\r
894
+ <g transform="translate(48, 0)">\r
895
+ <g id="part-handle">\r
896
+ <!-- 拨杆阴影 -->\r
897
+ <ellipse cx="0" cy="52" rx="10" ry="3" fill="#000" opacity="0.3"/>\r
898
+ \r
899
+ <!-- 拨杆主体 -->\r
900
+ <rect x="-8" y="40" width="16" height="20" rx="8" fill="url(#handle-gradient-switch)" stroke="#94a3b8" stroke-width="1"/>\r
901
+ \r
902
+ <!-- 拨杆纹理 -->\r
903
+ <g opacity="0.3">\r
904
+ <line x1="-4" y1="43" x2="-4" y2="57" stroke="#64748b" stroke-width="0.5"/>\r
905
+ <line x1="0" y1="43" x2="0" y2="57" stroke="#64748b" stroke-width="0.5"/>\r
906
+ <line x1="4" y1="43" x2="4" y2="57" stroke="#64748b" stroke-width="0.5"/>\r
907
+ </g>\r
908
+ \r
909
+ <!-- 拨杆高光 -->\r
910
+ <rect x="-6" y="42" width="4" height="8" rx="2" fill="#ffffff" opacity="0.4"/>\r
911
+ </g>\r
912
+ </g>\r
913
+ \r
914
+ <!-- 状态指示灯 -->\r
915
+ <g>\r
916
+ <!-- OFF指示灯 -->\r
917
+ <g id="part-indicatorOff">\r
918
+ <circle \r
919
+ cx="35" \r
920
+ cy="50" \r
921
+ r="3" \r
922
+ fill="#ef4444"\r
923
+ filter="url(#indicator-glow-switch)"\r
924
+ />\r
925
+ <circle \r
926
+ cx="35" \r
927
+ cy="50" \r
928
+ r="1.5" \r
929
+ fill="#ffffff"\r
930
+ opacity="0.6"\r
931
+ />\r
932
+ </g>\r
933
+ \r
934
+ <!-- ON指示灯 -->\r
935
+ <g id="part-indicatorOn" opacity="0">\r
936
+ <circle \r
937
+ cx="85" \r
938
+ cy="50" \r
939
+ r="3" \r
940
+ fill="#22c55e"\r
941
+ filter="url(#indicator-glow-switch)"\r
942
+ />\r
943
+ <circle \r
944
+ cx="85" \r
945
+ cy="50" \r
946
+ r="1.5" \r
947
+ fill="#ffffff"\r
948
+ opacity="0.6"\r
949
+ />\r
950
+ </g>\r
951
+ </g>\r
952
+ \r
953
+ <!-- 接线端子 -->\r
954
+ <g>\r
955
+ <rect x="15" y="47" width="8" height="6" rx="1" fill="#64748b" stroke="#475569" stroke-width="0.5"/>\r
956
+ <circle cx="19" cy="50" r="1.5" fill="#94a3b8"/>\r
957
+ \r
958
+ <rect x="97" y="47" width="8" height="6" rx="1" fill="#64748b" stroke="#475569" stroke-width="0.5"/>\r
959
+ <circle cx="101" cy="50" r="1.5" fill="#94a3b8"/>\r
960
+ </g>\r
961
+ \r
962
+ <!-- 型号标识 -->\r
963
+ <rect x="50" y="67" width="20" height="6" rx="1" fill="#0f172a" opacity="0.7"/>\r
964
+ <text x="60" y="71" font-size="3" fill="#64748b" text-anchor="middle" font-family="monospace">KCD1-101</text>\r
965
+ </g>\r
966
+ </svg>\r
967
+ `,Wv=`<?xml version="1.0" encoding="UTF-8"?>\r
968
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 120 160">\r
969
+ <!-- 组件元数据 -->\r
970
+ <metadata>\r
971
+ <scada-config><![CDATA[\r
972
+ {\r
973
+ "component": {\r
974
+ "id": "tank-level",\r
975
+ "name": "液位罐",\r
976
+ "category": "iot",\r
977
+ "icon": "🛢️",\r
978
+ "description": "带液位显示的储罐组件",\r
979
+ "version": "1.0.0",\r
980
+ "author": "SCADA Engine"\r
981
+ },\r
982
+ "size": {\r
983
+ "width": 120,\r
984
+ "height": 160\r
985
+ },\r
986
+ "presetBindings": [\r
987
+ {\r
988
+ "partId": "part-liquidFill",\r
989
+ "suggestedDriverProperty": "level",\r
990
+ "label": "液位",\r
991
+ "valueType": "number",\r
992
+ "suggestedTemplate": "level-height",\r
993
+ "suggestedParams": {\r
994
+ "type": "level-height",\r
995
+ "inputRange": { "min": 0, "max": 100 },\r
996
+ "direction": "bottom-up"\r
997
+ }\r
998
+ },\r
999
+ {\r
1000
+ "partId": "part-alarmLight",\r
1001
+ "suggestedDriverProperty": "alarm",\r
1002
+ "label": "报警状态",\r
1003
+ "valueType": "boolean",\r
1004
+ "booleanOptions": [\r
1005
+ { "value": 0, "label": "正常" },\r
1006
+ { "value": 1, "label": "报警" }\r
1007
+ ],\r
1008
+ "suggestedTemplate": "status-color",\r
1009
+ "suggestedParams": {\r
1010
+ "type": "status-color",\r
1011
+ "colorMap": {\r
1012
+ "0": "#10b981",\r
1013
+ "1": "#ef4444",\r
1014
+ "false": "#10b981",\r
1015
+ "true": "#ef4444",\r
1016
+ "normal": "#10b981",\r
1017
+ "alarm": "#ef4444"\r
1018
+ },\r
1019
+ "defaultColor": "#94a3b8",\r
1020
+ "applyTo": "fill"\r
1021
+ }\r
1022
+ }\r
1023
+ ],\r
1024
+ "ports": [\r
1025
+ {\r
1026
+ "id": "port-inlet",\r
1027
+ "group": "top"\r
1028
+ },\r
1029
+ {\r
1030
+ "id": "port-outlet",\r
1031
+ "group": "bottom"\r
1032
+ },\r
1033
+ {\r
1034
+ "id": "port-level-sensor",\r
1035
+ "group": "left",\r
1036
+ "args": {\r
1037
+ "y": "50%"\r
1038
+ }\r
1039
+ },\r
1040
+ {\r
1041
+ "id": "port-control",\r
1042
+ "group": "right",\r
1043
+ "args": {\r
1044
+ "y": "50%"\r
1045
+ }\r
1046
+ }\r
1047
+ ]\r
1048
+ }\r
1049
+ ]]></scada-config>\r
1050
+ </metadata>\r
1051
+ \r
1052
+ <!-- 渐变定义 -->\r
1053
+ <defs>\r
1054
+ <linearGradient id="tank-body-gradient" x1="0%" y1="0%" x2="100%" y2="0%">\r
1055
+ <stop offset="0%" stop-color="#e2e8f0" />\r
1056
+ <stop offset="50%" stop-color="#f8fafc" />\r
1057
+ <stop offset="100%" stop-color="#e2e8f0" />\r
1058
+ </linearGradient>\r
1059
+ <linearGradient id="liquid-gradient" x1="0%" y1="0%" x2="100%" y2="0%">\r
1060
+ <stop offset="0%" stop-color="#3b82f6" />\r
1061
+ <stop offset="50%" stop-color="#60a5fa" />\r
1062
+ <stop offset="100%" stop-color="#3b82f6" />\r
1063
+ </linearGradient>\r
1064
+ </defs>\r
1065
+ \r
1066
+ <!-- 组件主体 -->\r
1067
+ <g id="root">\r
1068
+ <!-- 罐体外壳 -->\r
1069
+ <rect \r
1070
+ x="20" \r
1071
+ y="30" \r
1072
+ width="80" \r
1073
+ height="110" \r
1074
+ rx="4" \r
1075
+ fill="url(#tank-body-gradient)" \r
1076
+ stroke="#64748b" \r
1077
+ stroke-width="3"\r
1078
+ opacity="0.9"\r
1079
+ />\r
1080
+ \r
1081
+ <!-- 液位填充(动态高度) -->\r
1082
+ <rect \r
1083
+ id="part-liquidFill"\r
1084
+ x="23" \r
1085
+ y="33" \r
1086
+ width="74" \r
1087
+ height="104" \r
1088
+ rx="2" \r
1089
+ fill="url(#liquid-gradient)" \r
1090
+ opacity="0.8"\r
1091
+ data-original-height="104"\r
1092
+ data-original-y="33"\r
1093
+ />\r
1094
+ \r
1095
+ <!-- 罐体顶部 -->\r
1096
+ <ellipse \r
1097
+ cx="60" \r
1098
+ cy="30" \r
1099
+ rx="40" \r
1100
+ ry="8" \r
1101
+ fill="#cbd5e1" \r
1102
+ stroke="#64748b" \r
1103
+ stroke-width="2"\r
1104
+ />\r
1105
+ \r
1106
+ <!-- 罐体底部 -->\r
1107
+ <ellipse \r
1108
+ cx="60" \r
1109
+ cy="140" \r
1110
+ rx="40" \r
1111
+ ry="8" \r
1112
+ fill="#94a3b8" \r
1113
+ stroke="#64748b" \r
1114
+ stroke-width="2"\r
1115
+ />\r
1116
+ \r
1117
+ <!-- 管道连接(底部出口) -->\r
1118
+ <rect \r
1119
+ x="55" \r
1120
+ y="145" \r
1121
+ width="10" \r
1122
+ height="15" \r
1123
+ fill="#64748b"\r
1124
+ />\r
1125
+ \r
1126
+ <!-- 刻度线 -->\r
1127
+ <line x1="15" y1="50" x2="20" y2="50" stroke="#64748b" stroke-width="1"/>\r
1128
+ <line x1="15" y1="70" x2="20" y2="70" stroke="#64748b" stroke-width="1"/>\r
1129
+ <line x1="15" y1="90" x2="20" y2="90" stroke="#64748b" stroke-width="1"/>\r
1130
+ <line x1="15" y1="110" x2="20" y2="110" stroke="#64748b" stroke-width="1"/>\r
1131
+ <line x1="15" y1="130" x2="20" y2="130" stroke="#64748b" stroke-width="1"/>\r
1132
+ \r
1133
+ <!-- 报警灯 -->\r
1134
+ <circle \r
1135
+ id="part-alarmLight"\r
1136
+ cx="60" \r
1137
+ cy="15" \r
1138
+ r="8" \r
1139
+ fill="#10b981" \r
1140
+ stroke="#334155" \r
1141
+ stroke-width="2"\r
1142
+ />\r
1143
+ \r
1144
+ <!-- 液位文字背景 -->\r
1145
+ <rect \r
1146
+ x="45" \r
1147
+ y="80" \r
1148
+ width="30" \r
1149
+ height="20" \r
1150
+ rx="2" \r
1151
+ fill="rgba(255,255,255,0.9)" \r
1152
+ stroke="#64748b" \r
1153
+ stroke-width="1"\r
1154
+ />\r
1155
+ \r
1156
+ <!-- 装饰环 -->\r
1157
+ <ellipse \r
1158
+ cx="60" \r
1159
+ cy="60" \r
1160
+ rx="42" \r
1161
+ ry="4" \r
1162
+ fill="none" \r
1163
+ stroke="#94a3b8" \r
1164
+ stroke-width="2"\r
1165
+ opacity="0.5"\r
1166
+ />\r
1167
+ <ellipse \r
1168
+ cx="60" \r
1169
+ cy="110" \r
1170
+ rx="42" \r
1171
+ ry="4" \r
1172
+ fill="none" \r
1173
+ stroke="#94a3b8" \r
1174
+ stroke-width="2"\r
1175
+ opacity="0.5"\r
1176
+ />\r
1177
+ </g>\r
1178
+ </svg>\r
1179
+ `,qv=`<?xml version="1.0" encoding="UTF-8"?>
1180
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 40">
1181
+ <metadata>
1182
+ <scada-config><![CDATA[
1183
+ {
1184
+ "component": {
1185
+ "id": "text",
1186
+ "name": "\\u6587\\u672c",
1187
+ "category": "basic",
1188
+ "icon": "T",
1189
+ "description": "\\u6587\\u672c\\u6807\\u7b7e\\u7ec4\\u4ef6",
1190
+ "version": "1.0.0",
1191
+ "author": "SCADA Engine"
1192
+ },
1193
+ "size": {
1194
+ "width": 100,
1195
+ "height": 40
1196
+ },
1197
+ "presetBindings": [],
1198
+ "ports": [
1199
+ { "id": "port-top", "group": "top" },
1200
+ { "id": "port-right", "group": "right" },
1201
+ { "id": "port-bottom", "group": "bottom" },
1202
+ { "id": "port-left", "group": "left" }
1203
+ ]
1204
+ }
1205
+ ]]></scada-config>
1206
+ </metadata>
1207
+ <g id="root">
1208
+ <rect
1209
+ x="2"
1210
+ y="2"
1211
+ width="96"
1212
+ height="36"
1213
+ rx="2"
1214
+ fill="transparent"
1215
+ stroke="#64748b"
1216
+ stroke-width="1"
1217
+ stroke-dasharray="5 5"
1218
+ />
1219
+ <text
1220
+ id="part-text"
1221
+ x="50"
1222
+ y="24"
1223
+ text-anchor="middle"
1224
+ dominant-baseline="middle"
1225
+ font-size="16"
1226
+ fill="#e2e8f0"
1227
+ font-family="system-ui, sans-serif"
1228
+ >&#25991;&#26412;</text>
1229
+ </g>
1230
+ </svg>
1231
+ `,Gv=`<?xml version="1.0" encoding="UTF-8"?>\r
1232
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 120 120">\r
1233
+ <!-- 组件元数据 -->\r
1234
+ <metadata>\r
1235
+ <scada-config><![CDATA[\r
1236
+ {\r
1237
+ "component": {\r
1238
+ "id": "valve-standard",\r
1239
+ "name": "标准阀门",\r
1240
+ "category": "iot",\r
1241
+ "icon": "🚰",\r
1242
+ "description": "带开度指示的标准阀门组件",\r
1243
+ "version": "1.0.0",\r
1244
+ "author": "SCADA Engine"\r
1245
+ },\r
1246
+ "size": {\r
1247
+ "width": 120,\r
1248
+ "height": 120\r
1249
+ },\r
1250
+ "presetBindings": [\r
1251
+ {\r
1252
+ "partId": "part-valveHandle",\r
1253
+ "suggestedDriverProperty": "opening",\r
1254
+ "label": "阀门开度",\r
1255
+ "valueType": "number",\r
1256
+ "suggestedTemplate": "opening-rotate",\r
1257
+ "suggestedParams": {\r
1258
+ "type": "opening-rotate",\r
1259
+ "inputRange": { "min": 0, "max": 90 },\r
1260
+ "outputRange": { "min": 0, "max": 90 },\r
1261
+ "origin": "center"\r
1262
+ }\r
1263
+ }\r
1264
+ ],\r
1265
+ "ports": [\r
1266
+ {\r
1267
+ "id": "port-inlet",\r
1268
+ "group": "top"\r
1269
+ },\r
1270
+ {\r
1271
+ "id": "port-outlet",\r
1272
+ "group": "bottom"\r
1273
+ },\r
1274
+ {\r
1275
+ "id": "port-control",\r
1276
+ "group": "left",\r
1277
+ "args": {\r
1278
+ "y": "50%"\r
1279
+ }\r
1280
+ },\r
1281
+ {\r
1282
+ "id": "port-feedback",\r
1283
+ "group": "right",\r
1284
+ "args": {\r
1285
+ "y": "50%"\r
1286
+ }\r
1287
+ }\r
1288
+ ]\r
1289
+ }\r
1290
+ ]]></scada-config>\r
1291
+ </metadata>\r
1292
+ \r
1293
+ <!-- 渐变定义 -->\r
1294
+ <defs>\r
1295
+ <linearGradient id="valve-body-gradient" x1="0%" y1="0%" x2="0%" y2="100%">\r
1296
+ <stop offset="0%" stop-color="#64748b" />\r
1297
+ <stop offset="100%" stop-color="#475569" />\r
1298
+ </linearGradient>\r
1299
+ <linearGradient id="valve-handle-gradient" x1="0%" y1="0%" x2="100%" y2="0%">\r
1300
+ <stop offset="0%" stop-color="#94a3b8" />\r
1301
+ <stop offset="100%" stop-color="#64748b" />\r
1302
+ </linearGradient>\r
1303
+ </defs>\r
1304
+ \r
1305
+ <!-- 组件主体 -->\r
1306
+ <g id="root">\r
1307
+ <!-- 阀门主体 -->\r
1308
+ <rect \r
1309
+ x="35" \r
1310
+ y="40" \r
1311
+ width="50" \r
1312
+ height="40" \r
1313
+ rx="4" \r
1314
+ fill="url(#valve-body-gradient)" \r
1315
+ stroke="#334155" \r
1316
+ stroke-width="2"\r
1317
+ />\r
1318
+ \r
1319
+ <!-- 阀门手柄(可旋转部分) -->\r
1320
+ <g id="part-valveHandle">\r
1321
+ <rect \r
1322
+ x="52" \r
1323
+ y="35" \r
1324
+ width="16" \r
1325
+ height="50" \r
1326
+ rx="2" \r
1327
+ fill="url(#valve-handle-gradient)" \r
1328
+ stroke="#334155" \r
1329
+ stroke-width="2"\r
1330
+ />\r
1331
+ <circle cx="60" cy="60" r="6" fill="#475569" stroke="#334155" stroke-width="1"/>\r
1332
+ </g>\r
1333
+ \r
1334
+ <!-- 状态指示灯 -->\r
1335
+ <circle \r
1336
+ id="part-statusIndicator" \r
1337
+ cx="60" \r
1338
+ cy="25" \r
1339
+ r="8" \r
1340
+ fill="#94a3b8" \r
1341
+ stroke="#334155" \r
1342
+ stroke-width="2"\r
1343
+ />\r
1344
+ \r
1345
+ <!-- 管道连接点 -->\r
1346
+ <line x1="60" y1="20" x2="60" y2="0" stroke="#475569" stroke-width="4" stroke-linecap="round"/>\r
1347
+ <line x1="60" y1="100" x2="60" y2="120" stroke="#475569" stroke-width="4" stroke-linecap="round"/>\r
1348
+ \r
1349
+ <!-- 装饰螺栓 -->\r
1350
+ <circle cx="40" cy="50" r="3" fill="#334155"/>\r
1351
+ <circle cx="80" cy="50" r="3" fill="#334155"/>\r
1352
+ <circle cx="40" cy="70" r="3" fill="#334155"/>\r
1353
+ <circle cx="80" cy="70" r="3" fill="#334155"/>\r
1354
+ </g>\r
1355
+ </svg>\r
1356
+ `;async function Hv(){try{const d=Object.assign({"../examples/circle.svg":Lv,"../examples/light-bulb.svg":Uv,"../examples/rect.svg":Fv,"../examples/switch-toggle.svg":zv,"../examples/tank-level.svg":Wv,"../examples/text.svg":qv,"../examples/valve-standard.svg":Gv});let t=0;const r=[];for(const[n,i]of Object.entries(d)){const s=n.split("/").pop()||"unknown.svg";cc.loadFromString(i,s)?t++:r.push(s)}t>0&&console.log(`[SCADA Engine] ✅ 已加载 ${t} 个 SVG 组件`)}catch{console.warn("[SCADA Engine] SVG 组件加载失败,请手动调用 loadExampleSvgComponents()")}}const Kv=Object.freeze(Object.defineProperty({__proto__:null,loadExampleSvgComponents:Hv},Symbol.toStringTag,{value:"Module"}));Te.AttributeConfigDialog=Yi,Te.BasicPropertiesTab=Bn,Te.BindingCard=Ki,Te.CanvasConfigPanel=Pn,Te.ComponentLibrary=Vn,Te.CustomCodeDialog=Ji,Te.DeviceStatus=fc,Te.DeviceType=pc,Te.EventCard=Hi,Te.Header=In,Te.IoTComponents=gd,Te.PointAccessMode=uc,Te.PointDataType=dc,Te.Preview=sc,Te.PropertyPanel=ts,Te.STORAGE_KEYS=yt,Te.ScadaCanvas=ic,Te.animationEngine=Wt,Te.canvasConfigItems=bd,Te.canvasConfigManager=$e,Te.componentRegistry=at,Te.default=jv,Te.defaultCanvasConfig=Tn,Te.exportToJSON=pb,Te.formatTimestamp=mr,Te.generateEventId=Ql,Te.generateNodeId=fb,Te.generateUniqueId=Qi,Te.getCurrentTimestamp=gr,Te.install=hc,Te.loadFromLocal=Xi,Te.randomPosition=Xl,Te.registerNodeEvents=Eb,Te.removeFromLocal=vn,Te.saveToLocal=yr,Te.showMessage=Je,Te.sizePresetMap=vr,Te.svgLoader=cc,Object.defineProperties(Te,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});