PageSourceSearch

https://id.priyadi.net/assets/controllers/process-monitor_controller-YdYX9-m.js

js priyadi.net collected 2026-10-02 06:18:31 UTC 36,725 bytes, 941 lines download raw bytes

vendor: 5,256 bytes, lines 1-151
1function _array_like_to_array(arr, len) {
2    if (len == null || len > arr.length) len = arr.length;
3    for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
4    return arr2;
5}
6function _array_with_holes(arr) {
7    if (Array.isArray(arr)) return arr;
8}
9function _assert_this_initialized(self) {
10    if (self === void 0) {
11        throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
12    }
13    return self;
14}
15function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
16    try {
17        var info = gen[key](arg);
18        var value = info.value;
19    } catch (error) {
20        reject(error);
21        return;
22    }
23    if (info.done) {
24        resolve(value);
25    } else {
26        Promise.resolve(value).then(_next, _throw);
27    }
28}
29function _async_to_generator(fn) {
30    return function() {
31        var self = this, args = arguments;
32        return new Promise(function(resolve, reject) {
33            var gen = fn.apply(self, args);
34            function _next(value) {
35                asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
36            }
37            function _throw(err) {
38                asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
39            }
40            _next(undefined);
41        });
42    };
43}
44function _class_call_check(instance, Constructor) {
45    if (!(instance instanceof Constructor)) {
46        throw new TypeError("Cannot call a class as a function");
47    }
48}
49function _defineProperties(target, props) {
50    for(var i = 0; i < props.length; i++){
51        var descriptor = props[i];
52        descriptor.enumerable = descriptor.enumerable || false;
53        descriptor.configurable = true;
54        if ("value" in descriptor) descriptor.writable = true;
55        Object.defineProperty(target, descriptor.key, descriptor);
56    }
57}
58function _create_class(Constructor, protoProps, staticProps) {
59    if (protoProps) _defineProperties(Constructor.prototype, protoProps);
60    if (staticProps) _defineProperties(Constructor, staticProps);
61    return Constructor;
62}
63function _define_property(obj, key, value) {
64    if (key in obj) {
65        Object.defineProperty(obj, key, {
66            value: value,
67            enumerable: true,
68            configurable: true,
69            writable: true
70        });
71    } else {
72        obj[key] = value;
73    }
74    return obj;
75}
76function _get_prototype_of(o) {
77    _get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
78        return o.__proto__ || Object.getPrototypeOf(o);
79    };
80    return _get_prototype_of(o);
81}
82function _inherits(subClass, superClass) {
83    if (typeof superClass !== "function" && superClass !== null) {
84        throw new TypeError("Super expression must either be null or a function");
85    }
86    subClass.prototype = Object.create(superClass && superClass.prototype, {
87        constructor: {
88            value: subClass,
89            writable: true,
90            configurable: true
91        }
92    });
93    if (superClass) _set_prototype_of(subClass, superClass);
94}
95function _iterable_to_array_limit(arr, i) {
96    var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
97    if (_i == null) return;
98    var _arr = [];
99    var _n = true;
100    var _d = false;
101    var _s, _e;
102    try {
103        for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
104            _arr.push(_s.value);
105            if (i && _arr.length === i) break;
106        }
107    } catch (err) {
108        _d = true;
109        _e = err;
110    } finally{
111        try {
112            if (!_n && _i["return"] != null) _i["return"]();
113        } finally{
114            if (_d) throw _e;
115        }
116    }
117    return _arr;
118}
119function _non_iterable_rest() {
120    throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
121}
122function _possible_constructor_return(self, call) {
123    if (call && (_type_of(call) === "object" || typeof call === "function")) {
124        return call;
125    }
126    return _assert_this_initialized(self);
127}
128function _set_prototype_of(o, p) {
129    _set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
130        o.__proto__ = p;
131        return o;
132    };
133    return _set_prototype_of(o, p);
134}
135function _sliced_to_array(arr, i) {
136    return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
137}
138function _type_of(obj) {
139    "@swc/helpers - typeof";
140    return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
141}
142function _unsupported_iterable_to_array(o, minLen) {
143    if (!o) return;
144    if (typeof o === "string") return _array_like_to_array(o, minLen);
145    var n = Object.prototype.toString.call(o).slice(8, -1);
146    if (n === "Object" && o.constructor) n = o.constructor.name;
147    if (n === "Map" || n === "Set") return Array.from(n);
148    if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
149}
150function _is_native_reflect_construct() {
151    if (typeof Reflect === "undefined" || !Reflect.construct) return false;
152    if (Reflect.construct.sham) return false;
153    if (typeof Proxy === "function") return true;
154    try {
155        Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
156        return true;
157    } catch (e) {
158        return false;
159    }
160}
161function _create_super(Derived) {
162    var hasNativeReflectConstruct = _is_native_reflect_construct();
163    return function _createSuperInternal() {
164        var Super = _get_prototype_of(Derived), result;
165        if (hasNativeReflectConstruct) {
166            var NewTarget = _get_prototype_of(this).constructor;
167            result = Reflect.construct(Super, arguments, NewTarget);
168        } else {
169            result = Super.apply(this, arguments);
170        }
171        return _possible_constructor_return(this, result);
172    };
173}
174function _ts_generator(thisArg, body) {
175    var f, y, t, g, _ = {
176        label: 0,
177        sent: function() {
178            if (t[0] & 1) throw t[1];
179            return t[1];
180        },
181        trys: [],
182        ops: []
183    };
184    return g = {
185        next: verb(0),
186        "throw": verb(1),
187        "return": verb(2)
188    }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
189        return this;
190    }), g;
191    function verb(n) {
192        return function(v) {
193            return step([
194                n,
195                v
196            ]);
197        };
198    }
199    function step(op) {
200        if (f) throw new TypeError("Generator is already executing.");
201        while(_)try {
202            if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
203            if (y = 0, t) op = [
204                op[0] & 2,
205                t.value
206            ];
207            switch(op[0]){
208                case 0:
209                case 1:
210                    t = op;
211                    break;
212                case 4:
213                    _.label++;
214                    return {
215                        value: op[1],
216                        done: false
217                    };
218                case 5:
219                    _.label++;
220                    y = op[1];
221                    op = [
222                        0
223                    ];
224                    continue;
225                case 7:
226                    op = _.ops.pop();
227                    _.trys.pop();
228                    continue;
229                default:
230                    if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
231                        _ = 0;
232                        continue;
233                    }
234                    if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
235                        _.label = op[1];
236                        break;
237                    }
238                    if (op[0] === 6 && _.label < t[1]) {
239                        _.label = t[1];
240                        t = op;
241                        break;
242                    }
243                    if (t && _.label < t[2]) {
244                        _.label = t[2];
245                        _.ops.push(op);
246                        break;
247                    }
248                    if (t[2]) _.ops.pop();
249                    _.trys.pop();
250                    continue;
251            }
252            op = body.call(thisArg, _);
253        } catch (e) {
254            op = [
255                6,
256                e
257            ];
258            y = 0;
259        } finally{
260            f = t = 0;
261        }
262        if (op[0] & 5) throw op[1];
263        return {
264            value: op[0] ? op[1] : void 0,
265            done: true
266        };
267    }
268}
269import { Controller } from "@hotwired/stimulus";
270var _class = /*#__PURE__*/ function(Controller) {
271    "use strict";
272    _inherits(_class, Controller);
273    var _super = _create_super(_class);
274    function _class() {
275        _class_call_check(this, _class);
276        var _this;
277        _this = _super.apply(this, arguments);
278        _define_property(_assert_this_initialized(_this), "processes", []);
279        _define_property(_assert_this_initialized(_this), "selectedPids", new Set());
280        _define_property(_assert_this_initialized(_this), "sortField", "pid");
281        _define_property(_assert_this_initialized(_this), "sortDirection", "asc");
282        _define_property(_assert_this_initialized(_this), "refreshTimer", null);
283        _define_property(_assert_this_initialized(_this), "isLoading", false);
284        _define_property(_assert_this_initialized(_this), "lastClickedPid", null);
285        return _this;
286    }
287    _create_class(_class, [
288        {
289            key: "connect",
290            value: function connect() {
291                this.loadProcesses();
292                this.startAutoRefresh();
293                // Close context menu on click outside
294                document.addEventListener("click", this.handleDocumentClick.bind(this));
295                document.addEventListener("keydown", this.handleKeyDown.bind(this));
296            }
297        },
298        {
299            key: "disconnect",
300            value: function disconnect() {
301                this.stopAutoRefresh();
302                document.removeEventListener("click", this.handleDocumentClick.bind(this));
303                document.removeEventListener("keydown", this.handleKeyDown.bind(this));
304            }
305        },
306        {
307            key: "loadProcesses",
308            value: /**
309     * Load processes from the API
310     */ function loadProcesses() {
311                var _this = this;
312                return _async_to_generator(function() {
313                    var response, data, error;
314                    return _ts_generator(this, function(_state) {
315                        switch(_state.label){
316                            case 0:
317                                if (_this.isLoading) return [
318                                    2
319                                ];
320                                _this.isLoading = true;
321                                _state.label = 1;
322                            case 1:
323                                _state.trys.push([
324                                    1,
325                                    4,
326                                    5,
327                                    6
328                                ]);
329                                return [
330                                    4,
331                                    fetch(_this.apiUrlValue, {
332                                        redirect: "manual"
333                                    })
334                                ];
335                            case 2:
336                                response = _state.sent();
337                                // Handle redirect (e.g., to login page)
338                                if (response.type === "opaqueredirect" || response.status === 302 || response.status === 301) {
339                                    window.location.href = _this.apiUrlValue;
340                                    return [
341                                        2
342                                    ];
343                                }
344                                if (!response.ok) {
345                                    throw new Error("HTTP error! status: ".concat(response.status));
346                                }
347                                return [
348                                    4,
349                                    response.json()
350                                ];
351                            case 3:
352                                data = _state.sent();
353                                _this.processes = data.processes;
354                                // Re-sort with current settings
355                                _this.sortProcesses();
356                                _this.renderTable();
357                                _this.updateStatusBar();
358                                return [
359                                    3,
360                                    6
361                                ];
362                            case 4:
363                                error = _state.sent();
364                                _this.showError(error.message);
365                                return [
366                                    3,
367                                    6
368                                ];
369                            case 5:
370                                _this.isLoading = false;
371                                return [
372                                    7
373                                ];
374                            case 6:
375                                return [
376                                    2
377                                ];
378                        }
379                    });
380                })();
381            }
382        },
383        {
384            /**
385     * Manual refresh action
386     */ key: "refresh",
387            value: function refresh() {
388                this.loadProcesses();
389            }
390        },
391        {
392            /**
393     * Toggle auto-refresh
394     */ key: "toggleAutoRefresh",
395            value: function toggleAutoRefresh() {
396                if (this.autoRefreshToggleTarget.checked) {
397                    this.startAutoRefresh();
398                } else {
399                    this.stopAutoRefresh();
400                }
401            }
402        },
403        {
404            key: "startAutoRefresh",
405            value: function startAutoRefresh() {
406                var _this = this;
407                if (this.refreshTimer) return;
408                if (this.refreshIntervalValue <= 0) return;
409                this.refreshTimer = setInterval(function() {
410                    _this.loadProcesses();
411                }, this.refreshIntervalValue);
412            }
413        },
414        {
415            key: "stopAutoRefresh",
416            value: function stopAutoRefresh() {
417                if (this.refreshTimer) {
418                    clearInterval(this.refreshTimer);
419                    this.refreshTimer = null;
420                }
421            }
422        },
423        {
424            /**
425     * Sort by column
426     */ key: "sort",
427            value: function sort(event) {
428                var target = event.currentTarget;
429                var field = target.dataset.field;
430                if (this.sortField === field) {
431                    // Toggle direction
432                    this.sortDirection = this.sortDirection === "asc" ? "desc" : "asc";
433                } else {
434                    this.sortField = field;
435                    this.sortDirection = "asc";
436                }
437                this.updateSortIndicators();
438                this.sortProcesses();
439                this.renderTable();
440            }
441        },
442        {
443            key: "sortProcesses",
444            value: function sortProcesses() {
445                var field = this.sortField;
446                var direction = this.sortDirection;
447                this.processes.sort(function(a, b) {
448                    var aVal = a[field];
449                    var bVal = b[field];
450                    // Handle string comparison
451                    if (typeof aVal === "string" && typeof bVal === "string") {
452                        aVal = aVal.toLowerCase();
453                        bVal = bVal.toLowerCase();
454                    }
455                    var result = 0;
456                    if (aVal < bVal) result = -1;
457                    if (aVal > bVal) result = 1;
458                    return direction === "asc" ? result : -result;
459                });
460            }
461        },
462        {
463            key: "updateSortIndicators",
464            value: function updateSortIndicators() {
465                // Remove sort classes from all headers
466                var headers = [
467                    this.headerPidTarget,
468                    this.headerPpidTarget,
469                    this.headerUserTarget,
470                    this.headerRssTarget,
471                    this.headerVszTarget,
472                    this.headerTtyTarget,
473                    this.headerStartedAtTarget,
474                    this.headerCommandTarget
475                ];
476                headers.forEach(function(header) {
477                    header.classList.remove("sort-asc", "sort-desc");
478                });
479                // Add sort class to current header
480                var currentHeader = this.element.querySelector('[data-field="'.concat(this.sortField, '"]'));
481                if (currentHeader) {
482                    currentHeader.classList.add(this.sortDirection === "asc" ? "sort-asc" : "sort-desc");
483                }
484            }
485        },
486        {
487            key: "renderTable",
488            value: /**
489     * Render the process table
490     */ function renderTable() {
491                var _this = this;
492                if (this.processes.length === 0) {
493                    this.showEmpty();
494                    return;
495                }
496                this.hideEmpty();
497                this.tableBodyTarget.innerHTML = this.processes.map(function(process) {
498                    return _this.renderRow(process);
499                }).join("");
500                // Re-apply selection state
501                this.updateSelectionUI();
502            }
503        },
504        {
505            key: "renderRow",
506            value: function renderRow(process) {
507                var isSelected = this.selectedPids.has(process.pid);
508                return '\n            <tr data-pid="'.concat(process.pid, '" \n                class="').concat(isSelected ? "selected" : "", '"\n                data-action="click->process-monitor#handleRowClick contextmenu->process-monitor#handleRowContextMenu">\n                <td>\n                    <input type="checkbox"\n                           class="size-4 accent-(--accent)"\n                           ').concat(isSelected ? "checked" : "", '\n                           data-action="click->process-monitor#handleCheckboxClick">\n                </td>\n                <td>').concat(process.pid, "</td>\n                <td>").concat(process.ppid, "</td>\n                <td>").concat(this.escapeHtml(process.user), '</td>\n                <td class="text-right">').concat(this.escapeHtml(process.rssFormatted), '</td>\n                <td class="text-right">').concat(this.escapeHtml(process.vszFormatted), "</td>\n                <td>").concat(this.escapeHtml(process.tty), "</td>\n                <td>").concat(this.escapeHtml(process.startedAtFormatted), '</td>\n                <td class="command-cell" title="').concat(this.escapeHtml(process.command), '">').concat(this.escapeHtml(process.command), "</td>\n            </tr>\n        ");
509            }
510        },
511        {
512            /**
513     * Handle row click for selection
514     */ key: "handleRowClick",
515            value: function handleRowClick(event) {
516                var target = event.target;
517                // Don't handle if clicking on checkbox directly
518                if (target.tagName === "INPUT") return;
519                var row = event.currentTarget;
520                var pid = parseInt(row.dataset.pid || "0", 10);
521                if (event.shiftKey && this.lastClickedPid !== null) {
522                    // Range selection
523                    this.selectRange(this.lastClickedPid, pid);
524                } else if (event.ctrlKey || event.metaKey) {
525                    // Toggle selection
526                    this.toggleSelection(pid);
527                } else {
528                    // Single selection (clear others)
529                    this.selectedPids.clear();
530                    this.selectedPids.add(pid);
531                }
532                this.lastClickedPid = pid;
533                this.updateSelectionUI();
534            }
535        },
536        {
537            /**
538     * Handle checkbox click
539     */ key: "handleCheckboxClick",
540            value: function handleCheckboxClick(event) {
541                event.stopPropagation();
542                var checkbox = event.target;
543                var row = checkbox.closest("tr");
544                var pid = parseInt(row.dataset.pid || "0", 10);
545                if (checkbox.checked) {
546                    this.selectedPids.add(pid);
547                } else {
548                    this.selectedPids.delete(pid);
549                }
550                this.lastClickedPid = pid;
551                this.updateSelectionUI();
552            }
553        },
554        {
555            /**
556     * Toggle select all
557     */ key: "toggleSelectAll",
558            value: function toggleSelectAll() {
559                var _this = this;
560                if (this.selectAllTarget.checked) {
561                    this.processes.forEach(function(p) {
562                        return _this.selectedPids.add(p.pid);
563                    });
564                } else {
565                    this.selectedPids.clear();
566                }
567                this.updateSelectionUI();
568            }
569        },
570        {
571            key: "toggleSelection",
572            value: function toggleSelection(pid) {
573                if (this.selectedPids.has(pid)) {
574                    this.selectedPids.delete(pid);
575                } else {
576                    this.selectedPids.add(pid);
577                }
578            }
579        },
580        {
581            key: "selectRange",
582            value: function selectRange(fromPid, toPid) {
583                var pids = this.processes.map(function(p) {
584                    return p.pid;
585                });
586                var fromIndex = pids.indexOf(fromPid);
587                var toIndex = pids.indexOf(toPid);
588                if (fromIndex === -1 || toIndex === -1) return;
589                var start = Math.min(fromIndex, toIndex);
590                var end = Math.max(fromIndex, toIndex);
591                for(var i = start; i <= end; i++){
592                    this.selectedPids.add(pids[i]);
593                }
594            }
595        },
596        {
597            key: "updateSelectionUI",
598            value: function updateSelectionUI() {
599                var _this = this;
600                // Update row selection visual
601                this.tableBodyTarget.querySelectorAll("tr").forEach(function(row) {
602                    var pid = parseInt(row.dataset.pid || "0", 10);
603                    var checkbox = row.querySelector('input[type="checkbox"]');
604                    if (_this.selectedPids.has(pid)) {
605                        row.classList.add("selected");
606                        if (checkbox) checkbox.checked = true;
607                    } else {
608                        row.classList.remove("selected");
609                        if (checkbox) checkbox.checked = false;
610                    }
611                });
612                // Update select all checkbox
613                var allSelected = this.processes.length > 0 && this.processes.every(function(p) {
614                    return _this.selectedPids.has(p.pid);
615                });
616                var someSelected = this.selectedPids.size > 0;
617                this.selectAllTarget.checked = allSelected;
618                this.selectAllTarget.indeterminate = someSelected && !allSelected;
619                // Update selection toolbar visibility
620                if (this.selectedPids.size > 0) {
621                    this.selectionToolbarTarget.classList.remove("hidden");
622                    this.selectionCountTarget.textContent = this.transSelectedValue.replace("%count%", String(this.selectedPids.size));
623                } else {
624                    this.selectionToolbarTarget.classList.add("hidden");
625                }
626            }
627        },
628        {
629            /**
630     * Handle right-click context menu
631     */ key: "handleRowContextMenu",
632            value: function handleRowContextMenu(event) {
633                event.preventDefault();
634                var row = event.currentTarget;
635                var pid = parseInt(row.dataset.pid || "0", 10);
636                // If right-clicking on unselected row, select only that row
637                if (!this.selectedPids.has(pid)) {
638                    this.selectedPids.clear();
639                    this.selectedPids.add(pid);
640                    this.updateSelectionUI();
641                }
642                this.showContextMenu(event.clientX, event.clientY);
643            }
644        },
645        {
646            key: "showContextMenu",
647            value: function showContextMenu(x, y) {
648                if (!this.hasContextMenuTarget) return;
649                var menu = this.contextMenuTarget;
650                menu.style.display = "block";
651                menu.style.left = "".concat(x, "px");
652                menu.style.top = "".concat(y, "px");
653                // Adjust if menu goes off screen
654                var rect = menu.getBoundingClientRect();
655                if (rect.right > window.innerWidth) {
656                    menu.style.left = "".concat(x - rect.width, "px");
657                }
658                if (rect.bottom > window.innerHeight) {
659                    menu.style.top = "".concat(y - rect.height, "px");
660                }
661            }
662        },
663        {
664            key: "hideContextMenu",
665            value: function hideContextMenu() {
666                if (this.hasContextMenuTarget) {
667                    this.contextMenuTarget.style.display = "none";
668                }
669            }
670        },
671        {
672            /**
673     * Handle context menu action
674     */ key: "contextMenuAction",
675            value: function contextMenuAction(event) {
676                event.preventDefault();
677                this.hideContextMenu();
678                var target = event.currentTarget;
679                var signal = target.dataset.signal;
680                this.killSelectedProcesses(signal);
681            }
682        },
683        {
684            /**
685     * Kill selected processes from toolbar
686     */ key: "killSelected",
687            value: function killSelected(event) {
688                event.preventDefault();
689                var target = event.currentTarget;
690                var signal = target.dataset.signal;
691                this.killSelectedProcesses(signal);
692            }
693        },
694        {
695            key: "killSelectedProcesses",
696            value: function killSelectedProcesses(signal) {
697                var _this = this;
698                return _async_to_generator(function() {
699                    var signalName, confirmMessage, pids, response, result, failedPids, error;
700                    return _ts_generator(this, function(_state) {
701                        switch(_state.label){
702                            case 0:
703                                if (_this.selectedPids.size === 0) return [
704                                    2
705                                ];
706                                signalName = signal.toUpperCase();
707                                confirmMessage = _this.transKillConfirmValue.replace("%signal%", "SIG".concat(signalName));
708                                if (!confirm(confirmMessage)) return [
709                                    2
710                                ];
711                                pids = Array.from(_this.selectedPids);
712                                _state.label = 1;
713                            case 1:
714                                _state.trys.push([
715                                    1,
716                                    4,
717                                    ,
718                                    5
719                                ]);
720                                return [
721                                    4,
722                                    fetch(_this.killUrlValue, {
723                                        method: "POST",
724                                        headers: {
725                                            "Content-Type": "application/json"
726                                        },
727                                        redirect: "manual",
728                                        body: JSON.stringify({
729                                            pids: pids,
730                                            signal: signal
731                                        })
732                                    })
733                                ];
734                            case 2:
735                                response = _state.sent();
736                                // Handle redirect (e.g., to login page)
737                                if (response.type === "opaqueredirect" || response.status === 302 || response.status === 301) {
738                                    window.location.href = _this.killUrlValue;
739                                    return [
740                                        2
741                                    ];
742                                }
743                                if (!response.ok) {
744                                    throw new Error("HTTP error! status: ".concat(response.status));
745                                }
746                                return [
747                                    4,
748                                    response.json()
749                                ];
750                            case 3:
751                                result = _state.sent();
752                                // Update process list from response
753                                _this.processes = result.processes;
754                                _this.sortProcesses();
755                                _this.renderTable();
756                                _this.updateStatusBar();
757                                // Clear selection
758                                _this.selectedPids.clear();
759                                _this.updateSelectionUI();
760                                if (!result.success) {
761                                    // Show error for failed kills
762                                    failedPids = Object.entries(result.results).filter(function(param) {
763                                        var _param = _sliced_to_array(param, 2), r = _param[1];
764                                        return !r.success;
765                                    }).map(function(param) {
766                                        var _param = _sliced_to_array(param, 1), pid = _param[0];
767                                        return pid;
768                                    });
769                                    if (failedPids.length > 0) {
770                                        alert("".concat(_this.transKillErrorValue, ": PIDs ").concat(failedPids.join(", ")));
771                                    }
772                                }
773                                return [
774                                    3,
775                                    5
776                                ];
777                            case 4:
778                                error = _state.sent();
779                                alert("".concat(_this.transKillErrorValue, ": ").concat(error.message));
780                                return [
781                                    3,
782                                    5
783                                ];
784                            case 5:
785                                return [
786                                    2
787                                ];
788                        }
789                    });
790                })();
791            }
792        },
793        {
794            key: "handleDocumentClick",
795            value: /**
796     * Handle document click to close context menu
797     */ function handleDocumentClick(event) {
798                if (this.hasContextMenuTarget && !this.contextMenuTarget.contains(event.target)) {
799                    this.hideContextMenu();
800                }
801            }
802        },
803        {
804            key: "handleKeyDown",
805            value: /**
806     * Handle keyboard shortcuts
807     */ function handleKeyDown(event) {
808                var _this = this;
809                // Escape closes context menu
810                if (event.key === "Escape") {
811                    this.hideContextMenu();
812                }
813                // Ctrl+A selects all (when focus is in this component)
814                if ((event.ctrlKey || event.metaKey) && event.key === "a") {
815                    if (this.element.contains(document.activeElement)) {
816                        event.preventDefault();
817                        this.selectedPids.clear();
818                        this.processes.forEach(function(p) {
819                            return _this.selectedPids.add(p.pid);
820                        });
821                        this.updateSelectionUI();
822                    }
823                }
824                // Delete key sends SIGTERM
825                if (event.key === "Delete" && this.selectedPids.size > 0) {
826                    if (this.element.contains(document.activeElement)) {
827                        this.killSelectedProcesses("term");
828                    }
829                }
830            }
831        },
832        {
833            key: "updateStatusBar",
834            value: /**
835     * Update status bar
836     */ function updateStatusBar() {
837                this.processCountTarget.textContent = "".concat(this.processes.length, " processes");
838                this.lastUpdateTarget.textContent = "Last update: ".concat(new Date().toLocaleTimeString());
839            }
840        },
841        {
842            key: "showError",
843            value: /**
844     * Show/hide UI states
845     */ function showError(message) {
846                this.errorTarget.textContent = this.transErrorValue.replace("%message%", message);
847                this.errorTarget.classList.remove("hidden");
848            }
849        },
850        {
851            key: "showEmpty",
852            value: function showEmpty() {
853                this.emptyTarget.classList.remove("hidden");
854                this.tableContainerTarget.style.display = "none";
855            }
856        },
857        {
858            key: "hideEmpty",
859            value: function hideEmpty() {
860                this.emptyTarget.classList.add("hidden");
861                this.tableContainerTarget.style.display = "";
862            }
863        },
864        {
865            key: "escapeHtml",
866            value: /**
867     * Escape HTML special characters
868     */ function escapeHtml(text) {
869                var div = document.createElement("div");
870                div.textContent = text;
871                return div.innerHTML;
872            }
873        }
874    ]);
875    return _class;
876}(Controller);
877_define_property(_class, "targets", [
878    "toolbar",
879    "error",
880    "empty",
881    "tableContainer",
882    "tableBody",
883    "contextMenu",
884    "selectAll",
885    "selectionToolbar",
886    "selectionCount",
887    "processCount",
888    "lastUpdate",
889    "autoRefreshToggle",
890    "headerPid",
891    "headerPpid",
892    "headerUser",
893    "headerRss",
894    "headerVsz",
895    "headerTty",
896    "headerStartedAt",
897    "headerCommand"
898]);
899_define_property(_class, "values", {
900    apiUrl: String,
901    killUrl: String,
902    refreshInterval: {
903        type: Number,
904        default: 3000
905    },
906    transError: {
907        type: String,
908        default: "Error: %message%"
909    },
910    transLoading: {
911        type: String,
912        default: "Loading processes..."
913    },
914    transNoProcesses: {
915        type: String,
916        default: "No processes found"
917    },
918    transKillConfirm: {
919        type: String,
920        default: "Are you sure you want to send %signal% to the selected process(es)?"
921    },
922    transKillSuccess: {
923        type: String,
924        default: "Signal sent successfully"
925    },
926    transKillError: {
927        type: String,
928        default: "Failed to send signal"
929    },
930    transSelected: {
931        type: String,
932        default: "%count% selected"
933    }
934});
935/**
936 * ProcessMonitor Controller
937 * 
938 * Real-time process monitor with sorting, selection, and kill functionality.
939 * 
940 * Controller identifier: process-monitor
941 */ export { _class as default };

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.