{"version":3,"sources":["webpack:///./node_modules/@ionic/core/dist/esm/legacy/ion-infinite-scroll_2-ios.entry.js"],"names":[],"mappings":";;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAiC;AAC4H;AAC3G;AACW;AAC7D;AACA;AACA;AACA,QAAQ,4DAAgB;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,4DAAW;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,+CAAiB;AAChC;AACA;AACA,mBAAmB,iDAAmB;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,4DAAS;AACrC;AACA;AACA;AACA,6BAA6B;AAC7B;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,+CAAiB;AAChC;AACA;AACA,mBAAmB,iDAAmB;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,4DAAQ;AAChC;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC,4DAAS;AACzC;AACA;AACA,iCAAiC;AACjC,6BAA6B;AAC7B,yBAAyB;AAC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;AACz8C;AACA;AACA,KAAK;AACL;AACA,CAAC;AACsG","file":"39.js","sourcesContent":["import * as tslib_1 from \"tslib\";\nimport { r as registerInstance, d as createEvent, w as writeTask, f as readTask, c as getIonMode, h, e as getElement, H as Host } from './chunk-09ec7fc0.js';\nimport { b as config } from './chunk-1074393c.js';\nimport { s as sanitizeDOMString } from './chunk-cae2ca23.js';\nvar InfiniteScroll = /** @class */ (function () {\n function InfiniteScroll(hostRef) {\n var _this = this;\n registerInstance(this, hostRef);\n this.thrPx = 0;\n this.thrPc = 0;\n this.didFire = false;\n this.isBusy = false;\n this.isLoading = false;\n /**\n * The threshold distance from the bottom\n * of the content to call the `infinite` output event when scrolled.\n * The threshold value can be either a percent, or\n * in pixels. For example, use the value of `10%` for the `infinite`\n * output event to get called when the user has scrolled 10%\n * from the bottom of the page. Use the value `100px` when the\n * scroll is within 100 pixels from the bottom of the page.\n */\n this.threshold = '15%';\n /**\n * If `true`, the infinite scroll will be hidden and scroll event listeners\n * will be removed.\n *\n * Set this to true to disable the infinite scroll from actively\n * trying to receive new data while scrolling. This is useful\n * when it is known that there is no more data that can be added, and\n * the infinite scroll is no longer needed.\n */\n this.disabled = false;\n /**\n * The position of the infinite scroll element.\n * The value can be either `top` or `bottom`.\n */\n this.position = 'bottom';\n this.onScroll = function () {\n var scrollEl = _this.scrollEl;\n if (!scrollEl || !_this.canStart()) {\n return 1;\n }\n var infiniteHeight = _this.el.offsetHeight;\n if (infiniteHeight === 0) {\n // if there is no height of this element then do nothing\n return 2;\n }\n var scrollTop = scrollEl.scrollTop;\n var scrollHeight = scrollEl.scrollHeight;\n var height = scrollEl.offsetHeight;\n var threshold = _this.thrPc !== 0 ? (height * _this.thrPc) : _this.thrPx;\n var distanceFromInfinite = (_this.position === 'bottom')\n ? scrollHeight - infiniteHeight - scrollTop - threshold - height\n : scrollTop - infiniteHeight - threshold;\n if (distanceFromInfinite < 0) {\n if (!_this.didFire) {\n _this.isLoading = true;\n _this.didFire = true;\n _this.ionInfinite.emit();\n return 3;\n }\n }\n else {\n _this.didFire = false;\n }\n return 4;\n };\n this.ionInfinite = createEvent(this, \"ionInfinite\", 7);\n }\n InfiniteScroll.prototype.thresholdChanged = function () {\n var val = this.threshold;\n if (val.lastIndexOf('%') > -1) {\n this.thrPx = 0;\n this.thrPc = (parseFloat(val) / 100);\n }\n else {\n this.thrPx = parseFloat(val);\n this.thrPc = 0;\n }\n };\n InfiniteScroll.prototype.disabledChanged = function () {\n var disabled = this.disabled;\n if (disabled) {\n this.isLoading = false;\n this.isBusy = false;\n }\n this.enableScrollEvents(!disabled);\n };\n InfiniteScroll.prototype.componentDidLoad = function () {\n return tslib_1.__awaiter(this, void 0, void 0, function () {\n var contentEl, _a;\n var _this = this;\n return tslib_1.__generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n contentEl = this.el.closest('ion-content');\n if (!contentEl) return [3 /*break*/, 3];\n return [4 /*yield*/, contentEl.componentOnReady()];\n case 1:\n _b.sent();\n _a = this;\n return [4 /*yield*/, contentEl.getScrollElement()];\n case 2:\n _a.scrollEl = _b.sent();\n _b.label = 3;\n case 3:\n this.thresholdChanged();\n this.disabledChanged();\n if (this.position === 'top') {\n writeTask(function () {\n if (_this.scrollEl) {\n _this.scrollEl.scrollTop = _this.scrollEl.scrollHeight - _this.scrollEl.clientHeight;\n }\n });\n }\n return [2 /*return*/];\n }\n });\n });\n };\n InfiniteScroll.prototype.componentDidUnload = function () {\n this.enableScrollEvents(false);\n this.scrollEl = undefined;\n };\n /**\n * Call `complete()` within the `ionInfinite` output event handler when\n * your async operation has completed. For example, the `loading`\n * state is while the app is performing an asynchronous operation,\n * such as receiving more data from an AJAX request to add more items\n * to a data list. Once the data has been received and UI updated, you\n * then call this method to signify that the loading has completed.\n * This method will change the infinite scroll's state from `loading`\n * to `enabled`.\n */\n InfiniteScroll.prototype.complete = function () {\n return tslib_1.__awaiter(this, void 0, void 0, function () {\n var scrollEl, prev_1;\n var _this = this;\n return tslib_1.__generator(this, function (_a) {\n scrollEl = this.scrollEl;\n if (!this.isLoading || !scrollEl) {\n return [2 /*return*/];\n }\n this.isLoading = false;\n if (this.position === 'top') {\n /**\n * New content is being added at the top, but the scrollTop position stays the same,\n * which causes a scroll jump visually. This algorithm makes sure to prevent this.\n * (Frame 1)\n * - complete() is called, but the UI hasn't had time to update yet.\n * - Save the current content dimensions.\n * - Wait for the next frame using _dom.read, so the UI will be updated.\n * (Frame 2)\n * - Read the new content dimensions.\n * - Calculate the height difference and the new scroll position.\n * - Delay the scroll position change until other possible dom reads are done using _dom.write to be performant.\n * (Still frame 2, if I'm correct)\n * - Change the scroll position (= visually maintain the scroll position).\n * - Change the state to re-enable the InfiniteScroll.\n * - This should be after changing the scroll position, or it could\n * cause the InfiniteScroll to be triggered again immediately.\n * (Frame 3)\n * Done.\n */\n this.isBusy = true;\n prev_1 = scrollEl.scrollHeight - scrollEl.scrollTop;\n // ******** DOM READ ****************\n requestAnimationFrame(function () {\n readTask(function () {\n // UI has updated, save the new content dimensions\n var scrollHeight = scrollEl.scrollHeight;\n // New content was added on top, so the scroll position should be changed immediately to prevent it from jumping around\n var newScrollTop = scrollHeight - prev_1;\n // ******** DOM WRITE ****************\n requestAnimationFrame(function () {\n writeTask(function () {\n scrollEl.scrollTop = newScrollTop;\n _this.isBusy = false;\n });\n });\n });\n });\n }\n return [2 /*return*/];\n });\n });\n };\n InfiniteScroll.prototype.canStart = function () {\n return (!this.disabled &&\n !this.isBusy &&\n !!this.scrollEl &&\n !this.isLoading);\n };\n InfiniteScroll.prototype.enableScrollEvents = function (shouldListen) {\n if (this.scrollEl) {\n if (shouldListen) {\n this.scrollEl.addEventListener('scroll', this.onScroll);\n }\n else {\n this.scrollEl.removeEventListener('scroll', this.onScroll);\n }\n }\n };\n InfiniteScroll.prototype.render = function () {\n var _a;\n var mode = getIonMode(this);\n var disabled = this.disabled;\n return (h(Host, { class: (_a = {},\n _a[mode] = true,\n _a['infinite-scroll-loading'] = this.isLoading,\n _a['infinite-scroll-enabled'] = !disabled,\n _a) }));\n };\n Object.defineProperty(InfiniteScroll.prototype, \"el\", {\n get: function () { return getElement(this); },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(InfiniteScroll, \"watchers\", {\n get: function () {\n return {\n \"threshold\": [\"thresholdChanged\"],\n \"disabled\": [\"disabledChanged\"]\n };\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(InfiniteScroll, \"style\", {\n get: function () { return \"ion-infinite-scroll{display:none;width:100%}.infinite-scroll-enabled{display:block}\"; },\n enumerable: true,\n configurable: true\n });\n return InfiniteScroll;\n}());\nvar InfiniteScrollContent = /** @class */ (function () {\n function InfiniteScrollContent(hostRef) {\n registerInstance(this, hostRef);\n }\n InfiniteScrollContent.prototype.componentDidLoad = function () {\n if (this.loadingSpinner === undefined) {\n var mode = getIonMode(this);\n this.loadingSpinner = config.get('infiniteLoadingSpinner', config.get('spinner', mode === 'ios' ? 'lines' : 'crescent'));\n }\n };\n InfiniteScrollContent.prototype.hostData = function () {\n var _a;\n var mode = getIonMode(this);\n return {\n class: (_a = {},\n _a[mode] = true,\n // Used internally for styling\n _a[\"infinite-scroll-content-\" + mode] = true,\n _a)\n };\n };\n InfiniteScrollContent.prototype.__stencil_render = function () {\n return (h(\"div\", { class: \"infinite-loading\" }, this.loadingSpinner && (h(\"div\", { class: \"infinite-loading-spinner\" }, h(\"ion-spinner\", { name: this.loadingSpinner }))), this.loadingText && (h(\"div\", { class: \"infinite-loading-text\", innerHTML: sanitizeDOMString(this.loadingText) }))));\n };\n InfiniteScrollContent.prototype.render = function () { return h(Host, this.hostData(), this.__stencil_render()); };\n Object.defineProperty(InfiniteScrollContent, \"style\", {\n get: function () { return \"ion-infinite-scroll-content{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-pack:center;justify-content:center;min-height:84px;text-align:center;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.infinite-loading{margin-left:0;margin-right:0;margin-top:0;margin-bottom:32px;display:none;width:100%}.infinite-loading-text{margin-left:32px;margin-right:32px;margin-top:4px;margin-bottom:0}\\@supports ((-webkit-margin-start:0) or (margin-inline-start:0)) or (-webkit-margin-start:0){.infinite-loading-text{margin-left:unset;margin-right:unset;-webkit-margin-start:32px;margin-inline-start:32px;-webkit-margin-end:32px;margin-inline-end:32px}}.infinite-scroll-loading ion-infinite-scroll-content>.infinite-loading{display:block}.infinite-scroll-content-ios .infinite-loading-text{color:var(--ion-color-step-600,#666)}.infinite-scroll-content-ios .infinite-loading-spinner .spinner-crescent circle,.infinite-scroll-content-ios .infinite-loading-spinner .spinner-lines-ios line,.infinite-scroll-content-ios .infinite-loading-spinner .spinner-lines-small-ios line{stroke:var(--ion-color-step-600,#666)}.infinite-scroll-content-ios .infinite-loading-spinner .spinner-bubbles circle,.infinite-scroll-content-ios .infinite-loading-spinner .spinner-circles circle,.infinite-scroll-content-ios .infinite-loading-spinner .spinner-dots circle{fill:var(--ion-color-step-600,#666)}\"; },\n enumerable: true,\n configurable: true\n });\n return InfiniteScrollContent;\n}());\nexport { InfiniteScroll as ion_infinite_scroll, InfiniteScrollContent as ion_infinite_scroll_content };\n"],"sourceRoot":""}