personal-website/res/dev-fs/wde/dist/desktop.js

149 lines
92 KiB
JavaScript

/*
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
* This devtool is neither made for production nor for readable output files.
* It uses "eval()" calls to create a separate source file in the browser devtools.
* If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
* or disable the default devtool with "devtool: false".
* If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
*/
/******/ (() => { // webpackBootstrap
/******/ "use strict";
/******/ var __webpack_modules__ = ({
/***/ "http://localhost:8080/res/dev-fs/dist/finder.js":
false,
/***/ "./src/desktop.js":
/*!************************!*\
!*** ./src/desktop.js ***!
\************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _wde_wde_desktop_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./wde/wde-desktop.js */ \"./src/wde/wde-desktop.js\");\n\ndocument.addEventListener('DOMContentLoaded', function () {\n var wde = new _wde_wde_desktop_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]();\n}, false);\n\n//# sourceURL=webpack://my-webpack-project/./src/desktop.js?");
/***/ }),
/***/ "./src/wde/application.js":
/*!********************************!*\
!*** ./src/wde/application.js ***!
\********************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ WDEApplication)\n/* harmony export */ });\n/* harmony import */ var _wde_desktop_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./wde-desktop.js */ \"./src/wde/wde-desktop.js\");\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }\nfunction _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError(\"Cannot initialize the same private elements twice on an object\"); } }\nfunction _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, \"get\"); return _classApplyDescriptorGet(receiver, descriptor); }\nfunction _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }\nfunction _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, \"set\"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }\nfunction _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError(\"attempted to \" + action + \" private field on non-instance\"); } return privateMap.get(receiver); }\nfunction _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError(\"attempted to set read only private field\"); } descriptor.value = value; } }\n\nvar _wde = /*#__PURE__*/new WeakMap();\nvar WDEApplication = /*#__PURE__*/function () {\n /** @type {WebDesktopEnvironment} */\n\n /**\r\n * @constructor\r\n * @param {WebDesktopEnvironment} wde \r\n */\n function WDEApplication(wde) {\n _classCallCheck(this, WDEApplication);\n _classPrivateFieldInitSpec(this, _wde, {\n writable: true,\n value: void 0\n });\n _classPrivateFieldSet(this, _wde, wde);\n }\n _createClass(WDEApplication, [{\n key: \"getWde\",\n value: function getWde() {\n return _classPrivateFieldGet(this, _wde);\n }\n }]);\n return WDEApplication;\n}();\n\n\n//# sourceURL=webpack://my-webpack-project/./src/wde/application.js?");
/***/ }),
/***/ "./src/wde/decorat/desktop-decorat.js":
/*!********************************************!*\
!*** ./src/wde/decorat/desktop-decorat.js ***!
\********************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ DesktopDecorat)\n/* harmony export */ });\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }\nfunction _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }\nfunction _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError(\"Cannot initialize the same private elements twice on an object\"); } }\nfunction _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError(\"attempted to get private field on non-instance\"); } return fn; }\nfunction _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, \"get\"); return _classApplyDescriptorGet(receiver, descriptor); }\nfunction _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }\nfunction _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, \"set\"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }\nfunction _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError(\"attempted to \" + action + \" private field on non-instance\"); } return privateMap.get(receiver); }\nfunction _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError(\"attempted to set read only private field\"); } descriptor.value = value; } }\nvar _windowsLayer = /*#__PURE__*/new WeakMap();\nvar _makeid = /*#__PURE__*/new WeakSet();\nvar DesktopDecorat = /*#__PURE__*/function () {\n /** @type {Element} */\n\n function DesktopDecorat() {\n var _this = this;\n _classCallCheck(this, DesktopDecorat);\n _classPrivateMethodInitSpec(this, _makeid);\n _classPrivateFieldInitSpec(this, _windowsLayer, {\n writable: true,\n value: void 0\n });\n this.windowLayer = document.body.querySelector('#windows-layer');\n // this.#windowsLayer = document.body.querySelector('#windows-layer')\n _classPrivateFieldSet(this, _windowsLayer, document.body.querySelector('#windows-layer'));\n var startDrag = function startDrag(event) {\n var window = event.target.closest('.WindowFrame');\n _this.bringWindowToFront(window);\n if (event.target.classList.contains(\"DragArea\")) {\n var xPosInit = event.offsetX;\n var yPosInit = event.offsetY;\n var dragWindow = function dragWindow(event) {\n window.style.left = \"\".concat(event.clientX - xPosInit, \"px\");\n window.style.top = \"\".concat(event.clientY - yPosInit, \"px\");\n };\n var stopDrag = function stopDrag() {\n removeEventListener('mousemove', dragWindow);\n removeEventListener('mouseup', stopDrag);\n };\n addEventListener('mousemove', dragWindow);\n addEventListener('mouseup', stopDrag);\n }\n };\n _classPrivateFieldGet(this, _windowsLayer).addEventListener('mousedown', startDrag);\n }\n\n /**\r\n * @param {HTMLElement} window\r\n */\n _createClass(DesktopDecorat, [{\n key: \"bringWindowToFront\",\n value: function bringWindowToFront(window) {\n //FIXME\n var previousWindow = _classPrivateFieldGet(this, _windowsLayer).lastChild;\n if (window == null || window == undefined) {\n return;\n }\n if (window != previousWindow) {\n _classPrivateFieldGet(this, _windowsLayer).insertBefore(window, previousWindow.nextSibling);\n previousWindow.classList.remove(\"Focused\");\n window.classList.add(\"Focused\");\n } else {\n window.classList.add(\"Focused\");\n }\n return;\n }\n\n /**\r\n * @param {string} appId\r\n * @param {number} width\r\n * @param {number} height\r\n * @returns {HTMLElement}\r\n */\n }, {\n key: \"CreateNewWindow\",\n value: function CreateNewWindow(appId, width, height) {\n var newWindow = document.createElement(\"div\");\n newWindow.setAttribute('appid', appId);\n newWindow.setAttribute(\"class\", \"WindowFrame ConvexElement\");\n newWindow.setAttribute(\"windowId\", _classPrivateMethodGet(this, _makeid, _makeid2).call(this, 4)); //TODO:\n\n newWindow.style.width = width.toString() + \"px\";\n newWindow.style.height = height.toString() + \"px\";\n document.body.querySelector('#windows-layer').appendChild(newWindow);\n return newWindow;\n }\n\n /**\r\n * @param {HTMLElement} window\r\n */\n }, {\n key: \"CloseWindow\",\n value: function CloseWindow(window) {\n window.remove();\n }\n }, {\n key: \"CloseFocusedWindow\",\n value: function CloseFocusedWindow() {\n if (document.body.querySelector('#windows-layer').childElementCount > 1) {\n document.body.querySelector('#windows-layer').lastElementChild.remove();\n }\n }\n }], [{\n key: \"ChangeURL\",\n value: function ChangeURL(appWindow) {\n var appId = appWindow.getAttribute('appid');\n window.history.replaceState(null, \"\", \"/\".concat(appId, \"/\"));\n }\n\n /**\r\n * @param {num} length\r\n */\n }]);\n return DesktopDecorat;\n}();\nfunction _makeid2(length) {\n var result = '';\n var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';\n var charactersLength = characters.length;\n var counter = 0;\n while (counter < length) {\n result += characters.charAt(Math.floor(Math.random() * charactersLength));\n counter += 1;\n }\n return result;\n}\n\n\n//# sourceURL=webpack://my-webpack-project/./src/wde/decorat/desktop-decorat.js?");
/***/ }),
/***/ "./src/wde/scrollbar/scrollbar.js":
/*!****************************************!*\
!*** ./src/wde/scrollbar/scrollbar.js ***!
\****************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ WdeScrollBar)\n/* harmony export */ });\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nvar WdeScrollBar = /*#__PURE__*/_createClass(\n/**\r\n* @param {HTMLElement} scrollBarContainer\r\n* @param {HTMLElement} content\r\n*/\nfunction WdeScrollBar(scrollBarContainer, content) {\n var _this = this;\n _classCallCheck(this, WdeScrollBar);\n var nonNativeScroll = false;\n // console.log(scrollBarContainer, content)\n // let handler = scrollBarContainer.children[0]\n //TODO On scroll move focus on window?\n var handler = scrollBarContainer.querySelector(\".ScrollBarScrollElement\"); //TODO Refactor classes\n // console.log(handler)\n\n handler.style.height = content.clientHeight / content.scrollHeight * handler.parentElement.clientHeight + 'px';\n var max = handler.parentElement.clientHeight - handler.clientHeight;\n var yPosInit = 0;\n handler.addEventListener('mousedown', function (event) {\n nonNativeScroll = true;\n yPosInit = event.clientY - Number(handler.style.top.replace('px', ''));\n document.addEventListener('mousemove', drag);\n document.addEventListener('mouseup', stop);\n });\n content.addEventListener('scroll', function (event) {\n if (!_this.nonNativeScroll) {\n var handlerPathLength = handler.parentElement.clientHeight - handler.clientHeight; //TODO recalculate only on resize event\n var coefficient = (content.scrollHeight - content.clientHeight) / handlerPathLength;\n handler.style.top = content.scrollTop / coefficient + 'px';\n }\n });\n function drag() {\n // console.log(event.clientY - yPosInit, Number(handler.style.top.replace('px','' )))\n var pos = event.clientY - yPosInit;\n var clampPos = Math.min(Math.max(pos, 0), max);\n handler.style.top = clampPos + \"px\";\n var handlerPathLength = handler.parentElement.clientHeight - handler.clientHeight; //TODO recalculate only on resize event\n var coefficient = (content.scrollHeight - content.clientHeight) / handlerPathLength;\n // console.log(clampPos, coefficient, content.clientHeight, clampPos* coefficient)\n\n content.scrollTop = clampPos * coefficient;\n }\n function stop() {\n // console.log(\"stop\")\n document.removeEventListener('mousemove', drag);\n document.removeEventListener('mouseup', stop);\n nonNativeScroll = false;\n }\n});\n\n\n//# sourceURL=webpack://my-webpack-project/./src/wde/scrollbar/scrollbar.js?");
/***/ }),
/***/ "./src/wde/wde-desktop.js":
/*!********************************!*\
!*** ./src/wde/wde-desktop.js ***!
\********************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ WebDesktopEnvironment)\n/* harmony export */ });\n/* harmony import */ var _decorat_desktop_decorat_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./decorat/desktop-decorat.js */ \"./src/wde/decorat/desktop-decorat.js\");\n/* harmony import */ var _scrollbar_scrollbar_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./scrollbar/scrollbar.js */ \"./src/wde/scrollbar/scrollbar.js\");\n/* harmony import */ var _web_fs_web_fs_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../web-fs/web-fs.js */ \"./src/web-fs/web-fs.js\");\n/* harmony import */ var _application_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./application.js */ \"./src/wde/application.js\");\n/* harmony import */ var _widgets_file_view_file_view_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./widgets/file-view/file-view.js */ \"./src/wde/widgets/file-view/file-view.js\");\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = \"function\" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || \"@@iterator\", asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\", toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, \"\"); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, \"_invoke\", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: \"normal\", arg: fn.call(obj, arg) }; } catch (err) { return { type: \"throw\", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { [\"next\", \"throw\", \"return\"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if (\"throw\" !== record.type) { var result = record.arg, value = result.value; return value && \"object\" == _typeof(value) && hasOwn.call(value, \"__await\") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke(\"next\", value, resolve, reject); }, function (err) { invoke(\"throw\", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke(\"throw\", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, \"_invoke\", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = \"suspendedStart\"; return function (method, arg) { if (\"executing\" === state) throw new Error(\"Generator is already running\"); if (\"completed\" === state) { if (\"throw\" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if (\"next\" === context.method) context.sent = context._sent = context.arg;else if (\"throw\" === context.method) { if (\"suspendedStart\" === state) throw state = \"completed\", context.arg; context.dispatchException(context.arg); } else \"return\" === context.method && context.abrupt(\"return\", context.arg); state = \"executing\"; var record = tryCatch(innerFn, self, context); if (\"normal\" === record.type) { if (state = context.done ? \"completed\" : \"suspendedYield\", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } \"throw\" === record.type && (state = \"completed\", context.method = \"throw\", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, \"throw\" === context.method) { if (delegate.iterator[\"return\"] && (context.method = \"return\", context.arg = undefined, maybeInvokeDelegate(delegate, context), \"throw\" === context.method)) return ContinueSentinel; context.method = \"throw\", context.arg = new TypeError(\"The iterator does not provide a 'throw' method\"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if (\"throw\" === record.type) return context.method = \"throw\", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, \"return\" !== context.method && (context.method = \"next\", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = \"throw\", context.arg = new TypeError(\"iterator result is not an object\"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = \"normal\", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: \"root\" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if (\"function\" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, \"GeneratorFunction\"), exports.isGeneratorFunction = function (genFun) { var ctor = \"function\" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || \"GeneratorFunction\" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, \"GeneratorFunction\")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, \"Generator\"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, \"toString\", function () { return \"[object Generator]\"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { \"t\" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if (\"throw\" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = \"throw\", record.arg = exception, context.next = loc, caught && (context.method = \"next\", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if (\"root\" === entry.tryLoc) return handle(\"end\"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, \"catchLoc\"), hasFinally = hasOwn.call(entry, \"finallyLoc\"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error(\"try statement without catch or finally\"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, \"finallyLoc\") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && (\"break\" === type || \"continue\" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = \"next\", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if (\"throw\" === record.type) throw record.arg; return \"break\" === record.type || \"continue\" === record.type ? this.next = record.arg : \"return\" === record.type ? (this.rval = this.arg = record.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, \"catch\": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if (\"throw\" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, \"next\" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }\nfunction _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it[\"return\"] != null) it[\"return\"](); } finally { if (didErr) throw err; } } }; }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\n\n\n\n\n\n// import DesktopSunBoard from \"./sunboard/sunboard-desktop.js\";\nvar WebDesktopEnvironment = /*#__PURE__*/function () {\n /** @type {string} */\n\n /** @type {WDEFileView} */\n\n /** @type {WDEScrollBar} */\n\n /**@type {DesktopDecorat} */\n\n /** @type {Object<string, WDEApplication>} */\n\n /** Deprecated */\n\n // static decorat\n\n function WebDesktopEnvironment() {\n _classCallCheck(this, WebDesktopEnvironment);\n _defineProperty(this, \"test\", \"\");\n _defineProperty(this, \"FileView\", _widgets_file_view_file_view_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"]);\n _defineProperty(this, \"ScrollBar\", _scrollbar_scrollbar_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]);\n _defineProperty(this, \"Decorat\", void 0);\n document.body.style.setProperty('--zoom', 1);\n this.Decorat = new _decorat_desktop_decorat_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]();\n WebDesktopEnvironment.webFs = new _web_fs_web_fs_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]();\n this.FileView = _widgets_file_view_file_view_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"];\n this.loadWDE();\n // this.#devLoadSunboard()\n }\n _createClass(WebDesktopEnvironment, [{\n key: \"loadWDE\",\n value: function () {\n var _loadWDE = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {\n var autoStart, _iterator, _step, child, appPath, args, argsRaw, _iterator2, _step2, argRaw, arg;\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n autoStart = document.body.querySelector(\"wde-autostart\");\n if (!(autoStart == null)) {\n _context.next = 4;\n break;\n }\n WebDesktopEnvironment.Alert(\"Error in loading DE\");\n return _context.abrupt(\"return\");\n case 4:\n _iterator = _createForOfIteratorHelper(autoStart.children);\n _context.prev = 5;\n _iterator.s();\n case 7:\n if ((_step = _iterator.n()).done) {\n _context.next = 41;\n break;\n }\n child = _step.value;\n if (!(child.nodeName != \"APP\")) {\n _context.next = 11;\n break;\n }\n return _context.abrupt(\"continue\", 39);\n case 11:\n appPath = child.getAttribute(\"app-path\");\n if (!(appPath == null)) {\n _context.next = 14;\n break;\n }\n return _context.abrupt(\"continue\", 39);\n case 14:\n args = [];\n argsRaw = child.querySelector(\"args\");\n if (!(argsRaw == null)) {\n _context.next = 18;\n break;\n }\n return _context.abrupt(\"continue\", 39);\n case 18:\n _iterator2 = _createForOfIteratorHelper(argsRaw.children);\n _context.prev = 19;\n _iterator2.s();\n case 21:\n if ((_step2 = _iterator2.n()).done) {\n _context.next = 29;\n break;\n }\n argRaw = _step2.value;\n arg = argRaw.getAttribute(\"string\");\n if (!(arg == null)) {\n _context.next = 26;\n break;\n }\n return _context.abrupt(\"continue\", 27);\n case 26:\n args.push(arg);\n case 27:\n _context.next = 21;\n break;\n case 29:\n _context.next = 34;\n break;\n case 31:\n _context.prev = 31;\n _context.t0 = _context[\"catch\"](19);\n _iterator2.e(_context.t0);\n case 34:\n _context.prev = 34;\n _iterator2.f();\n return _context.finish(34);\n case 37:\n _context.next = 39;\n return this.Open(appPath, args);\n case 39:\n _context.next = 7;\n break;\n case 41:\n _context.next = 46;\n break;\n case 43:\n _context.prev = 43;\n _context.t1 = _context[\"catch\"](5);\n _iterator.e(_context.t1);\n case 46:\n _context.prev = 46;\n _iterator.f();\n return _context.finish(46);\n case 49:\n autoStart.remove();\n case 50:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee, this, [[5, 43, 46, 49], [19, 31, 34, 37]]);\n }));\n function loadWDE() {\n return _loadWDE.apply(this, arguments);\n }\n return loadWDE;\n }()\n /**\r\n * @param {string} appPath\r\n * @param {string[]} args\r\n * @param {string} runPath\r\n */\n }, {\n key: \"Open\",\n value: function () {\n var _Open = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(appPath, args, runPath) {\n var appManifest, runContext;\n return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n while (1) {\n switch (_context2.prev = _context2.next) {\n case 0:\n _context2.next = 2;\n return WebDesktopEnvironment.fetchApp(appPath);\n case 2:\n appManifest = _context2.sent;\n if (!(appManifest === undefined)) {\n _context2.next = 5;\n break;\n }\n return _context2.abrupt(\"return\");\n case 5:\n //TODO return err\n /**@type {runContext} */\n runContext = {\n WDE: this,\n isMobile: false,\n bundlePath: appPath,\n runPath: runPath\n };\n if (WebDesktopEnvironment.Applications[appManifest.appId] === undefined) {\n WebDesktopEnvironment.load2(appManifest, function () {\n WebDesktopEnvironment.Applications[appManifest.appId].NewWindow(args, runContext);\n });\n } else {\n WebDesktopEnvironment.Applications[appManifest.appId].NewWindow(args, runContext);\n }\n case 7:\n case \"end\":\n return _context2.stop();\n }\n }\n }, _callee2, this);\n }));\n function Open(_x, _x2, _x3) {\n return _Open.apply(this, arguments);\n }\n return Open;\n }()\n /**\r\n * @param {string} appManifest\r\n * @param {function} onload callback after script loading\r\n */\n }], [{\n key: \"load2\",\n value: function () {\n var _load = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(appManifest, onload) {\n return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n while (1) {\n switch (_context3.prev = _context3.next) {\n case 0:\n // import(window.location.origin + appManifest.js[0]).then((app) => {\n // console.log(window.location.origin + appManifest.js[0] == 'http://localhost:8080/res/dev-fs/wde/dist/finder.js')\n // let kek = 'http://localhost:8080/res/dev-fs/wde/dist/finder.js'\n Promise.resolve(/*! import() */).then(__webpack_require__.bind(__webpack_require__, /*! http://localhost:8080/res/dev-fs/dist/finder.js */ \"http://localhost:8080/res/dev-fs/dist/finder.js\")).then(function (app) {\n var newApp = new app[\"default\"]();\n // if newApp //TODO Validate\n WebDesktopEnvironment.Applications[appManifest.appId] = newApp;\n onload();\n });\n return _context3.abrupt(\"return\");\n case 2:\n case \"end\":\n return _context3.stop();\n }\n }\n }, _callee3);\n }));\n function load2(_x4, _x5) {\n return _load.apply(this, arguments);\n }\n return load2;\n }()\n /**\r\n * @param {string} path\r\n * @returns {Object | undefined} //FIXME\r\n */\n }, {\n key: \"fetchApp\",\n value: function () {\n var _fetchApp = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(path) {\n var params, response, error, appManifest;\n return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n while (1) {\n switch (_context4.prev = _context4.next) {\n case 0:\n // console.log(\"path: \" + path )\n params = new URLSearchParams({\n path: path,\n mode: \"json\"\n });\n _context4.next = 3;\n return fetch(\"/system/loadApp?\" + params);\n case 3:\n response = _context4.sent;\n if (!(response.status != 200)) {\n _context4.next = 10;\n break;\n }\n _context4.next = 7;\n return response.json();\n case 7:\n error = _context4.sent;\n WebDesktopEnvironment.Alert(error.message);\n return _context4.abrupt(\"return\", undefined);\n case 10:\n //TODO Validate manifest\n appManifest = response.json();\n return _context4.abrupt(\"return\", appManifest);\n case 12:\n case \"end\":\n return _context4.stop();\n }\n }\n }, _callee4);\n }));\n function fetchApp(_x6) {\n return _fetchApp.apply(this, arguments);\n }\n return fetchApp;\n }()\n /**\r\n * @param {string} html\r\n */\n }, {\n key: \"SetBasicWindow\",\n value: function SetBasicWindow(html) {\n this.basicWindow = html;\n }\n\n /**\r\n * @returns {string}\r\n */\n }, {\n key: \"GetBasicWindow\",\n value: function GetBasicWindow() {\n return this.basicWindow;\n }\n\n /**\r\n * @param {string} alertText\r\n */\n }, {\n key: \"Alert\",\n value: function Alert(alertText) {\n WebDesktopEnvironment.CreateAlertWindow(alertText);\n console.log(alertText);\n }\n\n /**\r\n * @param {string} alertText\r\n */\n }, {\n key: \"CreateAlertWindow\",\n value: function CreateAlertWindow(alertText) {\n var newWindow = document.createElement(\"div\");\n newWindow.setAttribute(\"class\", \"WindowFrameless\");\n newWindow.setAttribute(\"windowId\", \"SuperUniqUUID\"); //TODO:\n newWindow.style.cssText = \"position:absolute;width:450px;height:116px; margin-left: -225px; margin-top:-58px;left: 50%;top: 50%;background-color:#FFFFFF;border: 1px solid #000000;box-shadow: 2px 2px 0px #000000;\";\n var alertImage = document.createElement(\"img\");\n alertImage.setAttribute(\"src\", \"/res/sys/wde/icons/ohno.png\");\n alertImage.style.cssText = \"position:absolute; width:64px;height:64px;top:15px;left:25px\";\n newWindow.appendChild(alertImage);\n var errorText = document.createElement(\"div\");\n errorText.style.cssText = \"position:absolute; width: 300px; left:128px; top:30px;font-family: 'Virtue';\";\n errorText.innerHTML = alertText;\n newWindow.appendChild(errorText);\n var closeButton = document.createElement(\"button\");\n closeButton.style.cssText = \"position:absolute; left: 382px; bottom: 10px; background-color:#FFFFFF; width: 55px; height:18px; font-family: 'Virtue'; border-radius:4px;border: 1px solid #000000;\";\n closeButton.innerHTML = \"Close\";\n closeButton.addEventListener('click', function () {\n newWindow.remove();\n });\n newWindow.appendChild(closeButton);\n document.body.querySelector('#windows-layer').appendChild(newWindow);\n }\n }]);\n return WebDesktopEnvironment;\n}();\n/**\r\n * @typedef {Object} runContext\r\n * @property {WebDesktopEnvironment} WDE \r\n * @property {boolean} isMobile\r\n * @property {string} appPath \r\n * @property {string} runPath //TODO\r\n*/\n_defineProperty(WebDesktopEnvironment, \"Applications\", {});\n_defineProperty(WebDesktopEnvironment, \"isMobile\", false);\n_defineProperty(WebDesktopEnvironment, \"webFs\", void 0);\n\n\n//# sourceURL=webpack://my-webpack-project/./src/wde/wde-desktop.js?");
/***/ }),
/***/ "./src/wde/widgets/file-view/file-view.js":
/*!************************************************!*\
!*** ./src/wde/widgets/file-view/file-view.js ***!
\************************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ WDEFileView)\n/* harmony export */ });\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = \"function\" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || \"@@iterator\", asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\", toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, \"\"); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, \"_invoke\", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: \"normal\", arg: fn.call(obj, arg) }; } catch (err) { return { type: \"throw\", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { [\"next\", \"throw\", \"return\"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if (\"throw\" !== record.type) { var result = record.arg, value = result.value; return value && \"object\" == _typeof(value) && hasOwn.call(value, \"__await\") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke(\"next\", value, resolve, reject); }, function (err) { invoke(\"throw\", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke(\"throw\", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, \"_invoke\", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = \"suspendedStart\"; return function (method, arg) { if (\"executing\" === state) throw new Error(\"Generator is already running\"); if (\"completed\" === state) { if (\"throw\" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if (\"next\" === context.method) context.sent = context._sent = context.arg;else if (\"throw\" === context.method) { if (\"suspendedStart\" === state) throw state = \"completed\", context.arg; context.dispatchException(context.arg); } else \"return\" === context.method && context.abrupt(\"return\", context.arg); state = \"executing\"; var record = tryCatch(innerFn, self, context); if (\"normal\" === record.type) { if (state = context.done ? \"completed\" : \"suspendedYield\", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } \"throw\" === record.type && (state = \"completed\", context.method = \"throw\", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, \"throw\" === context.method) { if (delegate.iterator[\"return\"] && (context.method = \"return\", context.arg = undefined, maybeInvokeDelegate(delegate, context), \"throw\" === context.method)) return ContinueSentinel; context.method = \"throw\", context.arg = new TypeError(\"The iterator does not provide a 'throw' method\"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if (\"throw\" === record.type) return context.method = \"throw\", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, \"return\" !== context.method && (context.method = \"next\", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = \"throw\", context.arg = new TypeError(\"iterator result is not an object\"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = \"normal\", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: \"root\" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if (\"function\" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, \"GeneratorFunction\"), exports.isGeneratorFunction = function (genFun) { var ctor = \"function\" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || \"GeneratorFunction\" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, \"GeneratorFunction\")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, \"Generator\"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, \"toString\", function () { return \"[object Generator]\"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { \"t\" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if (\"throw\" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = \"throw\", record.arg = exception, context.next = loc, caught && (context.method = \"next\", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if (\"root\" === entry.tryLoc) return handle(\"end\"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, \"catchLoc\"), hasFinally = hasOwn.call(entry, \"finallyLoc\"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error(\"try statement without catch or finally\"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, \"finallyLoc\") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && (\"break\" === type || \"continue\" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = \"next\", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if (\"throw\" === record.type) throw record.arg; return \"break\" === record.type || \"continue\" === record.type ? this.next = record.arg : \"return\" === record.type ? (this.rval = this.arg = record.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, \"catch\": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if (\"throw\" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, \"next\" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nvar WDEFileView = /*#__PURE__*/function () {\n /**\r\n * @param {HTMLElement} fileViewElem\r\n * @param {Function} doubleClickCallback\r\n * @param {Function} rightClickCallback\r\n * @param {Function} updateFileViewCallback\r\n */\n function WDEFileView(fileViewElem, doubleClickCallback, rightClickCallback, fileUploadCallback, updateFileViewCallback) {\n var _this = this;\n _classCallCheck(this, WDEFileView);\n _defineProperty(this, \"path\", \"\");\n _defineProperty(this, \"parentElem\", undefined);\n _defineProperty(this, \"selected\", []);\n //TODO check all params\n this.parentElem = fileViewElem;\n fileViewElem.addEventListener('click', function (event) {\n if (event.target.classList[0] == 'FileTileView') {\n _this.DeselectAll();\n return;\n }\n if (event.detail === 1) {\n _this.DeselectAll();\n _this.Select([event.target]);\n } else if (event.detail === 2) {\n doubleClickCallback(event);\n }\n });\n fileViewElem.addEventListener('contextmenu', function (event) {\n event.preventDefault();\n if (event.target.classList.contains(\"Tile\")) {\n _this.DeselectAll();\n _this.Select([event.target]);\n }\n _this.Select([event.target]);\n rightClickCallback(event);\n });\n if (fileUploadCallback !== undefined) {\n var counter = 0;\n var draggedElem = undefined;\n fileViewElem.addEventListener('dragstart', function (event) {\n // console.log(event.target)\n // console.log(this.path)\n // draggedElem = event.target\n event.dataTransfer.setData(\"fileName\", event.target.getAttribute(\"name\"));\n event.dataTransfer.setData(\"filePath\", _this.path + \"/\" + event.target.getAttribute(\"name\"));\n event.dataTransfer.setData(\"dropType\", \"move\");\n // console.log(updateFileViewCallback)\n // event.dataTransfer.setData(\"updateCallback\", updateFileViewCallback)\n // event.dataTransfer.setData(\"fileName\", )\n // console.log(draggedElem)\n });\n\n fileViewElem.addEventListener('dragenter', function (event) {\n event.preventDefault();\n counter++;\n fileViewElem.classList.add(\"DragDropBorder\");\n });\n fileViewElem.addEventListener('dragend', function (event) {\n // console.log(fileViewElem)\n event.preventDefault();\n counter--;\n if (counter === 0) {\n fileViewElem.classList.remove(\"DragDropBorder\");\n }\n // updateFileViewCallback()\n // draggedElem = undefined\n });\n\n fileViewElem.addEventListener('dragleave', function (event) {\n // console.log(fileViewElem)\n event.preventDefault();\n counter--;\n if (counter === 0) {\n fileViewElem.classList.remove(\"DragDropBorder\");\n }\n // draggedElem = undefined\n });\n\n fileViewElem.addEventListener('dragover', function (event) {\n event.preventDefault();\n });\n fileViewElem.addEventListener(\"drop\", function (event) {\n event.preventDefault();\n fileUploadCallback(event);\n fileViewElem.classList.remove(\"DragDropBorder\");\n // updateFileViewCallback()\n // this.OpenFolder(this.path)\n // draggedElem = undefined\n });\n }\n }\n\n /** \r\n * @param {[]Element} elements\r\n */\n _createClass(WDEFileView, [{\n key: \"Select\",\n value: function Select(elements) {\n var _this2 = this;\n elements.forEach(function (element) {\n _this2.selected.push(element);\n element.classList.add(\"Selected\");\n });\n }\n }, {\n key: \"DeselectAll\",\n value: function DeselectAll() {\n this.selected.forEach(function (element) {\n element.classList.remove(\"Selected\");\n });\n this.selected = [];\n }\n\n /** Get html of folder by path\r\n * @param {string} path\r\n */\n }, {\n key: \"OpenFolder\",\n value: function () {\n var _OpenFolder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(path) {\n var params, response, html;\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n this.path = path;\n params = new URLSearchParams({\n path: path\n });\n _context.next = 4;\n return fetch(\"/system/wde/widgets/file-tile-view?\" + params);\n case 4:\n response = _context.sent;\n if (!(response.status != 200)) {\n _context.next = 8;\n break;\n }\n //TODO Error text message\n WebDesktopEnvironment.Alert(\"TODO\");\n return _context.abrupt(\"return\");\n case 8:\n _context.next = 10;\n return response.text();\n case 10:\n html = _context.sent;\n this.parentElem.innerHTML = html;\n case 12:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee, this);\n }));\n function OpenFolder(_x) {\n return _OpenFolder.apply(this, arguments);\n }\n return OpenFolder;\n }()\n }]);\n return WDEFileView;\n}();\n\n\n//# sourceURL=webpack://my-webpack-project/./src/wde/widgets/file-view/file-view.js?");
/***/ }),
/***/ "./src/web-fs/web-fs.js":
/*!******************************!*\
!*** ./src/web-fs/web-fs.js ***!
\******************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ WebFS)\n/* harmony export */ });\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = \"function\" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || \"@@iterator\", asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\", toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, \"\"); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, \"_invoke\", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: \"normal\", arg: fn.call(obj, arg) }; } catch (err) { return { type: \"throw\", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { [\"next\", \"throw\", \"return\"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if (\"throw\" !== record.type) { var result = record.arg, value = result.value; return value && \"object\" == _typeof(value) && hasOwn.call(value, \"__await\") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke(\"next\", value, resolve, reject); }, function (err) { invoke(\"throw\", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke(\"throw\", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, \"_invoke\", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = \"suspendedStart\"; return function (method, arg) { if (\"executing\" === state) throw new Error(\"Generator is already running\"); if (\"completed\" === state) { if (\"throw\" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if (\"next\" === context.method) context.sent = context._sent = context.arg;else if (\"throw\" === context.method) { if (\"suspendedStart\" === state) throw state = \"completed\", context.arg; context.dispatchException(context.arg); } else \"return\" === context.method && context.abrupt(\"return\", context.arg); state = \"executing\"; var record = tryCatch(innerFn, self, context); if (\"normal\" === record.type) { if (state = context.done ? \"completed\" : \"suspendedYield\", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } \"throw\" === record.type && (state = \"completed\", context.method = \"throw\", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, \"throw\" === context.method) { if (delegate.iterator[\"return\"] && (context.method = \"return\", context.arg = undefined, maybeInvokeDelegate(delegate, context), \"throw\" === context.method)) return ContinueSentinel; context.method = \"throw\", context.arg = new TypeError(\"The iterator does not provide a 'throw' method\"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if (\"throw\" === record.type) return context.method = \"throw\", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, \"return\" !== context.method && (context.method = \"next\", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = \"throw\", context.arg = new TypeError(\"iterator result is not an object\"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = \"normal\", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: \"root\" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if (\"function\" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, \"GeneratorFunction\"), exports.isGeneratorFunction = function (genFun) { var ctor = \"function\" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || \"GeneratorFunction\" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, \"GeneratorFunction\")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, \"Generator\"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, \"toString\", function () { return \"[object Generator]\"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { \"t\" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if (\"throw\" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = \"throw\", record.arg = exception, context.next = loc, caught && (context.method = \"next\", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if (\"root\" === entry.tryLoc) return handle(\"end\"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, \"catchLoc\"), hasFinally = hasOwn.call(entry, \"finallyLoc\"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error(\"try statement without catch or finally\"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, \"finallyLoc\") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && (\"break\" === type || \"continue\" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = \"next\", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if (\"throw\" === record.type) throw record.arg; return \"break\" === record.type || \"continue\" === record.type ? this.next = record.arg : \"return\" === record.type ? (this.rval = this.arg = record.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, \"catch\": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if (\"throw\" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, \"next\" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nvar WebFS = /*#__PURE__*/function () {\n function WebFS() {\n _classCallCheck(this, WebFS);\n }\n _createClass(WebFS, null, [{\n key: \"CreateDirectory\",\n value:\n /**\r\n * @param {string} path\r\n * @returns {boolean}\r\n */\n function () {\n var _CreateDirectory = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(path) {\n var params, response;\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n if (!(path == undefined)) {\n _context.next = 3;\n break;\n }\n WebDesktopEnvironment.Alert(\"Path is undefined\");\n return _context.abrupt(\"return\", false);\n case 3:\n params = new URLSearchParams({\n path: \"\".concat(path, \"/New Directory\")\n });\n _context.next = 6;\n return fetch(\"/system/fs/createDir?\" + params);\n case 6:\n response = _context.sent;\n if (!(response.status != 200)) {\n _context.next = 10;\n break;\n }\n WebDesktopEnvironment.Alert(\"DIRCTORY CREATION ERROR\"); //TODO\n return _context.abrupt(\"return\", false);\n case 10:\n return _context.abrupt(\"return\", true);\n case 11:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee);\n }));\n function CreateDirectory(_x) {\n return _CreateDirectory.apply(this, arguments);\n }\n return CreateDirectory;\n }()\n /**\r\n * @param {string} path\r\n * @returns {boolean}\r\n */\n }, {\n key: \"DeleteFile\",\n value: function () {\n var _DeleteFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(path) {\n var params, response;\n return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n while (1) {\n switch (_context2.prev = _context2.next) {\n case 0:\n params = new URLSearchParams({\n path: path\n });\n _context2.next = 3;\n return fetch(\"/system/fs/delete?\" + params);\n case 3:\n response = _context2.sent;\n if (!(response.status != 200)) {\n _context2.next = 7;\n break;\n }\n WebDesktopEnvironment.Alert(\"DELETE ERROR\"); //TODO\n return _context2.abrupt(\"return\", false);\n case 7:\n return _context2.abrupt(\"return\", true);\n case 8:\n case \"end\":\n return _context2.stop();\n }\n }\n }, _callee2);\n }));\n function DeleteFile(_x2) {\n return _DeleteFile.apply(this, arguments);\n }\n return DeleteFile;\n }()\n /**\r\n * @param {string} path\r\n * @returns {boolean}\r\n */\n }, {\n key: \"MoveFile\",\n value: function () {\n var _MoveFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(sourcePath, targetPath) {\n var params, response;\n return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n while (1) {\n switch (_context3.prev = _context3.next) {\n case 0:\n params = new URLSearchParams({\n sourcePath: sourcePath,\n targetPath: targetPath\n });\n _context3.next = 3;\n return fetch(\"/system/fs/move?\" + params);\n case 3:\n response = _context3.sent;\n if (!(response.status != 200)) {\n _context3.next = 6;\n break;\n }\n return _context3.abrupt(\"return\", false);\n case 6:\n return _context3.abrupt(\"return\", true);\n case 7:\n case \"end\":\n return _context3.stop();\n }\n }\n }, _callee3);\n }));\n function MoveFile(_x3, _x4) {\n return _MoveFile.apply(this, arguments);\n }\n return MoveFile;\n }()\n /**\r\n * @param {string} linkPath\r\n * @returns {string}\r\n */\n }, {\n key: \"ReadObjectLink\",\n value: function () {\n var _ReadObjectLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(linkPath) {\n var params, response, path;\n return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n while (1) {\n switch (_context4.prev = _context4.next) {\n case 0:\n params = new URLSearchParams({\n linkPath: linkPath\n });\n _context4.next = 3;\n return fetch(\"/system/fs/readObjectLink?\" + params);\n case 3:\n response = _context4.sent;\n if (!(response.status != 200)) {\n _context4.next = 7;\n break;\n }\n WebDesktopEnvironment.Alert(\"TODO\"); //TODO\n return _context4.abrupt(\"return\", \"\");\n case 7:\n _context4.next = 9;\n return response.text();\n case 9:\n path = _context4.sent;\n return _context4.abrupt(\"return\", path);\n case 11:\n case \"end\":\n return _context4.stop();\n }\n }\n }, _callee4);\n }));\n function ReadObjectLink(_x5) {\n return _ReadObjectLink.apply(this, arguments);\n }\n return ReadObjectLink;\n }()\n /**\r\n * @param {string} sourcePath\r\n * @param {string} linkPath\r\n * @returns {string}\r\n */\n }, {\n key: \"CreatePathLink\",\n value: function () {\n var _CreatePathLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(sourcePath, linkPath) {\n var params, response;\n return _regeneratorRuntime().wrap(function _callee5$(_context5) {\n while (1) {\n switch (_context5.prev = _context5.next) {\n case 0:\n params = new URLSearchParams({\n sourcePath: sourcePath,\n linkPath: linkPath\n });\n _context5.next = 3;\n return fetch(\"/system/fs/createPathLink?\" + params);\n case 3:\n response = _context5.sent;\n return _context5.abrupt(\"return\", response.status == 200);\n case 5:\n case \"end\":\n return _context5.stop();\n }\n }\n }, _callee5);\n }));\n function CreatePathLink(_x6, _x7) {\n return _CreatePathLink.apply(this, arguments);\n }\n return CreatePathLink;\n }()\n /**\r\n * @param {string} linkPath\r\n * @returns {string}\r\n */\n }, {\n key: \"ReadPathLink\",\n value: function () {\n var _ReadPathLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(linkPath) {\n var params, response, file;\n return _regeneratorRuntime().wrap(function _callee6$(_context6) {\n while (1) {\n switch (_context6.prev = _context6.next) {\n case 0:\n params = new URLSearchParams({\n linkPath: linkPath\n });\n _context6.next = 3;\n return fetch(\"/system/fs/readPathLink?\" + params);\n case 3:\n response = _context6.sent;\n if (!(response.status != 200)) {\n _context6.next = 7;\n break;\n }\n WebDesktopEnvironment.Alert(\"TODO\"); //TODO\n return _context6.abrupt(\"return\", \"\");\n case 7:\n _context6.next = 9;\n return response.json();\n case 9:\n file = _context6.sent;\n return _context6.abrupt(\"return\", file);\n case 11:\n case \"end\":\n return _context6.stop();\n }\n }\n }, _callee6);\n }));\n function ReadPathLink(_x8) {\n return _ReadPathLink.apply(this, arguments);\n }\n return ReadPathLink;\n }()\n /**\r\n * @param {File} file\r\n * @param {string} parentPath\r\n * @returns {boolean}\r\n */\n }, {\n key: \"UploadFile\",\n value: function () {\n var _UploadFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(file, parentPath) {\n var formData, params, response, error;\n return _regeneratorRuntime().wrap(function _callee7$(_context7) {\n while (1) {\n switch (_context7.prev = _context7.next) {\n case 0:\n console.log('here');\n formData = new FormData();\n formData.append(\"file\", file); //FIXME Conn reset\n params = new URLSearchParams({\n parentPath: parentPath\n });\n _context7.next = 6;\n return fetch(\"/system/fs/upload?\" + params, {\n method: \"POST\",\n //TODO Change to PUT?\n body: formData\n });\n case 6:\n response = _context7.sent;\n console.log(response.status);\n if (!(response.status != 201)) {\n _context7.next = 14;\n break;\n }\n _context7.next = 11;\n return response.json();\n case 11:\n error = _context7.sent;\n WebDesktopEnvironment.Alert(error.message);\n return _context7.abrupt(\"return\", false);\n case 14:\n return _context7.abrupt(\"return\", true);\n case 15:\n case \"end\":\n return _context7.stop();\n }\n }\n }, _callee7);\n }));\n function UploadFile(_x9, _x10) {\n return _UploadFile.apply(this, arguments);\n }\n return UploadFile;\n }()\n }]);\n return WebFS;\n}();\n\n\n//# sourceURL=webpack://my-webpack-project/./src/web-fs/web-fs.js?");
/***/ })
/******/ });
/************************************************************************/
/******/ // The module cache
/******/ var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ var cachedModule = __webpack_module_cache__[moduleId];
/******/ if (cachedModule !== undefined) {
/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
/******/ // no module.id needed
/******/ // no module.loaded needed
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/************************************************************************/
/******/ /* webpack/runtime/define property getters */
/******/ (() => {
/******/ // define getter functions for harmony exports
/******/ __webpack_require__.d = (exports, definition) => {
/******/ for(var key in definition) {
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
/******/ }
/******/ }
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ (() => {
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/
/******/ /* webpack/runtime/make namespace object */
/******/ (() => {
/******/ // define __esModule on exports
/******/ __webpack_require__.r = (exports) => {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/ })();
/******/
/************************************************************************/
/******/
/******/ // startup
/******/ // Load entry module and return exports
/******/ // This entry module can't be inlined because the eval devtool is used.
/******/ var __webpack_exports__ = __webpack_require__("./src/desktop.js");
/******/
/******/ })()
;