/*!
 * (C) Ionic http://ionicframework.com - MIT License
 */
import{g as getMode,c as setMode}from"./index-6f1cee27.js";import{s as setupPlatforms,c as configFromSession,a as configFromURL,b as config,d as saveConfig,i as isPlatform}from"./config-83c2b25e.js";var defaultMode;var getIonMode=function(e){return e&&getMode(e)||defaultMode};var initialize=function(e){if(e===void 0){e={}}if(typeof window==="undefined"){return}var o=window.document;var t=window;var i=t.Ionic=t.Ionic||{};setupPlatforms(t);var n=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},configFromSession(t)),{persistConfig:false}),i.config),configFromURL(t)),e);config.reset(n);if(config.getBoolean("persistConfig")){saveConfig(t,n)}i.config=config;i.mode=defaultMode=config.get("mode",o.documentElement.getAttribute("mode")||(isPlatform(t,"ios")?"ios":"md"));config.set("mode",defaultMode);o.documentElement.setAttribute("mode",defaultMode);o.documentElement.classList.add(defaultMode);if(config.getBoolean("_testing")){config.set("animated",false)}var s=function(e){return e.tagName&&e.tagName.startsWith("ION-")};var a=function(e){return["ios","md"].includes(e)};setMode((function(e){while(e){var o=e.mode||e.getAttribute("mode");if(o){if(a(o)){return o}else if(s(e)){console.warn('Invalid ionic mode: "'+o+'", expected: "ios" or "md"')}}e=e.parentElement}return defaultMode}))};export{getIonMode as g,initialize as i};