native-fn 1.1.8 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (201) hide show
  1. package/README.md +2705 -21
  2. package/dist/index.d.ts +130 -117
  3. package/dist/native.cjs +581 -563
  4. package/dist/native.min.cjs +1 -1
  5. package/dist/native.min.mjs +1 -1
  6. package/dist/native.mjs +581 -563
  7. package/dist/native.umd.js +581 -563
  8. package/dist/native.umd.min.js +1 -1
  9. package/dist/plugin/appearance/src/errors/invalid-state-error.d.ts +2 -0
  10. package/dist/plugin/appearance/src/plugin/badge/types/badge.d.ts +1 -1
  11. package/dist/plugin/appearance/src/plugin/battery/types/battery.d.ts +1 -1
  12. package/dist/plugin/appearance/src/plugin/fullscreen/cores/index.d.ts +3 -3
  13. package/dist/plugin/appearance/src/plugin/fullscreen/types/fullscreen.d.ts +9 -3
  14. package/dist/plugin/appearance/src/plugin/geolocation/types/geolocation.d.ts +1 -1
  15. package/dist/plugin/appearance/src/plugin/open/types/open.d.ts +1 -1
  16. package/dist/plugin/appearance/src/plugin/permission/types/permission.d.ts +1 -0
  17. package/dist/plugin/appearance/src/plugin/pip/cores/index.d.ts +6 -6
  18. package/dist/plugin/appearance/src/plugin/pip/types/pip.d.ts +12 -6
  19. package/dist/plugin/appearance/src/plugin/vibration/types/vibration.d.ts +1 -1
  20. package/dist/plugin/badge/index.cjs +2 -2
  21. package/dist/plugin/badge/index.d.ts +1 -1
  22. package/dist/plugin/badge/index.mjs +2 -2
  23. package/dist/plugin/badge/src/errors/invalid-state-error.d.ts +2 -0
  24. package/dist/plugin/badge/src/plugin/badge/types/badge.d.ts +1 -1
  25. package/dist/plugin/badge/src/plugin/battery/types/battery.d.ts +1 -1
  26. package/dist/plugin/badge/src/plugin/fullscreen/cores/index.d.ts +3 -3
  27. package/dist/plugin/badge/src/plugin/fullscreen/types/fullscreen.d.ts +9 -3
  28. package/dist/plugin/badge/src/plugin/geolocation/types/geolocation.d.ts +1 -1
  29. package/dist/plugin/badge/src/plugin/open/types/open.d.ts +1 -1
  30. package/dist/plugin/badge/src/plugin/permission/types/permission.d.ts +1 -0
  31. package/dist/plugin/badge/src/plugin/pip/cores/index.d.ts +6 -6
  32. package/dist/plugin/badge/src/plugin/pip/types/pip.d.ts +12 -6
  33. package/dist/plugin/badge/src/plugin/vibration/types/vibration.d.ts +1 -1
  34. package/dist/plugin/battery/index.cjs +3 -3
  35. package/dist/plugin/battery/index.d.ts +1 -1
  36. package/dist/plugin/battery/index.mjs +3 -3
  37. package/dist/plugin/battery/src/errors/invalid-state-error.d.ts +2 -0
  38. package/dist/plugin/battery/src/plugin/badge/types/badge.d.ts +1 -1
  39. package/dist/plugin/battery/src/plugin/battery/types/battery.d.ts +1 -1
  40. package/dist/plugin/battery/src/plugin/fullscreen/cores/index.d.ts +3 -3
  41. package/dist/plugin/battery/src/plugin/fullscreen/types/fullscreen.d.ts +9 -3
  42. package/dist/plugin/battery/src/plugin/geolocation/types/geolocation.d.ts +1 -1
  43. package/dist/plugin/battery/src/plugin/open/types/open.d.ts +1 -1
  44. package/dist/plugin/battery/src/plugin/permission/types/permission.d.ts +1 -0
  45. package/dist/plugin/battery/src/plugin/pip/cores/index.d.ts +6 -6
  46. package/dist/plugin/battery/src/plugin/pip/types/pip.d.ts +12 -6
  47. package/dist/plugin/battery/src/plugin/vibration/types/vibration.d.ts +1 -1
  48. package/dist/plugin/clipboard/src/errors/invalid-state-error.d.ts +2 -0
  49. package/dist/plugin/clipboard/src/plugin/badge/types/badge.d.ts +1 -1
  50. package/dist/plugin/clipboard/src/plugin/battery/types/battery.d.ts +1 -1
  51. package/dist/plugin/clipboard/src/plugin/fullscreen/cores/index.d.ts +3 -3
  52. package/dist/plugin/clipboard/src/plugin/fullscreen/types/fullscreen.d.ts +9 -3
  53. package/dist/plugin/clipboard/src/plugin/geolocation/types/geolocation.d.ts +1 -1
  54. package/dist/plugin/clipboard/src/plugin/open/types/open.d.ts +1 -1
  55. package/dist/plugin/clipboard/src/plugin/permission/types/permission.d.ts +1 -0
  56. package/dist/plugin/clipboard/src/plugin/pip/cores/index.d.ts +6 -6
  57. package/dist/plugin/clipboard/src/plugin/pip/types/pip.d.ts +12 -6
  58. package/dist/plugin/clipboard/src/plugin/vibration/types/vibration.d.ts +1 -1
  59. package/dist/plugin/dimension/src/errors/invalid-state-error.d.ts +2 -0
  60. package/dist/plugin/dimension/src/plugin/badge/types/badge.d.ts +1 -1
  61. package/dist/plugin/dimension/src/plugin/battery/types/battery.d.ts +1 -1
  62. package/dist/plugin/dimension/src/plugin/fullscreen/cores/index.d.ts +3 -3
  63. package/dist/plugin/dimension/src/plugin/fullscreen/types/fullscreen.d.ts +9 -3
  64. package/dist/plugin/dimension/src/plugin/geolocation/types/geolocation.d.ts +1 -1
  65. package/dist/plugin/dimension/src/plugin/open/types/open.d.ts +1 -1
  66. package/dist/plugin/dimension/src/plugin/permission/types/permission.d.ts +1 -0
  67. package/dist/plugin/dimension/src/plugin/pip/cores/index.d.ts +6 -6
  68. package/dist/plugin/dimension/src/plugin/pip/types/pip.d.ts +12 -6
  69. package/dist/plugin/dimension/src/plugin/vibration/types/vibration.d.ts +1 -1
  70. package/dist/plugin/fullscreen/index.cjs +499 -265
  71. package/dist/plugin/fullscreen/index.d.ts +14 -7
  72. package/dist/plugin/fullscreen/index.mjs +499 -265
  73. package/dist/plugin/fullscreen/src/errors/invalid-state-error.d.ts +2 -0
  74. package/dist/plugin/fullscreen/src/plugin/badge/types/badge.d.ts +1 -1
  75. package/dist/plugin/fullscreen/src/plugin/battery/types/battery.d.ts +1 -1
  76. package/dist/plugin/fullscreen/src/plugin/fullscreen/cores/index.d.ts +3 -3
  77. package/dist/plugin/fullscreen/src/plugin/fullscreen/types/fullscreen.d.ts +9 -3
  78. package/dist/plugin/fullscreen/src/plugin/geolocation/types/geolocation.d.ts +1 -1
  79. package/dist/plugin/fullscreen/src/plugin/open/types/open.d.ts +1 -1
  80. package/dist/plugin/fullscreen/src/plugin/permission/types/permission.d.ts +1 -0
  81. package/dist/plugin/fullscreen/src/plugin/pip/cores/index.d.ts +6 -6
  82. package/dist/plugin/fullscreen/src/plugin/pip/types/pip.d.ts +12 -6
  83. package/dist/plugin/fullscreen/src/plugin/vibration/types/vibration.d.ts +1 -1
  84. package/dist/plugin/geolocation/index.cjs +6 -0
  85. package/dist/plugin/geolocation/index.d.ts +1 -1
  86. package/dist/plugin/geolocation/index.mjs +6 -0
  87. package/dist/plugin/geolocation/src/errors/invalid-state-error.d.ts +2 -0
  88. package/dist/plugin/geolocation/src/plugin/badge/types/badge.d.ts +1 -1
  89. package/dist/plugin/geolocation/src/plugin/battery/types/battery.d.ts +1 -1
  90. package/dist/plugin/geolocation/src/plugin/fullscreen/cores/index.d.ts +3 -3
  91. package/dist/plugin/geolocation/src/plugin/fullscreen/types/fullscreen.d.ts +9 -3
  92. package/dist/plugin/geolocation/src/plugin/geolocation/types/geolocation.d.ts +1 -1
  93. package/dist/plugin/geolocation/src/plugin/open/types/open.d.ts +1 -1
  94. package/dist/plugin/geolocation/src/plugin/permission/types/permission.d.ts +1 -0
  95. package/dist/plugin/geolocation/src/plugin/pip/cores/index.d.ts +6 -6
  96. package/dist/plugin/geolocation/src/plugin/pip/types/pip.d.ts +12 -6
  97. package/dist/plugin/geolocation/src/plugin/vibration/types/vibration.d.ts +1 -1
  98. package/dist/plugin/notification/index.cjs +6 -0
  99. package/dist/plugin/notification/index.mjs +6 -0
  100. package/dist/plugin/notification/src/errors/invalid-state-error.d.ts +2 -0
  101. package/dist/plugin/notification/src/plugin/badge/types/badge.d.ts +1 -1
  102. package/dist/plugin/notification/src/plugin/battery/types/battery.d.ts +1 -1
  103. package/dist/plugin/notification/src/plugin/fullscreen/cores/index.d.ts +3 -3
  104. package/dist/plugin/notification/src/plugin/fullscreen/types/fullscreen.d.ts +9 -3
  105. package/dist/plugin/notification/src/plugin/geolocation/types/geolocation.d.ts +1 -1
  106. package/dist/plugin/notification/src/plugin/open/types/open.d.ts +1 -1
  107. package/dist/plugin/notification/src/plugin/permission/types/permission.d.ts +1 -0
  108. package/dist/plugin/notification/src/plugin/pip/cores/index.d.ts +6 -6
  109. package/dist/plugin/notification/src/plugin/pip/types/pip.d.ts +12 -6
  110. package/dist/plugin/notification/src/plugin/vibration/types/vibration.d.ts +1 -1
  111. package/dist/plugin/open/index.cjs +120 -120
  112. package/dist/plugin/open/index.d.ts +35 -35
  113. package/dist/plugin/open/index.mjs +120 -120
  114. package/dist/plugin/open/src/errors/invalid-state-error.d.ts +2 -0
  115. package/dist/plugin/open/src/plugin/badge/types/badge.d.ts +1 -1
  116. package/dist/plugin/open/src/plugin/battery/types/battery.d.ts +1 -1
  117. package/dist/plugin/open/src/plugin/fullscreen/cores/index.d.ts +3 -3
  118. package/dist/plugin/open/src/plugin/fullscreen/types/fullscreen.d.ts +9 -3
  119. package/dist/plugin/open/src/plugin/geolocation/types/geolocation.d.ts +1 -1
  120. package/dist/plugin/open/src/plugin/open/types/open.d.ts +1 -1
  121. package/dist/plugin/open/src/plugin/permission/types/permission.d.ts +1 -0
  122. package/dist/plugin/open/src/plugin/pip/cores/index.d.ts +6 -6
  123. package/dist/plugin/open/src/plugin/pip/types/pip.d.ts +12 -6
  124. package/dist/plugin/open/src/plugin/vibration/types/vibration.d.ts +1 -1
  125. package/dist/plugin/permission/index.cjs +6 -0
  126. package/dist/plugin/permission/index.d.ts +1 -0
  127. package/dist/plugin/permission/index.mjs +6 -0
  128. package/dist/plugin/permission/src/errors/invalid-state-error.d.ts +2 -0
  129. package/dist/plugin/permission/src/plugin/badge/types/badge.d.ts +1 -1
  130. package/dist/plugin/permission/src/plugin/battery/types/battery.d.ts +1 -1
  131. package/dist/plugin/permission/src/plugin/fullscreen/cores/index.d.ts +3 -3
  132. package/dist/plugin/permission/src/plugin/fullscreen/types/fullscreen.d.ts +9 -3
  133. package/dist/plugin/permission/src/plugin/geolocation/types/geolocation.d.ts +1 -1
  134. package/dist/plugin/permission/src/plugin/open/types/open.d.ts +1 -1
  135. package/dist/plugin/permission/src/plugin/permission/types/permission.d.ts +1 -0
  136. package/dist/plugin/permission/src/plugin/pip/cores/index.d.ts +6 -6
  137. package/dist/plugin/permission/src/plugin/pip/types/pip.d.ts +12 -6
  138. package/dist/plugin/permission/src/plugin/vibration/types/vibration.d.ts +1 -1
  139. package/dist/plugin/pip/index.cjs +255 -273
  140. package/dist/plugin/pip/index.d.ts +20 -13
  141. package/dist/plugin/pip/index.mjs +255 -273
  142. package/dist/plugin/pip/src/errors/invalid-state-error.d.ts +2 -0
  143. package/dist/plugin/pip/src/plugin/badge/types/badge.d.ts +1 -1
  144. package/dist/plugin/pip/src/plugin/battery/types/battery.d.ts +1 -1
  145. package/dist/plugin/pip/src/plugin/fullscreen/cores/index.d.ts +3 -3
  146. package/dist/plugin/pip/src/plugin/fullscreen/types/fullscreen.d.ts +9 -3
  147. package/dist/plugin/pip/src/plugin/geolocation/types/geolocation.d.ts +1 -1
  148. package/dist/plugin/pip/src/plugin/open/types/open.d.ts +1 -1
  149. package/dist/plugin/pip/src/plugin/permission/types/permission.d.ts +1 -0
  150. package/dist/plugin/pip/src/plugin/pip/cores/index.d.ts +6 -6
  151. package/dist/plugin/pip/src/plugin/pip/types/pip.d.ts +12 -6
  152. package/dist/plugin/pip/src/plugin/vibration/types/vibration.d.ts +1 -1
  153. package/dist/plugin/platform/index.d.ts +5 -5
  154. package/dist/plugin/platform/src/errors/invalid-state-error.d.ts +2 -0
  155. package/dist/plugin/platform/src/plugin/badge/types/badge.d.ts +1 -1
  156. package/dist/plugin/platform/src/plugin/battery/types/battery.d.ts +1 -1
  157. package/dist/plugin/platform/src/plugin/fullscreen/cores/index.d.ts +3 -3
  158. package/dist/plugin/platform/src/plugin/fullscreen/types/fullscreen.d.ts +9 -3
  159. package/dist/plugin/platform/src/plugin/geolocation/types/geolocation.d.ts +1 -1
  160. package/dist/plugin/platform/src/plugin/open/types/open.d.ts +1 -1
  161. package/dist/plugin/platform/src/plugin/permission/types/permission.d.ts +1 -0
  162. package/dist/plugin/platform/src/plugin/pip/cores/index.d.ts +6 -6
  163. package/dist/plugin/platform/src/plugin/pip/types/pip.d.ts +12 -6
  164. package/dist/plugin/platform/src/plugin/vibration/types/vibration.d.ts +1 -1
  165. package/dist/plugin/theme/src/errors/invalid-state-error.d.ts +2 -0
  166. package/dist/plugin/theme/src/plugin/badge/types/badge.d.ts +1 -1
  167. package/dist/plugin/theme/src/plugin/battery/types/battery.d.ts +1 -1
  168. package/dist/plugin/theme/src/plugin/fullscreen/cores/index.d.ts +3 -3
  169. package/dist/plugin/theme/src/plugin/fullscreen/types/fullscreen.d.ts +9 -3
  170. package/dist/plugin/theme/src/plugin/geolocation/types/geolocation.d.ts +1 -1
  171. package/dist/plugin/theme/src/plugin/open/types/open.d.ts +1 -1
  172. package/dist/plugin/theme/src/plugin/permission/types/permission.d.ts +1 -0
  173. package/dist/plugin/theme/src/plugin/pip/cores/index.d.ts +6 -6
  174. package/dist/plugin/theme/src/plugin/pip/types/pip.d.ts +12 -6
  175. package/dist/plugin/theme/src/plugin/vibration/types/vibration.d.ts +1 -1
  176. package/dist/plugin/vibration/index.cjs +5 -5
  177. package/dist/plugin/vibration/index.d.ts +1 -1
  178. package/dist/plugin/vibration/index.mjs +5 -5
  179. package/dist/plugin/vibration/src/errors/invalid-state-error.d.ts +2 -0
  180. package/dist/plugin/vibration/src/plugin/badge/types/badge.d.ts +1 -1
  181. package/dist/plugin/vibration/src/plugin/battery/types/battery.d.ts +1 -1
  182. package/dist/plugin/vibration/src/plugin/fullscreen/cores/index.d.ts +3 -3
  183. package/dist/plugin/vibration/src/plugin/fullscreen/types/fullscreen.d.ts +9 -3
  184. package/dist/plugin/vibration/src/plugin/geolocation/types/geolocation.d.ts +1 -1
  185. package/dist/plugin/vibration/src/plugin/open/types/open.d.ts +1 -1
  186. package/dist/plugin/vibration/src/plugin/permission/types/permission.d.ts +1 -0
  187. package/dist/plugin/vibration/src/plugin/pip/cores/index.d.ts +6 -6
  188. package/dist/plugin/vibration/src/plugin/pip/types/pip.d.ts +12 -6
  189. package/dist/plugin/vibration/src/plugin/vibration/types/vibration.d.ts +1 -1
  190. package/dist/src/errors/invalid-state-error.d.ts +2 -0
  191. package/dist/src/plugin/badge/types/badge.d.ts +1 -1
  192. package/dist/src/plugin/battery/types/battery.d.ts +1 -1
  193. package/dist/src/plugin/fullscreen/cores/index.d.ts +3 -3
  194. package/dist/src/plugin/fullscreen/types/fullscreen.d.ts +9 -3
  195. package/dist/src/plugin/geolocation/types/geolocation.d.ts +1 -1
  196. package/dist/src/plugin/open/types/open.d.ts +1 -1
  197. package/dist/src/plugin/permission/types/permission.d.ts +1 -0
  198. package/dist/src/plugin/pip/cores/index.d.ts +6 -6
  199. package/dist/src/plugin/pip/types/pip.d.ts +12 -6
  200. package/dist/src/plugin/vibration/types/vibration.d.ts +1 -1
  201. package/package.json +21 -13
