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.

700 lines
23 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.PNotifyDesktop = {}));
  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 children(element) {
  149. return Array.from(element.childNodes);
  150. }
  151. var current_component;
  152. function set_current_component(component) {
  153. current_component = component;
  154. }
  155. var dirty_components = [];
  156. var binding_callbacks = [];
  157. var render_callbacks = [];
  158. var flush_callbacks = [];
  159. var resolved_promise = Promise.resolve();
  160. var update_scheduled = false;
  161. function schedule_update() {
  162. if (!update_scheduled) {
  163. update_scheduled = true;
  164. resolved_promise.then(flush);
  165. }
  166. }
  167. function add_render_callback(fn) {
  168. render_callbacks.push(fn);
  169. }
  170. var flushing = false;
  171. var seen_callbacks = new Set();
  172. function flush() {
  173. if (flushing) return;
  174. flushing = true;
  175. do {
  176. // first, call beforeUpdate functions
  177. // and update components
  178. for (var i = 0; i < dirty_components.length; i += 1) {
  179. var component = dirty_components[i];
  180. set_current_component(component);
  181. update(component.$$);
  182. }
  183. set_current_component(null);
  184. dirty_components.length = 0;
  185. while (binding_callbacks.length) {
  186. binding_callbacks.pop()();
  187. } // then, once components are updated, call
  188. // afterUpdate functions. This may cause
  189. // subsequent updates...
  190. for (var _i = 0; _i < render_callbacks.length; _i += 1) {
  191. var callback = render_callbacks[_i];
  192. if (!seen_callbacks.has(callback)) {
  193. // ...so guard against infinite loops
  194. seen_callbacks.add(callback);
  195. callback();
  196. }
  197. }
  198. render_callbacks.length = 0;
  199. } while (dirty_components.length);
  200. while (flush_callbacks.length) {
  201. flush_callbacks.pop()();
  202. }
  203. update_scheduled = false;
  204. flushing = false;
  205. seen_callbacks.clear();
  206. }
  207. function update($$) {
  208. if ($$.fragment !== null) {
  209. $$.update();
  210. run_all($$.before_update);
  211. var dirty = $$.dirty;
  212. $$.dirty = [-1];
  213. $$.fragment && $$.fragment.p($$.ctx, dirty);
  214. $$.after_update.forEach(add_render_callback);
  215. }
  216. }
  217. var outroing = new Set();
  218. function transition_in(block, local) {
  219. if (block && block.i) {
  220. outroing["delete"](block);
  221. block.i(local);
  222. }
  223. }
  224. function mount_component(component, target, anchor) {
  225. var _component$$$ = component.$$,
  226. fragment = _component$$$.fragment,
  227. on_mount = _component$$$.on_mount,
  228. on_destroy = _component$$$.on_destroy,
  229. after_update = _component$$$.after_update;
  230. fragment && fragment.m(target, anchor); // onMount happens before the initial afterUpdate
  231. add_render_callback(function () {
  232. var new_on_destroy = on_mount.map(run).filter(is_function);
  233. if (on_destroy) {
  234. on_destroy.push.apply(on_destroy, _toConsumableArray(new_on_destroy));
  235. } else {
  236. // Edge case - component was destroyed immediately,
  237. // most likely as a result of a binding initialising
  238. run_all(new_on_destroy);
  239. }
  240. component.$$.on_mount = [];
  241. });
  242. after_update.forEach(add_render_callback);
  243. }
  244. function destroy_component(component, detaching) {
  245. var $$ = component.$$;
  246. if ($$.fragment !== null) {
  247. run_all($$.on_destroy);
  248. $$.fragment && $$.fragment.d(detaching); // TODO null out other refs, including component.$$ (but need to
  249. // preserve final state?)
  250. $$.on_destroy = $$.fragment = null;
  251. $$.ctx = [];
  252. }
  253. }
  254. function make_dirty(component, i) {
  255. if (component.$$.dirty[0] === -1) {
  256. dirty_components.push(component);
  257. schedule_update();
  258. component.$$.dirty.fill(0);
  259. }
  260. component.$$.dirty[i / 31 | 0] |= 1 << i % 31;
  261. }
  262. function init(component, options, instance, create_fragment, not_equal, props) {
  263. var dirty = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : [-1];
  264. var parent_component = current_component;
  265. set_current_component(component);
  266. var prop_values = options.props || {};
  267. var $$ = component.$$ = {
  268. fragment: null,
  269. ctx: null,
  270. // state
  271. props: props,
  272. update: noop,
  273. not_equal: not_equal,
  274. bound: blank_object(),
  275. // lifecycle
  276. on_mount: [],
  277. on_destroy: [],
  278. before_update: [],
  279. after_update: [],
  280. context: new Map(parent_component ? parent_component.$$.context : []),
  281. // everything else
  282. callbacks: blank_object(),
  283. dirty: dirty,
  284. skip_bound: false
  285. };
  286. var ready = false;
  287. $$.ctx = instance ? instance(component, prop_values, function (i, ret) {
  288. var value = (arguments.length <= 2 ? 0 : arguments.length - 2) ? arguments.length <= 2 ? undefined : arguments[2] : ret;
  289. if ($$.ctx && not_equal($$.ctx[i], $$.ctx[i] = value)) {
  290. if (!$$.skip_bound && $$.bound[i]) $$.bound[i](value);
  291. if (ready) make_dirty(component, i);
  292. }
  293. return ret;
  294. }) : [];
  295. $$.update();
  296. ready = true;
  297. run_all($$.before_update); // `false` as a special case of no DOM component
  298. $$.fragment = create_fragment ? create_fragment($$.ctx) : false;
  299. if (options.target) {
  300. if (options.hydrate) {
  301. var nodes = children(options.target); // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
  302. $$.fragment && $$.fragment.l(nodes);
  303. nodes.forEach(detach);
  304. } else {
  305. // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
  306. $$.fragment && $$.fragment.c();
  307. }
  308. if (options.intro) transition_in(component.$$.fragment);
  309. mount_component(component, options.target, options.anchor);
  310. flush();
  311. }
  312. set_current_component(parent_component);
  313. }
  314. var SvelteComponent = /*#__PURE__*/function () {
  315. function SvelteComponent() {
  316. _classCallCheck(this, SvelteComponent);
  317. }
  318. _createClass(SvelteComponent, [{
  319. key: "$destroy",
  320. value: function $destroy() {
  321. destroy_component(this, 1);
  322. this.$destroy = noop;
  323. }
  324. }, {
  325. key: "$on",
  326. value: function $on(type, callback) {
  327. var callbacks = this.$$.callbacks[type] || (this.$$.callbacks[type] = []);
  328. callbacks.push(callback);
  329. return function () {
  330. var index = callbacks.indexOf(callback);
  331. if (index !== -1) callbacks.splice(index, 1);
  332. };
  333. }
  334. }, {
  335. key: "$set",
  336. value: function $set($$props) {
  337. if (this.$$set && !is_empty($$props)) {
  338. this.$$.skip_bound = true;
  339. this.$$set($$props);
  340. this.$$.skip_bound = false;
  341. }
  342. }
  343. }]);
  344. return SvelteComponent;
  345. }();
  346. var position = "PrependContainer";
  347. var defaults = {
  348. fallback: true,
  349. icon: null,
  350. tag: null,
  351. title: null,
  352. text: null,
  353. options: {}
  354. };
  355. function requestPermission() {
  356. if (typeof Notification !== "undefined" && "requestPermission" in Notification) {
  357. Notification.requestPermission();
  358. } else if ("webkitNotifications" in window) {
  359. window.webkitNotifications.requestPermission();
  360. }
  361. }
  362. var Notification = window.Notification;
  363. var _notify = function notify(title, options, onclick, onclose) {
  364. // Memoize based on feature detection.
  365. if ("Notification" in window) {
  366. _notify = function notify(title, options, onclick, onclose) {
  367. var notice = new Notification(title, options);
  368. if ("NotificationEvent" in window) {
  369. notice.addEventListener("notificationclick", onclick);
  370. notice.addEventListener("close", onclose);
  371. } else if ("addEventListener" in notice) {
  372. notice.addEventListener("click", onclick);
  373. notice.addEventListener("close", onclose);
  374. } else {
  375. notice.onclick = onclick;
  376. notice.onclose = onclose;
  377. }
  378. return notice;
  379. };
  380. } else if ("mozNotification" in navigator) {
  381. _notify = function notify(title, options, onclick, onclose) {
  382. // Gecko < 22
  383. var notice = navigator.mozNotification.createNotification(title, options.body, options.icon).show();
  384. notice.onclick = onclick;
  385. notice.onclose = onclose;
  386. return notice;
  387. };
  388. } else if ("webkitNotifications" in window) {
  389. _notify = function notify(title, options, onclick, onclose) {
  390. var notice = window.webkitNotifications.createNotification(options.icon, title, options.body);
  391. notice.onclick = onclick;
  392. notice.onclose = onclose;
  393. return notice;
  394. };
  395. } else {
  396. _notify = function notify(title, options, onclick, onclose) {
  397. return null;
  398. };
  399. }
  400. return _notify(title, options, onclick, onclose);
  401. };
  402. function checkPermission() {
  403. if (typeof Notification !== "undefined" && "permission" in Notification) {
  404. return Notification.permission === "granted";
  405. } else if ("webkitNotifications" in window) {
  406. return window.webkitNotifications.checkPermission() == 0;
  407. }
  408. return false;
  409. }
  410. var _permission = checkPermission();
  411. function instance($$self, $$props, $$invalidate) {
  412. var _$$props$self = $$props.self,
  413. self = _$$props$self === void 0 ? null : _$$props$self;
  414. var _$$props$fallback = $$props.fallback,
  415. fallback = _$$props$fallback === void 0 ? defaults.fallback : _$$props$fallback;
  416. var _$$props$icon = $$props.icon,
  417. icon = _$$props$icon === void 0 ? defaults.icon : _$$props$icon;
  418. var _$$props$tag = $$props.tag,
  419. tag = _$$props$tag === void 0 ? defaults.tag : _$$props$tag;
  420. var _$$props$title = $$props.title,
  421. title = _$$props$title === void 0 ? defaults.title : _$$props$title;
  422. var _$$props$text = $$props.text,
  423. text = _$$props$text === void 0 ? defaults.text : _$$props$text;
  424. var _$$props$options = $$props.options,
  425. options = _$$props$options === void 0 ? defaults.options : _$$props$options;
  426. var _desktop; // Animation should always be 'none' for desktop notices, but remember
  427. // the old animation so it can be recovered.
  428. var _oldAnimation = "none";
  429. var _icon;
  430. var _tag;
  431. self.on("pnotify:beforeOpen", function () {
  432. if (!_permission) {
  433. requestPermission();
  434. return;
  435. }
  436. if (_desktop && "show" in _desktop) {
  437. self.setModuleOpen(true);
  438. _desktop.show();
  439. }
  440. });
  441. self.on("pnotify:beforeClose", function () {
  442. if (!_permission) {
  443. return;
  444. }
  445. if (_desktop && "close" in _desktop) {
  446. _desktop.close();
  447. self.setModuleOpen(false);
  448. }
  449. });
  450. _permission = checkPermission();
  451. if (_permission) {
  452. self.addModuleClass("elem", "pnotify-desktop-hide");
  453. self.animation = "none";
  454. genNotice();
  455. } else if (!fallback) {
  456. // Keep the notice from opening if fallback is false.
  457. self.autoOpen = false;
  458. }
  459. function genNotice() {
  460. if (icon === null) {
  461. switch (self.type) {
  462. case "error":
  463. _icon = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3gQJATQg7e6HvQAAAB1pVFh0Q29tbWVudAAAAAAAQ3JlYXRlZCB3aXRoIEdJTVBkLmUHAAABr0lEQVRYw8WXu0oDQRSGv7hRSFYrLTTWKihaqUgUJO+gphBLL1jYpPSCVcAggpWthYhC7Ows9An0IbSPkMRCw8ZmFuI6yczs9cAPuzNz5v92brtrESxGARtokkCcAg2hk7jNl4G2R/m4zFPAiwTgWdRFHnmJuaulOAAaPQDqUZvv9DB3tR0lwIcGwHtU5uca5q4qYZvngJbHpAZ8CtU8dS1gLEyAisegBGTFKWiL65KnzVlY5uOSId6VtNuTtMupOu/TAHiQlNmSskHNXCOAGWBeUp7VhFoApoMAXAOWJoCszBJ9+ALY6vL0JiPgjsKmKUAaOOoBZwIAcNxlJLsCrAOTIQJMAWu62y4LOIqT7lGS96TIcYCMDkBZ46h1gB+PHI28ssq8X/G6DaqG8Piz2DrjVjGXbtSBy46F5QAHwJAizwZugKKscs7gSaqS/KpB/qxsFxwafhf6Odb/eblJi8BGwJdW26BtURxQpMU83hmaDQsNiPtvYMSwj3tgAqDgYzU7wJdHjo9+CgBvEW47lV5Tgj5DMtG0xIfESkIAF+522gdWxTzGEX3i9+6KpOMXF5UBt0NKJCAAAAAASUVORK5CYII=";
  464. break;
  465. case "success":
  466. _icon = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3gQJATQPRj+65AAAAdBJREFUWMPtlzsvRFEQx3+7HmEjoiYKolVJJDRqnS8ggvVIVEQhCIUsEYJGCEH2E4h4FPREaLTbEo1IEJXHrmY2GTf33nPuY7ud5OTenTMz//89Z86ZWShLWf5LB3AOfACFiOMF2AkC3qOc88BXxFEAxlX8ftGdaNCEen8H6oFHYBR4FocwkpTngzzHgF01fwL0aYcp9fVtMW/rsMcWXWijK1Hexgye9smRT6CxaHgjytMYwccNSXqoja9FeVbiZS+OVaeDiUBLAPAJA/i2m5MXgRSQk7llC/DBMOBeBGqAe0eAjQhfvurH3EmgQk6EW6CVEHt+ZFo6J4EU8OoTcF35jhnAl2wSx20LFgyB1yyOWtY2c72ScMAAkPeZy6g4zUBdGAIAcyEq4Z7y7xbdTFgCACMBwPVJqVDHeNqvaplkH5i0sNuUwmaNkQxww20ZSOy7gFvX7SAk0i76jPQQlJoAwAEwq35ngfmwVatSdUMArZZ+K9JQ1Bp6iGqgSt7f/AIOqSzujLEn6AV+JG6zm4HuCZ+AJuAbWAQu5aIJu7JDck0ngDugC/j1c2qPqR13jpxuvWyS8liY/kQcean/lX6ACQ99DdAQYe+Lf0zylMUgf7qDKgzv284QAAAAAElFTkSuQmCC";
  467. break;
  468. case "info":
  469. _icon = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3gQJATQ09zRTwAAAAdxJREFUWMPtl88rRFEUxz8zBolRCgsrpOym8TMSO2WplLKwUrKi/B0W7JSFmhVLNlhSlLKx8CtRGpEsJpofpZk3Nkc9b968e++8mdlw6vTeu/edc773nl/3wl+ngOH/zUAf0AN0AmEgB7wCD8AtcFMJoM3ADpAHLHk62RIwL8B0uQwHgXVRnDfkS2DSj/EW4K0Ew05eLMV4O/CuUJwEUvJUgdgwMd4IpBUKl13kVG6aL+ZjJ20DDQqQXy5jKYVMDBhVrb5f069LLrKfGnInqh040HRTvsTAHgei9oGQ7X0YaNNUNCdFKChgQvKtQ1vAkNvEahlSToez9oXad2BCA30ceHZxRxMQMShuvZLmv+hOA32/h+KUwS7MugVhqwb6Go+5nEEwht0ABDUEzyXdFsrQYwqMJjTbdxio9Qkg6QbgvkpnkLw0uQIAZ1UCYNkXawdw4qPCmVBcuADAMZCpAoCVYr3AKtYyHZSWauakjMx50TWwrzJw6lFARjQOt3se8jM6W9TloSCqIb9bRHbN5Fg+KkEZcow/Ak+KFBsD6h3jR8CUabAMlqn7xfxEbAdwWKLhhO3sGPCbOsNSvSyF0Z/5TaCuEleziLhmAOiWG1NWrmZXwIVU1A/+SZO+AcgLC4wt0zD3AAAAAElFTkSuQmCC";
  470. break;
  471. case "notice":
  472. default:
  473. _icon = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3gQJATM4scOJLAAAAcxJREFUWMPtljtLA0EQx3+J0QRfnYqCiCA+MERBrIwgFtoFbMTOR61i5QcQBdEihZWNoEWwsNAvkMJeBLHRQtHC0iIP4utOmw2cx97d7l2SRgcGbufmv/Pf2dmdhb8uIR+YJqAPaBff30AeeAHuxLgqMgRkgS/AAEybGuLfEdBcycCTwKVYmY5mgO6gwdd8BLaqAST9Bs8EDG7VTd3gex4TbgEjwKjQOHDugZlRDb7sMZEJpCS4bYVMJOygsG1cB+wqHN0Gib1RYXFpLwL74nx7Sb3EFlXATQNjTgRagA3FbZIRiCliT5wITGgUaRACA0CPjMC4xtUcDUAgDAzLCCQ0MhALQCAE9MoIdGkQCJIBgE4ZgWiNMvDL10qgUMMMFGQEnjQmkLXbVg38s8y4qtFcTCAnHiJ5oKiJnSoHjVgIXAmHkGIl5yy+YcWruIy9dvqpupIDCfZWEXvh1gsWFVfxIbG9a3RbRwJnYiuqJYfAqxsBgBWFiQyJzfTAlIB1uzEicbwBFoBTl8lSwINoSuXKjrv4F4FBh61zlKUKvgn7/e5ZEngMEDgLdFSieHaAT42LpgTMVbqC24B54Bi4twV9E6cnDcw6PFj+RSo/l6rlSlldhx4AAAAASUVORK5CYII=";
  474. break;
  475. }
  476. } else if (icon === false) {
  477. _icon = null;
  478. } else {
  479. _icon = icon;
  480. }
  481. if (!_tag || tag !== null) {
  482. _tag = tag === null ? "PNotify-".concat(Math.round(Math.random() * 1000000)) : tag;
  483. }
  484. var desktopOptions = {
  485. body: text || self.text,
  486. tag: _tag
  487. };
  488. if (!self.hide) {
  489. desktopOptions.requireInteraction = true;
  490. }
  491. if (_icon !== null) {
  492. desktopOptions.icon = _icon;
  493. }
  494. Object.apply(desktopOptions, options);
  495. _desktop = _notify(title || self.title, desktopOptions, function () {
  496. self.fire && self.fire("click", {
  497. target: _desktop
  498. });
  499. }, function () {
  500. self.close && self.close();
  501. });
  502. if (!("close" in _desktop) && "cancel" in _desktop) {
  503. _desktop.close = function () {
  504. _desktop.cancel();
  505. };
  506. }
  507. }
  508. $$self.$$set = function ($$props) {
  509. if ("self" in $$props) $$invalidate(0, self = $$props.self);
  510. if ("fallback" in $$props) $$invalidate(1, fallback = $$props.fallback);
  511. if ("icon" in $$props) $$invalidate(2, icon = $$props.icon);
  512. if ("tag" in $$props) $$invalidate(3, tag = $$props.tag);
  513. if ("title" in $$props) $$invalidate(4, title = $$props.title);
  514. if ("text" in $$props) $$invalidate(5, text = $$props.text);
  515. if ("options" in $$props) $$invalidate(6, options = $$props.options);
  516. };
  517. $$self.$$.update = function () {
  518. if ($$self.$$.dirty &
  519. /*self, _permission, _oldAnimation*/
  520. 257) {
  521. {
  522. if (self.animation !== "none") {
  523. $$invalidate(8, _oldAnimation = self.animation);
  524. } // This is necessary so desktop notices don't cause spacing problems
  525. // when positioning.
  526. if (self.getAnimatingClass() !== "" && _permission) {
  527. self.setAnimatingClass("");
  528. }
  529. if (!_permission && self.hasModuleClass("elem", "pnotify-desktop-hide")) {
  530. self.removeModuleClass("elem", "pnotify-desktop-hide");
  531. $$invalidate(0, self.animation = _oldAnimation, self);
  532. } else if (_permission && !self.hasModuleClass("elem", "pnotify-desktop-hide")) {
  533. self.addModuleClass("elem", "pnotify-desktop-hide");
  534. $$invalidate(0, self.animation = "none", self);
  535. genNotice();
  536. }
  537. }
  538. }
  539. if ($$self.$$.dirty &
  540. /*self, _permission*/
  541. 1) {
  542. {
  543. self.setModuleHandled(_permission);
  544. }
  545. }
  546. };
  547. return [self, fallback, icon, tag, title, text, options];
  548. }
  549. var Desktop = /*#__PURE__*/function (_SvelteComponent) {
  550. _inherits(Desktop, _SvelteComponent);
  551. var _super = _createSuper(Desktop);
  552. function Desktop(options) {
  553. var _this;
  554. _classCallCheck(this, Desktop);
  555. _this = _super.call(this);
  556. init(_assertThisInitialized(_this), options, instance, null, safe_not_equal, {
  557. self: 0,
  558. fallback: 1,
  559. icon: 2,
  560. tag: 3,
  561. title: 4,
  562. text: 5,
  563. options: 6
  564. });
  565. return _this;
  566. }
  567. return Desktop;
  568. }(SvelteComponent);
  569. exports.default = Desktop;
  570. exports.defaults = defaults;
  571. exports.permission = requestPermission;
  572. exports.position = position;
  573. Object.defineProperty(exports, '__esModule', { value: true });
  574. })));