1 line
13 KiB
JavaScript
1 line
13 KiB
JavaScript
(self.webpackChunkapp=self.webpackChunkapp||[]).push([[5349],{87626:(R,D,d)=>{d.d(D,{C:()=>c,a:()=>V,d:()=>I});var v=d(15861),g=d(35730);const V=function(){var r=(0,v.Z)(function*(u,E,w,p,b,y){var T;if(u)return u.attachViewToDom(E,w,b,p);if(!(y||"string"==typeof w||w instanceof HTMLElement))throw new Error("framework delegate is missing");const S="string"==typeof w?null===(T=E.ownerDocument)||void 0===T?void 0:T.createElement(w):w;return p&&p.forEach(C=>S.classList.add(C)),b&&Object.assign(S,b),E.appendChild(S),yield new Promise(C=>(0,g.c)(S,C)),S});return function(E,w,p,b,y,T){return r.apply(this,arguments)}}(),I=(r,u)=>{if(u){if(r)return r.removeViewFromDom(u.parentElement,u);u.remove()}return Promise.resolve()},c=()=>{let r,u;return{attachViewToDom:function(){var p=(0,v.Z)(function*(b,y,T={},S=[]){var C,B;if(r=b,y){const P="string"==typeof y?null===(C=r.ownerDocument)||void 0===C?void 0:C.createElement(y):y;S.forEach(e=>P.classList.add(e)),Object.assign(P,T),r.appendChild(P),yield new Promise(e=>(0,g.c)(P,e))}else if(r.children.length>0&&!r.children[0].classList.contains("ion-delegate-host")){const e=null===(B=r.ownerDocument)||void 0===B?void 0:B.createElement("div");e.classList.add("ion-delegate-host"),S.forEach(t=>e.classList.add(t)),e.append(...r.children),r.appendChild(e)}const O=document.querySelector("ion-app")||document.body;return u=document.createComment("ionic teleport"),r.parentNode.insertBefore(u,r),O.appendChild(r),r});return function(y,T){return p.apply(this,arguments)}}(),removeViewFromDom:()=>(r&&u&&(u.parentNode.insertBefore(r,u),u.remove()),Promise.resolve())}}},45349:(R,D,d)=>{d.r(D),d.d(D,{ion_nav:()=>B,ion_nav_link:()=>P});var v=d(15861),g=d(71308),V=d(35179),I=d(32225),c=d(35730),r=d(1843),u=d(87626);class b{constructor(t,n){this.component=t,this.params=n,this.state=1}init(t){var n=this;return(0,v.Z)(function*(){if(n.state=2,!n.element){const i=n.component;n.element=yield(0,u.a)(n.delegate,t,i,["ion-page","ion-page-invisible"],n.params)}})()}_destroy(){(0,c.n)(3!==this.state,"view state must be ATTACHED");const t=this.element;t&&(this.delegate?this.delegate.removeViewFromDom(t.parentElement,t):t.remove()),this.nav=void 0,this.state=3}}const y=(e,t,n)=>!(!e||e.component!==t)&&(0,c.s)(e.params,n),T=(e,t)=>e?e instanceof b?e:new b(e,t):null,B=class{constructor(e){(0,g.r)(this,e),this.ionNavWillLoad=(0,g.e)(this,"ionNavWillLoad",7),this.ionNavWillChange=(0,g.e)(this,"ionNavWillChange",3),this.ionNavDidChange=(0,g.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,V.b)(this);this.swipeGesture=V.c.getBoolean("swipeBackEnabled","ios"===e)}this.ionNavWillLoad.emit()}componentDidLoad(){var e=this;return(0,v.Z)(function*(){e.rootChanged(),e.gesture=(yield d.e(3109).then(d.bind(d,56659))).createSwipeBackGesture(e.el,e.canStart.bind(e),e.onStart.bind(e),e.onMove.bind(e),e.onEnd.bind(e)),e.swipeGestureChanged()})()}connectedCallback(){this.destroyed=!1}disconnectedCallback(){for(const e of this.views)(0,r.l)(e.element,r.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,n,i){return this.insert(-1,e,t,n,i)}insert(e,t,n,i,s){return this.insertPages(e,[{component:t,componentProps:n}],i,s)}insertPages(e,t,n,i){return this.queueTrns({insertStart:e,insertViews:t,opts:n},i)}pop(e,t){return this.removeIndex(-1,1,e,t)}popTo(e,t,n){const i={removeStart:-1,removeCount:-1,opts:t};return"object"==typeof e&&e.component?(i.removeView=e,i.removeStart=1):"number"==typeof e&&(i.removeStart=e+1),this.queueTrns(i,n)}popToRoot(e,t){return this.removeIndex(1,-1,e,t)}removeIndex(e,t=1,n,i){return this.queueTrns({removeStart:e,removeCount:t,opts:n},i)}setRoot(e,t,n,i){return this.setPages([{component:e,componentProps:t}],n,i)}setPages(e,t,n){return t??(t={}),!0!==t.animated&&(t.animated=!1),this.queueTrns({insertStart:0,insertViews:e,removeStart:0,removeCount:-1,opts:t},n)}setRouteId(e,t,n,i){const s=this.getActiveSync();if(y(s,e,t))return Promise.resolve({changed:!1,element:s.element});let o;const l=new Promise(f=>o=f);let a;const m={updateURL:!1,viewIsReady:f=>{let _;const k=new Promise(h=>_=h);return o({changed:!0,element:f,markVisible:(h=(0,v.Z)(function*(){_(),yield a}),function(){return h.apply(this,arguments)})}),k;var h}};if("root"===n)a=this.setRoot(e,t,m);else{const f=this.views.find(_=>y(_,e,t));f?a=this.popTo(f,Object.assign(Object.assign({},m),{direction:"back",animationBuilder:i})):"forward"===n?a=this.push(e,t,Object.assign(Object.assign({},m),{animationBuilder:i})):"back"===n&&(a=this.setRoot(e,t,Object.assign(Object.assign({},m),{direction:"back",animated:!0,animationBuilder:i})))}return l}getRouteId(){var e=this;return(0,v.Z)(function*(){const t=e.getActiveSync();if(t)return{id:t.element.tagName,params:t.params,element:t.element}})()}getActive(){var e=this;return(0,v.Z)(function*(){return e.getActiveSync()})()}getByIndex(e){var t=this;return(0,v.Z)(function*(){return t.views[e]})()}canGoBack(e){var t=this;return(0,v.Z)(function*(){return t.canGoBackSync(e)})()}getPrevious(e){var t=this;return(0,v.Z)(function*(){return t.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,n=t.indexOf(e);return n>0?t[n-1]:void 0}queueTrns(e,t){var n=this;return(0,v.Z)(function*(){var i,s;if(n.isTransitioning&&(null===(i=e.opts)||void 0===i?void 0:i.skipIfBusy))return!1;const o=new Promise((l,a)=>{e.resolve=l,e.reject=a});if(e.done=t,e.opts&&!1!==e.opts.updateURL&&n.useRouter){const l=document.querySelector("ion-router");if(l){const a=yield l.canTransition();if(!1===a)return!1;if("string"==typeof a)return l.push(a,e.opts.direction||"back"),!1}}return 0===(null===(s=e.insertViews)||void 0===s?void 0:s.length)&&(e.insertViews=void 0),n.transInstr.push(e),n.nextTrns(),o})()}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 n=document.querySelector("ion-router");n&&n.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)}runTransition(e){var t=this;return(0,v.Z)(function*(){try{t.ionNavWillChange.emit(),t.isTransitioning=!0,t.prepareTI(e);const n=t.getActiveSync(),i=t.getEnteringView(e,n);if(!n&&!i)throw new Error("no views in the stack to be removed");i&&1===i.state&&(yield i.init(t.el)),t.postViewInit(i,n,e);const s=(e.enteringRequiresTransition||e.leavingRequiresTransition)&&i!==n;let o;s&&e.opts&&n&&("back"===e.opts.direction&&(e.opts.animationBuilder=e.opts.animationBuilder||i?.animationBuilder),n.animationBuilder=e.opts.animationBuilder),o=s?yield t.transition(i,n,e):{hasCompleted:!0,requiresTransition:!1},t.success(o,e),t.ionNavDidChange.emit()}catch(n){t.failed(n,e)}t.isTransitioning=!1,t.nextTrns()})()}prepareTI(e){var t,n,i;const s=this.views.length;if(null!==(t=e.opts)&&void 0!==t||(e.opts={}),null!==(n=(i=e.opts).delegate)&&void 0!==n||(i.delegate=this.delegate),void 0!==e.removeView){(0,c.n)(void 0!==e.removeStart,"removeView needs removeStart"),(0,c.n)(void 0!==e.removeCount,"removeView needs removeCount");const a=this.views.indexOf(e.removeView);if(a<0)throw new Error("removeView was not found");e.removeStart+=a}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,c.n)(o.length>0,"length can not be zero");const l=(e=>e.map(t=>t instanceof b?t:"component"in t?T(t.component,null===t.componentProps?void 0:t.componentProps):T(t,void 0)).filter(t=>null!==t))(o);if(0===l.length)throw new Error("invalid views to insert");for(const a of l){a.delegate=e.opts.delegate;const m=a.nav;if(m&&m!==this)throw new Error("inserted view was already inserted");if(3===a.state)throw new Error("inserted view was already destroyed")}e.insertViews=l}getEnteringView(e,t){const n=e.insertViews;if(void 0!==n)return n[n.length-1];const i=e.removeStart;if(void 0!==i){const s=this.views,o=i+e.removeCount;for(let l=s.length-1;l>=0;l--){const a=s[l];if((l<i||l>=o)&&a!==t)return a}}}postViewInit(e,t,n){var i,s,o;(0,c.n)(t||e,"Both leavingView and enteringView are null"),(0,c.n)(n.resolve,"resolve must be valid"),(0,c.n)(n.reject,"reject must be valid");const l=n.opts,{insertViews:a,removeStart:m,removeCount:f}=n;let _;if(void 0!==m&&void 0!==f){(0,c.n)(m>=0,"removeStart can not be negative"),(0,c.n)(f>=0,"removeCount can not be negative"),_=[];for(let h=m;h<m+f;h++){const A=this.views[h];void 0!==A&&A!==e&&A!==t&&_.push(A)}null!==(i=l.direction)&&void 0!==i||(l.direction="back")}const k=this.views.length+(null!==(s=a?.length)&&void 0!==s?s:0)-(f??0);if((0,c.n)(k>=0,"final balance can not be negative"),0===k)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(a){let h=n.insertStart;for(const A of a)this.insertViewAt(A,h),h++;n.enteringRequiresTransition&&(null!==(o=l.direction)&&void 0!==o||(l.direction="forward"))}if(_&&_.length>0){for(const h of _)(0,r.l)(h.element,r.b),(0,r.l)(h.element,r.c),(0,r.l)(h.element,r.d);for(const h of _)this.destroyView(h)}}transition(e,t,n){var i=this;return(0,v.Z)(function*(){const s=n.opts,o=s.progressAnimation?k=>i.sbAni=k:void 0,l=(0,V.b)(i),a=e.element,m=t&&t.element,f=Object.assign(Object.assign({mode:l,showGoBack:i.canGoBackSync(e),baseEl:i.el,progressCallback:o,animated:i.animated&&V.c.getBoolean("animated",!0),enteringEl:a,leavingEl:m},s),{animationBuilder:s.animationBuilder||i.animation||V.c.get("navAnimation")}),{hasCompleted:_}=yield(0,r.t)(f);return i.transitionFinish(_,e,t,s)})()}transitionFinish(e,t,n,i){const s=e?t:n;return s&&this.unmountInactiveViews(s),{hasCompleted:e,requiresTransition:!0,enteringView:t,leavingView:n,direction:i.direction}}insertViewAt(e,t){const n=this.views,i=n.indexOf(e);i>-1?((0,c.n)(e.nav===this,"view is not part of the nav"),n.splice(i,1),n.splice(t,0,e)):((0,c.n)(!e.nav,"nav is used"),e.nav=this,n.splice(t,0,e))}removeView(e){(0,c.n)(2===e.state||3===e.state,"view state should be loaded or destroyed");const t=this.views,n=t.indexOf(e);(0,c.n)(n>-1,"view must be part of the stack"),n>=0&&t.splice(n,1)}destroyView(e){e._destroy(),this.removeView(e)}unmountInactiveViews(e){if(this.destroyed)return;const t=this.views,n=t.indexOf(e);for(let i=t.length-1;i>=0;i--){const s=t[i],o=s.element;o&&(i>n?((0,r.l)(o,r.d),this.destroyView(s)):i<n&&(0,r.s)(o,!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,n){if(this.sbAni){this.animationEnabled=!1,this.sbAni.onFinish(()=>{this.animationEnabled=!0},{oneTimeCallback:!0});let i=e?-.001:.001;e?i+=(0,I.g)([0,0],[.32,.72],[0,1],[1,1],t)[0]:(this.sbAni.easing("cubic-bezier(1, 0, 0.68, 0.28)"),i+=(0,I.g)([0,0],[1,0],[.68,.28],[1,1],t)[0]),this.sbAni.progressEnd(e?1:0,i,n)}}render(){return(0,g.h)("slot",null)}get el(){return(0,g.i)(this)}static get watchers(){return{swipeGesture:["swipeGestureChanged"],root:["rootChanged"]}}};B.style=":host{left:0;right:0;top:0;bottom:0;position:absolute;contain:layout size style;overflow:hidden;z-index:0}";const P=class{constructor(e){(0,g.r)(this,e),this.routerDirection="forward",this.onClick=()=>((e,t,n,i,s)=>{const o=this.el.closest("ion-nav");if(o)if("forward"===t){if(void 0!==n)return o.push(n,i,{skipIfBusy:!0,animationBuilder:s})}else if("root"===t){if(void 0!==n)return o.setRoot(n,i,{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,g.h)(g.H,{onClick:this.onClick})}get el(){return(0,g.i)(this)}}}}]); |