onsenui
Version:
HTML5 Mobile Framework & UI Components
1,405 lines (1,361 loc) • 3.04 MB
JavaScript
/* onsenui v2.12.8 - 2022-12-27 */
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.ons = factory());
})(this, (function () { 'use strict';
function ownKeys(object, enumerableOnly) {
var keys = Object.keys(object);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
enumerableOnly && (symbols = symbols.filter(function (sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
})), keys.push.apply(keys, symbols);
}
return keys;
}
function _objectSpread2(target) {
for (var i = 1; i < arguments.length; i++) {
var source = null != arguments[i] ? arguments[i] : {};
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
_defineProperty(target, key, source[key]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
});
}
return target;
}
function _typeof(obj) {
"@babel/helpers - typeof";
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
return typeof obj;
} : function (obj) {
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
}, _typeof(obj);
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
Object.defineProperty(Constructor, "prototype", {
writable: false
});
return Constructor;
}
function _defineProperty(obj, key, value) {
key = _toPropertyKey(key);
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
function _inherits(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function");
}
subClass.prototype = Object.create(superClass && superClass.prototype, {
constructor: {
value: subClass,
writable: true,
configurable: true
}
});
Object.defineProperty(subClass, "prototype", {
writable: false
});
if (superClass) _setPrototypeOf(subClass, superClass);
}
function _getPrototypeOf(o) {
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
return o.__proto__ || Object.getPrototypeOf(o);
};
return _getPrototypeOf(o);
}
function _setPrototypeOf(o, p) {
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};
return _setPrototypeOf(o, p);
}
function _isNativeReflectConstruct() {
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
if (Reflect.construct.sham) return false;
if (typeof Proxy === "function") return true;
try {
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
return true;
} catch (e) {
return false;
}
}
function _objectWithoutPropertiesLoose(source, excluded) {
if (source == null) return {};
var target = {};
var sourceKeys = Object.keys(source);
var key, i;
for (i = 0; i < sourceKeys.length; i++) {
key = sourceKeys[i];
if (excluded.indexOf(key) >= 0) continue;
target[key] = source[key];
}
return target;
}
function _objectWithoutProperties(source, excluded) {
if (source == null) return {};
var target = _objectWithoutPropertiesLoose(source, excluded);
var key, i;
if (Object.getOwnPropertySymbols) {
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
for (i = 0; i < sourceSymbolKeys.length; i++) {
key = sourceSymbolKeys[i];
if (excluded.indexOf(key) >= 0) continue;
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
target[key] = source[key];
}
}
return target;
}
function _assertThisInitialized(self) {
if (self === void 0) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return self;
}
function _possibleConstructorReturn(self, call) {
if (call && (typeof call === "object" || typeof call === "function")) {
return call;
} else if (call !== void 0) {
throw new TypeError("Derived constructors may only return object or undefined");
}
return _assertThisInitialized(self);
}
function _createSuper(Derived) {
var hasNativeReflectConstruct = _isNativeReflectConstruct();
return function _createSuperInternal() {
var Super = _getPrototypeOf(Derived),
result;
if (hasNativeReflectConstruct) {
var NewTarget = _getPrototypeOf(this).constructor;
result = Reflect.construct(Super, arguments, NewTarget);
} else {
result = Super.apply(this, arguments);
}
return _possibleConstructorReturn(this, result);
};
}
function _superPropBase(object, property) {
while (!Object.prototype.hasOwnProperty.call(object, property)) {
object = _getPrototypeOf(object);
if (object === null) break;
}
return object;
}
function _get() {
if (typeof Reflect !== "undefined" && Reflect.get) {
_get = Reflect.get.bind();
} else {
_get = function _get(target, property, receiver) {
var base = _superPropBase(target, property);
if (!base) return;
var desc = Object.getOwnPropertyDescriptor(base, property);
if (desc.get) {
return desc.get.call(arguments.length < 3 ? target : receiver);
}
return desc.value;
};
}
return _get.apply(this, arguments);
}
function _toConsumableArray(arr) {
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
}
function _arrayWithoutHoles(arr) {
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
}
function _iterableToArray(iter) {
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
}
function _unsupportedIterableToArray(o, minLen) {
if (!o) return;
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
var n = Object.prototype.toString.call(o).slice(8, -1);
if (n === "Object" && o.constructor) n = o.constructor.name;
if (n === "Map" || n === "Set") return Array.from(o);
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
}
function _arrayLikeToArray(arr, len) {
if (len == null || len > arr.length) len = arr.length;
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
return arr2;
}
function _nonIterableSpread() {
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function _toPrimitive(input, hint) {
if (typeof input !== "object" || input === null) return input;
var prim = input[Symbol.toPrimitive];
if (prim !== undefined) {
var res = prim.call(input, hint || "default");
if (typeof res !== "object") return res;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return (hint === "string" ? String : Number)(input);
}
function _toPropertyKey(arg) {
var key = _toPrimitive(arg, "string");
return typeof key === "symbol" ? key : String(key);
}
/*
Copyright 2013-2015 ASIAL CORPORATION
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Save HTMLElement object before Custom Elements polyfill patch global HTMLElement.
var NativeHTMLElement = window.HTMLElement;
/**
* @object ons.platform
* @category util
* @description
* [en]Utility methods to detect current platform.[/en]
* [ja]現在実行されているプラットフォームを検知するためのユーティリティメソッドを収めたオブジェクトです。[/ja]
*/
var Platform = /*#__PURE__*/function () {
/**
* All elements will be rendered as if the app was running on this platform.
* @type {String}
*/
function Platform() {
_classCallCheck(this, Platform);
this._selectedPlatform = null;
this._ignorePlatformSelect = false;
}
/**
* @method select
* @signature select(platform)
* @param {string} platform Name of the platform.
* [en]Possible values are: "opera", "firefox", "safari", "chrome", "ie", "android", "blackberry", "ios" or "wp".[/en]
* [ja]"opera", "firefox", "safari", "chrome", "ie", "android", "blackberry", "ios", "wp"のいずれかを指定します。[/ja]
* @description
* [en]Sets the platform used to render the elements. Useful for testing.[/en]
* [ja]要素を描画するために利用するプラットフォーム名を設定します。テストに便利です。[/ja]
*/
_createClass(Platform, [{
key: "select",
value: function select(platform) {
if (typeof platform === 'string') {
this._selectedPlatform = platform.trim().toLowerCase();
}
}
}, {
key: "_getSelectedPlatform",
value: function _getSelectedPlatform() {
return this._ignorePlatformSelect ? null : this._selectedPlatform;
}
}, {
key: "_runOnActualPlatform",
value: function _runOnActualPlatform(fn) {
this._ignorePlatformSelect = true;
var result = fn();
this._ignorePlatformSelect = false;
return result;
}
//----------------
// General
//----------------
/**
* @method isWebView
* @signature isWebView()
* @description
* [en]Returns whether app is running in Cordova.[/en]
* [ja]Cordova内で実行されているかどうかを返します。[/ja]
* @return {Boolean}
*/
}, {
key: "isWebView",
value: function isWebView() {
if (document.readyState === 'loading' || document.readyState == 'uninitialized') {
throw new Error('isWebView() method is available after dom contents loaded.');
}
return !!(window.cordova || window.phonegap || window.PhoneGap);
}
//----------------
// iOS devices
//----------------
/**
* @method isIPhone
* @signature isIPhone()
* @description
* [en]Returns whether the device is iPhone.[/en]
* [ja]iPhone上で実行されているかどうかを返します。[/ja]
* @return {Boolean}
*/
}, {
key: "isIPhone",
value: function isIPhone() {
return /iPhone/i.test(navigator.userAgent);
}
/**
* @method isIPhoneX
* @signature isIPhoneX()
* @description
* [en]Returns whether the device is iPhone X, XS, XS Max, XR, 11, 11 Pro, 11 Pro Max, 12 Mini, 12, 12 Pro or 12 Pro Max, 13 Mini, 13, 13 Pro, 13 Pro Max, 14, 14 Plus, 14 Pro, 14 Pro Max.[/en]
* [ja]iPhone X や XS、XS Max、XR、11、11 Pro、11 Pro Max、12 Mini、12、12 Pro、12 Pro Max、13 Mini、13、13 Pro、13 Pro Max、14、14 Plus、14 Pro、または14 Pro Max上で実行されているかどうかを返します。[/ja]
* @return {Boolean}
*/
}, {
key: "isIPhoneX",
value: function isIPhoneX() {
// iOS WebViews on the same iOS version have the same user agent.
// We cannot avoid using window.screen.
// We also cannot use cordova-plugin-device since its behavior is different between simulators and real devices.
// This works well both in iOS Safari and (UI|WK)WebView of iPhone X.
return this.isIPhone() && (
// X, XS, 11 Pro, 12 Mini, 13 Mini
window.screen.width === 375 && window.screen.height === 812 ||
// portrait
window.screen.width === 812 && window.screen.height === 375 ||
// landscape
// XS Max, XR, 11, 11 Pro Max
window.screen.width === 414 && window.screen.height === 896 ||
// portrait
window.screen.width === 896 && window.screen.height === 414 ||
// landscape
// 12, 12 Pro, 13, 13 Pro, 14
window.screen.width === 390 && window.screen.height === 844 ||
// portrait
window.screen.width === 844 && window.screen.height === 390 ||
// landscape
// 12 Pro Max, 13 Pro Max, 14 Plus
window.screen.width === 428 && window.screen.height === 926 ||
// portrait
window.screen.width === 926 && window.screen.height === 428 ||
// landscape
// 14 Pro Max
window.screen.width === 430 && window.screen.height === 932 ||
// portrait
window.screen.width === 932 && window.screen.height === 430 ||
// landscape
// 14 Pro
window.screen.width === 393 && window.screen.height === 852 ||
// portrait
window.screen.width === 852 && window.screen.height === 393 // landscape
);
}
/**
* @method isIPad
* @signature isIPad()
* @description
* [en]Returns whether the device is iPad.[/en]
* [ja]iPad上で実行されているかどうかを返します。[/ja]
* @return {Boolean}
*/
}, {
key: "isIPad",
value: function isIPad() {
return /iPad/i.test(navigator.userAgent) || this.isIPadOS();
}
/**
* @return {Boolean}
*/
}, {
key: "isIPod",
value: function isIPod() {
return /iPod/i.test(navigator.userAgent);
}
//----------------
// iOS versions
//----------------
/**
* @method isIOS
* @signature isIOS([forceActualPlatform])
* @param {Boolean} forceActualPlatform
* [en]If true, selected platform is ignored and the actual platform is returned.[/en]
* [ja][/ja]
* @description
* [en]Returns whether the OS is iOS. By default will return manually selected platform if it is set.[/en]
* [ja]iOS上で実行されているかどうかを返します。[/ja]
* @return {Boolean}
*/
}, {
key: "isIOS",
value: function isIOS(forceActualPlatform) {
if (!forceActualPlatform && this._getSelectedPlatform()) {
return this._getSelectedPlatform() === 'ios';
}
if ((typeof device === "undefined" ? "undefined" : _typeof(device)) === 'object' && !/browser/i.test(device.platform)) {
return /iOS/i.test(device.platform);
} else {
return /iPhone|iPad|iPod/i.test(navigator.userAgent) || this.isIPadOS();
}
}
/**
* @method isIOS7above
* @signature isIOS7above()
* @description
* [en]Returns whether the iOS version is 7 or above.[/en]
* [ja]iOS7以上で実行されているかどうかを返します。[/ja]
* @return {Boolean}
*/
}, {
key: "isIOS7above",
value: function isIOS7above() {
if ((typeof device === "undefined" ? "undefined" : _typeof(device)) === 'object' && !/browser/i.test(device.platform)) {
return /iOS/i.test(device.platform) && parseInt(device.version.split('.')[0]) >= 7;
} else if (/iPhone|iPad|iPod/i.test(navigator.userAgent)) {
var ver = (navigator.userAgent.match(/\b[0-9]+_[0-9]+(?:_[0-9]+)?\b/) || [''])[0].replace(/_/g, '.');
return parseInt(ver.split('.')[0]) >= 7;
}
return false;
}
/**
* @method isIPadOS
* @signature isIPadOS()
* @description
* [en]Returns whether the OS is iPadOS.[/en]
* [ja][/ja]
* @return {Boolean}
*/
}, {
key: "isIPadOS",
value: function isIPadOS() {
// The iPadOS User Agent string is the same as MacOS so as a
// workaround we test the max touch points, which is 5 for
// iPads and 0 for desktop browsers.
return !!(/Macintosh/i.test(navigator.userAgent) && navigator.maxTouchPoints && navigator.maxTouchPoints === 5);
}
//----------------
// iOS browsers
//----------------
/**
* @method isIOSSafari
* @signature isIOSSafari()
* @description
* [en]Returns whether app is running in iOS Safari.[/en]
* [ja]iOS Safariで実行されているかどうかを返します。[/ja]
* @return {Boolean}
*/
}, {
key: "isIOSSafari",
value: function isIOSSafari() {
var navigator = window.navigator;
var ua = navigator.userAgent;
return !!(this.isIOS() && ua.indexOf('Safari') !== -1 && ua.indexOf('Version') !== -1 && !navigator.standalone);
}
/**
* @method isWKWebView
* @signature isWKWebView()
* @description
* [en]Returns whether app is running in WKWebView.[/en]
* [ja]WKWebViewで実行されているかどうかを返します。[/ja]
* @return {Boolean}
*/
}, {
key: "isWKWebView",
value: function isWKWebView() {
var lte9 = /constructor/i.test(NativeHTMLElement);
return !!(this.isIOS() && window.webkit && window.webkit.messageHandlers && window.indexedDB && !lte9);
}
//----------------
// Android devices
//----------------
/**
* @method isAndroidPhone
* @signature isAndroidPhone()
* @description
* [en]Returns whether the device is Android phone.[/en]
* [ja]Android携帯上で実行されているかどうかを返します。[/ja]
* @return {Boolean}
*/
}, {
key: "isAndroidPhone",
value: function isAndroidPhone() {
return /Android/i.test(navigator.userAgent) && /Mobile/i.test(navigator.userAgent);
}
/**
* @method isAndroidTablet
* @signature isAndroidTablet()
* @description
* [en]Returns whether the device is Android tablet.[/en]
* [ja]Androidタブレット上で実行されているかどうかを返します。[/ja]
* @return {Boolean}
*/
}, {
key: "isAndroidTablet",
value: function isAndroidTablet() {
return /Android/i.test(navigator.userAgent) && !/Mobile/i.test(navigator.userAgent);
}
//----------------
// Android versions
//----------------
/**
* @method isAndroid
* @signature isAndroid([forceActualPlatform])
* @param {Boolean} forceActualPlatform
* [en]If true, selected platform is ignored and the actual platform is returned.[/en]
* [ja][/ja]
* @description
* [en]Returns whether the OS is Android. By default will return manually selected platform if it is set.[/en]
* [ja]Android上で実行されているかどうかを返します。[/ja]
* @return {Boolean}
*/
}, {
key: "isAndroid",
value: function isAndroid(forceActualPlatform) {
if (!forceActualPlatform && this._getSelectedPlatform()) {
return this._getSelectedPlatform() === 'android';
}
if ((typeof device === "undefined" ? "undefined" : _typeof(device)) === 'object' && !/browser/i.test(device.platform)) {
return /Android/i.test(device.platform);
} else {
return /Android/i.test(navigator.userAgent);
}
}
//----------------
// Other devices
//----------------
/**
* @method isWP
* @signature isWP([forceActualPlatform])
* @param {Boolean} forceActualPlatform
* [en]If true, selected platform is ignored and the actual platform is returned.[/en]
* [ja][/ja]
* @description
* [en]Returns whether the OS is Windows phone. By default will return manually selected platform if it is set.[/en]
* [ja][/ja]
* @return {Boolean}
*/
}, {
key: "isWP",
value: function isWP(forceActualPlatform) {
if (!forceActualPlatform && this._getSelectedPlatform()) {
return this._getSelectedPlatform() === 'wp';
}
if ((typeof device === "undefined" ? "undefined" : _typeof(device)) === 'object' && !/browser/i.test(device.platform)) {
return /Win32NT|WinCE/i.test(device.platform);
} else {
return /Windows Phone|IEMobile|WPDesktop/i.test(navigator.userAgent);
}
}
/**
* @method isBlackBerry
* @signature isBlackBerry([forceActualPlatform])
* @param {Boolean} forceActualPlatform
* [en]If true, selected platform is ignored and the actual platform is returned.[/en]
* [ja][/ja]
* @description
* [en]Returns whether the device is BlackBerry. By default will return manually selected platform if it is set.[/en]
* [ja]BlackBerry上で実行されているかどうかを返します。[/ja]
* @return {Boolean}
*/
}, {
key: "isBlackBerry",
value: function isBlackBerry(forceActualPlatform) {
if (!forceActualPlatform && this._getSelectedPlatform()) {
return this._getSelectedPlatform() === 'blackberry';
}
if ((typeof device === "undefined" ? "undefined" : _typeof(device)) === 'object' && !/browser/i.test(device.platform)) {
return /BlackBerry/i.test(device.platform);
} else {
return /BlackBerry|RIM Tablet OS|BB10/i.test(navigator.userAgent);
}
}
//----------------
// Other browsers
//----------------
/**
* @method isOpera
* @signature isOpera([forceActualPlatform])
* @param {Boolean} forceActualPlatform
* [en]If true, selected platform is ignored and the actual platform is returned.[/en]
* [ja][/ja]
* @description
* [en]Returns whether the browser is Opera. By default will return manually selected platform if it is set.[/en]
* [ja]Opera上で実行されているかどうかを返します。[/ja]
* @return {Boolean}
*/
}, {
key: "isOpera",
value: function isOpera(forceActualPlatform) {
if (!forceActualPlatform && this._getSelectedPlatform()) {
return this._getSelectedPlatform() === 'opera';
}
return !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0;
}
/**
* @method isFirefox
* @signature isFirefox([forceActualPlatform])
* @param {Boolean} forceActualPlatform
* [en]If true, selected platform is ignored and the actual platform is returned.[/en]
* [ja][/ja]
* @description
* [en]Returns whether the browser is Firefox. By default will return manually selected platform if it is set.[/en]
* [ja]Firefox上で実行されているかどうかを返します。[/ja]
* @return {Boolean}
*/
}, {
key: "isFirefox",
value: function isFirefox(forceActualPlatform) {
if (!forceActualPlatform && this._getSelectedPlatform()) {
return this._getSelectedPlatform() === 'firefox';
}
return typeof InstallTrigger !== 'undefined';
}
/**
* @method isSafari
* @signature isSafari([forceActualPlatform])
* @param {Boolean} forceActualPlatform
* [en]If true, selected platform is ignored and the actual platform is returned.[/en]
* [ja][/ja]
* @description
* [en]Returns whether the browser is Safari. By default will return manually selected platform if it is set.[/en]
* [ja]Safari上で実行されているかどうかを返します。[/ja]
* @return {Boolean}
*/
}, {
key: "isSafari",
value: function isSafari(forceActualPlatform) {
if (!forceActualPlatform && this._getSelectedPlatform()) {
return this._getSelectedPlatform() === 'safari';
}
return Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0 || function (p) {
return p.toString() === '[object SafariRemoteNotification]';
}(!window['safari'] || safari.pushNotification);
}
/**
* @method isChrome
* @signature isChrome([forceActualPlatform])
* @param {Boolean} forceActualPlatform
* [en]If true, selected platform is ignored and the actual platform is returned.[/en]
* [ja][/ja]
* @description
* [en]Returns whether the browser is Chrome. By default will return manually selected platform if it is set.[/en]
* [ja]Chrome上で実行されているかどうかを返します。[/ja]
* @return {Boolean}
*/
}, {
key: "isChrome",
value: function isChrome(forceActualPlatform) {
if (!forceActualPlatform && this._getSelectedPlatform()) {
return this._getSelectedPlatform() === 'chrome';
}
return !!window.chrome && !(!!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0) && !(navigator.userAgent.indexOf(' Edge/') >= 0);
}
/**
* @method isIE
* @signature isIE([forceActualPlatform])
* @param {Boolean} forceActualPlatform
* [en]If true, selected platform is ignored and the actual platform is returned.[/en]
* [ja][/ja]
* @description
* [en]Returns whether the browser is Internet Explorer. By default will return manually selected platform if it is set.[/en]
* [ja]Internet Explorer上で実行されているかどうかを返します。[/ja]
* @return {Boolean}
*/
}, {
key: "isIE",
value: function isIE(forceActualPlatform) {
if (!forceActualPlatform && this._getSelectedPlatform()) {
return this._getSelectedPlatform() === 'ie';
}
return !!document.documentMode;
}
/**
* @method isEdge
* @signature isEdge([forceActualPlatform])
* @param {Boolean} forceActualPlatform
* [en]If true, selected platform is ignored and the actual platform is returned.[/en]
* [ja][/ja]
* @description
* [en]Returns whether the browser is Edge. By default will return manually selected platform if it is set.[/en]
* [ja]Edge上で実行されているかどうかを返します。[/ja]
* @return {Boolean}
*/
}, {
key: "isEdge",
value: function isEdge(forceActualPlatform) {
if (!forceActualPlatform && this._getSelectedPlatform()) {
return this._getSelectedPlatform() === 'edge';
}
return navigator.userAgent.indexOf(' Edge/') >= 0;
}
//----------------
// Utility functions
//----------------
/**
* @return {String}
*/
}, {
key: "getMobileOS",
value: function getMobileOS() {
if (this.isAndroid()) {
return 'android';
} else if (this.isIOS()) {
return 'ios';
} else if (this.isWP()) {
return 'wp';
} else {
return 'other';
}
}
/**
* @return {String}
*/
}, {
key: "getIOSDevice",
value: function getIOSDevice() {
if (this.isIPhone()) {
return 'iphone';
} else if (this.isIPad()) {
return 'ipad';
} else if (this.isIPod()) {
return 'ipod';
} else {
return 'na';
}
}
}]);
return Platform;
}();
var platform = new Platform();
// For @onsenui/custom-elements
if (window.customElements) {
// even if native CE1 impl exists, use polyfill
window.customElements.forcePolyfill = true;
}
(function () {
var g = new function () {}();
var aa = new Set("annotation-xml color-profile font-face font-face-src font-face-uri font-face-format font-face-name missing-glyph".split(" "));
function k(b) {
var a = aa.has(b);
b = /^[a-z][.0-9_a-z]*-[\-.0-9_a-z]*$/.test(b);
return !a && b;
}
function l(b) {
var a = b.isConnected;
if (void 0 !== a) return a;
for (; b && !(b.__CE_isImportDocument || b instanceof Document);) b = b.parentNode || (window.ShadowRoot && b instanceof ShadowRoot ? b.host : void 0);
return !(!b || !(b.__CE_isImportDocument || b instanceof Document));
}
function m(b, a) {
for (; a && a !== b && !a.nextSibling;) a = a.parentNode;
return a && a !== b ? a.nextSibling : null;
}
function n(b, a, e) {
e = e ? e : new Set();
for (var c = b; c;) {
if (c.nodeType === Node.ELEMENT_NODE) {
var d = c;
a(d);
var h = d.localName;
if ("link" === h && "import" === d.getAttribute("rel")) {
c = d.import;
if (c instanceof Node && !e.has(c)) for (e.add(c), c = c.firstChild; c; c = c.nextSibling) n(c, a, e);
c = m(b, d);
continue;
} else if ("template" === h) {
c = m(b, d);
continue;
}
if (d = d.__CE_shadowRoot) for (d = d.firstChild; d; d = d.nextSibling) n(d, a, e);
}
c = c.firstChild ? c.firstChild : m(b, c);
}
}
function q(b, a, e) {
b[a] = e;
}
function r() {
this.a = new Map();
this.f = new Map();
this.c = [];
this.b = !1;
}
function ba(b, a, e) {
b.a.set(a, e);
b.f.set(e.constructor, e);
}
function t(b, a) {
b.b = !0;
b.c.push(a);
}
function v(b, a) {
b.b && n(a, function (a) {
return w(b, a);
});
}
function w(b, a) {
if (b.b && !a.__CE_patched) {
a.__CE_patched = !0;
for (var e = 0; e < b.c.length; e++) b.c[e](a);
}
}
function x(b, a) {
var e = [];
n(a, function (b) {
return e.push(b);
});
for (a = 0; a < e.length; a++) {
var c = e[a];
1 === c.__CE_state ? l(c) && b.connectedCallback(c) : y(b, c);
}
}
function z(b, a) {
var e = [];
n(a, function (b) {
return e.push(b);
});
for (a = 0; a < e.length; a++) {
var c = e[a];
1 === c.__CE_state && b.disconnectedCallback(c);
}
}
function A(b, a, e) {
e = e ? e : new Set();
var c = [];
n(a, function (d) {
if ("link" === d.localName && "import" === d.getAttribute("rel")) {
var a = d.import;
a instanceof Node && "complete" === a.readyState ? (a.__CE_isImportDocument = !0, a.__CE_hasRegistry = !0) : d.addEventListener("load", function () {
var a = d.import;
a.__CE_documentLoadHandled || (a.__CE_documentLoadHandled = !0, a.__CE_isImportDocument = !0, a.__CE_hasRegistry = !0, e.delete(a), A(b, a, e));
});
} else c.push(d);
}, e);
if (b.b) for (a = 0; a < c.length; a++) w(b, c[a]);
for (a = 0; a < c.length; a++) y(b, c[a]);
}
function y(b, a) {
if (void 0 === a.__CE_state) {
var e = b.a.get(a.localName);
if (e) {
e.constructionStack.push(a);
var c = e.constructor;
try {
try {
if (new c() !== a) throw Error("The custom element constructor did not produce the element being upgraded.");
} finally {
e.constructionStack.pop();
}
} catch (f) {
throw a.__CE_state = 2, f;
}
a.__CE_state = 1;
a.__CE_definition = e;
if (e.attributeChangedCallback) for (e = e.observedAttributes, c = 0; c < e.length; c++) {
var d = e[c],
h = a.getAttribute(d);
null !== h && b.attributeChangedCallback(a, d, null, h, null);
}
l(a) && b.connectedCallback(a);
}
}
}
r.prototype.connectedCallback = function (b) {
var a = b.__CE_definition;
a.connectedCallback && a.connectedCallback.call(b);
b.i = !0;
};
r.prototype.disconnectedCallback = function (b) {
b.i || this.connectedCallback(b);
var a = b.__CE_definition;
a.disconnectedCallback && a.disconnectedCallback.call(b);
b.i = void 0;
};
r.prototype.attributeChangedCallback = function (b, a, e, c, d) {
var h = b.__CE_definition;
h.attributeChangedCallback && -1 < h.observedAttributes.indexOf(a) && h.attributeChangedCallback.call(b, a, e, c, d);
};
function B(b, a) {
this.c = b;
this.a = a;
this.b = void 0;
A(this.c, this.a);
"loading" === this.a.readyState && (this.b = new MutationObserver(this.f.bind(this)), this.b.observe(this.a, {
childList: !0,
subtree: !0
}));
}
function C(b) {
b.b && b.b.disconnect();
}
B.prototype.f = function (b) {
var a = this.a.readyState;
"interactive" !== a && "complete" !== a || C(this);
for (a = 0; a < b.length; a++) for (var e = b[a].addedNodes, c = 0; c < e.length; c++) A(this.c, e[c]);
};
function ca() {
var b = this;
this.b = this.a = void 0;
this.c = new Promise(function (a) {
b.b = a;
b.a && a(b.a);
});
}
function D(b) {
if (b.a) throw Error("Already resolved.");
b.a = void 0;
b.b && b.b(void 0);
}
function E(b) {
this.f = !1;
this.a = b;
this.h = new Map();
this.g = function (b) {
return b();
};
this.b = !1;
this.c = [];
this.l = new B(b, document);
}
E.prototype.m = function (b, a) {
var e = this;
if (!(a instanceof Function)) throw new TypeError("Custom element constructors must be functions.");
if (!k(b)) throw new SyntaxError("The element name '" + b + "' is not valid.");
if (this.a.a.get(b)) throw Error("A custom element with name '" + b + "' has already been defined.");
if (this.f) throw Error("A custom element is already being defined.");
this.f = !0;
var c, d, h, f, u;
try {
var p = function p(b) {
var a = P[b];
if (void 0 !== a && !(a instanceof Function)) throw Error("The '" + b + "' callback must be a function.");
return a;
},
P = a.prototype;
if (!(P instanceof Object)) throw new TypeError("The custom element constructor's prototype is not an object.");
c = p("connectedCallback");
d = p("disconnectedCallback");
h = p("adoptedCallback");
f = p("attributeChangedCallback");
u = a.observedAttributes || [];
} catch (va) {
return;
} finally {
this.f = !1;
}
ba(this.a, b, {
localName: b,
constructor: a,
connectedCallback: c,
disconnectedCallback: d,
adoptedCallback: h,
attributeChangedCallback: f,
observedAttributes: u,
constructionStack: []
});
this.c.push(b);
this.b || (this.b = !0, this.g(function () {
if (!1 !== e.b) for (e.b = !1, A(e.a, document); 0 < e.c.length;) {
var b = e.c.shift();
(b = e.h.get(b)) && D(b);
}
}));
};
E.prototype.get = function (b) {
if (b = this.a.a.get(b)) return b.constructor;
};
E.prototype.s = function (b) {
if (!k(b)) return Promise.reject(new SyntaxError("'" + b + "' is not a valid custom element name."));
var a = this.h.get(b);
if (a) return a.c;
a = new ca();
this.h.set(b, a);
this.a.a.get(b) && -1 === this.c.indexOf(b) && D(a);
return a.c;
};
E.prototype.o = function (b) {
C(this.l);
var a = this.g;
this.g = function (e) {
return b(function () {
return a(e);
});
};
};
window.CustomElementRegistry = E;
E.prototype.define = E.prototype.m;
E.prototype.get = E.prototype.get;
E.prototype.whenDefined = E.prototype.s;
E.prototype.polyfillWrapFlushCallback = E.prototype.o;
var F = window.Document.prototype.createElement,
da = window.Document.prototype.createElementNS,
ea = window.Document.prototype.importNode,
fa = window.Document.prototype.prepend,
ga = window.Document.prototype.append,
G = window.Node.prototype.cloneNode,
H = window.Node.prototype.appendChild,
I = window.Node.prototype.insertBefore,
J = window.Node.prototype.removeChild,
K = window.Node.prototype.replaceChild,
L = Object.getOwnPropertyDescriptor(window.Node.prototype, "textContent"),
M = window.Element.prototype.attachShadow,
N = Object.getOwnPropertyDescriptor(window.Element.prototype, "innerHTML"),
O = window.Element.prototype.getAttribute,
Q = window.Element.prototype.setAttribute,
R = window.Element.prototype.removeAttribute,
S = window.Element.prototype.getAttributeNS,
T = window.Element.prototype.setAttributeNS,
U = window.Element.prototype.removeAttributeNS,
V = window.Element.prototype.insertAdjacentElement,
ha = window.Element.prototype.prepend,
ia = window.Element.prototype.append,
ja = window.Element.prototype.before,
ka = window.Element.prototype.after,
la = window.Element.prototype.replaceWith,
ma = window.Element.prototype.remove,
na = window.HTMLElement,
W = Object.getOwnPropertyDescriptor(window.HTMLElement.prototype, "innerHTML"),
X = window.HTMLElement.prototype.insertAdjacentElement;
function oa() {
var b = Y;
window.HTMLElement = function () {
function a() {
var a = this.constructor,
c = b.f.get(a);
if (!c) throw Error("The custom element being constructed was not registered with `customElements`.");
var d = c.constructionStack;
if (!d.length) return d = F.call(document, c.localName), Object.setPrototypeOf(d, a.prototype), d.__CE_state = 1, d.__CE_definition = c, w(b, d), d;
var c = d.length - 1,
h = d[c];
if (h === g) throw Error("The HTMLElement constructor was either called reentrantly for this constructor or called multiple times.");
d[c] = g;
Object.setPrototypeOf(h, a.prototype);
w(b, h);
return h;
}
a.prototype = na.prototype;
return a;
}();
}
function pa(b, a, e) {
a.prepend = function (a) {
for (var d = [], c = 0; c < arguments.length; ++c) d[c - 0] = arguments[c];
c = d.filter(function (b) {
return b instanceof Node && l(b);
});
e.j.apply(this, d);
for (var f = 0; f < c.length; f++) z(b, c[f]);
if (l(this)) for (c = 0; c < d.length; c++) f = d[c], f instanceof Element && x(b, f);
};
a.append = function (a) {
for (var d = [], c = 0; c < arguments.length; ++c) d[c - 0] = arguments[c];
c = d.filter(function (b) {
return b instanceof Node && l(b);
});
e.append.apply(this, d);
for (var f = 0; f < c.length; f++) z(b, c[f]);
if (l(this)) for (c = 0; c < d.length; c++) f = d[c], f instanceof Element && x(b, f);
};
}
function qa() {
var b = Y;
q(Document.prototype, "createElement", function (a) {
if (this.__CE_hasRegistry) {
var e = b.a.get(a);
if (e) return new e.constructor();
}
a = F.call(this, a);
w(b, a);
return a;
});
q(Document.prototype, "importNode", function (a, e) {
a = ea.call(this, a, e);
this.__CE_hasRegistry ? A(b, a) : v(b, a);
return a;
});
q(Document.prototype, "createElementNS", function (a, e) {
if (this.__CE_hasRegistry && (null === a || "http://www.w3.org/1999/xhtml" === a)) {
var c = b.a.get(e);
if (c) return new c.constructor();
}
a = da.call(this, a, e);
w(b, a);
return a;
});
pa(b, Document.prototype, {
j: fa,
append: ga
});
}
function ra() {
var b = Y;
function a(a, c) {
Object.defineProperty(a, "textContent", {
enumerable: c.enumerable,
configurable: !0,
get: c.get,
set: function set(a) {
if (this.nodeType === Node.TEXT_NODE) c.set.call(this, a);else {
var d = void 0;
if (this.firstChild) {
var e = this.childNodes,
u = e.length;
if (0 < u && l(this)) for (var d = Array(u), p = 0; p < u; p++) d[p] = e[p];
}
c.set.call(this, a);
if (d) for (a = 0; a < d.length; a++) z(b, d[a]);
}
}
});
}
q(Node.prototype, "insertBefore", function (a, c) {
if (a instanceof DocumentFragment) {
var d = Array.prototype.slice.apply(a.childNodes);
a = I.call(this, a, c);
if (l(this)) for (c = 0; c < d.length; c++) x(b, d[c]);
return a;
}
d = l(a);
c = I.call(this, a, c);
d && z(b, a);
l(this) && x(b, a);
return c;
});
q(Node.prototype, "appendChild", function (a) {
if (a instanceof DocumentFragment) {
var c = Array.prototype.slice.apply(a.childNodes);
a = H.call(this, a);
if (l(this)) for (var d = 0; d < c.length; d++) x(b, c[d]);
return a;
}
c = l(a);
d = H.call(this, a);
c && z(b, a);
l(this) && x(b, a);
return d;
});
q(Node.prototype, "cloneNode", function (a) {
a = G.call(this, a);
this.ownerDocument.__CE_hasRegistry ? A(b, a) : v(b, a);
return a;
});
q(Node.prototype, "removeChild", function (a) {
var c = l(a),
d = J.call(this, a);
c && z(b, a);
return d;
});
q(Node.prototype, "replaceChild", function (a, c) {
if (a instanceof DocumentFragment) {
var d = Array.prototype.slice.apply(a.childNodes);
a = K.call(this, a, c);
if (l(this)) for (z(b, c), c = 0; c < d.length; c++) x(b, d[c]);
return a;
}
var d = l(a),
e = K.call(this, a, c),
f = l(this);
f && z(b, c);
d && z(b, a);
f && x(b, a);
return e;
});
L && L.get ? a(Node.prototype, L) : t(b, function (b) {
a(b, {
enumerable: !0,
configurable: !0,
get: function get() {
for (var a = [], b = 0; b < this.childNodes.length; b++) a.push(this.childNodes[b].textContent);
return a.join("");
},
set: function set(a) {
for (; this.firstChild;) J.call(this, this.firstChild);
H.call(this, document.createTextNode(a));
}
});
});
}
function sa(b) {
var a = Element.prototype;
a.before = function (a) {
for (var c = [], d = 0; d < arguments.length; ++d) c[d - 0] = arguments[d];
d = c.filter(function (a) {
return a instanceof Node && l(a);
});
ja.apply(this, c);
for (var e = 0; e < d.length; e++) z(b, d[e]);
if (l(this)) for (d = 0; d < c.length; d++) e = c[d], e instanceof Element && x(b, e);
};
a.after = function (a) {
for (var c = [], d = 0; d < arguments.length; ++d) c[d - 0] = arguments[d];
d = c.filter(function (a) {
return a instanceof Node && l(a);
});
ka.apply(this, c);
for (var e = 0; e < d.length; e++) z(b, d[e]);
if (l(this)) for (d = 0; d < c.length; d++) e = c[d], e instanceof Element && x(b, e);
};
a.replaceWith = function (a) {
for (var c = [], d = 0; d < arguments.length; ++d) c[d - 0] = arguments[d];
var d = c.filter(function (a) {
return a instanceof Node && l(a);
}),
e = l(this);
la.apply(this, c);
for (var f = 0; f < d.length; f++) z(b, d[f]);
if (e) for (z(b, this), d = 0; d < c.length; d++) e = c[d], e instanceof Element && x(b, e);
};
a.remove = function () {
var a = l(this);
ma.call(this);
a && z(b, this);
};
}
function ta() {
var b = Y;
function a(a, c) {
Object.defineProperty(a, "innerHTML", {
enumerable: c.enumerable,
configurable: !0,
get: c.get,
set: function set(a) {
var d = this,
e = void 0;
l(this) && (e = [], n(this, function (a) {
a !== d && e.push(a);
}));
c.set.call(this, a);
if (e) for (var f = 0; f < e.length; f++) {
var h = e[f];
1 === h.__CE_state && b.disconnectedCallback(h);
}
this.ownerDocument.__CE_hasRegistry ? A(b, this) : v(b, this);
return a;
}
});
}
function e(a, c) {
q(a, "insertAdjacentElement", function (a, d) {
var e = l(d);
a = c.call(this, a, d);
e && z(b, d);
l(a) && x(b, d);
return a;
});
}
M ? q(Element.prototype, "attachShadow", function (a) {
return this.__CE_shadowRoot = a = M.call(this, a);
}) : console.warn("Custom Elements: `Element#attachShadow` was not patched.");
if (N && N.get) a(Element.prototype, N);else if (W && W.get) a(HTMLElement.prototype, W);else {
var c = F.call(document, "div");
t(b, function (b) {
a(b, {
enumerable: !0,
configurable: !0,
get: function get() {
return G.call(this, !0).innerHTML;
},
set: function set(a) {
var b = "template" === this.localName ? this.content : this;
for (c.innerHTML = a; 0 < b.childNodes.length;) J.call(b, b.childNodes[0]);
for (; 0 < c.childNodes.length;) H.call(b, c.childNodes[0]);
}
});
});
}
q(Element.prototype, "setAttribute", function (a, c) {
if (1 !== this.__CE_state) return Q.call(this, a, c);
var d = O.call(this, a);
Q.call(this, a, c);
c = O.call(this, a);
b.attributeChangedCallback(this, a, d, c, null);
});
q(Element.prototype, "setAttributeNS", function (a, c, e) {
if (1 !== this.__CE_state) return T.call(this, a, c, e);
var d = S.call(this, a, c);
T.call(this, a, c, e);
e = S.call(this, a, c);
b.attributeChangedCallback(this, c, d, e, a);
});
q(Element.prototype, "removeAttribute", function (a) {
if (1 !== this.__CE_state) return R.call(this, a);
var c = O.call(this, a);
R.call(this, a);
null !== c && b.attributeChangedCallback(this, a, c, null, null);
});
q(Element.prototype, "removeAttributeNS", function (a, c) {
if (1 !== this.__CE_state) return U.call(this, a, c);
var d = S.call(this, a, c);
U.call(this, a, c);
var e = S.call(this, a, c);
d !== e && b.attributeChangedCallback(this, c, d, e, a);
});
X ? e(HTMLElement.prototype, X) : V ? e(Element.prototype, V) : console.warn("Custom Elements: `Element#insertAdjacentElement` was not patched.");
pa(b, Element.prototype, {
j: ha,
append: ia
});
sa(b);
}
var Z = window.customElements;
if (!Z || Z.forcePolyfill || "function" != typeof Z.define || "function" != typeof Z.get) {
var Y = new r();
oa();
qa();
ra();
ta();
document.__CE_hasRegistry = !0;
var ua = new E(Y);
Object.defineProperty(window, "customElements", {
configurable: !0,
enumerable: !0,
value: ua
});
}
}).call(self);
/**
* @license
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
* The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
* Code distributed by Google as part of the polymer project is also
* subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
*/
// @version 0.7.22
(function (global) {
if (global.JsMutationObserver) {
return;
}
var registrationsTable = new WeakMap();
var setImmediate;
if (/Trident|Edge/.test(navigator.userAgent)) {
setImmediate = setTimeout;
} else if (window.setImmediate) {
setImmediate = window.setImmediate;
} else {
var setImmediateQueue = [];
var sentinel = String(Math.random());
window.addEventListener("message", function (e) {
if (e.data === sentinel) {
var queue = setImmediateQueue;
setImmediateQueue = [];
queue.forEach(funct