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
package/dist/native.mjs CHANGED
@@ -1,4 +1,4 @@
1
- var version = "1.1.8";
1
+ var version = "1.2.0";
2
2
  var packageJSON = {
3
3
  version: version};
4
4
 
@@ -853,14 +853,14 @@ function createSubscriptionManager(attach, detach) {
853
853
  };
854
854
  }
855
855
 
856
- var onChangeSubscriptionManager$3 = createSubscriptionManager(attachOnChange$3, detachOnChange$3);
856
+ var onChangeSubscriptionManager$5 = createSubscriptionManager(attachOnChange$5, detachOnChange$5);
857
857
  var appearanceRef = null;
858
858
  var pollingIntervalId = null;
859
859
  var Appearance = {
860
860
  get value() {
861
861
  return getAppearance();
862
862
  },
863
- onChange: onChangeSubscriptionManager$3.subscribe,
863
+ onChange: onChangeSubscriptionManager$5.subscribe,
864
864
  Constants: {
865
865
  Appearances: Appearances
866
866
  },
@@ -896,7 +896,7 @@ function startPolling() {
896
896
  var appearance = getAppearanceFromEngine();
897
897
  if (appearance !== appearanceRef) {
898
898
  appearanceRef = appearance;
899
- onChangeSubscriptionManager$3.emit(appearance);
899
+ onChangeSubscriptionManager$5.emit(appearance);
900
900
  }
901
901
  }, 2000);
902
902
  }
@@ -907,13 +907,13 @@ function stopPolling() {
907
907
  pollingIntervalId = null;
908
908
  }
909
909
  }
