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_without_holes(arr) { 7 if (Array.isArray(arr)) return _array_like_to_array(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(iter) { 96 if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); 97} 98function _non_iterable_spread() { 99 throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); 100} 101function _possible_constructor_return(self, call) { 102 if (call && (_type_of(call) === "object" || typeof call === "function")) { 103 return call; 104 } 105 return _assert_this_initialized(self); 106} 107function _set_prototype_of(o, p) { 108 _set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) { 109 o.__proto__ = p; 110 return o; 111 }; 112 return _set_prototype_of(o, p); 113} 114function _to_consumable_array(arr) { 115 return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread(); 116} 117function _type_of(obj) { 118 "@swc/helpers - typeof"; 119 return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj; 120} 121function _unsupported_iterable_to_array(o, minLen) { 122 if (!o) return; 123 if (typeof o === "string") return _array_like_to_array(o, minLen); 124 var n = Object.prototype.toString.call(o).slice(8, -1); 125 if (n === "Object" && o.constructor) n = o.constructor.name; 126 if (n === "Map" || n === "Set") return Array.from(n); 127 if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen); 128} 129function _is_native_reflect_construct() { 130 if (typeof Reflect === "undefined" || !Reflect.construct) return false;
131 if (Reflect.construct.sham) return false; 132 if (typeof Proxy === "function") return true; 133 try { 134 Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {})); 135 return true; 136 } catch (e) { 137 return false; 138 } 139} 140function _create_super(Derived) { 141 var hasNativeReflectConstruct = _is_native_reflect_construct(); 142 return function _createSuperInternal() { 143 var Super = _get_prototype_of(Derived), result; 144 if (hasNativeReflectConstruct) { 145 var NewTarget = _get_prototype_of(this).constructor; 146 result = Reflect.construct(Super, arguments, NewTarget); 147 } else { 148 result = Super.apply(this, arguments); 149 } 150 return _possible_constructor_return(this, result); 151 }; 152} 153function _ts_generator(thisArg, body) { 154 var f, y, t, g, _ = { 155 label: 0, 156 sent: function() { 157 if (t[0] & 1) throw t[1]; 158 return t[1]; 159 }, 160 trys: [], 161 ops: [] 162 }; 163 return g = { 164 next: verb(0), 165 "throw": verb(1), 166 "return": verb(2) 167 }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { 168 return this; 169 }), g; 170 function verb(n) { 171 return function(v) { 172 return step([ 173 n, 174 v 175 ]); 176 }; 177 } 178 function step(op) { 179 if (f) throw new TypeError("Generator is already executing."); 180 while(_)try { 181 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; 182 if (y = 0, t) op = [ 183 op[0] & 2, 184 t.value 185 ]; 186 switch(op[0]){ 187 case 0: 188 case 1: 189 t = op; 190 break; 191 case 4: 192 _.label++; 193 return { 194 value: op[1], 195 done: false 196 }; 197 case 5: 198 _.label++; 199 y = op[1]; 200 op = [ 201 0 202 ]; 203 continue; 204 case 7: 205 op = _.ops.pop(); 206 _.trys.pop(); 207 continue; 208 default: 209 if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { 210 _ = 0; 211 continue; 212 } 213 if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) { 214 _.label = op[1]; 215 break; 216 } 217 if (op[0] === 6 && _.label < t[1]) { 218 _.label = t[1]; 219 t = op; 220 break; 221 } 222 if (t && _.label < t[2]) { 223 _.label = t[2]; 224 _.ops.push(op); 225 break; 226 } 227 if (t[2]) _.ops.pop(); 228 _.trys.pop(); 229 continue; 230 } 231 op = body.call(thisArg, _); 232 } catch (e) { 233 op = [ 234 6, 235 e 236 ]; 237 y = 0; 238 } finally{ 239 f = t = 0; 240 } 241 if (op[0] & 5) throw op[1]; 242 return { 243 value: op[0] ? op[1] : void 0, 244 done: true 245 }; 246 } 247} 248import { Controller } from "@hotwired/stimulus"; 249import { createSvgIcon, fetchSvg } from "../../lib/file-manager/utils/svg-loader.js"; 250var IconsController = /*#__PURE__*/ function(Controller) { 251 "use strict"; 252 _inherits(IconsController, Controller); 253 var _super = _create_super(IconsController); 254 function IconsController() { 255 _class_call_check(this, IconsController); 256 var _this; 257 _this = _super.apply(this, arguments); 258 /** 259 * Icon name to value property mapping 260 */ _define_property(_assert_this_initialized(_this), "iconMap", { 261 "arrow-up": function() { 262 return _this.arrowUpValue; 263 }, 264 "refresh": function() { 265 return _this.refreshValue; 266 }, 267 "folder-plus": function() { 268 return _this.folderPlusValue; 269 }, 270 "upload": function() { 271 return _this.uploadValue; 272 }, 273 "copy": function() { 274 return _this.copyValue; 275 }, 276 "cut": function() { 277 return _this.cutValue; 278 }, 279 "clipboard-copy": function() { 280 return _this.clipboardCopyValue; 281 }, 282 "pencil": function() { 283 return _this.pencilValue; 284 }, 285 "trash": function() { 286 return _this.trashValue; 287 }, 288 "list": function() { 289 return _this.listValue; 290 }, 291 "layout-grid": function() { 292 return _this.layoutGridValue; 293 },
294 "columns-3": function() { 295 return _this.columns3Value; 296 }, 297 "arrows-sort": function() { 298 return _this.arrowsSortValue; 299 }, 300 "chevron-down": function() { 301 return _this.chevronDownValue; 302 }, 303 "chevron-right": function() { 304 return _this.chevronRightValue; 305 }, 306 "folder-filled": function() { 307 return _this.folderFilledValue; 308 }, 309 "folder": function() { 310 return _this.folderValue; 311 }, 312 "folder-public": function() { 313 return _this.folderPublicValue; 314 }, 315 "home": function() { 316 return _this.homeValue; 317 }, 318 "photo": function() { 319 return _this.photoValue; 320 }, 321 "code": function() { 322 return _this.codeValue; 323 }, 324 "file": function() { 325 return _this.fileValue; 326 }, 327 "x": function() { 328 return _this.xValue; 329 }, 330 "check": function() { 331 return _this.checkValue; 332 }, 333 "player-play": function() { 334 return _this.playerPlayValue; 335 }, 336 "download": function() { 337 return _this.downloadValue; 338 }, 339 "select-all": function() { 340 return _this.selectAllValue; 341 }, 342 "loader": function() { 343 return _this.loaderValue; 344 } 345 }); 346 return _this; 347 } 348 _create_class(IconsController, [ 349 { 350 /** 351 * Get the URL for an icon by name 352 */ key: "getIcon", 353 value: function getIcon(name) { 354 var getter = this.iconMap[name]; 355 if (!getter) { 356 console.warn("Unknown icon: ".concat(name)); 357 return ""; 358 } 359 return getter(); 360 } 361 }, 362 { 363 /** 364 * Create an SVG icon element asynchronously. 365 * Returns a placeholder that will be populated with the SVG once loaded. 366 */ key: "createIconElement", 367 value: function createIconElement(name, className) { 368 var url = this.getIcon(name); 369 return createSvgIcon(url, className); 370 } 371 }, 372 { 373 key: "fetchIconElement", 374 value: /** 375 * Fetch an SVG icon asynchronously. 376 * Returns a promise that resolves to the SVG element. 377 */ function fetchIconElement(name, className) { 378 var _this = this; 379 return _async_to_generator(function() { 380 var url, svg, _svg_classList; 381 return _ts_generator(this, function(_state) { 382 switch(_state.label){ 383 case 0: 384 url = _this.getIcon(name); 385 return [ 386 4, 387 fetchSvg(url) 388 ]; 389 case 1: 390 svg = _state.sent(); 391 if (svg && className) { 392 ; 393 (_svg_classList = svg.classList).add.apply(_svg_classList, _to_consumable_array(className.split(" ").filter(Boolean))); 394 } 395 return [ 396 2, 397 svg 398 ]; 399 } 400 }); 401 })(); 402 } 403 } 404 ], [ 405 { 406 key: "getIconUrl", 407 value: /** 408 * Static helper to get icon URL from any element within the FileManager 409 * Traverses up the DOM to find the icons controller 410 */ function getIconUrl(element, name) { 411 var fileManager = element.closest(".file-manager"); 412 if (!fileManager) { 413 console.warn("Could not find .file-manager ancestor"); 414 return ""; 415 } 416 var iconsElement = fileManager.querySelector('[data-controller~="file-manager--icons"]'); 417 if (!iconsElement) { 418 console.warn("Could not find file-manager--icons controller"); 419 return ""; 420 } 421 // Get the controller instance from the application 422 var application = window.Stimulus; 423 if (!application) { 424 console.warn("Stimulus application not found"); 425 return ""; 426 } 427 var controller = application.getControllerForElementAndIdentifier(iconsElement, "file-manager--icons"); 428 if (!controller) { 429 console.warn("file-manager--icons controller instance not found"); 430 return ""; 431 } 432 return controller.getIcon(name); 433 } 434 }, 435 { 436 key: "createIcon", 437 value: /** 438 * Static helper to create an SVG icon element. 439 * Returns a placeholder that will be populated with the SVG once loaded. 440 */ function createIcon(element, name, className) { 441 var fileManager = element.closest(".file-manager"); 442 if (!fileManager) { 443 console.warn("Could not find .file-manager ancestor"); 444 return null; 445 } 446 var iconsElement = fileManager.querySelector('[data-controller~="file-manager--icons"]'); 447 if (!iconsElement) { 448 console.warn("Could not find file-manager--icons controller"); 449 return null; 450 } 451 var application = window.Stimulus; 452 if (!application) { 453 console.warn("Stimulus application not found"); 454 return null; 455 } 456 var controller = application.getControllerForElementAndIdentifier(iconsElement, "file-manager--icons"); 457 if (!controller) { 458 console.warn("file-manager--icons controller instance not found"); 459 return null; 460 } 461 return controller.createIconElement(name, className); 462 } 463 }, 464 { 465 key: "fetchIcon", 466 value: /** 467 * Static helper to fetch an SVG icon asynchronously. 468 */ function fetchIcon(element, name, className) { 469 var _this = this; 470 return _async_to_generator(function() { 471 var url, svg, _svg_classList; 472 return _ts_generator(this, function(_state) { 473 switch(_state.label){ 474 case 0: 475 url = _this.getIconUrl(element, name); 476 if (!url) { 477 return [ 478 2, 479 null 480 ]; 481 } 482 return [ 483 4, 484 fetchSvg(url) 485 ]; 486 case 1: 487 svg = _state.sent(); 488 if (svg && className) { 489 ; 490 (_svg_classList = svg.classList).add.apply(_svg_classList, _to_consumable_array(className.split(" ").filter(
490Boolean))); 491 } 492 return [ 493 2, 494 svg 495 ]; 496 } 497 }); 498 })(); 499 } 500 } 501 ]); 502 return IconsController; 503}(Controller); 504_define_property(IconsController, "values", { 505 arrowUp: String, 506 refresh: String, 507 folderPlus: String, 508 upload: String, 509 copy: String, 510 cut: String, 511 clipboardCopy: String, 512 pencil: String, 513 trash: String, 514 list: String, 515 layoutGrid: String, 516 columns3: String, 517 arrowsSort: String, 518 chevronDown: String, 519 chevronRight: String, 520 folderFilled: String, 521 folder: String, 522 folderPublic: String, 523 home: String, 524 photo: String, 525 code: String, 526 file: String, 527 x: String, 528 check: String, 529 playerPlay: String, 530 download: String, 531 selectAll: String, 532 loader: String 533}); 534/** 535 * FileManager Icons Controller 536 * 537 * Provides icon URLs to other FileManager controllers. 538 * Acts as a single source of truth for all icon URLs. 539 * 540 * Controller identifier: file-manager--icons 541 * 542 * Usage in other controllers: 543 * const iconsController = this.application.getControllerForElementAndIdentifier( 544 * document.querySelector('[data-controller~="file-manager--icons"]'), 545 * 'file-manager--icons' 546 * ) as IconsController; 547 * const url = iconsController.getIcon('folder-filled'); 548 * 549 * Or use the static helper: 550 * IconsController.getIconUrl(this.element, 'folder-filled') 551 */ export { IconsController 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.