PageSourceSearch

https://cdn.infourok.ru/assets/ai/controllers/components/token-ledger/token-ledger_controller-P1ZWedW.js

js infourok.ru collected 2026-10-01 10:21:59 UTC 8,281 bytes, 222 lines download raw bytes

1/// <reference path="../../../../../../../../global.d.ts" />
2/// <reference path="../../../../../../../../iu.d.ts" />
3function _array_like_to_array(arr, len) {
4    if (len == null || len > arr.length) len = arr.length;
5    for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
6    return arr2;
7}
8function _array_without_holes(arr) {
9    if (Array.isArray(arr)) return _array_like_to_array(arr);
10}
11function _assert_this_initialized(self) {
12    if (self === void 0) {
13        throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
14    }
15    return self;
16}
17function _class_call_check(instance, Constructor) {
18    if (!(instance instanceof Constructor)) {
19        throw new TypeError("Cannot call a class as a function");
20    }
21}
22function _defineProperties(target, props) {
23    for(var i = 0; i < props.length; i++){
24        var descriptor = props[i];
25        descriptor.enumerable = descriptor.enumerable || false;
26        descriptor.configurable = true;
27        if ("value" in descriptor) descriptor.writable = true;
28        Object.defineProperty(target, descriptor.key, descriptor);
29    }
30}
31function _create_class(Constructor, protoProps, staticProps) {
32    if (protoProps) _defineProperties(Constructor.prototype, protoProps);
33    if (staticProps) _defineProperties(Constructor, staticProps);
34    return Constructor;
35}
36function _define_property(obj, key, value) {
37    if (key in obj) {
38        Object.defineProperty(obj, key, {
39            value: value,
40            enumerable: true,
41            configurable: true,
42            writable: true
43        });
44    } else {
45        obj[key] = value;
46    }
47    return obj;
48}
49function _get_prototype_of(o) {
50    _get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
51        return o.__proto__ || Object.getPrototypeOf(o);
52    };
53    return _get_prototype_of(o);
54}
55function _inherits(subClass, superClass) {
56    if (typeof superClass !== "function" && superClass !== null) {
57        throw new TypeError("Super expression must either be null or a function");
58    }
59    subClass.prototype = Object.create(superClass && superClass.prototype, {
60        constructor: {
61            value: subClass,
62            writable: true,
63            configurable: true
64        }
65    });
66    if (superClass) _set_prototype_of(subClass, superClass);
67}
68function _iterable_to_array(iter) {
69    if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
70}
71function _non_iterable_spread() {
72    throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
73}
74function _possible_constructor_return(self, call) {
75    if (call && (_type_of(call) === "object" || typeof call === "function")) {
76        return call;
77    }
78    return _assert_this_initialized(self);
79}
80function _set_prototype_of(o, p) {
81    _set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
82        o.__proto__ = p;
83        return o;
84    };
85    return _set_prototype_of(o, p);
86}
87function _to_consumable_array(arr) {
88    return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
89}
90function _type_of(obj) {
91    "@swc/helpers - typeof";
92    return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
93}
94function _unsupported_iterable_to_array(o, minLen) {
95    if (!o) return;
96    if (typeof o === "string") return _array_like_to_array(o, minLen);
97    var n = Object.prototype.toString.call(o).slice(8, -1);
98    if (n === "Object" && o.constructor) n = o.constructor.name;
99    if (n === "Map" || n === "Set") return Array.from(n);
100    if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
101}
102function _is_native_reflect_construct() {
103    if (typeof Reflect === "undefined" || !Reflect.construct) return false;
104    if (Reflect.construct.sham) return false;
105    if (typeof Proxy === "function") return true;
106    try {
107        Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
108        return true;
109    } catch (e) {
110        return false;
111    }
112}
113function _create_super(Derived) {
114    var hasNativeReflectConstruct = _is_native_reflect_construct();
115    return function _createSuperInternal() {
116        var Super = _get_prototype_of(Derived), result;
117        if (hasNativeReflectConstruct) {
118            var NewTarget = _get_prototype_of(this).constructor;
119            result = Reflect.construct(Super, arguments, NewTarget);
120        } else {
121            result = Super.apply(this, arguments);
122        }
123        return _possible_constructor_return(this, result);
124    };
125}
126import { Controller } from "@hotwired/stimulus";
127var _class = /*#__PURE__*/ function(Controller) {
128    "use strict";
129    _inherits(_class, Controller);
130    var _super = _create_super(_class);
131    function _class() {
132        _class_call_check(this, _class);
133        var _this;
134        _this = _super.apply(this, arguments);
135        _define_property(_assert_this_initialized(_this), "nextPage", 2);
136        return _this;
137    }
138    _create_class(_class, [
139        {
140            key: "closeModal",
141            value: function closeModal() {
142                iu.dlg.hide();
143            }
144        },
145        {
146            key: "switchTab",
147            value: function switchTab(event) {
148                var _this = this;
149                var type = event.params.type;
150                if (!type || type === this.typeValue) {
151                    return;
152                }
153                this.typeValue = type;
154                this.nextPage = 2;
155                this.tabTargets.forEach(function(tab) {
156                    tab.classList.toggle("token-ledger-modal__tab--active", tab === event.currentTarget);
157                });
158                this.listTarget.classList.add("token-ledger-modal__list--loading");
159                iu.ajax(null, this.pageUrlValue, {
160                    type: type,
161                    page: 1
162                }, function(data) {
163                    if (_this.typeValue !== type) {
164                        return;
165                    }
166                    _this.listTarget.classList.remove("token-ledger-modal__list--loading");
167                    if (data.html === undefined) {
168                        return;
169                    }
170                    _this.listTarget.innerHTML = data.html;
171                }, {
172                    isShowLoading: false
173                });
174            }
175        },
176        {
177            key: "loadMore",
178            value: function loadMore(event) {
179                var _this = this;
180                event === null || event === void 0 ? void 0 : event.stopPropagation();
181                if (!this.hasLoadMoreTarget || this.loadMoreTarget.dataset.loading === "true") {
182                    return;
183                }
184                var loadMore = this.loadMoreTarget;
185                loadMore.dataset.loading = "true";
186                iu.ajax(null, this.pageUrlValue, {
187                    type: this.typeValue,
188                    page: this.nextPage
189                }, function(data) {
190                    if (data.html === undefined) {
191                        loadMore.dataset.loading = "false";
192                        return;
193                    }
194                    _this.nextPage += 1;
195                    _this.replaceLoadMore(loadMore, data.html);
196                }, {
197                    isShowLoading: false
198                });
199            }
200        },
201        {
202            key: "replaceLoadMore",
203            value: function replaceLoadMore(loadMore, html) {
204                var _loadMore;
205                var tempDiv = document.createElement("div");
206                tempDiv.innerHTML = html;
207                (_loadMore = loadMore).replaceWith.apply(_loadMore, _to_consumable_array(Array.from(tempDiv.childNodes)));
208            }
209        }
210    ]);
211    return _class;
212}(Controller);
213_define_property(_class, "targets", [
214    "list",
215    "loadMore",
216    "tab"
217]);
218_define_property(_class, "values", {
219    pageUrl: String,
220    type: String
221});
222/* stimulusFetch: 'lazy' */ 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.