pixelfed/public/js/vendor.js

2 lines
2.3 MiB
JavaScript
Raw Normal View History

2022-02-18 05:31:41 +00:00
/*! For license information please see vendor.js.LICENSE.txt */
(self.webpackChunkpixelfed=self.webpackChunkpixelfed||[]).push([[898],{29655:(e,t,n)=>{"use strict";function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}n.r(t),n.d(t,{default:()=>g});var s=function(e,t){return e.matches?e.matches(t):e.msMatchesSelector?e.msMatchesSelector(t):e.webkitMatchesSelector?e.webkitMatchesSelector(t):null},l=function(e,t){return e.closest?e.closest(t):function(e,t){for(var n=e;n&&1===n.nodeType;){if(s(n,t))return n;n=n.parentNode}return null}(e,t)},c=function(e){return Boolean(e&&"function"==typeof e.then)},u=function e(){var t=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=n.search,i=n.autoSelect,s=void 0!==i&&i,u=n.setValue,d=void 0===u?function(){}:u,h=n.setAttribute,p=void 0===h?function(){}:h,f=n.onUpdate,m=void 0===f?function(){}:f,v=n.onSubmit,g=void 0===v?function(){}:v,_=n.onShow,b=void 0===_?function(){}:_,y=n.onHide,M=void 0===y?function(){}:y,I=n.onLoading,B=void 0===I?function(){}:I,k=n.onLoaded,P=void 0===k?function(){}:k;a(this,e),r(this,"value",""),r(this,"searchCounter",0),r(this,"results",[]),r(this,"selectedIndex",-1),r(this,"handleInput",(function(e){var n=e.target.value;t.updateResults(n),t.value=n})),r(this,"handleKeyDown",(function(e){var n=e.key;switch(n){case"Up":case"Down":case"ArrowUp":case"ArrowDown":var a="ArrowUp"===n||"Up"===n?t.selectedIndex-1:t.selectedIndex+1;e.preventDefault(),t.handleArrows(a);break;case"Tab":t.selectResult();break;case"Enter":var r=t.results[t.selectedIndex];t.selectResult(),t.onSubmit(r);break;case"Esc":case"Escape":t.hideResults(),t.setValue();break;default:return}})),r(this,"handleFocus",(function(e){var n=e.target.value;t.updateResults(n),t.value=n})),r(this,"handleBlur",(function(){t.hideResults()})),r(this,"handleResultMouseDown",(function(e){e.preventDefault()})),r(this,"handleResultClick",(function(e){var n=e.target,a=l(n,"[data-result-index]");if(a){t.selectedIndex=parseInt(a.dataset.resultIndex,10);var r=t.results[t.selectedIndex];t.selectResult(),t.onSubmit(r)}})),r(this,"handleArrows",(function(e){var n=t.results.length;t.selectedIndex=(e%n+n)%n,t.onUpdate(t.results,t.selectedIndex)})),r(this,"selectResult",(function(){var e=t.results[t.selectedIndex];e&&t.setValue(e),t.hideResults()})),r(this,"updateResults",(function(e){var n=++t.searchCounter;t.onLoading(),t.search(e).then((function(e){n===t.searchCounter&&(t.results=e,t.onLoaded(),0!==t.results.length?(t.selectedIndex=t.autoSelect?0:-1,t.onUpdate(t.results,t.selectedIndex),t.showResults()):t.hideResults())}))})),r(this,"showResults",(function(){t.setAttribute("aria-expanded",!0),t.onShow()})),r(this,"hideResults",(function(){t.selectedIndex=-1,t.results=[],t.setAttribute("aria-expanded",!1),t.setAttribute("aria-activedescendant",""),t.onUpdate(t.results,t.selectedIndex),t.onHide()})),r(this,"checkSelectedResultVisible",(function(e){var n=e.querySelector('[data-result-index="'.concat(t.selectedIndex,'"]'));if(n){var a=e.getBoundingClientRect(),r=n.getBoundingClientRect();r.top<a.top?e.scrollTop-=a.top-r.top:r.bottom>a.bottom&&(e.scrollTop+=r.bottom-a.bottom)}})),this.search=c(o)?o:function(e){return Promise.resolve(o(e))},this.autoSelect=s,this.setValue=d,this.setAttribute=p,this.onUpdate=m,this.onSubmit=g,this.onShow=b,this.onHide=M,this.onLoading=B,this.onLoaded=P},d=0,h=function(){var e=arguments.length>0&&void 0!==arguments[0]?argum