-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path5798-es2015.70fb278cd819e419ccf2.js
1 lines (1 loc) · 11.1 KB
/
5798-es2015.70fb278cd819e419ccf2.js
1
(self.webpackChunkv2x_frontend=self.webpackChunkv2x_frontend||[]).push([[5798],{5798:function(e,t,i){"use strict";i.r(t),i.d(t,{ion_nav:function(){return u},ion_nav_link:function(){return v}});var n=i(1429),s=i(8931),o=i(7572),r=i(1444),a=i(3645),h=i(3409);class c{constructor(e,t){this.component=e,this.params=t,this.state=1}async init(e){if(this.state=2,!this.element){const t=this.component;this.element=await(0,h.a)(this.delegate,e,t,["ion-page","ion-page-invisible"],this.params)}}_destroy(){(0,r.n)(3!==this.state,"view state must be ATTACHED");const e=this.element;e&&(this.delegate?this.delegate.removeViewFromDom(e.parentElement,e):e.remove()),this.nav=void 0,this.state=3}}const l=(e,t,i)=>!!e&&e.component===t&&(0,r.s)(e.params,i),d=(e,t)=>e?e instanceof c?e:new c(e,t):null,u=class{constructor(e){(0,n.r)(this,e),this.ionNavWillLoad=(0,n.e)(this,"ionNavWillLoad",7),this.ionNavWillChange=(0,n.e)(this,"ionNavWillChange",3),this.ionNavDidChange=(0,n.e)(this,"ionNavDidChange",3),this.transInstr=[],this.animationEnabled=!0,this.useRouter=!1,this.isTransitioning=!1,this.destroyed=!1,this.views=[],this.animated=!0}swipeGestureChanged(){this.gesture&&this.gesture.enable(!0===this.swipeGesture)}rootChanged(){void 0!==this.root&&(this.useRouter||this.setRoot(this.root,this.rootParams))}componentWillLoad(){if(this.useRouter=null!==document.querySelector("ion-router")&&null===this.el.closest("[no-router]"),void 0===this.swipeGesture){const e=(0,s.b)(this);this.swipeGesture=s.c.getBoolean("swipeBackEnabled","ios"===e)}this.ionNavWillLoad.emit()}async componentDidLoad(){this.rootChanged(),this.gesture=(await i.e(8592).then(i.bind(i,2108))).createSwipeBackGesture(this.el,this.canStart.bind(this),this.onStart.bind(this),this.onMove.bind(this),this.onEnd.bind(this)),this.swipeGestureChanged()}connectedCallback(){this.destroyed=!1}disconnectedCallback(){for(const e of this.views)(0,a.l)(e.element,a.d),e._destroy();this.gesture&&(this.gesture.destroy(),this.gesture=void 0),this.transInstr.length=0,this.views.length=0,this.destroyed=!0}push(e,t,i,n){return this.insert(-1,e,t,i,n)}insert(e,t,i,n,s){return this.insertPages(e,[{component:t,componentProps:i}],n,s)}insertPages(e,t,i,n){return this.queueTrns({insertStart:e,insertViews:t,opts:i},n)}pop(e,t){return this.removeIndex(-1,1,e,t)}popTo(e,t,i){const n={removeStart:-1,removeCount:-1,opts:t};return"object"==typeof e&&e.component?(n.removeView=e,n.removeStart=1):"number"==typeof e&&(n.removeStart=e+1),this.queueTrns(n,i)}popToRoot(e,t){return this.removeIndex(1,-1,e,t)}removeIndex(e,t=1,i,n){return this.queueTrns({removeStart:e,removeCount:t,opts:i},n)}setRoot(e,t,i,n){return this.setPages([{component:e,componentProps:t}],i,n)}setPages(e,t,i){return null!=t||(t={}),!0!==t.animated&&(t.animated=!1),this.queueTrns({insertStart:0,insertViews:e,removeStart:0,removeCount:-1,opts:t},i)}setRouteId(e,t,i,n){const s=this.getActiveSync();if(l(s,e,t))return Promise.resolve({changed:!1,element:s.element});let o;const r=new Promise(e=>o=e);let a;const h={updateURL:!1,viewIsReady:e=>{let t;const i=new Promise(e=>t=e);return o({changed:!0,element:e,markVisible:async()=>{t(),await a}}),i}};if("root"===i)a=this.setRoot(e,t,h);else{const s=this.views.find(i=>l(i,e,t));s?a=this.popTo(s,Object.assign(Object.assign({},h),{direction:"back",animationBuilder:n})):"forward"===i?a=this.push(e,t,Object.assign(Object.assign({},h),{animationBuilder:n})):"back"===i&&(a=this.setRoot(e,t,Object.assign(Object.assign({},h),{direction:"back",animated:!0,animationBuilder:n})))}return r}async getRouteId(){const e=this.getActiveSync();if(e)return{id:e.element.tagName,params:e.params,element:e.element}}async getActive(){return this.getActiveSync()}async getByIndex(e){return this.views[e]}async canGoBack(e){return this.canGoBackSync(e)}async getPrevious(e){return this.getPreviousSync(e)}getLength(){return this.views.length}getActiveSync(){return this.views[this.views.length-1]}canGoBackSync(e=this.getActiveSync()){return!(!e||!this.getPreviousSync(e))}getPreviousSync(e=this.getActiveSync()){if(!e)return;const t=this.views,i=t.indexOf(e);return i>0?t[i-1]:void 0}async queueTrns(e,t){var i,n;if(this.isTransitioning&&(null===(i=e.opts)||void 0===i?void 0:i.skipIfBusy))return!1;const s=new Promise((t,i)=>{e.resolve=t,e.reject=i});if(e.done=t,e.opts&&!1!==e.opts.updateURL&&this.useRouter){const t=document.querySelector("ion-router");if(t){const i=await t.canTransition();if(!1===i)return!1;if("string"==typeof i)return t.push(i,e.opts.direction||"back"),!1}}return 0===(null===(n=e.insertViews)||void 0===n?void 0:n.length)&&(e.insertViews=void 0),this.transInstr.push(e),this.nextTrns(),s}success(e,t){if(this.destroyed)this.fireError("nav controller was destroyed",t);else if(t.done&&t.done(e.hasCompleted,e.requiresTransition,e.enteringView,e.leavingView,e.direction),t.resolve(e.hasCompleted),!1!==t.opts.updateURL&&this.useRouter){const t=document.querySelector("ion-router");t&&t.navChanged("back"===e.direction?"back":"forward")}}failed(e,t){this.destroyed?this.fireError("nav controller was destroyed",t):(this.transInstr.length=0,this.fireError(e,t))}fireError(e,t){t.done&&t.done(!1,!1,e),t.reject&&!this.destroyed?t.reject(e):t.resolve(!1)}nextTrns(){if(this.isTransitioning)return!1;const e=this.transInstr.shift();return!!e&&(this.runTransition(e),!0)}async runTransition(e){try{this.ionNavWillChange.emit(),this.isTransitioning=!0,this.prepareTI(e);const t=this.getActiveSync(),i=this.getEnteringView(e,t);if(!t&&!i)throw new Error("no views in the stack to be removed");i&&1===i.state&&await i.init(this.el),this.postViewInit(i,t,e);const n=(e.enteringRequiresTransition||e.leavingRequiresTransition)&&i!==t;let s;n&&e.opts&&t&&("back"===e.opts.direction&&(e.opts.animationBuilder=e.opts.animationBuilder||(null==i?void 0:i.animationBuilder)),t.animationBuilder=e.opts.animationBuilder),s=n?await this.transition(i,t,e):{hasCompleted:!0,requiresTransition:!1},this.success(s,e),this.ionNavDidChange.emit()}catch(t){this.failed(t,e)}this.isTransitioning=!1,this.nextTrns()}prepareTI(e){var t,i,n;const s=this.views.length;if(null!==(t=e.opts)&&void 0!==t||(e.opts={}),null!==(i=(n=e.opts).delegate)&&void 0!==i||(n.delegate=this.delegate),void 0!==e.removeView){(0,r.n)(void 0!==e.removeStart,"removeView needs removeStart"),(0,r.n)(void 0!==e.removeCount,"removeView needs removeCount");const t=this.views.indexOf(e.removeView);if(t<0)throw new Error("removeView was not found");e.removeStart+=t}void 0!==e.removeStart&&(e.removeStart<0&&(e.removeStart=s-1),e.removeCount<0&&(e.removeCount=s-e.removeStart),e.leavingRequiresTransition=e.removeCount>0&&e.removeStart+e.removeCount===s),e.insertViews&&((e.insertStart<0||e.insertStart>s)&&(e.insertStart=s),e.enteringRequiresTransition=e.insertStart===s);const o=e.insertViews;if(!o)return;(0,r.n)(o.length>0,"length can not be zero");const a=o.map(e=>e instanceof c?e:"component"in e?d(e.component,null===e.componentProps?void 0:e.componentProps):d(e,void 0)).filter(e=>null!==e);if(0===a.length)throw new Error("invalid views to insert");for(const r of a){r.delegate=e.opts.delegate;const t=r.nav;if(t&&t!==this)throw new Error("inserted view was already inserted");if(3===r.state)throw new Error("inserted view was already destroyed")}e.insertViews=a}getEnteringView(e,t){const i=e.insertViews;if(void 0!==i)return i[i.length-1];const n=e.removeStart;if(void 0!==n){const i=this.views,s=n+e.removeCount;for(let e=i.length-1;e>=0;e--){const o=i[e];if((e<n||e>=s)&&o!==t)return o}}}postViewInit(e,t,i){var n,s,o;(0,r.n)(t||e,"Both leavingView and enteringView are null"),(0,r.n)(i.resolve,"resolve must be valid"),(0,r.n)(i.reject,"reject must be valid");const h=i.opts,{insertViews:c,removeStart:l,removeCount:d}=i;let u;if(void 0!==l&&void 0!==d){(0,r.n)(l>=0,"removeStart can not be negative"),(0,r.n)(d>=0,"removeCount can not be negative"),u=[];for(let i=l;i<l+d;i++){const n=this.views[i];void 0!==n&&n!==e&&n!==t&&u.push(n)}null!==(n=h.direction)&&void 0!==n||(h.direction="back")}const v=this.views.length+(null!==(s=null==c?void 0:c.length)&&void 0!==s?s:0)-(null!=d?d:0);if((0,r.n)(v>=0,"final balance can not be negative"),0===v)throw console.warn("You can't remove all the pages in the navigation stack. nav.pop() is probably called too many times.",this,this.el),new Error("navigation stack needs at least one root page");if(c){let e=i.insertStart;for(const t of c)this.insertViewAt(t,e),e++;i.enteringRequiresTransition&&(null!==(o=h.direction)&&void 0!==o||(h.direction="forward"))}if(u&&u.length>0){for(const e of u)(0,a.l)(e.element,a.b),(0,a.l)(e.element,a.c),(0,a.l)(e.element,a.d);for(const e of u)this.destroyView(e)}}async transition(e,t,i){const n=i.opts,o=n.progressAnimation?e=>this.sbAni=e:void 0,r=(0,s.b)(this),h=e.element,c=t&&t.element,l=Object.assign(Object.assign({mode:r,showGoBack:this.canGoBackSync(e),baseEl:this.el,progressCallback:o,animated:this.animated&&s.c.getBoolean("animated",!0),enteringEl:h,leavingEl:c},n),{animationBuilder:n.animationBuilder||this.animation||s.c.get("navAnimation")}),{hasCompleted:d}=await(0,a.t)(l);return this.transitionFinish(d,e,t,n)}transitionFinish(e,t,i,n){const s=e?t:i;return s&&this.unmountInactiveViews(s),{hasCompleted:e,requiresTransition:!0,enteringView:t,leavingView:i,direction:n.direction}}insertViewAt(e,t){const i=this.views,n=i.indexOf(e);n>-1?((0,r.n)(e.nav===this,"view is not part of the nav"),i.splice(n,1),i.splice(t,0,e)):((0,r.n)(!e.nav,"nav is used"),e.nav=this,i.splice(t,0,e))}removeView(e){(0,r.n)(2===e.state||3===e.state,"view state should be loaded or destroyed");const t=this.views,i=t.indexOf(e);(0,r.n)(i>-1,"view must be part of the stack"),i>=0&&t.splice(i,1)}destroyView(e){e._destroy(),this.removeView(e)}unmountInactiveViews(e){if(this.destroyed)return;const t=this.views,i=t.indexOf(e);for(let n=t.length-1;n>=0;n--){const e=t[n],s=e.element;s&&(n>i?((0,a.l)(s,a.d),this.destroyView(e)):n<i&&(0,a.s)(s,!0))}}canStart(){return!!this.swipeGesture&&!this.isTransitioning&&0===this.transInstr.length&&this.animationEnabled&&this.canGoBackSync()}onStart(){this.pop({direction:"back",progressAnimation:!0})}onMove(e){this.sbAni&&this.sbAni.progressStep(e)}onEnd(e,t,i){if(this.sbAni){this.animationEnabled=!1,this.sbAni.onFinish(()=>{this.animationEnabled=!0},{oneTimeCallback:!0});let n=e?-.001:.001;e?n+=(0,o.g)([0,0],[.32,.72],[0,1],[1,1],t)[0]:(this.sbAni.easing("cubic-bezier(1, 0, 0.68, 0.28)"),n+=(0,o.g)([0,0],[1,0],[.68,.28],[1,1],t)[0]),this.sbAni.progressEnd(e?1:0,n,i)}}render(){return(0,n.h)("slot",null)}get el(){return(0,n.i)(this)}static get watchers(){return{swipeGesture:["swipeGestureChanged"],root:["rootChanged"]}}};u.style=":host{left:0;right:0;top:0;bottom:0;position:absolute;contain:layout size style;overflow:hidden;z-index:0}";const v=class{constructor(e){(0,n.r)(this,e),this.routerDirection="forward",this.onClick=()=>((e,t,i,n,s)=>{const o=this.el.closest("ion-nav");if(o)if("forward"===t){if(void 0!==i)return o.push(i,n,{skipIfBusy:!0,animationBuilder:s})}else if("root"===t){if(void 0!==i)return o.setRoot(i,n,{skipIfBusy:!0,animationBuilder:s})}else if("back"===t)return o.pop({skipIfBusy:!0,animationBuilder:s});return Promise.resolve(!1)})(0,this.routerDirection,this.component,this.componentProps,this.routerAnimation)}render(){return(0,n.h)(n.H,{onClick:this.onClick})}get el(){return(0,n.i)(this)}}}}]);