@@ -4,7 +4,7 @@
4
4
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Native = factory());
5
5
  })(this, (function () { 'use strict';
6
6
 
7
- var version = "1.1.8";
7
+ var version = "1.2.0";
8
8
  var packageJSON = {
9
9
  version: version};
10
10
 
@@ -859,14 +859,14 @@
859
859
  };
860
860
  }
861
861
 
862
- var onChangeSubscriptionManager$3 = createSubscriptionManager(attachOnChange$3, detachOnChange$3);
862
+ var onChangeSubscriptionManager$5 = createSubscriptionManager(attachOnChange$5, detachOnChange$5);
863
863
  var appearanceRef = null;
864
864
  var pollingIntervalId = null;
865
865
  var Appearance = {
866
866
  get value() {
867
867
  return getAppearance();
868
868
  },
869
- onChange: onChangeSubscriptionManager$3.subscribe,
869
+ onChange: onChangeSubscriptionManager$5.subscribe,
870
870
  Constants: {
871
871
  Appearances: Appearances
872
872
  },
@@ -902,7 +902,7 @@
902
902
  var appearance = getAppearanceFromEngine();
903
903
  if (appearance !== appearanceRef) {
904
904
  appearanceRef = appearance;
905
- onChangeSubscriptionManager$3.emit(appearance);
905
+ onChangeSubscriptionManager$5.emit(appearance);
906
906
  }
907
907
  }, 2000);
