UNPKG

universalviewer

Version:

The Universal Viewer is a community-developed open source project on a mission to help you share your 📚📜📰📽️📻🗿 with the 🌎

2 lines (1 loc) 5.24 kB
import{c as E}from"./chunk-VNJCZCB4.js";var c=function(e,n,i,r){return new(i||(i=Promise))(function(l,t){function u(a){try{v(r.next(a))}catch(s){t(s)}}function d(a){try{v(r.throw(a))}catch(s){t(s)}}function v(a){a.done?l(a.value):new i(function(s){s(a.value)}).then(u,d)}v((r=r.apply(e,n||[])).next())})},o=function(e,n){var i={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1]},trys:[],ops:[]},r,l,t,u;return u={next:d(0),throw:d(1),return:d(2)},typeof Symbol=="function"&&(u[Symbol.iterator]=function(){return this}),u;function d(a){return function(s){return v([a,s])}}function v(a){if(r)throw new TypeError("Generator is already executing.");for(;i;)try{if(r=1,l&&(t=a[0]&2?l.return:a[0]?l.throw||((t=l.return)&&t.call(l),0):l.next)&&!(t=t.call(l,a[1])).done)return t;switch(l=0,t&&(a=[a[0]&2,t.value]),a[0]){case 0:case 1:t=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,l=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(t=i.trys,!(t=t.length>0&&t[t.length-1])&&(a[0]===6||a[0]===2)){i=0;continue}if(a[0]===3&&(!t||a[1]>t[0]&&a[1]<t[3])){i.label=a[1];break}if(a[0]===6&&i.label<t[1]){i.label=t[1],t=a;break}if(t&&i.label<t[2]){i.label=t[2],i.ops.push(a);break}t[2]&&i.ops.pop(),i.trys.pop();continue}a=n.call(e,i)}catch(s){a=[6,s],l=0}finally{r=t=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}},f=void 0,I="ionViewWillEnter",k="ionViewDidEnter",A="ionViewWillLeave",T="ionViewDidLeave",S="ionViewWillUnload",R=function(){return import("./ios.transition-28abd804-SDCQ3323.js")},x=function(){return import("./md.transition-93bb0365-F65P7227.js")},z=function(e){return new Promise(function(n,i){E(function(){W(e),D(e).then(function(r){r.animation&&r.animation.destroy(),b(e),n(r)},function(r){b(e),i(r)})})})},W=function(e){var n=e.enteringEl,i=e.leavingEl;B(n,i,e.direction),e.showGoBack?n.classList.add("can-go-back"):n.classList.remove("can-go-back"),w(n,!1),i&&w(i,!1)},D=function(e){return c(f,void 0,void 0,function(){var n,i;return o(this,function(r){switch(r.label){case 0:return[4,V(e)];case 1:return n=r.sent(),i=n?F(n,e):P(e),[2,i]}})})},b=function(e){var n=e.enteringEl,i=e.leavingEl;n.classList.remove("ion-page-invisible"),i!==void 0&&i.classList.remove("ion-page-invisible")},V=function(e){return c(f,void 0,void 0,function(){var n,i;return o(this,function(r){switch(r.label){case 0:return!e.leavingEl||!e.animated||e.duration===0?[2,void 0]:e.animationBuilder?[2,e.animationBuilder]:e.mode!=="ios"?[3,2]:[4,R()];case 1:return i=r.sent().iosTransitionAnimation,[3,4];case 2:return[4,x()];case 3:i=r.sent().mdTransitionAnimation,r.label=4;case 4:return n=i,[2,n]}})})},F=function(e,n){return c(f,void 0,void 0,function(){var i,r,l,t;return o(this,function(u){switch(u.label){case 0:return[4,y(n,!0)];case 1:u.sent(),u.label=2;case 2:return u.trys.push([2,5,,6]),[4,import("./index-db7d5039-SD4G6O3S.js")];case 3:return r=u.sent(),[4,r.create(e,n.baseEl,n)];case 4:return i=u.sent(),[3,6];case 5:return l=u.sent(),i=e(n.baseEl,n),[3,6];case 6:return L(n.enteringEl,n.leavingEl),[4,Y(i,n)];case 7:return t=u.sent(),n.progressCallback&&n.progressCallback(void 0),t&&C(n.enteringEl,n.leavingEl),[2,{hasCompleted:t,animation:i}]}})})},P=function(e){return c(f,void 0,void 0,function(){var n,i;return o(this,function(r){switch(r.label){case 0:return n=e.enteringEl,i=e.leavingEl,[4,y(e,!1)];case 1:return r.sent(),L(n,i),C(n,i),[2,{hasCompleted:!0}]}})})},y=function(e,n){return c(f,void 0,void 0,function(){var i,r;return o(this,function(l){switch(l.label){case 0:return i=e.deepWait!==void 0?e.deepWait:n,r=i?[m(e.enteringEl),m(e.leavingEl)]:[g(e.enteringEl),g(e.leavingEl)],[4,Promise.all(r)];case 1:return l.sent(),[4,O(e.viewIsReady,e.enteringEl)];case 2:return l.sent(),[2]}})})},O=function(e,n){return c(f,void 0,void 0,function(){return o(this,function(i){switch(i.label){case 0:return e?[4,e(n)]:[3,2];case 1:i.sent(),i.label=2;case 2:return[2]}})})},Y=function(e,n){var i=n.progressCallback,r=new Promise(function(l){e.onFinish(function(t){typeof t=="number"?l(t===1):e.hasCompleted!==void 0&&l(e.hasCompleted)})});return i?(e.progressStart(!0),i(e)):e.play(),r},L=function(e,n){h(n,A),h(e,I)},C=function(e,n){h(e,k),h(n,T)},h=function(e,n){if(e){var i=new CustomEvent(n,{bubbles:!1,cancelable:!1});e.dispatchEvent(i)}},g=function(e){return e&&e.componentOnReady?e.componentOnReady():Promise.resolve()},m=function(e){return c(f,void 0,void 0,function(){var n,i;return o(this,function(r){switch(r.label){case 0:return n=e,n?n.componentOnReady==null?[3,2]:[4,n.componentOnReady()]:[3,4];case 1:if(i=r.sent(),i!=null)return[2];r.label=2;case 2:return[4,Promise.all(Array.from(n.children).map(m))];case 3:r.sent(),r.label=4;case 4:return[2]}})})},w=function(e,n){n?(e.setAttribute("aria-hidden","true"),e.classList.add("ion-page-hidden")):(e.hidden=!1,e.removeAttribute("aria-hidden"),e.classList.remove("ion-page-hidden"))},B=function(e,n,i){e!==void 0&&(e.style.zIndex=i==="back"?"99":"101"),n!==void 0&&(n.style.zIndex="100")},G=function(e){if(e.classList.contains("ion-page"))return e;var n=e.querySelector(":scope > .ion-page, :scope > ion-nav, :scope > ion-tabs");return n||e};export{A as a,T as b,S as c,z as d,h as e,m as f,w as g,G as h};