910
- function attachOnChange$3() {
910
+ function attachOnChange$5() {
911
911
  appearanceRef = getAppearanceFromMediaQuery();
912
912
  EventListener.add(MEDIA_QUERY_LIST$1, { type: 'change', callback: onMediaChange });
913
913
  if (Platform.browser.name === Browsers.SamsungInternet)
914
914
  startPolling();
915
915
  }
916
- function detachOnChange$3() {
916
+ function detachOnChange$5() {
917
917
  appearanceRef = null;
918
918
  EventListener.remove(MEDIA_QUERY_LIST$1, { type: 'change', callback: onMediaChange });
919
919
  if (Platform.browser.name === Browsers.SamsungInternet)
@@ -926,7 +926,7 @@ function onMediaChange(event) {
926
926
  else
927
927
  appearance = Appearances.Light;
928
928
  if (appearance !== appearanceRef)
929
- onChangeSubscriptionManager$3.emit(appearanceRef = appearance);
929
+ onChangeSubscriptionManager$5.emit(appearanceRef = appearance);
930
930
  }
931
931
 
932
932
  function isSecureContext() {
@@ -1662,14 +1662,14 @@ var safeAreaMaxInsetObserver = createEnvObserver('safe-area-max-inset');
1662
1662
  var keyboardInsetObserver = createEnvObserver('keyboard-inset');
1663
1663
  var titlebarAreaObserver = createEnvObserver('titlebar-area');
1664
1664
  var viewportSegmentObserver = createEnvObserver('viewport-segment');
1665
- var onChangeSubscriptionManager$2 = createSubscriptionManager(attachOnChange$2, detachOnChange$2);
1665
+ var onChangeSubscriptionManager$4 = createSubscriptionManager(attachOnChange$4, detachOnChange$4);
1666
1666
  var dimensionRef = null;
1667
1667
  var Dimension = {
1668
1668
  get value() {
1669
1669
  return getDimension();
1670
1670
  },
1671
1671
  environment: getEnvironment(),
1672
- onChange: onChangeSubscriptionManager$2.subscribe,
1672
+ onChange: onChangeSubscriptionManager$4.subscribe,
1673
1673
  Constants: {
1674
1674
  Orientation: Orientation,
1675
1675
  },
@@ -1755,7 +1755,7 @@ function getDimension() {
1755
1755
  }
1756
1756
  return FALLBACK_DIMENSION;
1757
1757
  }
1758
- function attachOnChange$2() {
1758
+ function attachOnChange$4() {
1759
1759
  dimensionRef = getDimension();
1760
1760
  EventListener.add(globalThis, { type: 'resize', callback: onResize });
1761
1761
  if (typeof globalThis.screen.orientation.addEventListener === 'function')
@@ -1765,7 +1765,7 @@ function attachOnChange$2() {
1765
1765
  else if (MEDIA_QUERY_LIST.media !== 'not all')
1766
1766
  EventListener.add(MEDIA_QUERY_LIST, { type: 'change', callback: onResize });
1767
1767
  }
1768
- function detachOnChange$2() {
1768
+ function detachOnChange$4() {
1769
1769
  dimensionRef = null;
1770
1770
  EventListener.remove(globalThis, { type: 'resize', callback: onResize });
1771
1771
  if (typeof globalThis.screen.orientation.removeEventListener === 'function')
@@ -1778,7 +1778,7 @@ function detachOnChange$2() {
1778
1778
  function onResize() {
1779
1779
  var dimension = getDimension();
1780
1780
  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)
1781
- onChangeSubscriptionManager$2.emit(dimensionRef = dimension);
1781
+ onChangeSubscriptionManager$4.emit(dimensionRef = dimension);
1782
1782
  }
1783
1783
 
1784
1784
  function createCustomError(name, Base) {
@@ -1865,7 +1865,19 @@ function createCustomError(name, Base) {
1865
1865
 
1866
1866
  var NotSupportedError = createCustomError('NotSupportedError');
1867
1867
 
1868
- var FS_BRIDGED_KEY = Symbol('fsBridged');
1868
+ var InvalidStateError = createCustomError('InvalidStateError');
1869
+
1870
+ var lastIOSVideo = null;
1871
+ var eventsBridged$1 = false;
1872
+ var FS_BRIDGE_KEY = (function () {
1873
+ if (typeof Symbol === 'function') {
1874
+ var existing = globalThis.__nativeFnFsBridgeKey__;
1875
+ if (typeof existing === 'symbol')
1876
+ return existing;
1877
+ return globalThis.__nativeFnFsBridgeKey__ = Symbol('native.fn.fs.bridged');
1878
+ }
1879
+ return '__nativeFnFsBridged__';
1880
+ }());
1869
1881
  var API_VARIANTS = {
1870
1882
  standard: {
1871
1883
  enabled: 'fullscreenEnabled',
@@ -1897,6 +1909,31 @@ var API_VARIANTS = {
1897
1909
  },
1898
1910
  };
1899
1911
  var api = detectApi();
1912
+ var onChangeSubscriptionManager$3 = createSubscriptionManager(attachOnChange$3, detachOnChange$3);
1913
+ var onErrorSubscriptionManager$1 = createSubscriptionManager(attachOnError$1, detachOnError$1);
1914
+ var Fullscreen = {
1915
+ get supported() {
1916
+ return getEnabled$1();
1917
+ },
1918
+ get element() {
1919
+ return getElement$1();
1920
+ },
1921
+ get isFullscreen() {
1922
+ return getIsFullscreen();
1923
+ },
1924
+ request: request$3,
1925
+ exit: exit$1,
1926
+ onChange: onChangeSubscriptionManager$3.subscribe,
1927
+ onError: onErrorSubscriptionManager$1.subscribe,
1928
+ Constants: {},
1929
+ Errors: {
1930
+ NotSupportedError: NotSupportedError,
1931
+ InvalidStateError: InvalidStateError,
1932
+ },
1933
+ };
1934
+ function hasStandardApi$1() {
1935
+ return api !== null;
1936
+ }
1900
1937
  function detectApi() {
1901
1938
  var element = globalThis.document.documentElement;
1902
1939
  if (typeof globalThis.document.fullscreenEnabled !== 'undefined' || typeof globalThis.document.exitFullscreen !== 'undefined')
@@ -1913,287 +1950,282 @@ function detectApi() {
1913
1950
  }
1914
1951
  return null;
1915
1952
  }
1916
- function createFullscreen() {
1917
- var lastIOSVideo = null;
1918
- var eventsBridged = false;
1919
- var activeOperation = null;
1920
- var pendingQueue = [];
1921
- var lastIntendedOperation = 'exit';
1922
- var onChangeSubscriptionManager = createSubscriptionManager(attachOnChange, detachOnChange);
1923
- var onErrorSubscriptionManager = createSubscriptionManager(attachOnError, detachOnError);
1924
- function getDefaultTarget() {
1925
- if (Platform.os.name === OS.iOS) {
1926
- var video = globalThis.document.querySelector('video');
1927
- if (video === null)
1928
- return undefined;
1929
- return video;
1930
- }
1931
- return globalThis.document.documentElement;
1932
- }
1933
- function bridgeEvents() {
1934
- if (eventsBridged)
1935
- return;
1936
- eventsBridged = true;
1937
- if (Platform.os.name === OS.iOS) {
1938
- bridgeIOSVideoEvents();
1939
- if (typeof globalThis.MutationObserver !== 'undefined') {
1940
- var observer = new MutationObserver(function () {
1941
- bridgeIOSVideoEvents();
1942
- });
1943
- observer.observe(globalThis.document.documentElement, {
1944
- childList: true,
1945
- subtree: true,
1946
- });
1947
- }
1948
- }
1949
- }
1950
- function bridgeIOSVideoEvents() {
1951
- if (typeof globalThis.document === 'undefined')
1952
- return;
1953
- var videos = globalThis.document.querySelectorAll('video');
1954
- videos.forEach(function (video) {
1955
- if (video[FS_BRIDGED_KEY] === true || !(typeof video.webkitEnterFullscreen !== 'undefined' || typeof video.onwebkitbeginfullscreen !== 'undefined'))
1956
- return;
1957
- EventListener.add(video, {
1958
- type: 'webkitbeginfullscreen',
1959
- callback: onChangeSubscriptionManager.emit,
1960
- options: false,
1961
- });
1962
- EventListener.add(video, {
1963
- type: 'webkitendfullscreen',
1964
- callback: onChangeSubscriptionManager.emit,
1965
- options: false,
1966
- });
1967
- video[FS_BRIDGED_KEY] = true;
1968
- });
1969
- }
1970
- function attachOnChange() {
1971
- var events = ['fullscreenchange', 'webkitfullscreenchange', 'mozfullscreenchange', 'MSFullscreenChange'];
1972
- for (var i = 0; i < events.length; i++) {
1973
- EventListener.add(globalThis.document, {
1974
- type: events[i],
1975
- callback: onChangeSubscriptionManager.emit,
1976
- options: false,
1977
- });
1978
- }
1979
- }
1980
- function detachOnChange() {
1981
- var events = ['fullscreenchange', 'webkitfullscreenchange', 'mozfullscreenchange', 'MSFullscreenChange'];
1982
- for (var i = 0; i < events.length; i++) {
1983
- EventListener.remove(globalThis.document, {
1984
- type: events[i],
1985
- callback: onChangeSubscriptionManager.emit,
1986
- options: false,
1987
- });
1988
- }
1989
- }
1990
- function attachOnError() {
1991
- var events = ['fullscreenerror', 'webkitfullscreenerror', 'mozfullscreenerror', 'MSFullscreenError'];
1992
- for (var i = 0; i < events.length; i++) {
1993
- EventListener.add(globalThis.document, {
1994
- type: events[i],
1995
- callback: onErrorSubscriptionManager.emit,
1996
- options: false,
1997
- });
1998
- }
1999
- }
2000
- function detachOnError() {
2001
- var events = ['fullscreenerror', 'webkitfullscreenerror', 'mozfullscreenerror', 'MSFullscreenError'];
2002
- for (var i = 0; i < events.length; i++) {
2003
- EventListener.remove(globalThis.document, {
2004
- type: events[i],
2005
- callback: onErrorSubscriptionManager.emit,
2006
- options: false,
2007
- });
2008
- }
1953
+ function getDefaultTarget$1() {
1954
+ if (Platform.os.name === OS.iOS) {
1955
+ var video = globalThis.document.querySelector('video');
1956
+ return video !== null ? video : undefined;
2009
1957
  }
2010
- function getEnabled() {
2011
- if (api === null)
2012
- return (Platform.os.name === OS.iOS && globalThis.HTMLVideoElement.prototype.webkitSupportsFullscreen === true);
1958
+ return globalThis.document.documentElement;
1959
+ }
1960
+ function getEnabled$1() {
1961
+ if (api !== null)
2013
1962
  return globalThis.document[api.enabled] === true;
2014
- }
2015
- function getElement() {
2016
- if (api === null) {
2017
- if (lastIOSVideo !== null && lastIOSVideo.webkitDisplayingFullscreen === true)
2018
- return lastIOSVideo;
2019
- return null;
2020
- }
2021
- var currentElement = globalThis.document[api.element];
2022
- if (typeof currentElement !== 'undefined')
2023
- return currentElement;
1963
+ if (Platform.os.name !== OS.iOS)
1964
+ return false;
1965
+ var video;
1966
+ var selected = globalThis.document.querySelector('video');
1967
+ if (selected !== null)
1968
+ video = selected;
1969
+ else
1970
+ video = globalThis.document.createElement('video');
1971
+ return video.webkitSupportsFullscreen === true || typeof video.webkitEnterFullscreen === 'function';
1972
+ }
1973
+ function getElement$1() {
1974
+ if (api === null) {
1975
+ if (lastIOSVideo !== null && lastIOSVideo.webkitDisplayingFullscreen === true)
1976
+ return lastIOSVideo;
2024
1977
  return null;
2025
1978
  }
2026
- function getIsFullscreen() {
2027
- return getElement() !== null;
2028
- }
2029
- function drainPendingOperation() {
2030
- var entry = pendingQueue.shift();
2031
- if (typeof entry === 'undefined') {
2032
- activeOperation = null;
2033
- return;
2034
- }
2035
- var next;
2036
- if (entry.operation === 'request')
2037
- next = requestImmediately(entry.target, entry.options);
2038
- else
2039
- next = exitImmediately();
2040
- activeOperation = next
2041
- .then(function () {
2042
- entry.resolve();
2043
- drainPendingOperation();
2044
- })
2045
- .catch(function (error) {
2046
- entry.reject(error);
2047
- drainPendingOperation();
2048
- });
2049
- }
2050
- function request(target, options) {
2051
- lastIntendedOperation = 'request';
2052
- if (activeOperation === null) {
2053
- var next = requestImmediately(target, options);
2054
- activeOperation = next
2055
- .then(drainPendingOperation)
2056
- .catch(drainPendingOperation);
2057
- return next;
2058
- }
2059
- return new Promise(function (resolve, reject) {
2060
- pendingQueue.push({
2061
- operation: 'request',
2062
- target: target,
2063
- options: options,
2064
- resolve: resolve,
2065
- reject: reject,
2066
- });
2067
- });
2068
- }
2069
- function exit() {
2070
- lastIntendedOperation = 'exit';
2071
- if (activeOperation === null) {
2072
- var next = exitImmediately();
2073
- activeOperation = next
2074
- .then(drainPendingOperation)
2075
- .catch(drainPendingOperation);
2076
- return next;
2077
- }
2078
- return new Promise(function (resolve, reject) {
2079
- pendingQueue.push({
2080
- operation: 'exit',
2081
- target: undefined,
2082
- options: undefined,
2083
- resolve: resolve,
2084
- reject: reject,
2085
- });
2086
- });
2087
- }
2088
- function requestImmediately(target, options) {
2089
- return new Promise(function (resolve, reject) {
2090
- if (typeof target === 'undefined')
2091
- target = getDefaultTarget();
2092
- if (typeof target === 'undefined')
2093
- return reject(new NotSupportedError('Failed to enter fullscreen mode.'));
2094
- var tagName = target.tagName.toLowerCase();
2095
- function fallbackToIOSVideo() {
2096
- if (Platform.os.name === OS.iOS && typeof target !== 'undefined' && target.tagName.toUpperCase() === 'VIDEO') {
2097
- var video = target;
2098
- if (video.webkitSupportsFullscreen === true && typeof video.webkitEnterFullscreen === 'function') {
2099
- lastIOSVideo = video;
2100
- bridgeIOSVideoEvents();
2101
- video.webkitEnterFullscreen();
2102
- return resolve();
1979
+ var currentElement = globalThis.document[api.element];
1980
+ if (typeof currentElement !== 'undefined')
1981
+ return currentElement;
1982
+ return null;
1983
+ }
1984
+ function getIsFullscreen() {
1985
+ return getElement$1() !== null;
1986
+ }
1987
+ function createEventPayload(nativeEvent, element, isFullscreen) {
1988
+ return {
1989
+ nativeEvent: nativeEvent,
1990
+ element: element,
1991
+ isFullscreen: isFullscreen,
1992
+ };
1993
+ }
1994
+ function emitChange$1(nativeEvent, element, isFullscreen) {
1995
+ onChangeSubscriptionManager$3.emit(createEventPayload(nativeEvent, element, isFullscreen));
1996
+ }
1997
+ function emitError$1(nativeEvent, element, isFullscreen) {
1998
+ onErrorSubscriptionManager$1.emit(createEventPayload(nativeEvent, element, isFullscreen));
1999
+ }
2000
+ function onFullscreenChange(event) {
2001
+ var target = event.target;
2002
+ if (target instanceof globalThis.Element)
2003
+ emitChange$1(event, target, getIsFullscreen());
2004
+ if (target instanceof globalThis.Document)
2005
+ emitChange$1(event, globalThis.document.documentElement, getIsFullscreen());
2006
+ }
2007
+ function onFullscreenError(event) {
2008
+ var target = event.target;
2009
+ if (target instanceof globalThis.Element)
2010
+ emitError$1(event, target, getIsFullscreen());
2011
+ if (target instanceof globalThis.Document)
2012
+ emitError$1(event, globalThis.document.documentElement, getIsFullscreen());
2013
+ }
2014
+ function onIOSBeginFullscreen(event) {
2015
+ lastIOSVideo = this;
2016
+ emitChange$1(event, this, true);
2017
+ }
2018
+ function onIOSEndFullscreen(event) {
2019
+ if (lastIOSVideo === this)
2020
+ lastIOSVideo = null;
2021
+ emitChange$1(event, this, false);
2022
+ }
2023
+ function bridgeSingleVideoNode$1(video) {
2024
+ if (video[FS_BRIDGE_KEY])
2025
+ return;
2026
+ if (typeof video.webkitEnterFullscreen === 'undefined' && typeof video.onwebkitbeginfullscreen === 'undefined')
2027
+ return;
2028
+ EventListener.add(video, { type: 'webkitbeginfullscreen', callback: onIOSBeginFullscreen, options: false });
2029
+ EventListener.add(video, { type: 'webkitendfullscreen', callback: onIOSEndFullscreen, options: false });
2030
+ video[FS_BRIDGE_KEY] = true;
2031
+ }
2032
+ function bridgeIOSVideoEvents() {
2033
+ var videos = globalThis.document.querySelectorAll('video');
2034
+ for (var i = 0; i < videos.length; i++)
2035
+ bridgeSingleVideoNode$1(videos[i]);
2036
+ }
2037
+ function bridgeEvents$1() {
2038
+ if (eventsBridged$1)
2039
+ return;
2040
+ eventsBridged$1 = true;
2041
+ if (Platform.os.name !== OS.iOS)
2042
+ return;
2043
+ bridgeIOSVideoEvents();
2044
+ if (typeof globalThis.MutationObserver === 'undefined')
2045
+ return;
2046
+ var observer = new globalThis.MutationObserver(function (records) {
2047
+ if (lastIOSVideo !== null) {
2048
+ var removed = false;
2049
+ for (var i = 0; i < records.length; i++) {
2050
+ var removedNodes = records[i].removedNodes;
2051
+ for (var j = 0; j < removedNodes.length; j++) {
2052
+ var node = removedNodes[j];
2053
+ if (node === lastIOSVideo || (node.nodeType === Node.ELEMENT_NODE && node.contains(lastIOSVideo))) {
2054
+ removed = true;
2055
+ break;
2103
2056
  }
2104
2057
  }
2105
- reject(new NotSupportedError('The "' + tagName + '" element does not support fullscreen requests.'));
2058
+ if (removed)
2059
+ break;
2060
+ }
2061
+ if (removed && !globalThis.document.contains(lastIOSVideo))
2062
+ lastIOSVideo = null;
2063
+ }
2064
+ for (var i = 0; i < records.length; i++) {
2065
+ var addedNodes = records[i].addedNodes;
2066
+ for (var j = 0; j < addedNodes.length; j++) {
2067
+ var node = addedNodes[j];
2068
+ if (node.nodeType !== Node.ELEMENT_NODE)
2069
+ continue;
2070
+ var element = node;
2071
+ if (element.tagName === 'VIDEO') {
2072
+ bridgeSingleVideoNode$1(element);
2073
+ continue;
2074
+ }
2075
+ var nested = element.querySelectorAll('video');
2076
+ for (var k = 0; k < nested.length; k++)
2077
+ bridgeSingleVideoNode$1(nested[k]);
2106
2078
  }
2107
- if (api !== null) {
2108
- var method = target[api.request];
2109
- if (typeof method === 'function') {
2110
- var result = method.call(target, options);
2111
- if (typeof result !== 'undefined' && typeof result.then === 'function') {
2112
- result
2113
- .then(resolve)
2114
- .catch(function () {
2079
+ }
2080
+ });
2081
+ observer.observe(globalThis.document.documentElement, { childList: true, subtree: true });
2082
+ }
2083
+ function attachOnChange$3() {
2084
+ if (api != null)
2085
+ EventListener.add(globalThis.document, { type: api.events.change, callback: onFullscreenChange, options: false });
2086
+ if (Platform.os.name === OS.iOS)
2087
+ bridgeIOSVideoEvents();
2088
+ }
2089
+ function detachOnChange$3() {
2090
+ if (api != null)
2091
+ EventListener.remove(globalThis.document, { type: api.events.change, callback: onFullscreenChange, options: false });
2092
+ if (Platform.os.name !== OS.iOS)
2093
+ return;
2094
+ var videos = globalThis.document.querySelectorAll('video');
2095
+ for (var i = 0; i < videos.length; i++) {
2096
+ EventListener.remove(videos[i], { type: 'webkitbeginfullscreen', callback: onIOSBeginFullscreen, options: false });
2097
+ EventListener.remove(videos[i], { type: 'webkitendfullscreen', callback: onIOSEndFullscreen, options: false });
2098
+ videos[i][FS_BRIDGE_KEY] = false;
2099
+ }
2100
+ }
2101
+ function attachOnError$1() {
2102
+ if (api != null)
2103
+ EventListener.add(globalThis.document, { type: api.events.error, callback: onFullscreenError, options: false });
2104
+ }
2105
+ function detachOnError$1() {
2106
+ if (api != null)
2107
+ EventListener.remove(globalThis.document, { type: api.events.error, callback: onFullscreenError, options: false });
2108
+ }
2109
+ function request$3(target, options) {
2110
+ return new Promise(function (resolve, reject) {
2111
+ if (typeof target === 'undefined')
2112
+ target = getDefaultTarget$1();
2113
+ if (typeof target === 'undefined')
2114
+ return reject(new NotSupportedError('Failed to enter fullscreen mode.'));
2115
+ var tagName = target.tagName.toLowerCase();
2116
+ var isIOSFullscreenActive = lastIOSVideo !== null && lastIOSVideo.webkitDisplayingFullscreen === true;
2117
+ if (api !== null) {
2118
+ var method = target[api.request];
2119
+ if (typeof method === 'function' && !isIOSFullscreenActive) {
2120
+ var result = method.call(target, options);
2121
+ if (typeof result !== 'undefined' && typeof result.then === 'function') {
2122
+ result
2123
+ .then(resolve)
2124
+ .catch(function () {
2125
+ try {
2115
2126
  if (Platform.os.name !== OS.iOS)
2116
2127
  return reject(new NotSupportedError('The "' + tagName + '" element does not support fullscreen requests.'));
2117
2128
  fallbackToIOSVideo();
2118
- });
2119
- return;
2120
- }
2121
- return resolve();
2129
+ }
2130
+ catch (_e) {
2131
+ reject(new NotSupportedError('The "' + tagName + '" element does not support fullscreen requests.'));
2132
+ }
2133
+ });
2134
+ return;
2122
2135
  }
2123
- }
2124
- fallbackToIOSVideo();
2125
- });
2126
- }
2127
- function exitImmediately() {
2128
- return new Promise(function (resolve, reject) {
2129
- if (getElement() === null && lastIOSVideo === null)
2130
2136
  return resolve();
2131
- function fallbackToIOSVideo() {
2132
- if (Platform.os.name === OS.iOS) {
2133
- var candidates = void 0;
2134
- if (lastIOSVideo !== null)
2135
- candidates = [lastIOSVideo];
2136
- else
2137
- candidates = globalThis.document.querySelectorAll('video');
2138
- for (var i = 0; i < candidates.length; i++) {
2139
- var video = candidates[i];
2140
- if (typeof video.webkitExitFullscreen === 'function' && video.webkitDisplayingFullscreen === true) {
2141
- video.webkitExitFullscreen();
2142
- lastIOSVideo = null;
2143
- return resolve();
2137
+ }
2138
+ }
2139
+ function fallbackToIOSVideo() {
2140
+ if (Platform.os.name === OS.iOS && typeof target !== 'undefined' && target.tagName.toUpperCase() === 'VIDEO') {
2141
+ var video_1 = target;
2142
+ if (video_1.webkitSupportsFullscreen && typeof video_1.webkitEnterFullscreen === 'function') {
2143
+ if (!hasStandardApi$1())
2144
+ bridgeSingleVideoNode$1(video_1);
2145
+ if (video_1.played.length === 0) {
2146
+ video_1.play()
2147
+ .then(function () {
2148
+ try {
2149
+ video_1.webkitEnterFullscreen();
2150
+ }
2151
+ catch (e) {
2152
+ return reject(new InvalidStateError('The object is in an invalid state.'));
2153
+ }
2154
+ });
2155
+ }
2156
+ else {
2157
+ try {
2158
+ video_1.webkitEnterFullscreen();
2159
+ }
2160
+ catch (e) {
2161
+ return reject(new InvalidStateError('The object is in an invalid state.'));
2144
2162
  }
2145
2163
  }
2164
+ lastIOSVideo = video_1;
2165
+ return resolve();
2146
2166
  }
2147
- reject(new NotSupportedError('Failed to exit fullscreen mode.'));
2148
2167
  }
2149
- if (api !== null) {
2150
- var method = globalThis.document[api.exit];
2151
- if (typeof method === 'function') {
2152
- var result = method.call(globalThis.document);
2153
- if (typeof result !== 'undefined' && typeof result.then === 'function') {
2154
- result
2155
- .then(resolve)
2156
- .catch(function () {
2168
+ reject(new NotSupportedError('The "' + tagName + '" element does not support fullscreen requests.'));
2169
+ }
2170
+ fallbackToIOSVideo();
2171
+ });
2172
+ }
2173
+ function exit$1() {
2174
+ return new Promise(function (resolve, reject) {
2175
+ if (api !== null) {
2176
+ var method = globalThis.document[api.exit];
2177
+ if (typeof method === 'function') {
2178
+ var result = method.call(globalThis.document);
2179
+ if (typeof result !== 'undefined' && typeof result.then === 'function') {
2180
+ result
2181
+ .then(resolve)
2182
+ .catch(function () {
2183
+ try {
2157
2184
  if (Platform.os.name !== OS.iOS)
2158
2185
  return reject(new NotSupportedError('Failed to exit fullscreen mode.'));
2159
2186
  fallbackToIOSVideo();
2160
- });
2161
- return;
2162
- }
2187
+ }
2188
+ catch (_e) {
2189
+ reject(new NotSupportedError('Failed to exit fullscreen mode.'));
2190
+ }
2191
+ });
2192
+ return;
2193
+ }
2194
+ return resolve();
2195
+ }
2196
+ }
2197
+ function fallbackToIOSVideo() {
2198
+ if (Platform.os.name !== OS.iOS) {
2199
+ reject(new NotSupportedError('Failed to exit fullscreen mode.'));
2200
+ return;
2201
+ }
2202
+ var target = lastIOSVideo;
2203
+ if (target !== null && typeof target.webkitExitFullscreen === 'function' && target.webkitDisplayingFullscreen === true) {
2204
+ target.webkitExitFullscreen();
2205
+ if (target.webkitDisplayingFullscreen)
2206
+ return reject(new NotSupportedError('Failed to exit fullscreen mode.'));
2207
+ lastIOSVideo = null;
2208
+ return resolve();
2209
+ }
2210
+ var videos = globalThis.document.querySelectorAll('video');
2211
+ for (var i = 0; i < videos.length; i++) {
2212
+ var video = videos[i];
2213
+ if (typeof video.webkitExitFullscreen === 'function' && video.webkitDisplayingFullscreen === true) {
2214
+ video.webkitExitFullscreen();
2215
+ if (video.webkitDisplayingFullscreen)
2216
+ return reject(new NotSupportedError('Failed to exit fullscreen mode.'));
2217
+ lastIOSVideo = null;
2163
2218
  return resolve();
2164
2219
  }
2165
2220
  }
2166
- fallbackToIOSVideo();
2167
- });
2168
- }
2169
- function toggle(target, options) {
2170
- if (lastIntendedOperation === 'request')
2171
- return exit();
2172
- return request(target, options);
2173
- }
2174
- bridgeEvents();
2175
- return {
2176
- get supported() {
2177
- return getEnabled();
2178
- },
2179
- get element() {
2180
- return getElement();
2181
- },
2182
- get isFullscreen() {
2183
- return getIsFullscreen();
2184
- },
2185
- request: request,
2186
- exit: exit,
2187
- toggle: toggle,
2188
- onChange: onChangeSubscriptionManager.subscribe,
2189
- onError: onErrorSubscriptionManager.subscribe,
2190
- Constants: {},
2191
- Errors: {
2192
- NotSupportedError: NotSupportedError,
2193
- },
2194
- };
2221
+ if (getElement$1() === null)
2222
+ return resolve();
2223
+ reject(new NotSupportedError('Failed to exit fullscreen mode.'));
2224
+ }
2225
+ fallbackToIOSVideo();
2226
+ });
2195
2227
  }
2196
- var Fullscreen = createFullscreen();
2228
+ bridgeEvents$1();
2197
2229
 
2198
2230
  var PermissionType;
2199
2231
  (function (PermissionType) {
@@ -2235,7 +2267,10 @@ var GET_USER_MEDIA = (function () {
2235
2267
  })();
2236
2268
 
2237
2269
  var Permission = {
2238
- request: request$1,
2270
+ get supported() {
2271
+ return supported$5();
2272
+ },
2273
+ request: request$2,
2239
2274
  check: check,
2240
2275
  Constants: {
2241
2276
  PermissionType: PermissionType,
@@ -2243,7 +2278,10 @@ var Permission = {
2243
2278
  },
2244
2279
  Errors: {},
2245
2280
  };
2246
- function request$1(type) {
2281
+ function supported$5() {
2282
+ return typeof globalThis.navigator.permissions !== 'undefined';
2283
+ }
2284
+ function request$2(type) {
2247
2285
  var instance = this;
2248
2286
  return new Promise(function (resolve) {
2249
2287
  function resolveAfterCheck() {
@@ -2333,7 +2371,7 @@ function check(type) {
2333
2371
 
2334
2372
  var PermissionNotGrantedError = createCustomError('PermissionNotGrantedError');
2335
2373
 
2336
- function request(url, options) {
2374
+ function request$1(url, options) {
2337
2375
  return new Promise(function (resolve) {
2338
2376
  var method = 'GET';
2339
2377
  var headers = {};
@@ -2415,7 +2453,7 @@ function assign() {
2415
2453
  return to;
2416
2454
  }
2417
2455
 
2418
- var onChangeSubscriptionManager$1 = createSubscriptionManager(attachOnChange$1, detachOnChange$1);
2456
+ var onChangeSubscriptionManager$2 = createSubscriptionManager(attachOnChange$2, detachOnChange$2);
2419
2457
  var watchIdRef = null;
2420
2458
  var Geolocation = {
2421
2459
  get value() {
@@ -2424,7 +2462,7 @@ var Geolocation = {
2424
2462
  get supported() {
2425
2463
  return supported$4();
2426
2464
  },
2427
- onChange: onChangeSubscriptionManager$1.subscribe,
2465
+ onChange: onChangeSubscriptionManager$2.subscribe,
2428
2466
  Constants: {},
2429
2467
  Errors: {
2430
2468
  NotSupportedError: NotSupportedError,
@@ -2461,7 +2499,7 @@ function getValue$1() {
2461
2499
  }
2462
2500
  function getFallbackValue(error) {
2463
2501
  return new Promise(function (resolve, reject) {
2464
- request('http://ip-api.com/json?fields=lat,lon')
2502
+ request$1('http://ip-api.com/json?fields=lat,lon')
2465
2503
  .then(function (response) {
2466
2504
  if (typeof response !== 'undefined') {
2467
2505
  var coordinate_1 = {
@@ -2500,7 +2538,7 @@ function normalizeError(error) {
2500
2538
  return new NotSupportedError('Unknown error.');
2501
2539
  }
2502
2540
  }
2503
- function attachOnChange$1() {
2541
+ function attachOnChange$2() {
2504
2542
  if (!supported$4())
2505
2543
  return;
2506
2544
  Permission
@@ -2513,13 +2551,13 @@ function attachOnChange$1() {
2513
2551
  }
2514
2552
  });
2515
2553
  }
2516
- function detachOnChange$1() {
2554
+ function detachOnChange$2() {
2517
2555
  if (!supported$4() || watchIdRef === null)
2518
2556
  return;
2519
2557
  globalThis.navigator.geolocation.clearWatch(watchIdRef);
2520
2558
  }
2521
2559
  function onGeolocationCoordinatesChange(coordinates) {
2522
- onChangeSubscriptionManager$1.emit(coordinates);
2560
+ onChangeSubscriptionManager$2.emit(coordinates);
2523
2561
  }
2524
2562
  function supported$4() {
2525
2563
  return typeof globalThis.navigator.geolocation !== 'undefined';
@@ -3970,16 +4008,19 @@ function removeThemeColor() {
3970
4008
  }
3971
4009
 
3972
4010
  var Vibration = {
3973
- run: run,
3974
- stop: stop,
3975
4011
  get supported() {
3976
4012
  return supported$3();
3977
4013
  },
4014
+ run: run,
4015
+ stop: stop,
3978
4016
  Constants: {},
3979
4017
  Errors: {
3980
4018
  NotSupportedError: NotSupportedError,
3981
4019
  },
3982
4020
  };
4021
+ function supported$3() {
4022
+ return typeof globalThis.navigator.vibrate !== 'undefined';
4023
+ }
3983
4024
  function run(pattern) {
3984
4025
  if (supported$3())
3985
4026
  return globalThis.navigator.vibrate(pattern);
@@ -3988,313 +4029,290 @@ function run(pattern) {
3988
4029
  function stop() {
3989
4030
  return this.run(0);
3990
4031
  }
3991
- function supported$3() {
3992
- return typeof globalThis.navigator.vibrate !== 'undefined';
3993
- }
3994
4032
 
3995
- var PIP_BRIDGED_KEY = Symbol('pipBridged');
3996
4033
  var PIP_PRESENTATION_MODE = 'picture-in-picture';
3997
4034
  var INLINE_PRESENTATION_MODE = 'inline';
3998
- function hasStandardPipEvents() {
4035
+ var lastPipVideo = null;
4036
+ var eventsBridged = false;
4037
+ var PIP_BRIDGE_KEY = (function () {
4038
+ if (typeof Symbol === 'function') {
4039
+ var existing = globalThis.__nativeFnPipBridgeKey__;
4040
+ if (typeof existing === 'symbol')
4041
+ return existing;
4042
+ return globalThis.__nativeFnPipBridgeKey__ = Symbol('native.fn.pip.bridged');
4043
+ }
4044
+ return '__nativeFnPipBridged__';
4045
+ }());
4046
+ var onChangeSubscriptionManager$1 = createSubscriptionManager(attachOnChange$1, detachOnChange$1);
4047
+ var onErrorSubscriptionManager = createSubscriptionManager(attachOnError, detachOnError);
4048
+ var Pip = {
4049
+ get supported() {
4050
+ return getEnabled();
4051
+ },
4052
+ get element() {
4053
+ return getElement();
4054
+ },
4055
+ get isPip() {
4056
+ return getIsPip();
4057
+ },
4058
+ request: request,
4059
+ exit: exit,
4060
+ onChange: onChangeSubscriptionManager$1.subscribe,
4061
+ onError: onErrorSubscriptionManager.subscribe,
4062
+ Constants: {},
4063
+ Errors: {
4064
+ NotSupportedError: NotSupportedError,
4065
+ InvalidStateError: InvalidStateError,
4066
+ },
4067
+ };
4068
+ function hasStandardApi() {
3999
4069
  return typeof globalThis.document.pictureInPictureEnabled !== 'undefined';
4000
4070
  }
4001
- function createPip() {
4002
- var lastPipVideo = null;
4003
- var eventsBridged = false;
4004
- var activeOperation = null;
4005
- var pendingQueue = [];
4006
- var lastIntendedOperation = 'exit';
4007
- var onChangeSubscriptionManager = createSubscriptionManager(attachOnChange, detachOnChange);
4008
- var onErrorSubscriptionManager = createSubscriptionManager(attachOnError, detachOnError);
4009
- function getEnabled() {
4010
- if (typeof globalThis.document.pictureInPictureEnabled === 'boolean')
4011
- return globalThis.document.pictureInPictureEnabled;
4012
- if (typeof HTMLVideoElement === 'undefined')
4013
- return false;
4014
- var videos = globalThis.document.querySelectorAll('video');
4015
- for (var i = 0; i < videos.length; i++) {
4016
- var video = videos[i];
4017
- if (typeof video.webkitSupportsPresentationMode === 'function' && video.webkitSupportsPresentationMode(PIP_PRESENTATION_MODE))
4018
- return true;
4019
- }
4020
- return false;
4021
- }
4022
- function getElement() {
4023
- var currentElement = globalThis.document.pictureInPictureElement;
4024
- if (currentElement !== null && typeof currentElement !== 'undefined')
4025
- return currentElement;
4026
- if (lastPipVideo !== null && lastPipVideo.webkitPresentationMode === PIP_PRESENTATION_MODE)
4027
- return lastPipVideo;
4028
- return null;
4029
- }
4030
- function getIsPip() {
4031
- return getElement() !== null;
4032
- }
4033
- function getDefaultTarget() {
4034
- var video = globalThis.document.querySelector('video');
4035
- if (video === null)
4036
- return undefined;
4037
- return video;
4071
+ function getDefaultTarget() {
4072
+ var video = globalThis.document.querySelector('video');
4073
+ return video !== null ? video : undefined;
4074
+ }
4075
+ function createPipEventPayload(nativeEvent, element, isPip) {
4076
+ return {
4077
+ nativeEvent: nativeEvent,
4078
+ element: element,
4079
+ isPip: isPip
4080
+ };
4081
+ }
4082
+ function emitChange(nativeEvent, element, isPip) {
4083
+ onChangeSubscriptionManager$1.emit(createPipEventPayload(nativeEvent, element, isPip));
4084
+ }
4085
+ function emitError(nativeEvent, element, isPip) {
4086
+ onErrorSubscriptionManager.emit(createPipEventPayload(nativeEvent, element, isPip));
4087
+ }
4088
+ function onEnterPictureInPicture(event) {
4089
+ var target = event.target;
4090
+ if (target instanceof globalThis.HTMLVideoElement)
4091
+ emitChange(event, target, true);
4092
+ }
4093
+ function onLeavePictureInPicture(event) {
4094
+ var target = event.target;
4095
+ if (target instanceof globalThis.HTMLVideoElement)
4096
+ emitChange(event, target, false);
4097
+ }
4098
+ function onPictureInPictureError(event) {
4099
+ var target = event.target;
4100
+ if (target instanceof globalThis.HTMLVideoElement)
4101
+ emitError(event, target, getIsPip());
4102
+ }
4103
+ function onWebkitPresentationModeChanged(event) {
4104
+ if (this.webkitPresentationMode === PIP_PRESENTATION_MODE) {
4105
+ lastPipVideo = this;
4106
+ emitChange(event, this, true);
4107
+ return;
4038
4108
  }
4039
- function onWebkitPresentationModeChanged(event) {
4040
- if (this.webkitPresentationMode === PIP_PRESENTATION_MODE || (this.webkitPresentationMode === INLINE_PRESENTATION_MODE && lastPipVideo === this))
4041
- onChangeSubscriptionManager.emit(event);
4109
+ if (this.webkitPresentationMode === INLINE_PRESENTATION_MODE && lastPipVideo === this) {
4110
+ lastPipVideo = null;
4111
+ emitChange(event, this, false);
4042
4112
  }
4043
- function bridgeEvents() {
4044
- if (eventsBridged)
4045
- return;
4046
- eventsBridged = true;
4047
- if (!hasStandardPipEvents()) {
4048
- bridgeWebkitVideoEvents();
4049
- if (typeof globalThis.MutationObserver !== 'undefined') {
4050
- var observer = new MutationObserver(function () {
4051
- bridgeWebkitVideoEvents();
4052
- });
4053
- observer.observe(globalThis.document.documentElement, {
4054
- childList: true,
4055
- subtree: true,
4056
- });
4113
+ }
4114
+ function bridgeSingleVideoNode(video) {
4115
+ if (video[PIP_BRIDGE_KEY])
4116
+ return;
4117
+ if (typeof video.webkitSetPresentationMode === 'undefined' && typeof video.onwebkitpresentationmodechanged === 'undefined')
4118
+ return;
4119
+ EventListener.add(video, { type: 'webkitpresentationmodechanged', callback: onWebkitPresentationModeChanged, options: false });
4120
+ video[PIP_BRIDGE_KEY] = true;
4121
+ }
4122
+ function bridgeWebkitVideoEvents() {
4123
+ var videos = globalThis.document.querySelectorAll('video');
4124
+ for (var i = 0; i < videos.length; i++)
4125
+ bridgeSingleVideoNode(videos[i]);
4126
+ }
4127
+ function bridgeEvents() {
4128
+ if (eventsBridged)
4129
+ return;
4130
+ eventsBridged = true;
4131
+ if (hasStandardApi())
4132
+ return;
4133
+ bridgeWebkitVideoEvents();
4134
+ if (typeof globalThis.MutationObserver === 'undefined')
4135
+ return;
4136
+ var observer = new globalThis.MutationObserver(function (records) {
4137
+ if (lastPipVideo !== null) {
4138
+ var removed = false;
4139
+ for (var i = 0; i < records.length; i++) {
4140
+ var removedNodes = records[i].removedNodes;
4141
+ for (var j = 0; j < removedNodes.length; j++) {
4142
+ var node = removedNodes[j];
4143
+ if (node === lastPipVideo || (node.nodeType === Node.ELEMENT_NODE && node.contains(lastPipVideo))) {
4144
+ removed = true;
4145
+ break;
4146
+ }
4147
+ }
4148
+ if (removed)
4149
+ break;
4057
4150
  }
4151
+ if (removed && !globalThis.document.contains(lastPipVideo))
4152
+ lastPipVideo = null;
4058
4153
  }
4059
- }
4060
- function bridgeWebkitVideoEvents() {
4061
- if (typeof globalThis.document === 'undefined')
4062
- return;
4063
- var videos = globalThis.document.querySelectorAll('video');
4064
- videos.forEach(function (video) {
4065
- if (video[PIP_BRIDGED_KEY] === true || !(typeof video.webkitSetPresentationMode !== 'undefined' || typeof video.onwebkitpresentationmodechanged !== 'undefined'))
4066
- return;
4067
- EventListener.add(video, {
4068
- type: 'webkitpresentationmodechanged',
4069
- callback: onWebkitPresentationModeChanged,
4070
- options: false,
4071
- });
4072
- video[PIP_BRIDGED_KEY] = true;
4073
- });
4074
- }
4075
- function attachOnChange() {
4076
- if (hasStandardPipEvents()) {
4077
- var changeEvents = ['enterpictureinpicture', 'leavepictureinpicture'];
4078
- for (var i = 0; i < changeEvents.length; i++) {
4079
- EventListener.add(globalThis.document, {
4080
- type: changeEvents[i],
4081
- callback: onChangeSubscriptionManager.emit,
4082
- options: false,
4083
- });
4154
+ for (var i = 0; i < records.length; i++) {
4155
+ var addedNodes = records[i].addedNodes;
4156
+ for (var j = 0; j < addedNodes.length; j++) {
4157
+ var node = addedNodes[j];
4158
+ if (node.nodeType !== Node.ELEMENT_NODE)
4159
+ continue;
4160
+ var element = node;
4161
+ if (element.tagName === 'VIDEO') {
4162
+ bridgeSingleVideoNode(element);
4163
+ continue;
4164
+ }
4165
+ var nested = element.querySelectorAll('video');
4166
+ for (var k = 0; k < nested.length; k++)
4167
+ bridgeSingleVideoNode(nested[k]);
4084
4168
  }
4085
- return;
4086
4169
  }
4087
- bridgeWebkitVideoEvents();
4170
+ });
4171
+ observer.observe(globalThis.document.documentElement, { childList: true, subtree: true });
4172
+ }
4173
+ function attachOnChange$1() {
4174
+ if (hasStandardApi()) {
4175
+ EventListener.add(globalThis.document, { type: 'enterpictureinpicture', callback: onEnterPictureInPicture, options: false });
4176
+ EventListener.add(globalThis.document, { type: 'leavepictureinpicture', callback: onLeavePictureInPicture, options: false });
4177
+ return;
4088
4178
  }
4089
- function detachOnChange() {
4090
- if (hasStandardPipEvents()) {
4091
- var changeEvents = ['enterpictureinpicture', 'leavepictureinpicture'];
4092
- for (var i = 0; i < changeEvents.length; i++) {
4093
- EventListener.remove(globalThis.document, {
4094
- type: changeEvents[i],
4095
- callback: onChangeSubscriptionManager.emit,
4096
- options: false,
4179
+ bridgeWebkitVideoEvents();
4180
+ }
4181
+ function detachOnChange$1() {
4182
+ if (hasStandardApi()) {
4183
+ EventListener.remove(globalThis.document, { type: 'enterpictureinpicture', callback: onEnterPictureInPicture, options: false });
4184
+ EventListener.remove(globalThis.document, { type: 'leavepictureinpicture', callback: onLeavePictureInPicture, options: false });
4185
+ return;
4186
+ }
4187
+ var videos = globalThis.document.querySelectorAll('video');
4188
+ for (var i = 0; i < videos.length; i++) {
4189
+ EventListener.remove(videos[i], { type: 'webkitpresentationmodechanged', callback: onWebkitPresentationModeChanged, options: false });
4190
+ videos[i][PIP_BRIDGE_KEY] = false;
4191
+ }
4192
+ }
4193
+ function attachOnError() {
4194
+ EventListener.add(globalThis.document, { type: 'pictureinpictureerror', callback: onPictureInPictureError, options: false });
4195
+ }
4196
+ function detachOnError() {
4197
+ EventListener.remove(globalThis.document, { type: 'pictureinpictureerror', callback: onPictureInPictureError, options: false });
4198
+ }
4199
+ function getEnabled() {
4200
+ if (typeof globalThis.document.pictureInPictureEnabled === 'boolean')
4201
+ return globalThis.document.pictureInPictureEnabled;
4202
+ var video;
4203
+ var selected = globalThis.document.querySelector('video');
4204
+ if (selected !== null)
4205
+ video = selected;
4206
+ else
4207
+ video = globalThis.document.createElement('video');
4208
+ return typeof video.webkitSupportsPresentationMode === 'function' && video.webkitSupportsPresentationMode(PIP_PRESENTATION_MODE);
4209
+ }
4210
+ function getElement() {
4211
+ var currentElement = globalThis.document.pictureInPictureElement;
4212
+ if (currentElement !== null && typeof currentElement !== 'undefined')
4213
+ return currentElement;
4214
+ if (lastPipVideo !== null && lastPipVideo.webkitPresentationMode === PIP_PRESENTATION_MODE)
4215
+ return lastPipVideo;
4216
+ return null;
4217
+ }
4218
+ function getIsPip() {
4219
+ return getElement() !== null;
4220
+ }
4221
+ function request(target) {
4222
+ return new Promise(function (resolve, reject) {
4223
+ if (typeof target === 'undefined')
4224
+ target = getDefaultTarget();
4225
+ if (typeof target === 'undefined')
4226
+ return reject(new NotSupportedError('Failed to enter Picture-in-Picture mode.'));
4227
+ var tagName = target.tagName.toLowerCase();
4228
+ if (tagName !== 'video')
4229
+ return reject(new NotSupportedError('The "' + tagName + '" element does not support Picture-in-Picture requests.'));
4230
+ var method = target.requestPictureInPicture;
4231
+ var isWebkitPipActive = lastPipVideo !== null && lastPipVideo.webkitPresentationMode === PIP_PRESENTATION_MODE;
4232
+ if (typeof method === 'function' && !isWebkitPipActive) {
4233
+ var result = method.call(target);
4234
+ if (typeof result !== 'undefined' && typeof result.then === 'function') {
4235
+ result
4236
+ .then(resolve)
4237
+ .catch(function () {
4238
+ try {
4239
+ fallbackToWebkit();
4240
+ }
4241
+ catch (e) {
4242
+ reject(new NotSupportedError('The "' + tagName + '" element does not support Picture-in-Picture requests.'));
4243
+ }
4097
4244
  });
4245
+ return;
4098
4246
  }
4099
- return;
4247
+ return resolve();
4100
4248
  }
4101
- var videos = globalThis.document.querySelectorAll('video');
4102
- videos.forEach(function (video) {
4103
- EventListener.remove(video, {
4104
- type: 'webkitpresentationmodechanged',
4105
- callback: onWebkitPresentationModeChanged,
4106
- options: false,
4107
- });
4108
- try {
4109
- delete video[PIP_BRIDGED_KEY];
4110
- }
4111
- catch (_) {
4112
- video[PIP_BRIDGED_KEY] = undefined;
4249
+ function fallbackToWebkit() {
4250
+ if (typeof target !== 'undefined' && typeof target.webkitSupportsPresentationMode === 'function' && target.webkitSupportsPresentationMode(PIP_PRESENTATION_MODE) && typeof target.webkitSetPresentationMode === 'function') {
4251
+ if (target.disablePictureInPicture)
4252
+ return reject(new NotSupportedError('Picture-in-Picture is disabled on this element.'));
4253
+ if (!hasStandardApi())
4254
+ bridgeSingleVideoNode(target);
4255
+ target.webkitSetPresentationMode(PIP_PRESENTATION_MODE);
4256
+ if (target.webkitPresentationMode !== PIP_PRESENTATION_MODE)
4257
+ return reject(new InvalidStateError('Picture-in-Picture transition is already in progress.'));
4258
+ lastPipVideo = target;
4259
+ return resolve();
4113
4260
  }
4114
- });
4115
- }
4116
- function attachOnError() {
4117
- EventListener.add(globalThis.document, {
4118
- type: 'pictureinpictureerror',
4119
- callback: onErrorSubscriptionManager.emit,
4120
- options: false,
4121
- });
4122
- }
4123
- function detachOnError() {
4124
- EventListener.remove(globalThis.document, {
4125
- type: 'pictureinpictureerror',
4126
- callback: onErrorSubscriptionManager.emit,
4127
- options: false,
4128
- });
4129
- }
4130
- function drainPendingOperation() {
4131
- var entry = pendingQueue.shift();
4132
- if (typeof entry === 'undefined') {
4133
- activeOperation = null;
4134
- return;
4135
- }
4136
- var next;
4137
- if (entry.operation === 'request')
4138
- next = requestImmediately(entry.target);
4139
- else
4140
- next = exitImmediately();
4141
- activeOperation = next
4142
- .then(function () {
4143
- entry.resolve();
4144
- drainPendingOperation();
4145
- })
4146
- .catch(function (error) {
4147
- entry.reject(error);
4148
- drainPendingOperation();
4149
- });
4150
- }
4151
- function request(target) {
4152
- lastIntendedOperation = 'request';
4153
- if (activeOperation === null) {
4154
- var next = requestImmediately(target);
4155
- activeOperation = next
4156
- .then(drainPendingOperation)
4157
- .catch(drainPendingOperation);
4158
- return next;
4261
+ reject(new NotSupportedError('The "' + tagName + '" element does not support Picture-in-Picture requests.'));
4159
4262
  }
4160
- return new Promise(function (resolve, reject) {
4161
- pendingQueue.push({
4162
- operation: 'request',
4163
- target: target,
4164
- resolve: resolve,
4165
- reject: reject,
4166
- });
4167
- });
4168
- }
4169
- function exit() {
4170
- lastIntendedOperation = 'exit';
4171
- if (activeOperation === null) {
4172
- var next = exitImmediately();
4173
- activeOperation = next
4174
- .then(drainPendingOperation)
4175
- .catch(drainPendingOperation);
4176
- return next;
4177
- }
4178
- return new Promise(function (resolve, reject) {
4179
- pendingQueue.push({
4180
- operation: 'exit',
4181
- target: undefined,
4182
- resolve: resolve,
4183
- reject: reject,
4184
- });
4185
- });
4186
- }
4187
- function requestImmediately(target) {
4188
- return new Promise(function (resolve, reject) {
4189
- if (typeof target === 'undefined')
4190
- target = getDefaultTarget();
4191
- if (typeof target === 'undefined')
4192
- return reject(new NotSupportedError('Failed to enter Picture-in-Picture mode.'));
4193
- var tagName = target.tagName.toLowerCase();
4194
- if (tagName !== 'video')
4195
- return reject(new NotSupportedError('The "' + tagName + '" element does not support Picture-in-Picture requests.'));
4196
- function fallbackToWebkitVideo() {
4197
- if (typeof target !== 'undefined' && typeof target.webkitSupportsPresentationMode === 'function' && target.webkitSupportsPresentationMode(PIP_PRESENTATION_MODE) && typeof target.webkitSetPresentationMode === 'function') {
4198
- if (target.disablePictureInPicture)
4199
- return reject(new NotSupportedError('Picture-in-Picture is disabled on this video element.'));
4200
- lastPipVideo = target;
4201
- bridgeWebkitVideoEvents();
4202
- target.webkitSetPresentationMode(PIP_PRESENTATION_MODE);
4203
- return resolve();
4204
- }
4205
- reject(new NotSupportedError('The "' + tagName + '" element does not support Picture-in-Picture requests.'));
4263
+ fallbackToWebkit();
4264
+ });
4265
+ }
4266
+ function exit() {
4267
+ return new Promise(function (resolve, reject) {
4268
+ var method = globalThis.document.exitPictureInPicture;
4269
+ if (typeof method === 'function') {
4270
+ var result = method.call(globalThis.document);
4271
+ if (typeof result !== 'undefined' && typeof result.then === 'function') {
4272
+ result
4273
+ .then(resolve)
4274
+ .catch(function () {
4275
+ try {
4276
+ fallbackToWebkit();
4277
+ }
4278
+ catch (e) {
4279
+ reject(new NotSupportedError('Failed to exit Picture-in-Picture mode.'));
4280
+ }
4281
+ });
4282
+ return;
4206
4283
  }
4207
- var method = target.requestPictureInPicture;
4208
- if (typeof method === 'function') {
4209
- var result = method.call(target);
4210
- if (typeof result !== 'undefined' && typeof result.then === 'function') {
4211
- result
4212
- .then(function () {
4213
- resolve();
4214
- })
4215
- .catch(function () {
4216
- fallbackToWebkitVideo();
4217
- });
4218
- return;
4219
- }
4284
+ return resolve();
4285
+ }
4286
+ function fallbackToWebkit() {
4287
+ if (lastPipVideo !== null && typeof lastPipVideo.webkitSetPresentationMode === 'function' && lastPipVideo.webkitPresentationMode === PIP_PRESENTATION_MODE) {
4288
+ lastPipVideo.webkitSetPresentationMode(INLINE_PRESENTATION_MODE);
4289
+ lastPipVideo = null;
4220
4290
  return resolve();
4221
4291
  }
4222
- fallbackToWebkitVideo();
4223
- });
4224
- }
4225
- function exitImmediately() {
4226
- return new Promise(function (resolve, reject) {
4227
- if (getElement() === null && lastPipVideo === null)
4228
- return resolve();
4229
- function fallbackToWebkitVideo() {
4230
- var candidates;
4231
- if (lastPipVideo !== null && lastPipVideo.webkitPresentationMode === PIP_PRESENTATION_MODE)
4232
- candidates = [lastPipVideo];
4233
- else
4234
- candidates = globalThis.document.querySelectorAll('video');
4235
- for (var i = 0; i < candidates.length; i++) {
4236
- var video = candidates[i];
4237
- if (typeof video.webkitSetPresentationMode === 'function' && video.webkitPresentationMode === PIP_PRESENTATION_MODE) {
4238
- video.webkitSetPresentationMode(INLINE_PRESENTATION_MODE);
4239
- lastPipVideo = null;
4240
- return resolve();
4241
- }
4242
- }
4243
- if (getElement() === null)
4292
+ var videos = globalThis.document.querySelectorAll('video');
4293
+ for (var i = 0; i < videos.length; i++) {
4294
+ var video = videos[i];
4295
+ if (typeof video.webkitSetPresentationMode === 'function' && video.webkitPresentationMode === PIP_PRESENTATION_MODE) {
4296
+ video.webkitSetPresentationMode(INLINE_PRESENTATION_MODE);
4297
+ lastPipVideo = null;
4244
4298
  return resolve();
4245
- reject(new NotSupportedError('Failed to exit Picture-in-Picture mode.'));
4246
- }
4247
- var method = globalThis.document.exitPictureInPicture;
4248
- if (typeof method === 'function') {
4249
- var result = method.call(globalThis.document);
4250
- if (typeof result !== 'undefined' && typeof result.then === 'function') {
4251
- result
4252
- .then(resolve)
4253
- .catch(function () {
4254
- fallbackToWebkitVideo();
4255
- });
4256
- return;
4257
4299
  }
4258
- return resolve();
4259
4300
  }
4260
- fallbackToWebkitVideo();
4261
- });
4262
- }
4263
- function toggle(target) {
4264
- if (lastIntendedOperation === 'request')
4265
- return exit();
4266
- return request(target);
4267
- }
4268
- bridgeEvents();
4269
- return {
4270
- get supported() {
4271
- return getEnabled();
4272
- },
4273
- get element() {
4274
- return getElement();
4275
- },
4276
- get isPip() {
4277
- return getIsPip();
4278
- },
4279
- request: request,
4280
- exit: exit,
4281
- toggle: toggle,
4282
- onChange: onChangeSubscriptionManager.subscribe,
4283
- onError: onErrorSubscriptionManager.subscribe,
4284
- Constants: {},
4285
- Errors: {
4286
- NotSupportedError: NotSupportedError,
4287
- },
4288
- };
4301
+ if (globalThis.document.pictureInPictureElement === null || typeof globalThis.document.pictureInPictureElement === 'undefined')
4302
+ return resolve();
4303
+ reject(new NotSupportedError('Failed to exit Picture-in-Picture mode.'));
4304
+ }
4305
+ fallbackToWebkit();
4306
+ });
4289
4307
  }
4290
- var Pip = createPip();
4308
+ bridgeEvents();
4291
4309
 
4292
4310
  var Badge = {
4293
- set: set,
4294
- clear: clear,
4295
4311
  get supported() {
4296
4312
  return supported$2();
4297
4313
  },
4314
+ set: set,
4315
+ clear: clear,
4298
4316
  Constants: {},
4299
4317
  Errors: {
4300
4318
  NotSupportedError: NotSupportedError,
@@ -4366,12 +4384,12 @@ function supported$1() {
4366
4384
  var onChangeSubscriptionManager = createSubscriptionManager(attachOnChange, detachOnChange);
4367
4385
  var batteryRef = null;
4368
4386
  var Battery = {
4369
- get value() {
4370
- return getValue();
4371
- },
4372
4387
  get supported() {
4373
4388
  return supported();
4374
4389
  },
4390
+ get value() {
4391
+ return getValue();
4392
+ },
4375
4393
  onChange: onChangeSubscriptionManager.subscribe,
4376
4394
  Constants: {},
4377
4395
  Errors: {