@sqwkmob/ionic-custom-back
Version:
Dismiss Ionic Modal by Device Back Button
1 lines • 7.4 kB
JavaScript
const t="sqwk-ion-back-button",e=window,n=document,s={t:0,s:"",raf:t=>requestAnimationFrame(t),ael:(t,e,n,s)=>t.addEventListener(e,n,s),rel:(t,e,n,s)=>t.removeEventListener(e,n,s)},o=!!n.documentElement.attachShadow,c=(()=>{let t=!1;try{n.addEventListener("e",null,Object.defineProperty({},"passive",{get(){t=!0}}))}catch(t){}return t})(),r=(()=>{try{return new CSSStyleSheet,!0}catch(t){}return!1})(),a=new WeakMap,i=t=>a.get(t),l=(t,e)=>a.set(e.o=t,e),f=(t,e)=>e in t,$=t=>console.error(t),u=new Map,p=e.__stencil_cssshim;let y=0,m=!1;const d=[],w=[],h=[],_=t=>e=>{t.push(e),m||(m=!0,s.raf(k))},b=(t,e)=>{let n=0,s=0;for(;n<t.length&&(s=performance.now())<e;)try{t[n++](s)}catch(t){$(t)}n===t.length?t.length=0:0!==n&&t.splice(0,n)},k=()=>{y++,(t=>{for(let e=0;e<t.length;e++)try{t[e](performance.now())}catch(t){$(t)}t.length=0})(d);const t=2==(6&s.t)?performance.now()+7*Math.ceil(y*(1/22)):1/0;b(w,t),b(h,t),w.length>0&&(h.push(...w),w.length=0),(m=d.length+w.length+h.length>0)?s.raf(k):y=0},g=_(w),v={},j=t=>null!=t,S=t=>t.toLowerCase(),M=t=>["object","function"].includes(typeof t),R=()=>e.CSS&&e.CSS.supports&&e.CSS.supports("color","var(--c)")?Promise.resolve():__sc_import_sqwk_ion_back_button("./p-f7ddb189.js"),U=async()=>{{const s=Array.from(n.querySelectorAll("script")).find(e=>e.src.includes(`/${t}.esm.js`)||e.getAttribute("data-namespace")===t),o=new URL(".",new URL(s.getAttribute("data-resources-url")||s.src,e.location.href));return q(o.href),window.customElements||await __sc_import_sqwk_ion_back_button("./p-a0c82e31.js"),o.href}},q=s=>{const o=`__sc_import_${t.replace(/\s|-/g,"_")}`;try{e[o]=new Function("w","return import(w);")}catch(t){const c=new Map;e[o]=t=>{const r=new URL(t,s).href;let a=c.get(r);if(!a){const t=n.createElement("script");t.type="module",t.src=URL.createObjectURL(new Blob([`import * as m from '${r}'; window.${o}.m = m;`],{type:"application/javascript"})),a=new Promise(n=>{t.onload=()=>{n(e[o].m),t.remove()}}),c.set(r,a),n.head.appendChild(t)}return a}}},L=new WeakMap,x=t=>"sc-"+t,O=(t,e,...n)=>{let s,o=null,c=!1,r=!1,a=[];const i=e=>{for(let n=0;n<e.length;n++)o=e[n],Array.isArray(o)?i(o):null!=o&&"boolean"!=typeof o&&((c="function"!=typeof t&&!M(o))&&(o=String(o)),c&&r?a[a.length-1].i+=o:a.push(c?{t:0,i:o}:o),r=c)};if(i(n),e){s=e.key||void 0;{const t=e.className||e.class;t&&(e.class="object"!=typeof t?t:Object.keys(t).filter(e=>t[e]).join(" "))}}if("function"==typeof t)return t(e,a,A);const l={t:0,l:t,$:a.length>0?a:null,u:void 0,p:e};return l.h=s,l},C={},A={forEach:(t,e)=>t.map(E).forEach(e),map:(t,e)=>t.map(E).map(e).map(P)},E=t=>({vattrs:t.p,vchildren:t.$,vkey:t.h,vname:t._,vtag:t.l,vtext:t.i}),P=t=>({t:0,p:t.vattrs,$:t.vchildren,h:t.vkey,_:t.vname,l:t.vtag,i:t.vtext}),F=(t,e,n,o,c,r)=>{if(n!==o)if("class"!==e||c)if("style"===e)for(const e in o)n&&o[e]===n[e]||(e.includes("-")?t.style.setProperty(e,o[e]):t.style[e]=o[e]);else if("key"===e);else if("ref"===e)o&&o(t);else if(e.startsWith("on")&&!f(t,e))e=f(t,S(e))?S(e.substring(2)):S(e[2])+e.substring(3),n&&s.rel(t,e,n,!1),o&&s.ael(t,e,o,!1);else{const n=f(t,e),s=M(o);if((n||s&&null!==o)&&!c)try{t[e]=null==o&&-1===t.tagName.indexOf("-")?"":o}catch(t){}null==o||!1===o?t.removeAttribute(e):(!n||4&r||c)&&!s&&(o=!0===o?"":o.toString(),t.setAttribute(e,o))}else t.className=o},T=(t,e,n,s)=>{const o=11===e.u.nodeType&&e.u.host?e.u.host:e.u,c=t&&t.p||v,r=e.p||v;for(s in r)F(o,s,c[s],r[s],n,e.t)};let W,B;const H=(t,e,s)=>{let o,c,r=e.$[s],a=0;if(j(r.i))r.u=n.createTextNode(r.i);else if(o=r.u=n.createElement(r.l),T(null,r,!1),j(W)&&o["s-si"]!==W&&o.classList.add(o["s-si"]=W),r.$)for(a=0;a<r.$.length;++a)(c=H(t,r,a))&&o.appendChild(c);return r.u},N=(t,e,o)=>{if(!t["s-al"]){const c=e.o,r=e.k;512&e.t||(e.t|=512,t.classList.add("hydrated"),(async t=>{if(t&&t.componentDidLoad)try{await t.componentDidLoad()}catch(t){$(t)}})(c),e.g(t),r||(n.documentElement.classList.add("hydrated"),setTimeout(()=>s.t|=2,999))),r&&((o=r["s-al"])&&(o.delete(t),0===o.size&&(r["s-al"]=void 0,r["s-init"]())),e.k=void 0)}},V=(t,e)=>(e.v&&Object.entries(e.v).forEach(([t,[e]])=>{}),t),z=async(t,e,s,c,a)=>{if(0==(256&e.t)){e.t|=256,(a=await(t=>__sc_import_sqwk_ion_back_button(`./${t.j}.entry.js`).then(e=>e[t.S.replace(/-/g,"_")],$))(s)).isProxied||(V(a,s),a.isProxied=!0),e.t|=8;try{new a(e)}catch(t){$(t)}if(e.t&=-9,D(e.o),!a.isStyleRegistered&&a.style){let t=a.style,e=x(s.S);8&s.t&&(t=await __sc_import_sqwk_ion_back_button("./p-549b16dd.js").then(n=>n.scopeCss(t,e,!1))),((t,e)=>{let n=u.get(t);r?(n=n||new CSSStyleSheet).replace(e):n=e,u.set(t,n)})(e,t),a.isStyleRegistered=!0}}const i=e.k;i&&!i["s-lr"]&&i["s-rc"]?i["s-rc"].push(()=>z(t,e,s)):(async(t,e,s)=>{const c=e.o;g(()=>((t,e,s,c,r)=>{t["s-lr"]=!1,r&&((t,e)=>{const s=((t,s,o,c)=>{let r=x(e.S),a=u.get(r);if(t=11===t.nodeType?t:n,a)if("string"==typeof a){let e,s=L.get(t=t.head||t);if(s||L.set(t,s=new Set),!s.has(r)){if(p){const t=(e=p.createHostStyle(c,r,a))["s-sc"];t&&(r=t,s=null)}else(e=n.createElement("style")).innerHTML=a;t.appendChild(e),s&&s.add(r)}}else t.adoptedStyleSheets.includes(a)||(t.adoptedStyleSheets=[...t.adoptedStyleSheets,a]);return r})(o&&t.shadowRoot?t.shadowRoot:t.getRootNode(),0,0,t);10&e.t&&(t["s-sc"]=s,t.classList.add(s+"-h"))})(t,s),e.t|=4;try{((t,e,n,s)=>{const o=e.M||{t:0};B=S(t.tagName),(t=>t&&t.l===C)(s)?s.l=null:s=O(null,null,s),s.t|=4,e.M=s,s.u=o.u=t.shadowRoot||t,W=t["s-sc"],((t,e)=>{const n=e.u=t.u,s=e.$;j(e.i)?t.i!==e.i&&(n.textContent=e.i):(T(t,e,!1),j(s)&&((t,e,s,o,c,r)=>{let a,i=n;for(i.shadowRoot&&S(i.tagName)===B&&(i=i.shadowRoot);c<=r;++c)o[c]&&(a=H(null,s,c))&&(o[c].u=a,i.insertBefore(a,null))})(0,0,e,s,0,s.length-1))})(o,s)})(t,e,0,c.render())}catch(t){$(t)}e.t&=-5,p&&p.updateHost(t),t["s-lr"]=!0,e.t|=2,t["s-rc"].length>0&&(t["s-rc"].forEach(t=>t()),t["s-rc"].length=0),N(t,e)})(t,e,s,c,!0))})(t,e,s)},D=()=>{},G=(t,r={})=>{const l=[],f=r.exclude||[],u=n.head,y=e.customElements,m=u.querySelector("meta[charset]"),d=n.createElement("style");Object.assign(s,r),s.s=new URL(r.resourcesUrl||"/",e.location.href).href,r.syncQueue&&(s.t|=4),t.forEach(t=>t[1].forEach(n=>{const r={t:n[0],S:n[1],v:n[2],R:n[3]};!o&&1&r.t&&(r.t|=8);const u=r.S;r.j=t[0],f.includes(u)||y.get(u)||(l.push(u),y.define(u,V(class extends HTMLElement{constructor(t){super(t),t=this,this["s-lr"]=!1,this["s-rc"]=[],(t=>{{const e={t:0,U:t,q:new Map};e.L=new Promise(t=>e.g=t),a.set(t,e)}})(t),1&r.t&&(o?t.attachShadow({mode:"open"}):"shadowRoot"in t||(t.shadowRoot=t))}connectedCallback(){((t,n)=>{if(0==(1&s.t)){const o=i(t);if(n.R&&(o.O=((t,o)=>{const r=n.R.map(([n,r,a])=>{const i=((t,n)=>8&n?e:t)(t,n),l=((t,e)=>n=>t.o?t.o[e](n):t.L.then(()=>t.o[e](n)).catch($))(o,a),f=(t=>c?{passive:0!=(1&t),capture:0!=(2&t)}:0!=(2&t))(n);return s.ael(i,r,l,f),()=>s.rel(i,r,l,f)});return()=>r.forEach(t=>t())})(t,o)),!(1&o.t)){o.t|=1;{let e=t;for(;e=e.parentNode||e.host;)if(e["s-init"]&&!e["s-lr"]){o.k=e,(e["s-al"]=e["s-al"]||new Set).add(t);break}}z(t,o,n)}D(o.o)}})(this,r)}disconnectedCallback(){(t=>{if(0==(1&s.t)){const e=i(t);e.O&&(e.O(),e.O=void 0),p&&p.removeHost(t)}})(this)}"s-init"(){const t=i(this);t.o&&N(this,t)}"s-hmr"(t){}forceUpdate(){}componentOnReady(){return i(this).L}},r)))})),d.innerHTML=l+"{visibility:hidden}.hydrated{visibility:inherit}",d.setAttribute("data-styles",""),u.insertBefore(d,m?m.nextSibling:u.firstChild)},I=t=>i(t).U;export{R as a,G as b,I as g,O as h,U as p,l as r};