908
908
  }
@@ -913,13 +913,13 @@
913
913
  pollingIntervalId = null;
914
914
  }
915
915
  }
916
- function attachOnChange$3() {
916
+ function attachOnChange$5() {
917
917
  appearanceRef = getAppearanceFromMediaQuery();
918
918
  EventListener.add(MEDIA_QUERY_LIST$1, { type: 'change', callback: onMediaChange });
919
919
  if (Platform.browser.name === Browsers.SamsungInternet)
920
920
  startPolling();
921
921
  }
922
- function detachOnChange$3() {
922
+ function detachOnChange$5() {
923
923
  appearanceRef = null;
924
924
  EventListener.remove(MEDIA_QUERY_LIST$1, { type: 'change', callback: onMediaChange });
925
925
  if (Platform.browser.name === Browsers.SamsungInternet)
@@ -932,7 +932,7 @@
932
932
  else
933
933
  appearance = Appearances.Light;
934
934
  if (appearance !== appearanceRef)
935
- onChangeSubscriptionManager$3.emit(appearanceRef = appearance);
935
+ onChangeSubscriptionManager$5.emit(appearanceRef = appearance);
936
936
  }
937
937
 
938
938
  function isSecureContext() {
@@ -1668,14 +1668,14 @@
1668
1668
  var keyboardInsetObserver = createEnvObserver('keyboard-inset');
1669
1669
  var titlebarAreaObserver = createEnvObserver('titlebar-area');
1670
1670
  var viewportSegmentObserver = createEnvObserver('viewport-segment');
1671
- var onChangeSubscriptionManager$2 = createSubscriptionManager(attachOnChange$2, detachOnChange$2);
1671
+ var onChangeSubscriptionManager$4 = createSubscriptionManager(attachOnChange$4, detachOnChange$4);
1672
1672
  var dimensionRef = null;
1673
1673
  var Dimension = {
1674
1674
  get value() {
1675
1675
  return getDimension();
1676
1676
  },
1677
1677
  environment: getEnvironment(),
1678
- onChange: onChangeSubscriptionManager$2.subscribe,
1678
+ onChange: onChangeSubscriptionManager$4.subscribe,
1679
1679
  Constants: {
1680
1680
  Orientation: Orientation,
1681
1681
  },
@@ -1761,7 +1761,7 @@
1761
1761
  }
1762
1762
  return FALLBACK_DIMENSION;
1763
1763
  }
1764
- function attachOnChange$2() {
1764
+ function attachOnChange$4() {
1765
1765
  dimensionRef = getDimension();
1766
1766
  EventListener.add(globalThis, { type: 'resize', callback: onResize });
1767
1767
  if (typeof globalThis.screen.orientation.addEventListener === 'function')
@@ -1771,7 +1771,7 @@
1771
1771
  else if (MEDIA_QUERY_LIST.media !== 'not all')
1772
1772
  EventListener.add(MEDIA_QUERY_LIST, { type: 'change', callback: onResize });
1773
1773
  }
1774
- function detachOnChange$2() {
1774
+ function detachOnChange$4() {
1775
1775
  dimensionRef = null;
1776
1776
  EventListener.remove(globalThis, { type: 'resize', callback: onResize });
1777
1777
  if (typeof globalThis.screen.orientation.removeEventListener === 'function')
@@ -1784,7 +1784,7 @@
1784
1784
  function onResize() {
1785
1785
  var dimension = getDimension();
1786
1786
  if (dimensionRef === null || dimension.innerWidth !== dimensionRef.innerWidth || dimension.innerHeight !== dimensionRef.innerHeight || dimension.outerWidth !== dimensionRef.outerWidth || dimension.outerHeight !== dimensionRef.outerHeight || dimension.scale !== dimensionRef.scale || dimension.orientation !== dimensionRef.orientation)
1787
- onChangeSubscriptionManager$2.emit(dimensionRef = dimension);
1787
+ onChangeSubscriptionManager$4.emit(dimensionRef = dimension);
1788
1788
  }
1789
1789
 
1790
1790
  function createCustomError(name, Base) {
@@ -1871,7 +1871,19 @@
1871
1871
 
1872
1872
  var NotSupportedError = createCustomError('NotSupportedError');
1873
1873
 
1874
- var FS_BRIDGED_KEY = Symbol('fsBridged');
1874
+ var InvalidStateError = createCustomError('InvalidStateError');
1875
+
1876
+ var lastIOSVideo = null;
1877
+ var eventsBridged$1 = false;
1878
+ var FS_BRIDGE_KEY = (function () {
1879
+ if (typeof Symbol === 'function') {
1880
+ var existing = globalThis.__nativeFnFsBridgeKey__;
1881
+ if (typeof existing === 'symbol')
1882
+ return existing;
1883
+ return globalThis.__nativeFnFsBridgeKey__ = Symbol('native.fn.fs.bridged');
1884
+ }
1885
+ return '__nativeFnFsBridged__';
1886
+ }());
1875
1887
  var API_VARIANTS = {
1876
1888
  standard: {
1877
1889
  enabled: 'fullscreenEnabled',
@@ -1903,6 +1915,31 @@
1903
1915
  },
1904
1916
  };
1905
1917
  var api = detectApi();
1918
+ var onChangeSubscriptionManager$3 = createSubscriptionManager(attachOnChange$3, detachOnChange$3);
1919
+ var onErrorSubscriptionManager$1 = createSubscriptionManager(attachOnError$1, detachOnError$1);
1920
+ var Fullscreen = {
1921
+ get supported() {
1922
+ return getEnabled$1();
1923
+ },
1924
+ get element() {
1925
+ return getElement$1();
1926
+ },
1927
+ get isFullscreen() {
1928
+ return getIsFullscreen();
1929
+ },
1930
+ request: request$3,
1931
+ exit: exit$1,
1932
+ onChange: onChangeSubscriptionManager$3.subscribe,
1933
+ onError: onErrorSubscriptionManager$1.subscribe,
1934
+ Constants: {},
1935
+ Errors: {
1936
+ NotSupportedError: NotSupportedError,
1937
+ InvalidStateError: InvalidStateError,
1938
+ },
1939
+ };
1940
+ function hasStandardApi$1() {
1941
+ return api !== null;
1942
+ }
1906
1943
  function detectApi() {
1907
1944
  var element = globalThis.document.documentElement;
1908
1945
  if (typeof globalThis.document.fullscreenEnabled !== 'undefined' || typeof globalThis.document.exitFullscreen !== 'undefined')
@@ -1919,287 +1956,282 @@
1919
1956
  }
1920
1957
  return null;
1921
1958
  }
1922
- function createFullscreen() {
1923
- var lastIOSVideo = null;
1924
- var eventsBridged = false;
1925
- var activeOperation = null;
1926
- var pendingQueue = [];
1927
- var lastIntendedOperation = 'exit';
1928
- var onChangeSubscriptionManager = createSubscriptionManager(attachOnChange, detachOnChange);
1929
- var onErrorSubscriptionManager = createSubscriptionManager(attachOnError, detachOnError);
1930
- function getDefaultTarget() {
1931
- if (Platform.os.name === OS.iOS) {
1932
- var video = globalThis.document.querySelector('video');
1933
- if (video === null)
1934
- return undefined;
1935
- return video;
1936
- }
1937
- return globalThis.document.documentElement;
1938
- }
1939
- function bridgeEvents() {
1940
- if (eventsBridged)
1941
- return;
1942
- eventsBridged = true;
1943
- if (Platform.os.name === OS.iOS) {
1944
- bridgeIOSVideoEvents();
1945
- if (typeof globalThis.MutationObserver !== 'undefined') {
1946
- var observer = new MutationObserver(function () {
1947
- bridgeIOSVideoEvents();
1948
- });
1949
- observer.observe(globalThis.document.documentElement, {
1950
- childList: true,
1951
- subtree: true,
1952
- });
1953
- }
1954
- }
1955
- }
1956
- function bridgeIOSVideoEvents() {
1957
- if (typeof globalThis.document === 'undefined')
1958
- return;
1959
- var videos = globalThis.document.querySelectorAll('video');
1960
- videos.forEach(function (video) {
1961
- if (video[FS_BRIDGED_KEY] === true || !(typeof video.webkitEnterFullscreen !== 'undefined' || typeof video.onwebkitbeginfullscreen !== 'undefined'))
1962
- return;
1963
- EventListener.add(video, {
1964
- type: 'webkitbeginfullscreen',
1965
- callback: onChangeSubscriptionManager.emit,
1966
- options: false,
1967
- });
1968
- EventListener.add(video, {
1969
- type: 'webkitendfullscreen',
1970
- callback: onChangeSubscriptionManager.emit,
1971
- options: false,
1972
- });
1973
- video[FS_BRIDGED_KEY] = true;
1974
- });
1975
- }
1976
- function attachOnChange() {
1977
- var events = ['fullscreenchange', 'webkitfullscreenchange', 'mozfullscreenchange', 'MSFullscreenChange'];
1978
- for (var i = 0; i < events.length; i++) {
1979
- EventListener.add(globalThis.document, {
1980
- type: events[i],
1981
- callback: onChangeSubscriptionManager.emit,
1982
- options: false,
1983
- });
1984
- }
1985
- }
1986
- function detachOnChange() {
1987
- var events = ['fullscreenchange', 'webkitfullscreenchange', 'mozfullscreenchange', 'MSFullscreenChange'];
1988
- for (var i = 0; i < events.length; i++) {
1989
- EventListener.remove(globalThis.document, {
1990
- type: events[i],
1991
- callback: onChangeSubscriptionManager.emit,
1992
- options: false,
1993
- });
1994
- }
1995
- }
1996
- function attachOnError() {
1997
- var events = ['fullscreenerror', 'webkitfullscreenerror', 'mozfullscreenerror', 'MSFullscreenError'];
1998
- for (var i = 0; i < events.length; i++) {
1999
- EventListener.add(globalThis.document, {
2000
- type: events[i],
2001
- callback: onErrorSubscriptionManager.emit,
2002
- options: false,
2003
- });
2004
- }
2005
- }
2006
- function detachOnError() {
2007
- var events = ['fullscreenerror', 'webkitfullscreenerror', 'mozfullscreenerror', 'MSFullscreenError'];
2008
- for (var i = 0; i < events.length; i++) {
2009
- EventListener.remove(globalThis.document, {
2010
- type: events[i],
2011
- callback: onErrorSubscriptionManager.emit,
2012
- options: false,
2013
- });
2014
- }
1959
+ function getDefaultTarget$1() {
1960
+ if (Platform.os.name === OS.iOS) {
1961
+ var video = globalThis.document.querySelector('video');
1962
+ return video !== null ? video : undefined;
2015
1963
  }
2016
- function getEnabled() {
2017
- if (api === null)
2018
- return (Platform.os.name === OS.iOS && globalThis.HTMLVideoElement.prototype.webkitSupportsFullscreen === true);
1964
+ return globalThis.document.documentElement;
1965
+ }
1966
+ function getEnabled$1() {
1967
+ if (api !== null)
2019
1968
  return globalThis.document[api.enabled] === true;
2020
- }
2021
- function getElement() {
2022
- if (api === null) {
2023
- if (lastIOSVideo !== null && lastIOSVideo.webkitDisplayingFullscreen === true)
2024
- return lastIOSVideo;
2025
- return null;
2026
- }
2027
- var currentElement = globalThis.document[api.element];
2028
- if (typeof currentElement !== 'undefined')
2029
- return currentElement;
1969
+ if (Platform.os.name !== OS.iOS)
1970
+ return false;
1971
+ var video;
1972
+ var selected = globalThis.document.querySelector('video');
1973
+ if (selected !== null)
1974
+ video = selected;
1975
+ else
1976
+ video = globalThis.document.createElement('video');
1977
+ return video.webkitSupportsFullscreen === true || typeof video.webkitEnterFullscreen === 'function';
1978
+ }
1979
+ function getElement$1() {
1980
+ if (api === null) {
1981
+ if (lastIOSVideo !== null && lastIOSVideo.webkitDisplayingFullscreen === true)
1982
+ return lastIOSVideo;
2030
1983
  return null;
2031
1984
  }
2032
- function getIsFullscreen() {
2033
- return getElement() !== null;
2034
- }
2035
- function drainPendingOperation() {
2036
- var entry = pendingQueue.shift();
2037
- if (typeof entry === 'undefined') {
2038
- activeOperation = null;
2039
- return;
2040
- }
2041
- var next;
2042
- if (entry.operation === 'request')
2043
- next = requestImmediately(entry.target, entry.options);
2044
- else
2045
- next = exitImmediately();
2046
- activeOperation = next
2047
- .then(function () {
2048
- entry.resolve();
2049
- drainPendingOperation();
2050
- })
2051
- .catch(function (error) {
2052
- entry.reject(error);
2053
- drainPendingOperation();
2054
- });
2055
- }
2056
- function request(target, options) {
2057
- lastIntendedOperation = 'request';
2058
- if (activeOperation === null) {
2059
- var next = requestImmediately(target, options);
2060
- activeOperation = next
2061
- .then(drainPendingOperation)
2062
- .catch(drainPendingOperation);
2063
- return next;
2064
- }
2065
- return new Promise(function (resolve, reject) {
2066
- pendingQueue.push({
2067
- operation: 'request',
2068
- target: target,
2069
- options: options,
2070
- resolve: resolve,
2071
- reject: reject,
2072
- });
2073
- });
2074
- }
2075
- function exit() {
2076
- lastIntendedOperation = 'exit';
2077
- if (activeOperation === null) {
2078
- var next = exitImmediately();
2079
- activeOperation = next
2080
- .then(drainPendingOperation)
2081
- .catch(drainPendingOperation);
2082
- return next;
2083
- }
2084
- return new Promise(function (resolve, reject) {
2085
- pendingQueue.push({
2086
- operation: 'exit',
2087
- target: undefined,
2088
- options: undefined,
2089
- resolve: resolve,
2090
- reject: reject,
2091
- });
2092
- });
2093
- }
2094
- function requestImmediately(target, options) {
2095
- return new Promise(function (resolve, reject) {
2096
- if (typeof target === 'undefined')
2097
- target = getDefaultTarget();
2098
- if (typeof target === 'undefined')
2099
- return reject(new NotSupportedError('Failed to enter fullscreen mode.'));
2100
- var tagName = target.tagName.toLowerCase();
2101
- function fallbackToIOSVideo() {
2102
- if (Platform.os.name === OS.iOS && typeof target !== 'undefined' && target.tagName.toUpperCase() === 'VIDEO') {
2103
- var video = target;
2104
- if (video.webkitSupportsFullscreen === true && typeof video.webkitEnterFullscreen === 'function') {
2105
- lastIOSVideo = video;
2106
- bridgeIOSVideoEvents();
2107
- video.webkitEnterFullscreen();
2108
- return resolve();
1985
+ var currentElement = globalThis.document[api.element];
1986
+ if (typeof currentElement !== 'undefined')
1987
+ return currentElement;
1988
+ return null;
1989
+ }
1990
+ function getIsFullscreen() {
1991
+ return getElement$1() !== null;
1992
+ }
1993
+ function createEventPayload(nativeEvent, element, isFullscreen) {
1994
+ return {
1995
+ nativeEvent: nativeEvent,
1996
+ element: element,
1997
+ isFullscreen: isFullscreen,
1998
+ };
1999
+ }
2000
+ function emitChange$1(nativeEvent, element, isFullscreen) {
2001
+ onChangeSubscriptionManager$3.emit(createEventPayload(nativeEvent, element, isFullscreen));
2002
+ }
2003
+ function emitError$1(nativeEvent, element, isFullscreen) {
2004
+ onErrorSubscriptionManager$1.emit(createEventPayload(nativeEvent, element, isFullscreen));
2005
+ }
2006
+ function onFullscreenChange(event) {
2007
+ var target = event.target;
2008
+ if (target instanceof globalThis.Element)
2009
+ emitChange$1(event, target, getIsFullscreen());
2010
+ if (target instanceof globalThis.Document)
2011
+ emitChange$1(event, globalThis.document.documentElement, getIsFullscreen());
2012
+ }
2013
+ function onFullscreenError(event) {
2014
+ var target = event.target;
2015
+ if (target instanceof globalThis.Element)
2016
+ emitError$1(event, target, getIsFullscreen());
2017
+ if (target instanceof globalThis.Document)
2018
+ emitError$1(event, globalThis.document.documentElement, getIsFullscreen());
2019
+ }
2020
+ function onIOSBeginFullscreen(event) {
2021
+ lastIOSVideo = this;
2022
+ emitChange$1(event, this, true);
2023
+ }
2024
+ function onIOSEndFullscreen(event) {
2025
+ if (lastIOSVideo === this)
2026
+ lastIOSVideo = null;
2027
+ emitChange$1(event, this, false);
2028
+ }
2029
+ function bridgeSingleVideoNode$1(video) {
2030
+ if (video[FS_BRIDGE_KEY])
2031
+ return;
2032
+ if (typeof video.webkitEnterFullscreen === 'undefined' && typeof video.onwebkitbeginfullscreen === 'undefined')
2033
+ return;
2034
+ EventListener.add(video, { type: 'webkitbeginfullscreen', callback: onIOSBeginFullscreen, options: false });
2035
+ EventListener.add(video, { type: 'webkitendfullscreen', callback: onIOSEndFullscreen, options: false });
2036
+ video[FS_BRIDGE_KEY] = true;
2037
+ }
2038
+ function bridgeIOSVideoEvents() {
2039
+ var videos = globalThis.document.querySelectorAll('video');
2040
+ for (var i = 0; i < videos.length; i++)
2041
+ bridgeSingleVideoNode$1(videos[i]);
2042
+ }
2043
+ function bridgeEvents$1() {
2044
+ if (eventsBridged$1)
2045
+ return;
2046
+ eventsBridged$1 = true;
2047
+ if (Platform.os.name !== OS.iOS)
2048
+ return;
2049
+ bridgeIOSVideoEvents();
2050
+ if (typeof globalThis.MutationObserver === 'undefined')
2051
+ return;
2052
+ var observer = new globalThis.MutationObserver(function (records) {
2053
+ if (lastIOSVideo !== null) {
2054
+ var removed = false;
2055
+ for (var i = 0; i < records.length; i++) {
2056
+ var removedNodes = records[i].removedNodes;
2057
+ for (var j = 0; j < removedNodes.length; j++) {
2058
+ var node = removedNodes[j];
2059
+ if (node === lastIOSVideo || (node.nodeType === Node.ELEMENT_NODE && node.contains(lastIOSVideo))) {
2060
+ removed = true;
2061
+ break;
2109
2062
  }
2110
2063
  }
2111
- reject(new NotSupportedError('The "' + tagName + '" element does not support fullscreen requests.'));
2064
+ if (removed)
2065
+ break;
2066
+ }
2067
+ if (removed && !globalThis.document.contains(lastIOSVideo))
2068
+ lastIOSVideo = null;
2069
+ }
2070
+ for (var i = 0; i < records.length; i++) {
2071
+ var addedNodes = records[i].addedNodes;
2072
+ for (var j = 0; j < addedNodes.length; j++) {
2073
+ var node = addedNodes[j];
2074
+ if (node.nodeType !== Node.ELEMENT_NODE)
2075
+ continue;
2076
+ var element = node;
2077
+ if (element.tagName === 'VIDEO') {
2078
+ bridgeSingleVideoNode$1(element);
2079
+ continue;
2080
+ }
2081
+ var nested = element.querySelectorAll('video');
2082
+ for (var k = 0; k < nested.length; k++)
2083
+ bridgeSingleVideoNode$1(nested[k]);
2112
2084
  }
2113
- if (api !== null) {
2114
- var method = target[api.request];
2115
- if (typeof method === 'function') {
2116
- var result = method.call(target, options);
2117
- if (typeof result !== 'undefined' && typeof result.then === 'function') {
2118
- result
2119
- .then(resolve)
2120
- .catch(function () {
2085
+ }
2086
+ });
2087
+ observer.observe(globalThis.document.documentElement, { childList: true, subtree: true });
2088
+ }
2089
+ function attachOnChange$3() {
2090
+ if (api != null)
2091
+ EventListener.add(globalThis.document, { type: api.events.change, callback: onFullscreenChange, options: false });
2092
+ if (Platform.os.name === OS.iOS)
2093
+ bridgeIOSVideoEvents();
2094
+ }
2095
+ function detachOnChange$3() {
2096
+ if (api != null)
2097
+ EventListener.remove(globalThis.document, { type: api.events.change, callback: onFullscreenChange, options: false });
2098
+ if (Platform.os.name !== OS.iOS)
2099
+ return;
2100
+ var videos = globalThis.document.querySelectorAll('video');
2101
+ for (var i = 0; i < videos.length; i++) {
2102
+ EventListener.remove(videos[i], { type: 'webkitbeginfullscreen', callback: onIOSBeginFullscreen, options: false });
2103
+ EventListener.remove(videos[i], { type: 'webkitendfullscreen', callback: onIOSEndFullscreen, options: false });
2104
+ videos[i][FS_BRIDGE_KEY] = false;
2105
+ }
2106
+ }
2107
+ function attachOnError$1() {
2108
+ if (api != null)
2109
+ EventListener.add(globalThis.document, { type: api.events.error, callback: onFullscreenError, options: false });
2110
+ }
2111
+ function detachOnError$1() {
2112
+ if (api != null)
2113
+ EventListener.remove(globalThis.document, { type: api.events.error, callback: onFullscreenError, options: false });
2114
+ }
2115
+ function request$3(target, options) {
2116
+ return new Promise(function (resolve, reject) {
2117
+ if (typeof target === 'undefined')
2118
+ target = getDefaultTarget$1();
2119
+ if (typeof target === 'undefined')
2120
+ return reject(new NotSupportedError('Failed to enter fullscreen mode.'));
2121
+ var tagName = target.tagName.toLowerCase();
2122
+ var isIOSFullscreenActive = lastIOSVideo !== null && lastIOSVideo.webkitDisplayingFullscreen === true;
2123
+ if (api !== null) {
2124
+ var method = target[api.request];
2125
+ if (typeof method === 'function' && !isIOSFullscreenActive) {
2126
+ var result = method.call(target, options);
2127
+ if (typeof result !== 'undefined' && typeof result.then === 'function') {
2128
+ result
2129
+ .then(resolve)
2130
+ .catch(function () {
2131
+ try {
2121
2132
  if (Platform.os.name !== OS.iOS)
2122
2133
  return reject(new NotSupportedError('The "' + tagName + '" element does not support fullscreen requests.'));
2123
2134
  fallbackToIOSVideo();
2124
- });
2125
- return;
2126
- }
2127
- return resolve();
2135
+ }
2136
+ catch (_e) {
2137
+ reject(new NotSupportedError('The "' + tagName + '" element does not support fullscreen requests.'));
2138
+ }
2139
+ });
2140
+ return;
2128
2141
  }
2129
- }
2130
- fallbackToIOSVideo();
2131
- });
2132
- }
2133
- function exitImmediately() {
2134
- return new Promise(function (resolve, reject) {
2135
- if (getElement() === null && lastIOSVideo === null)
2136
2142
  return resolve();
2137
- function fallbackToIOSVideo() {
2138
- if (Platform.os.name === OS.iOS) {
2139
- var candidates = void 0;
2140
- if (lastIOSVideo !== null)
2141
- candidates = [lastIOSVideo];
2142
- else
2143
- candidates = globalThis.document.querySelectorAll('video');
2144
- for (var i = 0; i < candidates.length; i++) {
2145
- var video = candidates[i];
2146
- if (typeof video.webkitExitFullscreen === 'function' && video.webkitDisplayingFullscreen === true) {
2147
- video.webkitExitFullscreen();
2148
- lastIOSVideo = null;
2149
- return resolve();
2143
+ }
2144
+ }
2145
+ function fallbackToIOSVideo() {
2146
+ if (Platform.os.name === OS.iOS && typeof target !== 'undefined' && target.tagName.toUpperCase() === 'VIDEO') {
2147
+ var video_1 = target;
2148
+ if (video_1.webkitSupportsFullscreen && typeof video_1.webkitEnterFullscreen === 'function') {
2149
+ if (!hasStandardApi$1())
2150
+ bridgeSingleVideoNode$1(video_1);
2151
+ if (video_1.played.length === 0) {
2152
+ video_1.play()
2153
+ .then(function () {
2154
+ try {
2155
+ video_1.webkitEnterFullscreen();
2156
+ }
2157
+ catch (e) {
2158
+ return reject(new InvalidStateError('The object is in an invalid state.'));
2159
+ }
2160
+ });
2161
+ }
2162
+ else {
2163
+ try {
2164
+ video_1.webkitEnterFullscreen();
2165
+ }
2166
+ catch (e) {
2167
+ return reject(new InvalidStateError('The object is in an invalid state.'));
2150
2168
  }
2151
2169
  }
2170
+ lastIOSVideo = video_1;
2171
+ return resolve();
2152
2172
  }
2153
- reject(new NotSupportedError('Failed to exit fullscreen mode.'));
2154
2173
  }
2155
- if (api !== null) {
2156
- var method = globalThis.document[api.exit];
2157
- if (typeof method === 'function') {
2158
- var result = method.call(globalThis.document);
2159
- if (typeof result !== 'undefined' && typeof result.then === 'function') {
2160
- result
2161
- .then(resolve)
2162
- .catch(function () {
2174
+ reject(new NotSupportedError('The "' + tagName + '" element does not support fullscreen requests.'));
2175
+ }
2176
+ fallbackToIOSVideo();
2177
+ });
2178
+ }
2179
+ function exit$1() {
2180
+ return new Promise(function (resolve, reject) {
2181
+ if (api !== null) {
2182
+ var method = globalThis.document[api.exit];
2183
+ if (typeof method === 'function') {
2184
+ var result = method.call(globalThis.document);
2185
+ if (typeof result !== 'undefined' && typeof result.then === 'function') {
2186
+ result
2187
+ .then(resolve)
2188
+ .catch(function () {
2189
+ try {
2163
2190
  if (Platform.os.name !== OS.iOS)
2164
2191
  return reject(new NotSupportedError('Failed to exit fullscreen mode.'));
2165
2192
  fallbackToIOSVideo();
2166
- });
2167
- return;
2168
- }
2193
+ }
2194
+ catch (_e) {
2195
+ reject(new NotSupportedError('Failed to exit fullscreen mode.'));
2196
+ }
2197
+ });
2198
+ return;
2199
+ }
2200
+ return resolve();
2201
+ }
2202
+ }
2203
+ function fallbackToIOSVideo() {
2204
+ if (Platform.os.name !== OS.iOS) {
2205
+ reject(new NotSupportedError('Failed to exit fullscreen mode.'));
2206
+ return;
2207
+ }
2208
+ var target = lastIOSVideo;
2209
+ if (target !== null && typeof target.webkitExitFullscreen === 'function' && target.webkitDisplayingFullscreen === true) {
2210
+ target.webkitExitFullscreen();
2211
+ if (target.webkitDisplayingFullscreen)
2212
+ return reject(new NotSupportedError('Failed to exit fullscreen mode.'));
2213
+ lastIOSVideo = null;
2214
+ return resolve();
2215
+ }
2216
+ var videos = globalThis.document.querySelectorAll('video');
2217
+ for (var i = 0; i < videos.length; i++) {
2218
+ var video = videos[i];
2219
+ if (typeof video.webkitExitFullscreen === 'function' && video.webkitDisplayingFullscreen === true) {
2220
+ video.webkitExitFullscreen();
2221
+ if (video.webkitDisplayingFullscreen)
2222
+ return reject(new NotSupportedError('Failed to exit fullscreen mode.'));
2223
+ lastIOSVideo = null;
2169
2224
  return resolve();
2170
2225
  }
2171
2226
  }
2172
- fallbackToIOSVideo();
2173
- });
2174
- }
2175
- function toggle(target, options) {
2176
- if (lastIntendedOperation === 'request')
2177
- return exit();
2178
- return request(target, options);
2179
- }
2180
- bridgeEvents();
2181
- return {
2182
- get supported() {
2183
- return getEnabled();
2184
- },
2185
- get element() {
2186
- return getElement();
2187
- },
2188
- get isFullscreen() {
2189
- return getIsFullscreen();
2190
- },
2191
- request: request,
2192
- exit: exit,
2193
- toggle: toggle,
2194
- onChange: onChangeSubscriptionManager.subscribe,
2195
- onError: onErrorSubscriptionManager.subscribe,
2196
- Constants: {},
2197
- Errors: {
2198
- NotSupportedError: NotSupportedError,
2199
- },
2200
- };
2227
+ if (getElement$1() === null)
2228
+ return resolve();
2229
+ reject(new NotSupportedError('Failed to exit fullscreen mode.'));
2230
+ }
2231
+ fallbackToIOSVideo();
2232
+ });
2201
2233
  }
2202
- var Fullscreen = createFullscreen();
2234
+ bridgeEvents$1();
2203
2235
 
2204
2236
  var PermissionType;
2205
2237
  (function (PermissionType) {
@@ -2241,7 +2273,10 @@
2241
2273
  })();
2242
2274
 
2243
2275
  var Permission = {
2244
- request: request$1,
2276
+ get supported() {
2277
+ return supported$5();
2278
+ },
2279
+ request: request$2,
2245
2280
  check: check,
2246
2281
  Constants: {
2247
2282
  PermissionType: PermissionType,
@@ -2249,7 +2284,10 @@
2249
2284
  },
2250
2285
  Errors: {},
2251
2286
  };
2252
- function request$1(type) {
2287
+ function supported$5() {
2288
+ return typeof globalThis.navigator.permissions !== 'undefined';
2289
+ }
2290
+ function request$2(type) {
2253
2291
  var instance = this;
2254
2292
  return new Promise(function (resolve) {
2255
2293
  function resolveAfterCheck() {
@@ -2339,7 +2377,7 @@
2339
2377
 
2340
2378
  var PermissionNotGrantedError = createCustomError('PermissionNotGrantedError');
2341
2379
 
2342
- function request(url, options) {
2380
+ function request$1(url, options) {
2343
2381
  return new Promise(function (resolve) {
2344
2382
  var method = 'GET';
2345
2383
  var headers = {};
@@ -2421,7 +2459,7 @@
2421
2459
  return to;
2422
2460
  }
2423
2461
 
2424
- var onChangeSubscriptionManager$1 = createSubscriptionManager(attachOnChange$1, detachOnChange$1);
2462
+ var onChangeSubscriptionManager$2 = createSubscriptionManager(attachOnChange$2, detachOnChange$2);
2425
2463
  var watchIdRef = null;
2426
2464
  var Geolocation = {
2427
2465
  get value() {
@@ -2430,7 +2468,7 @@
2430
2468
  get supported() {
2431
2469
  return supported$4();
2432
2470
  },
2433
- onChange: onChangeSubscriptionManager$1.subscribe,
2471
+ onChange: onChangeSubscriptionManager$2.subscribe,
2434
2472
  Constants: {},
2435
2473
  Errors: {
2436
2474
  NotSupportedError: NotSupportedError,
@@ -2467,7 +2505,7 @@
2467
2505
  }
2468
2506
  function getFallbackValue(error) {
2469
2507
  return new Promise(function (resolve, reject) {
2470
- request('http://ip-api.com/json?fields=lat,lon')
2508
+ request$1('http://ip-api.com/json?fields=lat,lon')
2471
2509
  .then(function (response) {
2472
2510
  if (typeof response !== 'undefined') {
2473
2511
  var coordinate_1 = {
@@ -2506,7 +2544,7 @@
2506
2544
  return new NotSupportedError('Unknown error.');
2507
2545
  }
2508
2546
  }
2509
- function attachOnChange$1() {
2547
+ function attachOnChange$2() {
2510
2548
  if (!supported$4())
2511
2549
  return;
2512
2550
  Permission
@@ -2519,13 +2557,13 @@
2519
2557
  }
2520
2558
  });
2521
2559
  }
2522
- function detachOnChange$1() {
2560
+ function detachOnChange$2() {
2523
2561
  if (!supported$4() || watchIdRef === null)
2524
2562
  return;
2525
2563
  globalThis.navigator.geolocation.clearWatch(watchIdRef);
2526
2564
  }
2527
2565
  function onGeolocationCoordinatesChange(coordinates) {
2528
- onChangeSubscriptionManager$1.emit(coordinates);
2566
+ onChangeSubscriptionManager$2.emit(coordinates);
2529
2567
  }
2530
2568
  function supported$4() {
2531
2569
  return typeof globalThis.navigator.geolocation !== 'undefined';
@@ -3976,16 +4014,19 @@
3976
4014
  }
3977
4015
 
3978
4016
  var Vibration = {
3979
- run: run,
3980
- stop: stop,
3981
4017
  get supported() {
3982
4018
  return supported$3();
3983
4019
  },
4020
+ run: run,
4021
+ stop: stop,
3984
4022
  Constants: {},
3985
4023
  Errors: {
3986
4024
  NotSupportedError: NotSupportedError,
3987
4025
  },
3988
4026
  };
4027
+ function supported$3() {
4028
+ return typeof globalThis.navigator.vibrate !== 'undefined';
4029
+ }
3989
4030
  function run(pattern) {
3990
4031
  if (supported$3())
3991
4032
  return globalThis.navigator.vibrate(pattern);
@@ -3994,313 +4035,290 @@
3994
4035
  function stop() {
3995
4036
  return this.run(0);
3996
4037
  }
3997
- function supported$3() {
3998
- return typeof globalThis.navigator.vibrate !== 'undefined';
3999
- }
4000
4038
 
4001
- var PIP_BRIDGED_KEY = Symbol('pipBridged');
4002
4039
  var PIP_PRESENTATION_MODE = 'picture-in-picture';
4003
4040
  var INLINE_PRESENTATION_MODE = 'inline';
4004
- function hasStandardPipEvents() {
4041
+ var lastPipVideo = null;
4042
+ var eventsBridged = false;
4043
+ var PIP_BRIDGE_KEY = (function () {
4044
+ if (typeof Symbol === 'function') {
4045
+ var existing = globalThis.__nativeFnPipBridgeKey__;
4046
+ if (typeof existing === 'symbol')
4047
+ return existing;
4048
+ return globalThis.__nativeFnPipBridgeKey__ = Symbol('native.fn.pip.bridged');
4049
+ }
4050
+ return '__nativeFnPipBridged__';
4051
+ }());
4052
+ var onChangeSubscriptionManager$1 = createSubscriptionManager(attachOnChange$1, detachOnChange$1);
4053
+ var onErrorSubscriptionManager = createSubscriptionManager(attachOnError, detachOnError);
4054
+ var Pip = {
4055
+ get supported() {
4056
+ return getEnabled();
4057
+ },
4058
+ get element() {
4059
+ return getElement();
4060
+ },
4061
+ get isPip() {
4062
+ return getIsPip();
4063
+ },
4064
+ request: request,
4065
+ exit: exit,
4066
+ onChange: onChangeSubscriptionManager$1.subscribe,
4067
+ onError: onErrorSubscriptionManager.subscribe,
4068
+ Constants: {},
4069
+ Errors: {
4070
+ NotSupportedError: NotSupportedError,
4071
+ InvalidStateError: InvalidStateError,
4072
+ },
4073
+ };
4074
+ function hasStandardApi() {
4005
4075
  return typeof globalThis.document.pictureInPictureEnabled !== 'undefined';
4006
4076
  }
4007
- function createPip() {
4008
- var lastPipVideo = null;
4009
- var eventsBridged = false;
4010
- var activeOperation = null;
4011
- var pendingQueue = [];
4012
- var lastIntendedOperation = 'exit';
4013
- var onChangeSubscriptionManager = createSubscriptionManager(attachOnChange, detachOnChange);
4014
- var onErrorSubscriptionManager = createSubscriptionManager(attachOnError, detachOnError);
4015
- function getEnabled() {
4016
- if (typeof globalThis.document.pictureInPictureEnabled === 'boolean')
4017
- return globalThis.document.pictureInPictureEnabled;
4018
- if (typeof HTMLVideoElement === 'undefined')
4019
- return false;
4020
- var videos = globalThis.document.querySelectorAll('video');
4021
- for (var i = 0; i < videos.length; i++) {
4022
- var video = videos[i];
4023
- if (typeof video.webkitSupportsPresentationMode === 'function' && video.webkitSupportsPresentationMode(PIP_PRESENTATION_MODE))
4024
- return true;
4025
- }
4026
- return false;
4027
- }
4028
- function getElement() {
4029
- var currentElement = globalThis.document.pictureInPictureElement;
4030
- if (currentElement !== null && typeof currentElement !== 'undefined')
4031
- return currentElement;
4032
- if (lastPipVideo !== null && lastPipVideo.webkitPresentationMode === PIP_PRESENTATION_MODE)
4033
- return lastPipVideo;
4034
- return null;
4035
- }
4036
- function getIsPip() {
4037
- return getElement() !== null;
4038
- }
4039
- function getDefaultTarget() {
4040
- var video = globalThis.document.querySelector('video');
4041
- if (video === null)
4042
- return undefined;
4043
- return video;
4077
+ function getDefaultTarget() {
4078
+ var video = globalThis.document.querySelector('video');
4079
+ return video !== null ? video : undefined;
4080
+ }
4081
+ function createPipEventPayload(nativeEvent, element, isPip) {
4082
+ return {
4083
+ nativeEvent: nativeEvent,
4084
+ element: element,
4085
+ isPip: isPip
4086
+ };
4087
+ }
4088
+ function emitChange(nativeEvent, element, isPip) {
4089
+ onChangeSubscriptionManager$1.emit(createPipEventPayload(nativeEvent, element, isPip));
4090
+ }
4091
+ function emitError(nativeEvent, element, isPip) {
4092
+ onErrorSubscriptionManager.emit(createPipEventPayload(nativeEvent, element, isPip));
4093
+ }
4094
+ function onEnterPictureInPicture(event) {
4095
+ var target = event.target;
4096
+ if (target instanceof globalThis.HTMLVideoElement)
4097
+ emitChange(event, target, true);
4098
+ }
4099
+ function onLeavePictureInPicture(event) {
4100
+ var target = event.target;
4101
+ if (target instanceof globalThis.HTMLVideoElement)
4102
+ emitChange(event, target, false);
4103
+ }
4104
+ function onPictureInPictureError(event) {
4105
+ var target = event.target;
4106
+ if (target instanceof globalThis.HTMLVideoElement)
4107
+ emitError(event, target, getIsPip());
4108
+ }
4109
+ function onWebkitPresentationModeChanged(event) {
4110
+ if (this.webkitPresentationMode === PIP_PRESENTATION_MODE) {
4111
+ lastPipVideo = this;
4112
+ emitChange(event, this, true);
4113
+ return;
4044
4114
  }
4045
- function onWebkitPresentationModeChanged(event) {
4046
- if (this.webkitPresentationMode === PIP_PRESENTATION_MODE || (this.webkitPresentationMode === INLINE_PRESENTATION_MODE && lastPipVideo === this))
4047
- onChangeSubscriptionManager.emit(event);
4115
+ if (this.webkitPresentationMode === INLINE_PRESENTATION_MODE && lastPipVideo === this) {
4116
+ lastPipVideo = null;
4117
+ emitChange(event, this, false);
4048
4118
  }
4049
- function bridgeEvents() {
4050
- if (eventsBridged)
4051
- return;
4052
- eventsBridged = true;
4053
- if (!hasStandardPipEvents()) {
4054
- bridgeWebkitVideoEvents();
4055
- if (typeof globalThis.MutationObserver !== 'undefined') {
4056
- var observer = new MutationObserver(function () {
4057
- bridgeWebkitVideoEvents();
4058
- });
4059
- observer.observe(globalThis.document.documentElement, {
4060
- childList: true,
4061
- subtree: true,
4062
- });
4119
+ }
4120
+ function bridgeSingleVideoNode(video) {
4121
+ if (video[PIP_BRIDGE_KEY])
4122
+ return;
4123
+ if (typeof video.webkitSetPresentationMode === 'undefined' && typeof video.onwebkitpresentationmodechanged === 'undefined')
4124
+ return;
4125
+ EventListener.add(video, { type: 'webkitpresentationmodechanged', callback: onWebkitPresentationModeChanged, options: false });
4126
+ video[PIP_BRIDGE_KEY] = true;
4127
+ }
4128
+ function bridgeWebkitVideoEvents() {
4129
+ var videos = globalThis.document.querySelectorAll('video');
4130
+ for (var i = 0; i < videos.length; i++)
4131
+ bridgeSingleVideoNode(videos[i]);
4132
+ }
4133
+ function bridgeEvents() {
4134
+ if (eventsBridged)
4135
+ return;
4136
+ eventsBridged = true;
4137
+ if (hasStandardApi())
4138
+ return;
4139
+ bridgeWebkitVideoEvents();
4140
+ if (typeof globalThis.MutationObserver === 'undefined')
4141
+ return;
4142
+ var observer = new globalThis.MutationObserver(function (records) {
4143
+ if (lastPipVideo !== null) {
4144
+ var removed = false;
4145
+ for (var i = 0; i < records.length; i++) {
4146
+ var removedNodes = records[i].removedNodes;
4147
+ for (var j = 0; j < removedNodes.length; j++) {
4148
+ var node = removedNodes[j];
4149
+ if (node === lastPipVideo || (node.nodeType === Node.ELEMENT_NODE && node.contains(lastPipVideo))) {
4150
+ removed = true;
4151
+ break;
4152
+ }
4153
+ }
4154
+ if (removed)
4155
+ break;
4063
4156
  }
4157
+ if (removed && !globalThis.document.contains(lastPipVideo))
4158
+ lastPipVideo = null;
4064
4159
  }
4065
- }
4066
- function bridgeWebkitVideoEvents() {
4067
- if (typeof globalThis.document === 'undefined')
4068
- return;
4069
- var videos = globalThis.document.querySelectorAll('video');
4070
- videos.forEach(function (video) {
4071
- if (video[PIP_BRIDGED_KEY] === true || !(typeof video.webkitSetPresentationMode !== 'undefined' || typeof video.onwebkitpresentationmodechanged !== 'undefined'))
4072
- return;
4073
- EventListener.add(video, {
4074
- type: 'webkitpresentationmodechanged',
4075
- callback: onWebkitPresentationModeChanged,
4076
- options: false,
4077
- });
4078
- video[PIP_BRIDGED_KEY] = true;
4079
- });
4080
- }
4081
- function attachOnChange() {
4082
- if (hasStandardPipEvents()) {
4083
- var changeEvents = ['enterpictureinpicture', 'leavepictureinpicture'];
4084
- for (var i = 0; i < changeEvents.length; i++) {
4085
- EventListener.add(globalThis.document, {
4086
- type: changeEvents[i],
4087
- callback: onChangeSubscriptionManager.emit,
4088
- options: false,
4089
- });
4160
+ for (var i = 0; i < records.length; i++) {
4161
+ var addedNodes = records[i].addedNodes;
4162
+ for (var j = 0; j < addedNodes.length; j++) {
4163
+ var node = addedNodes[j];
4164
+ if (node.nodeType !== Node.ELEMENT_NODE)
4165
+ continue;
4166
+ var element = node;
4167
+ if (element.tagName === 'VIDEO') {
4168
+ bridgeSingleVideoNode(element);
4169
+ continue;
4170
+ }
4171
+ var nested = element.querySelectorAll('video');
4172
+ for (var k = 0; k < nested.length; k++)
4173
+ bridgeSingleVideoNode(nested[k]);
4090
4174
  }
4091
- return;
4092
4175
  }
4093
- bridgeWebkitVideoEvents();
4176
+ });
4177
+ observer.observe(globalThis.document.documentElement, { childList: true, subtree: true });
4178
+ }
4179
+ function attachOnChange$1() {
4180
+ if (hasStandardApi()) {
4181
+ EventListener.add(globalThis.document, { type: 'enterpictureinpicture', callback: onEnterPictureInPicture, options: false });
4182
+ EventListener.add(globalThis.document, { type: 'leavepictureinpicture', callback: onLeavePictureInPicture, options: false });
4183
+ return;
4094
4184
  }
4095
- function detachOnChange() {
4096
- if (hasStandardPipEvents()) {
4097
- var changeEvents = ['enterpictureinpicture', 'leavepictureinpicture'];
4098
- for (var i = 0; i < changeEvents.length; i++) {
4099
- EventListener.remove(globalThis.document, {
4100
- type: changeEvents[i],
4101
- callback: onChangeSubscriptionManager.emit,
4102
- options: false,
4185
+ bridgeWebkitVideoEvents();
4186
+ }
4187
+ function detachOnChange$1() {
4188
+ if (hasStandardApi()) {
4189
+ EventListener.remove(globalThis.document, { type: 'enterpictureinpicture', callback: onEnterPictureInPicture, options: false });
4190
+ EventListener.remove(globalThis.document, { type: 'leavepictureinpicture', callback: onLeavePictureInPicture, options: false });
4191
+ return;
4192
+ }
4193
+ var videos = globalThis.document.querySelectorAll('video');
4194
+ for (var i = 0; i < videos.length; i++) {
4195
+ EventListener.remove(videos[i], { type: 'webkitpresentationmodechanged', callback: onWebkitPresentationModeChanged, options: false });
4196
+ videos[i][PIP_BRIDGE_KEY] = false;
4197
+ }
4198
+ }
4199
+ function attachOnError() {
4200
+ EventListener.add(globalThis.document, { type: 'pictureinpictureerror', callback: onPictureInPictureError, options: false });
4201
+ }
4202
+ function detachOnError() {
4203
+ EventListener.remove(globalThis.document, { type: 'pictureinpictureerror', callback: onPictureInPictureError, options: false });
4204
+ }
4205
+ function getEnabled() {
4206
+ if (typeof globalThis.document.pictureInPictureEnabled === 'boolean')
4207
+ return globalThis.document.pictureInPictureEnabled;
4208
+ var video;
4209
+ var selected = globalThis.document.querySelector('video');
4210
+ if (selected !== null)
4211
+ video = selected;
4212
+ else
4213
+ video = globalThis.document.createElement('video');
4214
+ return typeof video.webkitSupportsPresentationMode === 'function' && video.webkitSupportsPresentationMode(PIP_PRESENTATION_MODE);
4215
+ }
4216
+ function getElement() {
4217
+ var currentElement = globalThis.document.pictureInPictureElement;
4218
+ if (currentElement !== null && typeof currentElement !== 'undefined')
4219
+ return currentElement;
4220
+ if (lastPipVideo !== null && lastPipVideo.webkitPresentationMode === PIP_PRESENTATION_MODE)
4221
+ return lastPipVideo;
4222
+ return null;
4223
+ }
4224
+ function getIsPip() {
4225
+ return getElement() !== null;
4226
+ }
4227
+ function request(target) {
4228
+ return new Promise(function (resolve, reject) {
4229
+ if (typeof target === 'undefined')
4230
+ target = getDefaultTarget();
4231
+ if (typeof target === 'undefined')
4232
+ return reject(new NotSupportedError('Failed to enter Picture-in-Picture mode.'));
4233
+ var tagName = target.tagName.toLowerCase();
4234
+ if (tagName !== 'video')
4235
+ return reject(new NotSupportedError('The "' + tagName + '" element does not support Picture-in-Picture requests.'));
4236
+ var method = target.requestPictureInPicture;
4237
+ var isWebkitPipActive = lastPipVideo !== null && lastPipVideo.webkitPresentationMode === PIP_PRESENTATION_MODE;
4238
+ if (typeof method === 'function' && !isWebkitPipActive) {
4239
+ var result = method.call(target);
4240
+ if (typeof result !== 'undefined' && typeof result.then === 'function') {
4241
+ result
4242
+ .then(resolve)
4243
+ .catch(function () {
4244
+ try {
4245
+ fallbackToWebkit();
4246
+ }
4247
+ catch (e) {
4248
+ reject(new NotSupportedError('The "' + tagName + '" element does not support Picture-in-Picture requests.'));
4249
+ }
4103
4250
  });
4251
+ return;
4104
4252
  }
4105
- return;
4253
+ return resolve();
4106
4254
  }
4107
- var videos = globalThis.document.querySelectorAll('video');
4108
- videos.forEach(function (video) {
4109
- EventListener.remove(video, {
4110
- type: 'webkitpresentationmodechanged',
4111
- callback: onWebkitPresentationModeChanged,
4112
- options: false,
4113
- });
4114
- try {
4115
- delete video[PIP_BRIDGED_KEY];
4116
- }
4117
- catch (_) {
4118
- video[PIP_BRIDGED_KEY] = undefined;
4255
+ function fallbackToWebkit() {
4256
+ if (typeof target !== 'undefined' && typeof target.webkitSupportsPresentationMode === 'function' && target.webkitSupportsPresentationMode(PIP_PRESENTATION_MODE) && typeof target.webkitSetPresentationMode === 'function') {
4257
+ if (target.disablePictureInPicture)
4258
+ return reject(new NotSupportedError('Picture-in-Picture is disabled on this element.'));
4259
+ if (!hasStandardApi())
4260
+ bridgeSingleVideoNode(target);
4261
+ target.webkitSetPresentationMode(PIP_PRESENTATION_MODE);
4262
+ if (target.webkitPresentationMode !== PIP_PRESENTATION_MODE)
4263
+ return reject(new InvalidStateError('Picture-in-Picture transition is already in progress.'));
4264
+ lastPipVideo = target;
4265
+ return resolve();
4119
4266
  }
4120
- });
4121
- }
4122
- function attachOnError() {
4123
- EventListener.add(globalThis.document, {
4124
- type: 'pictureinpictureerror',
4125
- callback: onErrorSubscriptionManager.emit,
4126
- options: false,
4127
- });
4128
- }
4129
- function detachOnError() {
4130
- EventListener.remove(globalThis.document, {
4131
- type: 'pictureinpictureerror',
4132
- callback: onErrorSubscriptionManager.emit,
4133
- options: false,
4134
- });
4135
- }
4136
- function drainPendingOperation() {
4137
- var entry = pendingQueue.shift();
4138
- if (typeof entry === 'undefined') {
4139
- activeOperation = null;
4140
- return;
4141
- }
4142
- var next;
4143
- if (entry.operation === 'request')
4144
- next = requestImmediately(entry.target);
4145
- else
4146
- next = exitImmediately();
4147
- activeOperation = next
4148
- .then(function () {
4149
- entry.resolve();
4150
- drainPendingOperation();
4151
- })
4152
- .catch(function (error) {
4153
- entry.reject(error);
4154
- drainPendingOperation();
4155
- });
4156
- }
4157
- function request(target) {
4158
- lastIntendedOperation = 'request';
4159
- if (activeOperation === null) {
4160
- var next = requestImmediately(target);
4161
- activeOperation = next
4162
- .then(drainPendingOperation)
4163
- .catch(drainPendingOperation);
4164
- return next;
4267
+ reject(new NotSupportedError('The "' + tagName + '" element does not support Picture-in-Picture requests.'));
4165
4268
  }
4166
- return new Promise(function (resolve, reject) {
4167
- pendingQueue.push({
4168
- operation: 'request',
4169
- target: target,
4170
- resolve: resolve,
4171
- reject: reject,
4172
- });
4173
- });
4174
- }
4175
- function exit() {
4176
- lastIntendedOperation = 'exit';
4177
- if (activeOperation === null) {
4178
- var next = exitImmediately();
4179
- activeOperation = next
4180
- .then(drainPendingOperation)
4181
- .catch(drainPendingOperation);
4182
- return next;
4183
- }
4184
- return new Promise(function (resolve, reject) {
4185
- pendingQueue.push({
4186
- operation: 'exit',
4187
- target: undefined,
4188
- resolve: resolve,
4189
- reject: reject,
4190
- });
4191
- });
4192
- }
4193
- function requestImmediately(target) {
4194
- return new Promise(function (resolve, reject) {
4195
- if (typeof target === 'undefined')
4196
- target = getDefaultTarget();
4197
- if (typeof target === 'undefined')
4198
- return reject(new NotSupportedError('Failed to enter Picture-in-Picture mode.'));
4199
- var tagName = target.tagName.toLowerCase();
4200
- if (tagName !== 'video')
4201
- return reject(new NotSupportedError('The "' + tagName + '" element does not support Picture-in-Picture requests.'));
4202
- function fallbackToWebkitVideo() {
4203
- if (typeof target !== 'undefined' && typeof target.webkitSupportsPresentationMode === 'function' && target.webkitSupportsPresentationMode(PIP_PRESENTATION_MODE) && typeof target.webkitSetPresentationMode === 'function') {
4204
- if (target.disablePictureInPicture)
4205
- return reject(new NotSupportedError('Picture-in-Picture is disabled on this video element.'));
4206
- lastPipVideo = target;
4207
- bridgeWebkitVideoEvents();
4208
- target.webkitSetPresentationMode(PIP_PRESENTATION_MODE);
4209
- return resolve();
4210
- }
4211
- reject(new NotSupportedError('The "' + tagName + '" element does not support Picture-in-Picture requests.'));
4269
+ fallbackToWebkit();
4270
+ });
4271
+ }
4272
+ function exit() {
4273
+ return new Promise(function (resolve, reject) {
4274
+ var method = globalThis.document.exitPictureInPicture;
4275
+ if (typeof method === 'function') {
4276
+ var result = method.call(globalThis.document);
4277
+ if (typeof result !== 'undefined' && typeof result.then === 'function') {
4278
+ result
4279
+ .then(resolve)
4280
+ .catch(function () {
4281
+ try {
4282
+ fallbackToWebkit();
4283
+ }
4284
+ catch (e) {
4285
+ reject(new NotSupportedError('Failed to exit Picture-in-Picture mode.'));
4286
+ }
4287
+ });
4288
+ return;
4212
4289
  }
4213
- var method = target.requestPictureInPicture;
4214
- if (typeof method === 'function') {
4215
- var result = method.call(target);
4216
- if (typeof result !== 'undefined' && typeof result.then === 'function') {
4217
- result
4218
- .then(function () {
4219
- resolve();
4220
- })
4221
- .catch(function () {
4222
- fallbackToWebkitVideo();
4223
- });
4224
- return;
4225
- }
4290
+ return resolve();
4291
+ }
4292
+ function fallbackToWebkit() {
4293
+ if (lastPipVideo !== null && typeof lastPipVideo.webkitSetPresentationMode === 'function' && lastPipVideo.webkitPresentationMode === PIP_PRESENTATION_MODE) {
4294
+ lastPipVideo.webkitSetPresentationMode(INLINE_PRESENTATION_MODE);
4295
+ lastPipVideo = null;
4226
4296
  return resolve();
4227
4297
  }
4228
- fallbackToWebkitVideo();
4229
- });
4230
- }
4231
- function exitImmediately() {
4232
- return new Promise(function (resolve, reject) {
4233
- if (getElement() === null && lastPipVideo === null)
4234
- return resolve();
4235
- function fallbackToWebkitVideo() {
4236
- var candidates;
4237
- if (lastPipVideo !== null && lastPipVideo.webkitPresentationMode === PIP_PRESENTATION_MODE)
4238
- candidates = [lastPipVideo];
4239
- else
4240
- candidates = globalThis.document.querySelectorAll('video');
4241
- for (var i = 0; i < candidates.length; i++) {
4242
- var video = candidates[i];
4243
- if (typeof video.webkitSetPresentationMode === 'function' && video.webkitPresentationMode === PIP_PRESENTATION_MODE) {
4244
- video.webkitSetPresentationMode(INLINE_PRESENTATION_MODE);
4245
- lastPipVideo = null;
4246
- return resolve();
4247
- }
4248
- }
4249
- if (getElement() === null)
4298
+ var videos = globalThis.document.querySelectorAll('video');
4299
+ for (var i = 0; i < videos.length; i++) {
4300
+ var video = videos[i];
4301
+ if (typeof video.webkitSetPresentationMode === 'function' && video.webkitPresentationMode === PIP_PRESENTATION_MODE) {
4302
+ video.webkitSetPresentationMode(INLINE_PRESENTATION_MODE);
4303
+ lastPipVideo = null;
4250
4304
  return resolve();
4251
- reject(new NotSupportedError('Failed to exit Picture-in-Picture mode.'));
4252
- }
4253
- var method = globalThis.document.exitPictureInPicture;
4254
- if (typeof method === 'function') {
4255
- var result = method.call(globalThis.document);
4256
- if (typeof result !== 'undefined' && typeof result.then === 'function') {
4257
- result
4258
- .then(resolve)
4259
- .catch(function () {
4260
- fallbackToWebkitVideo();
4261
- });
4262
- return;
4263
4305
  }
4264
- return resolve();
4265
4306
  }
4266
- fallbackToWebkitVideo();
4267
- });
4268
- }
4269
- function toggle(target) {
4270
- if (lastIntendedOperation === 'request')
4271
- return exit();
4272
- return request(target);
4273
- }
4274
- bridgeEvents();
4275
- return {
4276
- get supported() {
4277
- return getEnabled();
4278
- },
4279
- get element() {
4280
- return getElement();
4281
- },
4282
- get isPip() {
4283
- return getIsPip();
4284
- },
4285
- request: request,
4286
- exit: exit,
4287
- toggle: toggle,
4288
- onChange: onChangeSubscriptionManager.subscribe,
4289
- onError: onErrorSubscriptionManager.subscribe,
4290
- Constants: {},
4291
- Errors: {
4292
- NotSupportedError: NotSupportedError,
4293
- },
4294
- };
4307
+ if (globalThis.document.pictureInPictureElement === null || typeof globalThis.document.pictureInPictureElement === 'undefined')
4308
+ return resolve();
4309
+ reject(new NotSupportedError('Failed to exit Picture-in-Picture mode.'));
4310
+ }
4311
+ fallbackToWebkit();
4312
+ });
4295
4313
  }
4296
- var Pip = createPip();
4314
+ bridgeEvents();
4297
4315
 
4298
4316
  var Badge = {
4299
- set: set,
4300
- clear: clear,
4301
4317
  get supported() {
4302
4318
  return supported$2();
4303
4319
  },
4320
+ set: set,
4321
+ clear: clear,
4304
4322
  Constants: {},
4305
4323
  Errors: {
4306
4324
  NotSupportedError: NotSupportedError,
@@ -4372,12 +4390,12 @@
4372
4390
  var onChangeSubscriptionManager = createSubscriptionManager(attachOnChange, detachOnChange);
4373
4391
  var batteryRef = null;
4374
4392
  var Battery = {
4375
- get value() {
4376
- return getValue();
4377
- },
4378
4393
  get supported() {
4379
4394
  return supported();
4380
4395
  },
4396
+ get value() {
4397
+ return getValue();
4398
+ },
4381
4399
  onChange: onChangeSubscriptionManager.subscribe,
4382
4400
  Constants: {},
4383
4401
  Errors: {