@ganwei-web/gw-base-components-plus 1.0.26 → 1.0.28
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.
- package/element-plus-adapter/dist/ElementPlusAdapter.cjs +47 -16
- package/element-plus-adapter/dist/ElementPlusAdapter.cjs.map +1 -1
- package/element-plus-adapter/dist/ElementPlusAdapter.css +15 -4
- package/element-plus-adapter/dist/ElementPlusAdapter.iife.js +47 -16
- package/element-plus-adapter/dist/ElementPlusAdapter.iife.js.map +1 -1
- package/element-plus-adapter/dist/ElementPlusAdapter.js +48 -17
- package/element-plus-adapter/dist/ElementPlusAdapter.js.map +1 -1
- package/equip-list-plus/dist/index.es.js +93 -93
- package/equip-list-plus/dist/index.umd.js +1 -1
- package/equip-list-vue2/dist/index.es.js +147 -119
- package/equip-list-vue3/dist/index.es.js +1214 -1202
- package/equip-list-vue3/dist/index.umd.js +5 -5
- package/equip-select-vue3-java/dist/index.es.js +4723 -0
- package/equip-select-vue3-java/dist/index.umd.js +6 -0
- package/equip-select-vue3-java/dist/style.css +1 -0
- package/equipProcessing/dist/index.es.js +46 -45
- package/equipProcessing/dist/index.umd.js +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
(function(h, F){ typeof exports == "object" && typeof module < "u" ? module.exports = F(require("vue")) : typeof define == "function" && define.amd ? define(["vue"], F) : (h = typeof globalThis < "u" ? globalThis : h || self, h.EquipListVue3 = F(h.Vue)) })(this, function(h){
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)
|
|
5
|
-
}let O = {FRONT: "FRONT", BEHIND: "BEHIND"}, T = {INIT: "INIT", FIXED: "FIXED", DYNAMIC: "DYNAMIC"}, ye = 2, Ve = (function(){ function n(e, t){ Be(this, n), this.init(e, t) }return Re(n, [{key: "init", value: function(t, i){ this.param = t, this.callUpdate = i, this.sizes = new Map, this.firstRangeTotalSize = 0, this.firstRangeAverageSize = 0, this.lastCalcIndex = 0, this.fixedSizeValue = 0, this.calcType = T.INIT, this.offset = 0, this.direction = "", this.range = Object.create(null), t && this.checkRange(0, t.keeps - 1) }}, {key: "destroy", value: function(){ this.init(null, null) }}, {key: "getRange", value: function(){ let t = Object.create(null);return t.start = this.range.start, t.end = this.range.end, t.padFront = this.range.padFront, t.padBehind = this.range.padBehind, t }}, {key: "isBehind", value: function(){ return this.direction === O.BEHIND }}, {key: "isFront", value: function(){ return this.direction === O.FRONT }}, {key: "getOffset", value: function(t){ return(t < 1 ? 0 : this.getIndexOffset(t)) + this.param.slotHeaderSize }}, {key: "updateParam", value: function(t, i){ let o = this;this.param && t in this.param && (t === "uniqueIds" && this.sizes.forEach(function(r, a){ i.includes(a) || o.sizes.delete(a) }), this.param[t] = i) }}, {key: "saveSize", value: function(t, i){ this.sizes.set(t, i), this.calcType === T.INIT ? (this.fixedSizeValue = i, this.calcType = T.FIXED) : this.calcType === T.FIXED && this.fixedSizeValue !== i && (this.calcType = T.DYNAMIC, delete this.fixedSizeValue), this.calcType !== T.FIXED && typeof this.firstRangeTotalSize < "u" && (this.sizes.size < Math.min(this.param.keeps, this.param.uniqueIds.length) ? (this.firstRangeTotalSize = De(this.sizes.values()).reduce(function(o, r){ return o + r }, 0), this.firstRangeAverageSize = Math.round(this.firstRangeTotalSize / this.sizes.size)) : delete this.firstRangeTotalSize) }}, {key: "handleDataSourcesChange", value: function(){ let t = this.range.start;this.isFront() ? t = t - ye : this.isBehind() && (t = t + ye), t = Math.max(t, 0), this.updateRange(this.range.start, this.getEndByStart(t)) }}, {key: "handleSlotSizeChange", value: function(){ this.handleDataSourcesChange() }}, {key: "handleScroll", value: function(t){ this.direction = t < this.offset ? O.FRONT : O.BEHIND, this.offset = t, this.param && (this.direction === O.FRONT ? this.handleFront() : this.direction === O.BEHIND && this.handleBehind()) }}, {key: "handleFront", value: function(){ let t = this.getScrollOvers();if(!(t > this.range.start)){ let i = Math.max(t - this.param.buffer, 0);this.checkRange(i, this.getEndByStart(i)) } }}, {key: "handleBehind", value: function(){ let t = this.getScrollOvers();t < this.range.start + this.param.buffer || this.checkRange(t, this.getEndByStart(t)) }}, {key: "getScrollOvers", value: function(){ let t = this.offset - this.param.slotHeaderSize;if(t <= 0){ return 0; }if(this.isFixedType()){ return Math.floor(t / this.fixedSizeValue); }for(var i = 0, o = 0, r = 0, a = this.param.uniqueIds.length;i <= a;){ if(o = i + Math.floor((a - i) / 2), r = this.getIndexOffset(o), r === t){ return o; }r < t ? i = o + 1 : r > t && (a = o - 1) }return i > 0 ? --i : 0 }}, {key: "getIndexOffset", value: function(t){ if(!t){ return 0; }for(var i = 0, o = 0, r = 0;r < t;r++){ o = this.sizes.get(this.param.uniqueIds[r]), i = i + (typeof o == "number" ? o : this.getEstimateSize()); }return this.lastCalcIndex = Math.max(this.lastCalcIndex, t - 1), this.lastCalcIndex = Math.min(this.lastCalcIndex, this.getLastIndex()), i }}, {key: "isFixedType", value: function(){ return this.calcType === T.FIXED }}, {key: "getLastIndex", value: function(){ return this.param.uniqueIds.length - 1 }}, {key: "checkRange", value: function(t, i){ let o = this.param.keeps, r = this.param.uniqueIds.length;r <= o ? (t = 0, i = this.getLastIndex()) : i - t < o - 1 && (t = i - o + 1), this.range.start !== t && this.updateRange(t, i) }}, {key: "updateRange", value: function(t, i){ this.range.start = t, this.range.end = i, this.range.padFront = this.getPadFront(), this.range.padBehind = this.getPadBehind(), this.callUpdate(this.getRange()) }}, {key: "getEndByStart", value: function(t){ let i = t + this.param.keeps - 1, o = Math.min(i, this.getLastIndex());return o }}, {key: "getPadFront", value: function(){ return this.isFixedType() ? this.fixedSizeValue * this.range.start : this.getIndexOffset(this.range.start) }}, {key: "getPadBehind", value: function(){ let t = this.range.end, i = this.getLastIndex();return this.isFixedType() ? (i - t) * this.fixedSizeValue : this.lastCalcIndex === i ? this.getIndexOffset(i) - this.getIndexOffset(t) : (i - t) * this.getEstimateSize() }}, {key: "getEstimateSize", value: function(){ return this.isFixedType() ? this.fixedSizeValue : this.firstRangeAverageSize || this.param.estimateSize }}]), n })(), Ke = {dataKey: {type: [String, Function], required: !0}, dataSources: {type: Array, required: !0, default: function(){ return[] }}, dataComponent: {type: [Object, Function], required: !0}, keeps: {type: Number, default: 30}, extraProps: {type: Object}, estimateSize: {type: Number, default: 50}, direction: {type: String, default: "vertical"}, start: {type: Number, default: 0}, offset: {type: Number, default: 0}, topThreshold: {type: Number, default: 0}, bottomThreshold: {type: Number, default: 0}, pageMode: {type: Boolean, default: !1}, rootTag: {type: String, default: "div"}, wrapTag: {type: String, default: "div"}, wrapClass: {type: String, default: "wrap"}, wrapStyle: {type: Object}, itemTag: {type: String, default: "div"}, itemClass: {type: String, default: ""}, itemClassAdd: {type: Function}, itemStyle: {type: Object}, headerTag: {type: String, default: "div"}, headerClass: {type: String, default: ""}, headerStyle: {type: Object}, footerTag: {type: String, default: "div"}, footerClass: {type: String, default: ""}, footerStyle: {type: Object}, itemScopedSlots: {type: Object}}, Je = {index: {type: Number}, event: {type: String}, tag: {type: String}, horizontal: {type: Boolean}, source: {type: Object}, component: {type: [Object, Function]}, uniqueKey: {type: [String, Number]}, extraProps: {type: Object}, scopedSlots: {type: Object}}, Xe = {event: {type: String}, uniqueKey: {type: String}, tag: {type: String}, horizontal: {type: Boolean}}, me = function(e, t, i){ let o = null, r = h.computed(function(){ return e.horizontal ? "offsetWidth" : "offsetHeight" }), a = function(){ return t.value ? t.value[r.value] : 0 }, c = function(){ let s = e.event, l = e.uniqueKey, p = e.hasInitial;i(s, l, a(), p) };h.onMounted(function(){ typeof ResizeObserver < "u" && (o = new ResizeObserver(function(){ c() }), t.value && o.observe(t.value)) }), h.onUpdated(function(){ c() }), h.onUnmounted(function(){ o && (o.disconnect(), o = null) }) }, Ye = h.defineComponent({name: "VirtualListItem", props: Je, emits: ["itemResize"], setup: function(e, t){ let i = t.emit, o = h.ref(null);return me(e, o, i), function(){ let r = e.tag, a = e.component, c = e.extraProps, u = c === void 0 ? {} : c, s = e.index, l = e.source, p = e.scopedSlots, g = p === void 0 ? {} : p, R = e.uniqueKey, z = H(H({}, u), {}, {source: l, index: s});return h.createVNode(r, {key: R, ref: o}, {default: function(){ return[h.createVNode(a, H(H({}, z), {}, {scopedSlots: g}), null)] }}) } }}), ve = h.defineComponent({name: "VirtualListSlot", props: Xe, emits: ["slotResize"], setup: function(e, t){ let i = t.slots, o = t.emit, r = h.ref(null);return me(e, r, o), function(){ let a, c = e.tag, u = e.uniqueKey;return h.createVNode(c, {ref: r, key: u}, {default: function(){ return[(a = i.default) === null || a === void 0 ? void 0 : a.call(i)] }}) } }}), G;(function(n){ n.ITEM = "itemResize", n.SLOT = "slotResize" })(G || (G = {}));let I;(function(n){ n.HEADER = "thead", n.FOOTER = "tfoot" })(I || (I = {}));let Qe = h.defineComponent({name: "VirtualList", props: Ke, setup: function(e, t){ let i = t.emit, o = t.slots, r = t.expose, a = e.direction === "horizontal", c = a ? "scrollLeft" : "scrollTop", u = h.ref(null), s = h.ref(), l = h.ref(null), p;h.watch(function(){ return e.dataSources.length }, function(){ p.updateParam("uniqueIds", _e()), p.handleDataSourcesChange() }), h.watch(function(){ return e.keeps }, function(b){ p.updateParam("keeps", b), p.handleSlotSizeChange() }), h.watch(function(){ return e.start }, function(b){ he(b) }), h.watch(function(){ return e.offset }, function(b){ return j(b) });var g = function(f){ return p.sizes.get(f) }, R = function(){ return e.pageMode ? document.documentElement[c] || document.body[c] : s.value ? Math.ceil(s.value[c]) : 0 }, z = function(){ let f = a ? "clientWidth" : "clientHeight";return e.pageMode ? document.documentElement[f] || document.body[f] : s.value ? Math.ceil(s.value[f]) : 0 }, Q = function(){ let f = a ? "scrollWidth" : "scrollHeight";return e.pageMode ? document.documentElement[f] || document.body[f] : s.value ? Math.ceil(s.value[f]) : 0 }, ti = function(f, w, C, k){ i("scroll", k, p.getRange()), p.isFront() && e.dataSources.length && f - e.topThreshold <= 0 ? i("totop") : p.isBehind() && f + w + e.bottomThreshold >= C && i("tobottom") }, le = function(f){ let w = R(), C = z(), k = Q();w < 0 || w + C > k + 1 || !k || (p.handleScroll(w), ti(w, C, k, f)) }, _e = function(){ let f = e.dataKey, w = e.dataSources, C = w === void 0 ? [] : w;return C.map(function(k){ return typeof f == "function" ? f(k) : k[f] }) }, ii = function(f){ u.value = f }, ni = function(){ p = new Ve({slotHeaderSize: 0, slotFooterSize: 0, keeps: e.keeps, estimateSize: e.estimateSize, buffer: Math.round(e.keeps / 3), uniqueIds: _e()}, ii), u.value = p.getRange() }, he = function(f){ if(f >= e.dataSources.length - 1){ Pe(); }else{ let w = p.getOffset(f);j(w) } }, j = function(f){ e.pageMode ? (document.body[c] = f, document.documentElement[c] = f) : s.value && (s.value[c] = f) }, ri = function(){ for(var f = [], w = u.value, C = w.start, k = w.end, de = e.dataSources, _ = e.dataKey, pe = e.itemClass, fe = e.itemTag, ge = e.itemStyle, be = e.extraProps, Z = e.dataComponent, ee = e.itemScopedSlots, E = C;E <= k;E++){ let N = de[E];if(N){ let D = typeof _ == "function" ? _(N) : N[_];typeof D == "string" || typeof D == "number" ? f.push(h.createVNode(Ye, {index: E, tag: fe, event: G.ITEM, horizontal: a, uniqueKey: D, source: N, extraProps: be, component: Z, scopedSlots: ee, style: ge, class: "".concat(pe).concat(e.itemClassAdd ? " " + e.itemClassAdd(E) : ""), onItemResize: oi}, null)) : console.warn("Cannot get the data-key '".concat(_, "' from data-sources.")) }else { console.warn("Cannot get the index '".concat(E, "' from data-sources.")) } }return f }, oi = function(f, w){ p.saveSize(f, w), i("resized", f, w) }, Ge = function(f, w, C){ f === I.HEADER ? p.updateParam("slotHeaderSize", w) : f === I.FOOTER && p.updateParam("slotFooterSize", w), C && p.handleSlotSizeChange() }, Pe = function b(){ if(l.value){ let f = l.value[a ? "offsetLeft" : "offsetTop"];j(f), setTimeout(function(){ R() + z() < Q() && b() }, 3) } }, si = function(){ if(s.value){ let f = s.value.getBoundingClientRect(), w = s.value.ownerDocument.defaultView, C = a ? f.left + w.pageXOffset : f.top + w.pageYOffset;p.updateParam("slotHeaderSize", C) } }, ai = function(){ return p.sizes.size };return h.onBeforeMount(function(){ ni() }), h.onActivated(function(){ j(p.offset) }), h.onMounted(function(){ e.start ? he(e.start) : e.offset && j(e.offset), e.pageMode && (si(), document.addEventListener("scroll", le, {passive: !1})) }), h.onUnmounted(function(){ p.destroy(), e.pageMode && document.removeEventListener("scroll", le) }), r({scrollToBottom: Pe, getSizes: ai, getSize: g, getOffset: R, getScrollSize: Q, getClientSize: z, scrollToOffset: j, scrollToIndex: he}), function(){ let b = e.pageMode, f = e.rootTag, w = e.wrapTag, C = e.wrapClass, k = e.wrapStyle, de = e.headerTag, _ = e.headerClass, pe = e.headerStyle, fe = e.footerTag, ge = e.footerClass, be = e.footerStyle, Z = u.value, ee = Z.padFront, E = Z.padBehind, N = {padding: a ? "0px ".concat(E, "px 0px ").concat(ee, "px") : "".concat(ee, "px 0px ").concat(E, "px")}, D = k ? Object.assign({}, k, N) : N, Ae = o.header, $e = o.footer;return h.createVNode(f, {ref: s, onScroll: !b && le}, {default: function(){ return[Ae && h.createVNode(ve, {class: _, style: pe, tag: de, event: G.SLOT, uniqueKey: I.HEADER, onSlotResize: Ge}, {default: function(){ return[Ae()] }}), h.createVNode(w, {class: C, style: D}, {default: function(){ return[ri()] }}), $e && h.createVNode(ve, {class: ge, style: be, tag: fe, event: G.SLOT, uniqueKey: I.FOOTER, onSlotResize: Ge}, {default: function(){ return[$e()] }}), h.createVNode("div", {ref: l, style: {width: a ? "0px" : "100%", height: a ? "100%" : "0px"}}, null)] }}) } }});class Ze{constructor(e, t, i){ this.groupNodeObject = e, this.nodesMap = t, this.controlObject = i }addNodesMap(e){ e && e.forEach(t=>{ this.nodesMap[t.key] = t }) }removeNodesMap(e){ e && e.forEach(t=>{ delete this.nodesMap[t.key] }) }recycleAllNodeCache(e){ for(let t in this.groupNodeObject){ this.groupNodeObject[t].expand = !1, this.groupNodeObject[t].count = 0, this.recycleGroupCache(this.groupNodeObject[t].key), e && delete this.groupNodeObject[t] } }recycleGroupCache(e){ if(this.groupNodeObject[e]){ this.groupNodeObject[e].children = [], this.removeNodesMap(this.groupNodeObject[e].equips), this.groupNodeObject[e].equips = [], this.groupNodeObject[e].equips.length = 0, this.groupNodeObject[e].expand = !1;for(let t in this.groupNodeObject){ this.groupNodeObject[t].groupId == e && this.recycleGroupCache(this.groupNodeObject[t].key) } } }closeBrotherNode(e){ if(e && this.groupNodeObject[e]){ let t = this.groupNodeObject[e].groupId;for(let i in this.groupNodeObject){ this.groupNodeObject[i].groupId == t && this.groupNodeObject[i].key != e && this.groupNodeObject[i].expand && (this.groupNodeObject[i].expand = !1, this.recycleGroupCache(this.groupNodeObject[i].key)) } } }}class U{constructor(){ this.window = window;try{ window.top.equipGroup, this.window = window.top }catch{ this.window = window } }}const Ce = {data(){ return{window: null} }, created(){ this.window = window;try{ window.top.equipGroup, this.window = window.top }catch{ this.window = window } }};class et extends U{constructor(e, t, i, o, r, a){ super(), this.equipControllObject = i, this.groupNodeObject = e, this.nodesMap = t, this.controlObject = o, this.equipCheckObject = r, this.isSearchStatus = !1, this.searchStatusGroupObject = {}, this.aliasName = a }resetCheckedStatus(){ Object.values(this.nodesMap).forEach(e=>{ this.setCheckStatus(e.key, !1, !1) }), Object.keys(this.equipCheckObject).forEach(e=>delete this.equipCheckObject[e]), this.updateGroupCheckStatus() }reComputedCheckNum(e){ this.isSearchStatus = e, this.updateGroupCheckStatus() }updateCheckedStatusWithEquips(e){ let t = [];Array.isArray(e) ? t = e.map(i=>({equipNo: i, groupId: null})) : e !== null && typeof e == "object" && Object.keys(e).forEach(i=>{ Array.isArray(e[i]) && e[i].forEach(o=>{ t.push({equipNo: o, groupId: Number(i)}) }) });for(let i = 0, o = t.length;i < o;i++){ const{equipNo: r, groupId: a} = t[i];if(a != null){ const c = `${a}-${r}`;this.setEquipCheckObject(c, !0, !1, a), this.setCheckStatus(c, !0, !1), this.updateExpandControlCheckStatus(a, r) }else{ const c = this.window.equipCache && this.window.equipCache[r];c && (c.groupIds || (c.groupId ? [c.groupId] : [])).forEach(s=>{ const l = `${s}-${r}`;this.setEquipCheckObject(l, !0, !1, s), this.setCheckStatus(l, !0, !1), this.updateExpandControlCheckStatus(s, r) }) } } }updateExpandControlCheckStatus(e, t){ let i = this.nodesMap[`${e}-${t}`];i && i.settings && i.settings.length && i.settings.forEach(o=>{ this.nodesMap[`${e}-${t}-${o.setNo}`] && this.setCheckStatus(`${e}-${t}-${o.setNo}`, !0, !1) }) }updateCheckedStatusWithControls(e){ for(let t = 0, i = e.length;t < i;t++){ let o = e[t], r, a, c;if(o !== null && typeof o == "object" && !Array.isArray(o)){ r = o.equipNo, a = o.setNo, c = o.groupId; }else{ let s = o.split(".");r = s[0], a = s[1], c = null }this.equipControllObject[r] || (this.equipControllObject[r] = []), this.equipControllObject[r].push(Number(a));const u = this.window.equipCache && this.window.equipCache[r];u && (c != null ? [c] : u.groupIds || (u.groupId ? [u.groupId] : [])).forEach(l=>{ const p = `${l}-${r}`, g = `${l}-${r}-${a}`;this.nodesMap[g] && this.setCheckStatus(g, !0, !1), this.nodesMap[p] && this.setCheckStatus(p, !1, !0), this.setEquipCheckObject(p, !1, !0, l) }) } }updateGroupCheckStatus(){ this.getSortedGroupsByLevel().forEach(t=>{ const i = this.computeGroupStatus(t.key);this.setCheckStatus(t.key, i.checked, i.indeterminate), t.equipSelectCount = i.selectCount }) }getSortedGroupsByLevel(){ return Object.values(this.groupNodeObject).sort((e, t)=>t.level - e.level) }computeGroupStatus(e){ const t = this.groupNodeObject[e];if(!t){ return{checked: !1, indeterminate: !1, selectCount: 0}; }const i = this.isSearchStatus ? this.window[`group-${e}-search`] || [] : this.window[`group-${e}${this.aliasName}`] || [];let o = 0;i.forEach(p=>{ const g = `${e}-${p.equipNo}`;this.equipCheckObject[g] && this.equipCheckObject[g].checked && o++ });let r = 0, a = 0, c = !1, u = !1;t.groups && t.groups.length > 0 && t.groups.forEach(p=>{ const g = this.nodesMap[p.key];g && (g.checked ? (r += g.count || 0, c = !0) : g.indeterminate ? (u = !0, c = !0) : u = !0, a += g.count || 0) });const s = o + r, l = t.count || 0;return l === 0 ? {checked: !1, indeterminate: !1, selectCount: 0} : s === 0 ? c ? {checked: !1, indeterminate: !0, selectCount: s} : {checked: !1, indeterminate: !1, selectCount: 0} : s === l && !u ? {checked: !0, indeterminate: !1, selectCount: s} : {checked: !1, indeterminate: !0, selectCount: s} }setControlStatus(e, t, i, o){ e && e.forEach(r=>{ this.nodesMap[`${t}-${i}-${r.setNo}`] && this.setCheckStatus(`${t}-${i}-${r.setNo}`, o, !1) }) }updateControlCheckStatus(){ Object.keys(this.controlObject).forEach(e=>{ const[t, i] = e.split("-");let o = this.nodesMap[e];if(o){ if(o.checked){ let r = o.settings;this.setControlStatus(r, t, i, !0) }else if(!o.checked && !o.indeterminate){ let r = o.settings;this.setControlStatus(r, t, i, !1) }else { this.equipControllObject[i] && this.equipControllObject[i].forEach(r=>{ let a = `${t}-${i}-${r}`;this.nodesMap[a] && this.setCheckStatus(a, !0, !1) }) } } }) }getGroupChecked(){ let e = [];return Object.keys(this.groupNodeObject).forEach(t=>{ this.groupNodeObject[t].checked && e.push(t) }), e }getEquipSelectd(){ let e = [], t = new Set;return Object.keys(this.equipCheckObject).forEach(i=>{ if(this.equipCheckObject[i].checked){ try{ t.add(Number(i.split("-")[1])) }catch(o){ console.log(o) } } }), e = Array.from(t), e }getEquipGroupSelectd(){ let e = Object.keys(this.equipCheckObject);return e.length > 0 && (e = this.returnArray(e)), e }returnArray(e){ const t = [];return e.forEach(i=>{ const[o, r] = i.split("-"), a = parseInt(r);isNaN(a) || t.push(a) }), t }parseEquipArrayToGroupFormat(e){ const t = {};return e.forEach(i=>{ const[o, r] = i.split("-"), a = parseInt(o);isNaN(a) || (t[a] || (t[a] = []), t[a].push(parseInt(r))) }), t }getControlSelected(){ let e = [];return Object.keys(this.equipControllObject).forEach(t=>{ e.push(...this.equipControllObject[t].map(i=>`${t}.${i}`)) }), e }onChecked(e, t){ this.isSearchStatus = t || !1, e.isGroup && !e.isEquip ? this.selectGroup(e) : e.isEquip ? this.selectEquip(e) : e.isSetting && this.selectControl(e) }setCheckStatus(e, t, i, o){ this.nodesMap[e] && (this.nodesMap[e].checked = t, this.nodesMap[e].isGroup && (this.nodesMap[e].indeterminate = i)) }setEquipCheckObject(e, t, i, o){ this.equipCheckObject[e] || (this.equipCheckObject[e] = {}), this.equipCheckObject[e].checked = t, this.equipCheckObject[e].indeterminate = i, this.equipCheckObject[e].groupId = o, !t && !i && delete this.equipCheckObject[e] }selectGroup(e){ this.updateAllEquipStatus(e.key, e.checked), this.updateControlCheckStatus(), this.updateGroupCheckStatus() }updateAllEquipStatus(e, t){ const i = this.groupNodeObject[e];if(!i){ return; }(this.isSearchStatus ? this.window[`group-${e}-search`] || [] : this.window[`group-${e}${this.aliasName}`] || []).forEach(r=>{ const a = `${e}-${r.equipNo}`;this.setEquipCheckObject(a, t, !1, e), this.nodesMap[a] && this.setCheckStatus(a, t, !1) }), i.groups && i.groups.length > 0 && i.groups.forEach(r=>{ this.updateAllEquipStatus(r.key, t) }) }selectEquip(e){ const t = `${e.groupId}-${e.equipNo}`;this.setEquipCheckObject(t, e.checked, !1, e.groupId), this.nodesMap[t] && this.setCheckStatus(t, e.checked, !1), this.updateControlCheckStatus(), this.updateGroupCheckStatus() }updateEquipControl(e, t, i){ this.equipControllObject[e] || (this.equipControllObject[e] = []), i ? this.equipControllObject[e].push(t) : this.equipControllObject[e] = this.equipControllObject[e].filter(o=>o != t) }selectControl(e){ const t = `${e.groupId}-${e.equipNo}`, i = `${e.groupId}-${e.equipNo}-${e.setNo}`, o = this.nodesMap[t];if(!o){ return; }this.updateEquipControl(e.equipNo, e.setNo, e.checked), this.setCheckStatus(i, e.checked, !1);const r = o.settings || [], a = this.equipControllObject[e.equipNo] || [], c = r.length, u = a.length;e.checked ? u === c ? (delete this.equipControllObject[e.equipNo], this.setEquipCheckObject(t, !0, !1, e.groupId), this.setCheckStatus(t, !0, !1)) : (this.setEquipCheckObject(t, !1, !0, e.groupId), this.setCheckStatus(t, !1, !0)) : u === 0 ? (this.setEquipCheckObject(t, !1, !1, e.groupId), this.setCheckStatus(t, !1, !1)) : (this.setEquipCheckObject(t, !1, !0, e.groupId), this.setCheckStatus(t, !1, !0)), this.updateGroupCheckStatus() }}class tt extends U{constructor(e, t){ super(), this.aliasName = t, this.groupNodeObject = e }resetGroupNum(e, t, i){ this.clearAllEquipNum();for(let o in this.groupNodeObject){ let r = [];e ? r = this.window[`group-${o}-search`] : r = this.window[`group-${o}${this.aliasName}`], t && r && r.length && (r = r.filter(c=>i[c.equipNo] === 2));let a = r ? r.length : 0;this.groupNodeObject[o].equipCount = a, a && this.setGroupNum(o, a) } }clearAllEquipNum(){ for(let e in this.groupNodeObject){ this.groupNodeObject[e].equipCount = 0, this.groupNodeObject[e].count = 0 } }setGroupNum(e, t){ this.groupNodeObject[e] && (this.groupNodeObject[e].count = Number(this.groupNodeObject[e].count) + Number(t), this.setGroupNum(this.groupNodeObject[e].groupId, t)) }getAllEquipsNum(){ let e = 0;for(let t in this.groupNodeObject){ this.window[`group-${this.groupNodeObject[t].key}${this.aliasName}`] && (e = e + this.window[`group-${this.groupNodeObject[t].key}${this.aliasName}`].length); }return e }}let ie = globalThis && globalThis.__extends || (function(){ let n = Object.setPrototypeOf || {__proto__: []} instanceof Array && function(e, t){ e.__proto__ = t } || function(e, t){ for(let i in t){ t.hasOwnProperty(i) && (e[i] = t[i]) } };return function(e, t){ n(e, t);function i(){ this.constructor = e }e.prototype = t === null ? Object.create(t) : (i.prototype = t.prototype, new i) } })(), P = (function(n){ ie(e, n);function e(t, i){ let o = this.constructor, r = this, a = o.prototype;return r = n.call(this, t) || this, r.statusCode = i, r.__proto__ = a, r }return e })(Error), ne = (function(n){ ie(e, n);function e(t){ let i = this.constructor;t === void 0 && (t = "A timeout occurred.");let o = this, r = i.prototype;return o = n.call(this, t) || this, o.__proto__ = r, o }return e })(Error), W = (function(n){ ie(e, n);function e(t){ let i = this.constructor;t === void 0 && (t = "An abort occurred.");let o = this, r = i.prototype;return o = n.call(this, t) || this, o.__proto__ = r, o }return e })(Error), re = globalThis && globalThis.__assign || Object.assign || function(n){ for(var e, t = 1, i = arguments.length;t < i;t++){ e = arguments[t];for(let o in e){ Object.prototype.hasOwnProperty.call(e, o) && (n[o] = e[o]) } }return n }, ke = (function(){ function n(e, t, i){ this.statusCode = e, this.statusText = t, this.content = i }return n })(), oe = (function(){ function n(){}return n.prototype.get = function(e, t){ return this.send(re({}, t, {method: "GET", url: e})) }, n.prototype.post = function(e, t){ return this.send(re({}, t, {method: "POST", url: e})) }, n.prototype.delete = function(e, t){ return this.send(re({}, t, {method: "DELETE", url: e})) }, n.prototype.getCookieString = function(e){ return"" }, n })(), d;(function(n){ n[n.Trace = 0] = "Trace", n[n.Debug = 1] = "Debug", n[n.Information = 2] = "Information", n[n.Warning = 3] = "Warning", n[n.Error = 4] = "Error", n[n.Critical = 5] = "Critical", n[n.None = 6] = "None" })(d || (d = {}));let se = (function(){ function n(){}return n.prototype.log = function(e, t){}, n.instance = new n, n })(), it = globalThis && globalThis.__awaiter || function(n, e, t, i){ return new(t || (t = Promise))(function(o, r){ function a(s){ try{ u(i.next(s)) }catch(l){ r(l) } }function c(s){ try{ u(i.throw(s)) }catch(l){ r(l) } }function u(s){ s.done ? o(s.value) : new t(function(l){ l(s.value) }).then(a, c) }u((i = i.apply(n, e || [])).next()) }) }, nt = globalThis && globalThis.__generator || function(n, e){ let t = {label: 0, sent: function(){ if(r[0] & 1){ throw r[1]; }return r[1] }, trys: [], ops: []}, i, o, r, a;return a = {next: c(0), throw: c(1), return: c(2)}, typeof Symbol == "function" && (a[Symbol.iterator] = function(){ return this }), a;function c(s){ return function(l){ return u([s, l]) } }function u(s){ if(i){ throw new TypeError("Generator is already executing."); }for(;t;){ try{ if(i = 1, o && (r = s[0] & 2 ? o.return : s[0] ? o.throw || ((r = o.return) && r.call(o), 0) : o.next) && !(r = r.call(o, s[1])).done){ return r; }switch(o = 0, r && (s = [s[0] & 2, r.value]), s[0]){ case 0:case 1:r = s;break;case 4:return t.label++, {value: s[1], done: !1};case 5:t.label++, o = s[1], s = [0];continue;case 7:s = t.ops.pop(), t.trys.pop();continue;default:if(r = t.trys, !(r = r.length > 0 && r[r.length - 1]) && (s[0] === 6 || s[0] === 2)){ t = 0;continue }if(s[0] === 3 && (!r || s[1] > r[0] && s[1] < r[3])){ t.label = s[1];break }if(s[0] === 6 && t.label < r[1]){ t.label = r[1], r = s;break }if(r && t.label < r[2]){ t.label = r[2], t.ops.push(s);break }r[2] && t.ops.pop(), t.trys.pop();continue }s = e.call(n, t) }catch(l){ s = [6, l], o = 0 }finally{ i = r = 0 } }if(s[0] & 5){ throw s[1]; }return{value: s[0] ? s[1] : void 0, done: !0} } }, y = (function(){ function n(){}return n.isRequired = function(e, t){ if(e == null){ throw new Error("The '" + t + "' argument is required.") } }, n.isIn = function(e, t, i){ if(!(e in t)){ throw new Error("Unknown " + i + " value: " + e + ".") } }, n })();function A(n, e){ let t = "";return V(n) ? (t = "Binary data of length " + n.byteLength, e && (t += ". Content: '" + rt(n) + "'")) : typeof n == "string" && (t = "String data of length " + n.length, e && (t += ". Content: '" + n + "'")), t }function rt(n){ let e = new Uint8Array(n), t = "";return e.forEach(function(i){ let o = i < 16 ? "0" : "";t += "0x" + o + i.toString(16) + " " }), t.substr(0, t.length - 1) }function V(n){ return n && typeof ArrayBuffer < "u" && (n instanceof ArrayBuffer || n.constructor && n.constructor.name === "ArrayBuffer") }function Ee(n, e, t, i, o, r, a){ return it(this, void 0, void 0, function(){ let c, u, s, l, p;return nt(this, function(g){ switch(g.label){ case 0:return o ? [4, o()] : [3, 2];case 1:s = g.sent(), s && (u = (c = {}, c.Authorization = "Bearer " + s, c)), g.label = 2;case 2:return n.log(d.Trace, "(" + e + " transport) sending data. " + A(r, a) + "."), l = V(r) ? "arraybuffer" : "text", [4, t.post(i, {content: r, headers: u, responseType: l})];case 3:return p = g.sent(), n.log(d.Trace, "(" + e + " transport) request complete. Response status: " + p.statusCode + "."), [2] } }) }) }function ot(n){ return n === void 0 ? new ae(d.Information) : n === null ? se.instance : n.log ? n : new ae(n) }var st = (function(){ function n(){ this.observers = [] }return n.prototype.next = function(e){ for(let t = 0, i = this.observers;t < i.length;t++){ let o = i[t];o.next(e) } }, n.prototype.error = function(e){ for(let t = 0, i = this.observers;t < i.length;t++){ let o = i[t];o.error && o.error(e) } }, n.prototype.complete = function(){ for(let e = 0, t = this.observers;e < t.length;e++){ let i = t[e];i.complete && i.complete() } }, n.prototype.subscribe = function(e){ return this.observers.push(e), new at(this, e) }, n })(), at = (function(){ function n(e, t){ this.subject = e, this.observer = t }return n.prototype.dispose = function(){ let e = this.subject.observers.indexOf(this.observer);e > -1 && this.subject.observers.splice(e, 1), this.subject.observers.length === 0 && this.subject.cancelCallback && this.subject.cancelCallback().catch(function(t){}) }, n })(), ae = (function(){ function n(e){ this.minimumLogLevel = e }return n.prototype.log = function(e, t){ if(e >= this.minimumLogLevel){ switch(e){ case d.Critical:case d.Error:console.error("[" + new Date().toISOString() + "] " + d[e] + ": " + t);break;case d.Warning:console.warn("[" + new Date().toISOString() + "] " + d[e] + ": " + t);break;case d.Information:console.info("[" + new Date().toISOString() + "] " + d[e] + ": " + t);break;default:console.log("[" + new Date().toISOString() + "] " + d[e] + ": " + t);break } } }, n })(), ut = globalThis && globalThis.__extends || (function(){ let n = Object.setPrototypeOf || {__proto__: []} instanceof Array && function(e, t){ e.__proto__ = t } || function(e, t){ for(let i in t){ t.hasOwnProperty(i) && (e[i] = t[i]) } };return function(e, t){ n(e, t);function i(){ this.constructor = e }e.prototype = t === null ? Object.create(t) : (i.prototype = t.prototype, new i) } })(), ct = globalThis && globalThis.__assign || Object.assign || function(n){ for(var e, t = 1, i = arguments.length;t < i;t++){ e = arguments[t];for(let o in e){ Object.prototype.hasOwnProperty.call(e, o) && (n[o] = e[o]) } }return n }, K;if(typeof XMLHttpRequest > "u"){ let lt = typeof __webpack_require__ == "function" ? __non_webpack_require__ : require;K = lt("request") }let ht = (function(n){ ut(e, n);function e(t){ let i = n.call(this) || this;if(typeof K > "u"){ throw new Error("The 'request' module could not be loaded."); }return i.logger = t, i.cookieJar = K.jar(), i.request = K.defaults({jar: i.cookieJar}), i }return e.prototype.send = function(t){ let i = this;return new Promise(function(o, r){ let a;V(t.content) ? a = Buffer.from(t.content) : a = t.content || "";let c = i.request(t.url, {body: a, encoding: t.responseType === "arraybuffer" ? null : "utf8", headers: ct({"X-Requested-With": "XMLHttpRequest"}, t.headers), method: t.method, timeout: t.timeout}, function(u, s, l){ if(t.abortSignal && (t.abortSignal.onabort = null), u){ u.code === "ETIMEDOUT" && (i.logger.log(d.Warning, "Timeout from HTTP request."), r(new ne)), i.logger.log(d.Warning, "Error from HTTP request. " + u), r(u);return }s.statusCode >= 200 && s.statusCode < 300 ? o(new ke(s.statusCode, s.statusMessage || "", l)) : r(new P(s.statusMessage || "", s.statusCode || 0)) });t.abortSignal && (t.abortSignal.onabort = function(){ c.abort(), r(new W) }) }) }, e.prototype.getCookieString = function(t){ return this.cookieJar.getCookieString(t) }, e })(oe), dt = globalThis && globalThis.__extends || (function(){ let n = Object.setPrototypeOf || {__proto__: []} instanceof Array && function(e, t){ e.__proto__ = t } || function(e, t){ for(let i in t){ t.hasOwnProperty(i) && (e[i] = t[i]) } };return function(e, t){ n(e, t);function i(){ this.constructor = e }e.prototype = t === null ? Object.create(t) : (i.prototype = t.prototype, new i) } })(), pt = (function(n){ dt(e, n);function e(t){ let i = n.call(this) || this;return i.logger = t, i }return e.prototype.send = function(t){ let i = this;return t.abortSignal && t.abortSignal.aborted ? Promise.reject(new W) : t.method ? t.url ? new Promise(function(o, r){ let a = new XMLHttpRequest;a.open(t.method, t.url, !0), a.withCredentials = !0, a.setRequestHeader("X-Requested-With", "XMLHttpRequest"), a.setRequestHeader("Content-Type", "text/plain;charset=UTF-8");let c = t.headers;c && Object.keys(c).forEach(function(u){ a.setRequestHeader(u, c[u]) }), t.responseType && (a.responseType = t.responseType), t.abortSignal && (t.abortSignal.onabort = function(){ a.abort(), r(new W) }), t.timeout && (a.timeout = t.timeout), a.onload = function(){ t.abortSignal && (t.abortSignal.onabort = null), a.status >= 200 && a.status < 300 ? o(new ke(a.status, a.statusText, a.response || a.responseText)) : r(new P(a.statusText, a.status)) }, a.onerror = function(){ i.logger.log(d.Warning, "Error from HTTP request. " + a.status + ": " + a.statusText + "."), r(new P(a.statusText, a.status)) }, a.ontimeout = function(){ i.logger.log(d.Warning, "Timeout from HTTP request."), r(new ne) }, a.send(t.content || "") }) : Promise.reject(new Error("No url defined.")) : Promise.reject(new Error("No method defined.")) }, e })(oe), ft = globalThis && globalThis.__extends || (function(){ let n = Object.setPrototypeOf || {__proto__: []} instanceof Array && function(e, t){ e.__proto__ = t } || function(e, t){ for(let i in t){ t.hasOwnProperty(i) && (e[i] = t[i]) } };return function(e, t){ n(e, t);function i(){ this.constructor = e }e.prototype = t === null ? Object.create(t) : (i.prototype = t.prototype, new i) } })(), gt = (function(n){ ft(e, n);function e(t){ let i = n.call(this) || this;return typeof XMLHttpRequest < "u" ? i.httpClient = new pt(t) : i.httpClient = new ht(t), i }return e.prototype.send = function(t){ return t.abortSignal && t.abortSignal.aborted ? Promise.reject(new W) : t.method ? t.url ? this.httpClient.send(t) : Promise.reject(new Error("No url defined.")) : Promise.reject(new Error("No method defined.")) }, e.prototype.getCookieString = function(t){ return this.httpClient.getCookieString(t) }, e })(oe), M = (function(){ function n(){}return n.write = function(e){ return"" + e + n.RecordSeparator }, n.parse = function(e){ if(e[e.length - 1] !== n.RecordSeparator){ throw new Error("Message is incomplete."); }let t = e.split(n.RecordSeparator);return t.pop(), t }, n.RecordSeparatorCode = 30, n.RecordSeparator = String.fromCharCode(n.RecordSeparatorCode), n })(), bt = (function(){ function n(){}return n.prototype.writeHandshakeRequest = function(e){ return M.write(JSON.stringify(e)) }, n.prototype.parseHandshakeResponse = function(e){ let t, i, o;if(V(e) || typeof Buffer < "u" && e instanceof Buffer){ var r = new Uint8Array(e), a = r.indexOf(M.RecordSeparatorCode);if(a === -1){ throw new Error("Message is incomplete."); }var c = a + 1;i = String.fromCharCode.apply(null, r.slice(0, c)), o = r.byteLength > c ? r.slice(c).buffer : null }else{ var u = e, a = u.indexOf(M.RecordSeparator);if(a === -1){ throw new Error("Message is incomplete."); }var c = a + 1;i = u.substring(0, c), o = u.length > c ? u.substring(c) : null }let s = M.parse(i), l = JSON.parse(s[0]);if(l.type){ throw new Error("Expected a handshake response from the server."); }return t = l, [o, t] }, n })(), S;(function(n){ n[n.Invocation = 1] = "Invocation", n[n.StreamItem = 2] = "StreamItem", n[n.Completion = 3] = "Completion", n[n.StreamInvocation = 4] = "StreamInvocation", n[n.CancelInvocation = 5] = "CancelInvocation", n[n.Ping = 6] = "Ping", n[n.Close = 7] = "Close" })(S || (S = {}));let qe = globalThis && globalThis.__awaiter || function(n, e, t, i){ return new(t || (t = Promise))(function(o, r){ function a(s){ try{ u(i.next(s)) }catch(l){ r(l) } }function c(s){ try{ u(i.throw(s)) }catch(l){ r(l) } }function u(s){ s.done ? o(s.value) : new t(function(l){ l(s.value) }).then(a, c) }u((i = i.apply(n, e || [])).next()) }) }, Te = globalThis && globalThis.__generator || function(n, e){ let t = {label: 0, sent: function(){ if(r[0] & 1){ throw r[1]; }return r[1] }, trys: [], ops: []}, i, o, r, a;return a = {next: c(0), throw: c(1), return: c(2)}, typeof Symbol == "function" && (a[Symbol.iterator] = function(){ return this }), a;function c(s){ return function(l){ return u([s, l]) } }function u(s){ if(i){ throw new TypeError("Generator is already executing."); }for(;t;){ try{ if(i = 1, o && (r = s[0] & 2 ? o.return : s[0] ? o.throw || ((r = o.return) && r.call(o), 0) : o.next) && !(r = r.call(o, s[1])).done){ return r; }switch(o = 0, r && (s = [s[0] & 2, r.value]), s[0]){ case 0:case 1:r = s;break;case 4:return t.label++, {value: s[1], done: !1};case 5:t.label++, o = s[1], s = [0];continue;case 7:s = t.ops.pop(), t.trys.pop();continue;default:if(r = t.trys, !(r = r.length > 0 && r[r.length - 1]) && (s[0] === 6 || s[0] === 2)){ t = 0;continue }if(s[0] === 3 && (!r || s[1] > r[0] && s[1] < r[3])){ t.label = s[1];break }if(s[0] === 6 && t.label < r[1]){ t.label = r[1], r = s;break }if(r && t.label < r[2]){ t.label = r[2], t.ops.push(s);break }r[2] && t.ops.pop(), t.trys.pop();continue }s = e.call(n, t) }catch(l){ s = [6, l], o = 0 }finally{ i = r = 0 } }if(s[0] & 5){ throw s[1]; }return{value: s[0] ? s[1] : void 0, done: !0} } }, wt = 30 * 1e3, St = 15 * 1e3, x;(function(n){ n[n.Disconnected = 0] = "Disconnected", n[n.Connected = 1] = "Connected" })(x || (x = {}));let yt = (function(){ function n(e, t, i){ let o = this;y.isRequired(e, "connection"), y.isRequired(t, "logger"), y.isRequired(i, "protocol"), this.serverTimeoutInMilliseconds = wt, this.keepAliveIntervalInMilliseconds = St, this.logger = t, this.protocol = i, this.connection = e, this.handshakeProtocol = new bt, this.connection.onreceive = function(r){ return o.processIncomingData(r) }, this.connection.onclose = function(r){ return o.connectionClosed(r) }, this.callbacks = {}, this.methods = {}, this.closedCallbacks = [], this.id = 0, this.receivedHandshakeResponse = !1, this.connectionState = x.Disconnected, this.cachedPingMessage = this.protocol.writeMessage({type: S.Ping}) }return n.create = function(e, t, i){ return new n(e, t, i) }, Object.defineProperty(n.prototype, "state", {get: function(){ return this.connectionState }, enumerable: !0, configurable: !0}), n.prototype.start = function(){ return qe(this, void 0, void 0, function(){ let e, t, i = this;return Te(this, function(o){ switch(o.label){ case 0:return e = {protocol: this.protocol.name, version: this.protocol.version}, this.logger.log(d.Debug, "Starting HubConnection."), this.receivedHandshakeResponse = !1, t = new Promise(function(r, a){ i.handshakeResolver = r, i.handshakeRejecter = a }), [4, this.connection.start(this.protocol.transferFormat)];case 1:return o.sent(), this.logger.log(d.Debug, "Sending handshake request."), [4, this.sendMessage(this.handshakeProtocol.writeHandshakeRequest(e))];case 2:return o.sent(), this.logger.log(d.Information, "Using HubProtocol '" + this.protocol.name + "'."), this.cleanupTimeout(), this.resetTimeoutPeriod(), this.resetKeepAliveInterval(), [4, t];case 3:return o.sent(), this.connectionState = x.Connected, [2] } }) }) }, n.prototype.stop = function(){ return this.logger.log(d.Debug, "Stopping HubConnection."), this.cleanupTimeout(), this.cleanupPingTimer(), this.connection.stop() }, n.prototype.stream = function(e){ for(var t = this, i = [], o = 1;o < arguments.length;o++){ i[o - 1] = arguments[o]; }let r = this.createStreamInvocation(e, i), a, c = new st;c.cancelCallback = function(){ let s = t.createCancelInvocation(r.invocationId), l = t.protocol.writeMessage(s);return delete t.callbacks[r.invocationId], a.then(function(){ return t.sendMessage(l) }) }, this.callbacks[r.invocationId] = function(s, l){ if(l){ c.error(l);return }s && (s.type === S.Completion ? s.error ? c.error(new Error(s.error)) : c.complete() : c.next(s.item)) };let u = this.protocol.writeMessage(r);return a = this.sendMessage(u).catch(function(s){ c.error(s), delete t.callbacks[r.invocationId] }), c }, n.prototype.sendMessage = function(e){ return this.resetKeepAliveInterval(), this.connection.send(e) }, n.prototype.send = function(e){ for(var t = [], i = 1;i < arguments.length;i++){ t[i - 1] = arguments[i]; }let o = this.createInvocation(e, t, !0), r = this.protocol.writeMessage(o);return this.sendMessage(r) }, n.prototype.invoke = function(e){ for(var t = this, i = [], o = 1;o < arguments.length;o++){ i[o - 1] = arguments[o]; }let r = this.createInvocation(e, i, !1), a = new Promise(function(c, u){ t.callbacks[r.invocationId] = function(l, p){ if(p){ u(p);return }l && (l.type === S.Completion ? l.error ? u(new Error(l.error)) : c(l.result) : u(new Error("Unexpected message type: " + l.type))) };let s = t.protocol.writeMessage(r);t.sendMessage(s).catch(function(l){ u(l), delete t.callbacks[r.invocationId] }) });return a }, n.prototype.on = function(e, t){ !e || !t || (e = e.toLowerCase(), this.methods[e] || (this.methods[e] = []), this.methods[e].indexOf(t) === -1 && this.methods[e].push(t)) }, n.prototype.off = function(e, t){ if(e){ e = e.toLowerCase();let i = this.methods[e];if(i){ if(t){ let o = i.indexOf(t);o !== -1 && (i.splice(o, 1), i.length === 0 && delete this.methods[e]) }else { delete this.methods[e] } } } }, n.prototype.onclose = function(e){ e && this.closedCallbacks.push(e) }, n.prototype.processIncomingData = function(e){ if(this.cleanupTimeout(), this.receivedHandshakeResponse || (e = this.processHandshakeResponse(e), this.receivedHandshakeResponse = !0), e){ for(let t = this.protocol.parseMessages(e, this.logger), i = 0, o = t;i < o.length;i++){ let r = o[i];switch(r.type){ case S.Invocation:this.invokeClientMethod(r);break;case S.StreamItem:case S.Completion:var a = this.callbacks[r.invocationId];a != null && (r.type === S.Completion && delete this.callbacks[r.invocationId], a(r));break;case S.Ping:break;case S.Close:this.logger.log(d.Information, "Close message received from server."), this.connection.stop(r.error ? new Error("Server returned an error on close: " + r.error) : void 0);break;default:this.logger.log(d.Warning, "Invalid message type: " + r.type + ".");break } } }this.resetTimeoutPeriod() }, n.prototype.processHandshakeResponse = function(e){ let t, i, o;try{ t = this.handshakeProtocol.parseHandshakeResponse(e), o = t[0], i = t[1] }catch(c){ var r = "Error parsing handshake response: " + c;this.logger.log(d.Error, r);let a = new Error(r);throw this.connection.stop(a), this.handshakeRejecter(a), a }if(i.error){ var r = "Server returned handshake error: " + i.error;throw this.logger.log(d.Error, r), this.handshakeRejecter(r), this.connection.stop(new Error(r)), new Error(r) }else { this.logger.log(d.Debug, "Server handshake complete."); }return this.handshakeResolver(), o }, n.prototype.resetKeepAliveInterval = function(){ let e = this;this.cleanupPingTimer(), this.pingServerHandle = setTimeout(function(){ return qe(e, void 0, void 0, function(){ return Te(this, function(t){ switch(t.label){ case 0:if(this.connectionState !== x.Connected){ return[3, 4]; }t.label = 1;case 1:return t.trys.push([1, 3,, 4]), [4, this.sendMessage(this.cachedPingMessage)];case 2:return t.sent(), [3, 4];case 3:return t.sent(), this.cleanupPingTimer(), [3, 4];case 4:return[2] } }) }) }, this.keepAliveIntervalInMilliseconds) }, n.prototype.resetTimeoutPeriod = function(){ let e = this;(!this.connection.features || !this.connection.features.inherentKeepAlive) && (this.timeoutHandle = setTimeout(function(){ return e.serverTimeout() }, this.serverTimeoutInMilliseconds)) }, n.prototype.serverTimeout = function(){ this.connection.stop(new Error("Server timeout elapsed without receiving a message from the server.")) }, n.prototype.invokeClientMethod = function(e){ let t = this, i = this.methods[e.target.toLowerCase()];if(i){ if(i.forEach(function(r){ return r.apply(t, e.arguments) }), e.invocationId){ let o = "Server requested a response, which is not supported in this version of the client.";this.logger.log(d.Error, o), this.connection.stop(new Error(o)) } }else { this.logger.log(d.Warning, "No client method with the name '" + e.target + "' found.") } }, n.prototype.connectionClosed = function(e){ let t = this, i = this.callbacks;this.callbacks = {}, this.connectionState = x.Disconnected, this.handshakeRejecter && this.handshakeRejecter(e), Object.keys(i).forEach(function(o){ let r = i[o];r(null, e || new Error("Invocation canceled due to connection being closed.")) }), this.cleanupTimeout(), this.cleanupPingTimer(), this.closedCallbacks.forEach(function(o){ return o.apply(t, [e]) }) }, n.prototype.cleanupPingTimer = function(){ this.pingServerHandle && clearTimeout(this.pingServerHandle) }, n.prototype.cleanupTimeout = function(){ this.timeoutHandle && clearTimeout(this.timeoutHandle) }, n.prototype.createInvocation = function(e, t, i){ if(i){ return{arguments: t, target: e, type: S.Invocation}; }let o = this.id;return this.id++, {arguments: t, invocationId: o.toString(), target: e, type: S.Invocation} }, n.prototype.createStreamInvocation = function(e, t){ let i = this.id;return this.id++, {arguments: t, invocationId: i.toString(), target: e, type: S.StreamInvocation} }, n.prototype.createCancelInvocation = function(e){ return{invocationId: e, type: S.CancelInvocation} }, n })(), m;(function(n){ n[n.None = 0] = "None", n[n.WebSockets = 1] = "WebSockets", n[n.ServerSentEvents = 2] = "ServerSentEvents", n[n.LongPolling = 4] = "LongPolling" })(m || (m = {}));let v;(function(n){ n[n.Text = 1] = "Text", n[n.Binary = 2] = "Binary" })(v || (v = {}));let mt = (function(){ function n(){ this.isAborted = !1, this.onabort = null }return n.prototype.abort = function(){ this.isAborted || (this.isAborted = !0, this.onabort && this.onabort()) }, Object.defineProperty(n.prototype, "signal", {get: function(){ return this }, enumerable: !0, configurable: !0}), Object.defineProperty(n.prototype, "aborted", {get: function(){ return this.isAborted }, enumerable: !0, configurable: !0}), n })(), $ = globalThis && globalThis.__awaiter || function(n, e, t, i){ return new(t || (t = Promise))(function(o, r){ function a(s){ try{ u(i.next(s)) }catch(l){ r(l) } }function c(s){ try{ u(i.throw(s)) }catch(l){ r(l) } }function u(s){ s.done ? o(s.value) : new t(function(l){ l(s.value) }).then(a, c) }u((i = i.apply(n, e || [])).next()) }) }, L = globalThis && globalThis.__generator || function(n, e){ let t = {label: 0, sent: function(){ if(r[0] & 1){ throw r[1]; }return r[1] }, trys: [], ops: []}, i, o, r, a;return a = {next: c(0), throw: c(1), return: c(2)}, typeof Symbol == "function" && (a[Symbol.iterator] = function(){ return this }), a;function c(s){ return function(l){ return u([s, l]) } }function u(s){ if(i){ throw new TypeError("Generator is already executing."); }for(;t;){ try{ if(i = 1, o && (r = s[0] & 2 ? o.return : s[0] ? o.throw || ((r = o.return) && r.call(o), 0) : o.next) && !(r = r.call(o, s[1])).done){ return r; }switch(o = 0, r && (s = [s[0] & 2, r.value]), s[0]){ case 0:case 1:r = s;break;case 4:return t.label++, {value: s[1], done: !1};case 5:t.label++, o = s[1], s = [0];continue;case 7:s = t.ops.pop(), t.trys.pop();continue;default:if(r = t.trys, !(r = r.length > 0 && r[r.length - 1]) && (s[0] === 6 || s[0] === 2)){ t = 0;continue }if(s[0] === 3 && (!r || s[1] > r[0] && s[1] < r[3])){ t.label = s[1];break }if(s[0] === 6 && t.label < r[1]){ t.label = r[1], r = s;break }if(r && t.label < r[2]){ t.label = r[2], t.ops.push(s);break }r[2] && t.ops.pop(), t.trys.pop();continue }s = e.call(n, t) }catch(l){ s = [6, l], o = 0 }finally{ i = r = 0 } }if(s[0] & 5){ throw s[1]; }return{value: s[0] ? s[1] : void 0, done: !0} } }, Ne = (function(){ function n(e, t, i, o){ this.httpClient = e, this.accessTokenFactory = t, this.logger = i, this.pollAbort = new mt, this.logMessageContent = o, this.running = !1, this.onreceive = null, this.onclose = null }return Object.defineProperty(n.prototype, "pollAborted", {get: function(){ return this.pollAbort.aborted }, enumerable: !0, configurable: !0}), n.prototype.connect = function(e, t){ return $(this, void 0, void 0, function(){ let i, o, r, a;return L(this, function(c){ switch(c.label){ case 0:if(y.isRequired(e, "url"), y.isRequired(t, "transferFormat"), y.isIn(t, v, "transferFormat"), this.url = e, this.logger.log(d.Trace, "(LongPolling transport) Connecting."), t === v.Binary && typeof XMLHttpRequest < "u" && typeof new XMLHttpRequest().responseType != "string"){ throw new Error("Binary protocols over XmlHttpRequest not implementing advanced features are not supported."); }return i = {abortSignal: this.pollAbort.signal, headers: {}, timeout: 1e5}, t === v.Binary && (i.responseType = "arraybuffer"), [4, this.getAccessToken()];case 1:return o = c.sent(), this.updateHeaderToken(i, o), r = e + "&_=" + Date.now(), this.logger.log(d.Trace, "(LongPolling transport) polling: " + r + "."), [4, this.httpClient.get(r, i)];case 2:return a = c.sent(), a.statusCode !== 200 ? (this.logger.log(d.Error, "(LongPolling transport) Unexpected response code: " + a.statusCode + "."), this.closeError = new P(a.statusText || "", a.statusCode), this.running = !1) : this.running = !0, this.receiving = this.poll(this.url, i), [2] } }) }) }, n.prototype.getAccessToken = function(){ return $(this, void 0, void 0, function(){ return L(this, function(e){ switch(e.label){ case 0:return this.accessTokenFactory ? [4, this.accessTokenFactory()] : [3, 2];case 1:return[2, e.sent()];case 2:return[2, null] } }) }) }, n.prototype.updateHeaderToken = function(e, t){ if(e.headers || (e.headers = {}), t){ e.headers.Authorization = "Bearer " + t;return }e.headers.Authorization && delete e.headers.Authorization }, n.prototype.poll = function(e, t){ return $(this, void 0, void 0, function(){ let i, o, r, a;return L(this, function(c){ switch(c.label){ case 0:c.trys.push([0,, 8, 9]), c.label = 1;case 1:return this.running ? [4, this.getAccessToken()] : [3, 7];case 2:i = c.sent(), this.updateHeaderToken(t, i), c.label = 3;case 3:return c.trys.push([3, 5,, 6]), o = e + "&_=" + Date.now(), this.logger.log(d.Trace, "(LongPolling transport) polling: " + o + "."), [4, this.httpClient.get(o, t)];case 4:return r = c.sent(), r.statusCode === 204 ? (this.logger.log(d.Information, "(LongPolling transport) Poll terminated by server."), this.running = !1) : r.statusCode !== 200 ? (this.logger.log(d.Error, "(LongPolling transport) Unexpected response code: " + r.statusCode + "."), this.closeError = new P(r.statusText || "", r.statusCode), this.running = !1) : r.content ? (this.logger.log(d.Trace, "(LongPolling transport) data received. " + A(r.content, this.logMessageContent) + "."), this.onreceive && this.onreceive(r.content)) : this.logger.log(d.Trace, "(LongPolling transport) Poll timed out, reissuing."), [3, 6];case 5:return a = c.sent(), this.running ? a instanceof ne ? this.logger.log(d.Trace, "(LongPolling transport) Poll timed out, reissuing.") : (this.closeError = a, this.running = !1) : this.logger.log(d.Trace, "(LongPolling transport) Poll errored after shutdown: " + a.message), [3, 6];case 6:return[3, 1];case 7:return[3, 9];case 8:return this.logger.log(d.Trace, "(LongPolling transport) Polling complete."), this.pollAborted || this.raiseOnClose(), [7];case 9:return[2] } }) }) }, n.prototype.send = function(e){ return $(this, void 0, void 0, function(){ return L(this, function(t){ return this.running ? [2, Ee(this.logger, "LongPolling", this.httpClient, this.url, this.accessTokenFactory, e, this.logMessageContent)] : [2, Promise.reject(new Error("Cannot send until the transport is connected"))] }) }) }, n.prototype.stop = function(){ return $(this, void 0, void 0, function(){ let e, t;return L(this, function(i){ switch(i.label){ case 0:this.logger.log(d.Trace, "(LongPolling transport) Stopping polling."), this.running = !1, this.pollAbort.abort(), i.label = 1;case 1:return i.trys.push([1,, 5, 6]), [4, this.receiving];case 2:return i.sent(), this.logger.log(d.Trace, "(LongPolling transport) sending DELETE request to " + this.url + "."), e = {headers: {}}, [4, this.getAccessToken()];case 3:return t = i.sent(), this.updateHeaderToken(e, t), [4, this.httpClient.delete(this.url, e)];case 4:return i.sent(), this.logger.log(d.Trace, "(LongPolling transport) DELETE request sent."), [3, 6];case 5:return this.logger.log(d.Trace, "(LongPolling transport) Stop finished."), this.raiseOnClose(), [7];case 6:return[2] } }) }) }, n.prototype.raiseOnClose = function(){ if(this.onclose){ let e = "(LongPolling transport) Firing onclose event.";this.closeError && (e += " Error: " + this.closeError), this.logger.log(d.Trace, e), this.onclose(this.closeError) } }, n })(), Oe = globalThis && globalThis.__awaiter || function(n, e, t, i){ return new(t || (t = Promise))(function(o, r){ function a(s){ try{ u(i.next(s)) }catch(l){ r(l) } }function c(s){ try{ u(i.throw(s)) }catch(l){ r(l) } }function u(s){ s.done ? o(s.value) : new t(function(l){ l(s.value) }).then(a, c) }u((i = i.apply(n, e || [])).next()) }) }, Ie = globalThis && globalThis.__generator || function(n, e){ let t = {label: 0, sent: function(){ if(r[0] & 1){ throw r[1]; }return r[1] }, trys: [], ops: []}, i, o, r, a;return a = {next: c(0), throw: c(1), return: c(2)}, typeof Symbol == "function" && (a[Symbol.iterator] = function(){ return this }), a;function c(s){ return function(l){ return u([s, l]) } }function u(s){ if(i){ throw new TypeError("Generator is already executing."); }for(;t;){ try{ if(i = 1, o && (r = s[0] & 2 ? o.return : s[0] ? o.throw || ((r = o.return) && r.call(o), 0) : o.next) && !(r = r.call(o, s[1])).done){ return r; }switch(o = 0, r && (s = [s[0] & 2, r.value]), s[0]){ case 0:case 1:r = s;break;case 4:return t.label++, {value: s[1], done: !1};case 5:t.label++, o = s[1], s = [0];continue;case 7:s = t.ops.pop(), t.trys.pop();continue;default:if(r = t.trys, !(r = r.length > 0 && r[r.length - 1]) && (s[0] === 6 || s[0] === 2)){ t = 0;continue }if(s[0] === 3 && (!r || s[1] > r[0] && s[1] < r[3])){ t.label = s[1];break }if(s[0] === 6 && t.label < r[1]){ t.label = r[1], r = s;break }if(r && t.label < r[2]){ t.label = r[2], t.ops.push(s);break }r[2] && t.ops.pop(), t.trys.pop();continue }s = e.call(n, t) }catch(l){ s = [6, l], o = 0 }finally{ i = r = 0 } }if(s[0] & 5){ throw s[1]; }return{value: s[0] ? s[1] : void 0, done: !0} } }, vt = (function(){ function n(e, t, i, o, r){ this.httpClient = e, this.accessTokenFactory = t, this.logger = i, this.logMessageContent = o, this.eventSourceConstructor = r, this.onreceive = null, this.onclose = null }return n.prototype.connect = function(e, t){ return Oe(this, void 0, void 0, function(){ let i, o = this;return Ie(this, function(r){ switch(r.label){ case 0:return y.isRequired(e, "url"), y.isRequired(t, "transferFormat"), y.isIn(t, v, "transferFormat"), this.logger.log(d.Trace, "(SSE transport) Connecting."), this.url = e, this.accessTokenFactory ? [4, this.accessTokenFactory()] : [3, 2];case 1:i = r.sent(), i && (e += (e.indexOf("?") < 0 ? "?" : "&") + ("access_token=" + encodeURIComponent(i))), r.label = 2;case 2:return[2, new Promise(function(a, c){ let u = !1;if(t !== v.Text){ c(new Error("The Server-Sent Events transport only supports the 'Text' transfer format"));return }let s;if(typeof window < "u"){ s = new o.eventSourceConstructor(e, {withCredentials: !0}); }else{ let l = o.httpClient.getCookieString(e);s = new o.eventSourceConstructor(e, {withCredentials: !0, headers: {Cookie: l}}) }try{ s.onmessage = function(p){ if(o.onreceive){ try{ o.logger.log(d.Trace, "(SSE transport) data received. " + A(p.data, o.logMessageContent) + "."), o.onreceive(p.data) }catch(g){ o.close(g);return } } }, s.onerror = function(p){ let g = new Error(p.data || "Error occurred");u ? o.close(g) : c(g) }, s.onopen = function(){ o.logger.log(d.Information, "SSE connected to " + o.url), o.eventSource = s, u = !0, a() } }catch(p){ c(p);return } })] } }) }) }, n.prototype.send = function(e){ return Oe(this, void 0, void 0, function(){ return Ie(this, function(t){ return this.eventSource ? [2, Ee(this.logger, "SSE", this.httpClient, this.url, this.accessTokenFactory, e, this.logMessageContent)] : [2, Promise.reject(new Error("Cannot send until the transport is connected"))] }) }) }, n.prototype.stop = function(){ return this.close(), Promise.resolve() }, n.prototype.close = function(e){ this.eventSource && (this.eventSource.close(), this.eventSource = void 0, this.onclose && this.onclose(e)) }, n })(), Ct = globalThis && globalThis.__awaiter || function(n, e, t, i){ return new(t || (t = Promise))(function(o, r){ function a(s){ try{ u(i.next(s)) }catch(l){ r(l) } }function c(s){ try{ u(i.throw(s)) }catch(l){ r(l) } }function u(s){ s.done ? o(s.value) : new t(function(l){ l(s.value) }).then(a, c) }u((i = i.apply(n, e || [])).next()) }) }, kt = globalThis && globalThis.__generator || function(n, e){ let t = {label: 0, sent: function(){ if(r[0] & 1){ throw r[1]; }return r[1] }, trys: [], ops: []}, i, o, r, a;return a = {next: c(0), throw: c(1), return: c(2)}, typeof Symbol == "function" && (a[Symbol.iterator] = function(){ return this }), a;function c(s){ return function(l){ return u([s, l]) } }function u(s){ if(i){ throw new TypeError("Generator is already executing."); }for(;t;){ try{ if(i = 1, o && (r = s[0] & 2 ? o.return : s[0] ? o.throw || ((r = o.return) && r.call(o), 0) : o.next) && !(r = r.call(o, s[1])).done){ return r; }switch(o = 0, r && (s = [s[0] & 2, r.value]), s[0]){ case 0:case 1:r = s;break;case 4:return t.label++, {value: s[1], done: !1};case 5:t.label++, o = s[1], s = [0];continue;case 7:s = t.ops.pop(), t.trys.pop();continue;default:if(r = t.trys, !(r = r.length > 0 && r[r.length - 1]) && (s[0] === 6 || s[0] === 2)){ t = 0;continue }if(s[0] === 3 && (!r || s[1] > r[0] && s[1] < r[3])){ t.label = s[1];break }if(s[0] === 6 && t.label < r[1]){ t.label = r[1], r = s;break }if(r && t.label < r[2]){ t.label = r[2], t.ops.push(s);break }r[2] && t.ops.pop(), t.trys.pop();continue }s = e.call(n, t) }catch(l){ s = [6, l], o = 0 }finally{ i = r = 0 } }if(s[0] & 5){ throw s[1]; }return{value: s[0] ? s[1] : void 0, done: !0} } }, Et = (function(){ function n(e, t, i, o, r){ this.logger = i, this.accessTokenFactory = t, this.logMessageContent = o, this.webSocketConstructor = r, this.httpClient = e, this.onreceive = null, this.onclose = null }return n.prototype.connect = function(e, t){ return Ct(this, void 0, void 0, function(){ let i, o = this;return kt(this, function(r){ switch(r.label){ case 0:return y.isRequired(e, "url"), y.isRequired(t, "transferFormat"), y.isIn(t, v, "transferFormat"), this.logger.log(d.Trace, "(WebSockets transport) Connecting."), this.accessTokenFactory ? [4, this.accessTokenFactory()] : [3, 2];case 1:i = r.sent(), i && (e += (e.indexOf("?") < 0 ? "?" : "&") + ("access_token=" + encodeURIComponent(i))), r.label = 2;case 2:return[2, new Promise(function(a, c){ e = e.replace(/^http/, "ws");let u, s = o.httpClient.getCookieString(e);typeof window > "u" && s && (u = new o.webSocketConstructor(e, void 0, {headers: {Cookie: "" + s}})), u || (u = new o.webSocketConstructor(e)), t === v.Binary && (u.binaryType = "arraybuffer"), u.onopen = function(l){ o.logger.log(d.Information, "WebSocket connected to " + e + "."), o.webSocket = u, a() }, u.onerror = function(l){ let p = null;typeof ErrorEvent < "u" && l instanceof ErrorEvent && (p = l.error), c(p) }, u.onmessage = function(l){ o.logger.log(d.Trace, "(WebSockets transport) data received. " + A(l.data, o.logMessageContent) + "."), o.onreceive && o.onreceive(l.data) }, u.onclose = function(l){ return o.close(l) } })] } }) }) }, n.prototype.send = function(e){ return this.webSocket && this.webSocket.readyState === this.webSocketConstructor.OPEN ? (this.logger.log(d.Trace, "(WebSockets transport) sending data. " + A(e, this.logMessageContent) + "."), this.webSocket.send(e), Promise.resolve()) : Promise.reject("WebSocket is not in the OPEN state") }, n.prototype.stop = function(){ return this.webSocket && (this.webSocket.onclose = function(){}, this.webSocket.onmessage = function(){}, this.webSocket.onerror = function(){}, this.webSocket.close(), this.webSocket = void 0, this.close(void 0)), Promise.resolve() }, n.prototype.close = function(e){ this.logger.log(d.Trace, "(WebSockets transport) socket closed."), this.onclose && (e && (e.wasClean === !1 || e.code !== 1e3) ? this.onclose(new Error("WebSocket closed with status code: " + e.code + " (" + e.reason + ").")) : this.onclose()) }, n })(), J = globalThis && globalThis.__awaiter || function(n, e, t, i){ return new(t || (t = Promise))(function(o, r){ function a(s){ try{ u(i.next(s)) }catch(l){ r(l) } }function c(s){ try{ u(i.throw(s)) }catch(l){ r(l) } }function u(s){ s.done ? o(s.value) : new t(function(l){ l(s.value) }).then(a, c) }u((i = i.apply(n, e || [])).next()) }) }, B = globalThis && globalThis.__generator || function(n, e){ let t = {label: 0, sent: function(){ if(r[0] & 1){ throw r[1]; }return r[1] }, trys: [], ops: []}, i, o, r, a;return a = {next: c(0), throw: c(1), return: c(2)}, typeof Symbol == "function" && (a[Symbol.iterator] = function(){ return this }), a;function c(s){ return function(l){ return u([s, l]) } }function u(s){ if(i){ throw new TypeError("Generator is already executing."); }for(;t;){ try{ if(i = 1, o && (r = s[0] & 2 ? o.return : s[0] ? o.throw || ((r = o.return) && r.call(o), 0) : o.next) && !(r = r.call(o, s[1])).done){ return r; }switch(o = 0, r && (s = [s[0] & 2, r.value]), s[0]){ case 0:case 1:r = s;break;case 4:return t.label++, {value: s[1], done: !1};case 5:t.label++, o = s[1], s = [0];continue;case 7:s = t.ops.pop(), t.trys.pop();continue;default:if(r = t.trys, !(r = r.length > 0 && r[r.length - 1]) && (s[0] === 6 || s[0] === 2)){ t = 0;continue }if(s[0] === 3 && (!r || s[1] > r[0] && s[1] < r[3])){ t.label = s[1];break }if(s[0] === 6 && t.label < r[1]){ t.label = r[1], r = s;break }if(r && t.label < r[2]){ t.label = r[2], t.ops.push(s);break }r[2] && t.ops.pop(), t.trys.pop();continue }s = e.call(n, t) }catch(l){ s = [6, l], o = 0 }finally{ i = r = 0 } }if(s[0] & 5){ throw s[1]; }return{value: s[0] ? s[1] : void 0, done: !0} } }, Me = 100, ue = null, ce = null;if(typeof window > "u" && typeof require < "u"){ let xe = typeof __webpack_require__ == "function" ? __non_webpack_require__ : require;ue = xe("ws"), ce = xe("eventsource") }let qt = (function(){ function n(e, t){ t === void 0 && (t = {}), this.features = {}, y.isRequired(e, "url"), this.logger = ot(t.logger), this.baseUrl = this.resolveUrl(e), t = t || {}, t.logMessageContent = t.logMessageContent || !1;let i = typeof window > "u";!i && typeof WebSocket < "u" && !t.WebSocket ? t.WebSocket = WebSocket : i && !t.WebSocket && ue && (t.WebSocket = ue), !i && typeof EventSource < "u" && !t.EventSource ? t.EventSource = EventSource : i && !t.EventSource && typeof ce < "u" && (t.EventSource = ce), this.httpClient = t.httpClient || new gt(this.logger), this.connectionState = 2, this.options = t, this.onreceive = null, this.onclose = null }return n.prototype.start = function(e){ return e = e || v.Binary, y.isIn(e, v, "transferFormat"), this.logger.log(d.Debug, "Starting connection with transfer format '" + v[e] + "'."), this.connectionState !== 2 ? Promise.reject(new Error("Cannot start a connection that is not in the 'Disconnected' state.")) : (this.connectionState = 0, this.startPromise = this.startInternal(e), this.startPromise) }, n.prototype.send = function(e){ if(this.connectionState !== 1){ throw new Error("Cannot send data if the connection is not in the 'Connected' State."); }return this.transport.send(e) }, n.prototype.stop = function(e){ return J(this, void 0, void 0, function(){ return B(this, function(t){ switch(t.label){ case 0:this.connectionState = 2, this.stopError = e, t.label = 1;case 1:return t.trys.push([1, 3,, 4]), [4, this.startPromise];case 2:return t.sent(), [3, 4];case 3:return t.sent(), [3, 4];case 4:return this.transport ? [4, this.transport.stop()] : [3, 6];case 5:t.sent(), this.transport = void 0, t.label = 6;case 6:return[2] } }) }) }, n.prototype.startInternal = function(e){ return J(this, void 0, void 0, function(){ let t, i, o, r, a, c, u, s = this;return B(this, function(l){ switch(l.label){ case 0:t = this.baseUrl, this.accessTokenFactory = this.options.accessTokenFactory, l.label = 1;case 1:return l.trys.push([1, 12,, 13]), this.options.skipNegotiation ? this.options.transport !== m.WebSockets ? [3, 3] : (this.transport = this.constructTransport(m.WebSockets), [4, this.transport.connect(t, e)]) : [3, 5];case 2:return l.sent(), [3, 4];case 3:throw Error("Negotiation can only be skipped when using the WebSocket transport directly.");case 4:return[3, 11];case 5:i = null, o = 0, r = function(){ let p;return B(this, function(g){ switch(g.label){ case 0:return[4, a.getNegotiationResponse(t)];case 1:if(i = g.sent(), a.connectionState === 2){ return[2, {value: void 0}]; }if(i.error){ throw Error(i.error); }if(i.ProtocolVersion){ throw Error("Detected a connection attempt to an ASP.NET SignalR Server. This client only supports connecting to an ASP.NET Core SignalR Server. See https://aka.ms/signalr-core-differences for details."); }return i.url && (t = i.url), i.accessToken && (p = i.accessToken, a.accessTokenFactory = function(){ return p }), o++, [2] } }) }, a = this, l.label = 6;case 6:return[5, r()];case 7:if(c = l.sent(), typeof c == "object"){ return[2, c.value]; }l.label = 8;case 8:if(i.url && o < Me){ return[3, 6]; }l.label = 9;case 9:if(o === Me && i.url){ throw Error("Negotiate redirection limit exceeded."); }return[4, this.createTransport(t, this.options.transport, i, e)];case 10:l.sent(), l.label = 11;case 11:return this.transport instanceof Ne && (this.features.inherentKeepAlive = !0), this.transport.onreceive = this.onreceive, this.transport.onclose = function(p){ return s.stopConnection(p) }, this.changeState(0, 1), [3, 13];case 12:throw u = l.sent(), this.logger.log(d.Error, "Failed to start the connection: " + u), this.connectionState = 2, this.transport = void 0, u;case 13:return[2] } }) }) }, n.prototype.getNegotiationResponse = function(e){ return J(this, void 0, void 0, function(){ let t, i, o, r, a, c;return B(this, function(u){ switch(u.label){ case 0:return this.accessTokenFactory ? [4, this.accessTokenFactory()] : [3, 2];case 1:o = u.sent(), o && (i = (t = {}, t.Authorization = "Bearer " + o, t)), u.label = 2;case 2:r = this.resolveNegotiateUrl(e), this.logger.log(d.Debug, "Sending negotiation request: " + r + "."), u.label = 3;case 3:return u.trys.push([3, 5,, 6]), [4, this.httpClient.post(r, {content: "", headers: i})];case 4:if(a = u.sent(), a.statusCode !== 200){ throw Error("Unexpected status code returned from negotiate " + a.statusCode); }return[2, JSON.parse(a.content)];case 5:throw c = u.sent(), this.logger.log(d.Error, "Failed to complete negotiation with the server: " + c), c;case 6:return[2] } }) }) }, n.prototype.createConnectUrl = function(e, t){ return t ? e + (e.indexOf("?") === -1 ? "?" : "&") + ("id=" + t) : e }, n.prototype.createTransport = function(e, t, i, o){ return J(this, void 0, void 0, function(){ let r, a, c, u, s, l, p;return B(this, function(g){ switch(g.label){ case 0:return r = this.createConnectUrl(e, i.connectionId), this.isITransport(t) ? (this.logger.log(d.Debug, "Connection was provided an instance of ITransport, using that directly."), this.transport = t, [4, this.transport.connect(r, o)]) : [3, 2];case 1:return g.sent(), this.changeState(0, 1), [2];case 2:a = i.availableTransports || [], c = 0, u = a, g.label = 3;case 3:return c < u.length ? (s = u[c], this.connectionState = 0, l = this.resolveTransport(s, t, o), typeof l != "number" ? [3, 8] : (this.transport = this.constructTransport(l), i.connectionId ? [3, 5] : [4, this.getNegotiationResponse(e)])) : [3, 9];case 4:i = g.sent(), r = this.createConnectUrl(e, i.connectionId), g.label = 5;case 5:return g.trys.push([5, 7,, 8]), [4, this.transport.connect(r, o)];case 6:return g.sent(), this.changeState(0, 1), [2];case 7:return p = g.sent(), this.logger.log(d.Error, "Failed to start the transport '" + m[l] + "': " + p), this.connectionState = 2, i.connectionId = void 0, [3, 8];case 8:return c++, [3, 3];case 9:throw new Error("Unable to initialize any of the available transports.") } }) }) }, n.prototype.constructTransport = function(e){ switch(e){ case m.WebSockets:if(!this.options.WebSocket){ throw new Error("'WebSocket' is not supported in your environment."); }return new Et(this.httpClient, this.accessTokenFactory, this.logger, this.options.logMessageContent || !1, this.options.WebSocket);case m.ServerSentEvents:if(!this.options.EventSource){ throw new Error("'EventSource' is not supported in your environment."); }return new vt(this.httpClient, this.accessTokenFactory, this.logger, this.options.logMessageContent || !1, this.options.EventSource);case m.LongPolling:return new Ne(this.httpClient, this.accessTokenFactory, this.logger, this.options.logMessageContent || !1);default:throw new Error("Unknown transport: " + e + ".") } }, n.prototype.resolveTransport = function(e, t, i){ let o = m[e.transport];if(o == null){ this.logger.log(d.Debug, "Skipping transport '" + e.transport + "' because it is not supported by this client."); }else{ let r = e.transferFormats.map(function(a){ return v[a] });if(Tt(t, o)){ if(r.indexOf(i) >= 0){ if(o === m.WebSockets && !this.options.WebSocket || o === m.ServerSentEvents && !this.options.EventSource){ this.logger.log(d.Debug, "Skipping transport '" + m[o] + "' because it is not supported in your environment.'"); }else { return this.logger.log(d.Debug, "Selecting transport '" + m[o] + "'."), o; } }else { this.logger.log(d.Debug, "Skipping transport '" + m[o] + "' because it does not support the requested transfer format '" + v[i] + "'."); } }else { this.logger.log(d.Debug, "Skipping transport '" + m[o] + "' because it was disabled by the client.") } }return null }, n.prototype.isITransport = function(e){ return e && typeof e == "object" && "connect" in e }, n.prototype.changeState = function(e, t){ return this.connectionState === e ? (this.connectionState = t, !0) : !1 }, n.prototype.stopConnection = function(e){ this.transport = void 0, e = this.stopError || e, e ? this.logger.log(d.Error, "Connection disconnected with error '" + e + "'.") : this.logger.log(d.Information, "Connection disconnected."), this.connectionState = 2, this.onclose && this.onclose(e) }, n.prototype.resolveUrl = function(e){ if(e.lastIndexOf("https://", 0) === 0 || e.lastIndexOf("http://", 0) === 0){ return e; }if(typeof window > "u" || !window || !window.document){ throw new Error("Cannot resolve '" + e + "'."); }let t = window.document.createElement("a");return t.href = e, this.logger.log(d.Information, "Normalizing '" + e + "' to '" + t.href + "'."), t.href }, n.prototype.resolveNegotiateUrl = function(e){ let t = e.indexOf("?"), i = e.substring(0, t === -1 ? e.length : t);return i[i.length - 1] !== "/" && (i += "/"), i += "negotiate", i += t === -1 ? "" : e.substring(t), i }, n })();function Tt(n, e){ return!n || (e & n) !== 0 }let Nt = "json", Ot = (function(){ function n(){ this.name = Nt, this.version = 1, this.transferFormat = v.Text }return n.prototype.parseMessages = function(e, t){ if(typeof e != "string"){ throw new Error("Invalid input for JSON hub protocol. Expected a string."); }if(!e){ return[]; }t === null && (t = se.instance);for(var i = M.parse(e), o = [], r = 0, a = i;r < a.length;r++){ let c = a[r], u = JSON.parse(c);if(typeof u.type != "number"){ throw new Error("Invalid payload."); }switch(u.type){ case S.Invocation:this.isInvocationMessage(u);break;case S.StreamItem:this.isStreamItemMessage(u);break;case S.Completion:this.isCompletionMessage(u);break;case S.Ping:break;case S.Close:break;default:t.log(d.Information, "Unknown message type '" + u.type + "' ignored.");continue }o.push(u) }return o }, n.prototype.writeMessage = function(e){ return M.write(JSON.stringify(e)) }, n.prototype.isInvocationMessage = function(e){ this.assertNotEmptyString(e.target, "Invalid payload for Invocation message."), e.invocationId !== void 0 && this.assertNotEmptyString(e.invocationId, "Invalid payload for Invocation message.") }, n.prototype.isStreamItemMessage = function(e){ if(this.assertNotEmptyString(e.invocationId, "Invalid payload for StreamItem message."), e.item === void 0){ throw new Error("Invalid payload for StreamItem message.") } }, n.prototype.isCompletionMessage = function(e){ if(e.result && e.error){ throw new Error("Invalid payload for Completion message."); }!e.result && e.error && this.assertNotEmptyString(e.error, "Invalid payload for Completion message."), this.assertNotEmptyString(e.invocationId, "Invalid payload for Completion message.") }, n.prototype.assertNotEmptyString = function(e, t){ if(typeof e != "string" || e === ""){ throw new Error(t) } }, n })(), It = (function(){ function n(){}return n.prototype.configureLogging = function(e){ return y.isRequired(e, "logging"), Mt(e) ? this.logger = e : this.logger = new ae(e), this }, n.prototype.withUrl = function(e, t){ return y.isRequired(e, "url"), this.url = e, typeof t == "object" ? this.httpConnectionOptions = t : this.httpConnectionOptions = {transport: t}, this }, n.prototype.withHubProtocol = function(e){ return y.isRequired(e, "protocol"), this.protocol = e, this }, n.prototype.build = function(){ let e = this.httpConnectionOptions || {};if(e.logger === void 0 && (e.logger = this.logger), !this.url){ throw new Error("The 'HubConnectionBuilder.withUrl' method must be called before building the connection."); }let t = new qt(this.url, e);return yt.create(t, this.logger || se.instance, this.protocol || new Ot) }, n })();function Mt(n){ return n.log !== void 0 }class je{constructor(e, t, i){ this.url = e, this.connectionId = t, this.equipNo = i, this.signalr = null }openConnect(){ return this.signalr && (this.signalr.stop(), this.signalr = null), this.signalr = new It().withUrl(this.url).build(), this.signalr.serverTimeoutInMilliseconds = 5e8, this.signalr.keepaliveintervalinmilliseconds = 5e8, new Promise(e=>{ this.signalr.start().then(()=>{ this.connectionId && this.send(), e(this.signalr) }).catch(t=>{ console.log(t) }) }) }async send(){ try{ await this.signalr.invoke(this.connectionId, this.equipNo) }catch(e){ console.log("connectHub 连接失败" + e) } }}class xt extends U{constructor(e, t, i, o, r){ super(), this.equipStatusObject = t, this.groupNodeObject = i, this.aleadyUpdateStatus = {}, this.isGetAllEquipStatus = !1, this.nodesMap = e, this.statusChange = o, this.openSignlr(), this.aliasName = r }openSignlr(){ this.equipStatusSignlr = new je("/equipStatusMonitor", "", ""), this.equipStatusSignlr.openConnect().then(e=>{ try{ e.invoke("GetAllEquipStatus") }catch(t){ console.log(t) }this.subscribeTo(e, "GetAllEquipStatus");try{ e.invoke("GetEquipChangeStatus") }catch(t){ console.log(t) }e.onclose(()=>{ this.openSignlr() }), this.subscribeTo(e, "GetEquipChangeStatus") }) }subscribeTo(e, t){ e.off(t), e.on(t, i=>{ i && i.isSuccess && i.data && (this[t] ? this[t](i.data) : this.notice({func: t, data: i.data, key: i.groupId})) }) }GetAllEquipStatus(e){ this.isGetAllEquipStatus = !0, this.resetGroupStatus(), Object.keys(e).forEach(t=>{ this.equipStatusObject[t] = e[t] }), Object.keys(this.groupNodeObject).forEach(t=>{ this.updateByGroup(t) }) }updateByGroup(e){ if(!this.aleadyUpdateStatus[e]){ let t = this.window[`group-${e}${this.aliasName}`] || [];if(t.length){ this.aleadyUpdateStatus[e] = !0;let i = !1, o = !0;t.forEach(r=>{ const a = this.equipStatusObject[r.equipNo];a === 1 ? (i = !0, o = !1) : a !== 0 && (o = !1) }), o && this.setOfflineStatus(e), t.forEach(r=>{ this.equipStatusObject[r.equipNo] == 2 ? this.setGroupStatus(e, !0, 2) : this.equipStatusObject[r.equipNo] == 6 && this.setGroupStatus(e, !0, 6), this.nodesMap[`${e}-${r.equipNo}`] && (this.nodesMap[`${e}-${r.equipNo}`].status = this.equipStatusObject[r.equipNo]) }), this.nodesMap[e].alarmCounts === 0 && this.nodesMap[e].backUpCounts === 0 && i && (this.nodesMap[e].status = 1, this.nodesMap[e].groupId && this.setNormalStatus(this.nodesMap[e].groupId)) } } }updateGroupStatus(e){ this.isGetAllEquipStatus && this.updateByGroup(e) }GetEquipChangeStatus(e){ this.setStatus(e) }setGroupStatus(e, t, i){ t ? i == 2 ? (this.nodesMap[e].alarmCounts = this.nodesMap[e].alarmCounts + 1, this.nodesMap[e].alarmCounts > 0 && (this.nodesMap[e].status = 2)) : (this.nodesMap[e].backUpCounts = this.nodesMap[e].backUpCounts + 1, this.nodesMap[e].alarmCounts == 0 && this.nodesMap[e].backUpCounts > 0 && (this.nodesMap[e].status = 6)) : i == 2 ? (this.nodesMap[e].alarmCounts = this.nodesMap[e].alarmCounts - 1, this.nodesMap[e].alarmCounts == 0 && (this.nodesMap[e].status = 1)) : (this.nodesMap[e].backUpCounts = this.nodesMap[e].backUpCounts - 1, this.nodesMap[e].alarmCounts == 0 && (this.nodesMap[e].backUpCounts == 0 ? this.nodesMap[e].status = 1 : this.nodesMap[e].status = 6)), this.nodesMap[e].groupId && this.setGroupStatus(this.nodesMap[e].groupId, t, i) }setOfflineStatus(e){ this.nodesMap[e].status !== 2 && this.nodesMap[e].status !== 6 && this.nodesMap[e].status !== 1 && (this.nodesMap[e].status = 0, this.nodesMap[e].groupId && this.setOfflineStatus(this.nodesMap[e].groupId)) }setNormalStatus(e){ this.nodesMap[e].status !== 2 && this.nodesMap[e].status !== 6 && (this.nodesMap[e].status = 1, this.nodesMap[e].groupId && this.setNormalStatus(this.nodesMap[e].groupId)) }getEquipGroupIds(e){ const t = [];if(this.window.groupCache && Object.keys(this.window.groupCache).forEach(i=>{ this.window.groupCache[i] && this.window.groupCache[i][e] && t.push(Number(i)) }), t.length === 0){ const i = this.window.equipCache && this.window.equipCache[e];if(i){ if(i.groupIds && i.groupIds.length > 0){ return i.groupIds; }i.groupId && t.push(i.groupId) } }return t }setStatus(e){ let t = this.equipStatusObject[e.equipNo];const i = this.getEquipGroupIds(e.equipNo);e.status != 3 && i.length > 0 && (i.forEach(o=>{ switch(e.status){ case 0:t == 6 && this.setGroupStatus(o, !1, 6);break;case 1:t == 6 ? this.setGroupStatus(o, !1, 6) : t == 2 && this.setGroupStatus(o, !1, 2);break;case 2:t != 2 && this.setGroupStatus(o, !0, 2), t == 6 && this.setGroupStatus(o, !1, 6);break;case 6:t == 2 && this.setGroupStatus(o, !1, 2), t != 6 && this.setGroupStatus(o, !0, 6);break }let r = `${o}-${e.equipNo}`;this.nodesMap[r] && (this.nodesMap[r].status = e.status) }), this.equipStatusObject[e.equipNo] = e.status, this.statusChange(i[0], e.equipNo, e.status)) }resetGroupStatus(){ for(let e in this.groupNodeObject){ this.groupNodeObject[e].alarmCounts = 0, this.groupNodeObject[e].backUpCount = 0 } }}const jt = Object.assign({}, {getSetParm(n){ if(window.AxiosBuilder.axios){ return window.AxiosBuilder.axios({method: "post", url: "/IoT/api/v3/EquipList/GetFullSetParmByEquipNo", params: n, data: n, headers: {"Content-Type": "application/json;charset=UTF-8", "Accept-Language": window.sessionStorage.languageType || "zh-CN"}}) } }});class _t{constructor(e, t){ this.nodesMap = e, this.equipControllObject = t }async getSetting(e, t, i, o){ let[r, a] = String(e).split("-"), c = {equipNo: a};await jt.getSetParm(c).then(u=>{ if(u.data.code == 200){ let s = u && u.data && u.data.data && u.data.data.rows || [];this.nodesMap[e].settings || (this.nodesMap[e].settings = []), s && s.length > 0 && this.nodesMap[e] && (s.forEach(l=>{ l.title = l.setNm, l.key = `${r}-${a}-${l.setNo}`, l.level = Number(i) + 1, l.checked = o || this.equipControllObject[a] && this.equipControllObject[a].includes(l.setNo), l.isSetting = !0, l.equipNo = a, l.groupId = r, l.setNo = l.setNo, l.equipName = t }), this.nodesMap[e].settings = [...s]) } }) }}class q{static formateList(e, t){ let i = [];for(const o of e){ let r = {};r.count = 0, r.equipSelectCount = 0, r.controlSelectCount = 0, r.equipCount = o.equipCount || 0, r.title = o.name, r.key = o.id, r.isGroup = !0, r.children = [], r.status = 1, r.level = t || 1, r.expand = !t, r.equips = [], r.groupId = o.parentId, r.groups = [], r.alarmCounts = 0, r.backUpCounts = 0, r.indeterminate = !1, r.checked = !1, r.visible = !0, r.nodeEquipSelectCount = 0, r.checkedEquips = [], r.halfCheckedEquips = [], r.selectControlCount = 0, o.children && o.children.length > 0 && (r.groups = [...this.formateList(o.children, t ? t + 1 : 2)]), i.push(r) }return i }static deepClone(e, t, i, o, r, a){ let c = [];if(e){ for(let u = 0, s = e.length;u < s;u++){ c.push({isGroup: i, key: `${o}-${e[u].id}`, status: a[e[u].id] || 0, title: e[u].title, level: t, expand: !1, isEquip: !0, loading: !1, indeterminate: r[`${e[u].groupId}-${e[u].equipNo}`] && r[`${e[u].groupId}-${e[u].equipNo}`].indeterminate || !1, checked: r[`${e[u].groupId}-${e[u].equipNo}`] && r[`${e[u].groupId}-${e[u].equipNo}`].checked || !1, groupId: o, equipNo: e[u].id, visible: !0, settings: []}); } }return c }static copyOrigin(e){ let t = [];return e.forEach(i=>{ t.push({...i}) }), t }static getPosition(e, t){ let i = 0;for(let o = 0, r = t.length;o < r;o++){ if(t[o].key == e){ i = o - 30;break } }return i }static flattern(e, t){ e.forEach(i=>{ i.isGroup && (t[`${i.key}`] = null, t[`${i.key}`] = i), i.groups && i.groups.length && this.flattern(i.groups, t) }) }static generateUUID(){ let e = new Date().getTime();return window.performance && typeof window.performance.now == "function" && (e += performance.now()), "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(i){ let o = (e + Math.random() * 16) % 16 | 0;return e = Math.floor(e / 16), (i === "x" ? o : o & 3 | 8).toString(16) }) }static listToTreeList(e){ const t = e, i = [], o = {};return t.forEach(r=>{ o[r.id] = r }), t.forEach(r=>{ const a = o[r.parentId];a ? (a.children || (a.children = [])).push(r) : i.push(r) }), i }}class Gt extends U{constructor(e, t, i){ super(), this.showSettings = t, this.groupNodeObject = e, this.aliasName = i }filterMethod(e){ for(let t in this.groupNodeObject){ e && this.updateBySearch(t, e) } }updateBySearch(e, t){ let i = this.window[`group-${this.groupNodeObject[e].key}${this.aliasName}`];i && (i = i.filter(o=>o.title.includes(t)), this.window[`group-${this.groupNodeObject[e].key}-search`] = q.copyOrigin(i)) }}const X = (n, e)=>{ const t = n.__vccOpts || n;for(const[i, o]of e){ t[i] = o; }return t }, Pt = {props: {source: {type: Object, default: ()=>{}}, groupEditAndNew: {type: Function, default: ()=>{}}, deleteGroup: {type: Function, default: ()=>{}}}}, At = {class: "operates"};function $t(n, e, t, i, o, r){ const a = h.resolveComponent("el-button"), c = h.resolveComponent("el-button-group"), u = h.resolveComponent("el-popover");return h.openBlock(), h.createElementBlock("div", At, [h.createVNode(u, {placement: "bottom", trigger: "hover"}, {reference: h.withCtx(()=>[h.createElementVNode("i", {class: "el-icon-more", onClick: e[3] || (e[3] = h.withModifiers(()=>{}, ["stop"]))})]), default: h.withCtx(()=>[h.createVNode(c, {class: "new-button-group setModule"}, {default: h.withCtx(()=>[h.createVNode(a, {type: "text", size: "small", class: "elBtn", icon: " iconfont icon-tubiao20_bianji", onClick: e[0] || (e[0] = h.withModifiers(s=>t.groupEditAndNew(!1, t.source), ["stop"]))}, {default: h.withCtx(()=>[h.createTextVNode(h.toDisplayString(n.$t("equipInfo.poverTips.rename")), 1)]), _: 1}), h.createVNode(a, {type: "text", size: "small", class: "elBtn", icon: " iconfont icon-gw-icon-tianjia1", onClick: e[1] || (e[1] = s=>t.groupEditAndNew(!0, t.source))}, {default: h.withCtx(()=>[h.createTextVNode(h.toDisplayString(n.$t("equipInfo.poverTips.newChildGroup")), 1)]), _: 1}), t.source.level != 1 ? (h.openBlock(), h.createBlock(a, {key: 0, type: "danger", size: "small", onClick: e[2] || (e[2] = h.withModifiers(s=>t.deleteGroup(t.source), ["stop"])), icon: " iconfont icon-tubiao20_shanchu"}, {default: h.withCtx(()=>[h.createTextVNode(h.toDisplayString(n.$t("publics.button.deletes")), 1)]), _: 1})) : h.createCommentVNode("", !0)]), _: 1})]), _: 1})]) }const Lt = {name: "ElTreeVirtualNode", componentName: "ElTreeVirtualNode", props: {searchName: {type: String, default: ""}, expanding: {type: Boolean, default: !1}, aleadyLoadAll: {type: Boolean, default: !1}, groupLoading: {type: Boolean, default: !1}, source: {type: Object, default(){ return{} }}, showCheckbox: {type: Boolean, default: !1}, showStatus: {type: Boolean, default: !1}, showOperate: {type: Boolean, default: !1}, currentSelect: {type: [Number, String], default: -1}, nodeClick: {type: Function}, onChecked: {type: Function}, groupEditAndNew: {type: Function}, deleteGroup: {type: Function}, childrenResetGroupNum: {type: Function}, getEquipStatus: {type: Function}, colorConfig: {type: Object, default: ()=>{}}, index: {type: Number, default: -1}}, components: {oparate: X(Pt, [["render", $t]])}, computed: {getColor(){ return function(n){ this.colorConfig || (this.colorConfig = {noComm: "#a0a0a0", normal: "#63e03f", alarm: "#f22433", lsSet: "#bebcaa", initialize: "#289ac0", withdraw: "#ffc0cb", BackUp: "#f8901c"});let e;switch(n){ case 0:e = this.colorConfig.noComm;break;case 1:e = this.colorConfig.normal;break;case 2:e = this.colorConfig.alarm;break;case 3:e = this.colorConfig.lsSet;break;case 4:e = this.colorConfig.initialize;break;case 5:e = this.colorConfig.withdraw;break;case 6:e = this.colorConfig.BackUp;break;default:e = this.colorConfig.noComm;break }return e } }}, data(){ return{indent: 13} }, methods: {clickFunction(){ this.source.expand = !this.source.expand, this.nodeClick(this.source, this.index, this.source.level, this.source.checked) }, checkedChange(n){ this.onChecked(this.source) }}}, Bt = {class: "el-tree-node__content"}, Rt = {class: "nodeContent"}, zt = {key: 1, class: "circle"}, Dt = {class: "label"}, Ft = {key: 2, class: "equipNumber"}, Ht = {key: 4, class: "el-tree-node__loading-icon el-icon-loading"};function Ut(n, e, t, i, o, r){ const a = h.resolveComponent("el-checkbox"), c = h.resolveComponent("oparate");return h.openBlock(), h.createElementBlock("div", {class: h.normalizeClass(["el-tree-node", {parent_tag: t.source.isGroup, child_tags: !t.source.isGroup, selectedColor: t.currentSelect === t.source.key && !t.source.isGroup}]), onClick: e[2] || (e[2] = (...u)=>r.clickFunction && r.clickFunction(...u))}, [h.createElementVNode("div", Bt, [h.createElementVNode("span", {class: "el-tree__indent", "aria-hidden": "true", style: h.normalizeStyle({width: (t.source.level - 1) * o.indent + "px"})}, null, 4), t.source.isGroup ? (h.openBlock(), h.createElementBlock("span", {key: 0, class: h.normalizeClass([{"is-leaf": !t.source.isGroup, expanded: t.source.isGroup && t.source.expand}, "el-tree-node__expand-icon", "iconfont icon-fangxiangL"])}, null, 2)) : h.createCommentVNode("", !0), h.createElementVNode("div", Rt, [t.showCheckbox ? (h.openBlock(), h.createBlock(a, {key: 0, onClick: e[0] || (e[0] = h.withModifiers(()=>{}, ["stop"])), modelValue: t.source.checked, "onUpdate:modelValue": e[1] || (e[1] = u=>t.source.checked = u), indeterminate: t.source.indeterminate, onChange: r.checkedChange}, null, 8, ["modelValue", "indeterminate", "onChange"])) : h.createCommentVNode("", !0), t.showStatus ? (h.openBlock(), h.createElementBlock("span", zt, [t.source.status != 6 ? (h.openBlock(), h.createElementBlock("span", {key: 0, class: "yd", style: h.normalizeStyle({backgroundColor: r.getColor(t.source.status)})}, null, 4)) : (h.openBlock(), h.createElementBlock("i", {key: 1, style: h.normalizeStyle({color: t.colorConfig.BackUp}), class: "iconfont icon-gw-icon-beiji2"}, null, 4))])) : h.createCommentVNode("", !0), h.createElementVNode("span", Dt, h.toDisplayString(t.source.title), 1), t.source.isGroup && !t.source.isEquip || t.source.isGroup && !t.source.isEquip ? (h.openBlock(), h.createElementBlock("span", Ft, h.toDisplayString(t.source.count), 1)) : h.createCommentVNode("", !0), t.source.isGroup && t.showOperate ? (h.openBlock(), h.createBlock(c, {key: 3, source: t.source, groupEditAndNew: t.groupEditAndNew, deleteGroup: t.deleteGroup}, null, 8, ["source", "groupEditAndNew", "deleteGroup"])) : h.createCommentVNode("", !0), t.source.loading ? (h.openBlock(), h.createElementBlock("span", Ht)) : h.createCommentVNode("", !0)])])], 2) }const Wt = X(Lt, [["render", Ut]]), Vt = {components: {VirtualList: Qe}, mixins: [Ce], data(){ return{itemComponent: Wt, visibleList: [], currentSelect: -1, equipStatusManage: null, cacheManage: null, searchManage: null, equipNumManage: null, requestManage: null, checkStatusManage: null, groupNodeObject: {}, nodesMap: {}, equipCheckObject: {}, equipStatusObject: {}, controlObject: {}, isSearchStatus: !1, equipControllObject: {}, expandGroup: [], updateJob: null, filterEquipList: []} }, props: {data: {type: Array}, selectEquips: {type: [Array, Object], default: ()=>[]}, controllList: {type: Array, default: ()=>[]}, showSettings: {type: Boolean, default: !1}, showSelectNum: {type: Boolean, default(){ return!1 }}, showCheckbox: {type: Boolean, default: !1}, showStatus: {type: Boolean, default: !1}, filterEquip: {type: Boolean, default: !1}, showOperate: {type: Boolean, default: !1}, defaultExpandAll: {type: Boolean, default: !1}, currentNodeKey: [String, Number], colorConfig: {type: Object, default: ()=>({noComm: "#a0a0a0", normal: "#63e03f", alarm: "#f22433", lsSet: "#bebcaa", initialize: "#289ac0", withdraw: "#ffc0cb", BackUp: "#f8901c"})}, treeType: {type: String, default: ""}, buildTree: {type: Function, default: ()=>{}}, filterData: {type: Function, default: ()=>{}}, alias: {type: String, default: ""}}, watch: {data(n){ n && n.length && (q.flattern(this.data, this.groupNodeObject), this.cacheManage.addNodesMap(Object.values(this.groupNodeObject).map(e=>e)), this.init()) }, controllList(n){ this.updateCheckedStatusWithControls() }, selectEquips(n){ this.updateCheckedStatusWithEquips(), this.$nextTick(()=>{ this.checkStatusManage && this.checkStatusManage.updateGroupCheckStatus() }) }, filterEquip(n){ this.$nextTick(()=>{ this.visibleList = [], this.$refs.virtualList.scrollToIndex(0), this.updateTreeList(this.data), this.equipNumManage.resetGroupNum(this.isSearchStatus, n, this.equipStatusObject) }) }}, computed: {aliasName(){ return this.alias ? `-${this.alias}` : "" }}, created(){ this.showCheckbox && (this.checkStatusManage = new et(this.groupNodeObject, this.nodesMap, this.equipControllObject, this.controlObject, this.equipCheckObject, this.aliasName)), this.cacheManage = new Ze(this.groupNodeObject, this.nodesMap, this.controlObject, this.equipCheckObject), this.searchManage = new Gt(this.groupNodeObject, this.showSettings, this.aliasName), this.equipNumManage = new tt(this.groupNodeObject, this.aliasName), this.requestManage = new _t(this.nodesMap, this.equipControllObject) }, mounted(){ this.updateCheckedStatusWithControls(), this.updateCheckedStatusWithEquips(), window.addEventListener("message", n=>{ n.data.type && this[n.data.type] && this[n.data.type](n.data.data) }) }, methods: {init(){ this.data[0].expand = !0, this.updateTreeList(), setTimeout(()=>{ Object.values(this.groupNodeObject).forEach((n, e)=>{ !n.expand && this.expandGroup.includes(n.key) && (n.expand = !0), this.filterWithAlias(n.key), this.updateGroupEquips(n.key, !0) }), this.showCheckbox && this.checkStatusManage && this.checkStatusManage.updateGroupCheckStatus(), this.showStatus && !this.equipStatusManage && (this.equipStatusManage = new xt(this.nodesMap, this.equipStatusObject, this.groupNodeObject, this.statusChange, this.aliasName)) }, 500) }, filterWithAlias(n){ if(this.aliasName){ let e = this.window[`group-${n}`] || [];this.window[`group-${n}${this.aliasName}`] = this.filterData(e) } }, updateCurrentSelect(){ this.window.equipCache && this.window.equipCache[this.currentNodeKey] && (this.currentSelect = `${this.window.equipCache[this.currentNodeKey].groupId}-${this.currentNodeKey}`) }, statusChange(n, e, t){ this.currentSelect == `${n}-${e}` && this.$emit("statusChange", e, t) }, updateCheckWidthJob(){ this.showCheckbox && (this.checkStatusManage.resetCheckedStatus(), this.updateCheckedStatusWithControls(), this.updateCheckedStatusWithEquips(), this.checkStatusManage && this.checkStatusManage.updateGroupCheckStatus()) }, updateGroupEquips(n, e){ if(!this.isSearchStatus && this.groupNodeObject[n]){ let t = this.equipNumManage.getAllEquipsNum();this.$emit("getTotal", t) }this.equipNumManage.resetGroupNum(this.isSearchStatus, this.filterEquip, this.equipStatusObject), this.groupNodeObject[n].expand && this.updateList(n, this.groupNodeObject[n].level, null, !1) }, updateList(n){ if(this.groupNodeObject[n]){ let e = [];this.isSearchStatus ? (e = this.window[`group-${n}-search`], this.groupNodeObject[n].equips = [...q.deepClone(e, Number(this.groupNodeObject[n].level) + 1, this.showSettings, n, this.equipCheckObject, this.equipStatusObject)]) : (e = this.window[`group-${n}${this.aliasName}`], this.groupNodeObject[n].equips = [...q.deepClone(e, Number(this.groupNodeObject[n].level) + 1, this.showSettings, n, this.equipCheckObject, this.equipStatusObject)]), this.cacheManage.addNodesMap(this.groupNodeObject[n].equips), this.cacheManage.closeBrotherNode(n), this.visibleList = [], this.updateTreeList(this.data), this.showCheckbox && this.checkStatusManage && e && e.length && this.checkStatusManage.updateGroupCheckStatus(), this.showStatus && this.equipStatusManage && this.equipStatusManage.updateGroupStatus(n), this.updateCurrentSelect() } }, updateTreeList(n){ n && n.length > 0 && n.forEach(e=>{ this.filterEquip && e.status === 2 ? this.filterEquipList.includes(e.equipNo) || this.visibleList.push(e) : this.filterEquip || this.visibleList.push(e), e.expand ? e.isEquip ? (e.children || (e.children = []), e.settings && (e.children = [...e.settings || []])) : e.children = [...e.equips || [], ...e.groups || []] : e.children = [], this.updateTreeList(e.children || []) }) }, nodeClick(n, e, t, i){ this.$emit("node-click", {...n, key: n.isEquip ? n.equipNo : n.key}), n.isGroup ? n.isEquip ? this.equipClick(n, e, i) : this.groupClick(n, e, i) : this.currentSelect = n.key }, groupClick(n, e, t){ n.expand ? this.updateList(n.key, n.level, e, t) : (this.cacheManage.recycleGroupCache(n.key), this.visibleList = [], this.updateTreeList(this.data)) }, async equipClick(n, e, t){ this.showSettings && (n.expand ? (n.loading = !0, await this.requestManage.getSetting(n.key, n.title, n.level, t), this.controlObject[`${n.groupId}-${n.equipNo}`] = {groupId: n.groupId}, n.loading = !1, this.visibleList.splice(e + 1, 0, ...this.nodesMap[n.key].settings), this.cacheManage.addNodesMap(this.nodesMap[n.key].settings)) : (this.visibleList.splice(e + 1, this.nodesMap[n.key].settings.length), this.cacheManage.removeNodesMap(this.nodesMap[n.key].settings), this.nodesMap[n.key].settings = [], delete this.controlObject[`${n.groupId}-${n.equipNo}`])) }, onChecked(n){ this.checkStatusManage && this.checkStatusManage.onChecked(n, this.isSearchStatus), this.$emit("onCheck") }, groupEditAndNew(n, e){ this.$emit("groupEditAndNew", {isGroupNew: n, node: e}) }, deleteGroup(n){ this.$emit("deleteGroup", n) }, updateCheckedStatusWithControls(){ this.controllList && this.controllList.length && this.checkStatusManage && this.checkStatusManage && this.checkStatusManage.updateCheckedStatusWithControls(this.controllList) }, updateCheckedStatusWithEquips(){ this.selectEquips && (this.selectEquips.length || Object.keys(this.selectEquips).length) && this.checkStatusManage && this.checkStatusManage && this.checkStatusManage.updateCheckedStatusWithEquips(this.selectEquips) }, resetCheckedStatus(){ this.checkStatusManage && this.checkStatusManage.resetCheckedStatus() }, getEquipSelectd(){ return this.checkStatusManage && this.checkStatusManage.getEquipSelectd() }, getEquipGroupSelectd(){ return this.checkStatusManage && this.checkStatusManage.getEquipGroupSelectd() }, getControlSelected(){ return this.checkStatusManage && this.checkStatusManage.getControlSelected() }, recordExpandGroup(){ this.expandGroup = [], Object.values(this.groupNodeObject).forEach(n=>{ n.expand && this.expandGroup.push(n.key) }) }, removeExpandGroup(){ this.$nextTick(()=>{ this.expandGroup = [] }) }, filterMethod(n){ this.visibleList = [], this.cacheManage.recycleAllNodeCache(), n ? (this.isSearchStatus = !0, this.searchManage.filterMethod(n)) : this.isSearchStatus = !1, this.init(), this.$nextTick(()=>{ this.$refs.virtualList.scrollToIndex(0) }), this.equipNumManage.resetGroupNum(this.isSearchStatus, this.filterEquip, this.equipStatusObject), this.showCheckbox && (this.checkStatusManage && this.checkStatusManage.reComputedCheckNum(this.isSearchStatus), this.checkStatusManage && this.checkStatusManage.updateGroupCheckStatus()) }, rebuildTree(){ this.recordExpandGroup(), this.checkStatusManage && this.checkStatusManage.resetCheckedStatus(), this.cacheManage.recycleAllNodeCache(!0), this.$nextTick(()=>{ this.buildTree(), this.removeExpandGroup() }) }, destroyTree(){ this.cacheManage.recycleAllNodeCache(!0), this.visibleList = [], this.updateTreeList(this.data) }, GetGroupEquips(n){ n.groupId && this.groupNodeObject[n.groupId] && !this.isSearchStatus && (this.updateGroupEquips(n.groupId, !0), this.updateJob && clearTimeout(this.updateJob), this.updateJob = setTimeout(()=>{ this.updateCheckWidthJob() }, 500)) }, DeleteEquip(n){ const{groupId: e, equips: t} = n || {};e && this.groupNodeObject[e] && (this.updateGroupEquips(n.groupId), this.equipNumManage.resetGroupNum(), this.checkStatusManage && this.checkStatusManage.resetCheckedStatus()), t.length && t.forEach(i=>{ let o = this.nodesMap[`${e}-${i.id}`];o && (this.currentSelect.toString().includes(i.id) && this.$emit("currentDelete"), this.showStatus && (o.status == 2 ? this.equipStatusManage.setGroupStatus(e, !1, 2) : o.status == 6 && this.equipStatusManage.setGroupStatus(e, !1, 6)), delete this.nodesMap[`${e}-${i.id}`], delete this.equipCheckObject[i.id]), delete this.equipStatusObject[i.id] }) }, moveEquips(n){ const{updateGroups: e, buildTree: t} = n || {};!t && e ? e.forEach(i=>{ i && this.groupNodeObject[i] && (this.updateGroupEquips(i), this.equipNumManage.resetGroupNum(), this.checkStatusManage && this.checkStatusManage.resetCheckedStatus()) }) : t && this.rebuildTree() }, DeleteEquipGroup(n){ n.forEach(e=>{ e.groupId && this.nodesMap[e.groupId] && (this.isSearchStatus || this.rebuildTree()) }) }, AddEquipGroup(n){ const{parentGroupId: e, groupId: t} = n || {};t && this.nodesMap[e] && this.treeType && (this.isSearchStatus || this.rebuildTree()) }, EditEquipGroup(n){ const{groupId: e, groupName: t} = n;this.nodesMap[e] && (this.nodesMap[e].title = t) }, AddEquip(n){ this.filterEquip && (this.filterEquipList = n == null ? void 0 : n.equips.map(e=>e.id)), this.init() }, EditEquip(n){ const{equipNo: e, groupId: t, equipName: i} = n || {};this.nodesMap[`${t}-${e}`] && (this.isSearchStatus || (this.nodesMap[`${t}-${e}`].title = i)) }, childrenResetGroupNum(n){ this.equipNumManage.resetGroupNum(n, this.filterEquip, this.equipStatusObject) }, getEquipStatus(n){ return this.equipStatusManage.equipStatusObject[n] }}}, Kt = {class: "gw-tree", style: {height: "100%"}}, Jt = {class: "tree", style: {height: "100%"}};function Xt(n, e, t, i, o, r){ const a = h.resolveComponent("virtual-list", !0);return h.openBlock(), h.createElementBlock("div", Kt, [h.createElementVNode("div", Jt, [h.createVNode(a, {ref: "virtualList", class: "virtualList", "data-key": "key", "data-sources": o.visibleList, "data-component": o.itemComponent, keeps: 40, "extra-props": {currentSelect: o.currentSelect, nodeClick: r.nodeClick, showStatus: t.showStatus, filterEquip: t.filterEquip, showSettings: t.showSettings, showCheckbox: t.showCheckbox, onChecked: r.onChecked, showOperate: t.showOperate, groupEditAndNew: r.groupEditAndNew, deleteGroup: r.deleteGroup, colorConfig: t.colorConfig, childrenResetGroupNum: r.childrenResetGroupNum, getEquipStatus: r.getEquipStatus}}, null, 8, ["data-sources", "data-component", "extra-props"])])]) }const Yt = X(Vt, [["render", Xt]]);class Qt{constructor(){ this.eGroupNotify = new je("/eGroupNotify", "", ""), this.alreadyUpdate = {}, this.notify = null, this.window = window;try{ window.top.equipGroup, this.window = window.top }catch{ this.window = window } }stop(){ this.notify && this.notify.stop() }Init(){ this.eGroupNotify.openConnect().then(e=>{ this.notify = e;try{ e.invoke("GetEquipGroupTree"), e.invoke("GetAllEquipGroupTree") }catch(t){ console.log(t) }this.subscribeTo(e, "GetEquipGroupTree"), this.subscribeTo(e, "AddEquipGroup"), this.subscribeTo(e, "EditEquipGroup"), this.subscribeTo(e, "DeleteEquipGroup");try{ e.invoke("GetGroupEquips") }catch(t){ console.log(t) }this.subscribeTo(e, "GetGroupEquips"), this.subscribeTo(e, "AddEquip"), this.subscribeTo(e, "DeleteEquip"), this.subscribeTo(e, "EditEquip"), this.subscribeTo(e, "moveEquips"), this.subscribeTo(e, "GetAllEquipGroupTree"), e.onclose(t=>{ try{ this.Init() }catch(i){ console.log(i) }console.log("重连", t) }) }).catch(e=>{ console.error(e) }) }subscribeTo(e, t){ e.off(t), e.on(t, i=>{ i && i.isSuccess && (this[t] ? this[t](i.data) : this.notice({func: t, data: i.data, key: i.groupId})) }) }GetEquipGroupTree(e){ this.window.groupList || (this.window.groupList = e, this.notice({type: "GetEquipGroupTree"})) }GetAllEquipGroupTree(e){ this.window.groupList_manageMent || (this.window.groupList_manageMent = e, this.notice({type: "GetEquipGroupTreeWidthTreeType"})) }AddEquipGroup(e){ const{parentGroupId: t, groupId: i, groupName: o} = e || {};i && (this.window.groupList_manageMent || (this.window.groupList_manageMent = []), this.window.groupList_manageMent.push({parentId: t, id: i, name: o, equipCount: 0}), this.notice({type: "AddEquipGroup", data: e})) }EditEquipGroup(e){ const{groupId: t, groupName: i} = e;this.window.groupList && window.groupList.forEach(o=>{ o.id == t && (o.name = i) }), this.window.groupList_manageMent && window.groupList_manageMent.forEach(o=>{ o.id == t && (o.name = i) }), this.notice({type: "EditEquipGroup", data: e}) }deleteChildGroup(e, t){ let i = [];t.forEach(o=>{ o.parentId == e && i.push(o.id) }), i.forEach(o=>{ let r = t.findIndex(a=>a.id == o);r > -1 && t.splice(r, 1), this.deleteChildGroup(o, t) }) }DeleteEquipGroup(e){ e.forEach(t=>{ if(this.window.groupList){ let i = this.window.groupList.findIndex(o=>o.id == t.groupId);i > -1 && this.window.groupList.splice(i, 1), this.deleteChildGroup(t.groupId, this.window.groupList) }if(this.window.groupList_manageMent){ let i = this.window.groupList_manageMent.findIndex(o=>o.id == t.groupId);i > -1 && this.window.groupList_manageMent.splice(i, 1), this.deleteChildGroup(t.groupId, this.window.groupList_manageMent) } }), this.notice({type: "DeleteEquipGroup", data: e}) }GetGroupEquips(e){ const{groupId: t, equips: i} = e || {};this.alreadyUpdate[t] || (this.window.groupCache || (this.window.groupCache = {}), this.window.groupCache[t] = {}, t && i && i instanceof Array && (i.forEach(o=>{ o.title = o.name, o.groupId = t, o.equipNo = o.id, delete o.name, window.equipCache || (this.window.equipCache = {}), this.window.equipCache[o.id] = o, this.window.groupCache[t][o.id] = o }), this.window[`group-${t}`] = i, this.notice({type: "GetGroupEquips", data: {groupId: t}}), this.alreadyUpdate[t] = !0)) }AddEquip(e){ const{groupId: t, equips: i} = e || {};this.window[`group-${t}`] || (this.window[`group-${t}`] = []), this.window.groupCache || (this.window.groupCache = {}), this.window.groupCache[t] || (this.window.groupCache[t] = {}), this.window.equipCache || (this.window.equipCache = {});let o = this.window[`group-${t}`].length;if(t && i){ if(i.forEach((r, a)=>{ this.window[`group-${t}`].push({equipNo: r.id, groupId: t, id: r.id, title: r.name}), this.window.equipCache[r.id] = this.window[`group-${t}`][o + a], this.window.groupCache[t][r.id] = this.window[`group-${t}`][o + a] }), !this.exist(t, this.window.groupList)){ let r = this.findParentList(t, this.window.groupList_manageMent);this.window.groupList.push(...r) }this.notice({type: "AddEquip", data: e}) } }moveEquips(e){ let t = [], i = !0, o = [];const{sourceGroup: r, targetGroupId: a} = e || {};a && t.push(a), r.forEach(c=>{ if(t.push(c.groupId), (!this.window[`group-${a}`] || !this.window[`group-${a}`].length) && (this.window[`group-${a}`] = [], o.push(a)), this.window.groupCache || (this.window.groupCache = {}), this.window.groupCache[a] || (this.window.groupCache[a] = {}), c.equips.forEach(u=>{ if(u.title = u.name, u.groupId = a, u.equipNo = u.id, this.window[`group-${c.groupId}`]){ let s = this.window[`group-${c.groupId}`].findIndex(l=>l.id == u.id);s > -1 && this.window[`group-${c.groupId}`].splice(s, 1) }window.equipCache || (this.window.equipCache = {}), this.window.equipCache[u.id] = u, this.window.groupCache[a][u.id] = u, this.window[`group-${a}`].push(u) }), !this.window[`group-${c.groupId}`].length){ let u = this.window.groupList.findIndex(s=>s.id == c.groupId);u > -1 && this.window.groupList.splice(u, 1), this.deleteChildGroup(c.groupId, this.window.groupList) } }), o.forEach(c=>{ if(!this.exist(c, this.window.groupList)){ let u = this.findParentList(c, this.window.groupList_manageMent);this.window.groupList.push(...u) } }), this.notice({type: "moveEquips", data: {updateGroups: t, buildTree: i}}) }exist(e, t){ return t ? t.some(i=>i.id == e) : !1 }findParentList(e, t){ let i = [];if(t){ let o = t.findIndex(r=>r.id == e);o > -1 && i.push({...t[o]}), t[o].parentId && !this.exist(t[o].parentId, this.window.groupList) && i.push(...this.findParentList(t[o].parentId, this.window.groupList_manageMent)) }return i }DeleteEquip(e){ const{groupId: t, equips: i} = e || {};if(t && i && i instanceof Array){ if(this.window[`group-${t}`]){ for(let o = 0, r = i.length;o < r;o++){ let a = this.window[`group-${t}`].findIndex(c=>c.id == i[o].id);a > -1 && this.window[`group-${t}`].splice(a, 1), delete this.window.equipCache[i[o].id], delete this.window.groupCache[t][i[o].id] } }this.notice({type: "DeleteEquip", data: e}) } }EditEquip(e){ const{equipNo: t, groupId: i, equipName: o} = e || {};i && t && (window[`group-${i}`] && (this.window.equipCache[t] = o), this.notice({type: "EditEquip", data: e})) }notice(e){ if(this.window.hasIframe){ let t = document.getElementsByTagName("iframe");for(let i of t){ i.contentWindow.postMessage(e) } }else { window.postMessage(e, "*") } }}const Zt = {name: "treeV2", components: {tree: Yt}, mixins: [Ce], data(){ return{list: [], refId: q.generateUUID(), treeKey: null, listKey: null, hasBuildTree: !1} }, props: {treeType: {type: String, default: ""}}, mounted(){ this.treeKey = `equipGroup${this.treeType}`, this.listKey = `groupList${this.treeType}`, this.window[this.treeKey] ? this.list = q.formateList(JSON.parse(JSON.stringify(this.window[this.treeKey]))) : this.window[this.listKey] && this.buildTree(), window.executeQueue || (window.executeQueues = {}), window.executeQueues[this.refId] = this.destroyTree, window.addEventListener("message", n=>{ n && n.data && n.data.type && this[n.data.type] && this[n.data.type]() });try{ this.window.hasIframe || this.selfRequest() }catch{ this.selfRequest() } }, methods: {selfRequest(){ new Qt().Init() }, GetEquipGroupTreeWidthTreeType(){ this.treeType && this.window[this.listKey] && this.buildTree() }, GetEquipGroupTree(){ !this.treeType && this.window[this.listKey] && this.buildTree() }, buildTree(){ if(this.window[this.listKey]){ let n = q.listToTreeList(JSON.parse(JSON.stringify(this.window[this.listKey])));this.list = q.formateList(JSON.parse(JSON.stringify(n))), this.window[`equipGroup${this.treeType}`] = n, this.hasBuildTree = !0 } }, filterMethod(n){ this.$refs[this.refId].filterMethod(n) }, resetCheckedStatus(){ this.$refs[this.refId].resetCheckedStatus() }, getEquipSelectd(){ return this.$refs[this.refId].getEquipSelectd() }, getEquipGroupSelectd(){ return this.$refs[this.refId].getEquipGroupSelectd() }, getControlSelected(){ return this.$refs[this.refId].getControlSelected() }, destroyTree(){ this.$refs[this.refId].destroyTree() }}};function ei(n, e, t, i, o, r){ const a = h.resolveComponent("tree");return h.openBlock(), h.createBlock(a, h.mergeProps({ref: o.refId, data: o.list}, {...n.$attrs, ...n.$props}, h.toHandlers(n.$listeners), {buildTree: r.buildTree}), null, 16, ["data", "buildTree"]) }const Y = X(Zt, [["render", ei]]);return Y.install = function(n){ n.component(Y.name, Y) }, Y
|
|
1
|
+
(function (h, F) { typeof exports == "object" && typeof module < "u" ? module.exports = F(require("vue")) : typeof define == "function" && define.amd ? define(["vue"], F) : (h = typeof globalThis < "u" ? globalThis : h || self, h.EquipListVue3 = F(h.Vue)) })(this, function (h) {
|
|
2
|
+
"use strict"; const F = ""; function we(n, e) { let t = Object.keys(n); if (Object.getOwnPropertySymbols) { let i = Object.getOwnPropertySymbols(n); e && (i = i.filter(function (o) { return Object.getOwnPropertyDescriptor(n, o).enumerable })), t.push.apply(t, i) } return t } function H(n) { for (let e = 1; e < arguments.length; e++) { var t = arguments[e] != null ? arguments[e] : {}; e % 2 ? we(Object(t), !0).forEach(function (i) { ze(n, i, t[i]) }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(n, Object.getOwnPropertyDescriptors(t)) : we(Object(t)).forEach(function (i) { Object.defineProperty(n, i, Object.getOwnPropertyDescriptor(t, i)) }) } return n } function Be(n, e) { if (!(n instanceof e)) { throw new TypeError("Cannot call a class as a function") } } function Se(n, e) { for (let t = 0; t < e.length; t++) { let i = e[t]; i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(n, i.key, i) } } function Re(n, e, t) { return e && Se(n.prototype, e), t && Se(n, t), n } function ze(n, e, t) { return e in n ? Object.defineProperty(n, e, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : n[e] = t, n } function De(n) { return Fe(n) || He(n) || Ue(n) || We() } function Fe(n) { if (Array.isArray(n)) { return te(n) } } function He(n) { if (typeof Symbol < "u" && n[Symbol.iterator] != null || n["@@iterator"] != null) { return Array.from(n) } } function Ue(n, e) { if (n) { if (typeof n == "string") { return te(n, e); } let t = Object.prototype.toString.call(n).slice(8, -1); if (t === "Object" && n.constructor && (t = n.constructor.name), t === "Map" || t === "Set") { return Array.from(n); } if (t === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)) { return te(n, e) } } } function te(n, e) { (e == null || e > n.length) && (e = n.length); for (var t = 0, i = new Array(e); t < e; t++) { i[t] = n[t]; } return i } function We() {
|
|
3
|
+
throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
4
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)
|
|
5
|
+
} let O = { FRONT: "FRONT", BEHIND: "BEHIND" }, T = { INIT: "INIT", FIXED: "FIXED", DYNAMIC: "DYNAMIC" }, ye = 2, Ve = (function () { function n(e, t) { Be(this, n), this.init(e, t) } return Re(n, [{ key: "init", value: function (t, i) { this.param = t, this.callUpdate = i, this.sizes = new Map, this.firstRangeTotalSize = 0, this.firstRangeAverageSize = 0, this.lastCalcIndex = 0, this.fixedSizeValue = 0, this.calcType = T.INIT, this.offset = 0, this.direction = "", this.range = Object.create(null), t && this.checkRange(0, t.keeps - 1) } }, { key: "destroy", value: function () { this.init(null, null) } }, { key: "getRange", value: function () { let t = Object.create(null); return t.start = this.range.start, t.end = this.range.end, t.padFront = this.range.padFront, t.padBehind = this.range.padBehind, t } }, { key: "isBehind", value: function () { return this.direction === O.BEHIND } }, { key: "isFront", value: function () { return this.direction === O.FRONT } }, { key: "getOffset", value: function (t) { return (t < 1 ? 0 : this.getIndexOffset(t)) + this.param.slotHeaderSize } }, { key: "updateParam", value: function (t, i) { let o = this; this.param && t in this.param && (t === "uniqueIds" && this.sizes.forEach(function (r, a) { i.includes(a) || o.sizes.delete(a) }), this.param[t] = i) } }, { key: "saveSize", value: function (t, i) { this.sizes.set(t, i), this.calcType === T.INIT ? (this.fixedSizeValue = i, this.calcType = T.FIXED) : this.calcType === T.FIXED && this.fixedSizeValue !== i && (this.calcType = T.DYNAMIC, delete this.fixedSizeValue), this.calcType !== T.FIXED && typeof this.firstRangeTotalSize < "u" && (this.sizes.size < Math.min(this.param.keeps, this.param.uniqueIds.length) ? (this.firstRangeTotalSize = De(this.sizes.values()).reduce(function (o, r) { return o + r }, 0), this.firstRangeAverageSize = Math.round(this.firstRangeTotalSize / this.sizes.size)) : delete this.firstRangeTotalSize) } }, { key: "handleDataSourcesChange", value: function () { let t = this.range.start; this.isFront() ? t = t - ye : this.isBehind() && (t = t + ye), t = Math.max(t, 0), this.updateRange(this.range.start, this.getEndByStart(t)) } }, { key: "handleSlotSizeChange", value: function () { this.handleDataSourcesChange() } }, { key: "handleScroll", value: function (t) { this.direction = t < this.offset ? O.FRONT : O.BEHIND, this.offset = t, this.param && (this.direction === O.FRONT ? this.handleFront() : this.direction === O.BEHIND && this.handleBehind()) } }, { key: "handleFront", value: function () { let t = this.getScrollOvers(); if (!(t > this.range.start)) { let i = Math.max(t - this.param.buffer, 0); this.checkRange(i, this.getEndByStart(i)) } } }, { key: "handleBehind", value: function () { let t = this.getScrollOvers(); t < this.range.start + this.param.buffer || this.checkRange(t, this.getEndByStart(t)) } }, { key: "getScrollOvers", value: function () { let t = this.offset - this.param.slotHeaderSize; if (t <= 0) { return 0; } if (this.isFixedType()) { return Math.floor(t / this.fixedSizeValue); } for (var i = 0, o = 0, r = 0, a = this.param.uniqueIds.length; i <= a;) { if (o = i + Math.floor((a - i) / 2), r = this.getIndexOffset(o), r === t) { return o; } r < t ? i = o + 1 : r > t && (a = o - 1) } return i > 0 ? --i : 0 } }, { key: "getIndexOffset", value: function (t) { if (!t) { return 0; } for (var i = 0, o = 0, r = 0; r < t; r++) { o = this.sizes.get(this.param.uniqueIds[r]), i = i + (typeof o == "number" ? o : this.getEstimateSize()); } return this.lastCalcIndex = Math.max(this.lastCalcIndex, t - 1), this.lastCalcIndex = Math.min(this.lastCalcIndex, this.getLastIndex()), i } }, { key: "isFixedType", value: function () { return this.calcType === T.FIXED } }, { key: "getLastIndex", value: function () { return this.param.uniqueIds.length - 1 } }, { key: "checkRange", value: function (t, i) { let o = this.param.keeps, r = this.param.uniqueIds.length; r <= o ? (t = 0, i = this.getLastIndex()) : i - t < o - 1 && (t = i - o + 1), this.range.start !== t && this.updateRange(t, i) } }, { key: "updateRange", value: function (t, i) { this.range.start = t, this.range.end = i, this.range.padFront = this.getPadFront(), this.range.padBehind = this.getPadBehind(), this.callUpdate(this.getRange()) } }, { key: "getEndByStart", value: function (t) { let i = t + this.param.keeps - 1, o = Math.min(i, this.getLastIndex()); return o } }, { key: "getPadFront", value: function () { return this.isFixedType() ? this.fixedSizeValue * this.range.start : this.getIndexOffset(this.range.start) } }, { key: "getPadBehind", value: function () { let t = this.range.end, i = this.getLastIndex(); return this.isFixedType() ? (i - t) * this.fixedSizeValue : this.lastCalcIndex === i ? this.getIndexOffset(i) - this.getIndexOffset(t) : (i - t) * this.getEstimateSize() } }, { key: "getEstimateSize", value: function () { return this.isFixedType() ? this.fixedSizeValue : this.firstRangeAverageSize || this.param.estimateSize } }]), n })(), Ke = { dataKey: { type: [String, Function], required: !0 }, dataSources: { type: Array, required: !0, default: function () { return [] } }, dataComponent: { type: [Object, Function], required: !0 }, keeps: { type: Number, default: 30 }, extraProps: { type: Object }, estimateSize: { type: Number, default: 50 }, direction: { type: String, default: "vertical" }, start: { type: Number, default: 0 }, offset: { type: Number, default: 0 }, topThreshold: { type: Number, default: 0 }, bottomThreshold: { type: Number, default: 0 }, pageMode: { type: Boolean, default: !1 }, rootTag: { type: String, default: "div" }, wrapTag: { type: String, default: "div" }, wrapClass: { type: String, default: "wrap" }, wrapStyle: { type: Object }, itemTag: { type: String, default: "div" }, itemClass: { type: String, default: "" }, itemClassAdd: { type: Function }, itemStyle: { type: Object }, headerTag: { type: String, default: "div" }, headerClass: { type: String, default: "" }, headerStyle: { type: Object }, footerTag: { type: String, default: "div" }, footerClass: { type: String, default: "" }, footerStyle: { type: Object }, itemScopedSlots: { type: Object } }, Je = { index: { type: Number }, event: { type: String }, tag: { type: String }, horizontal: { type: Boolean }, source: { type: Object }, component: { type: [Object, Function] }, uniqueKey: { type: [String, Number] }, extraProps: { type: Object }, scopedSlots: { type: Object } }, Xe = { event: { type: String }, uniqueKey: { type: String }, tag: { type: String }, horizontal: { type: Boolean } }, me = function (e, t, i) { let o = null, r = h.computed(function () { return e.horizontal ? "offsetWidth" : "offsetHeight" }), a = function () { return t.value ? t.value[r.value] : 0 }, c = function () { let s = e.event, l = e.uniqueKey, p = e.hasInitial; i(s, l, a(), p) }; h.onMounted(function () { typeof ResizeObserver < "u" && (o = new ResizeObserver(function () { c() }), t.value && o.observe(t.value)) }), h.onUpdated(function () { c() }), h.onUnmounted(function () { o && (o.disconnect(), o = null) }) }, Ye = h.defineComponent({ name: "VirtualListItem", props: Je, emits: ["itemResize"], setup: function (e, t) { let i = t.emit, o = h.ref(null); return me(e, o, i), function () { let r = e.tag, a = e.component, c = e.extraProps, u = c === void 0 ? {} : c, s = e.index, l = e.source, p = e.scopedSlots, g = p === void 0 ? {} : p, R = e.uniqueKey, z = H(H({}, u), {}, { source: l, index: s }); return h.createVNode(r, { key: R, ref: o }, { default: function () { return [h.createVNode(a, H(H({}, z), {}, { scopedSlots: g }), null)] } }) } } }), ve = h.defineComponent({ name: "VirtualListSlot", props: Xe, emits: ["slotResize"], setup: function (e, t) { let i = t.slots, o = t.emit, r = h.ref(null); return me(e, r, o), function () { let a, c = e.tag, u = e.uniqueKey; return h.createVNode(c, { ref: r, key: u }, { default: function () { return [(a = i.default) === null || a === void 0 ? void 0 : a.call(i)] } }) } } }), G; (function (n) { n.ITEM = "itemResize", n.SLOT = "slotResize" })(G || (G = {})); let I; (function (n) { n.HEADER = "thead", n.FOOTER = "tfoot" })(I || (I = {})); let Qe = h.defineComponent({ name: "VirtualList", props: Ke, setup: function (e, t) { let i = t.emit, o = t.slots, r = t.expose, a = e.direction === "horizontal", c = a ? "scrollLeft" : "scrollTop", u = h.ref(null), s = h.ref(), l = h.ref(null), p; h.watch(function () { return e.dataSources.length }, function () { p.updateParam("uniqueIds", _e()), p.handleDataSourcesChange() }), h.watch(function () { return e.keeps }, function (b) { p.updateParam("keeps", b), p.handleSlotSizeChange() }), h.watch(function () { return e.start }, function (b) { he(b) }), h.watch(function () { return e.offset }, function (b) { return j(b) }); var g = function (f) { return p.sizes.get(f) }, R = function () { return e.pageMode ? document.documentElement[c] || document.body[c] : s.value ? Math.ceil(s.value[c]) : 0 }, z = function () { let f = a ? "clientWidth" : "clientHeight"; return e.pageMode ? document.documentElement[f] || document.body[f] : s.value ? Math.ceil(s.value[f]) : 0 }, Q = function () { let f = a ? "scrollWidth" : "scrollHeight"; return e.pageMode ? document.documentElement[f] || document.body[f] : s.value ? Math.ceil(s.value[f]) : 0 }, ti = function (f, w, C, k) { i("scroll", k, p.getRange()), p.isFront() && e.dataSources.length && f - e.topThreshold <= 0 ? i("totop") : p.isBehind() && f + w + e.bottomThreshold >= C && i("tobottom") }, le = function (f) { let w = R(), C = z(), k = Q(); w < 0 || w + C > k + 1 || !k || (p.handleScroll(w), ti(w, C, k, f)) }, _e = function () { let f = e.dataKey, w = e.dataSources, C = w === void 0 ? [] : w; return C.map(function (k) { return typeof f == "function" ? f(k) : k[f] }) }, ii = function (f) { u.value = f }, ni = function () { p = new Ve({ slotHeaderSize: 0, slotFooterSize: 0, keeps: e.keeps, estimateSize: e.estimateSize, buffer: Math.round(e.keeps / 3), uniqueIds: _e() }, ii), u.value = p.getRange() }, he = function (f) { if (f >= e.dataSources.length - 1) { Pe(); } else { let w = p.getOffset(f); j(w) } }, j = function (f) { e.pageMode ? (document.body[c] = f, document.documentElement[c] = f) : s.value && (s.value[c] = f) }, ri = function () { for (var f = [], w = u.value, C = w.start, k = w.end, de = e.dataSources, _ = e.dataKey, pe = e.itemClass, fe = e.itemTag, ge = e.itemStyle, be = e.extraProps, Z = e.dataComponent, ee = e.itemScopedSlots, E = C; E <= k; E++) { let N = de[E]; if (N) { let D = typeof _ == "function" ? _(N) : N[_]; typeof D == "string" || typeof D == "number" ? f.push(h.createVNode(Ye, { index: E, tag: fe, event: G.ITEM, horizontal: a, uniqueKey: D, source: N, extraProps: be, component: Z, scopedSlots: ee, style: ge, class: "".concat(pe).concat(e.itemClassAdd ? " " + e.itemClassAdd(E) : ""), onItemResize: oi }, null)) : console.warn("Cannot get the data-key '".concat(_, "' from data-sources.")) } else { console.warn("Cannot get the index '".concat(E, "' from data-sources.")) } } return f }, oi = function (f, w) { p.saveSize(f, w), i("resized", f, w) }, Ge = function (f, w, C) { f === I.HEADER ? p.updateParam("slotHeaderSize", w) : f === I.FOOTER && p.updateParam("slotFooterSize", w), C && p.handleSlotSizeChange() }, Pe = function b() { if (l.value) { let f = l.value[a ? "offsetLeft" : "offsetTop"]; j(f), setTimeout(function () { R() + z() < Q() && b() }, 3) } }, si = function () { if (s.value) { let f = s.value.getBoundingClientRect(), w = s.value.ownerDocument.defaultView, C = a ? f.left + w.pageXOffset : f.top + w.pageYOffset; p.updateParam("slotHeaderSize", C) } }, ai = function () { return p.sizes.size }; return h.onBeforeMount(function () { ni() }), h.onActivated(function () { j(p.offset) }), h.onMounted(function () { e.start ? he(e.start) : e.offset && j(e.offset), e.pageMode && (si(), document.addEventListener("scroll", le, { passive: !1 })) }), h.onUnmounted(function () { p.destroy(), e.pageMode && document.removeEventListener("scroll", le) }), r({ scrollToBottom: Pe, getSizes: ai, getSize: g, getOffset: R, getScrollSize: Q, getClientSize: z, scrollToOffset: j, scrollToIndex: he }), function () { let b = e.pageMode, f = e.rootTag, w = e.wrapTag, C = e.wrapClass, k = e.wrapStyle, de = e.headerTag, _ = e.headerClass, pe = e.headerStyle, fe = e.footerTag, ge = e.footerClass, be = e.footerStyle, Z = u.value, ee = Z.padFront, E = Z.padBehind, N = { padding: a ? "0px ".concat(E, "px 0px ").concat(ee, "px") : "".concat(ee, "px 0px ").concat(E, "px") }, D = k ? Object.assign({}, k, N) : N, Ae = o.header, $e = o.footer; return h.createVNode(f, { ref: s, onScroll: !b && le }, { default: function () { return [Ae && h.createVNode(ve, { class: _, style: pe, tag: de, event: G.SLOT, uniqueKey: I.HEADER, onSlotResize: Ge }, { default: function () { return [Ae()] } }), h.createVNode(w, { class: C, style: D }, { default: function () { return [ri()] } }), $e && h.createVNode(ve, { class: ge, style: be, tag: fe, event: G.SLOT, uniqueKey: I.FOOTER, onSlotResize: Ge }, { default: function () { return [$e()] } }), h.createVNode("div", { ref: l, style: { width: a ? "0px" : "100%", height: a ? "100%" : "0px" } }, null)] } }) } } }); class Ze { constructor(e, t, i) { this.groupNodeObject = e, this.nodesMap = t, this.controlObject = i } addNodesMap(e) { e && e.forEach(t => { this.nodesMap[t.key] = t }) } removeNodesMap(e) { e && e.forEach(t => { delete this.nodesMap[t.key] }) } recycleAllNodeCache(e) { for (let t in this.groupNodeObject) { this.groupNodeObject[t].expand = !1, this.groupNodeObject[t].count = 0, this.recycleGroupCache(this.groupNodeObject[t].key), e && delete this.groupNodeObject[t] } } recycleGroupCache(e) { if (this.groupNodeObject[e]) { this.groupNodeObject[e].children = [], this.removeNodesMap(this.groupNodeObject[e].equips), this.groupNodeObject[e].equips = [], this.groupNodeObject[e].equips.length = 0, this.groupNodeObject[e].expand = !1; for (let t in this.groupNodeObject) { this.groupNodeObject[t].groupId == e && this.recycleGroupCache(this.groupNodeObject[t].key) } } } closeBrotherNode(e) { if (e && this.groupNodeObject[e]) { let t = this.groupNodeObject[e].groupId; for (let i in this.groupNodeObject) { this.groupNodeObject[i].groupId == t && this.groupNodeObject[i].key != e && this.groupNodeObject[i].expand && (this.groupNodeObject[i].expand = !1, this.recycleGroupCache(this.groupNodeObject[i].key)) } } } } class U { constructor() { window = window; try { window.top.equipGroup, window = window.top } catch { window = window } } } const Ce = { data() { return { window: null } }, created() { window = window; try { window.top.equipGroup, window = window.top } catch { window = window } } }; class et extends U { constructor(e, t, i, o, r, a) { super(), this.equipControllObject = i, this.groupNodeObject = e, this.nodesMap = t, this.controlObject = o, this.equipCheckObject = r, this.isSearchStatus = !1, this.searchStatusGroupObject = {}, this.aliasName = a } resetCheckedStatus() { Object.values(this.nodesMap).forEach(e => { this.setCheckStatus(e.key, !1, !1) }), Object.keys(this.equipCheckObject).forEach(e => delete this.equipCheckObject[e]), this.updateGroupCheckStatus() } reComputedCheckNum(e) { this.isSearchStatus = e, this.updateGroupCheckStatus() } updateCheckedStatusWithEquips(e) { let t = []; Array.isArray(e) ? t = e.map(i => ({ equipNo: i, groupId: null })) : e !== null && typeof e == "object" && Object.keys(e).forEach(i => { Array.isArray(e[i]) && e[i].forEach(o => { t.push({ equipNo: o, groupId: Number(i) }) }) }); for (let i = 0, o = t.length; i < o; i++) { const { equipNo: r, groupId: a } = t[i]; if (a != null) { const c = `${a}-${r}`; this.setEquipCheckObject(c, !0, !1, a), this.setCheckStatus(c, !0, !1), this.updateExpandControlCheckStatus(a, r) } else { const c = window.equipCache && window.equipCache[r]; c && (c.groupIds || (c.groupId ? [c.groupId] : [])).forEach(s => { const l = `${s}-${r}`; this.setEquipCheckObject(l, !0, !1, s), this.setCheckStatus(l, !0, !1), this.updateExpandControlCheckStatus(s, r) }) } } } updateExpandControlCheckStatus(e, t) { let i = this.nodesMap[`${e}-${t}`]; i && i.settings && i.settings.length && i.settings.forEach(o => { this.nodesMap[`${e}-${t}-${o.setNo}`] && this.setCheckStatus(`${e}-${t}-${o.setNo}`, !0, !1) }) } updateCheckedStatusWithControls(e) { for (let t = 0, i = e.length; t < i; t++) { let o = e[t], r, a, c; if (o !== null && typeof o == "object" && !Array.isArray(o)) { r = o.equipNo, a = o.setNo, c = o.groupId; } else { let s = o.split("."); r = s[0], a = s[1], c = null } this.equipControllObject[r] || (this.equipControllObject[r] = []), this.equipControllObject[r].push(Number(a)); const u = window.equipCache && window.equipCache[r]; u && (c != null ? [c] : u.groupIds || (u.groupId ? [u.groupId] : [])).forEach(l => { const p = `${l}-${r}`, g = `${l}-${r}-${a}`; this.nodesMap[g] && this.setCheckStatus(g, !0, !1), this.nodesMap[p] && this.setCheckStatus(p, !1, !0), this.setEquipCheckObject(p, !1, !0, l) }) } } updateGroupCheckStatus() { this.getSortedGroupsByLevel().forEach(t => { const i = this.computeGroupStatus(t.key); this.setCheckStatus(t.key, i.checked, i.indeterminate), t.equipSelectCount = i.selectCount }) } getSortedGroupsByLevel() { return Object.values(this.groupNodeObject).sort((e, t) => t.level - e.level) } computeGroupStatus(e) { const t = this.groupNodeObject[e]; if (!t) { return { checked: !1, indeterminate: !1, selectCount: 0 }; } const i = this.isSearchStatus ? window[`group-${e}-search`] || [] : window[`group-${e}${this.aliasName}`] || []; let o = 0; i.forEach(p => { const g = `${e}-${p.equipNo}`; this.equipCheckObject[g] && this.equipCheckObject[g].checked && o++ }); let r = 0, a = 0, c = !1, u = !1; t.groups && t.groups.length > 0 && t.groups.forEach(p => { const g = this.nodesMap[p.key]; g && (g.checked ? (r += g.count || 0, c = !0) : g.indeterminate ? (u = !0, c = !0) : u = !0, a += g.count || 0) }); const s = o + r, l = t.count || 0; return l === 0 ? { checked: !1, indeterminate: !1, selectCount: 0 } : s === 0 ? c ? { checked: !1, indeterminate: !0, selectCount: s } : { checked: !1, indeterminate: !1, selectCount: 0 } : s === l && !u ? { checked: !0, indeterminate: !1, selectCount: s } : { checked: !1, indeterminate: !0, selectCount: s } } setControlStatus(e, t, i, o) { e && e.forEach(r => { this.nodesMap[`${t}-${i}-${r.setNo}`] && this.setCheckStatus(`${t}-${i}-${r.setNo}`, o, !1) }) } updateControlCheckStatus() { Object.keys(this.controlObject).forEach(e => { const [t, i] = e.split("-"); let o = this.nodesMap[e]; if (o) { if (o.checked) { let r = o.settings; this.setControlStatus(r, t, i, !0) } else if (!o.checked && !o.indeterminate) { let r = o.settings; this.setControlStatus(r, t, i, !1) } else { this.equipControllObject[i] && this.equipControllObject[i].forEach(r => { let a = `${t}-${i}-${r}`; this.nodesMap[a] && this.setCheckStatus(a, !0, !1) }) } } }) } getGroupChecked() { let e = []; return Object.keys(this.groupNodeObject).forEach(t => { this.groupNodeObject[t].checked && e.push(t) }), e } getEquipSelectd() { let e = [], t = new Set; return Object.keys(this.equipCheckObject).forEach(i => { if (this.equipCheckObject[i].checked) { try { t.add(Number(i.split("-")[1])) } catch (o) { console.log(o) } } }), e = Array.from(t), e } getEquipGroupSelectd() { let e = Object.keys(this.equipCheckObject); return e.length > 0 && (e = this.returnArray(e)), e } returnArray(e) { const t = []; return e.forEach(i => { const [o, r] = i.split("-"), a = parseInt(r); isNaN(a) || t.push(a) }), t } parseEquipArrayToGroupFormat(e) { const t = {}; return e.forEach(i => { const [o, r] = i.split("-"), a = parseInt(o); isNaN(a) || (t[a] || (t[a] = []), t[a].push(parseInt(r))) }), t } getControlSelected() { let e = []; return Object.keys(this.equipControllObject).forEach(t => { e.push(...this.equipControllObject[t].map(i => `${t}.${i}`)) }), e } onChecked(e, t) { this.isSearchStatus = t || !1, e.isGroup && !e.isEquip ? this.selectGroup(e) : e.isEquip ? this.selectEquip(e) : e.isSetting && this.selectControl(e) } setCheckStatus(e, t, i, o) { this.nodesMap[e] && (this.nodesMap[e].checked = t, this.nodesMap[e].isGroup && (this.nodesMap[e].indeterminate = i)) } setEquipCheckObject(e, t, i, o) { this.equipCheckObject[e] || (this.equipCheckObject[e] = {}), this.equipCheckObject[e].checked = t, this.equipCheckObject[e].indeterminate = i, this.equipCheckObject[e].groupId = o, !t && !i && delete this.equipCheckObject[e] } selectGroup(e) { this.updateAllEquipStatus(e.key, e.checked), this.updateControlCheckStatus(), this.updateGroupCheckStatus() } updateAllEquipStatus(e, t) { const i = this.groupNodeObject[e]; if (!i) { return; } (this.isSearchStatus ? window[`group-${e}-search`] || [] : window[`group-${e}${this.aliasName}`] || []).forEach(r => { const a = `${e}-${r.equipNo}`; this.setEquipCheckObject(a, t, !1, e), this.nodesMap[a] && this.setCheckStatus(a, t, !1) }), i.groups && i.groups.length > 0 && i.groups.forEach(r => { this.updateAllEquipStatus(r.key, t) }) } selectEquip(e) { const t = `${e.groupId}-${e.equipNo}`; this.setEquipCheckObject(t, e.checked, !1, e.groupId), this.nodesMap[t] && this.setCheckStatus(t, e.checked, !1), this.updateControlCheckStatus(), this.updateGroupCheckStatus() } updateEquipControl(e, t, i) { this.equipControllObject[e] || (this.equipControllObject[e] = []), i ? this.equipControllObject[e].push(t) : this.equipControllObject[e] = this.equipControllObject[e].filter(o => o != t) } selectControl(e) { const t = `${e.groupId}-${e.equipNo}`, i = `${e.groupId}-${e.equipNo}-${e.setNo}`, o = this.nodesMap[t]; if (!o) { return; } this.updateEquipControl(e.equipNo, e.setNo, e.checked), this.setCheckStatus(i, e.checked, !1); const r = o.settings || [], a = this.equipControllObject[e.equipNo] || [], c = r.length, u = a.length; e.checked ? u === c ? (delete this.equipControllObject[e.equipNo], this.setEquipCheckObject(t, !0, !1, e.groupId), this.setCheckStatus(t, !0, !1)) : (this.setEquipCheckObject(t, !1, !0, e.groupId), this.setCheckStatus(t, !1, !0)) : u === 0 ? (this.setEquipCheckObject(t, !1, !1, e.groupId), this.setCheckStatus(t, !1, !1)) : (this.setEquipCheckObject(t, !1, !0, e.groupId), this.setCheckStatus(t, !1, !0)), this.updateGroupCheckStatus() } } class tt extends U { constructor(e, t) { super(), this.aliasName = t, this.groupNodeObject = e } resetGroupNum(e, t, i) { this.clearAllEquipNum(); for (let o in this.groupNodeObject) { let r = []; e ? r = window[`group-${o}-search`] : r = window[`group-${o}${this.aliasName}`], t && r && r.length && (r = r.filter(c => i[c.equipNo] === 2)); let a = r ? r.length : 0; this.groupNodeObject[o].equipCount = a, a && this.setGroupNum(o, a) } } clearAllEquipNum() { for (let e in this.groupNodeObject) { this.groupNodeObject[e].equipCount = 0, this.groupNodeObject[e].count = 0 } } setGroupNum(e, t) { this.groupNodeObject[e] && (this.groupNodeObject[e].count = Number(this.groupNodeObject[e].count) + Number(t), this.setGroupNum(this.groupNodeObject[e].groupId, t)) } getAllEquipsNum() { let e = 0; for (let t in this.groupNodeObject) { window[`group-${this.groupNodeObject[t].key}${this.aliasName}`] && (e = e + window[`group-${this.groupNodeObject[t].key}${this.aliasName}`].length); } return e } } let ie = globalThis && globalThis.__extends || (function () { let n = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (e, t) { e.__proto__ = t } || function (e, t) { for (let i in t) { t.hasOwnProperty(i) && (e[i] = t[i]) } }; return function (e, t) { n(e, t); function i() { this.constructor = e } e.prototype = t === null ? Object.create(t) : (i.prototype = t.prototype, new i) } })(), P = (function (n) { ie(e, n); function e(t, i) { let o = this.constructor, r = this, a = o.prototype; return r = n.call(this, t) || this, r.statusCode = i, r.__proto__ = a, r } return e })(Error), ne = (function (n) { ie(e, n); function e(t) { let i = this.constructor; t === void 0 && (t = "A timeout occurred."); let o = this, r = i.prototype; return o = n.call(this, t) || this, o.__proto__ = r, o } return e })(Error), W = (function (n) { ie(e, n); function e(t) { let i = this.constructor; t === void 0 && (t = "An abort occurred."); let o = this, r = i.prototype; return o = n.call(this, t) || this, o.__proto__ = r, o } return e })(Error), re = globalThis && globalThis.__assign || Object.assign || function (n) { for (var e, t = 1, i = arguments.length; t < i; t++) { e = arguments[t]; for (let o in e) { Object.prototype.hasOwnProperty.call(e, o) && (n[o] = e[o]) } } return n }, ke = (function () { function n(e, t, i) { this.statusCode = e, this.statusText = t, this.content = i } return n })(), oe = (function () { function n() { } return n.prototype.get = function (e, t) { return this.send(re({}, t, { method: "GET", url: e })) }, n.prototype.post = function (e, t) { return this.send(re({}, t, { method: "POST", url: e })) }, n.prototype.delete = function (e, t) { return this.send(re({}, t, { method: "DELETE", url: e })) }, n.prototype.getCookieString = function (e) { return "" }, n })(), d; (function (n) { n[n.Trace = 0] = "Trace", n[n.Debug = 1] = "Debug", n[n.Information = 2] = "Information", n[n.Warning = 3] = "Warning", n[n.Error = 4] = "Error", n[n.Critical = 5] = "Critical", n[n.None = 6] = "None" })(d || (d = {})); let se = (function () { function n() { } return n.prototype.log = function (e, t) { }, n.instance = new n, n })(), it = globalThis && globalThis.__awaiter || function (n, e, t, i) { return new (t || (t = Promise))(function (o, r) { function a(s) { try { u(i.next(s)) } catch (l) { r(l) } } function c(s) { try { u(i.throw(s)) } catch (l) { r(l) } } function u(s) { s.done ? o(s.value) : new t(function (l) { l(s.value) }).then(a, c) } u((i = i.apply(n, e || [])).next()) }) }, nt = globalThis && globalThis.__generator || function (n, e) { let t = { label: 0, sent: function () { if (r[0] & 1) { throw r[1]; } return r[1] }, trys: [], ops: [] }, i, o, r, a; return a = { next: c(0), throw: c(1), return: c(2) }, typeof Symbol == "function" && (a[Symbol.iterator] = function () { return this }), a; function c(s) { return function (l) { return u([s, l]) } } function u(s) { if (i) { throw new TypeError("Generator is already executing."); } for (; t;) { try { if (i = 1, o && (r = s[0] & 2 ? o.return : s[0] ? o.throw || ((r = o.return) && r.call(o), 0) : o.next) && !(r = r.call(o, s[1])).done) { return r; } switch (o = 0, r && (s = [s[0] & 2, r.value]), s[0]) { case 0: case 1: r = s; break; case 4: return t.label++, { value: s[1], done: !1 }; case 5: t.label++, o = s[1], s = [0]; continue; case 7: s = t.ops.pop(), t.trys.pop(); continue; default: if (r = t.trys, !(r = r.length > 0 && r[r.length - 1]) && (s[0] === 6 || s[0] === 2)) { t = 0; continue } if (s[0] === 3 && (!r || s[1] > r[0] && s[1] < r[3])) { t.label = s[1]; break } if (s[0] === 6 && t.label < r[1]) { t.label = r[1], r = s; break } if (r && t.label < r[2]) { t.label = r[2], t.ops.push(s); break } r[2] && t.ops.pop(), t.trys.pop(); continue }s = e.call(n, t) } catch (l) { s = [6, l], o = 0 } finally { i = r = 0 } } if (s[0] & 5) { throw s[1]; } return { value: s[0] ? s[1] : void 0, done: !0 } } }, y = (function () { function n() { } return n.isRequired = function (e, t) { if (e == null) { throw new Error("The '" + t + "' argument is required.") } }, n.isIn = function (e, t, i) { if (!(e in t)) { throw new Error("Unknown " + i + " value: " + e + ".") } }, n })(); function A(n, e) { let t = ""; return V(n) ? (t = "Binary data of length " + n.byteLength, e && (t += ". Content: '" + rt(n) + "'")) : typeof n == "string" && (t = "String data of length " + n.length, e && (t += ". Content: '" + n + "'")), t } function rt(n) { let e = new Uint8Array(n), t = ""; return e.forEach(function (i) { let o = i < 16 ? "0" : ""; t += "0x" + o + i.toString(16) + " " }), t.substr(0, t.length - 1) } function V(n) { return n && typeof ArrayBuffer < "u" && (n instanceof ArrayBuffer || n.constructor && n.constructor.name === "ArrayBuffer") } function Ee(n, e, t, i, o, r, a) { return it(this, void 0, void 0, function () { let c, u, s, l, p; return nt(this, function (g) { switch (g.label) { case 0: return o ? [4, o()] : [3, 2]; case 1: s = g.sent(), s && (u = (c = {}, c.Authorization = "Bearer " + s, c)), g.label = 2; case 2: return n.log(d.Trace, "(" + e + " transport) sending data. " + A(r, a) + "."), l = V(r) ? "arraybuffer" : "text", [4, t.post(i, { content: r, headers: u, responseType: l })]; case 3: return p = g.sent(), n.log(d.Trace, "(" + e + " transport) request complete. Response status: " + p.statusCode + "."), [2] } }) }) } function ot(n) { return n === void 0 ? new ae(d.Information) : n === null ? se.instance : n.log ? n : new ae(n) } var st = (function () { function n() { this.observers = [] } return n.prototype.next = function (e) { for (let t = 0, i = this.observers; t < i.length; t++) { let o = i[t]; o.next(e) } }, n.prototype.error = function (e) { for (let t = 0, i = this.observers; t < i.length; t++) { let o = i[t]; o.error && o.error(e) } }, n.prototype.complete = function () { for (let e = 0, t = this.observers; e < t.length; e++) { let i = t[e]; i.complete && i.complete() } }, n.prototype.subscribe = function (e) { return this.observers.push(e), new at(this, e) }, n })(), at = (function () { function n(e, t) { this.subject = e, this.observer = t } return n.prototype.dispose = function () { let e = this.subject.observers.indexOf(this.observer); e > -1 && this.subject.observers.splice(e, 1), this.subject.observers.length === 0 && this.subject.cancelCallback && this.subject.cancelCallback().catch(function (t) { }) }, n })(), ae = (function () { function n(e) { this.minimumLogLevel = e } return n.prototype.log = function (e, t) { if (e >= this.minimumLogLevel) { switch (e) { case d.Critical: case d.Error: console.error("[" + new Date().toISOString() + "] " + d[e] + ": " + t); break; case d.Warning: console.warn("[" + new Date().toISOString() + "] " + d[e] + ": " + t); break; case d.Information: console.info("[" + new Date().toISOString() + "] " + d[e] + ": " + t); break; default: console.log("[" + new Date().toISOString() + "] " + d[e] + ": " + t); break } } }, n })(), ut = globalThis && globalThis.__extends || (function () { let n = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (e, t) { e.__proto__ = t } || function (e, t) { for (let i in t) { t.hasOwnProperty(i) && (e[i] = t[i]) } }; return function (e, t) { n(e, t); function i() { this.constructor = e } e.prototype = t === null ? Object.create(t) : (i.prototype = t.prototype, new i) } })(), ct = globalThis && globalThis.__assign || Object.assign || function (n) { for (var e, t = 1, i = arguments.length; t < i; t++) { e = arguments[t]; for (let o in e) { Object.prototype.hasOwnProperty.call(e, o) && (n[o] = e[o]) } } return n }, K; if (typeof XMLHttpRequest > "u") { let lt = typeof __webpack_require__ == "function" ? __non_webpack_require__ : require; K = lt("request") } let ht = (function (n) { ut(e, n); function e(t) { let i = n.call(this) || this; if (typeof K > "u") { throw new Error("The 'request' module could not be loaded."); } return i.logger = t, i.cookieJar = K.jar(), i.request = K.defaults({ jar: i.cookieJar }), i } return e.prototype.send = function (t) { let i = this; return new Promise(function (o, r) { let a; V(t.content) ? a = Buffer.from(t.content) : a = t.content || ""; let c = i.request(t.url, { body: a, encoding: t.responseType === "arraybuffer" ? null : "utf8", headers: ct({ "X-Requested-With": "XMLHttpRequest" }, t.headers), method: t.method, timeout: t.timeout }, function (u, s, l) { if (t.abortSignal && (t.abortSignal.onabort = null), u) { u.code === "ETIMEDOUT" && (i.logger.log(d.Warning, "Timeout from HTTP request."), r(new ne)), i.logger.log(d.Warning, "Error from HTTP request. " + u), r(u); return } s.statusCode >= 200 && s.statusCode < 300 ? o(new ke(s.statusCode, s.statusMessage || "", l)) : r(new P(s.statusMessage || "", s.statusCode || 0)) }); t.abortSignal && (t.abortSignal.onabort = function () { c.abort(), r(new W) }) }) }, e.prototype.getCookieString = function (t) { return this.cookieJar.getCookieString(t) }, e })(oe), dt = globalThis && globalThis.__extends || (function () { let n = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (e, t) { e.__proto__ = t } || function (e, t) { for (let i in t) { t.hasOwnProperty(i) && (e[i] = t[i]) } }; return function (e, t) { n(e, t); function i() { this.constructor = e } e.prototype = t === null ? Object.create(t) : (i.prototype = t.prototype, new i) } })(), pt = (function (n) { dt(e, n); function e(t) { let i = n.call(this) || this; return i.logger = t, i } return e.prototype.send = function (t) { let i = this; return t.abortSignal && t.abortSignal.aborted ? Promise.reject(new W) : t.method ? t.url ? new Promise(function (o, r) { let a = new XMLHttpRequest; a.open(t.method, t.url, !0), a.withCredentials = !0, a.setRequestHeader("X-Requested-With", "XMLHttpRequest"), a.setRequestHeader("Content-Type", "text/plain;charset=UTF-8"); let c = t.headers; c && Object.keys(c).forEach(function (u) { a.setRequestHeader(u, c[u]) }), t.responseType && (a.responseType = t.responseType), t.abortSignal && (t.abortSignal.onabort = function () { a.abort(), r(new W) }), t.timeout && (a.timeout = t.timeout), a.onload = function () { t.abortSignal && (t.abortSignal.onabort = null), a.status >= 200 && a.status < 300 ? o(new ke(a.status, a.statusText, a.response || a.responseText)) : r(new P(a.statusText, a.status)) }, a.onerror = function () { i.logger.log(d.Warning, "Error from HTTP request. " + a.status + ": " + a.statusText + "."), r(new P(a.statusText, a.status)) }, a.ontimeout = function () { i.logger.log(d.Warning, "Timeout from HTTP request."), r(new ne) }, a.send(t.content || "") }) : Promise.reject(new Error("No url defined.")) : Promise.reject(new Error("No method defined.")) }, e })(oe), ft = globalThis && globalThis.__extends || (function () { let n = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (e, t) { e.__proto__ = t } || function (e, t) { for (let i in t) { t.hasOwnProperty(i) && (e[i] = t[i]) } }; return function (e, t) { n(e, t); function i() { this.constructor = e } e.prototype = t === null ? Object.create(t) : (i.prototype = t.prototype, new i) } })(), gt = (function (n) { ft(e, n); function e(t) { let i = n.call(this) || this; return typeof XMLHttpRequest < "u" ? i.httpClient = new pt(t) : i.httpClient = new ht(t), i } return e.prototype.send = function (t) { return t.abortSignal && t.abortSignal.aborted ? Promise.reject(new W) : t.method ? t.url ? this.httpClient.send(t) : Promise.reject(new Error("No url defined.")) : Promise.reject(new Error("No method defined.")) }, e.prototype.getCookieString = function (t) { return this.httpClient.getCookieString(t) }, e })(oe), M = (function () { function n() { } return n.write = function (e) { return "" + e + n.RecordSeparator }, n.parse = function (e) { if (e[e.length - 1] !== n.RecordSeparator) { throw new Error("Message is incomplete."); } let t = e.split(n.RecordSeparator); return t.pop(), t }, n.RecordSeparatorCode = 30, n.RecordSeparator = String.fromCharCode(n.RecordSeparatorCode), n })(), bt = (function () { function n() { } return n.prototype.writeHandshakeRequest = function (e) { return M.write(JSON.stringify(e)) }, n.prototype.parseHandshakeResponse = function (e) { let t, i, o; if (V(e) || typeof Buffer < "u" && e instanceof Buffer) { var r = new Uint8Array(e), a = r.indexOf(M.RecordSeparatorCode); if (a === -1) { throw new Error("Message is incomplete."); } var c = a + 1; i = String.fromCharCode.apply(null, r.slice(0, c)), o = r.byteLength > c ? r.slice(c).buffer : null } else { var u = e, a = u.indexOf(M.RecordSeparator); if (a === -1) { throw new Error("Message is incomplete."); } var c = a + 1; i = u.substring(0, c), o = u.length > c ? u.substring(c) : null } let s = M.parse(i), l = JSON.parse(s[0]); if (l.type) { throw new Error("Expected a handshake response from the server."); } return t = l, [o, t] }, n })(), S; (function (n) { n[n.Invocation = 1] = "Invocation", n[n.StreamItem = 2] = "StreamItem", n[n.Completion = 3] = "Completion", n[n.StreamInvocation = 4] = "StreamInvocation", n[n.CancelInvocation = 5] = "CancelInvocation", n[n.Ping = 6] = "Ping", n[n.Close = 7] = "Close" })(S || (S = {})); let qe = globalThis && globalThis.__awaiter || function (n, e, t, i) { return new (t || (t = Promise))(function (o, r) { function a(s) { try { u(i.next(s)) } catch (l) { r(l) } } function c(s) { try { u(i.throw(s)) } catch (l) { r(l) } } function u(s) { s.done ? o(s.value) : new t(function (l) { l(s.value) }).then(a, c) } u((i = i.apply(n, e || [])).next()) }) }, Te = globalThis && globalThis.__generator || function (n, e) { let t = { label: 0, sent: function () { if (r[0] & 1) { throw r[1]; } return r[1] }, trys: [], ops: [] }, i, o, r, a; return a = { next: c(0), throw: c(1), return: c(2) }, typeof Symbol == "function" && (a[Symbol.iterator] = function () { return this }), a; function c(s) { return function (l) { return u([s, l]) } } function u(s) { if (i) { throw new TypeError("Generator is already executing."); } for (; t;) { try { if (i = 1, o && (r = s[0] & 2 ? o.return : s[0] ? o.throw || ((r = o.return) && r.call(o), 0) : o.next) && !(r = r.call(o, s[1])).done) { return r; } switch (o = 0, r && (s = [s[0] & 2, r.value]), s[0]) { case 0: case 1: r = s; break; case 4: return t.label++, { value: s[1], done: !1 }; case 5: t.label++, o = s[1], s = [0]; continue; case 7: s = t.ops.pop(), t.trys.pop(); continue; default: if (r = t.trys, !(r = r.length > 0 && r[r.length - 1]) && (s[0] === 6 || s[0] === 2)) { t = 0; continue } if (s[0] === 3 && (!r || s[1] > r[0] && s[1] < r[3])) { t.label = s[1]; break } if (s[0] === 6 && t.label < r[1]) { t.label = r[1], r = s; break } if (r && t.label < r[2]) { t.label = r[2], t.ops.push(s); break } r[2] && t.ops.pop(), t.trys.pop(); continue }s = e.call(n, t) } catch (l) { s = [6, l], o = 0 } finally { i = r = 0 } } if (s[0] & 5) { throw s[1]; } return { value: s[0] ? s[1] : void 0, done: !0 } } }, wt = 30 * 1e3, St = 15 * 1e3, x; (function (n) { n[n.Disconnected = 0] = "Disconnected", n[n.Connected = 1] = "Connected" })(x || (x = {})); let yt = (function () { function n(e, t, i) { let o = this; y.isRequired(e, "connection"), y.isRequired(t, "logger"), y.isRequired(i, "protocol"), this.serverTimeoutInMilliseconds = wt, this.keepAliveIntervalInMilliseconds = St, this.logger = t, this.protocol = i, this.connection = e, this.handshakeProtocol = new bt, this.connection.onreceive = function (r) { return o.processIncomingData(r) }, this.connection.onclose = function (r) { return o.connectionClosed(r) }, this.callbacks = {}, this.methods = {}, this.closedCallbacks = [], this.id = 0, this.receivedHandshakeResponse = !1, this.connectionState = x.Disconnected, this.cachedPingMessage = this.protocol.writeMessage({ type: S.Ping }) } return n.create = function (e, t, i) { return new n(e, t, i) }, Object.defineProperty(n.prototype, "state", { get: function () { return this.connectionState }, enumerable: !0, configurable: !0 }), n.prototype.start = function () { return qe(this, void 0, void 0, function () { let e, t, i = this; return Te(this, function (o) { switch (o.label) { case 0: return e = { protocol: this.protocol.name, version: this.protocol.version }, this.logger.log(d.Debug, "Starting HubConnection."), this.receivedHandshakeResponse = !1, t = new Promise(function (r, a) { i.handshakeResolver = r, i.handshakeRejecter = a }), [4, this.connection.start(this.protocol.transferFormat)]; case 1: return o.sent(), this.logger.log(d.Debug, "Sending handshake request."), [4, this.sendMessage(this.handshakeProtocol.writeHandshakeRequest(e))]; case 2: return o.sent(), this.logger.log(d.Information, "Using HubProtocol '" + this.protocol.name + "'."), this.cleanupTimeout(), this.resetTimeoutPeriod(), this.resetKeepAliveInterval(), [4, t]; case 3: return o.sent(), this.connectionState = x.Connected, [2] } }) }) }, n.prototype.stop = function () { return this.logger.log(d.Debug, "Stopping HubConnection."), this.cleanupTimeout(), this.cleanupPingTimer(), this.connection.stop() }, n.prototype.stream = function (e) { for (var t = this, i = [], o = 1; o < arguments.length; o++) { i[o - 1] = arguments[o]; } let r = this.createStreamInvocation(e, i), a, c = new st; c.cancelCallback = function () { let s = t.createCancelInvocation(r.invocationId), l = t.protocol.writeMessage(s); return delete t.callbacks[r.invocationId], a.then(function () { return t.sendMessage(l) }) }, this.callbacks[r.invocationId] = function (s, l) { if (l) { c.error(l); return } s && (s.type === S.Completion ? s.error ? c.error(new Error(s.error)) : c.complete() : c.next(s.item)) }; let u = this.protocol.writeMessage(r); return a = this.sendMessage(u).catch(function (s) { c.error(s), delete t.callbacks[r.invocationId] }), c }, n.prototype.sendMessage = function (e) { return this.resetKeepAliveInterval(), this.connection.send(e) }, n.prototype.send = function (e) { for (var t = [], i = 1; i < arguments.length; i++) { t[i - 1] = arguments[i]; } let o = this.createInvocation(e, t, !0), r = this.protocol.writeMessage(o); return this.sendMessage(r) }, n.prototype.invoke = function (e) { for (var t = this, i = [], o = 1; o < arguments.length; o++) { i[o - 1] = arguments[o]; } let r = this.createInvocation(e, i, !1), a = new Promise(function (c, u) { t.callbacks[r.invocationId] = function (l, p) { if (p) { u(p); return } l && (l.type === S.Completion ? l.error ? u(new Error(l.error)) : c(l.result) : u(new Error("Unexpected message type: " + l.type))) }; let s = t.protocol.writeMessage(r); t.sendMessage(s).catch(function (l) { u(l), delete t.callbacks[r.invocationId] }) }); return a }, n.prototype.on = function (e, t) { !e || !t || (e = e.toLowerCase(), this.methods[e] || (this.methods[e] = []), this.methods[e].indexOf(t) === -1 && this.methods[e].push(t)) }, n.prototype.off = function (e, t) { if (e) { e = e.toLowerCase(); let i = this.methods[e]; if (i) { if (t) { let o = i.indexOf(t); o !== -1 && (i.splice(o, 1), i.length === 0 && delete this.methods[e]) } else { delete this.methods[e] } } } }, n.prototype.onclose = function (e) { e && this.closedCallbacks.push(e) }, n.prototype.processIncomingData = function (e) { if (this.cleanupTimeout(), this.receivedHandshakeResponse || (e = this.processHandshakeResponse(e), this.receivedHandshakeResponse = !0), e) { for (let t = this.protocol.parseMessages(e, this.logger), i = 0, o = t; i < o.length; i++) { let r = o[i]; switch (r.type) { case S.Invocation: this.invokeClientMethod(r); break; case S.StreamItem: case S.Completion: var a = this.callbacks[r.invocationId]; a != null && (r.type === S.Completion && delete this.callbacks[r.invocationId], a(r)); break; case S.Ping: break; case S.Close: this.logger.log(d.Information, "Close message received from server."), this.connection.stop(r.error ? new Error("Server returned an error on close: " + r.error) : void 0); break; default: this.logger.log(d.Warning, "Invalid message type: " + r.type + "."); break } } } this.resetTimeoutPeriod() }, n.prototype.processHandshakeResponse = function (e) { let t, i, o; try { t = this.handshakeProtocol.parseHandshakeResponse(e), o = t[0], i = t[1] } catch (c) { var r = "Error parsing handshake response: " + c; this.logger.log(d.Error, r); let a = new Error(r); throw this.connection.stop(a), this.handshakeRejecter(a), a } if (i.error) { var r = "Server returned handshake error: " + i.error; throw this.logger.log(d.Error, r), this.handshakeRejecter(r), this.connection.stop(new Error(r)), new Error(r) } else { this.logger.log(d.Debug, "Server handshake complete."); } return this.handshakeResolver(), o }, n.prototype.resetKeepAliveInterval = function () { let e = this; this.cleanupPingTimer(), this.pingServerHandle = setTimeout(function () { return qe(e, void 0, void 0, function () { return Te(this, function (t) { switch (t.label) { case 0: if (this.connectionState !== x.Connected) { return [3, 4]; } t.label = 1; case 1: return t.trys.push([1, 3, , 4]), [4, this.sendMessage(this.cachedPingMessage)]; case 2: return t.sent(), [3, 4]; case 3: return t.sent(), this.cleanupPingTimer(), [3, 4]; case 4: return [2] } }) }) }, this.keepAliveIntervalInMilliseconds) }, n.prototype.resetTimeoutPeriod = function () { let e = this; (!this.connection.features || !this.connection.features.inherentKeepAlive) && (this.timeoutHandle = setTimeout(function () { return e.serverTimeout() }, this.serverTimeoutInMilliseconds)) }, n.prototype.serverTimeout = function () { this.connection.stop(new Error("Server timeout elapsed without receiving a message from the server.")) }, n.prototype.invokeClientMethod = function (e) { let t = this, i = this.methods[e.target.toLowerCase()]; if (i) { if (i.forEach(function (r) { return r.apply(t, e.arguments) }), e.invocationId) { let o = "Server requested a response, which is not supported in this version of the client."; this.logger.log(d.Error, o), this.connection.stop(new Error(o)) } } else { this.logger.log(d.Warning, "No client method with the name '" + e.target + "' found.") } }, n.prototype.connectionClosed = function (e) { let t = this, i = this.callbacks; this.callbacks = {}, this.connectionState = x.Disconnected, this.handshakeRejecter && this.handshakeRejecter(e), Object.keys(i).forEach(function (o) { let r = i[o]; r(null, e || new Error("Invocation canceled due to connection being closed.")) }), this.cleanupTimeout(), this.cleanupPingTimer(), this.closedCallbacks.forEach(function (o) { return o.apply(t, [e]) }) }, n.prototype.cleanupPingTimer = function () { this.pingServerHandle && clearTimeout(this.pingServerHandle) }, n.prototype.cleanupTimeout = function () { this.timeoutHandle && clearTimeout(this.timeoutHandle) }, n.prototype.createInvocation = function (e, t, i) { if (i) { return { arguments: t, target: e, type: S.Invocation }; } let o = this.id; return this.id++, { arguments: t, invocationId: o.toString(), target: e, type: S.Invocation } }, n.prototype.createStreamInvocation = function (e, t) { let i = this.id; return this.id++, { arguments: t, invocationId: i.toString(), target: e, type: S.StreamInvocation } }, n.prototype.createCancelInvocation = function (e) { return { invocationId: e, type: S.CancelInvocation } }, n })(), m; (function (n) { n[n.None = 0] = "None", n[n.WebSockets = 1] = "WebSockets", n[n.ServerSentEvents = 2] = "ServerSentEvents", n[n.LongPolling = 4] = "LongPolling" })(m || (m = {})); let v; (function (n) { n[n.Text = 1] = "Text", n[n.Binary = 2] = "Binary" })(v || (v = {})); let mt = (function () { function n() { this.isAborted = !1, this.onabort = null } return n.prototype.abort = function () { this.isAborted || (this.isAborted = !0, this.onabort && this.onabort()) }, Object.defineProperty(n.prototype, "signal", { get: function () { return this }, enumerable: !0, configurable: !0 }), Object.defineProperty(n.prototype, "aborted", { get: function () { return this.isAborted }, enumerable: !0, configurable: !0 }), n })(), $ = globalThis && globalThis.__awaiter || function (n, e, t, i) { return new (t || (t = Promise))(function (o, r) { function a(s) { try { u(i.next(s)) } catch (l) { r(l) } } function c(s) { try { u(i.throw(s)) } catch (l) { r(l) } } function u(s) { s.done ? o(s.value) : new t(function (l) { l(s.value) }).then(a, c) } u((i = i.apply(n, e || [])).next()) }) }, L = globalThis && globalThis.__generator || function (n, e) { let t = { label: 0, sent: function () { if (r[0] & 1) { throw r[1]; } return r[1] }, trys: [], ops: [] }, i, o, r, a; return a = { next: c(0), throw: c(1), return: c(2) }, typeof Symbol == "function" && (a[Symbol.iterator] = function () { return this }), a; function c(s) { return function (l) { return u([s, l]) } } function u(s) { if (i) { throw new TypeError("Generator is already executing."); } for (; t;) { try { if (i = 1, o && (r = s[0] & 2 ? o.return : s[0] ? o.throw || ((r = o.return) && r.call(o), 0) : o.next) && !(r = r.call(o, s[1])).done) { return r; } switch (o = 0, r && (s = [s[0] & 2, r.value]), s[0]) { case 0: case 1: r = s; break; case 4: return t.label++, { value: s[1], done: !1 }; case 5: t.label++, o = s[1], s = [0]; continue; case 7: s = t.ops.pop(), t.trys.pop(); continue; default: if (r = t.trys, !(r = r.length > 0 && r[r.length - 1]) && (s[0] === 6 || s[0] === 2)) { t = 0; continue } if (s[0] === 3 && (!r || s[1] > r[0] && s[1] < r[3])) { t.label = s[1]; break } if (s[0] === 6 && t.label < r[1]) { t.label = r[1], r = s; break } if (r && t.label < r[2]) { t.label = r[2], t.ops.push(s); break } r[2] && t.ops.pop(), t.trys.pop(); continue }s = e.call(n, t) } catch (l) { s = [6, l], o = 0 } finally { i = r = 0 } } if (s[0] & 5) { throw s[1]; } return { value: s[0] ? s[1] : void 0, done: !0 } } }, Ne = (function () { function n(e, t, i, o) { this.httpClient = e, this.accessTokenFactory = t, this.logger = i, this.pollAbort = new mt, this.logMessageContent = o, this.running = !1, this.onreceive = null, this.onclose = null } return Object.defineProperty(n.prototype, "pollAborted", { get: function () { return this.pollAbort.aborted }, enumerable: !0, configurable: !0 }), n.prototype.connect = function (e, t) { return $(this, void 0, void 0, function () { let i, o, r, a; return L(this, function (c) { switch (c.label) { case 0: if (y.isRequired(e, "url"), y.isRequired(t, "transferFormat"), y.isIn(t, v, "transferFormat"), this.url = e, this.logger.log(d.Trace, "(LongPolling transport) Connecting."), t === v.Binary && typeof XMLHttpRequest < "u" && typeof new XMLHttpRequest().responseType != "string") { throw new Error("Binary protocols over XmlHttpRequest not implementing advanced features are not supported."); } return i = { abortSignal: this.pollAbort.signal, headers: {}, timeout: 1e5 }, t === v.Binary && (i.responseType = "arraybuffer"), [4, this.getAccessToken()]; case 1: return o = c.sent(), this.updateHeaderToken(i, o), r = e + "&_=" + Date.now(), this.logger.log(d.Trace, "(LongPolling transport) polling: " + r + "."), [4, this.httpClient.get(r, i)]; case 2: return a = c.sent(), a.statusCode !== 200 ? (this.logger.log(d.Error, "(LongPolling transport) Unexpected response code: " + a.statusCode + "."), this.closeError = new P(a.statusText || "", a.statusCode), this.running = !1) : this.running = !0, this.receiving = this.poll(this.url, i), [2] } }) }) }, n.prototype.getAccessToken = function () { return $(this, void 0, void 0, function () { return L(this, function (e) { switch (e.label) { case 0: return this.accessTokenFactory ? [4, this.accessTokenFactory()] : [3, 2]; case 1: return [2, e.sent()]; case 2: return [2, null] } }) }) }, n.prototype.updateHeaderToken = function (e, t) { if (e.headers || (e.headers = {}), t) { e.headers.Authorization = "Bearer " + t; return } e.headers.Authorization && delete e.headers.Authorization }, n.prototype.poll = function (e, t) { return $(this, void 0, void 0, function () { let i, o, r, a; return L(this, function (c) { switch (c.label) { case 0: c.trys.push([0, , 8, 9]), c.label = 1; case 1: return this.running ? [4, this.getAccessToken()] : [3, 7]; case 2: i = c.sent(), this.updateHeaderToken(t, i), c.label = 3; case 3: return c.trys.push([3, 5, , 6]), o = e + "&_=" + Date.now(), this.logger.log(d.Trace, "(LongPolling transport) polling: " + o + "."), [4, this.httpClient.get(o, t)]; case 4: return r = c.sent(), r.statusCode === 204 ? (this.logger.log(d.Information, "(LongPolling transport) Poll terminated by server."), this.running = !1) : r.statusCode !== 200 ? (this.logger.log(d.Error, "(LongPolling transport) Unexpected response code: " + r.statusCode + "."), this.closeError = new P(r.statusText || "", r.statusCode), this.running = !1) : r.content ? (this.logger.log(d.Trace, "(LongPolling transport) data received. " + A(r.content, this.logMessageContent) + "."), this.onreceive && this.onreceive(r.content)) : this.logger.log(d.Trace, "(LongPolling transport) Poll timed out, reissuing."), [3, 6]; case 5: return a = c.sent(), this.running ? a instanceof ne ? this.logger.log(d.Trace, "(LongPolling transport) Poll timed out, reissuing.") : (this.closeError = a, this.running = !1) : this.logger.log(d.Trace, "(LongPolling transport) Poll errored after shutdown: " + a.message), [3, 6]; case 6: return [3, 1]; case 7: return [3, 9]; case 8: return this.logger.log(d.Trace, "(LongPolling transport) Polling complete."), this.pollAborted || this.raiseOnClose(), [7]; case 9: return [2] } }) }) }, n.prototype.send = function (e) { return $(this, void 0, void 0, function () { return L(this, function (t) { return this.running ? [2, Ee(this.logger, "LongPolling", this.httpClient, this.url, this.accessTokenFactory, e, this.logMessageContent)] : [2, Promise.reject(new Error("Cannot send until the transport is connected"))] }) }) }, n.prototype.stop = function () { return $(this, void 0, void 0, function () { let e, t; return L(this, function (i) { switch (i.label) { case 0: this.logger.log(d.Trace, "(LongPolling transport) Stopping polling."), this.running = !1, this.pollAbort.abort(), i.label = 1; case 1: return i.trys.push([1, , 5, 6]), [4, this.receiving]; case 2: return i.sent(), this.logger.log(d.Trace, "(LongPolling transport) sending DELETE request to " + this.url + "."), e = { headers: {} }, [4, this.getAccessToken()]; case 3: return t = i.sent(), this.updateHeaderToken(e, t), [4, this.httpClient.delete(this.url, e)]; case 4: return i.sent(), this.logger.log(d.Trace, "(LongPolling transport) DELETE request sent."), [3, 6]; case 5: return this.logger.log(d.Trace, "(LongPolling transport) Stop finished."), this.raiseOnClose(), [7]; case 6: return [2] } }) }) }, n.prototype.raiseOnClose = function () { if (this.onclose) { let e = "(LongPolling transport) Firing onclose event."; this.closeError && (e += " Error: " + this.closeError), this.logger.log(d.Trace, e), this.onclose(this.closeError) } }, n })(), Oe = globalThis && globalThis.__awaiter || function (n, e, t, i) { return new (t || (t = Promise))(function (o, r) { function a(s) { try { u(i.next(s)) } catch (l) { r(l) } } function c(s) { try { u(i.throw(s)) } catch (l) { r(l) } } function u(s) { s.done ? o(s.value) : new t(function (l) { l(s.value) }).then(a, c) } u((i = i.apply(n, e || [])).next()) }) }, Ie = globalThis && globalThis.__generator || function (n, e) { let t = { label: 0, sent: function () { if (r[0] & 1) { throw r[1]; } return r[1] }, trys: [], ops: [] }, i, o, r, a; return a = { next: c(0), throw: c(1), return: c(2) }, typeof Symbol == "function" && (a[Symbol.iterator] = function () { return this }), a; function c(s) { return function (l) { return u([s, l]) } } function u(s) { if (i) { throw new TypeError("Generator is already executing."); } for (; t;) { try { if (i = 1, o && (r = s[0] & 2 ? o.return : s[0] ? o.throw || ((r = o.return) && r.call(o), 0) : o.next) && !(r = r.call(o, s[1])).done) { return r; } switch (o = 0, r && (s = [s[0] & 2, r.value]), s[0]) { case 0: case 1: r = s; break; case 4: return t.label++, { value: s[1], done: !1 }; case 5: t.label++, o = s[1], s = [0]; continue; case 7: s = t.ops.pop(), t.trys.pop(); continue; default: if (r = t.trys, !(r = r.length > 0 && r[r.length - 1]) && (s[0] === 6 || s[0] === 2)) { t = 0; continue } if (s[0] === 3 && (!r || s[1] > r[0] && s[1] < r[3])) { t.label = s[1]; break } if (s[0] === 6 && t.label < r[1]) { t.label = r[1], r = s; break } if (r && t.label < r[2]) { t.label = r[2], t.ops.push(s); break } r[2] && t.ops.pop(), t.trys.pop(); continue }s = e.call(n, t) } catch (l) { s = [6, l], o = 0 } finally { i = r = 0 } } if (s[0] & 5) { throw s[1]; } return { value: s[0] ? s[1] : void 0, done: !0 } } }, vt = (function () { function n(e, t, i, o, r) { this.httpClient = e, this.accessTokenFactory = t, this.logger = i, this.logMessageContent = o, this.eventSourceConstructor = r, this.onreceive = null, this.onclose = null } return n.prototype.connect = function (e, t) { return Oe(this, void 0, void 0, function () { let i, o = this; return Ie(this, function (r) { switch (r.label) { case 0: return y.isRequired(e, "url"), y.isRequired(t, "transferFormat"), y.isIn(t, v, "transferFormat"), this.logger.log(d.Trace, "(SSE transport) Connecting."), this.url = e, this.accessTokenFactory ? [4, this.accessTokenFactory()] : [3, 2]; case 1: i = r.sent(), i && (e += (e.indexOf("?") < 0 ? "?" : "&") + ("access_token=" + encodeURIComponent(i))), r.label = 2; case 2: return [2, new Promise(function (a, c) { let u = !1; if (t !== v.Text) { c(new Error("The Server-Sent Events transport only supports the 'Text' transfer format")); return } let s; if (typeof window < "u") { s = new o.eventSourceConstructor(e, { withCredentials: !0 }); } else { let l = o.httpClient.getCookieString(e); s = new o.eventSourceConstructor(e, { withCredentials: !0, headers: { Cookie: l } }) } try { s.onmessage = function (p) { if (o.onreceive) { try { o.logger.log(d.Trace, "(SSE transport) data received. " + A(p.data, o.logMessageContent) + "."), o.onreceive(p.data) } catch (g) { o.close(g); return } } }, s.onerror = function (p) { let g = new Error(p.data || "Error occurred"); u ? o.close(g) : c(g) }, s.onopen = function () { o.logger.log(d.Information, "SSE connected to " + o.url), o.eventSource = s, u = !0, a() } } catch (p) { c(p); return } })] } }) }) }, n.prototype.send = function (e) { return Oe(this, void 0, void 0, function () { return Ie(this, function (t) { return this.eventSource ? [2, Ee(this.logger, "SSE", this.httpClient, this.url, this.accessTokenFactory, e, this.logMessageContent)] : [2, Promise.reject(new Error("Cannot send until the transport is connected"))] }) }) }, n.prototype.stop = function () { return this.close(), Promise.resolve() }, n.prototype.close = function (e) { this.eventSource && (this.eventSource.close(), this.eventSource = void 0, this.onclose && this.onclose(e)) }, n })(), Ct = globalThis && globalThis.__awaiter || function (n, e, t, i) { return new (t || (t = Promise))(function (o, r) { function a(s) { try { u(i.next(s)) } catch (l) { r(l) } } function c(s) { try { u(i.throw(s)) } catch (l) { r(l) } } function u(s) { s.done ? o(s.value) : new t(function (l) { l(s.value) }).then(a, c) } u((i = i.apply(n, e || [])).next()) }) }, kt = globalThis && globalThis.__generator || function (n, e) { let t = { label: 0, sent: function () { if (r[0] & 1) { throw r[1]; } return r[1] }, trys: [], ops: [] }, i, o, r, a; return a = { next: c(0), throw: c(1), return: c(2) }, typeof Symbol == "function" && (a[Symbol.iterator] = function () { return this }), a; function c(s) { return function (l) { return u([s, l]) } } function u(s) { if (i) { throw new TypeError("Generator is already executing."); } for (; t;) { try { if (i = 1, o && (r = s[0] & 2 ? o.return : s[0] ? o.throw || ((r = o.return) && r.call(o), 0) : o.next) && !(r = r.call(o, s[1])).done) { return r; } switch (o = 0, r && (s = [s[0] & 2, r.value]), s[0]) { case 0: case 1: r = s; break; case 4: return t.label++, { value: s[1], done: !1 }; case 5: t.label++, o = s[1], s = [0]; continue; case 7: s = t.ops.pop(), t.trys.pop(); continue; default: if (r = t.trys, !(r = r.length > 0 && r[r.length - 1]) && (s[0] === 6 || s[0] === 2)) { t = 0; continue } if (s[0] === 3 && (!r || s[1] > r[0] && s[1] < r[3])) { t.label = s[1]; break } if (s[0] === 6 && t.label < r[1]) { t.label = r[1], r = s; break } if (r && t.label < r[2]) { t.label = r[2], t.ops.push(s); break } r[2] && t.ops.pop(), t.trys.pop(); continue }s = e.call(n, t) } catch (l) { s = [6, l], o = 0 } finally { i = r = 0 } } if (s[0] & 5) { throw s[1]; } return { value: s[0] ? s[1] : void 0, done: !0 } } }, Et = (function () { function n(e, t, i, o, r) { this.logger = i, this.accessTokenFactory = t, this.logMessageContent = o, this.webSocketConstructor = r, this.httpClient = e, this.onreceive = null, this.onclose = null } return n.prototype.connect = function (e, t) { return Ct(this, void 0, void 0, function () { let i, o = this; return kt(this, function (r) { switch (r.label) { case 0: return y.isRequired(e, "url"), y.isRequired(t, "transferFormat"), y.isIn(t, v, "transferFormat"), this.logger.log(d.Trace, "(WebSockets transport) Connecting."), this.accessTokenFactory ? [4, this.accessTokenFactory()] : [3, 2]; case 1: i = r.sent(), i && (e += (e.indexOf("?") < 0 ? "?" : "&") + ("access_token=" + encodeURIComponent(i))), r.label = 2; case 2: return [2, new Promise(function (a, c) { e = e.replace(/^http/, "ws"); let u, s = o.httpClient.getCookieString(e); typeof window > "u" && s && (u = new o.webSocketConstructor(e, void 0, { headers: { Cookie: "" + s } })), u || (u = new o.webSocketConstructor(e)), t === v.Binary && (u.binaryType = "arraybuffer"), u.onopen = function (l) { o.logger.log(d.Information, "WebSocket connected to " + e + "."), o.webSocket = u, a() }, u.onerror = function (l) { let p = null; typeof ErrorEvent < "u" && l instanceof ErrorEvent && (p = l.error), c(p) }, u.onmessage = function (l) { o.logger.log(d.Trace, "(WebSockets transport) data received. " + A(l.data, o.logMessageContent) + "."), o.onreceive && o.onreceive(l.data) }, u.onclose = function (l) { return o.close(l) } })] } }) }) }, n.prototype.send = function (e) { return this.webSocket && this.webSocket.readyState === this.webSocketConstructor.OPEN ? (this.logger.log(d.Trace, "(WebSockets transport) sending data. " + A(e, this.logMessageContent) + "."), this.webSocket.send(e), Promise.resolve()) : Promise.reject("WebSocket is not in the OPEN state") }, n.prototype.stop = function () { return this.webSocket && (this.webSocket.onclose = function () { }, this.webSocket.onmessage = function () { }, this.webSocket.onerror = function () { }, this.webSocket.close(), this.webSocket = void 0, this.close(void 0)), Promise.resolve() }, n.prototype.close = function (e) { this.logger.log(d.Trace, "(WebSockets transport) socket closed."), this.onclose && (e && (e.wasClean === !1 || e.code !== 1e3) ? this.onclose(new Error("WebSocket closed with status code: " + e.code + " (" + e.reason + ").")) : this.onclose()) }, n })(), J = globalThis && globalThis.__awaiter || function (n, e, t, i) { return new (t || (t = Promise))(function (o, r) { function a(s) { try { u(i.next(s)) } catch (l) { r(l) } } function c(s) { try { u(i.throw(s)) } catch (l) { r(l) } } function u(s) { s.done ? o(s.value) : new t(function (l) { l(s.value) }).then(a, c) } u((i = i.apply(n, e || [])).next()) }) }, B = globalThis && globalThis.__generator || function (n, e) { let t = { label: 0, sent: function () { if (r[0] & 1) { throw r[1]; } return r[1] }, trys: [], ops: [] }, i, o, r, a; return a = { next: c(0), throw: c(1), return: c(2) }, typeof Symbol == "function" && (a[Symbol.iterator] = function () { return this }), a; function c(s) { return function (l) { return u([s, l]) } } function u(s) { if (i) { throw new TypeError("Generator is already executing."); } for (; t;) { try { if (i = 1, o && (r = s[0] & 2 ? o.return : s[0] ? o.throw || ((r = o.return) && r.call(o), 0) : o.next) && !(r = r.call(o, s[1])).done) { return r; } switch (o = 0, r && (s = [s[0] & 2, r.value]), s[0]) { case 0: case 1: r = s; break; case 4: return t.label++, { value: s[1], done: !1 }; case 5: t.label++, o = s[1], s = [0]; continue; case 7: s = t.ops.pop(), t.trys.pop(); continue; default: if (r = t.trys, !(r = r.length > 0 && r[r.length - 1]) && (s[0] === 6 || s[0] === 2)) { t = 0; continue } if (s[0] === 3 && (!r || s[1] > r[0] && s[1] < r[3])) { t.label = s[1]; break } if (s[0] === 6 && t.label < r[1]) { t.label = r[1], r = s; break } if (r && t.label < r[2]) { t.label = r[2], t.ops.push(s); break } r[2] && t.ops.pop(), t.trys.pop(); continue }s = e.call(n, t) } catch (l) { s = [6, l], o = 0 } finally { i = r = 0 } } if (s[0] & 5) { throw s[1]; } return { value: s[0] ? s[1] : void 0, done: !0 } } }, Me = 100, ue = null, ce = null; if (typeof window > "u" && typeof require < "u") { let xe = typeof __webpack_require__ == "function" ? __non_webpack_require__ : require; ue = xe("ws"), ce = xe("eventsource") } let qt = (function () { function n(e, t) { t === void 0 && (t = {}), this.features = {}, y.isRequired(e, "url"), this.logger = ot(t.logger), this.baseUrl = this.resolveUrl(e), t = t || {}, t.logMessageContent = t.logMessageContent || !1; let i = typeof window > "u"; !i && typeof WebSocket < "u" && !t.WebSocket ? t.WebSocket = WebSocket : i && !t.WebSocket && ue && (t.WebSocket = ue), !i && typeof EventSource < "u" && !t.EventSource ? t.EventSource = EventSource : i && !t.EventSource && typeof ce < "u" && (t.EventSource = ce), this.httpClient = t.httpClient || new gt(this.logger), this.connectionState = 2, this.options = t, this.onreceive = null, this.onclose = null } return n.prototype.start = function (e) { return e = e || v.Binary, y.isIn(e, v, "transferFormat"), this.logger.log(d.Debug, "Starting connection with transfer format '" + v[e] + "'."), this.connectionState !== 2 ? Promise.reject(new Error("Cannot start a connection that is not in the 'Disconnected' state.")) : (this.connectionState = 0, this.startPromise = this.startInternal(e), this.startPromise) }, n.prototype.send = function (e) { if (this.connectionState !== 1) { throw new Error("Cannot send data if the connection is not in the 'Connected' State."); } return this.transport.send(e) }, n.prototype.stop = function (e) { return J(this, void 0, void 0, function () { return B(this, function (t) { switch (t.label) { case 0: this.connectionState = 2, this.stopError = e, t.label = 1; case 1: return t.trys.push([1, 3, , 4]), [4, this.startPromise]; case 2: return t.sent(), [3, 4]; case 3: return t.sent(), [3, 4]; case 4: return this.transport ? [4, this.transport.stop()] : [3, 6]; case 5: t.sent(), this.transport = void 0, t.label = 6; case 6: return [2] } }) }) }, n.prototype.startInternal = function (e) { return J(this, void 0, void 0, function () { let t, i, o, r, a, c, u, s = this; return B(this, function (l) { switch (l.label) { case 0: t = this.baseUrl, this.accessTokenFactory = this.options.accessTokenFactory, l.label = 1; case 1: return l.trys.push([1, 12, , 13]), this.options.skipNegotiation ? this.options.transport !== m.WebSockets ? [3, 3] : (this.transport = this.constructTransport(m.WebSockets), [4, this.transport.connect(t, e)]) : [3, 5]; case 2: return l.sent(), [3, 4]; case 3: throw Error("Negotiation can only be skipped when using the WebSocket transport directly."); case 4: return [3, 11]; case 5: i = null, o = 0, r = function () { let p; return B(this, function (g) { switch (g.label) { case 0: return [4, a.getNegotiationResponse(t)]; case 1: if (i = g.sent(), a.connectionState === 2) { return [2, { value: void 0 }]; } if (i.error) { throw Error(i.error); } if (i.ProtocolVersion) { throw Error("Detected a connection attempt to an ASP.NET SignalR Server. This client only supports connecting to an ASP.NET Core SignalR Server. See https://aka.ms/signalr-core-differences for details."); } return i.url && (t = i.url), i.accessToken && (p = i.accessToken, a.accessTokenFactory = function () { return p }), o++, [2] } }) }, a = this, l.label = 6; case 6: return [5, r()]; case 7: if (c = l.sent(), typeof c == "object") { return [2, c.value]; } l.label = 8; case 8: if (i.url && o < Me) { return [3, 6]; } l.label = 9; case 9: if (o === Me && i.url) { throw Error("Negotiate redirection limit exceeded."); } return [4, this.createTransport(t, this.options.transport, i, e)]; case 10: l.sent(), l.label = 11; case 11: return this.transport instanceof Ne && (this.features.inherentKeepAlive = !0), this.transport.onreceive = this.onreceive, this.transport.onclose = function (p) { return s.stopConnection(p) }, this.changeState(0, 1), [3, 13]; case 12: throw u = l.sent(), this.logger.log(d.Error, "Failed to start the connection: " + u), this.connectionState = 2, this.transport = void 0, u; case 13: return [2] } }) }) }, n.prototype.getNegotiationResponse = function (e) { return J(this, void 0, void 0, function () { let t, i, o, r, a, c; return B(this, function (u) { switch (u.label) { case 0: return this.accessTokenFactory ? [4, this.accessTokenFactory()] : [3, 2]; case 1: o = u.sent(), o && (i = (t = {}, t.Authorization = "Bearer " + o, t)), u.label = 2; case 2: r = this.resolveNegotiateUrl(e), this.logger.log(d.Debug, "Sending negotiation request: " + r + "."), u.label = 3; case 3: return u.trys.push([3, 5, , 6]), [4, this.httpClient.post(r, { content: "", headers: i })]; case 4: if (a = u.sent(), a.statusCode !== 200) { throw Error("Unexpected status code returned from negotiate " + a.statusCode); } return [2, JSON.parse(a.content)]; case 5: throw c = u.sent(), this.logger.log(d.Error, "Failed to complete negotiation with the server: " + c), c; case 6: return [2] } }) }) }, n.prototype.createConnectUrl = function (e, t) { return t ? e + (e.indexOf("?") === -1 ? "?" : "&") + ("id=" + t) : e }, n.prototype.createTransport = function (e, t, i, o) { return J(this, void 0, void 0, function () { let r, a, c, u, s, l, p; return B(this, function (g) { switch (g.label) { case 0: return r = this.createConnectUrl(e, i.connectionId), this.isITransport(t) ? (this.logger.log(d.Debug, "Connection was provided an instance of ITransport, using that directly."), this.transport = t, [4, this.transport.connect(r, o)]) : [3, 2]; case 1: return g.sent(), this.changeState(0, 1), [2]; case 2: a = i.availableTransports || [], c = 0, u = a, g.label = 3; case 3: return c < u.length ? (s = u[c], this.connectionState = 0, l = this.resolveTransport(s, t, o), typeof l != "number" ? [3, 8] : (this.transport = this.constructTransport(l), i.connectionId ? [3, 5] : [4, this.getNegotiationResponse(e)])) : [3, 9]; case 4: i = g.sent(), r = this.createConnectUrl(e, i.connectionId), g.label = 5; case 5: return g.trys.push([5, 7, , 8]), [4, this.transport.connect(r, o)]; case 6: return g.sent(), this.changeState(0, 1), [2]; case 7: return p = g.sent(), this.logger.log(d.Error, "Failed to start the transport '" + m[l] + "': " + p), this.connectionState = 2, i.connectionId = void 0, [3, 8]; case 8: return c++, [3, 3]; case 9: throw new Error("Unable to initialize any of the available transports.") } }) }) }, n.prototype.constructTransport = function (e) { switch (e) { case m.WebSockets: if (!this.options.WebSocket) { throw new Error("'WebSocket' is not supported in your environment."); } return new Et(this.httpClient, this.accessTokenFactory, this.logger, this.options.logMessageContent || !1, this.options.WebSocket); case m.ServerSentEvents: if (!this.options.EventSource) { throw new Error("'EventSource' is not supported in your environment."); } return new vt(this.httpClient, this.accessTokenFactory, this.logger, this.options.logMessageContent || !1, this.options.EventSource); case m.LongPolling: return new Ne(this.httpClient, this.accessTokenFactory, this.logger, this.options.logMessageContent || !1); default: throw new Error("Unknown transport: " + e + ".") } }, n.prototype.resolveTransport = function (e, t, i) { let o = m[e.transport]; if (o == null) { this.logger.log(d.Debug, "Skipping transport '" + e.transport + "' because it is not supported by this client."); } else { let r = e.transferFormats.map(function (a) { return v[a] }); if (Tt(t, o)) { if (r.indexOf(i) >= 0) { if (o === m.WebSockets && !this.options.WebSocket || o === m.ServerSentEvents && !this.options.EventSource) { this.logger.log(d.Debug, "Skipping transport '" + m[o] + "' because it is not supported in your environment.'"); } else { return this.logger.log(d.Debug, "Selecting transport '" + m[o] + "'."), o; } } else { this.logger.log(d.Debug, "Skipping transport '" + m[o] + "' because it does not support the requested transfer format '" + v[i] + "'."); } } else { this.logger.log(d.Debug, "Skipping transport '" + m[o] + "' because it was disabled by the client.") } } return null }, n.prototype.isITransport = function (e) { return e && typeof e == "object" && "connect" in e }, n.prototype.changeState = function (e, t) { return this.connectionState === e ? (this.connectionState = t, !0) : !1 }, n.prototype.stopConnection = function (e) { this.transport = void 0, e = this.stopError || e, e ? this.logger.log(d.Error, "Connection disconnected with error '" + e + "'.") : this.logger.log(d.Information, "Connection disconnected."), this.connectionState = 2, this.onclose && this.onclose(e) }, n.prototype.resolveUrl = function (e) { if (e.lastIndexOf("https://", 0) === 0 || e.lastIndexOf("http://", 0) === 0) { return e; } if (typeof window > "u" || !window || !window.document) { throw new Error("Cannot resolve '" + e + "'."); } let t = window.document.createElement("a"); return t.href = e, this.logger.log(d.Information, "Normalizing '" + e + "' to '" + t.href + "'."), t.href }, n.prototype.resolveNegotiateUrl = function (e) { let t = e.indexOf("?"), i = e.substring(0, t === -1 ? e.length : t); return i[i.length - 1] !== "/" && (i += "/"), i += "negotiate", i += t === -1 ? "" : e.substring(t), i }, n })(); function Tt(n, e) { return !n || (e & n) !== 0 } let Nt = "json", Ot = (function () { function n() { this.name = Nt, this.version = 1, this.transferFormat = v.Text } return n.prototype.parseMessages = function (e, t) { if (typeof e != "string") { throw new Error("Invalid input for JSON hub protocol. Expected a string."); } if (!e) { return []; } t === null && (t = se.instance); for (var i = M.parse(e), o = [], r = 0, a = i; r < a.length; r++) { let c = a[r], u = JSON.parse(c); if (typeof u.type != "number") { throw new Error("Invalid payload."); } switch (u.type) { case S.Invocation: this.isInvocationMessage(u); break; case S.StreamItem: this.isStreamItemMessage(u); break; case S.Completion: this.isCompletionMessage(u); break; case S.Ping: break; case S.Close: break; default: t.log(d.Information, "Unknown message type '" + u.type + "' ignored."); continue }o.push(u) } return o }, n.prototype.writeMessage = function (e) { return M.write(JSON.stringify(e)) }, n.prototype.isInvocationMessage = function (e) { this.assertNotEmptyString(e.target, "Invalid payload for Invocation message."), e.invocationId !== void 0 && this.assertNotEmptyString(e.invocationId, "Invalid payload for Invocation message.") }, n.prototype.isStreamItemMessage = function (e) { if (this.assertNotEmptyString(e.invocationId, "Invalid payload for StreamItem message."), e.item === void 0) { throw new Error("Invalid payload for StreamItem message.") } }, n.prototype.isCompletionMessage = function (e) { if (e.result && e.error) { throw new Error("Invalid payload for Completion message."); } !e.result && e.error && this.assertNotEmptyString(e.error, "Invalid payload for Completion message."), this.assertNotEmptyString(e.invocationId, "Invalid payload for Completion message.") }, n.prototype.assertNotEmptyString = function (e, t) { if (typeof e != "string" || e === "") { throw new Error(t) } }, n })(), It = (function () { function n() { } return n.prototype.configureLogging = function (e) { return y.isRequired(e, "logging"), Mt(e) ? this.logger = e : this.logger = new ae(e), this }, n.prototype.withUrl = function (e, t) { return y.isRequired(e, "url"), this.url = e, typeof t == "object" ? this.httpConnectionOptions = t : this.httpConnectionOptions = { transport: t }, this }, n.prototype.withHubProtocol = function (e) { return y.isRequired(e, "protocol"), this.protocol = e, this }, n.prototype.build = function () { let e = this.httpConnectionOptions || {}; if (e.logger === void 0 && (e.logger = this.logger), !this.url) { throw new Error("The 'HubConnectionBuilder.withUrl' method must be called before building the connection."); } let t = new qt(this.url, e); return yt.create(t, this.logger || se.instance, this.protocol || new Ot) }, n })(); function Mt(n) { return n.log !== void 0 } class je { constructor(e, t, i) { this.url = e, this.connectionId = t, this.equipNo = i, this.signalr = null } openConnect() { return this.signalr && (this.signalr.stop(), this.signalr = null), this.signalr = new It().withUrl(this.url).build(), this.signalr.serverTimeoutInMilliseconds = 5e8, this.signalr.keepaliveintervalinmilliseconds = 5e8, new Promise(e => { this.signalr.start().then(() => { this.connectionId && this.send(), e(this.signalr) }).catch(t => { console.log(t) }) }) } async send() { try { await this.signalr.invoke(this.connectionId, this.equipNo) } catch (e) { console.log("connectHub 连接失败" + e) } } } class xt extends U { constructor(e, t, i, o, r) { super(), this.equipStatusObject = t, this.groupNodeObject = i, this.aleadyUpdateStatus = {}, this.isGetAllEquipStatus = !1, this.nodesMap = e, this.statusChange = o, this.openSignlr(), this.aliasName = r } openSignlr() { this.equipStatusSignlr = new je("/equipStatusMonitor", "", ""), this.equipStatusSignlr.openConnect().then(e => { try { e.invoke("GetAllEquipStatus") } catch (t) { console.log(t) } this.subscribeTo(e, "GetAllEquipStatus"); try { e.invoke("GetEquipChangeStatus") } catch (t) { console.log(t) } e.onclose(() => { this.openSignlr() }), this.subscribeTo(e, "GetEquipChangeStatus") }) } subscribeTo(e, t) { e.off(t), e.on(t, i => { i && i.isSuccess && i.data && (this[t] ? this[t](i.data) : this.notice({ func: t, data: i.data, key: i.groupId })) }) } GetAllEquipStatus(e) { this.isGetAllEquipStatus = !0, this.resetGroupStatus(), Object.keys(e).forEach(t => { this.equipStatusObject[t] = e[t] }), Object.keys(this.groupNodeObject).forEach(t => { this.updateByGroup(t) }) } updateByGroup(e) { if (!this.aleadyUpdateStatus[e]) { let t = window[`group-${e}${this.aliasName}`] || []; if (t.length) { this.aleadyUpdateStatus[e] = !0; let i = !1, o = !0; t.forEach(r => { const a = this.equipStatusObject[r.equipNo]; a === 1 ? (i = !0, o = !1) : a !== 0 && (o = !1) }), o && this.setOfflineStatus(e), t.forEach(r => { this.equipStatusObject[r.equipNo] == 2 ? this.setGroupStatus(e, !0, 2) : this.equipStatusObject[r.equipNo] == 6 && this.setGroupStatus(e, !0, 6), this.nodesMap[`${e}-${r.equipNo}`] && (this.nodesMap[`${e}-${r.equipNo}`].status = this.equipStatusObject[r.equipNo]) }), this.nodesMap[e].alarmCounts === 0 && this.nodesMap[e].backUpCounts === 0 && i && (this.nodesMap[e].status = 1, this.nodesMap[e].groupId && this.setNormalStatus(this.nodesMap[e].groupId)) } } } updateGroupStatus(e) { this.isGetAllEquipStatus && this.updateByGroup(e) } GetEquipChangeStatus(e) { this.setStatus(e) } setGroupStatus(e, t, i) { t ? i == 2 ? (this.nodesMap[e].alarmCounts = this.nodesMap[e].alarmCounts + 1, this.nodesMap[e].alarmCounts > 0 && (this.nodesMap[e].status = 2)) : (this.nodesMap[e].backUpCounts = this.nodesMap[e].backUpCounts + 1, this.nodesMap[e].alarmCounts == 0 && this.nodesMap[e].backUpCounts > 0 && (this.nodesMap[e].status = 6)) : i == 2 ? (this.nodesMap[e].alarmCounts = this.nodesMap[e].alarmCounts - 1, this.nodesMap[e].alarmCounts == 0 && (this.nodesMap[e].status = 1)) : (this.nodesMap[e].backUpCounts = this.nodesMap[e].backUpCounts - 1, this.nodesMap[e].alarmCounts == 0 && (this.nodesMap[e].backUpCounts == 0 ? this.nodesMap[e].status = 1 : this.nodesMap[e].status = 6)), this.nodesMap[e].groupId && this.setGroupStatus(this.nodesMap[e].groupId, t, i) } setOfflineStatus(e) { this.nodesMap[e].status !== 2 && this.nodesMap[e].status !== 6 && this.nodesMap[e].status !== 1 && (this.nodesMap[e].status = 0, this.nodesMap[e].groupId && this.setOfflineStatus(this.nodesMap[e].groupId)) } setNormalStatus(e) { this.nodesMap[e].status !== 2 && this.nodesMap[e].status !== 6 && (this.nodesMap[e].status = 1, this.nodesMap[e].groupId && this.setNormalStatus(this.nodesMap[e].groupId)) } getEquipGroupIds(e) { const t = []; if (window.groupCache && Object.keys(window.groupCache).forEach(i => { window.groupCache[i] && window.groupCache[i][e] && t.push(Number(i)) }), t.length === 0) { const i = window.equipCache && window.equipCache[e]; if (i) { if (i.groupIds && i.groupIds.length > 0) { return i.groupIds; } i.groupId && t.push(i.groupId) } } return t } setStatus(e) { let t = this.equipStatusObject[e.equipNo]; const i = this.getEquipGroupIds(e.equipNo); e.status != 3 && i.length > 0 && (i.forEach(o => { switch (e.status) { case 0: t == 6 && this.setGroupStatus(o, !1, 6); break; case 1: t == 6 ? this.setGroupStatus(o, !1, 6) : t == 2 && this.setGroupStatus(o, !1, 2); break; case 2: t != 2 && this.setGroupStatus(o, !0, 2), t == 6 && this.setGroupStatus(o, !1, 6); break; case 6: t == 2 && this.setGroupStatus(o, !1, 2), t != 6 && this.setGroupStatus(o, !0, 6); break }let r = `${o}-${e.equipNo}`; this.nodesMap[r] && (this.nodesMap[r].status = e.status) }), this.equipStatusObject[e.equipNo] = e.status, this.statusChange(i[0], e.equipNo, e.status)) } resetGroupStatus() { for (let e in this.groupNodeObject) { this.groupNodeObject[e].alarmCounts = 0, this.groupNodeObject[e].backUpCount = 0 } } } const jt = Object.assign({}, { getSetParm(n) { if (window.AxiosBuilder.axios) { return window.AxiosBuilder.axios({ method: "post", url: "/IoT/api/v3/EquipList/GetFullSetParmByEquipNo", params: n, data: n, headers: { "Content-Type": "application/json;charset=UTF-8", "Accept-Language": window.sessionStorage.languageType || "zh-CN" } }) } } }); class _t { constructor(e, t) { this.nodesMap = e, this.equipControllObject = t } async getSetting(e, t, i, o) { let [r, a] = String(e).split("-"), c = { equipNo: a }; await jt.getSetParm(c).then(u => { if (u.data.code == 200) { let s = u && u.data && u.data.data && u.data.data.rows || []; this.nodesMap[e].settings || (this.nodesMap[e].settings = []), s && s.length > 0 && this.nodesMap[e] && (s.forEach(l => { l.title = l.setNm, l.key = `${r}-${a}-${l.setNo}`, l.level = Number(i) + 1, l.checked = o || this.equipControllObject[a] && this.equipControllObject[a].includes(l.setNo), l.isSetting = !0, l.equipNo = a, l.groupId = r, l.setNo = l.setNo, l.equipName = t }), this.nodesMap[e].settings = [...s]) } }) } } class q { static formateList(e, t) { let i = []; for (const o of e) { let r = {}; r.count = 0, r.equipSelectCount = 0, r.controlSelectCount = 0, r.equipCount = o.equipCount || 0, r.title = o.name, r.key = o.id, r.isGroup = !0, r.children = [], r.status = 1, r.level = t || 1, r.expand = !t, r.equips = [], r.groupId = o.parentId, r.groups = [], r.alarmCounts = 0, r.backUpCounts = 0, r.indeterminate = !1, r.checked = !1, r.visible = !0, r.nodeEquipSelectCount = 0, r.checkedEquips = [], r.halfCheckedEquips = [], r.selectControlCount = 0, o.children && o.children.length > 0 && (r.groups = [...this.formateList(o.children, t ? t + 1 : 2)]), i.push(r) } return i } static deepClone(e, t, i, o, r, a) { let c = []; if (e) { for (let u = 0, s = e.length; u < s; u++) { c.push({ isGroup: i, key: `${o}-${e[u].id}`, status: a[e[u].id] || 0, title: e[u].title, level: t, expand: !1, isEquip: !0, loading: !1, indeterminate: r[`${e[u].groupId}-${e[u].equipNo}`] && r[`${e[u].groupId}-${e[u].equipNo}`].indeterminate || !1, checked: r[`${e[u].groupId}-${e[u].equipNo}`] && r[`${e[u].groupId}-${e[u].equipNo}`].checked || !1, groupId: o, equipNo: e[u].id, visible: !0, settings: [] }); } } return c } static copyOrigin(e) { let t = []; return e.forEach(i => { t.push({ ...i }) }), t } static getPosition(e, t) { let i = 0; for (let o = 0, r = t.length; o < r; o++) { if (t[o].key == e) { i = o - 30; break } } return i } static flattern(e, t) { e.forEach(i => { i.isGroup && (t[`${i.key}`] = null, t[`${i.key}`] = i), i.groups && i.groups.length && this.flattern(i.groups, t) }) } static generateUUID() { let e = new Date().getTime(); return window.performance && typeof window.performance.now == "function" && (e += performance.now()), "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (i) { let o = (e + Math.random() * 16) % 16 | 0; return e = Math.floor(e / 16), (i === "x" ? o : o & 3 | 8).toString(16) }) } static listToTreeList(e) { const t = e, i = [], o = {}; return t.forEach(r => { o[r.id] = r }), t.forEach(r => { const a = o[r.parentId]; a ? (a.children || (a.children = [])).push(r) : i.push(r) }), i } } class Gt extends U { constructor(e, t, i) { super(), this.showSettings = t, this.groupNodeObject = e, this.aliasName = i } filterMethod(e) { for (let t in this.groupNodeObject) { e && this.updateBySearch(t, e) } } updateBySearch(e, t) { let i = window[`group-${this.groupNodeObject[e].key}${this.aliasName}`]; i && (i = i.filter(o => o.title.includes(t)), window[`group-${this.groupNodeObject[e].key}-search`] = q.copyOrigin(i)) } } const X = (n, e) => { const t = n.__vccOpts || n; for (const [i, o] of e) { t[i] = o; } return t }, Pt = { props: { source: { type: Object, default: () => { } }, groupEditAndNew: { type: Function, default: () => { } }, deleteGroup: { type: Function, default: () => { } } } }, At = { class: "operates" }; function $t(n, e, t, i, o, r) { const a = h.resolveComponent("el-button"), c = h.resolveComponent("el-button-group"), u = h.resolveComponent("el-popover"); return h.openBlock(), h.createElementBlock("div", At, [h.createVNode(u, { placement: "bottom", trigger: "hover" }, { reference: h.withCtx(() => [h.createElementVNode("i", { class: "el-icon-more", onClick: e[3] || (e[3] = h.withModifiers(() => { }, ["stop"])) })]), default: h.withCtx(() => [h.createVNode(c, { class: "new-button-group setModule" }, { default: h.withCtx(() => [h.createVNode(a, { type: "text", size: "small", class: "elBtn", icon: "iconfont icon-tubiao20_bianji", onClick: e[0] || (e[0] = h.withModifiers(s => t.groupEditAndNew(!1, t.source), ["stop"])) }, { default: h.withCtx(() => [h.createTextVNode(h.toDisplayString(n.$t("equipInfo.poverTips.rename")), 1)]), _: 1 }), h.createVNode(a, { type: "text", size: "small", class: "elBtn", icon: " iconfont icon-gw-icon-tianjia1", onClick: e[1] || (e[1] = s => t.groupEditAndNew(!0, t.source)) }, { default: h.withCtx(() => [h.createTextVNode(h.toDisplayString(n.$t("equipInfo.poverTips.newChildGroup")), 1)]), _: 1 }), t.source.level != 1 ? (h.openBlock(), h.createBlock(a, { key: 0, type: "danger", size: "small", onClick: e[2] || (e[2] = h.withModifiers(s => t.deleteGroup(t.source), ["stop"])), icon: " iconfont icon-tubiao20_shanchu" }, { default: h.withCtx(() => [h.createTextVNode(h.toDisplayString(n.$t("publics.button.deletes")), 1)]), _: 1 })) : h.createCommentVNode("", !0)]), _: 1 })]), _: 1 })]) } const Lt = { name: "ElTreeVirtualNode", componentName: "ElTreeVirtualNode", props: { searchName: { type: String, default: "" }, expanding: { type: Boolean, default: !1 }, aleadyLoadAll: { type: Boolean, default: !1 }, groupLoading: { type: Boolean, default: !1 }, source: { type: Object, default() { return {} } }, showCheckbox: { type: Boolean, default: !1 }, showStatus: { type: Boolean, default: !1 }, showOperate: { type: Boolean, default: !1 }, currentSelect: { type: [Number, String], default: -1 }, nodeClick: { type: Function }, onChecked: { type: Function }, groupEditAndNew: { type: Function }, deleteGroup: { type: Function }, childrenResetGroupNum: { type: Function }, getEquipStatus: { type: Function }, colorConfig: { type: Object, default: () => { } }, index: { type: Number, default: -1 } }, components: { oparate: X(Pt, [["render", $t]]) }, computed: { getColor() { return function (n) { this.colorConfig || (this.colorConfig = { noComm: "#a0a0a0", normal: "#63e03f", alarm: "#f22433", lsSet: "#bebcaa", initialize: "#289ac0", withdraw: "#ffc0cb", BackUp: "#f8901c" }); let e; switch (n) { case 0: e = this.colorConfig.noComm; break; case 1: e = this.colorConfig.normal; break; case 2: e = this.colorConfig.alarm; break; case 3: e = this.colorConfig.lsSet; break; case 4: e = this.colorConfig.initialize; break; case 5: e = this.colorConfig.withdraw; break; case 6: e = this.colorConfig.BackUp; break; default: e = this.colorConfig.noComm; break }return e } } }, data() { return { indent: 13 } }, methods: { clickFunction() { this.source.expand = !this.source.expand, this.nodeClick(this.source, this.index, this.source.level, this.source.checked) }, checkedChange(n) { this.onChecked(this.source) } } }, Bt = { class: "el-tree-node__content" }, Rt = { class: "nodeContent" }, zt = { key: 1, class: "circle" }, Dt = { class: "label" }, Ft = { key: 2, class: "equipNumber" }, Ht = { key: 4, class: "el-tree-node__loading-icon el-icon-loading" }; function Ut(n, e, t, i, o, r) { const a = h.resolveComponent("el-checkbox"), c = h.resolveComponent("oparate"); return h.openBlock(), h.createElementBlock("div", { class: h.normalizeClass(["el-tree-node", { parent_tag: t.source.isGroup, child_tags: !t.source.isGroup, selectedColor: t.currentSelect === t.source.key && !t.source.isGroup }]), onClick: e[2] || (e[2] = (...u) => r.clickFunction && r.clickFunction(...u)) }, [h.createElementVNode("div", Bt, [h.createElementVNode("span", { class: "el-tree__indent", "aria-hidden": "true", style: h.normalizeStyle({ width: (t.source.level - 1) * o.indent + "px" }) }, null, 4), t.source.isGroup ? (h.openBlock(), h.createElementBlock("span", { key: 0, class: h.normalizeClass([{ "is-leaf": !t.source.isGroup, expanded: t.source.isGroup && t.source.expand }, "el-tree-node__expand-icon", "iconfont icon-fangxiangL"]) }, null, 2)) : h.createCommentVNode("", !0), h.createElementVNode("div", Rt, [t.showCheckbox ? (h.openBlock(), h.createBlock(a, { key: 0, onClick: e[0] || (e[0] = h.withModifiers(() => { }, ["stop"])), modelValue: t.source.checked, "onUpdate:modelValue": e[1] || (e[1] = u => t.source.checked = u), indeterminate: t.source.indeterminate, onChange: r.checkedChange }, null, 8, ["modelValue", "indeterminate", "onChange"])) : h.createCommentVNode("", !0), t.showStatus ? (h.openBlock(), h.createElementBlock("span", zt, [t.source.status != 6 ? (h.openBlock(), h.createElementBlock("span", { key: 0, class: "yd", style: h.normalizeStyle({ backgroundColor: r.getColor(t.source.status) }) }, null, 4)) : (h.openBlock(), h.createElementBlock("i", { key: 1, style: h.normalizeStyle({ color: t.colorConfig.BackUp }), class: "iconfont icon-gw-icon-beiji2" }, null, 4))])) : h.createCommentVNode("", !0), h.createElementVNode("span", Dt, h.toDisplayString(t.source.title), 1), t.source.isGroup && !t.source.isEquip || t.source.isGroup && !t.source.isEquip ? (h.openBlock(), h.createElementBlock("span", Ft, h.toDisplayString(t.source.count), 1)) : h.createCommentVNode("", !0), t.source.isGroup && t.showOperate ? (h.openBlock(), h.createBlock(c, { key: 3, source: t.source, groupEditAndNew: t.groupEditAndNew, deleteGroup: t.deleteGroup }, null, 8, ["source", "groupEditAndNew", "deleteGroup"])) : h.createCommentVNode("", !0), t.source.loading ? (h.openBlock(), h.createElementBlock("span", Ht)) : h.createCommentVNode("", !0)])])], 2) } const Wt = X(Lt, [["render", Ut]]), Vt = { components: { VirtualList: Qe }, mixins: [Ce], data() { return { itemComponent: Wt, visibleList: [], currentSelect: -1, equipStatusManage: null, cacheManage: null, searchManage: null, equipNumManage: null, requestManage: null, checkStatusManage: null, groupNodeObject: {}, nodesMap: {}, equipCheckObject: {}, equipStatusObject: {}, controlObject: {}, isSearchStatus: !1, equipControllObject: {}, expandGroup: [], updateJob: null, filterEquipList: [] } }, props: { data: { type: Array }, selectEquips: { type: [Array, Object], default: () => [] }, controllList: { type: Array, default: () => [] }, showSettings: { type: Boolean, default: !1 }, showSelectNum: { type: Boolean, default() { return !1 } }, showCheckbox: { type: Boolean, default: !1 }, showStatus: { type: Boolean, default: !1 }, filterEquip: { type: Boolean, default: !1 }, showOperate: { type: Boolean, default: !1 }, defaultExpandAll: { type: Boolean, default: !1 }, currentNodeKey: [String, Number], colorConfig: { type: Object, default: () => ({ noComm: "#a0a0a0", normal: "#63e03f", alarm: "#f22433", lsSet: "#bebcaa", initialize: "#289ac0", withdraw: "#ffc0cb", BackUp: "#f8901c" }) }, treeType: { type: String, default: "" }, buildTree: { type: Function, default: () => { } }, filterData: { type: Function, default: () => { } }, alias: { type: String, default: "" } }, watch: { data(n) { n && n.length && (q.flattern(this.data, this.groupNodeObject), this.cacheManage.addNodesMap(Object.values(this.groupNodeObject).map(e => e)), this.init()) }, controllList(n) { this.updateCheckedStatusWithControls() }, selectEquips(n) { this.updateCheckedStatusWithEquips(), this.$nextTick(() => { this.checkStatusManage && this.checkStatusManage.updateGroupCheckStatus() }) }, filterEquip(n) { this.$nextTick(() => { this.visibleList = [], this.$refs.virtualList.scrollToIndex(0), this.updateTreeList(this.data), this.equipNumManage.resetGroupNum(this.isSearchStatus, n, this.equipStatusObject) }) } }, computed: { aliasName() { return this.alias ? `-${this.alias}` : "" } }, created() { this.showCheckbox && (this.checkStatusManage = new et(this.groupNodeObject, this.nodesMap, this.equipControllObject, this.controlObject, this.equipCheckObject, this.aliasName)), this.cacheManage = new Ze(this.groupNodeObject, this.nodesMap, this.controlObject, this.equipCheckObject), this.searchManage = new Gt(this.groupNodeObject, this.showSettings, this.aliasName), this.equipNumManage = new tt(this.groupNodeObject, this.aliasName), this.requestManage = new _t(this.nodesMap, this.equipControllObject) }, mounted() { this.updateCheckedStatusWithControls(), this.updateCheckedStatusWithEquips(), window.addEventListener("message", n => { n.data.type && this[n.data.type] && this[n.data.type](n.data.data) }) }, methods: { init() { this.data[0].expand = !0, this.updateTreeList(), setTimeout(() => { Object.values(this.groupNodeObject).forEach((n, e) => { !n.expand && this.expandGroup.includes(n.key) && (n.expand = !0), this.filterWithAlias(n.key), this.updateGroupEquips(n.key, !0) }), this.showCheckbox && this.checkStatusManage && this.checkStatusManage.updateGroupCheckStatus(), this.showStatus && !this.equipStatusManage && (this.equipStatusManage = new xt(this.nodesMap, this.equipStatusObject, this.groupNodeObject, this.statusChange, this.aliasName)) }, 500) }, filterWithAlias(n) { if (this.aliasName) { let e = window[`group-${n}`] || []; window[`group-${n}${this.aliasName}`] = this.filterData(e) } }, updateCurrentSelect() { window.equipCache && window.equipCache[this.currentNodeKey] && (this.currentSelect = `${window.equipCache[this.currentNodeKey].groupId}-${this.currentNodeKey}`) }, statusChange(n, e, t) { this.currentSelect == `${n}-${e}` && this.$emit("statusChange", e, t) }, updateCheckWidthJob() { this.showCheckbox && (this.checkStatusManage.resetCheckedStatus(), this.updateCheckedStatusWithControls(), this.updateCheckedStatusWithEquips(), this.checkStatusManage && this.checkStatusManage.updateGroupCheckStatus()) }, updateGroupEquips(n, e) { if (!this.isSearchStatus && this.groupNodeObject[n]) { let t = this.equipNumManage.getAllEquipsNum(); this.$emit("getTotal", t) } this.equipNumManage.resetGroupNum(this.isSearchStatus, this.filterEquip, this.equipStatusObject), this.groupNodeObject[n].expand && this.updateList(n, this.groupNodeObject[n].level, null, !1) }, updateList(n) { if (this.groupNodeObject[n]) { let e = []; this.isSearchStatus ? (e = window[`group-${n}-search`], this.groupNodeObject[n].equips = [...q.deepClone(e, Number(this.groupNodeObject[n].level) + 1, this.showSettings, n, this.equipCheckObject, this.equipStatusObject)]) : (e = window[`group-${n}${this.aliasName}`], this.groupNodeObject[n].equips = [...q.deepClone(e, Number(this.groupNodeObject[n].level) + 1, this.showSettings, n, this.equipCheckObject, this.equipStatusObject)]), this.cacheManage.addNodesMap(this.groupNodeObject[n].equips), this.cacheManage.closeBrotherNode(n), this.visibleList = [], this.updateTreeList(this.data), this.showCheckbox && this.checkStatusManage && e && e.length && this.checkStatusManage.updateGroupCheckStatus(), this.showStatus && this.equipStatusManage && this.equipStatusManage.updateGroupStatus(n), this.updateCurrentSelect() } }, updateTreeList(n) { n && n.length > 0 && n.forEach(e => { this.filterEquip && e.status === 2 ? this.filterEquipList.includes(e.equipNo) || this.visibleList.push(e) : this.filterEquip || this.visibleList.push(e), e.expand ? e.isEquip ? (e.children || (e.children = []), e.settings && (e.children = [...e.settings || []])) : e.children = [...e.equips || [], ...e.groups || []] : e.children = [], this.updateTreeList(e.children || []) }) }, nodeClick(n, e, t, i) { this.$emit("node-click", { ...n, key: n.isEquip ? n.equipNo : n.key }), n.isGroup ? n.isEquip ? this.equipClick(n, e, i) : this.groupClick(n, e, i) : this.currentSelect = n.key }, groupClick(n, e, t) { n.expand ? this.updateList(n.key, n.level, e, t) : (this.cacheManage.recycleGroupCache(n.key), this.visibleList = [], this.updateTreeList(this.data)) }, async equipClick(n, e, t) { this.showSettings && (n.expand ? (n.loading = !0, await this.requestManage.getSetting(n.key, n.title, n.level, t), this.controlObject[`${n.groupId}-${n.equipNo}`] = { groupId: n.groupId }, n.loading = !1, this.visibleList.splice(e + 1, 0, ...this.nodesMap[n.key].settings), this.cacheManage.addNodesMap(this.nodesMap[n.key].settings)) : (this.visibleList.splice(e + 1, this.nodesMap[n.key].settings.length), this.cacheManage.removeNodesMap(this.nodesMap[n.key].settings), this.nodesMap[n.key].settings = [], delete this.controlObject[`${n.groupId}-${n.equipNo}`])) }, onChecked(n) { this.checkStatusManage && this.checkStatusManage.onChecked(n, this.isSearchStatus), this.$emit("onCheck") }, groupEditAndNew(n, e) { this.$emit("groupEditAndNew", { isGroupNew: n, node: e }) }, deleteGroup(n) { this.$emit("deleteGroup", n) }, updateCheckedStatusWithControls() { this.controllList && this.controllList.length && this.checkStatusManage && this.checkStatusManage && this.checkStatusManage.updateCheckedStatusWithControls(this.controllList) }, updateCheckedStatusWithEquips() { this.selectEquips && (this.selectEquips.length || Object.keys(this.selectEquips).length) && this.checkStatusManage && this.checkStatusManage && this.checkStatusManage.updateCheckedStatusWithEquips(this.selectEquips) }, resetCheckedStatus() { this.checkStatusManage && this.checkStatusManage.resetCheckedStatus() }, getEquipSelectd() { return this.checkStatusManage && this.checkStatusManage.getEquipSelectd() }, getEquipGroupSelectd() { return this.checkStatusManage && this.checkStatusManage.getEquipGroupSelectd() }, getControlSelected() { return this.checkStatusManage && this.checkStatusManage.getControlSelected() }, recordExpandGroup() { this.expandGroup = [], Object.values(this.groupNodeObject).forEach(n => { n.expand && this.expandGroup.push(n.key) }) }, removeExpandGroup() { this.$nextTick(() => { this.expandGroup = [] }) }, filterMethod(n) { this.visibleList = [], this.cacheManage.recycleAllNodeCache(), n ? (this.isSearchStatus = !0, this.searchManage.filterMethod(n)) : this.isSearchStatus = !1, this.init(), this.$nextTick(() => { this.$refs.virtualList.scrollToIndex(0) }), this.equipNumManage.resetGroupNum(this.isSearchStatus, this.filterEquip, this.equipStatusObject), this.showCheckbox && (this.checkStatusManage && this.checkStatusManage.reComputedCheckNum(this.isSearchStatus), this.checkStatusManage && this.checkStatusManage.updateGroupCheckStatus()) }, rebuildTree() { this.recordExpandGroup(), this.checkStatusManage && this.checkStatusManage.resetCheckedStatus(), this.cacheManage.recycleAllNodeCache(!0), this.$nextTick(() => { this.buildTree(), this.removeExpandGroup() }) }, destroyTree() { this.cacheManage.recycleAllNodeCache(!0), this.visibleList = [], this.updateTreeList(this.data) }, GetGroupEquips(n) { n.groupId && this.groupNodeObject[n.groupId] && !this.isSearchStatus && (this.updateGroupEquips(n.groupId, !0), this.updateJob && clearTimeout(this.updateJob), this.updateJob = setTimeout(() => { this.updateCheckWidthJob() }, 500)) }, DeleteEquip(n) { const { groupId: e, equips: t } = n || {}; e && this.groupNodeObject[e] && (this.updateGroupEquips(n.groupId), this.equipNumManage.resetGroupNum(), this.checkStatusManage && this.checkStatusManage.resetCheckedStatus()), t.length && t.forEach(i => { let o = this.nodesMap[`${e}-${i.id}`]; o && (this.currentSelect.toString().includes(i.id) && this.$emit("currentDelete"), this.showStatus && (o.status == 2 ? this.equipStatusManage.setGroupStatus(e, !1, 2) : o.status == 6 && this.equipStatusManage.setGroupStatus(e, !1, 6)), delete this.nodesMap[`${e}-${i.id}`], delete this.equipCheckObject[i.id]), delete this.equipStatusObject[i.id] }) }, moveEquips(n) { const { updateGroups: e, buildTree: t } = n || {}; !t && e ? e.forEach(i => { i && this.groupNodeObject[i] && (this.updateGroupEquips(i), this.equipNumManage.resetGroupNum(), this.checkStatusManage && this.checkStatusManage.resetCheckedStatus()) }) : t && this.rebuildTree() }, DeleteEquipGroup(n) { n.forEach(e => { e.groupId && this.nodesMap[e.groupId] && (this.isSearchStatus || this.rebuildTree()) }) }, AddEquipGroup(n) { const { parentGroupId: e, groupId: t } = n || {}; t && this.nodesMap[e] && this.treeType && (this.isSearchStatus || this.rebuildTree()) }, EditEquipGroup(n) { const { groupId: e, groupName: t } = n; this.nodesMap[e] && (this.nodesMap[e].title = t) }, AddEquip(n) { this.filterEquip && (this.filterEquipList = n == null ? void 0 : n.equips.map(e => e.id)), this.init() }, EditEquip(n) { const { equipNo: e, groupId: t, equipName: i } = n || {}; this.nodesMap[`${t}-${e}`] && (this.isSearchStatus || (this.nodesMap[`${t}-${e}`].title = i)) }, childrenResetGroupNum(n) { this.equipNumManage.resetGroupNum(n, this.filterEquip, this.equipStatusObject) }, getEquipStatus(n) { return this.equipStatusManage.equipStatusObject[n] } } }, Kt = { class: "gw-tree", style: { height: "100%" } }, Jt = { class: "tree", style: { height: "100%" } }; function Xt(n, e, t, i, o, r) { const a = h.resolveComponent("virtual-list", !0); return h.openBlock(), h.createElementBlock("div", Kt, [h.createElementVNode("div", Jt, [h.createVNode(a, { ref: "virtualList", class: "virtualList", "data-key": "key", "data-sources": o.visibleList, "data-component": o.itemComponent, keeps: 40, "extra-props": { currentSelect: o.currentSelect, nodeClick: r.nodeClick, showStatus: t.showStatus, filterEquip: t.filterEquip, showSettings: t.showSettings, showCheckbox: t.showCheckbox, onChecked: r.onChecked, showOperate: t.showOperate, groupEditAndNew: r.groupEditAndNew, deleteGroup: r.deleteGroup, colorConfig: t.colorConfig, childrenResetGroupNum: r.childrenResetGroupNum, getEquipStatus: r.getEquipStatus } }, null, 8, ["data-sources", "data-component", "extra-props"])])]) } const Yt = X(Vt, [["render", Xt]]); class Qt { constructor() { this.eGroupNotify = new je("/eGroupNotify", "", ""), this.alreadyUpdate = {}, this.notify = null, window = window; try { window.top.equipGroup, window = window.top } catch { window = window } } stop() { this.notify && this.notify.stop() } Init() { this.eGroupNotify.openConnect().then(e => { this.notify = e; try { e.invoke("GetEquipGroupTree"), e.invoke("GetAllEquipGroupTree") } catch (t) { console.log(t) } this.subscribeTo(e, "GetEquipGroupTree"), this.subscribeTo(e, "AddEquipGroup"), this.subscribeTo(e, "EditEquipGroup"), this.subscribeTo(e, "DeleteEquipGroup"); try { e.invoke("GetGroupEquips") } catch (t) { console.log(t) } this.subscribeTo(e, "GetGroupEquips"), this.subscribeTo(e, "AddEquip"), this.subscribeTo(e, "DeleteEquip"), this.subscribeTo(e, "EditEquip"), this.subscribeTo(e, "moveEquips"), this.subscribeTo(e, "GetAllEquipGroupTree"), e.onclose(t => { try { this.Init() } catch (i) { console.log(i) } console.log("重连", t) }) }).catch(e => { console.error(e) }) } subscribeTo(e, t) { e.off(t), e.on(t, i => { i && i.isSuccess && (this[t] ? this[t](i.data) : this.notice({ func: t, data: i.data, key: i.groupId })) }) } GetEquipGroupTree(e) { window.groupList || (window.groupList = e, this.notice({ type: "GetEquipGroupTree" })) } GetAllEquipGroupTree(e) { window.groupList_manageMent || (window.groupList_manageMent = e, this.notice({ type: "GetEquipGroupTreeWidthTreeType" })) } AddEquipGroup(e) { const { parentGroupId: t, groupId: i, groupName: o } = e || {}; i && (window.groupList_manageMent || (window.groupList_manageMent = []), window.groupList_manageMent.push({ parentId: t, id: i, name: o, equipCount: 0 }), this.notice({ type: "AddEquipGroup", data: e })) } EditEquipGroup(e) { const { groupId: t, groupName: i } = e; window.groupList && window.groupList.forEach(o => { o.id == t && (o.name = i) }), window.groupList_manageMent && window.groupList_manageMent.forEach(o => { o.id == t && (o.name = i) }), this.notice({ type: "EditEquipGroup", data: e }) } deleteChildGroup(e, t) { let i = []; t.forEach(o => { o.parentId == e && i.push(o.id) }), i.forEach(o => { let r = t.findIndex(a => a.id == o); r > -1 && t.splice(r, 1), this.deleteChildGroup(o, t) }) } DeleteEquipGroup(e) { e.forEach(t => { if (window.groupList) { let i = window.groupList.findIndex(o => o.id == t.groupId); i > -1 && window.groupList.splice(i, 1), this.deleteChildGroup(t.groupId, window.groupList) } if (window.groupList_manageMent) { let i = window.groupList_manageMent.findIndex(o => o.id == t.groupId); i > -1 && window.groupList_manageMent.splice(i, 1), this.deleteChildGroup(t.groupId, window.groupList_manageMent) } }), this.notice({ type: "DeleteEquipGroup", data: e }) } GetGroupEquips(e) { const { groupId: t, equips: i } = e || {}; this.alreadyUpdate[t] || (window.groupCache || (window.groupCache = {}), window.groupCache[t] = {}, t && i && i instanceof Array && (i.forEach(o => { o.title = o.name, o.groupId = t, o.equipNo = o.id, delete o.name, window.equipCache || (window.equipCache = {}), window.equipCache[o.id] = o, window.groupCache[t][o.id] = o }), window[`group-${t}`] = i, this.notice({ type: "GetGroupEquips", data: { groupId: t } }), this.alreadyUpdate[t] = !0)) } AddEquip(e) { const { groupId: t, equips: i } = e || {}; window[`group-${t}`] || (window[`group-${t}`] = []), window.groupCache || (window.groupCache = {}), window.groupCache[t] || (window.groupCache[t] = {}), window.equipCache || (window.equipCache = {}); let o = window[`group-${t}`].length; if (t && i) { if (i.forEach((r, a) => { window[`group-${t}`].push({ equipNo: r.id, groupId: t, id: r.id, title: r.name }), window.equipCache[r.id] = window[`group-${t}`][o + a], window.groupCache[t][r.id] = window[`group-${t}`][o + a] }), !this.exist(t, window.groupList)) { let r = this.findParentList(t, window.groupList_manageMent); window.groupList.push(...r) } this.notice({ type: "AddEquip", data: e }) } } moveEquips(e) { let t = [], i = !0, o = []; const { sourceGroup: r, targetGroupId: a } = e || {}; a && t.push(a), r.forEach(c => { if (t.push(c.groupId), (!window[`group-${a}`] || !window[`group-${a}`].length) && (window[`group-${a}`] = [], o.push(a)), window.groupCache || (window.groupCache = {}), window.groupCache[a] || (window.groupCache[a] = {}), c.equips.forEach(u => { if (u.title = u.name, u.groupId = a, u.equipNo = u.id, window[`group-${c.groupId}`]) { let s = window[`group-${c.groupId}`].findIndex(l => l.id == u.id); s > -1 && window[`group-${c.groupId}`].splice(s, 1) } window.equipCache || (window.equipCache = {}), window.equipCache[u.id] = u, window.groupCache[a][u.id] = u, window[`group-${a}`].push(u) }), !window[`group-${c.groupId}`].length) { let u = window.groupList.findIndex(s => s.id == c.groupId); u > -1 && window.groupList.splice(u, 1), this.deleteChildGroup(c.groupId, window.groupList) } }), o.forEach(c => { if (!this.exist(c, window.groupList)) { let u = this.findParentList(c, window.groupList_manageMent); window.groupList.push(...u) } }), this.notice({ type: "moveEquips", data: { updateGroups: t, buildTree: i } }) } exist(e, t) { return t ? t.some(i => i.id == e) : !1 } findParentList(e, t) { let i = []; if (t) { let o = t.findIndex(r => r.id == e); o > -1 && i.push({ ...t[o] }), t[o].parentId && !this.exist(t[o].parentId, window.groupList) && i.push(...this.findParentList(t[o].parentId, window.groupList_manageMent)) } return i } DeleteEquip(e) { const { groupId: t, equips: i } = e || {}; if (t && i && i instanceof Array) { if (window[`group-${t}`]) { for (let o = 0, r = i.length; o < r; o++) { let a = window[`group-${t}`].findIndex(c => c.id == i[o].id); a > -1 && window[`group-${t}`].splice(a, 1), delete window.equipCache[i[o].id], delete window.groupCache[t][i[o].id] } } this.notice({ type: "DeleteEquip", data: e }) } } EditEquip(e) { const { equipNo: t, groupId: i, equipName: o } = e || {}; i && t && (window[`group-${i}`] && (window.equipCache[t] = o), this.notice({ type: "EditEquip", data: e })) } notice(e) { if (window.hasIframe) { let t = document.getElementsByTagName("iframe"); for (let i of t) { i.contentWindow.postMessage(e) } } else { window.postMessage(e, "*") } } } const Zt = { name: "treeV2", components: { tree: Yt }, mixins: [Ce], data() { return { list: [], refId: q.generateUUID(), treeKey: null, listKey: null, hasBuildTree: !1 } }, props: { treeType: { type: String, default: "" } }, mounted() { this.treeKey = `equipGroup${this.treeType}`, this.listKey = `groupList${this.treeType}`, window[this.treeKey] ? this.list = q.formateList(JSON.parse(JSON.stringify(window[this.treeKey]))) : window[this.listKey] && this.buildTree(), window.executeQueue || (window.executeQueues = {}), window.executeQueues[this.refId] = this.destroyTree, window.addEventListener("message", n => { n && n.data && n.data.type && this[n.data.type] && this[n.data.type]() }); try { window.hasIframe || this.selfRequest() } catch { this.selfRequest() } }, methods: { selfRequest() { new Qt().Init() }, GetEquipGroupTreeWidthTreeType() { this.treeType && window[this.listKey] && this.buildTree() }, GetEquipGroupTree() { !this.treeType && window[this.listKey] && this.buildTree() }, buildTree() { if (window[this.listKey]) { let n = q.listToTreeList(JSON.parse(JSON.stringify(window[this.listKey]))); this.list = q.formateList(JSON.parse(JSON.stringify(n))), window[`equipGroup${this.treeType}`] = n, this.hasBuildTree = !0 } }, filterMethod(n) { this.$refs[this.refId].filterMethod(n) }, resetCheckedStatus() { this.$refs[this.refId].resetCheckedStatus() }, getEquipSelectd() { return this.$refs[this.refId].getEquipSelectd() }, getEquipGroupSelectd() { return this.$refs[this.refId].getEquipGroupSelectd() }, getControlSelected() { return this.$refs[this.refId].getControlSelected() }, destroyTree() { this.$refs[this.refId].destroyTree() } } }; function ei(n, e, t, i, o, r) { const a = h.resolveComponent("tree"); return h.openBlock(), h.createBlock(a, h.mergeProps({ ref: o.refId, data: o.list }, { ...n.$attrs, ...n.$props }, h.toHandlers(n.$listeners), { buildTree: r.buildTree }), null, 16, ["data", "buildTree"]) } const Y = X(Zt, [["render", ei]]); return Y.install = function (n) { n.component(Y.name, Y) }, Y
|
|
6
6
|
});
|