UNPKG

2.91 kBJavaScriptView Raw
1import{g as t,s as e}from"./p-3df3e749.js";const o=t=>i(t),n=(t,e)=>("string"==typeof t&&(e=t,t=void 0),o(t).includes(e)),i=(t=window)=>{if(void 0===t)return[];t.Ionic=t.Ionic||{};let e=t.Ionic.platforms;return null==e&&(e=t.Ionic.platforms=r(t),e.forEach((e=>t.document.documentElement.classList.add(`plt-${e}`)))),e},r=t=>Object.keys(h).filter((e=>h[e](t))),s=t=>!!l(t,/iPad/i)||!(!l(t,/Macintosh/i)||!a(t)),c=t=>l(t,/android|sink/i),a=t=>m(t,"(any-pointer:coarse)"),d=t=>p(t)||u(t),p=t=>!!(t.cordova||t.phonegap||t.PhoneGap),u=t=>{const e=t.Capacitor;return!(!e||!e.isNative)},l=(t,e)=>e.test(t.navigator.userAgent),m=(t,e)=>t.matchMedia(e).matches,h={ipad:s,iphone:t=>l(t,/iPhone/i),ios:t=>l(t,/iPhone|iPod/i)||s(t),android:c,phablet:t=>{const e=t.innerWidth,o=t.innerHeight,n=Math.min(e,o),i=Math.max(e,o);return n>390&&n<520&&i>620&&i<800},tablet:t=>{const e=t.innerWidth,o=t.innerHeight,n=Math.min(e,o),i=Math.max(e,o);return s(t)||(t=>c(t)&&!l(t,/mobile/i))(t)||n>460&&n<820&&i>780&&i<1400},cordova:p,capacitor:u,electron:t=>l(t,/electron/i),pwa:t=>!(!t.matchMedia("(display-mode: standalone)").matches&&!t.navigator.standalone),mobile:a,mobileweb:t=>a(t)&&!d(t),desktop:t=>!a(t),hybrid:d};class b{constructor(){this.m=new Map}reset(t){this.m=new Map(Object.entries(t))}get(t,e){const o=this.m.get(t);return void 0!==o?o:e}getBoolean(t,e=!1){const o=this.m.get(t);return void 0===o?e:"string"==typeof o?"true"===o:!!o}getNumber(t,e){const o=parseFloat(this.m.get(t));return isNaN(o)?void 0!==e?e:NaN:o}set(t,e){this.m.set(t,e)}}const f=new b;let w;const g=e=>e&&t(e)||w,O=(t={})=>{if("undefined"==typeof window)return;const o=window.document,r=window,s=r.Ionic=r.Ionic||{};i(r);const c=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},(t=>{try{const e=t.sessionStorage.getItem("ionic-persist-config");return null!==e?JSON.parse(e):{}}catch(e){return{}}})(r)),{persistConfig:!1}),s.config),(t=>{const e={};return t.location.search.slice(1).split("&").map((t=>t.split("="))).map((([t,e])=>[decodeURIComponent(t),decodeURIComponent(e)])).filter((([t])=>{return t.substr(0,(e="ionic:").length)===e;var e})).map((([t,e])=>[t.slice("ionic:".length),e])).forEach((([t,o])=>{e[t]=o})),e})(r)),t);f.reset(c),f.getBoolean("persistConfig")&&((t,e)=>{try{t.sessionStorage.setItem("ionic-persist-config",JSON.stringify(e))}catch(o){return}})(r,c),s.config=f,s.mode=w=f.get("mode",o.documentElement.getAttribute("mode")||(n(r,"ios")?"ios":"md")),f.set("mode",w),o.documentElement.setAttribute("mode",w),o.documentElement.classList.add(w),f.getBoolean("_testing")&&f.set("animated",!1);const a=t=>t.tagName&&t.tagName.startsWith("ION-"),d=t=>["ios","md"].includes(t);e((t=>{for(;t;){const e=t.mode||t.getAttribute("mode");if(e){if(d(e))return e;a(t)&&console.warn('Invalid ionic mode: "'+e+'", expected: "ios" or "md"')}t=t.parentElement}return w}))};export{n as a,g as b,f as c,o as g,O as i}
\No newline at end of file