Web UI for ARGUS server
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

657 lines
19 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. (function (global, factory) {
  2. typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
  3. typeof define === 'function' && define.amd ? define(['exports'], factory) :
  4. (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.PNotifyMobile = {}));
  5. }(this, (function (exports) { 'use strict';
  6. function _typeof(obj) {
  7. "@babel/helpers - typeof";
  8. if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
  9. _typeof = function (obj) {
  10. return typeof obj;
  11. };
  12. } else {
  13. _typeof = function (obj) {
  14. return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
  15. };
  16. }
  17. return _typeof(obj);
  18. }
  19. function _classCallCheck(instance, Constructor) {
  20. if (!(instance instanceof Constructor)) {
  21. throw new TypeError("Cannot call a class as a function");
  22. }
  23. }
  24. function _defineProperties(target, props) {
  25. for (var i = 0; i < props.length; i++) {
  26. var descriptor = props[i];
  27. descriptor.enumerable = descriptor.enumerable || false;
  28. descriptor.configurable = true;
  29. if ("value" in descriptor) descriptor.writable = true;
  30. Object.defineProperty(target, descriptor.key, descriptor);
  31. }
  32. }
  33. function _createClass(Constructor, protoProps, staticProps) {
  34. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  35. if (staticProps) _defineProperties(Constructor, staticProps);
  36. return Constructor;
  37. }
  38. function _inherits(subClass, superClass) {
  39. if (typeof superClass !== "function" && superClass !== null) {
  40. throw new TypeError("Super expression must either be null or a function");
  41. }
  42. subClass.prototype = Object.create(superClass && superClass.prototype, {
  43. constructor: {
  44. value: subClass,
  45. writable: true,
  46. configurable: true
  47. }
  48. });
  49. if (superClass) _setPrototypeOf(subClass, superClass);
  50. }
  51. function _getPrototypeOf(o) {
  52. _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
  53. return o.__proto__ || Object.getPrototypeOf(o);
  54. };
  55. return _getPrototypeOf(o);
  56. }
  57. function _setPrototypeOf(o, p) {
  58. _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
  59. o.__proto__ = p;
  60. return o;
  61. };
  62. return _setPrototypeOf(o, p);
  63. }
  64. function _isNativeReflectConstruct() {
  65. if (typeof Reflect === "undefined" || !Reflect.construct) return false;
  66. if (Reflect.construct.sham) return false;
  67. if (typeof Proxy === "function") return true;
  68. try {
  69. Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
  70. return true;
  71. } catch (e) {
  72. return false;
  73. }
  74. }
  75. function _assertThisInitialized(self) {
  76. if (self === void 0) {
  77. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  78. }
  79. return self;
  80. }
  81. function _possibleConstructorReturn(self, call) {
  82. if (call && (typeof call === "object" || typeof call === "function")) {
  83. return call;
  84. }
  85. return _assertThisInitialized(self);
  86. }
  87. function _createSuper(Derived) {
  88. var hasNativeReflectConstruct = _isNativeReflectConstruct();
  89. return function _createSuperInternal() {
  90. var Super = _getPrototypeOf(Derived),
  91. result;
  92. if (hasNativeReflectConstruct) {
  93. var NewTarget = _getPrototypeOf(this).constructor;
  94. result = Reflect.construct(Super, arguments, NewTarget);
  95. } else {
  96. result = Super.apply(this, arguments);
  97. }
  98. return _possibleConstructorReturn(this, result);
  99. };
  100. }
  101. function _toConsumableArray(arr) {
  102. return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
  103. }
  104. function _arrayWithoutHoles(arr) {
  105. if (Array.isArray(arr)) return _arrayLikeToArray(arr);
  106. }
  107. function _iterableToArray(iter) {
  108. if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
  109. }
  110. function _unsupportedIterableToArray(o, minLen) {
  111. if (!o) return;
  112. if (typeof o === "string") return _arrayLikeToArray(o, minLen);
  113. var n = Object.prototype.toString.call(o).slice(8, -1);
  114. if (n === "Object" && o.constructor) n = o.constructor.name;
  115. if (n === "Map" || n === "Set") return Array.from(o);
  116. if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
  117. }
  118. function _arrayLikeToArray(arr, len) {
  119. if (len == null || len > arr.length) len = arr.length;
  120. for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
  121. return arr2;
  122. }
  123. function _nonIterableSpread() {
  124. throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  125. }
  126. function noop() {}
  127. function run(fn) {
  128. return fn();
  129. }
  130. function blank_object() {
  131. return Object.create(null);
  132. }
  133. function run_all(fns) {
  134. fns.forEach(run);
  135. }
  136. function is_function(thing) {
  137. return typeof thing === 'function';
  138. }
  139. function safe_not_equal(a, b) {
  140. return a != a ? b == b : a !== b || a && _typeof(a) === 'object' || typeof a === 'function';
  141. }
  142. function is_empty(obj) {
  143. return Object.keys(obj).length === 0;
  144. }
  145. function detach(node) {
  146. node.parentNode.removeChild(node);
  147. }
  148. function listen(node, event, handler, options) {
  149. node.addEventListener(event, handler, options);
  150. return function () {
  151. return node.removeEventListener(event, handler, options);
  152. };
  153. }
  154. function children(element) {
  155. return Array.from(element.childNodes);
  156. }
  157. var current_component;
  158. function set_current_component(component) {
  159. current_component = component;
  160. }
  161. function get_current_component() {
  162. if (!current_component) throw new Error('Function called outside component initialization');
  163. return current_component;
  164. }
  165. function onMount(fn) {
  166. get_current_component().$$.on_mount.push(fn);
  167. }
  168. function onDestroy(fn) {
  169. get_current_component().$$.on_destroy.push(fn);
  170. }
  171. var dirty_components = [];
  172. var binding_callbacks = [];
  173. var render_callbacks = [];
  174. var flush_callbacks = [];
  175. var resolved_promise = Promise.resolve();
  176. var update_scheduled = false;
  177. function schedule_update() {
  178. if (!update_scheduled) {
  179. update_scheduled = true;
  180. resolved_promise.then(flush);
  181. }
  182. }
  183. function add_render_callback(fn) {
  184. render_callbacks.push(fn);
  185. }
  186. var flushing = false;
  187. var seen_callbacks = new Set();
  188. function flush() {
  189. if (flushing) return;
  190. flushing = true;
  191. do {
  192. // first, call beforeUpdate functions
  193. // and update components
  194. for (var i = 0; i < dirty_components.length; i += 1) {
  195. var component = dirty_components[i];
  196. set_current_component(component);
  197. update(component.$$);
  198. }
  199. set_current_component(null);
  200. dirty_components.length = 0;
  201. while (binding_callbacks.length) {
  202. binding_callbacks.pop()();
  203. } // then, once components are updated, call
  204. // afterUpdate functions. This may cause
  205. // subsequent updates...
  206. for (var _i = 0; _i < render_callbacks.length; _i += 1) {
  207. var callback = render_callbacks[_i];
  208. if (!seen_callbacks.has(callback)) {
  209. // ...so guard against infinite loops
  210. seen_callbacks.add(callback);
  211. callback();
  212. }
  213. }
  214. render_callbacks.length = 0;
  215. } while (dirty_components.length);
  216. while (flush_callbacks.length) {
  217. flush_callbacks.pop()();
  218. }
  219. update_scheduled = false;
  220. flushing = false;
  221. seen_callbacks.clear();
  222. }
  223. function update($$) {
  224. if ($$.fragment !== null) {
  225. $$.update();
  226. run_all($$.before_update);
  227. var dirty = $$.dirty;
  228. $$.dirty = [-1];
  229. $$.fragment && $$.fragment.p($$.ctx, dirty);
  230. $$.after_update.forEach(add_render_callback);
  231. }
  232. }
  233. var outroing = new Set();
  234. function transition_in(block, local) {
  235. if (block && block.i) {
  236. outroing["delete"](block);
  237. block.i(local);
  238. }
  239. }
  240. var globals = typeof window !== 'undefined' ? window : typeof globalThis !== 'undefined' ? globalThis : global;
  241. function mount_component(component, target, anchor) {
  242. var _component$$$ = component.$$,
  243. fragment = _component$$$.fragment,
  244. on_mount = _component$$$.on_mount,
  245. on_destroy = _component$$$.on_destroy,
  246. after_update = _component$$$.after_update;
  247. fragment && fragment.m(target, anchor); // onMount happens before the initial afterUpdate
  248. add_render_callback(function () {
  249. var new_on_destroy = on_mount.map(run).filter(is_function);
  250. if (on_destroy) {
  251. on_destroy.push.apply(on_destroy, _toConsumableArray(new_on_destroy));
  252. } else {
  253. // Edge case - component was destroyed immediately,
  254. // most likely as a result of a binding initialising
  255. run_all(new_on_destroy);
  256. }
  257. component.$$.on_mount = [];
  258. });
  259. after_update.forEach(add_render_callback);
  260. }
  261. function destroy_component(component, detaching) {
  262. var $$ = component.$$;
  263. if ($$.fragment !== null) {
  264. run_all($$.on_destroy);
  265. $$.fragment && $$.fragment.d(detaching); // TODO null out other refs, including component.$$ (but need to
  266. // preserve final state?)
  267. $$.on_destroy = $$.fragment = null;
  268. $$.ctx = [];
  269. }
  270. }
  271. function make_dirty(component, i) {
  272. if (component.$$.dirty[0] === -1) {
  273. dirty_components.push(component);
  274. schedule_update();
  275. component.$$.dirty.fill(0);
  276. }
  277. component.$$.dirty[i / 31 | 0] |= 1 << i % 31;
  278. }
  279. function init(component, options, instance, create_fragment, not_equal, props) {
  280. var dirty = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : [-1];
  281. var parent_component = current_component;
  282. set_current_component(component);
  283. var prop_values = options.props || {};
  284. var $$ = component.$$ = {
  285. fragment: null,
  286. ctx: null,
  287. // state
  288. props: props,
  289. update: noop,
  290. not_equal: not_equal,
  291. bound: blank_object(),
  292. // lifecycle
  293. on_mount: [],
  294. on_destroy: [],
  295. before_update: [],
  296. after_update: [],
  297. context: new Map(parent_component ? parent_component.$$.context : []),
  298. // everything else
  299. callbacks: blank_object(),
  300. dirty: dirty,
  301. skip_bound: false
  302. };
  303. var ready = false;
  304. $$.ctx = instance ? instance(component, prop_values, function (i, ret) {
  305. var value = (arguments.length <= 2 ? 0 : arguments.length - 2) ? arguments.length <= 2 ? undefined : arguments[2] : ret;
  306. if ($$.ctx && not_equal($$.ctx[i], $$.ctx[i] = value)) {
  307. if (!$$.skip_bound && $$.bound[i]) $$.bound[i](value);
  308. if (ready) make_dirty(component, i);
  309. }
  310. return ret;
  311. }) : [];
  312. $$.update();
  313. ready = true;
  314. run_all($$.before_update); // `false` as a special case of no DOM component
  315. $$.fragment = create_fragment ? create_fragment($$.ctx) : false;
  316. if (options.target) {
  317. if (options.hydrate) {
  318. var nodes = children(options.target); // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
  319. $$.fragment && $$.fragment.l(nodes);
  320. nodes.forEach(detach);
  321. } else {
  322. // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
  323. $$.fragment && $$.fragment.c();
  324. }
  325. if (options.intro) transition_in(component.$$.fragment);
  326. mount_component(component, options.target, options.anchor);
  327. flush();
  328. }
  329. set_current_component(parent_component);
  330. }
  331. var SvelteComponent = /*#__PURE__*/function () {
  332. function SvelteComponent() {
  333. _classCallCheck(this, SvelteComponent);
  334. }
  335. _createClass(SvelteComponent, [{
  336. key: "$destroy",
  337. value: function $destroy() {
  338. destroy_component(this, 1);
  339. this.$destroy = noop;
  340. }
  341. }, {
  342. key: "$on",
  343. value: function $on(type, callback) {
  344. var callbacks = this.$$.callbacks[type] || (this.$$.callbacks[type] = []);
  345. callbacks.push(callback);
  346. return function () {
  347. var index = callbacks.indexOf(callback);
  348. if (index !== -1) callbacks.splice(index, 1);
  349. };
  350. }
  351. }, {
  352. key: "$set",
  353. value: function $set($$props) {
  354. if (this.$$set && !is_empty($$props)) {
  355. this.$$.skip_bound = true;
  356. this.$$set($$props);
  357. this.$$.skip_bound = false;
  358. }
  359. }
  360. }]);
  361. return SvelteComponent;
  362. }();
  363. var window_1 = globals.window;
  364. function create_fragment(ctx) {
  365. var mounted;
  366. var dispose;
  367. return {
  368. c: noop,
  369. m: function m(target, anchor) {
  370. if (!mounted) {
  371. dispose = listen(window_1, "resize",
  372. /*resize_handler*/
  373. ctx[3]);
  374. mounted = true;
  375. }
  376. },
  377. p: noop,
  378. i: noop,
  379. o: noop,
  380. d: function d(detaching) {
  381. mounted = false;
  382. dispose();
  383. }
  384. };
  385. }
  386. var position = "PrependContainer";
  387. var defaults = {
  388. swipeDismiss: true
  389. };
  390. function instance($$self, $$props, $$invalidate) {
  391. var _$$props$self = $$props.self,
  392. self = _$$props$self === void 0 ? null : _$$props$self;
  393. var _$$props$swipeDismiss = $$props.swipeDismiss,
  394. swipeDismiss = _$$props$swipeDismiss === void 0 ? defaults.swipeDismiss : _$$props$swipeDismiss;
  395. var origXY = null;
  396. var diffXY = null;
  397. var noticeWidthHeight = null;
  398. var noticeOpacity = null;
  399. var csspos = "left";
  400. var direction = "X";
  401. var span = "Width";
  402. var windowInnerWidth = window.innerWidth;
  403. var offs = [];
  404. onMount(function () {
  405. offs = [self.on("touchstart", function (e) {
  406. if (!swipeDismiss) {
  407. return;
  408. }
  409. var stack = self.stack;
  410. if (stack) {
  411. switch (stack.dir1) {
  412. case "up":
  413. case "down":
  414. csspos = "left";
  415. direction = "X";
  416. span = "Width";
  417. break;
  418. case "left":
  419. case "right":
  420. csspos = "top";
  421. direction = "Y";
  422. span = "Height";
  423. break;
  424. }
  425. }
  426. origXY = e.touches[0]["screen".concat(direction)];
  427. noticeWidthHeight = self.refs.elem["scroll".concat(span)];
  428. noticeOpacity = window.getComputedStyle(self.refs.elem)["opacity"];
  429. $$invalidate(1, self.refs.container.style[csspos] = 0, self);
  430. }), self.on("touchmove", function (e) {
  431. if (!origXY || !swipeDismiss) {
  432. return;
  433. }
  434. var curXY = e.touches[0]["screen".concat(direction)];
  435. diffXY = curXY - origXY;
  436. var opacity = (1 - Math.abs(diffXY) / noticeWidthHeight) * noticeOpacity;
  437. $$invalidate(1, self.refs.elem.style.opacity = opacity, self);
  438. $$invalidate(1, self.refs.container.style[csspos] = "".concat(diffXY, "px"), self);
  439. }), self.on("touchend", function () {
  440. if (!origXY || !swipeDismiss) {
  441. return;
  442. }
  443. self.refs.container.classList.add("pnotify-mobile-animate-left");
  444. if (Math.abs(diffXY) > 40) {
  445. var goLeft = diffXY < 0 ? noticeWidthHeight * -2 : noticeWidthHeight * 2;
  446. $$invalidate(1, self.refs.elem.style.opacity = 0, self);
  447. $$invalidate(1, self.refs.container.style[csspos] = "".concat(goLeft, "px"), self);
  448. self.close();
  449. } else {
  450. self.refs.elem.style.removeProperty("opacity");
  451. self.refs.container.style.removeProperty(csspos);
  452. }
  453. origXY = null;
  454. diffXY = null;
  455. noticeWidthHeight = null;
  456. noticeOpacity = null;
  457. }), self.on("touchcancel", function () {
  458. if (!origXY || !swipeDismiss) {
  459. return;
  460. }
  461. self.refs.elem.style.removeProperty("opacity");
  462. self.refs.container.style.removeProperty(csspos);
  463. origXY = null;
  464. diffXY = null;
  465. noticeWidthHeight = null;
  466. noticeOpacity = null;
  467. }), self.on("pnotify:afterClose", function () {
  468. // Remove any styling we added to close it.
  469. if (!swipeDismiss) {
  470. return;
  471. }
  472. self.refs.elem.style.removeProperty("opacity");
  473. self.refs.container.style.removeProperty("left");
  474. self.refs.container.style.removeProperty("top");
  475. })];
  476. });
  477. onDestroy(function () {
  478. offs.forEach(function (off) {
  479. return off();
  480. });
  481. });
  482. var resize_handler = function resize_handler() {
  483. return $$invalidate(0, windowInnerWidth = window.innerWidth);
  484. };
  485. $$self.$$set = function ($$props) {
  486. if ("self" in $$props) $$invalidate(1, self = $$props.self);
  487. if ("swipeDismiss" in $$props) $$invalidate(2, swipeDismiss = $$props.swipeDismiss);
  488. };
  489. $$self.$$.update = function () {
  490. if ($$self.$$.dirty &
  491. /*self, windowInnerWidth*/
  492. 3) {
  493. {
  494. var stack = self.stack;
  495. if (stack) {
  496. if (windowInnerWidth <= 480) {
  497. if (!("_m_spacing1" in stack)) {
  498. stack._m_spacing1 = stack.spacing1;
  499. stack._m_firstpos1 = stack.firstpos1;
  500. stack._m_spacing2 = stack.spacing2;
  501. stack._m_firstpos2 = stack.firstpos2;
  502. stack.spacing1 = 0;
  503. stack.firstpos1 = 0;
  504. stack.spacing2 = 0;
  505. stack.firstpos2 = 0;
  506. stack.queuePosition();
  507. }
  508. } else {
  509. if ("_m_spacing1" in stack) {
  510. stack.spacing1 = stack._m_spacing1;
  511. delete stack._m_spacing1;
  512. stack.firstpos1 = stack._m_firstpos1;
  513. delete stack._m_firstpos1;
  514. stack.spacing2 = stack._m_spacing2;
  515. delete stack._m_spacing2;
  516. stack.firstpos2 = stack._m_firstpos2;
  517. delete stack._m_firstpos2;
  518. stack.queuePosition();
  519. }
  520. }
  521. }
  522. }
  523. }
  524. };
  525. return [windowInnerWidth, self, swipeDismiss, resize_handler];
  526. }
  527. var Mobile = /*#__PURE__*/function (_SvelteComponent) {
  528. _inherits(Mobile, _SvelteComponent);
  529. var _super = _createSuper(Mobile);
  530. function Mobile(options) {
  531. var _this;
  532. _classCallCheck(this, Mobile);
  533. _this = _super.call(this);
  534. init(_assertThisInitialized(_this), options, instance, create_fragment, safe_not_equal, {
  535. self: 1,
  536. swipeDismiss: 2
  537. });
  538. return _this;
  539. }
  540. return Mobile;
  541. }(SvelteComponent);
  542. exports.default = Mobile;
  543. exports.defaults = defaults;
  544. exports.position = position;
  545. Object.defineProperty(exports, '__esModule', { value: true });
  546. })));