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.

548 lines
16 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.PNotifyFontAwesome5Fix = {}));
  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. function get_current_component() {
  156. if (!current_component) throw new Error('Function called outside component initialization');
  157. return current_component;
  158. }
  159. function onDestroy(fn) {
  160. get_current_component().$$.on_destroy.push(fn);
  161. }
  162. var dirty_components = [];
  163. var binding_callbacks = [];
  164. var render_callbacks = [];
  165. var flush_callbacks = [];
  166. var resolved_promise = Promise.resolve();
  167. var update_scheduled = false;
  168. function schedule_update() {
  169. if (!update_scheduled) {
  170. update_scheduled = true;
  171. resolved_promise.then(flush);
  172. }
  173. }
  174. function tick() {
  175. schedule_update();
  176. return resolved_promise;
  177. }
  178. function add_render_callback(fn) {
  179. render_callbacks.push(fn);
  180. }
  181. var flushing = false;
  182. var seen_callbacks = new Set();
  183. function flush() {
  184. if (flushing) return;
  185. flushing = true;
  186. do {
  187. // first, call beforeUpdate functions
  188. // and update components
  189. for (var i = 0; i < dirty_components.length; i += 1) {
  190. var component = dirty_components[i];
  191. set_current_component(component);
  192. update(component.$$);
  193. }
  194. set_current_component(null);
  195. dirty_components.length = 0;
  196. while (binding_callbacks.length) {
  197. binding_callbacks.pop()();
  198. } // then, once components are updated, call
  199. // afterUpdate functions. This may cause
  200. // subsequent updates...
  201. for (var _i = 0; _i < render_callbacks.length; _i += 1) {
  202. var callback = render_callbacks[_i];
  203. if (!seen_callbacks.has(callback)) {
  204. // ...so guard against infinite loops
  205. seen_callbacks.add(callback);
  206. callback();
  207. }
  208. }
  209. render_callbacks.length = 0;
  210. } while (dirty_components.length);
  211. while (flush_callbacks.length) {
  212. flush_callbacks.pop()();
  213. }
  214. update_scheduled = false;
  215. flushing = false;
  216. seen_callbacks.clear();
  217. }
  218. function update($$) {
  219. if ($$.fragment !== null) {
  220. $$.update();
  221. run_all($$.before_update);
  222. var dirty = $$.dirty;
  223. $$.dirty = [-1];
  224. $$.fragment && $$.fragment.p($$.ctx, dirty);
  225. $$.after_update.forEach(add_render_callback);
  226. }
  227. }
  228. var outroing = new Set();
  229. function transition_in(block, local) {
  230. if (block && block.i) {
  231. outroing["delete"](block);
  232. block.i(local);
  233. }
  234. }
  235. function mount_component(component, target, anchor) {
  236. var _component$$$ = component.$$,
  237. fragment = _component$$$.fragment,
  238. on_mount = _component$$$.on_mount,
  239. on_destroy = _component$$$.on_destroy,
  240. after_update = _component$$$.after_update;
  241. fragment && fragment.m(target, anchor); // onMount happens before the initial afterUpdate
  242. add_render_callback(function () {
  243. var new_on_destroy = on_mount.map(run).filter(is_function);
  244. if (on_destroy) {
  245. on_destroy.push.apply(on_destroy, _toConsumableArray(new_on_destroy));
  246. } else {
  247. // Edge case - component was destroyed immediately,
  248. // most likely as a result of a binding initialising
  249. run_all(new_on_destroy);
  250. }
  251. component.$$.on_mount = [];
  252. });
  253. after_update.forEach(add_render_callback);
  254. }
  255. function destroy_component(component, detaching) {
  256. var $$ = component.$$;
  257. if ($$.fragment !== null) {
  258. run_all($$.on_destroy);
  259. $$.fragment && $$.fragment.d(detaching); // TODO null out other refs, including component.$$ (but need to
  260. // preserve final state?)
  261. $$.on_destroy = $$.fragment = null;
  262. $$.ctx = [];
  263. }
  264. }
  265. function make_dirty(component, i) {
  266. if (component.$$.dirty[0] === -1) {
  267. dirty_components.push(component);
  268. schedule_update();
  269. component.$$.dirty.fill(0);
  270. }
  271. component.$$.dirty[i / 31 | 0] |= 1 << i % 31;
  272. }
  273. function init(component, options, instance, create_fragment, not_equal, props) {
  274. var dirty = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : [-1];
  275. var parent_component = current_component;
  276. set_current_component(component);
  277. var prop_values = options.props || {};
  278. var $$ = component.$$ = {
  279. fragment: null,
  280. ctx: null,
  281. // state
  282. props: props,
  283. update: noop,
  284. not_equal: not_equal,
  285. bound: blank_object(),
  286. // lifecycle
  287. on_mount: [],
  288. on_destroy: [],
  289. before_update: [],
  290. after_update: [],
  291. context: new Map(parent_component ? parent_component.$$.context : []),
  292. // everything else
  293. callbacks: blank_object(),
  294. dirty: dirty,
  295. skip_bound: false
  296. };
  297. var ready = false;
  298. $$.ctx = instance ? instance(component, prop_values, function (i, ret) {
  299. var value = (arguments.length <= 2 ? 0 : arguments.length - 2) ? arguments.length <= 2 ? undefined : arguments[2] : ret;
  300. if ($$.ctx && not_equal($$.ctx[i], $$.ctx[i] = value)) {
  301. if (!$$.skip_bound && $$.bound[i]) $$.bound[i](value);
  302. if (ready) make_dirty(component, i);
  303. }
  304. return ret;
  305. }) : [];
  306. $$.update();
  307. ready = true;
  308. run_all($$.before_update); // `false` as a special case of no DOM component
  309. $$.fragment = create_fragment ? create_fragment($$.ctx) : false;
  310. if (options.target) {
  311. if (options.hydrate) {
  312. var nodes = children(options.target); // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
  313. $$.fragment && $$.fragment.l(nodes);
  314. nodes.forEach(detach);
  315. } else {
  316. // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
  317. $$.fragment && $$.fragment.c();
  318. }
  319. if (options.intro) transition_in(component.$$.fragment);
  320. mount_component(component, options.target, options.anchor);
  321. flush();
  322. }
  323. set_current_component(parent_component);
  324. }
  325. var SvelteComponent = /*#__PURE__*/function () {
  326. function SvelteComponent() {
  327. _classCallCheck(this, SvelteComponent);
  328. }
  329. _createClass(SvelteComponent, [{
  330. key: "$destroy",
  331. value: function $destroy() {
  332. destroy_component(this, 1);
  333. this.$destroy = noop;
  334. }
  335. }, {
  336. key: "$on",
  337. value: function $on(type, callback) {
  338. var callbacks = this.$$.callbacks[type] || (this.$$.callbacks[type] = []);
  339. callbacks.push(callback);
  340. return function () {
  341. var index = callbacks.indexOf(callback);
  342. if (index !== -1) callbacks.splice(index, 1);
  343. };
  344. }
  345. }, {
  346. key: "$set",
  347. value: function $set($$props) {
  348. if (this.$$set && !is_empty($$props)) {
  349. this.$$.skip_bound = true;
  350. this.$$set($$props);
  351. this.$$.skip_bound = false;
  352. }
  353. }
  354. }]);
  355. return SvelteComponent;
  356. }();
  357. var position = "PrependContainer";
  358. var defaults = {};
  359. function instance($$self, $$props, $$invalidate) {
  360. var _$$props$self = $$props.self,
  361. self = _$$props$self === void 0 ? null : _$$props$self; // This keeps the beforeUpdate handler from going into a loop when we're
  362. // taming Font Awesome's magic.
  363. var _updatingIcon = false;
  364. var _updatingSticker = false; // Save the old value of icon, so we can do our magic.
  365. var _oldIconProp = self.icon;
  366. var _oldIconValue = self.icon === true ? self.getIcon(self.type) : self.icon;
  367. var _oldSticker = "".concat(self.getIcon("sticker"), " ").concat(self.hide ? self.getIcon("unstuck") : self.getIcon("stuck"));
  368. var newIconProp;
  369. var newIconValue;
  370. var newSticker;
  371. var removeIconHandler = self.on("pnotify:update", function () {
  372. if (_updatingIcon) {
  373. return;
  374. } // Font Awesome 5 uses dark magic by replacing the icon element with an SVG.
  375. // In order to make it play nice with Svelte, we have to clear the element
  376. // and make it again.
  377. newIconProp = self.icon;
  378. newIconValue = self.icon === true ? self.getIcon(self.type) : self.icon;
  379. if (newIconValue !== _oldIconValue && (typeof newIconValue === "string" && newIconValue.match(/(^| )fa[srlb]($| )/) || typeof _oldIconValue === "string" && _oldIconValue.match(/(^| )fa[srlb]($| )/))) {
  380. $$invalidate(0, self.icon = false, self);
  381. _updatingIcon = true;
  382. tick().then(function () {
  383. $$invalidate(0, self.icon = newIconProp, self);
  384. _updatingIcon = false; // Update seved icon.
  385. _oldIconProp = newIconProp;
  386. _oldIconValue = newIconValue;
  387. });
  388. } else {
  389. // Update seved icon.
  390. _oldIconProp = newIconProp;
  391. _oldIconValue = newIconValue;
  392. }
  393. });
  394. var removeStickerHandler = self.on("pnotify:update", function () {
  395. if (_updatingSticker) {
  396. return;
  397. } // Font Awesome 5 uses dark magic by replacing the icon element with an SVG.
  398. // In order to make it play nice with Svelte, we have to clear the element
  399. // and make it again.
  400. newSticker = "".concat(self.getIcon("sticker"), " ").concat(self.hide ? self.getIcon("unstuck") : self.getIcon("stuck"));
  401. if (self.sticker && newSticker !== _oldSticker && typeof newSticker === "string" && newSticker.match(/(^| )fa[srlb]($| )/)) {
  402. $$invalidate(0, self.sticker = false, self);
  403. _updatingSticker = true;
  404. tick().then(function () {
  405. $$invalidate(0, self.sticker = true, self);
  406. _updatingSticker = false; // Update seved icon.
  407. _oldSticker = newSticker;
  408. });
  409. } else {
  410. // Update seved icon.
  411. _oldSticker = newSticker;
  412. }
  413. });
  414. onDestroy(function () {
  415. removeIconHandler && removeIconHandler();
  416. removeStickerHandler && removeStickerHandler();
  417. });
  418. $$self.$$set = function ($$props) {
  419. if ("self" in $$props) $$invalidate(0, self = $$props.self);
  420. };
  421. return [self];
  422. }
  423. var Font_awesome5_fix = /*#__PURE__*/function (_SvelteComponent) {
  424. _inherits(Font_awesome5_fix, _SvelteComponent);
  425. var _super = _createSuper(Font_awesome5_fix);
  426. function Font_awesome5_fix(options) {
  427. var _this;
  428. _classCallCheck(this, Font_awesome5_fix);
  429. _this = _super.call(this);
  430. init(_assertThisInitialized(_this), options, instance, null, safe_not_equal, {
  431. self: 0
  432. });
  433. return _this;
  434. }
  435. return Font_awesome5_fix;
  436. }(SvelteComponent);
  437. exports.default = Font_awesome5_fix;
  438. exports.defaults = defaults;
  439. exports.position = position;
  440. Object.defineProperty(exports, '__esModule', { value: true });
  441. })));