tiny-essentials 1.29.1 → 1.29.2

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 (128) hide show
  1. package/changelog/1/29/2.md +82 -0
  2. package/dist/v1/TinyBasicsEs.min.js +1 -1
  3. package/dist/v1/TinyEssentials.min.js +1 -1
  4. package/dist/v1/TinyFetchLoader.min.js +1 -0
  5. package/dist/v1/TinyImageLoader.min.js +1 -0
  6. package/dist/v1/TinyMediaCache.min.js +1 -0
  7. package/dist/v1/TinyMediaLoader.min.js +1 -0
  8. package/dist/v1/basics/index.cjs +5 -0
  9. package/dist/v1/basics/index.d.mts +2 -1
  10. package/dist/v1/basics/index.d.mts.map +1 -1
  11. package/dist/v1/basics/index.mjs +2 -1
  12. package/dist/v1/basics/media/youtube.cjs +275 -0
  13. package/dist/v1/basics/media/youtube.d.mts +107 -0
  14. package/dist/v1/basics/media/youtube.d.mts.map +1 -0
  15. package/dist/v1/basics/media/youtube.mjs +214 -0
  16. package/dist/v1/index.cjs +13 -0
  17. package/dist/v1/index.d.mts +6 -1
  18. package/dist/v1/index.d.mts.map +1 -1
  19. package/dist/v1/index.mjs +7 -2
  20. package/dist/v1/libs/fs/plugins/OPFS/StorageBucket.cjs +0 -1
  21. package/dist/v1/libs/fs/plugins/OPFS/StorageBucket.d.mts +0 -1
  22. package/dist/v1/libs/fs/plugins/OPFS/StorageBucket.d.mts.map +1 -1
  23. package/dist/v1/libs/fs/plugins/OPFS/StorageBucket.mjs +0 -1
  24. package/dist/v1/libs/fs/plugins/OPFS/index.cjs +0 -8
  25. package/dist/v1/libs/fs/plugins/OPFS/index.d.mts +0 -8
  26. package/dist/v1/libs/fs/plugins/OPFS/index.d.mts.map +1 -1
  27. package/dist/v1/libs/fs/plugins/OPFS/index.mjs +0 -8
  28. package/dist/v1/libs/html/TinyHtml.cjs +1 -1
  29. package/dist/v1/libs/html/TinyHtml.d.mts +2 -2
  30. package/dist/v1/libs/html/TinyHtml.d.mts.map +1 -1
  31. package/dist/v1/libs/html/TinyHtml.mjs +1 -1
  32. package/dist/v1/libs/html/loader/TinyMediaLoader.cjs +1999 -0
  33. package/dist/v1/libs/html/loader/TinyMediaLoader.d.mts +999 -0
  34. package/dist/v1/libs/html/loader/TinyMediaLoader.d.mts.map +1 -0
  35. package/dist/v1/libs/html/loader/TinyMediaLoader.mjs +1852 -0
  36. package/dist/v1/libs/html/loader/beta/formats/TinyAudioLoader.cjs +77 -0
  37. package/dist/v1/libs/html/loader/beta/formats/TinyAudioLoader.d.mts +103 -0
  38. package/dist/v1/libs/html/loader/beta/formats/TinyAudioLoader.d.mts.map +1 -0
  39. package/dist/v1/libs/html/loader/beta/formats/TinyAudioLoader.mjs +67 -0
  40. package/dist/v1/libs/html/loader/beta/formats/TinyContentLoader.cjs +630 -0
  41. package/dist/v1/libs/html/loader/beta/formats/TinyContentLoader.d.mts +138 -0
  42. package/dist/v1/libs/html/loader/beta/formats/TinyContentLoader.d.mts.map +1 -0
  43. package/dist/v1/libs/html/loader/beta/formats/TinyContentLoader.mjs +576 -0
  44. package/dist/v1/libs/html/loader/beta/formats/TinyVideoLoader.cjs +70 -0
  45. package/dist/v1/libs/html/loader/beta/formats/TinyVideoLoader.d.mts +100 -0
  46. package/dist/v1/libs/html/loader/beta/formats/TinyVideoLoader.d.mts.map +1 -0
  47. package/dist/v1/libs/html/loader/beta/formats/TinyVideoLoader.mjs +60 -0
  48. package/dist/v1/libs/html/loader/beta/probe/TinyMediaProbe.cjs +946 -0
  49. package/dist/v1/libs/html/loader/beta/probe/TinyMediaProbe.d.mts +67 -0
  50. package/dist/v1/libs/html/loader/beta/probe/TinyMediaProbe.d.mts.map +1 -0
  51. package/dist/v1/libs/html/loader/beta/probe/TinyMediaProbe.mjs +896 -0
  52. package/dist/v1/libs/html/loader/formats/TinyFetchLoader.cjs +225 -0
  53. package/dist/v1/libs/html/loader/formats/TinyFetchLoader.d.mts +149 -0
  54. package/dist/v1/libs/html/loader/formats/TinyFetchLoader.d.mts.map +1 -0
  55. package/dist/v1/libs/html/loader/formats/TinyFetchLoader.mjs +197 -0
  56. package/dist/v1/libs/html/loader/formats/TinyImageLoader.cjs +1454 -0
  57. package/dist/v1/libs/html/loader/formats/TinyImageLoader.d.mts +200 -0
  58. package/dist/v1/libs/html/loader/formats/TinyImageLoader.d.mts.map +1 -0
  59. package/dist/v1/libs/html/loader/formats/TinyImageLoader.mjs +1317 -0
  60. package/dist/v1/libs/html/loader/probe/TinyImageProbe.cjs +668 -0
  61. package/dist/v1/libs/html/loader/probe/TinyImageProbe.d.mts +83 -0
  62. package/dist/v1/libs/html/loader/probe/TinyImageProbe.d.mts.map +1 -0
  63. package/dist/v1/libs/html/loader/probe/TinyImageProbe.mjs +626 -0
  64. package/dist/v1/libs/html/loader/utils/TinyBufferReader.cjs +277 -0
  65. package/dist/v1/libs/html/loader/utils/TinyBufferReader.d.mts +118 -0
  66. package/dist/v1/libs/html/loader/utils/TinyBufferReader.d.mts.map +1 -0
  67. package/dist/v1/libs/html/loader/utils/TinyBufferReader.mjs +247 -0
  68. package/dist/v1/libs/html/loader/utils/TinyIsoBox.cjs +128 -0
  69. package/dist/v1/libs/html/loader/utils/TinyIsoBox.d.mts +49 -0
  70. package/dist/v1/libs/html/loader/utils/TinyIsoBox.d.mts.map +1 -0
  71. package/dist/v1/libs/html/loader/utils/TinyIsoBox.mjs +116 -0
  72. package/dist/v1/libs/html/loader/utils/TinyMediaCache.cjs +796 -0
  73. package/dist/v1/libs/html/loader/utils/TinyMediaCache.d.mts +354 -0
  74. package/dist/v1/libs/html/loader/utils/TinyMediaCache.d.mts.map +1 -0
  75. package/dist/v1/libs/html/loader/utils/TinyMediaCache.mjs +734 -0
  76. package/dist/v1/libs/html/loader/utils/TinyMediaMirror.cjs +302 -0
  77. package/dist/v1/libs/html/loader/utils/TinyMediaMirror.d.mts +256 -0
  78. package/dist/v1/libs/html/loader/utils/TinyMediaMirror.d.mts.map +1 -0
  79. package/dist/v1/libs/html/loader/utils/TinyMediaMirror.mjs +280 -0
  80. package/dist/v1/libs/html/loader/utils/TinyMediaProgress.cjs +194 -0
  81. package/dist/v1/libs/html/loader/utils/TinyMediaProgress.d.mts +138 -0
  82. package/dist/v1/libs/html/loader/utils/TinyMediaProgress.d.mts.map +1 -0
  83. package/dist/v1/libs/html/loader/utils/TinyMediaProgress.mjs +175 -0
  84. package/dist/v1/libs/tools/TinyPkgExportValidator.cjs +359 -55
  85. package/dist/v1/libs/tools/TinyPkgExportValidator.d.mts +64 -6
  86. package/dist/v1/libs/tools/TinyPkgExportValidator.d.mts.map +1 -1
  87. package/dist/v1/libs/tools/TinyPkgExportValidator.mjs +320 -57
  88. package/dist/v1/libs/worker/engine/TinyWebWorkerEngine.cjs +0 -1
  89. package/dist/v1/libs/worker/engine/TinyWebWorkerEngine.d.mts +0 -1
  90. package/dist/v1/libs/worker/engine/TinyWebWorkerEngine.d.mts.map +1 -1
  91. package/dist/v1/libs/worker/engine/TinyWebWorkerEngine.mjs +0 -1
  92. package/dist/v1/webTemplates/bootstrap/5.3/scss/background/_background-grid.scss +15 -0
  93. package/dist/v1/webTemplates/bootstrap/5.3/scss/components/buttons/_buttons-contrast.scss +208 -0
  94. package/dist/v1/webTemplates/bootstrap/5.3/scss/components/buttons/_buttons-ghost.scss +89 -0
  95. package/dist/v1/webTemplates/bootstrap/5.3/scss/components/icon/_cube-icon.scss +65 -0
  96. package/dist/v1/webTemplates/bootstrap/5.3/scss/components/icon/_sphere-pulse.scss +39 -0
  97. package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/_badges.scss +90 -0
  98. package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/_bootstrap-overrides.scss +495 -0
  99. package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/_buttons.scss +390 -0
  100. package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/_colors.scss +213 -0
  101. package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/_effects.scss +153 -0
  102. package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/_forms-tones.scss +69 -0
  103. package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/_forms.scss +323 -0
  104. package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/_global.scss +31 -0
  105. package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/_links.scss +47 -0
  106. package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/_tables.scss +25 -0
  107. package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/_theme.scss +21 -0
  108. package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/_tokens.scss +161 -0
  109. package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/_utilities.scss +81 -0
  110. package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/_variables.scss +63 -0
  111. package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/plugins/_form-tone-mixins.scss +236 -0
  112. package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/plugins/_sizing.scss +68 -0
  113. package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/plugins/_tone-mixins.scss +392 -0
  114. package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/plugins/_typography.scss +112 -0
  115. package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/plugins/background/_tiny_gradient_1.scss +131 -0
  116. package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/plugins/colors/_pink.scss +47 -0
  117. package/docs/v1/Exports.md +33 -2
  118. package/docs/v1/README.md +9 -0
  119. package/docs/v1/basics/youtube.md +204 -0
  120. package/docs/v1/libs/html/loader/TinyFetchLoader.md +114 -0
  121. package/docs/v1/libs/html/loader/TinyImageLoader.md +141 -0
  122. package/docs/v1/libs/html/loader/TinyMediaCache.md +166 -0
  123. package/docs/v1/libs/html/loader/TinyMediaLoader.md +300 -0
  124. package/docs/v1/libs/tools/TinyPkgExportValidator.md +55 -0
  125. package/docs/v1/webTemplates/bootstrap/5.3/DeepStrap.md +177 -0
  126. package/package.json +244 -8
  127. /package/dist/v1/webTemplates/bootstrap/5.3/scss/input/{Placeholder-Colors-Fix.scss → _placeholder-colors-fix.scss} +0 -0
  128. /package/dist/v1/webTemplates/bootstrap/5.3/scss/spacing/{Spacing-Plus.scss → _spacing-plus.scss} +0 -0
@@ -0,0 +1 @@
1
+ (()=>{"use strict";const e={cw:e=>{var t;return()=>{if(e){var r=e;e=0,t={exports:{}},r.call(t.exports,t,t.exports)}return t.exports}},d:(t,r)=>{for(var s in r)e.o(r,s)&&!e.o(t,s)&&Object.defineProperty(t,s,{enumerable:!0,get:r[s]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};let t={};e.d(t,{TinyFetchLoader:()=>m});var r=e.cw(function(e,t){var r,s="object"==typeof Reflect?Reflect:null,i=s&&"function"==typeof s.apply?s.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};r=s&&"function"==typeof s.ownKeys?s.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var n=Number.isNaN||function(e){return e!=e};function o(){o.init.call(this)}e.exports=o,e.exports.once=function(e,t){return new Promise(function(r,s){function i(r){e.removeListener(t,n),s(r)}function n(){"function"==typeof e.removeListener&&e.removeListener("error",i),r([].slice.call(arguments))}y(e,t,n,{once:!0}),"error"!==t&&function(e,t){"function"==typeof e.on&&y(e,"error",t,{once:!0})}(e,i)})},o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var a=10;function h(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function c(e){return void 0===e._maxListeners?o.defaultMaxListeners:e._maxListeners}function l(e,t,r,s){var i,n,o,a;if(h(r),void 0===(n=e._events)?(n=e._events=Object.create(null),e._eventsCount=0):(void 0!==n.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),n=e._events),o=n[t]),void 0===o)o=n[t]=r,++e._eventsCount;else if("function"==typeof o?o=n[t]=s?[r,o]:[o,r]:s?o.unshift(r):o.push(r),(i=c(e))>0&&o.length>i&&!o.warned){o.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=o.length,a=l,console&&console.warn&&console.warn(a)}return e}function u(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function d(e,t,r){var s={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=u.bind(s);return i.listener=r,s.wrapFn=i,i}function m(e,t,r){var s=e._events;if(void 0===s)return[];var i=s[t];return void 0===i?[]:"function"==typeof i?r?[i.listener||i]:[i]:r?function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(i):f(i,i.length)}function p(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function f(e,t){for(var r=new Array(t),s=0;s<t;++s)r[s]=e[s];return r}function y(e,t,r,s){if("function"==typeof e.on)s.once?e.once(t,r):e.on(t,r);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,function i(n){s.once&&e.removeEventListener(t,i),r(n)})}}Object.defineProperty(o,"defaultMaxListeners",{enumerable:!0,get:function(){return a},set:function(e){if("number"!=typeof e||e<0||n(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");a=e}}),o.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},o.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||n(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},o.prototype.getMaxListeners=function(){return c(this)},o.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var s="error"===e,n=this._events;if(void 0!==n)s=s&&void 0===n.error;else if(!s)return!1;if(s){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var h=n[e];if(void 0===h)return!1;if("function"==typeof h)i(h,this,t);else{var c=h.length,l=f(h,c);for(r=0;r<c;++r)i(l[r],this,t)}return!0},o.prototype.addListener=function(e,t){return l(this,e,t,!1)},o.prototype.on=o.prototype.addListener,o.prototype.prependListener=function(e,t){return l(this,e,t,!0)},o.prototype.once=function(e,t){return h(t),this.on(e,d(this,e,t)),this},o.prototype.prependOnceListener=function(e,t){return h(t),this.prependListener(e,d(this,e,t)),this},o.prototype.removeListener=function(e,t){var r,s,i,n,o;if(h(t),void 0===(s=this._events))return this;if(void 0===(r=s[e]))return this;if(r===t||r.listener===t)0===--this._eventsCount?this._events=Object.create(null):(delete s[e],s.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(i=-1,n=r.length-1;n>=0;n--)if(r[n]===t||r[n].listener===t){o=r[n].listener,i=n;break}if(i<0)return this;0===i?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,i),1===r.length&&(s[e]=r[0]),void 0!==s.removeListener&&this.emit("removeListener",e,o||t)}return this},o.prototype.off=o.prototype.removeListener,o.prototype.removeAllListeners=function(e){var t,r,s;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0===--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var i,n=Object.keys(r);for(s=0;s<n.length;++s)"removeListener"!==(i=n[s])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(s=t.length-1;s>=0;s--)this.removeListener(e,t[s]);return this},o.prototype.listeners=function(e){return m(this,e,!0)},o.prototype.rawListeners=function(e){return m(this,e,!1)},o.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):p.call(e,t)},o.prototype.listenerCount=p,o.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]}});r();const s=class{#e;#t=0;#r=0;#s=0;#i=0;#n=0;#o=0;constructor(e=0){if("number"!=typeof e||Number.isNaN(e)||e<0)throw new RangeError('The "total" argument must be a positive number.');this.#e=e}get total(){return this.#e}set total(e){if("number"!=typeof e||Number.isNaN(e)||e<0)throw new RangeError('The "total" value must be a positive number.');this.#e=e}get loaded(){return this.#t}get remaining(){return this.#e>0?Math.max(0,this.#e-this.#t):0}get percent(){return this.#e>0?Math.min(100,this.#t/this.#e*100):0}get rate(){return this.#o}get chunks(){return this.#r}get elapsed(){return 0===this.#s?0:performance.now()-this.#s}get eta(){return this.#o<=0||this.#e<=0?0:this.remaining/this.#o*1e3}start(){return this.#s=performance.now(),this.#i=this.#s,this}push(e){if("number"!=typeof e||Number.isNaN(e)||e<0)throw new RangeError('The "bytes" argument must be a positive number.');const t=performance.now();this.#t+=e,this.#r+=1;const r=t-this.#i;if(r>0){const e=(this.#t-this.#n)/r*1e3;this.#o=0===this.#o?e:.7*this.#o+.3*e}return this.#i=t,this.#n=this.#t,this}reset(){return this.#t=0,this.#r=0,this.#o=0,this.#n=0,this.#s=0,this.#i=0,this}snapshot(){return{loaded:this.#t,total:this.#e,remaining:this.remaining,percent:this.percent,rate:this.#o,elapsed:this.elapsed,eta:this.eta,chunks:this.#r}}};function i(e){if(null===e||"object"!=typeof e)return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}class n{static Strategy=Object.freeze({AUTO:"auto",MANUAL:"manual",TTL:"ttl"});static#a=new Set;static#h=new Map;#c=0;#l=new Map;#u=new Map;#d;#m;#p;#f;#y;#g=0;#b=0;#w=null;#v=!1;get misses(){return this.#b}get ignoreSearch(){return this.#y}get strategy(){return this.#f}get ttl(){return this.#p}get maxItems(){return this.#d}get maxBytes(){return this.#m}get evictions(){return this.#c}constructor(e={}){if(!i(e))throw new TypeError('The "options" argument must be a plain object.');const{maxItems:t=1/0,maxBytes:r=1/0,ttl:s=0,strategy:o=n.Strategy.MANUAL,ignoreSearch:a=!1,sweepInterval:h=0}=e;if("number"!=typeof t||Number.isNaN(t)||t<1)throw new RangeError('The "maxItems" option must be a positive number.');if(t!==1/0&&!Number.isInteger(t))throw new RangeError('The "maxItems" option must be an integer or Infinity.');if("number"!=typeof r||Number.isNaN(r)||r<0)throw new RangeError('The "maxBytes" option must be a positive number.');if("number"!=typeof s||Number.isNaN(s)||s<0)throw new RangeError('The "ttl" option must be a positive number.');if(!Object.values(n.Strategy).includes(o))throw new TypeError(`Unknown cache strategy: ${o}`);if("boolean"!=typeof a)throw new TypeError('The "ignoreSearch" option must be a boolean.');if("number"!=typeof h||Number.isNaN(h)||h<0)throw new RangeError('The "sweepInterval" option must be a positive number.');this.#d=t,this.#m=r,this.#p=s,this.#f=o,this.#y=a,n.#a.add(this),h>0&&(this.#w=setInterval(()=>this.prune(),h),"function"==typeof this.#w.unref&&this.#w.unref())}static get registry(){return Array.from(n.#h,([e,t])=>({key:e,...t}))}static get instances(){return Array.from(n.#a)}static get size(){return n.#h.size}static get bytes(){let e=0;for(const t of n.#h.values())e+=t.size;return e}static has(e,t=!1){return n.#h.has(n.#T(e,t))}static clear(){for(const e of n.#h.values())URL.revokeObjectURL(e.objectUrl);n.#h.clear()}static destroyAll(){for(const e of Array.from(n.#a))e.destroy()}get size(){return this.#l.size}get links(){return this.#u.size}get bytes(){let e=0;for(const t of this.#l.values())e+=t.size;return e}get destroyed(){return this.#v}get stats(){let e=0;for(const t of this.#l.values())e+=t.refs;return{size:this.#l.size,bytes:this.bytes,refs:e,hits:this.#g,misses:this.#b,evictions:this.#c,links:this.#u.size,instances:n.#a.size,blobs:n.#h.size}}entries(){return this.#E(),Array.from(this.#l.values(),e=>({...e,metadata:{...e.metadata}}))}set(e,t,r=!1,s={},o=null){if(this.#E(),!(t instanceof Blob))throw new TypeError('The "blob" argument must be a Blob.');if("boolean"!=typeof r)throw new TypeError('The "pinned" argument must be a boolean.');if(!i(s))throw new TypeError('The "metadata" argument must be a plain object.');if(null!==o&&"string"!=typeof o)throw new TypeError('The "parent" argument must be a string or null.');const a=this.#L(e);this.#_(a,!1);const h=n.#S(a,t),c=Date.now(),l={key:a,url:e,blob:t,objectUrl:h.objectUrl,size:t.size,type:t.type,refs:0,createdAt:c,lastAccess:c,expiresAt:this.#p>0?c+this.#p:0,pinned:Boolean(r),parent:o,metadata:{...s}};return this.#l.set(a,l),null!==o&&this.#A(o,a),this.#R(),l}get(e){this.#E();const t=this.#L(e),r=this.#l.get(t);return r?this.#O(r)?(this.delete(t),this.#b+=1,null):(r.lastAccess=Date.now(),this.#g+=1,r):(this.#b+=1,null)}has(e){this.#E();const t=this.#l.get(this.#L(e));return void 0!==t&&!this.#O(t)}acquire(e){this.#E();const t=this.get(e);return t?(t.refs+=1,t):null}release(e){this.#E();const t=this.#L(e),r=this.#l.get(t);return!!r&&(r.refs=Math.max(0,r.refs-1),0===r.refs&&this.#f===n.Strategy.AUTO&&this.delete(t),!0)}delete(e){return this.#E(),this.#_(this.#L(e),!0)}children(e){return Array.from(this.#u.get(this.#L(e))??[])}#_(e,t){if("string"!=typeof e)throw new TypeError('The "key" argument must be a string.');if("boolean"!=typeof t)throw new TypeError('The "cascade" argument must be a boolean.');const r=this.#l.get(e);if(!r)return!1;if(this.#l.delete(e),n.#M(e),this.#u.delete(e),null===r.parent)return!0;const s=this.#u.get(r.parent);if(!s)return!0;if(s.delete(e),s.size>0)return!0;this.#u.delete(r.parent);const i=this.#l.get(r.parent);return t&&i&&0===i.refs&&this.#_(r.parent,!0),!0}#A(e,t){if("string"!=typeof e)throw new TypeError('The "parent" argument must be a string.');if("string"!=typeof t)throw new TypeError('The "child" argument must be a string.');let r=this.#u.get(e);r||(r=new Set,this.#u.set(e,r)),r.add(t)}peek(e){if(this.#E(),"string"!=typeof e)throw new TypeError('The "url" argument must be a string.');const t=this.#l.get(this.#L(e));return!t||this.#O(t)?null:t}pin(e,t=!0){if(this.#E(),"boolean"!=typeof t)throw new TypeError('The "value" argument must be a boolean.');const r=this.#l.get(this.#L(e));return!!r&&(r.pinned=t,!0)}prune(){this.#E();const e=[];for(const[t,r]of this.#l)this.#O(r)&&e.push(t);let t=0;for(const r of e)this.#_(r,!0)&&(t+=1);return t}clear(){this.#E();for(const e of Array.from(this.#l.keys()))this.#l.delete(e),n.#M(e);this.#u.clear()}destroy(){this.#v||(this.#w&&(clearInterval(this.#w),this.#w=null),this.clear(),n.#a.delete(this),this.#v=!0)}#R(){if(this.#l.size<=this.#d&&this.bytes<=this.#m)return;const e=Array.from(this.#l.values()).filter(e=>!e.pinned&&0===e.refs&&!this.#u.has(e.key)).sort((e,t)=>e.lastAccess-t.lastAccess);let t=this.bytes,r=this.#l.size;for(const s of e){if(r<=this.#d&&t<=this.#m)break;this.delete(s.key),this.#c+=1,t-=s.size,r-=1}}#O(e){if(null===e||"object"!=typeof e)throw new TypeError('The "entry" argument must be a MediaCacheEntry.');return e.expiresAt>0&&Date.now()>=e.expiresAt}#L(e){return n.#T(e,this.#y)}#E(){if(this.#v)throw new Error("Cannot use a destroyed media cache.")}static#T(e,t){if("string"!=typeof e)throw new TypeError('The "url" argument must be a string.');if("boolean"!=typeof t)throw new TypeError('The "ignoreSearch" argument must be a boolean.');if(!t)return e;const r=e.split("#")[0],s=r.indexOf("?");return-1===s?r:r.slice(0,s)}static#S(e,t){if("string"!=typeof e)throw new TypeError('The "key" argument must be a string.');if(!(t instanceof Blob))throw new TypeError('The "blob" argument must be a Blob.');const r=n.#h.get(e);if(r)return r.refs+=1,r;const s={objectUrl:URL.createObjectURL(t),refs:1,size:t.size};return n.#h.set(e,s),s}static#M(e){if("string"!=typeof e)throw new TypeError('The "key" argument must be a string.');const t=n.#h.get(e);t&&(t.refs-=1,t.refs>0||(URL.revokeObjectURL(t.objectUrl),n.#h.delete(e)))}}const o=n;class a{static#j=new Map;static get size(){return a.#j.size}static get keys(){return Array.from(a.#j.keys())}static get stats(){let e=0;for(const t of a.#j.values())e+=t.mirrors;return{pending:a.#j.size,mirrors:e}}static has(e){return a.#j.has(e)}static get(e){return a.#j.get(e)??null}static entries(){return Array.from(a.#j.values(),e=>({key:e.key,src:e.src,startedAt:e.startedAt,mirrors:e.mirrors,settled:e.settled}))}static open(e,t){if("string"!=typeof e)throw new TypeError('The "key" argument must be a string.');if("string"!=typeof t)throw new TypeError('The "src" argument must be a string.');const r=a.#j.get(e);if(r)return r;const s={key:e,src:t,startedAt:Date.now(),mirrors:0,settled:!1,sequence:0,events:[],subscribers:new Set,promise:null,resolve:()=>{},reject:()=>{}};return s.promise=new Promise((e,t)=>{s.resolve=t=>{s.settled=!0,e(t)},s.reject=e=>{s.settled=!0,t(e)}}),s.promise.catch(()=>{}),a.#j.set(e,s),s}static attach(e){const t=a.#j.get(e);return t?(t.mirrors+=1,t):null}static close(e){const t=a.#j.get(e);return!!t&&(t.settled||t.reject(new Error(`The mirrored download for "${t.src}" ended without a payload.`)),a.#j.delete(e))}static clear(){for(const e of a.#j.values())e.settled||e.reject(new Error("The mirror registry was cleared."));a.#j.clear()}static publish(e,t,r){if("string"!=typeof e)throw new TypeError('The "key" argument must be a string.');if("string"!=typeof t)throw new TypeError('The "name" argument must be a string.');if(!Array.isArray(r))throw new TypeError('The "args" argument must be an array.');const s=a.#j.get(e);if(!s)return 0;const i={seq:s.sequence,name:t,args:r,timestamp:performance.now()};s.sequence+=1,s.events.push(i);for(const e of s.subscribers)e(i);return s.subscribers.size}static subscribe(e,t){if("function"!=typeof t)throw new TypeError('The "handler" argument must be a function.');const r=a.#j.get(e);if(!r)return null;const{events:s}=r;for(let e=0;e<s.length;e+=1)t(s[e]);return r.subscribers.add(t),()=>r.subscribers.delete(t)}static history(e){return a.#j.get(e)?.events??[]}}const h=a,c=r().EventEmitter;class l extends c{static get TinyMediaMirror(){return h}static MediaState=Object.freeze({IDLE:"idle",LOADING:"loading",LOADED:"loaded",ERROR:"error",DESTROYED:"destroyed"});static get tagName(){return""}#k;#x=l.MediaState.IDLE;#z=null;#D;#s=0;#N=0;#I=!1;#C=!1;#U=!1;#q=null;#H=null;#B=null;#F=[];#P=null;#$=!1;#G=!1;#K=null;#Y=null;#W=null;#J=!1;#Q=0;#V=!1;#X=null;#Z=!0;#ee=null;#te=null;#re=new Map;#se=!0;#ie=!1;#ne=!1;#oe=null;#ae=globalThis.fetch.bind(globalThis);#he={};#ce=void 0;#le={};#ue={src:"",type:"",width:0,height:0,duration:0,size:0,fromCache:!1,loadTime:0,timestamp:0,animation:null};constructor(e={}){if(null===e||"object"!=typeof e)throw new TypeError('The "options" argument must be an object.');const{src:t,timeout:r=1/0,element:s=null,autoReload:i=!1,originalSrc:n=!1,earlyDecode:a=!0,progressive:h=!0,useHeadRequest:c=!1,mirror:l=!0,body:u}=e;if(void 0!==t&&"string"!=typeof t)throw new TypeError('The "src" option must be a string.');if("number"!=typeof r||Number.isNaN(r)||r<0)throw new RangeError('The "timeout" option must be a positive number.');if(null!==s&&!(s instanceof HTMLElement))throw new TypeError('The "element" option must be an HTMLElement or null.');if("boolean"!=typeof n)throw new TypeError('The "originalSrc" option must be a boolean.');if("boolean"!=typeof a)throw new TypeError('The "earlyDecode" option must be a boolean.');if("boolean"!=typeof h)throw new TypeError('The "progressive" option must be a boolean.');if("boolean"!=typeof l)throw new TypeError('The "mirror" option must be a boolean.');if("boolean"!=typeof i)throw new TypeError('The "autoReload" option must be a boolean.');super();const d=this.constructor.tagName;if(s&&d&&s.tagName!==d)throw new TypeError(`The "element" option must be a <${d.toLowerCase()}> element.`);if(this.#k=t??s?.getAttribute("src")??"",this.#D=r,this.#U=i,this.#J=n,void 0!==e.cache&&null!==e.cache&&!(e.cache instanceof o))throw new TypeError('The "cache" option must be a TinyMediaCache or null.');this.#P=e.cache??null,this.#de(),this.#I=c,this.#V=a,this.#Z=h,this.#ce=u,this.#se=l,s&&(this.#z=s,this.#me())}static#pe=new Set(["mirror","destroy","error","metadata"]);emit(e,...t){const r=super.emit(e,...t);return!this.#oe||this.#ne||l.#pe.has(e)||this.#oe(e,t),r}get mirror(){return this.#se}get mirrored(){return this.#ie}get response(){return this.#ee}get headResponse(){return this.#te}get useHeadRequest(){return this.#I}get objectUrl(){return this.#W}get src(){return this.#k}get internalSrc(){return this.#K}get originalSrc(){return this.#J}get earlyDecode(){return this.#V}get progressive(){return this.#Z}set src(e){if("string"!=typeof e)throw new TypeError('The "src" value must be a string.');this.#fe(e)&&this.#z&&this.#z.getAttribute("src")!==e&&(e?this.#z.setAttribute("src",e):this.#z.removeAttribute("src"),this._flushMutations())}get aborted(){return this.#G}get cacheAcquired(){return this.#$}get autoReload(){return this.#U}get cacheHint(){return this.#C}get endTime(){return this.#N}get startTime(){return this.#s}get state(){return this.#x}get element(){return this.#z}get metadata(){return{...this.#ue,httpHeaders:{...this.#ue.httpHeaders}}}get resourceSize(){return this.#Q}get isLoading(){return this.#x===l.MediaState.LOADING}get isLoaded(){return this.#x===l.MediaState.LOADED}get hasError(){return this.#x===l.MediaState.ERROR}get progress(){return this.#H}get cache(){return this.#P}set cache(e){if(null!==e&&!(e instanceof o))throw new TypeError('The "cache" value must be a TinyMediaCache or null.');this.#P=e}get signal(){if(!this.#B)throw new Error("Signal does not exist.");return this.#B}get body(){return this.#ce}set body(e){this.#ce=e}get pending(){return h.has(this.#ye(this.#k))}get _fetch(){return this.#ae}set _fetch(e){if("function"!=typeof e)throw new TypeError('The "fetch" value must be a function.');this.#ae=e}get _requestInit(){return this.#he}set _requestInit(e){this.#he=e}isCached(e=this.#k){if("string"!=typeof e)throw new TypeError('The "src" argument must be a string.');return!!this.#P&&this.#P.has(e)}get cached(){return this.isCached()}peekCache(e=this.#k){if("string"!=typeof e)throw new TypeError('The "src" argument must be a string.');return this.#P?this.#P.peek(e):null}_insertDecoder(e,t){if("string"!=typeof e||0===e.length)throw new TypeError('The "mime" argument must be a non-empty string.');if("function"!=typeof t)throw new TypeError('The "callback" argument must be a function.');this.#re.set(e,t)}_createProgress(e=0){if("number"!=typeof e||!Number.isFinite(e))throw new TypeError('The "total" argument must be a finite number.');if(e<0)throw new RangeError('The "total" argument must be a non-negative number.');return this.#H=new s(e).start(),this.#H}_emitProgress(){this.#H&&this.emit("progress",this.#H.snapshot())}_emitMetadata(e,t){if(null===e||"object"!=typeof e)throw new TypeError('The "patch" argument must be an object.');if("string"!=typeof t||0===t.length)throw new TypeError('The "type" argument must be a non-empty string.');const r=Object.fromEntries(Object.entries(e).filter(([,e])=>void 0!==e));this.#le={...this.#le,...r},this.#ue={...this.#ue,...r},this.#oe?.("metadata",[r,t]),this.emit("metadata",this.metadata,t)}_on(e,t,r){if(!(e instanceof HTMLElement))throw new TypeError('The "element" argument must be an HTMLElement.');if("string"!=typeof t||0===t.length)throw new TypeError('The "type" argument must be a non-empty string.');if("function"!=typeof r)throw new TypeError('The "handler" argument must be a function.');e.addEventListener(t,r),this.#F.push(()=>e.removeEventListener(t,r))}_forwardEvents(e,t){if(!Array.isArray(t))throw new TypeError('The "events" argument must be an array of strings.');for(const r of t){if("string"!=typeof r||0===r.length)throw new TypeError('Every entry of "events" must be a non-empty string.');this._on(e,r,e=>{this.emit(r,e)})}}_detachEvents(){for(const e of this.#F)e();this.#F=[]}async load(){if(this.#x===l.MediaState.DESTROYED)throw new Error("Cannot load a destroyed media loader.");if(this.#x===l.MediaState.LOADING)throw new Error("The media is already loading.");if(!this.#k)throw new Error("Cannot load media without a source.");this._detachEvents(),this._releaseFromCache(),this.#de(),this.#ge(),this.#be(),this._createProgress(0),this.#we(l.MediaState.LOADING),this.emit("loadstart",{src:this.#k});try{return await this.#ve(this._startLoad()),this.#N=performance.now(),this.#ue=this.#Te(),this.#we(l.MediaState.LOADED),this.emit("loaded",this.#ue),this.#ue}catch(e){throw this.#N=performance.now(),this.#G?(this.#G=!1,this.#we(l.MediaState.IDLE),this.emit("abort",{src:this.#k})):(this.#we(l.MediaState.ERROR),this.#Ee(e)),e}finally{this.emit("loadend",{src:this.#k,state:this.#x})}}async reload(){if(this.#x===l.MediaState.LOADING)throw new Error("Cannot reload while the media is loading.");if(this.#x===l.MediaState.DESTROYED)throw new Error("Cannot reload a destroyed media loader.");return this.#H?.reset(),this.#x=l.MediaState.IDLE,this.load()}abort(){return this.#x===l.MediaState.LOADING&&(this.#G=!0,this.#B&&this.#B.abort(),!0)}mount(e){if(!(e instanceof HTMLElement))throw new TypeError('The "container" argument must be an HTMLElement.');if(!this.#z)throw new Error("Cannot mount before the media element is created.");return e.appendChild(this.#z),this}destroy(){this.#x!==l.MediaState.DESTROYED&&(this.#x=l.MediaState.DESTROYED,this.#B&&this.#B.abort(),this._cleanup(),this._detachEvents(),this.#Le(),null!==this.#Y&&(clearTimeout(this.#Y),this.#Y=null),this.#ge(),this._releaseFromCache(),this.#re.clear(),this.emit("destroy"),this.removeAllListeners(),this.#z=null)}_resolveElement(){return this.#z||(this.#z=this._createElement()),this.#me(),this.#z}_setElement(e){if(!(e instanceof HTMLElement))throw new TypeError('The "element" argument must be an HTMLElement.');this.#z=e,this.#me()}_setCacheHint(e){if("boolean"!=typeof e)throw new TypeError('The "value" argument must be a boolean.');this.#C=Boolean(e)}_setInternalSrc(e){if(null!==e&&"string"!=typeof e)throw new TypeError('The "url" argument must be a string or null.');this.#K=e,this.#_e(),this._flushMutations(),this.emit("srctransition",{src:this.#k,internalSrc:e})}#_e(){const e=this.#z;e&&this.#J&&(this.#K?e.setAttribute("original-src",this.#k):e.removeAttribute("original-src"))}_waitForMedia(e,t="loadeddata"){if(!(e instanceof HTMLElement))throw new TypeError('The "element" argument must be an HTMLElement.');if("string"!=typeof t)throw new TypeError('The "readyEvent" argument must be a string.');if(!this.#B)throw new Error("Signal does not exist to wait for media.");const{signal:r}=this.#B;return new Promise((s,i)=>{const n=()=>{h(),s(void 0)},o=()=>{h(),i(new Error(`Failed to load media: ${this.#k}`))},a=()=>{h(),i(new DOMException("The media load was aborted.","AbortError"))},h=()=>{e.removeEventListener(t,n),e.removeEventListener("error",o),r.removeEventListener("abort",a)};e.addEventListener(t,n),e.addEventListener("error",o),r.addEventListener("abort",a,{once:!0})})}_cacheBlob(e){if(!(e instanceof Blob))throw new TypeError('The "blob" argument must be a Blob.');if(this._setResourceSize(e.size),this.#P){const t=this.#P.get(this.#k);if(t)return this.#P.acquire(this.#k),this.#$=!0,t.objectUrl;const r=this.#P.set(this.#k,e,!1,this.#le);return this.#P.acquire(this.#k),this.#$=!0,this.emit("cachemiss",r),r.objectUrl}return this._createObjectUrl(e)}async _downloadStream(e,t,r=0,s=null){if("string"!=typeof e)throw new TypeError('The "url" argument must be a string.');if(!Number.isInteger(r)||r<0)throw new RangeError('The "startByte" argument must be a non-negative integer.');if(void 0!==t&&"function"!=typeof t)throw new TypeError('The "onChunk" argument must be a function or undefined.');const i=this.#ye(e),n=this.#se&&0===r,o=n?h.attach(i):null;if(o)return this.#Se(o,e,t,r,s);const a=n?h.open(i,e):null;this.#oe=a?(e,t)=>h.publish(i,e,t):null;try{const i=await this.#Ae(e,t,r,s);return a?.resolve(i),i}catch(e){throw a?.reject(e),e}finally{this.#oe=null,a&&h.close(i)}}async#Ae(e,t,r=0,s=null){if("string"!=typeof e)throw new TypeError('The "url" argument must be a string.');const i=this.#he.method?.toUpperCase(),n="GET"===i;let o="",a=0,h=!1;if(this.#I&&"GET"===i&&0===r)try{const t=await this.#ae(e,{...this.#he,method:"HEAD",signal:s||this.signal.signal});if(this.#te=t,this.emit("headResponse",t),t.ok){o=t.headers.get("content-type")||"";const e=t.headers.get("content-length");e&&(a=Number(e));const r={};t.headers.forEach((e,t)=>{r[t]=e});const s={};o&&(s.type=o),a>0&&(s.size=a),Object.keys(r).length>0&&(s.httpHeaders=r),Object.keys(s).length>0&&this._emitMetadata(s,"HEAD"),h=!0}}catch(e){}const c=new Headers(this.#he.headers);n&&r>0&&c.set("Range",`bytes=${r}-`);const l={...this.#he,signal:s||this.signal.signal,headers:c};l.body||void 0===this.#ce||(l.body=this.#ce);const u=await this.#ae(e,l);if(this.#ee=u,this.emit("response",u),!u.ok){if(416===u.status)throw new Error("Requested range not satisfiable.");throw new Error(`Failed to fetch media: ${u.status} ${u.statusText}`)}if(!u.body)return new Blob([],{type:o||"application/octet-stream"});const d=u.headers.get("content-type")||o,m=Number(u.headers.get("content-length")||0);if(206===u.status){const e=u.headers.get("content-range");if(e){const t=e.match(/\/(\d+)$/);t&&(a=Number(t[1]))}}else a=m>0?m+r:a;const p={};u.headers.forEach((e,t)=>{p[t]=e});const f={};d&&d!==o&&(f.type=d,o=d),a>0&&(!h||206===u.status)&&(f.size=a),Object.keys(p).length>0&&(f.httpHeaders=p),Object.keys(f).length>0&&this._emitMetadata(f,"GET"),this.#Re(o);const y=this._createProgress(a),g=u.body.getReader(),b=[];let w=r;try{for(;;){const{done:e,value:r}=await g.read();if(e)break;b.push(r),this.#X?.write(r),w+=r.byteLength,y.push(r.byteLength),this.emit("chunk",{chunk:r,loaded:w,total:a}),this._emitProgress(),t&&t(r,b)}}finally{this.#ge()}return new Blob(b,{type:o||"application/octet-stream"})}#ye(e){if(!this.#P?.ignoreSearch)return e;const t=e.split("#")[0],r=t.indexOf("?");return-1===r?t:t.slice(0,r)}async#Se(e,t,r,s,i){const n=[],o=this._createProgress(0),a=h.history(e.key).length,c=h.subscribe(e.key,e=>{this.#Oe(e,n,o,r)});let l;try{l=await e.promise}catch{return c&&c(),this.#Ae(t,r,s,i)}return c&&c(),this.#ie=!0,this._setResourceSize(l.size),l.type&&this._emitMetadata({type:l.type},"MIRROR"),await this.#Me(l),this.emit("mirror",{src:this.#k,key:e.key,size:l.size,mirrors:e.mirrors,replayed:a}),l}#Oe(e,t,r,s){if("metadata"===e.name){const[t,r]=e.args;return void this._emitMetadata(t,r)}if("chunk"===e.name){const[i]=e.args,n=i.chunk;0===r.total&&i.total>0&&(r.total=i.total),t.push(n),r.push(i.chunk.byteLength),s&&s(n,t)}this.#je(e.name,e.args)}#je(e,t){this.#ne=!0;try{Reflect.apply(this.emit,this,[e,...t])}finally{this.#ne=!1}}async#Me(e){this.#Re(e.type),this.#X&&(this.#X.write(new Uint8Array(await e.arrayBuffer())),this.#ge())}#Re(e){if(!this.#V)return;const t=e.split(";")[0].trim().toLowerCase();this.#re.forEach((e,r)=>{!this.#X&&t.startsWith(`${r}/`)&&(this.#X=e(t))})}#ge(){if(this.#X){if("function"==typeof this.#X.finalize){const e=this.#X.finalize();e&&this._emitMetadata(e,"DECODE")}this.#X.close(),this.#X=null}}_acquireFromCache(){if(!this.#P)return null;const e=this.#P.acquire(this.#k);return e&&(this.#$=!0,this._setCacheHint(!0),this._setResourceSize(e.size),e.type&&this._emitMetadata({type:e.type},"CACHE"),e.metadata&&this._emitMetadata(e.metadata,"CACHE")),e}_releaseFromCache(){this.#P&&this.#$&&(this.#P.release(this.#k),this.#$=!1)}_getLoadTime(){return this.#N-this.#s}_detectCache(){if("undefined"==typeof performance||"function"!=typeof performance.getEntriesByName)return!1;const e=performance.getEntriesByName(this.#k);if(0===e.length)return!1;const t=e[e.length-1];return 0===t.transferSize&&t.decodedBodySize>0}_setResourceSize(e){if("number"!=typeof e||Number.isNaN(e)||e<0)throw new RangeError('The "size" argument must be a positive number.');this.#Q=e}_getResourceSize(){if(this.#Q>0)return this.#Q;if("undefined"==typeof performance||"function"!=typeof performance.getEntriesByName)return 0;const e=performance.getEntriesByName(this.#k);if(0===e.length)return 0;const t=e[e.length-1];return t.decodedBodySize||t.transferSize||0}_flushMutations(){this.#q&&this.#q.takeRecords()}_createObjectUrl(e){if(!(e instanceof Blob))throw new TypeError('The "blob" argument must be a Blob.');return this._revokeObjectUrl(),this.#W=URL.createObjectURL(e),this.#W}_revokeObjectUrl(){this.#W&&(URL.revokeObjectURL(this.#W),this.#W=null)}#be(){this.#B=new AbortController,this.#B.signal.addEventListener("abort",()=>this._abort(),{once:!0})}#ke(){return{src:this.#k,type:"",width:0,height:0,duration:0,size:0,fromCache:!1,loadTime:0,timestamp:0,animation:null,httpHeaders:{}}}#de(){this.#G=!1,this.#K=null,this.#Q=0,this.#C=!1,this.#ie=!1,this.#ne=!1,this.#oe=null,this.#le={},this.#s=performance.now(),this.#N=0,this.#ue=this.#ke()}#we(e){if(this.#x===e)return;const t=this.#x;this.#x=e,this.emit("statechange",{state:e,previous:t,src:this.#k})}#Ee(e){this.listenerCount("error")>0&&this.emit("error",e)}#fe(e){if(e===this.#k)return!1;const t=this.#k;return this.#k=e,this.#ue.src=e,this.emit("srcchange",{src:e,previousSrc:t}),!0}#me(){!this.#q&&"undefined"!=typeof MutationObserver&&this.#z&&(this.#q=new MutationObserver(e=>this.#xe(e)),this.#q.observe(this.#z,{attributes:!0,attributeFilter:this.#J?["src","original-src"]:["src"]}))}#Le(){this.#q&&(this.#q.disconnect(),this.#q=null)}#xe(e){const t=this.#z;if(!t)return;let r=null;for(const{attributeName:s}of e)"original-src"===s?r=t.getAttribute("original-src")??"":"src"===s&&null===r&&(r=t.getAttribute("src")??"");null!==r&&r!==this.#k&&r!==this.#K&&(this.#fe(r),this.#U&&this.reload().catch(e=>{this.listenerCount("error")>0&&this.emit("error",e)}))}#Te(){return{src:this.#k,fromCache:this.#C||this._detectCache(),loadTime:this.#N-this.#s,timestamp:Date.now(),animation:null,...this._getMetadataDetails(),...this.#le}}#ve(e){return this.#D<=0?e:new Promise((t,r)=>{this.#Y=setTimeout(()=>{this.#Y=null,this.#B&&this.#B.abort(),this.emit("timeout",{src:this.#k,timeout:this.#D}),r(new Error(`Media load timed out after ${this.#D}ms.`))},this.#D),e.then(e=>{null!==this.#Y&&clearTimeout(this.#Y),this.#Y=null,t(e)},e=>{null!==this.#Y&&clearTimeout(this.#Y),this.#Y=null,r(e)})})}_createElement(){throw new Error('The "_createElement" method must be implemented by a subclass.')}_startLoad(){throw new Error('The "_startLoad" method must be implemented by a subclass.')}_getMetadataDetails(){return{type:"",width:0,height:0,duration:0,size:0}}_abort(){this._revokeObjectUrl();const e=this.#z;if(!e)return;const t=e;"function"==typeof t.pause&&t.pause(),e.removeAttribute("src"),"function"==typeof t.load&&t.load(),this._setInternalSrc(null)}_cleanup(){}}const u=l;class d extends u{#ze;#De;#Ne=null;#Ie=null;#Ce;constructor(e={}){if(null===e||"object"!=typeof e||Array.isArray(e))throw new TypeError('The "options" argument must be a plain object.');super(e);const{fetch:t=globalThis.fetch.bind(globalThis),init:r={},responseType:s="blob"}=e;if("function"!=typeof t)throw new TypeError('The "fetch" option must be a function.');if(null===r||"object"!=typeof r||Array.isArray(r))throw new TypeError('The "init" option must be a plain object.');if(!["blob","arraybuffer","text","json"].includes(s))throw new RangeError('The "responseType" option must be one of: blob, arraybuffer, text, json.');this._fetch=t,this._requestInit=r,this.#ze=r,this.#De=s,this.#Ce={...e,fetch:t,init:{...r},responseType:s}}get blob(){return this.#Ne}get data(){return this.#Ie}get responseType(){return this.#De}get init(){return{...this.#ze}}clone(e={}){if(null===e||"object"!=typeof e||Array.isArray(e))throw new TypeError('The "overrides" argument must be a plain object.');const t={...this.#Ce.init,...e.init??{}};return new d({...this.#Ce,...e,init:t})}exportFetch(){const e=this;return async function(t,r){return e._fetch(t,r)}}async _startLoad(){const e=this._acquireFromCache();if(e)return this.emit("cachehit",e),this.#Ne=e.blob,void await this.#Ue(e.blob);const t=await this._downloadStream(this.src);this.#Ne=t,this._setResourceSize(t.size),this.cache&&this._cacheBlob(t),await this.#Ue(t)}async#Ue(e){"arraybuffer"===this.#De?this.#Ie=await e.arrayBuffer():"text"===this.#De?this.#Ie=await e.text():"json"===this.#De?this.#Ie=JSON.parse(await e.text()):this.#Ie=e}_getMetadataDetails(){return{type:this.#Ne?.type||"application/octet-stream",width:0,height:0,duration:0,size:this.#Ne?.size??0}}_createElement(){throw new Error("TinyFetchLoader does not create a DOM element.")}}const m=d;window.TinyFetchLoader=t.TinyFetchLoader})();
@@ -0,0 +1 @@
1
+ (()=>{"use strict";const t={cw:t=>{var e;return()=>{if(t){var r=t;t=0,e={exports:{}},r.call(e.exports,e,e.exports)}return e.exports}},d:(e,r)=>{for(var i in r)t.o(r,i)&&!t.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:r[i]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)};let e={};t.d(e,{TinyImageLoader:()=>R});var r=t.cw(function(t,e){var r,i="object"==typeof Reflect?Reflect:null,n=i&&"function"==typeof i.apply?i.apply:function(t,e,r){return Function.prototype.apply.call(t,e,r)};r=i&&"function"==typeof i.ownKeys?i.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var s=Number.isNaN||function(t){return t!=t};function a(){a.init.call(this)}t.exports=a,t.exports.once=function(t,e){return new Promise(function(r,i){function n(r){t.removeListener(e,s),i(r)}function s(){"function"==typeof t.removeListener&&t.removeListener("error",n),r([].slice.call(arguments))}p(t,e,s,{once:!0}),"error"!==e&&function(t,e){"function"==typeof t.on&&p(t,"error",e,{once:!0})}(t,n)})},a.EventEmitter=a,a.prototype._events=void 0,a.prototype._eventsCount=0,a.prototype._maxListeners=void 0;var o=10;function h(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function l(t){return void 0===t._maxListeners?a.defaultMaxListeners:t._maxListeners}function u(t,e,r,i){var n,s,a,o;if(h(r),void 0===(s=t._events)?(s=t._events=Object.create(null),t._eventsCount=0):(void 0!==s.newListener&&(t.emit("newListener",e,r.listener?r.listener:r),s=t._events),a=s[e]),void 0===a)a=s[e]=r,++t._eventsCount;else if("function"==typeof a?a=s[e]=i?[r,a]:[a,r]:i?a.unshift(r):a.push(r),(n=l(t))>0&&a.length>n&&!a.warned){a.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=t,u.type=e,u.count=a.length,o=u,console&&console.warn&&console.warn(o)}return t}function c(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function f(t,e,r){var i={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},n=c.bind(i);return n.listener=r,i.wrapFn=n,n}function m(t,e,r){var i=t._events;if(void 0===i)return[];var n=i[e];return void 0===n?[]:"function"==typeof n?r?[n.listener||n]:[n]:r?function(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}(n):g(n,n.length)}function d(t){var e=this._events;if(void 0!==e){var r=e[t];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function g(t,e){for(var r=new Array(e),i=0;i<e;++i)r[i]=t[i];return r}function p(t,e,r,i){if("function"==typeof t.on)i.once?t.once(e,r):t.on(e,r);else{if("function"!=typeof t.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t);t.addEventListener(e,function n(s){i.once&&t.removeEventListener(e,n),r(s)})}}Object.defineProperty(a,"defaultMaxListeners",{enumerable:!0,get:function(){return o},set:function(t){if("number"!=typeof t||t<0||s(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");o=t}}),a.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},a.prototype.setMaxListeners=function(t){if("number"!=typeof t||t<0||s(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this},a.prototype.getMaxListeners=function(){return l(this)},a.prototype.emit=function(t){for(var e=[],r=1;r<arguments.length;r++)e.push(arguments[r]);var i="error"===t,s=this._events;if(void 0!==s)i=i&&void 0===s.error;else if(!i)return!1;if(i){var a;if(e.length>0&&(a=e[0]),a instanceof Error)throw a;var o=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw o.context=a,o}var h=s[t];if(void 0===h)return!1;if("function"==typeof h)n(h,this,e);else{var l=h.length,u=g(h,l);for(r=0;r<l;++r)n(u[r],this,e)}return!0},a.prototype.addListener=function(t,e){return u(this,t,e,!1)},a.prototype.on=a.prototype.addListener,a.prototype.prependListener=function(t,e){return u(this,t,e,!0)},a.prototype.once=function(t,e){return h(e),this.on(t,f(this,t,e)),this},a.prototype.prependOnceListener=function(t,e){return h(e),this.prependListener(t,f(this,t,e)),this},a.prototype.removeListener=function(t,e){var r,i,n,s,a;if(h(e),void 0===(i=this._events))return this;if(void 0===(r=i[t]))return this;if(r===e||r.listener===e)0===--this._eventsCount?this._events=Object.create(null):(delete i[t],i.removeListener&&this.emit("removeListener",t,r.listener||e));else if("function"!=typeof r){for(n=-1,s=r.length-1;s>=0;s--)if(r[s]===e||r[s].listener===e){a=r[s].listener,n=s;break}if(n<0)return this;0===n?r.shift():function(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}(r,n),1===r.length&&(i[t]=r[0]),void 0!==i.removeListener&&this.emit("removeListener",t,a||e)}return this},a.prototype.off=a.prototype.removeListener,a.prototype.removeAllListeners=function(t){var e,r,i;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[t]&&(0===--this._eventsCount?this._events=Object.create(null):delete r[t]),this;if(0===arguments.length){var n,s=Object.keys(r);for(i=0;i<s.length;++i)"removeListener"!==(n=s[i])&&this.removeAllListeners(n);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(e=r[t]))this.removeListener(t,e);else if(void 0!==e)for(i=e.length-1;i>=0;i--)this.removeListener(t,e[i]);return this},a.prototype.listeners=function(t){return m(this,t,!0)},a.prototype.rawListeners=function(t){return m(this,t,!1)},a.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):d.call(t,e)},a.prototype.listenerCount=d,a.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]}});r();const i=class{#t;#e=0;#r=0;#i=0;#n=0;#s=0;#a=0;constructor(t=0){if("number"!=typeof t||Number.isNaN(t)||t<0)throw new RangeError('The "total" argument must be a positive number.');this.#t=t}get total(){return this.#t}set total(t){if("number"!=typeof t||Number.isNaN(t)||t<0)throw new RangeError('The "total" value must be a positive number.');this.#t=t}get loaded(){return this.#e}get remaining(){return this.#t>0?Math.max(0,this.#t-this.#e):0}get percent(){return this.#t>0?Math.min(100,this.#e/this.#t*100):0}get rate(){return this.#a}get chunks(){return this.#r}get elapsed(){return 0===this.#i?0:performance.now()-this.#i}get eta(){return this.#a<=0||this.#t<=0?0:this.remaining/this.#a*1e3}start(){return this.#i=performance.now(),this.#n=this.#i,this}push(t){if("number"!=typeof t||Number.isNaN(t)||t<0)throw new RangeError('The "bytes" argument must be a positive number.');const e=performance.now();this.#e+=t,this.#r+=1;const r=e-this.#n;if(r>0){const t=(this.#e-this.#s)/r*1e3;this.#a=0===this.#a?t:.7*this.#a+.3*t}return this.#n=e,this.#s=this.#e,this}reset(){return this.#e=0,this.#r=0,this.#a=0,this.#s=0,this.#i=0,this.#n=0,this}snapshot(){return{loaded:this.#e,total:this.#t,remaining:this.remaining,percent:this.percent,rate:this.#a,elapsed:this.elapsed,eta:this.eta,chunks:this.#r}}};function n(t){if(null===t||"object"!=typeof t)return!1;const e=Object.getPrototypeOf(t);return e===Object.prototype||null===e}class s{static Strategy=Object.freeze({AUTO:"auto",MANUAL:"manual",TTL:"ttl"});static#o=new Set;static#h=new Map;#l=0;#u=new Map;#c=new Map;#f;#m;#d;#g;#p;#y=0;#b=0;#w=null;#v=!1;get misses(){return this.#b}get ignoreSearch(){return this.#p}get strategy(){return this.#g}get ttl(){return this.#d}get maxItems(){return this.#f}get maxBytes(){return this.#m}get evictions(){return this.#l}constructor(t={}){if(!n(t))throw new TypeError('The "options" argument must be a plain object.');const{maxItems:e=1/0,maxBytes:r=1/0,ttl:i=0,strategy:a=s.Strategy.MANUAL,ignoreSearch:o=!1,sweepInterval:h=0}=t;if("number"!=typeof e||Number.isNaN(e)||e<1)throw new RangeError('The "maxItems" option must be a positive number.');if(e!==1/0&&!Number.isInteger(e))throw new RangeError('The "maxItems" option must be an integer or Infinity.');if("number"!=typeof r||Number.isNaN(r)||r<0)throw new RangeError('The "maxBytes" option must be a positive number.');if("number"!=typeof i||Number.isNaN(i)||i<0)throw new RangeError('The "ttl" option must be a positive number.');if(!Object.values(s.Strategy).includes(a))throw new TypeError(`Unknown cache strategy: ${a}`);if("boolean"!=typeof o)throw new TypeError('The "ignoreSearch" option must be a boolean.');if("number"!=typeof h||Number.isNaN(h)||h<0)throw new RangeError('The "sweepInterval" option must be a positive number.');this.#f=e,this.#m=r,this.#d=i,this.#g=a,this.#p=o,s.#o.add(this),h>0&&(this.#w=setInterval(()=>this.prune(),h),"function"==typeof this.#w.unref&&this.#w.unref())}static get registry(){return Array.from(s.#h,([t,e])=>({key:t,...e}))}static get instances(){return Array.from(s.#o)}static get size(){return s.#h.size}static get bytes(){let t=0;for(const e of s.#h.values())t+=e.size;return t}static has(t,e=!1){return s.#h.has(s.#T(t,e))}static clear(){for(const t of s.#h.values())URL.revokeObjectURL(t.objectUrl);s.#h.clear()}static destroyAll(){for(const t of Array.from(s.#o))t.destroy()}get size(){return this.#u.size}get links(){return this.#c.size}get bytes(){let t=0;for(const e of this.#u.values())t+=e.size;return t}get destroyed(){return this.#v}get stats(){let t=0;for(const e of this.#u.values())t+=e.refs;return{size:this.#u.size,bytes:this.bytes,refs:t,hits:this.#y,misses:this.#b,evictions:this.#l,links:this.#c.size,instances:s.#o.size,blobs:s.#h.size}}entries(){return this.#E(),Array.from(this.#u.values(),t=>({...t,metadata:{...t.metadata}}))}set(t,e,r=!1,i={},a=null){if(this.#E(),!(e instanceof Blob))throw new TypeError('The "blob" argument must be a Blob.');if("boolean"!=typeof r)throw new TypeError('The "pinned" argument must be a boolean.');if(!n(i))throw new TypeError('The "metadata" argument must be a plain object.');if(null!==a&&"string"!=typeof a)throw new TypeError('The "parent" argument must be a string or null.');const o=this.#A(t);this.#S(o,!1);const h=s.#U(o,e),l=Date.now(),u={key:o,url:t,blob:e,objectUrl:h.objectUrl,size:e.size,type:e.type,refs:0,createdAt:l,lastAccess:l,expiresAt:this.#d>0?l+this.#d:0,pinned:Boolean(r),parent:a,metadata:{...i}};return this.#u.set(o,u),null!==a&&this.#k(a,o),this.#L(),u}get(t){this.#E();const e=this.#A(t),r=this.#u.get(e);return r?this.#_(r)?(this.delete(e),this.#b+=1,null):(r.lastAccess=Date.now(),this.#y+=1,r):(this.#b+=1,null)}has(t){this.#E();const e=this.#u.get(this.#A(t));return void 0!==e&&!this.#_(e)}acquire(t){this.#E();const e=this.get(t);return e?(e.refs+=1,e):null}release(t){this.#E();const e=this.#A(t),r=this.#u.get(e);return!!r&&(r.refs=Math.max(0,r.refs-1),0===r.refs&&this.#g===s.Strategy.AUTO&&this.delete(e),!0)}delete(t){return this.#E(),this.#S(this.#A(t),!0)}children(t){return Array.from(this.#c.get(this.#A(t))??[])}#S(t,e){if("string"!=typeof t)throw new TypeError('The "key" argument must be a string.');if("boolean"!=typeof e)throw new TypeError('The "cascade" argument must be a boolean.');const r=this.#u.get(t);if(!r)return!1;if(this.#u.delete(t),s.#C(t),this.#c.delete(t),null===r.parent)return!0;const i=this.#c.get(r.parent);if(!i)return!0;if(i.delete(t),i.size>0)return!0;this.#c.delete(r.parent);const n=this.#u.get(r.parent);return e&&n&&0===n.refs&&this.#S(r.parent,!0),!0}#k(t,e){if("string"!=typeof t)throw new TypeError('The "parent" argument must be a string.');if("string"!=typeof e)throw new TypeError('The "child" argument must be a string.');let r=this.#c.get(t);r||(r=new Set,this.#c.set(t,r)),r.add(e)}peek(t){if(this.#E(),"string"!=typeof t)throw new TypeError('The "url" argument must be a string.');const e=this.#u.get(this.#A(t));return!e||this.#_(e)?null:e}pin(t,e=!0){if(this.#E(),"boolean"!=typeof e)throw new TypeError('The "value" argument must be a boolean.');const r=this.#u.get(this.#A(t));return!!r&&(r.pinned=e,!0)}prune(){this.#E();const t=[];for(const[e,r]of this.#u)this.#_(r)&&t.push(e);let e=0;for(const r of t)this.#S(r,!0)&&(e+=1);return e}clear(){this.#E();for(const t of Array.from(this.#u.keys()))this.#u.delete(t),s.#C(t);this.#c.clear()}destroy(){this.#v||(this.#w&&(clearInterval(this.#w),this.#w=null),this.clear(),s.#o.delete(this),this.#v=!0)}#L(){if(this.#u.size<=this.#f&&this.bytes<=this.#m)return;const t=Array.from(this.#u.values()).filter(t=>!t.pinned&&0===t.refs&&!this.#c.has(t.key)).sort((t,e)=>t.lastAccess-e.lastAccess);let e=this.bytes,r=this.#u.size;for(const i of t){if(r<=this.#f&&e<=this.#m)break;this.delete(i.key),this.#l+=1,e-=i.size,r-=1}}#_(t){if(null===t||"object"!=typeof t)throw new TypeError('The "entry" argument must be a MediaCacheEntry.');return t.expiresAt>0&&Date.now()>=t.expiresAt}#A(t){return s.#T(t,this.#p)}#E(){if(this.#v)throw new Error("Cannot use a destroyed media cache.")}static#T(t,e){if("string"!=typeof t)throw new TypeError('The "url" argument must be a string.');if("boolean"!=typeof e)throw new TypeError('The "ignoreSearch" argument must be a boolean.');if(!e)return t;const r=t.split("#")[0],i=r.indexOf("?");return-1===i?r:r.slice(0,i)}static#U(t,e){if("string"!=typeof t)throw new TypeError('The "key" argument must be a string.');if(!(e instanceof Blob))throw new TypeError('The "blob" argument must be a Blob.');const r=s.#h.get(t);if(r)return r.refs+=1,r;const i={objectUrl:URL.createObjectURL(e),refs:1,size:e.size};return s.#h.set(t,i),i}static#C(t){if("string"!=typeof t)throw new TypeError('The "key" argument must be a string.');const e=s.#h.get(t);e&&(e.refs-=1,e.refs>0||(URL.revokeObjectURL(e.objectUrl),s.#h.delete(t)))}}const a=s;class o{static#O=new Map;static get size(){return o.#O.size}static get keys(){return Array.from(o.#O.keys())}static get stats(){let t=0;for(const e of o.#O.values())t+=e.mirrors;return{pending:o.#O.size,mirrors:t}}static has(t){return o.#O.has(t)}static get(t){return o.#O.get(t)??null}static entries(){return Array.from(o.#O.values(),t=>({key:t.key,src:t.src,startedAt:t.startedAt,mirrors:t.mirrors,settled:t.settled}))}static open(t,e){if("string"!=typeof t)throw new TypeError('The "key" argument must be a string.');if("string"!=typeof e)throw new TypeError('The "src" argument must be a string.');const r=o.#O.get(t);if(r)return r;const i={key:t,src:e,startedAt:Date.now(),mirrors:0,settled:!1,sequence:0,events:[],subscribers:new Set,promise:null,resolve:()=>{},reject:()=>{}};return i.promise=new Promise((t,e)=>{i.resolve=e=>{i.settled=!0,t(e)},i.reject=t=>{i.settled=!0,e(t)}}),i.promise.catch(()=>{}),o.#O.set(t,i),i}static attach(t){const e=o.#O.get(t);return e?(e.mirrors+=1,e):null}static close(t){const e=o.#O.get(t);return!!e&&(e.settled||e.reject(new Error(`The mirrored download for "${e.src}" ended without a payload.`)),o.#O.delete(t))}static clear(){for(const t of o.#O.values())t.settled||t.reject(new Error("The mirror registry was cleared."));o.#O.clear()}static publish(t,e,r){if("string"!=typeof t)throw new TypeError('The "key" argument must be a string.');if("string"!=typeof e)throw new TypeError('The "name" argument must be a string.');if(!Array.isArray(r))throw new TypeError('The "args" argument must be an array.');const i=o.#O.get(t);if(!i)return 0;const n={seq:i.sequence,name:e,args:r,timestamp:performance.now()};i.sequence+=1,i.events.push(n);for(const t of i.subscribers)t(n);return i.subscribers.size}static subscribe(t,e){if("function"!=typeof e)throw new TypeError('The "handler" argument must be a function.');const r=o.#O.get(t);if(!r)return null;const{events:i}=r;for(let t=0;t<i.length;t+=1)e(i[t]);return r.subscribers.add(e),()=>r.subscribers.delete(e)}static history(t){return o.#O.get(t)?.events??[]}}const h=o,l=r().EventEmitter;class u extends l{static get TinyMediaMirror(){return h}static MediaState=Object.freeze({IDLE:"idle",LOADING:"loading",LOADED:"loaded",ERROR:"error",DESTROYED:"destroyed"});static get tagName(){return""}#R;#x=u.MediaState.IDLE;#M=null;#I;#i=0;#N=0;#j=!1;#D=!1;#z=!1;#F=null;#B=null;#q=null;#H=[];#P=null;#$=!1;#V=!1;#K=null;#G=null;#W=null;#Y=!1;#J=0;#Q=!1;#X=null;#Z=!0;#tt=null;#et=null;#rt=new Map;#it=!0;#nt=!1;#st=!1;#at=null;#ot=globalThis.fetch.bind(globalThis);#ht={};#lt=void 0;#ut={};#ct={src:"",type:"",width:0,height:0,duration:0,size:0,fromCache:!1,loadTime:0,timestamp:0,animation:null};constructor(t={}){if(null===t||"object"!=typeof t)throw new TypeError('The "options" argument must be an object.');const{src:e,timeout:r=1/0,element:i=null,autoReload:n=!1,originalSrc:s=!1,earlyDecode:o=!0,progressive:h=!0,useHeadRequest:l=!1,mirror:u=!0,body:c}=t;if(void 0!==e&&"string"!=typeof e)throw new TypeError('The "src" option must be a string.');if("number"!=typeof r||Number.isNaN(r)||r<0)throw new RangeError('The "timeout" option must be a positive number.');if(null!==i&&!(i instanceof HTMLElement))throw new TypeError('The "element" option must be an HTMLElement or null.');if("boolean"!=typeof s)throw new TypeError('The "originalSrc" option must be a boolean.');if("boolean"!=typeof o)throw new TypeError('The "earlyDecode" option must be a boolean.');if("boolean"!=typeof h)throw new TypeError('The "progressive" option must be a boolean.');if("boolean"!=typeof u)throw new TypeError('The "mirror" option must be a boolean.');if("boolean"!=typeof n)throw new TypeError('The "autoReload" option must be a boolean.');super();const f=this.constructor.tagName;if(i&&f&&i.tagName!==f)throw new TypeError(`The "element" option must be a <${f.toLowerCase()}> element.`);if(this.#R=e??i?.getAttribute("src")??"",this.#I=r,this.#z=n,this.#Y=s,void 0!==t.cache&&null!==t.cache&&!(t.cache instanceof a))throw new TypeError('The "cache" option must be a TinyMediaCache or null.');this.#P=t.cache??null,this.#ft(),this.#j=l,this.#Q=o,this.#Z=h,this.#lt=c,this.#it=u,i&&(this.#M=i,this.#mt())}static#dt=new Set(["mirror","destroy","error","metadata"]);emit(t,...e){const r=super.emit(t,...e);return!this.#at||this.#st||u.#dt.has(t)||this.#at(t,e),r}get mirror(){return this.#it}get mirrored(){return this.#nt}get response(){return this.#tt}get headResponse(){return this.#et}get useHeadRequest(){return this.#j}get objectUrl(){return this.#W}get src(){return this.#R}get internalSrc(){return this.#K}get originalSrc(){return this.#Y}get earlyDecode(){return this.#Q}get progressive(){return this.#Z}set src(t){if("string"!=typeof t)throw new TypeError('The "src" value must be a string.');this.#gt(t)&&this.#M&&this.#M.getAttribute("src")!==t&&(t?this.#M.setAttribute("src",t):this.#M.removeAttribute("src"),this._flushMutations())}get aborted(){return this.#V}get cacheAcquired(){return this.#$}get autoReload(){return this.#z}get cacheHint(){return this.#D}get endTime(){return this.#N}get startTime(){return this.#i}get state(){return this.#x}get element(){return this.#M}get metadata(){return{...this.#ct,httpHeaders:{...this.#ct.httpHeaders}}}get resourceSize(){return this.#J}get isLoading(){return this.#x===u.MediaState.LOADING}get isLoaded(){return this.#x===u.MediaState.LOADED}get hasError(){return this.#x===u.MediaState.ERROR}get progress(){return this.#B}get cache(){return this.#P}set cache(t){if(null!==t&&!(t instanceof a))throw new TypeError('The "cache" value must be a TinyMediaCache or null.');this.#P=t}get signal(){if(!this.#q)throw new Error("Signal does not exist.");return this.#q}get body(){return this.#lt}set body(t){this.#lt=t}get pending(){return h.has(this.#pt(this.#R))}get _fetch(){return this.#ot}set _fetch(t){if("function"!=typeof t)throw new TypeError('The "fetch" value must be a function.');this.#ot=t}get _requestInit(){return this.#ht}set _requestInit(t){this.#ht=t}isCached(t=this.#R){if("string"!=typeof t)throw new TypeError('The "src" argument must be a string.');return!!this.#P&&this.#P.has(t)}get cached(){return this.isCached()}peekCache(t=this.#R){if("string"!=typeof t)throw new TypeError('The "src" argument must be a string.');return this.#P?this.#P.peek(t):null}_insertDecoder(t,e){if("string"!=typeof t||0===t.length)throw new TypeError('The "mime" argument must be a non-empty string.');if("function"!=typeof e)throw new TypeError('The "callback" argument must be a function.');this.#rt.set(t,e)}_createProgress(t=0){if("number"!=typeof t||!Number.isFinite(t))throw new TypeError('The "total" argument must be a finite number.');if(t<0)throw new RangeError('The "total" argument must be a non-negative number.');return this.#B=new i(t).start(),this.#B}_emitProgress(){this.#B&&this.emit("progress",this.#B.snapshot())}_emitMetadata(t,e){if(null===t||"object"!=typeof t)throw new TypeError('The "patch" argument must be an object.');if("string"!=typeof e||0===e.length)throw new TypeError('The "type" argument must be a non-empty string.');const r=Object.fromEntries(Object.entries(t).filter(([,t])=>void 0!==t));this.#ut={...this.#ut,...r},this.#ct={...this.#ct,...r},this.#at?.("metadata",[r,e]),this.emit("metadata",this.metadata,e)}_on(t,e,r){if(!(t instanceof HTMLElement))throw new TypeError('The "element" argument must be an HTMLElement.');if("string"!=typeof e||0===e.length)throw new TypeError('The "type" argument must be a non-empty string.');if("function"!=typeof r)throw new TypeError('The "handler" argument must be a function.');t.addEventListener(e,r),this.#H.push(()=>t.removeEventListener(e,r))}_forwardEvents(t,e){if(!Array.isArray(e))throw new TypeError('The "events" argument must be an array of strings.');for(const r of e){if("string"!=typeof r||0===r.length)throw new TypeError('Every entry of "events" must be a non-empty string.');this._on(t,r,t=>{this.emit(r,t)})}}_detachEvents(){for(const t of this.#H)t();this.#H=[]}async load(){if(this.#x===u.MediaState.DESTROYED)throw new Error("Cannot load a destroyed media loader.");if(this.#x===u.MediaState.LOADING)throw new Error("The media is already loading.");if(!this.#R)throw new Error("Cannot load media without a source.");this._detachEvents(),this._releaseFromCache(),this.#ft(),this.#yt(),this.#bt(),this._createProgress(0),this.#wt(u.MediaState.LOADING),this.emit("loadstart",{src:this.#R});try{return await this.#vt(this._startLoad()),this.#N=performance.now(),this.#ct=this.#Tt(),this.#wt(u.MediaState.LOADED),this.emit("loaded",this.#ct),this.#ct}catch(t){throw this.#N=performance.now(),this.#V?(this.#V=!1,this.#wt(u.MediaState.IDLE),this.emit("abort",{src:this.#R})):(this.#wt(u.MediaState.ERROR),this.#Et(t)),t}finally{this.emit("loadend",{src:this.#R,state:this.#x})}}async reload(){if(this.#x===u.MediaState.LOADING)throw new Error("Cannot reload while the media is loading.");if(this.#x===u.MediaState.DESTROYED)throw new Error("Cannot reload a destroyed media loader.");return this.#B?.reset(),this.#x=u.MediaState.IDLE,this.load()}abort(){return this.#x===u.MediaState.LOADING&&(this.#V=!0,this.#q&&this.#q.abort(),!0)}mount(t){if(!(t instanceof HTMLElement))throw new TypeError('The "container" argument must be an HTMLElement.');if(!this.#M)throw new Error("Cannot mount before the media element is created.");return t.appendChild(this.#M),this}destroy(){this.#x!==u.MediaState.DESTROYED&&(this.#x=u.MediaState.DESTROYED,this.#q&&this.#q.abort(),this._cleanup(),this._detachEvents(),this.#At(),null!==this.#G&&(clearTimeout(this.#G),this.#G=null),this.#yt(),this._releaseFromCache(),this.#rt.clear(),this.emit("destroy"),this.removeAllListeners(),this.#M=null)}_resolveElement(){return this.#M||(this.#M=this._createElement()),this.#mt(),this.#M}_setElement(t){if(!(t instanceof HTMLElement))throw new TypeError('The "element" argument must be an HTMLElement.');this.#M=t,this.#mt()}_setCacheHint(t){if("boolean"!=typeof t)throw new TypeError('The "value" argument must be a boolean.');this.#D=Boolean(t)}_setInternalSrc(t){if(null!==t&&"string"!=typeof t)throw new TypeError('The "url" argument must be a string or null.');this.#K=t,this.#St(),this._flushMutations(),this.emit("srctransition",{src:this.#R,internalSrc:t})}#St(){const t=this.#M;t&&this.#Y&&(this.#K?t.setAttribute("original-src",this.#R):t.removeAttribute("original-src"))}_waitForMedia(t,e="loadeddata"){if(!(t instanceof HTMLElement))throw new TypeError('The "element" argument must be an HTMLElement.');if("string"!=typeof e)throw new TypeError('The "readyEvent" argument must be a string.');if(!this.#q)throw new Error("Signal does not exist to wait for media.");const{signal:r}=this.#q;return new Promise((i,n)=>{const s=()=>{h(),i(void 0)},a=()=>{h(),n(new Error(`Failed to load media: ${this.#R}`))},o=()=>{h(),n(new DOMException("The media load was aborted.","AbortError"))},h=()=>{t.removeEventListener(e,s),t.removeEventListener("error",a),r.removeEventListener("abort",o)};t.addEventListener(e,s),t.addEventListener("error",a),r.addEventListener("abort",o,{once:!0})})}_cacheBlob(t){if(!(t instanceof Blob))throw new TypeError('The "blob" argument must be a Blob.');if(this._setResourceSize(t.size),this.#P){const e=this.#P.get(this.#R);if(e)return this.#P.acquire(this.#R),this.#$=!0,e.objectUrl;const r=this.#P.set(this.#R,t,!1,this.#ut);return this.#P.acquire(this.#R),this.#$=!0,this.emit("cachemiss",r),r.objectUrl}return this._createObjectUrl(t)}async _downloadStream(t,e,r=0,i=null){if("string"!=typeof t)throw new TypeError('The "url" argument must be a string.');if(!Number.isInteger(r)||r<0)throw new RangeError('The "startByte" argument must be a non-negative integer.');if(void 0!==e&&"function"!=typeof e)throw new TypeError('The "onChunk" argument must be a function or undefined.');const n=this.#pt(t),s=this.#it&&0===r,a=s?h.attach(n):null;if(a)return this.#Ut(a,t,e,r,i);const o=s?h.open(n,t):null;this.#at=o?(t,e)=>h.publish(n,t,e):null;try{const n=await this.#kt(t,e,r,i);return o?.resolve(n),n}catch(t){throw o?.reject(t),t}finally{this.#at=null,o&&h.close(n)}}async#kt(t,e,r=0,i=null){if("string"!=typeof t)throw new TypeError('The "url" argument must be a string.');const n=this.#ht.method?.toUpperCase(),s="GET"===n;let a="",o=0,h=!1;if(this.#j&&"GET"===n&&0===r)try{const e=await this.#ot(t,{...this.#ht,method:"HEAD",signal:i||this.signal.signal});if(this.#et=e,this.emit("headResponse",e),e.ok){a=e.headers.get("content-type")||"";const t=e.headers.get("content-length");t&&(o=Number(t));const r={};e.headers.forEach((t,e)=>{r[e]=t});const i={};a&&(i.type=a),o>0&&(i.size=o),Object.keys(r).length>0&&(i.httpHeaders=r),Object.keys(i).length>0&&this._emitMetadata(i,"HEAD"),h=!0}}catch(t){}const l=new Headers(this.#ht.headers);s&&r>0&&l.set("Range",`bytes=${r}-`);const u={...this.#ht,signal:i||this.signal.signal,headers:l};u.body||void 0===this.#lt||(u.body=this.#lt);const c=await this.#ot(t,u);if(this.#tt=c,this.emit("response",c),!c.ok){if(416===c.status)throw new Error("Requested range not satisfiable.");throw new Error(`Failed to fetch media: ${c.status} ${c.statusText}`)}if(!c.body)return new Blob([],{type:a||"application/octet-stream"});const f=c.headers.get("content-type")||a,m=Number(c.headers.get("content-length")||0);if(206===c.status){const t=c.headers.get("content-range");if(t){const e=t.match(/\/(\d+)$/);e&&(o=Number(e[1]))}}else o=m>0?m+r:o;const d={};c.headers.forEach((t,e)=>{d[e]=t});const g={};f&&f!==a&&(g.type=f,a=f),o>0&&(!h||206===c.status)&&(g.size=o),Object.keys(d).length>0&&(g.httpHeaders=d),Object.keys(g).length>0&&this._emitMetadata(g,"GET"),this.#Lt(a);const p=this._createProgress(o),y=c.body.getReader(),b=[];let w=r;try{for(;;){const{done:t,value:r}=await y.read();if(t)break;b.push(r),this.#X?.write(r),w+=r.byteLength,p.push(r.byteLength),this.emit("chunk",{chunk:r,loaded:w,total:o}),this._emitProgress(),e&&e(r,b)}}finally{this.#yt()}return new Blob(b,{type:a||"application/octet-stream"})}#pt(t){if(!this.#P?.ignoreSearch)return t;const e=t.split("#")[0],r=e.indexOf("?");return-1===r?e:e.slice(0,r)}async#Ut(t,e,r,i,n){const s=[],a=this._createProgress(0),o=h.history(t.key).length,l=h.subscribe(t.key,t=>{this.#_t(t,s,a,r)});let u;try{u=await t.promise}catch{return l&&l(),this.#kt(e,r,i,n)}return l&&l(),this.#nt=!0,this._setResourceSize(u.size),u.type&&this._emitMetadata({type:u.type},"MIRROR"),await this.#Ct(u),this.emit("mirror",{src:this.#R,key:t.key,size:u.size,mirrors:t.mirrors,replayed:o}),u}#_t(t,e,r,i){if("metadata"===t.name){const[e,r]=t.args;return void this._emitMetadata(e,r)}if("chunk"===t.name){const[n]=t.args,s=n.chunk;0===r.total&&n.total>0&&(r.total=n.total),e.push(s),r.push(n.chunk.byteLength),i&&i(s,e)}this.#Ot(t.name,t.args)}#Ot(t,e){this.#st=!0;try{Reflect.apply(this.emit,this,[t,...e])}finally{this.#st=!1}}async#Ct(t){this.#Lt(t.type),this.#X&&(this.#X.write(new Uint8Array(await t.arrayBuffer())),this.#yt())}#Lt(t){if(!this.#Q)return;const e=t.split(";")[0].trim().toLowerCase();this.#rt.forEach((t,r)=>{!this.#X&&e.startsWith(`${r}/`)&&(this.#X=t(e))})}#yt(){if(this.#X){if("function"==typeof this.#X.finalize){const t=this.#X.finalize();t&&this._emitMetadata(t,"DECODE")}this.#X.close(),this.#X=null}}_acquireFromCache(){if(!this.#P)return null;const t=this.#P.acquire(this.#R);return t&&(this.#$=!0,this._setCacheHint(!0),this._setResourceSize(t.size),t.type&&this._emitMetadata({type:t.type},"CACHE"),t.metadata&&this._emitMetadata(t.metadata,"CACHE")),t}_releaseFromCache(){this.#P&&this.#$&&(this.#P.release(this.#R),this.#$=!1)}_getLoadTime(){return this.#N-this.#i}_detectCache(){if("undefined"==typeof performance||"function"!=typeof performance.getEntriesByName)return!1;const t=performance.getEntriesByName(this.#R);if(0===t.length)return!1;const e=t[t.length-1];return 0===e.transferSize&&e.decodedBodySize>0}_setResourceSize(t){if("number"!=typeof t||Number.isNaN(t)||t<0)throw new RangeError('The "size" argument must be a positive number.');this.#J=t}_getResourceSize(){if(this.#J>0)return this.#J;if("undefined"==typeof performance||"function"!=typeof performance.getEntriesByName)return 0;const t=performance.getEntriesByName(this.#R);if(0===t.length)return 0;const e=t[t.length-1];return e.decodedBodySize||e.transferSize||0}_flushMutations(){this.#F&&this.#F.takeRecords()}_createObjectUrl(t){if(!(t instanceof Blob))throw new TypeError('The "blob" argument must be a Blob.');return this._revokeObjectUrl(),this.#W=URL.createObjectURL(t),this.#W}_revokeObjectUrl(){this.#W&&(URL.revokeObjectURL(this.#W),this.#W=null)}#bt(){this.#q=new AbortController,this.#q.signal.addEventListener("abort",()=>this._abort(),{once:!0})}#Rt(){return{src:this.#R,type:"",width:0,height:0,duration:0,size:0,fromCache:!1,loadTime:0,timestamp:0,animation:null,httpHeaders:{}}}#ft(){this.#V=!1,this.#K=null,this.#J=0,this.#D=!1,this.#nt=!1,this.#st=!1,this.#at=null,this.#ut={},this.#i=performance.now(),this.#N=0,this.#ct=this.#Rt()}#wt(t){if(this.#x===t)return;const e=this.#x;this.#x=t,this.emit("statechange",{state:t,previous:e,src:this.#R})}#Et(t){this.listenerCount("error")>0&&this.emit("error",t)}#gt(t){if(t===this.#R)return!1;const e=this.#R;return this.#R=t,this.#ct.src=t,this.emit("srcchange",{src:t,previousSrc:e}),!0}#mt(){!this.#F&&"undefined"!=typeof MutationObserver&&this.#M&&(this.#F=new MutationObserver(t=>this.#xt(t)),this.#F.observe(this.#M,{attributes:!0,attributeFilter:this.#Y?["src","original-src"]:["src"]}))}#At(){this.#F&&(this.#F.disconnect(),this.#F=null)}#xt(t){const e=this.#M;if(!e)return;let r=null;for(const{attributeName:i}of t)"original-src"===i?r=e.getAttribute("original-src")??"":"src"===i&&null===r&&(r=e.getAttribute("src")??"");null!==r&&r!==this.#R&&r!==this.#K&&(this.#gt(r),this.#z&&this.reload().catch(t=>{this.listenerCount("error")>0&&this.emit("error",t)}))}#Tt(){return{src:this.#R,fromCache:this.#D||this._detectCache(),loadTime:this.#N-this.#i,timestamp:Date.now(),animation:null,...this._getMetadataDetails(),...this.#ut}}#vt(t){return this.#I<=0?t:new Promise((e,r)=>{this.#G=setTimeout(()=>{this.#G=null,this.#q&&this.#q.abort(),this.emit("timeout",{src:this.#R,timeout:this.#I}),r(new Error(`Media load timed out after ${this.#I}ms.`))},this.#I),t.then(t=>{null!==this.#G&&clearTimeout(this.#G),this.#G=null,e(t)},t=>{null!==this.#G&&clearTimeout(this.#G),this.#G=null,r(t)})})}_createElement(){throw new Error('The "_createElement" method must be implemented by a subclass.')}_startLoad(){throw new Error('The "_startLoad" method must be implemented by a subclass.')}_getMetadataDetails(){return{type:"",width:0,height:0,duration:0,size:0}}_abort(){this._revokeObjectUrl();const t=this.#M;if(!t)return;const e=t;"function"==typeof e.pause&&e.pause(),t.removeAttribute("src"),"function"==typeof e.load&&e.load(),this._setInternalSrc(null)}_cleanup(){}}const c=u;class f extends Error{constructor(t="The buffer does not hold enough bytes to satisfy the read."){super(t),this.name="TinyNeedMoreData"}}class m{#Mt;#It;#Nt;#jt;constructor(t,e=0,r=t.length){if(!(t instanceof Uint8Array))throw new TypeError('The "bytes" argument must be a Uint8Array.');if(!Number.isInteger(e)||e<0||e>t.length)throw new RangeError('The "offset" argument is out of bounds.');if(!Number.isInteger(r)||r<e||r>t.length)throw new RangeError('The "limit" argument is out of bounds.');this.#Mt=t,this.#It=new DataView(t.buffer,t.byteOffset,t.byteLength),this.#Nt=e,this.#jt=r}get offset(){return this.#Nt}get limit(){return this.#jt}get remaining(){return this.#jt-this.#Nt}get eof(){return this.#Nt>=this.#jt}get buffer(){return this.#Mt}has(t){if(!Number.isInteger(t))throw new TypeError('The "count" argument must be an integer.');return t>=0&&this.#Nt+t<=this.#jt}#Dt(t){if(!Number.isInteger(t))throw new TypeError('The "count" argument must be an integer.');if(t<0)throw new RangeError('The "count" argument must be a non-negative integer.');if(!this.has(t))throw new f}seek(t){if(!Number.isInteger(t)||t<0)throw new RangeError('The "position" argument must be a positive integer.');return this.#Nt=t,this}skip(t){if(!Number.isInteger(t)||t<0)throw new RangeError('The "count" argument must be a non-negative integer.');return this.#Dt(t),this.#Nt+=t,this}uint8(){return this.#Dt(1),this.#It.getUint8(this.#Nt++)}uint16(){this.#Dt(2);const t=this.#It.getUint16(this.#Nt);return this.#Nt+=2,t}uint16le(){this.#Dt(2);const t=this.#It.getUint16(this.#Nt,!0);return this.#Nt+=2,t}uint24(){this.#Dt(3);const t=this.#Mt[this.#Nt]<<16|this.#Mt[this.#Nt+1]<<8|this.#Mt[this.#Nt+2];return this.#Nt+=3,t}uint32(){this.#Dt(4);const t=this.#It.getUint32(this.#Nt);return this.#Nt+=4,t}uint32le(){this.#Dt(4);const t=this.#It.getUint32(this.#Nt,!0);return this.#Nt+=4,t}int32le(){this.#Dt(4);const t=this.#It.getInt32(this.#Nt,!0);return this.#Nt+=4,t}uint64(){return 4294967296*this.uint32()+this.uint32()}ascii(t){if(!Number.isInteger(t)||t<0)throw new RangeError('The "length" argument must be a non-negative integer.');this.#Dt(t);let e="";for(let r=0;r<t;r+=1)e+=String.fromCharCode(this.#Mt[this.#Nt+r]);return this.#Nt+=t,e}bytes(t){if(!Number.isInteger(t)||t<0)throw new RangeError('The "length" argument must be a non-negative integer.');this.#Dt(t);const e=this.#Mt.subarray(this.#Nt,this.#Nt+t);return this.#Nt+=t,e}}const d=new Set(["moov","trak","mdia","minf","stbl","edts","dinf","udta","mvex","moof","traf","iprp","ipco","mfra","skip","jxl "]),g=new Set(["meta"]);function p(t,e){const r=t.offset,i=t.uint32(),n=t.ascii(4);let s=8,a=i;if(1===i?(a=t.uint64(),s=16):0===i&&(a=e-r),a<s||r+a>e)throw new f;return{type:n,start:r,dataStart:r+s,dataEnd:r+a,end:r+a}}function y(t,e,r,i,n=0){if(n>8)return null;for(const s of function*(t,e,r){let i=e;for(;i+8<=r;){t.seek(i);const e=p(t,r);yield e,i=e.end}}(t,e,r)){if(i.has(s.type))return s;if(d.has(s.type)||g.has(s.type)){const e=g.has(s.type)?4:0,r=y(t,s.dataStart+e,s.dataEnd,i,n+1);if(r)return r}}return null}function b(t,e,r=0){return!(t.length<r+e.length)&&e.every((e,i)=>t[r+i]===e)}function w(t){return t.seek(6),{width:t.uint8()||256,height:t.uint8()||256}}function v(t,e){let r=e;for(;r<t.length;){const e=t[r];if(void 0===e)break;if(r+=1,0===e)return r;r+=e}return r}const T=Object.freeze([{name:"png",mime:"image/png",sniff:t=>b(t,[137,80,78,71,13,10,26,10]),parse:function(t){return t.seek(16),{width:t.uint32(),height:t.uint32()}}},{name:"jpeg",mime:"image/jpeg",sniff:t=>b(t,[255,216,255]),parse:function(t){const e=t.limit;for(t.seek(2);t.offset+4<=e;){if(255!==t.uint8())continue;let r=t.uint8();for(;255===r&&t.offset<e;)r=t.uint8();if(1===r||r>=208&&r<=217)continue;if(218===r)return null;const i=t.uint16();if(r>=192&&r<=207&&196!==r&&200!==r&&204!==r){t.skip(1);const e=t.uint16(),r=t.uint16();return r>0&&e>0?{width:r,height:e}:null}t.skip(i-2)}return null}},{name:"gif",mime:"image/gif",sniff:t=>b(t,[71,73,70,56]),parse:function(t){t.seek(6);const e=t.uint16le(),r=t.uint16le();return e>0&&r>0?{width:e,height:r}:null}},{name:"bmp",mime:"image/bmp",sniff:t=>b(t,[66,77]),parse:function(t){t.seek(18);const e=t.int32le(),r=Math.abs(t.int32le());return e>0&&r>0?{width:e,height:r}:null}},{name:"webp",mime:"image/webp",sniff:t=>b(t,[82,73,70,70])&&b(t,[87,69,66,80],8),parse:function(t){t.seek(12);const e=t.ascii(4);if("VP8 "===e)return t.seek(26),{width:16383&t.uint16le(),height:16383&t.uint16le()};if("VP8L"===e){t.seek(21);const e=t.uint32le();return{width:1+(16383&e),height:1+(e>>14&16383)}}return"VP8X"===e?(t.seek(24),{width:1+(t.uint8()|t.uint8()<<8|t.uint8()<<16),height:1+(t.uint8()|t.uint8()<<8|t.uint8()<<16)}):null}},{name:"avif",mime:"image/avif",sniff:t=>b(t,[102,116,121,112],4),parse:function(t){const e=y(t,0,t.limit,new Set(["ispe"]));if(!e)return null;t.seek(e.dataStart+4);const r=t.uint32(),i=t.uint32();return r>0&&i>0?{width:r,height:i}:null}},{name:"ico",mime:"image/x-icon",sniff:t=>b(t,[0,0,1,0]),parse:w},{name:"cur",mime:"image/x-icon",sniff:t=>b(t,[0,0,2,0]),parse:w},{name:"svg",mime:"image/svg+xml",sniff:t=>{const e=new TextDecoder("utf-8").decode(t.subarray(0,256)).trimStart();return e.startsWith("<svg")||e.startsWith("<?xml")||e.startsWith("<!DOCTYPE svg")},parse:function(t){const e=Math.min(t.limit,8192);t.seek(0);const r=new TextDecoder("utf-8").decode(t.bytes(e)),i=r.match(/<svg\b[^>]*>/i);if(!i){if(r.includes("<svg"))throw new f;return null}const n=i[0],s=t=>{const e=n.match(new RegExp(`${t}\\s*=\\s*["']([^"']+)["']`,"i"));return e?Math.round(Number.parseFloat(e[1])):0},a=s("width"),o=s("height");if(a>0&&o>0)return{width:a,height:o};const h=n.match(/viewBox\s*=\s*["']([^"']+)["']/i);if(h){const t=h[1].trim().split(/[\s,]+/).map(Number);if(4===t.length&&t[2]>0&&t[3]>0)return{width:Math.round(t[2]),height:Math.round(t[3])}}return null}}]),E=class{#zt=new Uint8Array(0);#Ft=null;#Bt=!1;#qt=!1;#m;#Ht=!1;#Pt=0;#$t=0;#Vt=0;finalize(){if(!this.#Ht||!this.#Ft||!this.#Bt)return null;const t=this.#Kt();return this.#zt=new Uint8Array(0),t?{animation:t}:null}constructor(t="",e=65536){if("number"!=typeof e||Number.isNaN(e)||e<1)throw new RangeError('The "maxBytes" argument must be a positive number.');this.#m=e}#Kt(){const t=this.#Ft?.name;return"gif"===t?function(t){if(t.length<13)return null;let e=13;const r=t[10];128&r&&(e+=3*(1<<1+(7&r)));let i=0,n=1,s=!1,a=0,o=100;for(;e<t.length;){const r=t[e];if(59===r)break;if(33===r){const r=t[e+1];if(255===r&&11===t[e+2])b(t,[78,69,84,83,67,65,80,69,50,46,48],e+3)&&3===t[e+14]&&1===t[e+15]&&(n=t[e+16]|t[e+17]<<8,s=!0);else if(249===r&&4===t[e+2]){let r=t[e+4]|t[e+5]<<8;r<=1&&(r=10),o=10*r}e=v(t,e+2)}else{if(44!==r)break;{i+=1,a+=o,o=100;const r=t[e+9];e+=10,128&r&&(e+=3*(1<<1+(7&r))),e+=1,e=v(t,e)}}if(!e||isNaN(e))break}return i<=1?null:{frames:i,loopCount:s?n:1,duration:a}}(this.#zt):"webp"===t?function(t){let e=12,r=0,i=1,n=0,s=!1;for(;e+8<=t.length;){const a=new DataView(t.buffer,t.byteOffset+e,8),o=String.fromCharCode(t[e],t[e+1],t[e+2],t[e+3]),h=a.getUint32(4,!0),l=e+8;"ANIM"===o&&l+6<=t.length?(s=!0,i=t[l+4]|t[l+5]<<8):"ANMF"===o&&l+15<=t.length&&(r+=1,n+=t[l+12]|t[l+13]<<8|t[l+14]<<16),e+=8+h+h%2}return!s||r<=1?null:{frames:r,loopCount:i,duration:n}}(this.#zt):"png"===t?function(t){let e=8,r=0,i=1,n=0,s=!1;for(;e+8<=t.length;){const a=new DataView(t.buffer,t.byteOffset+e,8).getUint32(0),o=String.fromCharCode(t[e+4],t[e+5],t[e+6],t[e+7]),h=e+8;if("acTL"===o&&h+8<=t.length){s=!0;const e=new DataView(t.buffer,t.byteOffset+h,8);r=e.getUint32(0),i=e.getUint32(4)}else if("fcTL"===o&&h+26<=t.length){const e=new DataView(t.buffer,t.byteOffset+h,26),r=e.getUint16(20),i=e.getUint16(22)||100;n+=Math.round(r/i*1e3)}else if("IEND"===o)break;e+=12+a}return!s||r<=1?null:{frames:r,loopCount:i,duration:n}}(this.#zt):"avif"===t?function(t){const e=new m(t),r=y(e,0,e.limit,new Set(["moov"]));if(!r)return null;const i=y(e,r.dataStart,r.dataEnd,new Set(["mvhd"]));let n=0;if(i){e.seek(i.dataStart);const t=e.uint8();let r,s;if(e.skip(3),1===t){e.skip(16),r=e.uint32();const t=e.bytes(8);s=t[4]<<24|t[5]<<16|t[6]<<8|t[7]}else e.skip(8),r=e.uint32(),s=e.uint32();r>0&&(n=Math.round(s/r*1e3))}const s=y(e,r.dataStart,r.dataEnd,new Set(["trak"]));if(!s)return null;const a=y(e,s.dataStart,s.dataEnd,new Set(["mdia"]));if(!a)return null;const o=y(e,a.dataStart,a.dataEnd,new Set(["minf"]));if(!o)return null;const h=y(e,o.dataStart,o.dataEnd,new Set(["stbl"]));if(!h)return null;const l=y(e,h.dataStart,h.dataEnd,new Set(["stsz"]));let u=0;return l&&(e.seek(l.dataStart+4),e.uint32(),u=e.uint32()),u<=1?null:{frames:u,loopCount:0,duration:n}}(this.#zt):null}push(t){if(!(t instanceof Uint8Array))throw new TypeError('The "chunk" argument must be a Uint8Array.');if(this.#qt)return null;if(this.#Bt&&!this.#Ht)return null;const e=new Uint8Array(this.#zt.length+t.length);if(e.set(this.#zt),e.set(t,this.#zt.length),this.#zt=e,!this.#Ft){if(this.#Ft=this.#Gt(),!this.#Ft)return this.#zt.length>512&&(this.#qt=!0),null;this.#Ht=["gif","webp","png","avif"].includes(this.#Ft.name)}if(this.#Bt&&this.#Ht){const t=this.#Kt();return t&&t.frames>this.#Vt?(this.#Vt=t.frames,{width:this.#Pt,height:this.#$t,animation:t}):null}try{const t=this.#Ft.parse(new m(this.#zt));if(t){if(this.#Bt=!0,this.#Pt=t.width,this.#$t=t.height,this.#Ht){const e=this.#Kt();e&&(t.animation=e,this.#Vt=e.frames)}else this.#zt=new Uint8Array(0);return t}}catch(t){if(!(t instanceof f))throw t}return this.#zt.length>this.#m&&!this.#Bt&&(this.#qt=!0,this.#zt=new Uint8Array(0)),null}close(){this.#zt=new Uint8Array(0),this.#qt=!0}#Gt(){for(const t of T)try{if(t.sniff(this.#zt))return t}catch{return null}return null}},A="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=";function S(t,e,r){const i=new DataView(t.buffer,t.byteOffset,t.byteLength),n=[];let s=e;for(;s+8<=r;){let e=i.getUint32(s);const a=String.fromCharCode(t[s+4],t[s+5],t[s+6],t[s+7]);let o=8;if(1===e){if(s+16>r)break;e=4294967296*i.getUint32(s+8)+i.getUint32(s+12),o=16}else 0===e&&(e=r-s);if(e<o||s+e>r)break;n.push({type:a,start:s,dataStart:s+o,dataEnd:s+e,end:s+e}),s+=e}return n}function U(t){let e=0;for(const r of t)e+=r.length;const r=new Uint8Array(e);let i=0;for(const e of t)r.set(e,i),i+=e.length;return r}function k(t){const e=new Uint8Array(t.length);for(let r=0;r<t.length;r+=1)e[r]=t.charCodeAt(r);return e}function L(t){return new Uint8Array([t>>8&255,255&t])}function _(t){return new Uint8Array([t>>>24&255,t>>>16&255,t>>>8&255,255&t])}function C(t,...e){const r=U(e),i=new Uint8Array(8+r.length);return i.set(_(i.length),0),i.set(k(t),4),i.set(r,8),i}function O(t,e,r,i){const n=C("ftyp",k("avif"),_(0),k("avif"),k("mif1"),k("miaf")),s=n=>{const s=C("hdlr",_(0),_(0),k("pict"),_(0),_(0),_(0),new Uint8Array([0])),a=C("pitm",_(0),L(1)),o=C("iloc",_(0),new Uint8Array([68,0]),L(1),L(1),L(0),L(1),_(n),_(i.length)),h=C("infe",_(33554432),L(1),L(0),k("av01"),new Uint8Array([0])),l=C("iinf",_(0),L(1),h),u=C("ispe",_(0),_(e),_(r)),c=C("ipco",t,u),f=C("ipma",_(0),_(1),L(1),new Uint8Array([2,129,2])),m=C("iprp",c,f);return C("meta",_(0),s,a,o,l,m)},a=s(0);return U([n,s(n.length+a.length+8),C("mdat",i)])}const R=class extends c{static get tagName(){return"IMG"}#Wt;#Yt;#Jt;#Qt;#Xt;#Zt=[];#te=[];#ee=!1;#re=!0;#ie=1;#ne=0;#se=null;#ae=null;#oe=null;constructor(t={}){if(null===t||"object"!=typeof t)throw new TypeError('The "options" argument must be an object.');if(null!==t.element&&void 0!==t.element&&!(t.element instanceof HTMLImageElement))throw new TypeError('The "element" option must be an HTMLImageElement or null.');super({useHeadRequest:!1,...t}),t.cache||(this.#oe=new a({strategy:a.Strategy.MANUAL}));const e=["none","native","script-only","controlled"],r=["sync","async","auto"],{crossOrigin:i=null,decoding:n="async",stream:s=!1,animationControl:o="none"}=t;if(!e.includes(o))throw new RangeError(`The "animationControl" option must be one of: ${e.join(", ")}.`);if(!r.includes(n))throw new RangeError(`The "decoding" option must be one of: ${r.join(", ")}.`);if(![null,"anonymous","use-credentials"].includes(i))throw new RangeError('The "crossOrigin" option must be "anonymous", "use-credentials" or null.');this.#Yt=i,this.#Jt=n,this.#Wt=null,this.#Xt=o,this.#Qt="none"!==this.#Xt||Boolean(s),this._insertDecoder("image",t=>{const e=new E(t);return{write:t=>{const r=e.push(t);r&&this._emitMetadata(r,"PROBE")},close:()=>{const t=e.finalize();t&&this._emitMetadata(t,"PROBE_ANIMATION"),e.close()}}})}get image(){return this.#Wt}get stream(){return this.#Qt}get naturalWidth(){return this.#Wt?.naturalWidth??0}get naturalHeight(){return this.#Wt?.naturalHeight??0}get aspectRatio(){const t=this.naturalHeight;return 0===t?0:this.naturalWidth/t}freeze(t=null){if(null!==t&&(!Number.isInteger(t)||t<0))throw new RangeError('The "frameIndex" argument must be a non-negative integer or null.');if("none"!==this.#Xt&&"script-only"!==this.#Xt)if(this.#ee=!0,"native"===this.#Xt&&this.#Zt.length>0){const t=this.#Zt[0].url;this.#Wt&&(this._setInternalSrc(t),this.#Wt.src=t)}else if("controlled"===this.#Xt&&(this.pause(),null!==t&&t>=0&&t<this.#Zt.length&&(this.#ne=t),this.#Wt&&this.#Zt[this.#ne])){const t=this.#Zt[this.#ne].url;this._setInternalSrc(t),this.#Wt.src=t}}unfreeze(){"none"!==this.#Xt&&"script-only"!==this.#Xt&&(this.#ee=!1,"native"===this.#Xt?this.#Wt&&this.#ae&&(this._setInternalSrc(this.#ae),this.#Wt.src=this.#ae):"controlled"===this.#Xt&&this.play())}play(){"controlled"===this.#Xt&&(this.#se||(this.#re=!0,this.#ee=!1,this.#he()))}pause(){"controlled"===this.#Xt&&(this.#re=!1,this.#se&&(clearTimeout(this.#se),this.#se=null))}get playbackRate(){return this.#ie}set playbackRate(t){"controlled"===this.#Xt&&(this.#ie=Math.max(.1,Number(t)||1))}get animationScript(){return JSON.parse(JSON.stringify(this.#te))}set animationScript(t){if("controlled"!==this.#Xt)throw new Error("Animation script editing is only available in controlled mode.");if(!Array.isArray(t))throw new TypeError('The "script" value must be an array.');this.#te=Array.isArray(t)?t:[]}async _startLoad(){this._releaseAnimationFrames();const t=this._resolveElement();let e;if(this.#Wt=t,this.#Yt&&(t.crossOrigin=this.#Yt),t.decoding=this.#Jt,t.removeAttribute("src"),this._flushMutations(),this.#Qt?e=await this.#le(t):(e=this._waitForMedia(t,"load"),t.src=this.src,this._flushMutations()),await e,"function"==typeof t.decode)try{await t.decode()}catch{}}#ue(t){if(!Number.isInteger(t)||t<0)throw new RangeError('The "index" argument must be a non-negative integer.');return`${this.src}:::frame=${t}`}#ce(t){if(!Number.isInteger(t)||t<0)throw new RangeError('The "index" argument must be a non-negative integer.');const e=this.cache??this.#oe;if(!e)throw new Error("No cache is available to store animation frames.");const r=e.get(this.#ue(t));return r?(e.acquire(this.#ue(t)),r.objectUrl):null}#fe(t,e){if(!Number.isInteger(t)||t<0)throw new RangeError('The "index" argument must be a non-negative integer.');if(!(e instanceof Blob))throw new TypeError('The "blob" argument must be a Blob.');const r=this.cache??this.#oe;if(!r)throw new Error("No cache is available to store animation frames.");const i=this.#ue(t),n=r.set(i,e,!1,{},this.src);return r.acquire(i),n.objectUrl}async#le(t){if(!(t instanceof HTMLImageElement))throw new TypeError('The "image" argument must be an HTMLImageElement.');const e=this._acquireFromCache();if(e){if(this.emit("cachehit",e),this._setInternalSrc(e.objectUrl),this.#ae=e.objectUrl,"none"!==this.#Xt&&e.metadata?.animation&&0===this.#Zt.length&&await this.#me(await e.blob.arrayBuffer()),"controlled"===this.#Xt)return this.#ae=null,this.play(),Promise.resolve();const r=this._waitForMedia(t,"load");return t.src=e.objectUrl,this._flushMutations(),r}let r=performance.now(),i=null;try{const e=await this._downloadStream(this.src,(e,n)=>{if(this.progressive&&"controlled"!==this.#Xt){const e=performance.now();if(e-r>500){r=e;const s=new Blob(n,{type:this.metadata.type||"image/jpeg"}),a=URL.createObjectURL(s);i&&URL.revokeObjectURL(i),i=a,this._setInternalSrc(a),t.src=a,this._flushMutations()}}});"none"!==this.#Xt&&this.metadata.animation&&await this.#me(await e.arrayBuffer());const n=this.mirrored?this.#de(e):this._cacheBlob(e);if(this._setInternalSrc(n),"controlled"===this.#Xt)return this.#ae=null,this.play(),Promise.resolve();this.#ae=n;const s=this._waitForMedia(t,"load");return t.src=n,this._flushMutations(),s}finally{i&&URL.revokeObjectURL(i)}}async#me(t){if(!(t instanceof ArrayBuffer))throw new TypeError('The "arrayBuffer" argument must be an ArrayBuffer.');const e=new Uint8Array(t);e.length<12||(71===e[0]&&73===e[1]&&70===e[2]?this.#ge(e):82===e[0]&&73===e[1]&&70===e[2]&&70===e[3]&&87===e[8]&&69===e[9]&&66===e[10]&&80===e[11]?this.#pe(e):137===e[0]&&80===e[1]&&78===e[2]&&71===e[3]?this.#ye(e):102===e[4]&&116===e[5]&&121===e[6]&&112===e[7]&&this.#be(e))}#we(t){if(!(t instanceof Uint8Array))throw new TypeError('The "bytes" argument must be a Uint8Array.');let e=4294967295;for(let r=0;r<t.length;r++){e^=t[r];for(let t=0;t<8;t++)e=1&e?3988292384^e>>>1:e>>>1}return(4294967295^e)>>>0}#be(t){if(!(t instanceof Uint8Array))throw new TypeError('The "bytes" argument must be a Uint8Array.');const e=S(t,0,t.length).find(t=>"moov"===t.type);if(!e)return;const r=new DataView(t.buffer,t.byteOffset,t.byteLength),i=S(t,e.dataStart,e.dataEnd).filter(t=>"trak"===t.type);let n=null;for(const e of i){const i=S(t,e.dataStart,e.dataEnd).find(t=>"mdia"===t.type);if(!i)continue;const s=S(t,i.dataStart,i.dataEnd).find(t=>"minf"===t.type);if(!s)continue;const a=S(t,s.dataStart,s.dataEnd).find(t=>"stbl"===t.type);if(!a)continue;const o=S(t,i.dataStart,i.dataEnd).find(t=>"mdhd"===t.type);let h=1e3;o&&(h=1===t[o.dataStart]?r.getUint32(o.dataStart+20):r.getUint32(o.dataStart+12)),n={stbl:a,timescale:h};break}if(!n)return;const s=S(t,n.stbl.dataStart,n.stbl.dataEnd),a=s.find(t=>"stsz"===t.type),o=s.find(t=>"stco"===t.type),h=s.find(t=>"co64"===t.type),l=s.find(t=>"stsc"===t.type),u=s.find(t=>"stts"===t.type),c=s.find(t=>"stsd"===t.type);if(!a||!l||!c)return;const f=[];{const t=a.dataStart+4,e=r.getUint32(t),i=r.getUint32(t+4);for(let n=0;n<i;n+=1)f.push(e>0?e:r.getUint32(t+8+4*n))}const m=[];if(o){const t=r.getUint32(o.dataStart+4);for(let e=0;e<t;e+=1)m.push(r.getUint32(o.dataStart+8+4*e))}else if(h){const t=r.getUint32(h.dataStart+4);for(let e=0;e<t;e+=1){const t=r.getUint32(h.dataStart+8+8*e),i=r.getUint32(h.dataStart+12+8*e);m.push(4294967296*t+i)}}const d=[];{const t=r.getUint32(l.dataStart+4);for(let e=0;e<t;e+=1){const t=l.dataStart+8+12*e;d.push({firstChunk:r.getUint32(t),samplesPerChunk:r.getUint32(t+4)})}}const g=[];if(u){const t=r.getUint32(u.dataStart+4);for(let e=0;e<t;e+=1){const t=u.dataStart+8+8*e,i=r.getUint32(t),n=r.getUint32(t+4);for(let t=0;t<i;t+=1)g.push(n)}}const p=[];{let t=0;for(let e=0;e<d.length;e+=1){const{firstChunk:r,samplesPerChunk:i}=d[e],n=e+1<d.length?d[e+1].firstChunk-1:m.length;for(let e=r;e<=n;e+=1){let r=m[e-1]??0;for(let e=0;e<i;e+=1)p.push(r),r+=f[t]??0,t+=1}}}const y=S(t,c.dataStart+8,c.dataEnd)[0];if(!y)return;const b=r.getUint16(y.dataStart+24),w=r.getUint16(y.dataStart+26),v=S(t,y.dataStart+78,y.dataEnd).find(t=>"av1C"===t.type);if(!v)return;const T=t.subarray(v.start,v.end),E=Math.min(f.length,p.length);for(let e=0;e<E;e+=1){const r=f[e],i=p[e],s=g[e]??0;let a=n.timescale>0?Math.round(s/n.timescale*1e3):100;if(a<=10&&(a=100),this.#te.push({delay:a}),"script-only"!==this.#Xt){let n=this.#ce(e);if(!n){const s=O(T,b,w,t.subarray(i,i+r)),a=new Blob([s],{type:"image/avif"});n=this.#fe(e,a)}this.#Zt.push({url:n,cacheKey:this.#ue(e)})}if("native"===this.#Xt)break}}#pe(t){if(!(t instanceof Uint8Array))throw new TypeError('The "bytes" argument must be a Uint8Array.');if(t.length<12)return;let e=12,r=null,i=null;const n=[],s=[];for(;e+8<=t.length;){const a=new DataView(t.buffer,t.byteOffset+e,8),o=String.fromCharCode(t[e],t[e+1],t[e+2],t[e+3]),h=a.getUint32(4,!0),l=e+8+h+h%2;if(l>t.length)break;const u=t.subarray(e,l);if("VP8X"===o)r=u;else if("ANIM"===o)i=u;else if("ANMF"===o){const r=e+8,i=t[r+12]|t[r+13]<<8|t[r+14]<<16;s.push({chunk:u,delay:i})}else s.length||"VP8 "===o||"VP8L"===o||n.push(u);e=l}if(0!==s.length)for(let t=0;t<s.length;t++){const e=s[t];let a=e.delay;if(a<=10&&(a=100),this.#te.push({delay:a}),"script-only"!==this.#Xt){let s=this.#ce(t);if(!s){const a=[];r&&a.push(r),i&&a.push(i);for(const t of n)a.push(t);a.push(e.chunk);let o=4;for(const t of a)o+=t.length;const h=new Uint8Array(12),l=new DataView(h.buffer);h.set([82,73,70,70],0),l.setUint32(4,o,!0),h.set([87,69,66,80],8);const u=new Blob([h,...a],{type:"image/webp"});s=this.#fe(t,u)}this.#Zt.push({url:s,cacheKey:this.#ue(t)})}if("native"===this.#Xt)break}}#ye(t){if(!(t instanceof Uint8Array))throw new TypeError('The "bytes" argument must be a Uint8Array.');const e=[137,80,78,71,13,10,26,10],r=new Uint8Array([0,0,0,0,73,69,78,68,174,66,96,130]);if(t.length<8)return;const i=[],n=[];let s=null,a=0,o=0,h=8,l=!1,u=null;for(;h+8<=t.length;){const e=new DataView(t.buffer,t.byteOffset+h,8).getUint32(0),r=String.fromCharCode(t[h+4],t[h+5],t[h+6],t[h+7]),c=h+12+e;if(c>t.length)break;const f=t.subarray(h,c);if("IHDR"===r){const t=new DataView(f.buffer,f.byteOffset,f.byteLength);a=t.getUint32(8),o=t.getUint32(12),n.push(f)}else if("acTL"===r);else if("fcTL"===r){if(l=!0,u&&i.push(u),u=null,e>=26){const e=new DataView(t.buffer,t.byteOffset+h+8,26),r=e.getUint16(20),i=e.getUint16(22)||100;u={delay:0===i?100:Math.round(r/i*1e3),dataChunks:[],width:e.getUint32(4),height:e.getUint32(8),x:e.getUint32(12),y:e.getUint32(16),disposeOp:e.getUint8(24),blendOp:e.getUint8(25)}}}else if("IDAT"===r)l=!0,u&&u.dataChunks.push({type:"IDAT",bytes:f});else if("fdAT"===r)l=!0,u&&u.dataChunks.push({type:"fdAT",bytes:f});else{if("IEND"===r){s=f;break}l||n.push(f)}h=c}if(u&&i.push(u),0===i.length)return;const c=t=>{const i=n.map(e=>{if("IHDR"!==String.fromCharCode(e[4],e[5],e[6],e[7]))return e;const r=new Uint8Array(e),i=new DataView(r.buffer,r.byteOffset,r.byteLength);return i.setUint32(8,t.width),i.setUint32(12,t.height),i.setUint32(r.length-4,this.#we(r.subarray(4,r.length-4))),r}),a=[new Uint8Array(e),...i];for(const e of t.dataChunks)if("IDAT"===e.type)a.push(e.bytes);else if("fdAT"===e.type){const t=new Uint8Array(e.bytes.length-4),r=new DataView(t.buffer);r.setUint32(0,e.bytes.length-16),t.set([73,68,65,84],4),t.set(e.bytes.subarray(12,e.bytes.length-4),8),r.setUint32(t.length-4,this.#we(t.subarray(4,t.length-4))),a.push(t)}a.push(s??r);let o=0;for(const t of a)o+=t.length;const h=new Uint8Array(o);let l=0;for(const t of a)h.set(t,l),l+=t.length;let u="";for(let t=0;t<h.length;t+=1)u+=String.fromCharCode(h[t]);return btoa(u)},f=new Map,m=t=>{let e=f.get(t);return void 0===e&&(e=c(i[t]),f.set(t,e)),e},d=a||1,g=o||1,p=[];let y=0;const b=(t,e,r,i,n)=>{if(""===t)return"";if(i>=d&&n>=g)return"";if(i<=0||n<=0)return t;const s=`apng-mask-${y}`;return y+=1,p.push(`<mask id="${s}" maskUnits="userSpaceOnUse" x="0" y="0" width="${d}" height="${g}"><rect x="0" y="0" width="${d}" height="${g}" fill="#fff"/><rect x="${e}" y="${r}" width="${i}" height="${n}" fill="#000"/></mask>`),`<g mask="url(#${s})">${t}</g>`};let w="";for(let t=0;t<i.length;t+=1){const e=i[t],r=w,n=`<image href="data:image/png;base64,${m(t)}" x="${e.x}" y="${e.y}" width="${e.width}" height="${e.height}"/>`,s=0===e.blendOp?b(w,e.x,e.y,e.width,e.height)+n:w+n;let a=e.delay;if(a<=10&&(a=100),this.#te.push({delay:a}),"script-only"!==this.#Xt){let e=this.#ce(t);if(!e){const r=`<svg xmlns="http://www.w3.org/2000/svg" width="${d}" height="${g}" viewBox="0 0 ${d} ${g}">`+(p.length>0?`<defs>${p.join("")}</defs>`:"")+s+"</svg>";e=this.#fe(t,new Blob([r],{type:"image/svg+xml"}))}this.#Zt.push({url:e,cacheKey:this.#ue(t)})}if(w=1===e.disposeOp?b(s,e.x,e.y,e.width,e.height):2===e.disposeOp?r:s,"native"===this.#Xt)break}}#ge(t){if(!(t instanceof Uint8Array))throw new TypeError('The "bytes" argument must be a Uint8Array.');if(t.length<13)return;let e=13;const r=t[10];e+=128&r?3*(1<<1+(7&r)):0;const i=t.subarray(0,e);let n=null,s=100;for(;e<t.length;){const r=t[e];if(59===r)break;if(33===r){for(249===t[e+1]&&(n=t.subarray(e,e+8),s=10*(t[e+4]|t[e+5]<<8),s<=10&&(s=100)),e+=2;e<t.length&&0!==t[e];)e+=t[e]+1;e++}else{if(44!==r)break;{const r=e;e+=10;const a=t[e-1];for(128&a&&(e+=3*(1<<1+(7&a))),e++;e<t.length&&0!==t[e];)e+=t[e]+1;e++;const o=e;if(this.#te.push({delay:s}),"script-only"!==this.#Xt){const e=this.#Zt.length;let s=this.#ce(e);if(!s){const a=new Uint8Array(i.length+(n?n.length:0)+(o-r)+1);a.set(i,0);let h=i.length;n&&(a.set(n,h),h+=n.length),a.set(t.subarray(r,o),h),a[a.length-1]=59;const l=new Blob([a],{type:"image/gif"});s=this.#fe(e,l)}this.#Zt.push({url:s,cacheKey:this.#ue(e)})}if("native"===this.#Xt)break;n=null}}}}#he(){if(!this.#re||this.#ee||!this.#Wt||0===this.#Zt.length)return;const t=this.#Zt[this.#ne];if(!t)return;const e=this.#te[this.#ne],r=(e?.delay||100)/this.#ie;this._setInternalSrc(t.url),this.#Wt.src=t.url,this._flushMutations(),this.#se=setTimeout(()=>{this.#ne=(this.#ne+1)%this.#Zt.length,this.#he()},r)}_getMetadataDetails(){const t=this.#Wt,e=this.metadata.animation;return{type:t?.naturalWidth?`image/${this.#ve()}`:"image/*",width:t?.naturalWidth??0,height:t?.naturalHeight??0,duration:e?e.duration/1e3:NaN,size:this._getResourceSize()}}_abort(){super._abort(),this.#Wt&&(this.#Wt.src=A,this._flushMutations())}_releaseAnimationFrames(){null!==this.#se&&(clearTimeout(this.#se),this.#se=null);for(const t of this.#Zt){const e=this.cache??this.#oe;e?e.release(t.cacheKey):URL.revokeObjectURL(t.url)}this.#Zt=[],this.#te=[],this.#ne=0,this.#ee=!1,this.#re=!1}_cleanup(){this._revokeObjectUrl(),this.pause(),this._releaseAnimationFrames(),this.#ae=null,this.#Wt&&(this.#Wt.onload=null,this.#Wt.onerror=null,this.#Wt.removeAttribute("src"),this.#Wt.src=A,this._flushMutations())}_createElement(){return document.createElement("img")}#de(t){if(!(t instanceof Blob))throw new TypeError('The "blob" argument must be a Blob.');return this._setResourceSize(t.size),this._createObjectUrl(t)}#ve(){const t=this.src.split("?")[0].split("#")[0],e=t.lastIndexOf(".");return-1===e?"png":t.slice(e+1).toLowerCase()}};window.TinyImageLoader=e.TinyImageLoader})();
@@ -0,0 +1 @@
1
+ (()=>{"use strict";const e={d:(t,r)=>{for(var s in r)e.o(r,s)&&!e.o(t,s)&&Object.defineProperty(t,s,{enumerable:!0,get:r[s]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};let t={};function r(e){if(null===e||"object"!=typeof e)return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}e.d(t,{TinyMediaCache:()=>i});class s{static Strategy=Object.freeze({AUTO:"auto",MANUAL:"manual",TTL:"ttl"});static#e=new Set;static#t=new Map;#r=0;#s=new Map;#i=new Map;#n;#o;#a;#h;#l;#c=0;#u=0;#m=null;#y=!1;get misses(){return this.#u}get ignoreSearch(){return this.#l}get strategy(){return this.#h}get ttl(){return this.#a}get maxItems(){return this.#n}get maxBytes(){return this.#o}get evictions(){return this.#r}constructor(e={}){if(!r(e))throw new TypeError('The "options" argument must be a plain object.');const{maxItems:t=1/0,maxBytes:i=1/0,ttl:n=0,strategy:o=s.Strategy.MANUAL,ignoreSearch:a=!1,sweepInterval:h=0}=e;if("number"!=typeof t||Number.isNaN(t)||t<1)throw new RangeError('The "maxItems" option must be a positive number.');if(t!==1/0&&!Number.isInteger(t))throw new RangeError('The "maxItems" option must be an integer or Infinity.');if("number"!=typeof i||Number.isNaN(i)||i<0)throw new RangeError('The "maxBytes" option must be a positive number.');if("number"!=typeof n||Number.isNaN(n)||n<0)throw new RangeError('The "ttl" option must be a positive number.');if(!Object.values(s.Strategy).includes(o))throw new TypeError(`Unknown cache strategy: ${o}`);if("boolean"!=typeof a)throw new TypeError('The "ignoreSearch" option must be a boolean.');if("number"!=typeof h||Number.isNaN(h)||h<0)throw new RangeError('The "sweepInterval" option must be a positive number.');this.#n=t,this.#o=i,this.#a=n,this.#h=o,this.#l=a,s.#e.add(this),h>0&&(this.#m=setInterval(()=>this.prune(),h),"function"==typeof this.#m.unref&&this.#m.unref())}static get registry(){return Array.from(s.#t,([e,t])=>({key:e,...t}))}static get instances(){return Array.from(s.#e)}static get size(){return s.#t.size}static get bytes(){let e=0;for(const t of s.#t.values())e+=t.size;return e}static has(e,t=!1){return s.#t.has(s.#b(e,t))}static clear(){for(const e of s.#t.values())URL.revokeObjectURL(e.objectUrl);s.#t.clear()}static destroyAll(){for(const e of Array.from(s.#e))e.destroy()}get size(){return this.#s.size}get links(){return this.#i.size}get bytes(){let e=0;for(const t of this.#s.values())e+=t.size;return e}get destroyed(){return this.#y}get stats(){let e=0;for(const t of this.#s.values())e+=t.refs;return{size:this.#s.size,bytes:this.bytes,refs:e,hits:this.#c,misses:this.#u,evictions:this.#r,links:this.#i.size,instances:s.#e.size,blobs:s.#t.size}}entries(){return this.#f(),Array.from(this.#s.values(),e=>({...e,metadata:{...e.metadata}}))}set(e,t,i=!1,n={},o=null){if(this.#f(),!(t instanceof Blob))throw new TypeError('The "blob" argument must be a Blob.');if("boolean"!=typeof i)throw new TypeError('The "pinned" argument must be a boolean.');if(!r(n))throw new TypeError('The "metadata" argument must be a plain object.');if(null!==o&&"string"!=typeof o)throw new TypeError('The "parent" argument must be a string or null.');const a=this.#g(e);this.#p(a,!1);const h=s.#d(a,t),l=Date.now(),c={key:a,url:e,blob:t,objectUrl:h.objectUrl,size:t.size,type:t.type,refs:0,createdAt:l,lastAccess:l,expiresAt:this.#a>0?l+this.#a:0,pinned:Boolean(i),parent:o,metadata:{...n}};return this.#s.set(a,c),null!==o&&this.#w(o,a),this.#T(),c}get(e){this.#f();const t=this.#g(e),r=this.#s.get(t);return r?this.#v(r)?(this.delete(t),this.#u+=1,null):(r.lastAccess=Date.now(),this.#c+=1,r):(this.#u+=1,null)}has(e){this.#f();const t=this.#s.get(this.#g(e));return void 0!==t&&!this.#v(t)}acquire(e){this.#f();const t=this.get(e);return t?(t.refs+=1,t):null}release(e){this.#f();const t=this.#g(e),r=this.#s.get(t);return!!r&&(r.refs=Math.max(0,r.refs-1),0===r.refs&&this.#h===s.Strategy.AUTO&&this.delete(t),!0)}delete(e){return this.#f(),this.#p(this.#g(e),!0)}children(e){return Array.from(this.#i.get(this.#g(e))??[])}#p(e,t){if("string"!=typeof e)throw new TypeError('The "key" argument must be a string.');if("boolean"!=typeof t)throw new TypeError('The "cascade" argument must be a boolean.');const r=this.#s.get(e);if(!r)return!1;if(this.#s.delete(e),s.#A(e),this.#i.delete(e),null===r.parent)return!0;const i=this.#i.get(r.parent);if(!i)return!0;if(i.delete(e),i.size>0)return!0;this.#i.delete(r.parent);const n=this.#s.get(r.parent);return t&&n&&0===n.refs&&this.#p(r.parent,!0),!0}#w(e,t){if("string"!=typeof e)throw new TypeError('The "parent" argument must be a string.');if("string"!=typeof t)throw new TypeError('The "child" argument must be a string.');let r=this.#i.get(e);r||(r=new Set,this.#i.set(e,r)),r.add(t)}peek(e){if(this.#f(),"string"!=typeof e)throw new TypeError('The "url" argument must be a string.');const t=this.#s.get(this.#g(e));return!t||this.#v(t)?null:t}pin(e,t=!0){if(this.#f(),"boolean"!=typeof t)throw new TypeError('The "value" argument must be a boolean.');const r=this.#s.get(this.#g(e));return!!r&&(r.pinned=t,!0)}prune(){this.#f();const e=[];for(const[t,r]of this.#s)this.#v(r)&&e.push(t);let t=0;for(const r of e)this.#p(r,!0)&&(t+=1);return t}clear(){this.#f();for(const e of Array.from(this.#s.keys()))this.#s.delete(e),s.#A(e);this.#i.clear()}destroy(){this.#y||(this.#m&&(clearInterval(this.#m),this.#m=null),this.clear(),s.#e.delete(this),this.#y=!0)}#T(){if(this.#s.size<=this.#n&&this.bytes<=this.#o)return;const e=Array.from(this.#s.values()).filter(e=>!e.pinned&&0===e.refs&&!this.#i.has(e.key)).sort((e,t)=>e.lastAccess-t.lastAccess);let t=this.bytes,r=this.#s.size;for(const s of e){if(r<=this.#n&&t<=this.#o)break;this.delete(s.key),this.#r+=1,t-=s.size,r-=1}}#v(e){if(null===e||"object"!=typeof e)throw new TypeError('The "entry" argument must be a MediaCacheEntry.');return e.expiresAt>0&&Date.now()>=e.expiresAt}#g(e){return s.#b(e,this.#l)}#f(){if(this.#y)throw new Error("Cannot use a destroyed media cache.")}static#b(e,t){if("string"!=typeof e)throw new TypeError('The "url" argument must be a string.');if("boolean"!=typeof t)throw new TypeError('The "ignoreSearch" argument must be a boolean.');if(!t)return e;const r=e.split("#")[0],s=r.indexOf("?");return-1===s?r:r.slice(0,s)}static#d(e,t){if("string"!=typeof e)throw new TypeError('The "key" argument must be a string.');if(!(t instanceof Blob))throw new TypeError('The "blob" argument must be a Blob.');const r=s.#t.get(e);if(r)return r.refs+=1,r;const i={objectUrl:URL.createObjectURL(t),refs:1,size:t.size};return s.#t.set(e,i),i}static#A(e){if("string"!=typeof e)throw new TypeError('The "key" argument must be a string.');const t=s.#t.get(e);t&&(t.refs-=1,t.refs>0||(URL.revokeObjectURL(t.objectUrl),s.#t.delete(e)))}}const i=s;window.TinyMediaCache=t.TinyMediaCache})();
@@ -0,0 +1 @@
1
+ (()=>{"use strict";const e={cw:e=>{var t;return()=>{if(e){var r=e;e=0,t={exports:{}},r.call(t.exports,t,t.exports)}return t.exports}},d:(t,r)=>{for(var s in r)e.o(r,s)&&!e.o(t,s)&&Object.defineProperty(t,s,{enumerable:!0,get:r[s]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};let t={};e.d(t,{TinyMediaLoader:()=>u});var r=e.cw(function(e,t){var r,s="object"==typeof Reflect?Reflect:null,i=s&&"function"==typeof s.apply?s.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};r=s&&"function"==typeof s.ownKeys?s.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var n=Number.isNaN||function(e){return e!=e};function o(){o.init.call(this)}e.exports=o,e.exports.once=function(e,t){return new Promise(function(r,s){function i(r){e.removeListener(t,n),s(r)}function n(){"function"==typeof e.removeListener&&e.removeListener("error",i),r([].slice.call(arguments))}g(e,t,n,{once:!0}),"error"!==t&&function(e,t){"function"==typeof e.on&&g(e,"error",t,{once:!0})}(e,i)})},o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var a=10;function h(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function c(e){return void 0===e._maxListeners?o.defaultMaxListeners:e._maxListeners}function l(e,t,r,s){var i,n,o,a;if(h(r),void 0===(n=e._events)?(n=e._events=Object.create(null),e._eventsCount=0):(void 0!==n.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),n=e._events),o=n[t]),void 0===o)o=n[t]=r,++e._eventsCount;else if("function"==typeof o?o=n[t]=s?[r,o]:[o,r]:s?o.unshift(r):o.push(r),(i=c(e))>0&&o.length>i&&!o.warned){o.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=o.length,a=l,console&&console.warn&&console.warn(a)}return e}function u(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function m(e,t,r){var s={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=u.bind(s);return i.listener=r,s.wrapFn=i,i}function d(e,t,r){var s=e._events;if(void 0===s)return[];var i=s[t];return void 0===i?[]:"function"==typeof i?r?[i.listener||i]:[i]:r?function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(i):f(i,i.length)}function p(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function f(e,t){for(var r=new Array(t),s=0;s<t;++s)r[s]=e[s];return r}function g(e,t,r,s){if("function"==typeof e.on)s.once?e.once(t,r):e.on(t,r);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,function i(n){s.once&&e.removeEventListener(t,i),r(n)})}}Object.defineProperty(o,"defaultMaxListeners",{enumerable:!0,get:function(){return a},set:function(e){if("number"!=typeof e||e<0||n(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");a=e}}),o.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},o.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||n(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},o.prototype.getMaxListeners=function(){return c(this)},o.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var s="error"===e,n=this._events;if(void 0!==n)s=s&&void 0===n.error;else if(!s)return!1;if(s){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var h=n[e];if(void 0===h)return!1;if("function"==typeof h)i(h,this,t);else{var c=h.length,l=f(h,c);for(r=0;r<c;++r)i(l[r],this,t)}return!0},o.prototype.addListener=function(e,t){return l(this,e,t,!1)},o.prototype.on=o.prototype.addListener,o.prototype.prependListener=function(e,t){return l(this,e,t,!0)},o.prototype.once=function(e,t){return h(t),this.on(e,m(this,e,t)),this},o.prototype.prependOnceListener=function(e,t){return h(t),this.prependListener(e,m(this,e,t)),this},o.prototype.removeListener=function(e,t){var r,s,i,n,o;if(h(t),void 0===(s=this._events))return this;if(void 0===(r=s[e]))return this;if(r===t||r.listener===t)0===--this._eventsCount?this._events=Object.create(null):(delete s[e],s.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(i=-1,n=r.length-1;n>=0;n--)if(r[n]===t||r[n].listener===t){o=r[n].listener,i=n;break}if(i<0)return this;0===i?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,i),1===r.length&&(s[e]=r[0]),void 0!==s.removeListener&&this.emit("removeListener",e,o||t)}return this},o.prototype.off=o.prototype.removeListener,o.prototype.removeAllListeners=function(e){var t,r,s;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0===--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var i,n=Object.keys(r);for(s=0;s<n.length;++s)"removeListener"!==(i=n[s])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(s=t.length-1;s>=0;s--)this.removeListener(e,t[s]);return this},o.prototype.listeners=function(e){return d(this,e,!0)},o.prototype.rawListeners=function(e){return d(this,e,!1)},o.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):p.call(e,t)},o.prototype.listenerCount=p,o.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]}});r();const s=class{#e;#t=0;#r=0;#s=0;#i=0;#n=0;#o=0;constructor(e=0){if("number"!=typeof e||Number.isNaN(e)||e<0)throw new RangeError('The "total" argument must be a positive number.');this.#e=e}get total(){return this.#e}set total(e){if("number"!=typeof e||Number.isNaN(e)||e<0)throw new RangeError('The "total" value must be a positive number.');this.#e=e}get loaded(){return this.#t}get remaining(){return this.#e>0?Math.max(0,this.#e-this.#t):0}get percent(){return this.#e>0?Math.min(100,this.#t/this.#e*100):0}get rate(){return this.#o}get chunks(){return this.#r}get elapsed(){return 0===this.#s?0:performance.now()-this.#s}get eta(){return this.#o<=0||this.#e<=0?0:this.remaining/this.#o*1e3}start(){return this.#s=performance.now(),this.#i=this.#s,this}push(e){if("number"!=typeof e||Number.isNaN(e)||e<0)throw new RangeError('The "bytes" argument must be a positive number.');const t=performance.now();this.#t+=e,this.#r+=1;const r=t-this.#i;if(r>0){const e=(this.#t-this.#n)/r*1e3;this.#o=0===this.#o?e:.7*this.#o+.3*e}return this.#i=t,this.#n=this.#t,this}reset(){return this.#t=0,this.#r=0,this.#o=0,this.#n=0,this.#s=0,this.#i=0,this}snapshot(){return{loaded:this.#t,total:this.#e,remaining:this.remaining,percent:this.percent,rate:this.#o,elapsed:this.elapsed,eta:this.eta,chunks:this.#r}}};function i(e){if(null===e||"object"!=typeof e)return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}class n{static Strategy=Object.freeze({AUTO:"auto",MANUAL:"manual",TTL:"ttl"});static#a=new Set;static#h=new Map;#c=0;#l=new Map;#u=new Map;#m;#d;#p;#f;#g;#y=0;#b=0;#w=null;#v=!1;get misses(){return this.#b}get ignoreSearch(){return this.#g}get strategy(){return this.#f}get ttl(){return this.#p}get maxItems(){return this.#m}get maxBytes(){return this.#d}get evictions(){return this.#c}constructor(e={}){if(!i(e))throw new TypeError('The "options" argument must be a plain object.');const{maxItems:t=1/0,maxBytes:r=1/0,ttl:s=0,strategy:o=n.Strategy.MANUAL,ignoreSearch:a=!1,sweepInterval:h=0}=e;if("number"!=typeof t||Number.isNaN(t)||t<1)throw new RangeError('The "maxItems" option must be a positive number.');if(t!==1/0&&!Number.isInteger(t))throw new RangeError('The "maxItems" option must be an integer or Infinity.');if("number"!=typeof r||Number.isNaN(r)||r<0)throw new RangeError('The "maxBytes" option must be a positive number.');if("number"!=typeof s||Number.isNaN(s)||s<0)throw new RangeError('The "ttl" option must be a positive number.');if(!Object.values(n.Strategy).includes(o))throw new TypeError(`Unknown cache strategy: ${o}`);if("boolean"!=typeof a)throw new TypeError('The "ignoreSearch" option must be a boolean.');if("number"!=typeof h||Number.isNaN(h)||h<0)throw new RangeError('The "sweepInterval" option must be a positive number.');this.#m=t,this.#d=r,this.#p=s,this.#f=o,this.#g=a,n.#a.add(this),h>0&&(this.#w=setInterval(()=>this.prune(),h),"function"==typeof this.#w.unref&&this.#w.unref())}static get registry(){return Array.from(n.#h,([e,t])=>({key:e,...t}))}static get instances(){return Array.from(n.#a)}static get size(){return n.#h.size}static get bytes(){let e=0;for(const t of n.#h.values())e+=t.size;return e}static has(e,t=!1){return n.#h.has(n.#T(e,t))}static clear(){for(const e of n.#h.values())URL.revokeObjectURL(e.objectUrl);n.#h.clear()}static destroyAll(){for(const e of Array.from(n.#a))e.destroy()}get size(){return this.#l.size}get links(){return this.#u.size}get bytes(){let e=0;for(const t of this.#l.values())e+=t.size;return e}get destroyed(){return this.#v}get stats(){let e=0;for(const t of this.#l.values())e+=t.refs;return{size:this.#l.size,bytes:this.bytes,refs:e,hits:this.#y,misses:this.#b,evictions:this.#c,links:this.#u.size,instances:n.#a.size,blobs:n.#h.size}}entries(){return this.#E(),Array.from(this.#l.values(),e=>({...e,metadata:{...e.metadata}}))}set(e,t,r=!1,s={},o=null){if(this.#E(),!(t instanceof Blob))throw new TypeError('The "blob" argument must be a Blob.');if("boolean"!=typeof r)throw new TypeError('The "pinned" argument must be a boolean.');if(!i(s))throw new TypeError('The "metadata" argument must be a plain object.');if(null!==o&&"string"!=typeof o)throw new TypeError('The "parent" argument must be a string or null.');const a=this.#L(e);this.#_(a,!1);const h=n.#S(a,t),c=Date.now(),l={key:a,url:e,blob:t,objectUrl:h.objectUrl,size:t.size,type:t.type,refs:0,createdAt:c,lastAccess:c,expiresAt:this.#p>0?c+this.#p:0,pinned:Boolean(r),parent:o,metadata:{...s}};return this.#l.set(a,l),null!==o&&this.#A(o,a),this.#R(),l}get(e){this.#E();const t=this.#L(e),r=this.#l.get(t);return r?this.#O(r)?(this.delete(t),this.#b+=1,null):(r.lastAccess=Date.now(),this.#y+=1,r):(this.#b+=1,null)}has(e){this.#E();const t=this.#l.get(this.#L(e));return void 0!==t&&!this.#O(t)}acquire(e){this.#E();const t=this.get(e);return t?(t.refs+=1,t):null}release(e){this.#E();const t=this.#L(e),r=this.#l.get(t);return!!r&&(r.refs=Math.max(0,r.refs-1),0===r.refs&&this.#f===n.Strategy.AUTO&&this.delete(t),!0)}delete(e){return this.#E(),this.#_(this.#L(e),!0)}children(e){return Array.from(this.#u.get(this.#L(e))??[])}#_(e,t){if("string"!=typeof e)throw new TypeError('The "key" argument must be a string.');if("boolean"!=typeof t)throw new TypeError('The "cascade" argument must be a boolean.');const r=this.#l.get(e);if(!r)return!1;if(this.#l.delete(e),n.#M(e),this.#u.delete(e),null===r.parent)return!0;const s=this.#u.get(r.parent);if(!s)return!0;if(s.delete(e),s.size>0)return!0;this.#u.delete(r.parent);const i=this.#l.get(r.parent);return t&&i&&0===i.refs&&this.#_(r.parent,!0),!0}#A(e,t){if("string"!=typeof e)throw new TypeError('The "parent" argument must be a string.');if("string"!=typeof t)throw new TypeError('The "child" argument must be a string.');let r=this.#u.get(e);r||(r=new Set,this.#u.set(e,r)),r.add(t)}peek(e){if(this.#E(),"string"!=typeof e)throw new TypeError('The "url" argument must be a string.');const t=this.#l.get(this.#L(e));return!t||this.#O(t)?null:t}pin(e,t=!0){if(this.#E(),"boolean"!=typeof t)throw new TypeError('The "value" argument must be a boolean.');const r=this.#l.get(this.#L(e));return!!r&&(r.pinned=t,!0)}prune(){this.#E();const e=[];for(const[t,r]of this.#l)this.#O(r)&&e.push(t);let t=0;for(const r of e)this.#_(r,!0)&&(t+=1);return t}clear(){this.#E();for(const e of Array.from(this.#l.keys()))this.#l.delete(e),n.#M(e);this.#u.clear()}destroy(){this.#v||(this.#w&&(clearInterval(this.#w),this.#w=null),this.clear(),n.#a.delete(this),this.#v=!0)}#R(){if(this.#l.size<=this.#m&&this.bytes<=this.#d)return;const e=Array.from(this.#l.values()).filter(e=>!e.pinned&&0===e.refs&&!this.#u.has(e.key)).sort((e,t)=>e.lastAccess-t.lastAccess);let t=this.bytes,r=this.#l.size;for(const s of e){if(r<=this.#m&&t<=this.#d)break;this.delete(s.key),this.#c+=1,t-=s.size,r-=1}}#O(e){if(null===e||"object"!=typeof e)throw new TypeError('The "entry" argument must be a MediaCacheEntry.');return e.expiresAt>0&&Date.now()>=e.expiresAt}#L(e){return n.#T(e,this.#g)}#E(){if(this.#v)throw new Error("Cannot use a destroyed media cache.")}static#T(e,t){if("string"!=typeof e)throw new TypeError('The "url" argument must be a string.');if("boolean"!=typeof t)throw new TypeError('The "ignoreSearch" argument must be a boolean.');if(!t)return e;const r=e.split("#")[0],s=r.indexOf("?");return-1===s?r:r.slice(0,s)}static#S(e,t){if("string"!=typeof e)throw new TypeError('The "key" argument must be a string.');if(!(t instanceof Blob))throw new TypeError('The "blob" argument must be a Blob.');const r=n.#h.get(e);if(r)return r.refs+=1,r;const s={objectUrl:URL.createObjectURL(t),refs:1,size:t.size};return n.#h.set(e,s),s}static#M(e){if("string"!=typeof e)throw new TypeError('The "key" argument must be a string.');const t=n.#h.get(e);t&&(t.refs-=1,t.refs>0||(URL.revokeObjectURL(t.objectUrl),n.#h.delete(e)))}}const o=n;class a{static#k=new Map;static get size(){return a.#k.size}static get keys(){return Array.from(a.#k.keys())}static get stats(){let e=0;for(const t of a.#k.values())e+=t.mirrors;return{pending:a.#k.size,mirrors:e}}static has(e){return a.#k.has(e)}static get(e){return a.#k.get(e)??null}static entries(){return Array.from(a.#k.values(),e=>({key:e.key,src:e.src,startedAt:e.startedAt,mirrors:e.mirrors,settled:e.settled}))}static open(e,t){if("string"!=typeof e)throw new TypeError('The "key" argument must be a string.');if("string"!=typeof t)throw new TypeError('The "src" argument must be a string.');const r=a.#k.get(e);if(r)return r;const s={key:e,src:t,startedAt:Date.now(),mirrors:0,settled:!1,sequence:0,events:[],subscribers:new Set,promise:null,resolve:()=>{},reject:()=>{}};return s.promise=new Promise((e,t)=>{s.resolve=t=>{s.settled=!0,e(t)},s.reject=e=>{s.settled=!0,t(e)}}),s.promise.catch(()=>{}),a.#k.set(e,s),s}static attach(e){const t=a.#k.get(e);return t?(t.mirrors+=1,t):null}static close(e){const t=a.#k.get(e);return!!t&&(t.settled||t.reject(new Error(`The mirrored download for "${t.src}" ended without a payload.`)),a.#k.delete(e))}static clear(){for(const e of a.#k.values())e.settled||e.reject(new Error("The mirror registry was cleared."));a.#k.clear()}static publish(e,t,r){if("string"!=typeof e)throw new TypeError('The "key" argument must be a string.');if("string"!=typeof t)throw new TypeError('The "name" argument must be a string.');if(!Array.isArray(r))throw new TypeError('The "args" argument must be an array.');const s=a.#k.get(e);if(!s)return 0;const i={seq:s.sequence,name:t,args:r,timestamp:performance.now()};s.sequence+=1,s.events.push(i);for(const e of s.subscribers)e(i);return s.subscribers.size}static subscribe(e,t){if("function"!=typeof t)throw new TypeError('The "handler" argument must be a function.');const r=a.#k.get(e);if(!r)return null;const{events:s}=r;for(let e=0;e<s.length;e+=1)t(s[e]);return r.subscribers.add(t),()=>r.subscribers.delete(t)}static history(e){return a.#k.get(e)?.events??[]}}const h=a,c=r().EventEmitter;class l extends c{static get TinyMediaMirror(){return h}static MediaState=Object.freeze({IDLE:"idle",LOADING:"loading",LOADED:"loaded",ERROR:"error",DESTROYED:"destroyed"});static get tagName(){return""}#j;#z=l.MediaState.IDLE;#x=null;#N;#s=0;#D=0;#I=!1;#C=!1;#U=!1;#q=null;#H=null;#B=null;#P=[];#F=null;#$=!1;#G=!1;#K=null;#Y=null;#W=null;#J=!1;#Q=0;#V=!1;#X=null;#Z=!0;#ee=null;#te=null;#re=new Map;#se=!0;#ie=!1;#ne=!1;#oe=null;#ae=globalThis.fetch.bind(globalThis);#he={};#ce=void 0;#le={};#ue={src:"",type:"",width:0,height:0,duration:0,size:0,fromCache:!1,loadTime:0,timestamp:0,animation:null};constructor(e={}){if(null===e||"object"!=typeof e)throw new TypeError('The "options" argument must be an object.');const{src:t,timeout:r=1/0,element:s=null,autoReload:i=!1,originalSrc:n=!1,earlyDecode:a=!0,progressive:h=!0,useHeadRequest:c=!1,mirror:l=!0,body:u}=e;if(void 0!==t&&"string"!=typeof t)throw new TypeError('The "src" option must be a string.');if("number"!=typeof r||Number.isNaN(r)||r<0)throw new RangeError('The "timeout" option must be a positive number.');if(null!==s&&!(s instanceof HTMLElement))throw new TypeError('The "element" option must be an HTMLElement or null.');if("boolean"!=typeof n)throw new TypeError('The "originalSrc" option must be a boolean.');if("boolean"!=typeof a)throw new TypeError('The "earlyDecode" option must be a boolean.');if("boolean"!=typeof h)throw new TypeError('The "progressive" option must be a boolean.');if("boolean"!=typeof l)throw new TypeError('The "mirror" option must be a boolean.');if("boolean"!=typeof i)throw new TypeError('The "autoReload" option must be a boolean.');super();const m=this.constructor.tagName;if(s&&m&&s.tagName!==m)throw new TypeError(`The "element" option must be a <${m.toLowerCase()}> element.`);if(this.#j=t??s?.getAttribute("src")??"",this.#N=r,this.#U=i,this.#J=n,void 0!==e.cache&&null!==e.cache&&!(e.cache instanceof o))throw new TypeError('The "cache" option must be a TinyMediaCache or null.');this.#F=e.cache??null,this.#me(),this.#I=c,this.#V=a,this.#Z=h,this.#ce=u,this.#se=l,s&&(this.#x=s,this.#de())}static#pe=new Set(["mirror","destroy","error","metadata"]);emit(e,...t){const r=super.emit(e,...t);return!this.#oe||this.#ne||l.#pe.has(e)||this.#oe(e,t),r}get mirror(){return this.#se}get mirrored(){return this.#ie}get response(){return this.#ee}get headResponse(){return this.#te}get useHeadRequest(){return this.#I}get objectUrl(){return this.#W}get src(){return this.#j}get internalSrc(){return this.#K}get originalSrc(){return this.#J}get earlyDecode(){return this.#V}get progressive(){return this.#Z}set src(e){if("string"!=typeof e)throw new TypeError('The "src" value must be a string.');this.#fe(e)&&this.#x&&this.#x.getAttribute("src")!==e&&(e?this.#x.setAttribute("src",e):this.#x.removeAttribute("src"),this._flushMutations())}get aborted(){return this.#G}get cacheAcquired(){return this.#$}get autoReload(){return this.#U}get cacheHint(){return this.#C}get endTime(){return this.#D}get startTime(){return this.#s}get state(){return this.#z}get element(){return this.#x}get metadata(){return{...this.#ue,httpHeaders:{...this.#ue.httpHeaders}}}get resourceSize(){return this.#Q}get isLoading(){return this.#z===l.MediaState.LOADING}get isLoaded(){return this.#z===l.MediaState.LOADED}get hasError(){return this.#z===l.MediaState.ERROR}get progress(){return this.#H}get cache(){return this.#F}set cache(e){if(null!==e&&!(e instanceof o))throw new TypeError('The "cache" value must be a TinyMediaCache or null.');this.#F=e}get signal(){if(!this.#B)throw new Error("Signal does not exist.");return this.#B}get body(){return this.#ce}set body(e){this.#ce=e}get pending(){return h.has(this.#ge(this.#j))}get _fetch(){return this.#ae}set _fetch(e){if("function"!=typeof e)throw new TypeError('The "fetch" value must be a function.');this.#ae=e}get _requestInit(){return this.#he}set _requestInit(e){this.#he=e}isCached(e=this.#j){if("string"!=typeof e)throw new TypeError('The "src" argument must be a string.');return!!this.#F&&this.#F.has(e)}get cached(){return this.isCached()}peekCache(e=this.#j){if("string"!=typeof e)throw new TypeError('The "src" argument must be a string.');return this.#F?this.#F.peek(e):null}_insertDecoder(e,t){if("string"!=typeof e||0===e.length)throw new TypeError('The "mime" argument must be a non-empty string.');if("function"!=typeof t)throw new TypeError('The "callback" argument must be a function.');this.#re.set(e,t)}_createProgress(e=0){if("number"!=typeof e||!Number.isFinite(e))throw new TypeError('The "total" argument must be a finite number.');if(e<0)throw new RangeError('The "total" argument must be a non-negative number.');return this.#H=new s(e).start(),this.#H}_emitProgress(){this.#H&&this.emit("progress",this.#H.snapshot())}_emitMetadata(e,t){if(null===e||"object"!=typeof e)throw new TypeError('The "patch" argument must be an object.');if("string"!=typeof t||0===t.length)throw new TypeError('The "type" argument must be a non-empty string.');const r=Object.fromEntries(Object.entries(e).filter(([,e])=>void 0!==e));this.#le={...this.#le,...r},this.#ue={...this.#ue,...r},this.#oe?.("metadata",[r,t]),this.emit("metadata",this.metadata,t)}_on(e,t,r){if(!(e instanceof HTMLElement))throw new TypeError('The "element" argument must be an HTMLElement.');if("string"!=typeof t||0===t.length)throw new TypeError('The "type" argument must be a non-empty string.');if("function"!=typeof r)throw new TypeError('The "handler" argument must be a function.');e.addEventListener(t,r),this.#P.push(()=>e.removeEventListener(t,r))}_forwardEvents(e,t){if(!Array.isArray(t))throw new TypeError('The "events" argument must be an array of strings.');for(const r of t){if("string"!=typeof r||0===r.length)throw new TypeError('Every entry of "events" must be a non-empty string.');this._on(e,r,e=>{this.emit(r,e)})}}_detachEvents(){for(const e of this.#P)e();this.#P=[]}async load(){if(this.#z===l.MediaState.DESTROYED)throw new Error("Cannot load a destroyed media loader.");if(this.#z===l.MediaState.LOADING)throw new Error("The media is already loading.");if(!this.#j)throw new Error("Cannot load media without a source.");this._detachEvents(),this._releaseFromCache(),this.#me(),this.#ye(),this.#be(),this._createProgress(0),this.#we(l.MediaState.LOADING),this.emit("loadstart",{src:this.#j});try{return await this.#ve(this._startLoad()),this.#D=performance.now(),this.#ue=this.#Te(),this.#we(l.MediaState.LOADED),this.emit("loaded",this.#ue),this.#ue}catch(e){throw this.#D=performance.now(),this.#G?(this.#G=!1,this.#we(l.MediaState.IDLE),this.emit("abort",{src:this.#j})):(this.#we(l.MediaState.ERROR),this.#Ee(e)),e}finally{this.emit("loadend",{src:this.#j,state:this.#z})}}async reload(){if(this.#z===l.MediaState.LOADING)throw new Error("Cannot reload while the media is loading.");if(this.#z===l.MediaState.DESTROYED)throw new Error("Cannot reload a destroyed media loader.");return this.#H?.reset(),this.#z=l.MediaState.IDLE,this.load()}abort(){return this.#z===l.MediaState.LOADING&&(this.#G=!0,this.#B&&this.#B.abort(),!0)}mount(e){if(!(e instanceof HTMLElement))throw new TypeError('The "container" argument must be an HTMLElement.');if(!this.#x)throw new Error("Cannot mount before the media element is created.");return e.appendChild(this.#x),this}destroy(){this.#z!==l.MediaState.DESTROYED&&(this.#z=l.MediaState.DESTROYED,this.#B&&this.#B.abort(),this._cleanup(),this._detachEvents(),this.#Le(),null!==this.#Y&&(clearTimeout(this.#Y),this.#Y=null),this.#ye(),this._releaseFromCache(),this.#re.clear(),this.emit("destroy"),this.removeAllListeners(),this.#x=null)}_resolveElement(){return this.#x||(this.#x=this._createElement()),this.#de(),this.#x}_setElement(e){if(!(e instanceof HTMLElement))throw new TypeError('The "element" argument must be an HTMLElement.');this.#x=e,this.#de()}_setCacheHint(e){if("boolean"!=typeof e)throw new TypeError('The "value" argument must be a boolean.');this.#C=Boolean(e)}_setInternalSrc(e){if(null!==e&&"string"!=typeof e)throw new TypeError('The "url" argument must be a string or null.');this.#K=e,this.#_e(),this._flushMutations(),this.emit("srctransition",{src:this.#j,internalSrc:e})}#_e(){const e=this.#x;e&&this.#J&&(this.#K?e.setAttribute("original-src",this.#j):e.removeAttribute("original-src"))}_waitForMedia(e,t="loadeddata"){if(!(e instanceof HTMLElement))throw new TypeError('The "element" argument must be an HTMLElement.');if("string"!=typeof t)throw new TypeError('The "readyEvent" argument must be a string.');if(!this.#B)throw new Error("Signal does not exist to wait for media.");const{signal:r}=this.#B;return new Promise((s,i)=>{const n=()=>{h(),s(void 0)},o=()=>{h(),i(new Error(`Failed to load media: ${this.#j}`))},a=()=>{h(),i(new DOMException("The media load was aborted.","AbortError"))},h=()=>{e.removeEventListener(t,n),e.removeEventListener("error",o),r.removeEventListener("abort",a)};e.addEventListener(t,n),e.addEventListener("error",o),r.addEventListener("abort",a,{once:!0})})}_cacheBlob(e){if(!(e instanceof Blob))throw new TypeError('The "blob" argument must be a Blob.');if(this._setResourceSize(e.size),this.#F){const t=this.#F.get(this.#j);if(t)return this.#F.acquire(this.#j),this.#$=!0,t.objectUrl;const r=this.#F.set(this.#j,e,!1,this.#le);return this.#F.acquire(this.#j),this.#$=!0,this.emit("cachemiss",r),r.objectUrl}return this._createObjectUrl(e)}async _downloadStream(e,t,r=0,s=null){if("string"!=typeof e)throw new TypeError('The "url" argument must be a string.');if(!Number.isInteger(r)||r<0)throw new RangeError('The "startByte" argument must be a non-negative integer.');if(void 0!==t&&"function"!=typeof t)throw new TypeError('The "onChunk" argument must be a function or undefined.');const i=this.#ge(e),n=this.#se&&0===r,o=n?h.attach(i):null;if(o)return this.#Se(o,e,t,r,s);const a=n?h.open(i,e):null;this.#oe=a?(e,t)=>h.publish(i,e,t):null;try{const i=await this.#Ae(e,t,r,s);return a?.resolve(i),i}catch(e){throw a?.reject(e),e}finally{this.#oe=null,a&&h.close(i)}}async#Ae(e,t,r=0,s=null){if("string"!=typeof e)throw new TypeError('The "url" argument must be a string.');const i=this.#he.method?.toUpperCase(),n="GET"===i;let o="",a=0,h=!1;if(this.#I&&"GET"===i&&0===r)try{const t=await this.#ae(e,{...this.#he,method:"HEAD",signal:s||this.signal.signal});if(this.#te=t,this.emit("headResponse",t),t.ok){o=t.headers.get("content-type")||"";const e=t.headers.get("content-length");e&&(a=Number(e));const r={};t.headers.forEach((e,t)=>{r[t]=e});const s={};o&&(s.type=o),a>0&&(s.size=a),Object.keys(r).length>0&&(s.httpHeaders=r),Object.keys(s).length>0&&this._emitMetadata(s,"HEAD"),h=!0}}catch(e){}const c=new Headers(this.#he.headers);n&&r>0&&c.set("Range",`bytes=${r}-`);const l={...this.#he,signal:s||this.signal.signal,headers:c};l.body||void 0===this.#ce||(l.body=this.#ce);const u=await this.#ae(e,l);if(this.#ee=u,this.emit("response",u),!u.ok){if(416===u.status)throw new Error("Requested range not satisfiable.");throw new Error(`Failed to fetch media: ${u.status} ${u.statusText}`)}if(!u.body)return new Blob([],{type:o||"application/octet-stream"});const m=u.headers.get("content-type")||o,d=Number(u.headers.get("content-length")||0);if(206===u.status){const e=u.headers.get("content-range");if(e){const t=e.match(/\/(\d+)$/);t&&(a=Number(t[1]))}}else a=d>0?d+r:a;const p={};u.headers.forEach((e,t)=>{p[t]=e});const f={};m&&m!==o&&(f.type=m,o=m),a>0&&(!h||206===u.status)&&(f.size=a),Object.keys(p).length>0&&(f.httpHeaders=p),Object.keys(f).length>0&&this._emitMetadata(f,"GET"),this.#Re(o);const g=this._createProgress(a),y=u.body.getReader(),b=[];let w=r;try{for(;;){const{done:e,value:r}=await y.read();if(e)break;b.push(r),this.#X?.write(r),w+=r.byteLength,g.push(r.byteLength),this.emit("chunk",{chunk:r,loaded:w,total:a}),this._emitProgress(),t&&t(r,b)}}finally{this.#ye()}return new Blob(b,{type:o||"application/octet-stream"})}#ge(e){if(!this.#F?.ignoreSearch)return e;const t=e.split("#")[0],r=t.indexOf("?");return-1===r?t:t.slice(0,r)}async#Se(e,t,r,s,i){const n=[],o=this._createProgress(0),a=h.history(e.key).length,c=h.subscribe(e.key,e=>{this.#Oe(e,n,o,r)});let l;try{l=await e.promise}catch{return c&&c(),this.#Ae(t,r,s,i)}return c&&c(),this.#ie=!0,this._setResourceSize(l.size),l.type&&this._emitMetadata({type:l.type},"MIRROR"),await this.#Me(l),this.emit("mirror",{src:this.#j,key:e.key,size:l.size,mirrors:e.mirrors,replayed:a}),l}#Oe(e,t,r,s){if("metadata"===e.name){const[t,r]=e.args;return void this._emitMetadata(t,r)}if("chunk"===e.name){const[i]=e.args,n=i.chunk;0===r.total&&i.total>0&&(r.total=i.total),t.push(n),r.push(i.chunk.byteLength),s&&s(n,t)}this.#ke(e.name,e.args)}#ke(e,t){this.#ne=!0;try{Reflect.apply(this.emit,this,[e,...t])}finally{this.#ne=!1}}async#Me(e){this.#Re(e.type),this.#X&&(this.#X.write(new Uint8Array(await e.arrayBuffer())),this.#ye())}#Re(e){if(!this.#V)return;const t=e.split(";")[0].trim().toLowerCase();this.#re.forEach((e,r)=>{!this.#X&&t.startsWith(`${r}/`)&&(this.#X=e(t))})}#ye(){if(this.#X){if("function"==typeof this.#X.finalize){const e=this.#X.finalize();e&&this._emitMetadata(e,"DECODE")}this.#X.close(),this.#X=null}}_acquireFromCache(){if(!this.#F)return null;const e=this.#F.acquire(this.#j);return e&&(this.#$=!0,this._setCacheHint(!0),this._setResourceSize(e.size),e.type&&this._emitMetadata({type:e.type},"CACHE"),e.metadata&&this._emitMetadata(e.metadata,"CACHE")),e}_releaseFromCache(){this.#F&&this.#$&&(this.#F.release(this.#j),this.#$=!1)}_getLoadTime(){return this.#D-this.#s}_detectCache(){if("undefined"==typeof performance||"function"!=typeof performance.getEntriesByName)return!1;const e=performance.getEntriesByName(this.#j);if(0===e.length)return!1;const t=e[e.length-1];return 0===t.transferSize&&t.decodedBodySize>0}_setResourceSize(e){if("number"!=typeof e||Number.isNaN(e)||e<0)throw new RangeError('The "size" argument must be a positive number.');this.#Q=e}_getResourceSize(){if(this.#Q>0)return this.#Q;if("undefined"==typeof performance||"function"!=typeof performance.getEntriesByName)return 0;const e=performance.getEntriesByName(this.#j);if(0===e.length)return 0;const t=e[e.length-1];return t.decodedBodySize||t.transferSize||0}_flushMutations(){this.#q&&this.#q.takeRecords()}_createObjectUrl(e){if(!(e instanceof Blob))throw new TypeError('The "blob" argument must be a Blob.');return this._revokeObjectUrl(),this.#W=URL.createObjectURL(e),this.#W}_revokeObjectUrl(){this.#W&&(URL.revokeObjectURL(this.#W),this.#W=null)}#be(){this.#B=new AbortController,this.#B.signal.addEventListener("abort",()=>this._abort(),{once:!0})}#je(){return{src:this.#j,type:"",width:0,height:0,duration:0,size:0,fromCache:!1,loadTime:0,timestamp:0,animation:null,httpHeaders:{}}}#me(){this.#G=!1,this.#K=null,this.#Q=0,this.#C=!1,this.#ie=!1,this.#ne=!1,this.#oe=null,this.#le={},this.#s=performance.now(),this.#D=0,this.#ue=this.#je()}#we(e){if(this.#z===e)return;const t=this.#z;this.#z=e,this.emit("statechange",{state:e,previous:t,src:this.#j})}#Ee(e){this.listenerCount("error")>0&&this.emit("error",e)}#fe(e){if(e===this.#j)return!1;const t=this.#j;return this.#j=e,this.#ue.src=e,this.emit("srcchange",{src:e,previousSrc:t}),!0}#de(){!this.#q&&"undefined"!=typeof MutationObserver&&this.#x&&(this.#q=new MutationObserver(e=>this.#ze(e)),this.#q.observe(this.#x,{attributes:!0,attributeFilter:this.#J?["src","original-src"]:["src"]}))}#Le(){this.#q&&(this.#q.disconnect(),this.#q=null)}#ze(e){const t=this.#x;if(!t)return;let r=null;for(const{attributeName:s}of e)"original-src"===s?r=t.getAttribute("original-src")??"":"src"===s&&null===r&&(r=t.getAttribute("src")??"");null!==r&&r!==this.#j&&r!==this.#K&&(this.#fe(r),this.#U&&this.reload().catch(e=>{this.listenerCount("error")>0&&this.emit("error",e)}))}#Te(){return{src:this.#j,fromCache:this.#C||this._detectCache(),loadTime:this.#D-this.#s,timestamp:Date.now(),animation:null,...this._getMetadataDetails(),...this.#le}}#ve(e){return this.#N<=0?e:new Promise((t,r)=>{this.#Y=setTimeout(()=>{this.#Y=null,this.#B&&this.#B.abort(),this.emit("timeout",{src:this.#j,timeout:this.#N}),r(new Error(`Media load timed out after ${this.#N}ms.`))},this.#N),e.then(e=>{null!==this.#Y&&clearTimeout(this.#Y),this.#Y=null,t(e)},e=>{null!==this.#Y&&clearTimeout(this.#Y),this.#Y=null,r(e)})})}_createElement(){throw new Error('The "_createElement" method must be implemented by a subclass.')}_startLoad(){throw new Error('The "_startLoad" method must be implemented by a subclass.')}_getMetadataDetails(){return{type:"",width:0,height:0,duration:0,size:0}}_abort(){this._revokeObjectUrl();const e=this.#x;if(!e)return;const t=e;"function"==typeof t.pause&&t.pause(),e.removeAttribute("src"),"function"==typeof t.load&&t.load(),this._setInternalSrc(null)}_cleanup(){}}const u=l;window.TinyMediaLoader=t.TinyMediaLoader})();
@@ -14,6 +14,7 @@ var mediaContent = require('./mediaContent.cjs');
14
14
  var promiseUtils = require('./promiseUtils.cjs');
15
15
  var browserDetector = require('./browserDetector.cjs');
16
16
  var jsonFilter = require('./jsonFilter.cjs');
17
+ var youtube = require('./media/youtube.cjs');
17
18
 
18
19
 
19
20
 
@@ -103,3 +104,7 @@ exports.isBrowserAgent = browserDetector.isBrowserAgent;
103
104
  exports.jsonFilter = jsonFilter.jsonFilter;
104
105
  exports.jsonFilterByKeys = jsonFilter.jsonFilterByKeys;
105
106
  exports.jsonFilterRecursive = jsonFilter.jsonFilterRecursive;
107
+ exports.assertYouTubeOEmbedResponse = youtube.assertYouTubeOEmbedResponse;
108
+ exports.extractYouTubeVideoId = youtube.extractYouTubeVideoId;
109
+ exports.fetchYouTubeOEmbed = youtube.fetchYouTubeOEmbed;
110
+ exports.getYouTubeThumbnailUrl = youtube.getYouTubeThumbnailUrl;
@@ -12,5 +12,6 @@ import { extractMediaId3Tags, parseMediaMetadata, valMediaContentMetadata, valFe
12
12
  import { createSingletonTask, waitForTrue } from './promiseUtils.mjs';
13
13
  import { browserIs, getBrowserCssPrefix, getBrowserPings, getDuckTyping, isBrowser, isBrowserAgent } from './browserDetector.mjs';
14
14
  import { jsonFilter, jsonFilterRecursive, jsonFilterByKeys } from './jsonFilter.mjs';
15
- export { isAnyClassInstance, isClass, isClassInstance, isBrowser, getObjTypeRegistry, getObjTypeOrder, jsonFilter, jsonFilterRecursive, jsonFilterByKeys, getUserTimeFormat, getBrowserPings, isBrowserAgent, getBrowserCssPrefix, getDuckTyping, browserIs, isValidObj, createSingletonTask, waitForTrue, multiplyArrayBlocks, valMediaContentMetadata, valFetchMediaContent, parseMediaMetadata, extractMediaId3Tags, hashText, diffObjList, diffArrayList, breakdownDuration, calculateMarketcap, compareMarketcap, getPercentage, areElsCollTop, areElsCollBottom, areElsCollLeft, areElsCollRight, areElsCollPerfTop, areElsCollPerfBottom, areElsCollPerfLeft, areElsCollPerfRight, areElsColliding, areElsPerfColliding, getElsColliding, getElsPerfColliding, getElsCollOverlap, getElsCollOverlapPos, getRectCenter, getElsRelativeCenterOffset, getElsCollDirDepth, getElsCollDetails, safeTextTrim, installWindowHiddenScript, genFibonacciSeq, fetchJson, fetchText, readJsonBlob, readFileBlob, readBase64Blob, saveJsonFile, documentIsFullScreen, isScreenFilled, requestFullScreen, exitFullScreen, isFullScreenMode, onFullScreenChange, offFullScreenChange, isJsonObject, arraySortPositions, formatBytes, addAiMarkerShortcut, extendObjType, reorderObjTypeOrder, cloneObjTypeOrder, countObj, isObjType, objTypeName, objType, ruleOfThree, getSimplePerc, asyncReplace, getAge, formatCustomTimer, formatDayTimer, formatTimer, getTimeDuration, shuffleArray, toTitleCase, toTitleCaseLowerFirst, };
15
+ import { getYouTubeThumbnailUrl, fetchYouTubeOEmbed, extractYouTubeVideoId, assertYouTubeOEmbedResponse } from './media/youtube.mjs';
16
+ export { getYouTubeThumbnailUrl, fetchYouTubeOEmbed, extractYouTubeVideoId, assertYouTubeOEmbedResponse, isAnyClassInstance, isClass, isClassInstance, isBrowser, getObjTypeRegistry, getObjTypeOrder, jsonFilter, jsonFilterRecursive, jsonFilterByKeys, getUserTimeFormat, getBrowserPings, isBrowserAgent, getBrowserCssPrefix, getDuckTyping, browserIs, isValidObj, createSingletonTask, waitForTrue, multiplyArrayBlocks, valMediaContentMetadata, valFetchMediaContent, parseMediaMetadata, extractMediaId3Tags, hashText, diffObjList, diffArrayList, breakdownDuration, calculateMarketcap, compareMarketcap, getPercentage, areElsCollTop, areElsCollBottom, areElsCollLeft, areElsCollRight, areElsCollPerfTop, areElsCollPerfBottom, areElsCollPerfLeft, areElsCollPerfRight, areElsColliding, areElsPerfColliding, getElsColliding, getElsPerfColliding, getElsCollOverlap, getElsCollOverlapPos, getRectCenter, getElsRelativeCenterOffset, getElsCollDirDepth, getElsCollDetails, safeTextTrim, installWindowHiddenScript, genFibonacciSeq, fetchJson, fetchText, readJsonBlob, readFileBlob, readBase64Blob, saveJsonFile, documentIsFullScreen, isScreenFilled, requestFullScreen, exitFullScreen, isFullScreenMode, onFullScreenChange, offFullScreenChange, isJsonObject, arraySortPositions, formatBytes, addAiMarkerShortcut, extendObjType, reorderObjTypeOrder, cloneObjTypeOrder, countObj, isObjType, objTypeName, objType, ruleOfThree, getSimplePerc, asyncReplace, getAge, formatCustomTimer, formatDayTimer, formatTimer, getTimeDuration, shuffleArray, toTitleCase, toTitleCaseLowerFirst, };
16
17
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../src/v1/basics/index.mjs"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACnG,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,cAAc,EACd,WAAW,EACX,eAAe,EACf,iBAAiB,EAClB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,SAAS,EACT,yBAAyB,EACzB,YAAY,EACZ,cAAc,EACd,SAAS,EACV,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,aAAa,EACb,mBAAmB,EACnB,iBAAiB,EACjB,OAAO,EACP,SAAS,EACT,WAAW,EACX,eAAe,EACf,kBAAkB,EACnB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,QAAQ,EACR,eAAe,EACf,kBAAkB,EAClB,OAAO,EACP,YAAY,EACZ,UAAU,EACX,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,oBAAoB,EACpB,cAAc,EACd,iBAAiB,EACjB,cAAc,EACd,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,WAAW,EACX,eAAe,EACf,MAAM,EACN,aAAa,EACb,aAAa,EACb,WAAW,EACZ,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,mBAAmB,EACnB,WAAW,EACX,YAAY,EACZ,WAAW,EACX,qBAAqB,EACrB,YAAY,EACb,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,iBAAiB,EACjB,oBAAoB,EACpB,kBAAkB,EAClB,mBAAmB,EACnB,eAAe,EACf,mBAAmB,EACnB,eAAe,EACf,mBAAmB,EACnB,iBAAiB,EACjB,oBAAoB,EACpB,aAAa,EACb,0BAA0B,EAC1B,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,uBAAuB,EACvB,oBAAoB,EACrB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtE,OAAO,EACL,SAAS,EACT,mBAAmB,EACnB,eAAe,EACf,aAAa,EACb,SAAS,EACT,cAAc,EACf,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAErF,OAAO,EACL,kBAAkB,EAClB,OAAO,EACP,eAAe,EACf,SAAS,EACT,kBAAkB,EAClB,eAAe,EACf,UAAU,EACV,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,EACf,cAAc,EACd,mBAAmB,EACnB,aAAa,EACb,SAAS,EACT,UAAU,EACV,mBAAmB,EACnB,WAAW,EACX,mBAAmB,EACnB,uBAAuB,EACvB,oBAAoB,EACpB,kBAAkB,EAClB,mBAAmB,EACnB,QAAQ,EACR,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,iBAAiB,EACjB,oBAAoB,EACpB,kBAAkB,EAClB,mBAAmB,EACnB,eAAe,EACf,mBAAmB,EACnB,eAAe,EACf,mBAAmB,EACnB,iBAAiB,EACjB,oBAAoB,EACpB,aAAa,EACb,0BAA0B,EAC1B,kBAAkB,EAClB,iBAAiB,EACjB,YAAY,EACZ,yBAAyB,EACzB,eAAe,EACf,SAAS,EACT,SAAS,EACT,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,YAAY,EACZ,oBAAoB,EACpB,cAAc,EACd,iBAAiB,EACjB,cAAc,EACd,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACnB,YAAY,EACZ,kBAAkB,EAClB,WAAW,EACX,mBAAmB,EACnB,aAAa,EACb,mBAAmB,EACnB,iBAAiB,EACjB,QAAQ,EACR,SAAS,EACT,WAAW,EACX,OAAO,EACP,WAAW,EACX,aAAa,EACb,YAAY,EACZ,MAAM,EACN,iBAAiB,EACjB,cAAc,EACd,WAAW,EACX,eAAe,EACf,YAAY,EACZ,WAAW,EACX,qBAAqB,GACtB,CAAC"}
1
+ {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../src/v1/basics/index.mjs"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACnG,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,cAAc,EACd,WAAW,EACX,eAAe,EACf,iBAAiB,EAClB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,SAAS,EACT,yBAAyB,EACzB,YAAY,EACZ,cAAc,EACd,SAAS,EACV,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,aAAa,EACb,mBAAmB,EACnB,iBAAiB,EACjB,OAAO,EACP,SAAS,EACT,WAAW,EACX,eAAe,EACf,kBAAkB,EACnB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,QAAQ,EACR,eAAe,EACf,kBAAkB,EAClB,OAAO,EACP,YAAY,EACZ,UAAU,EACX,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,oBAAoB,EACpB,cAAc,EACd,iBAAiB,EACjB,cAAc,EACd,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,WAAW,EACX,eAAe,EACf,MAAM,EACN,aAAa,EACb,aAAa,EACb,WAAW,EACZ,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,mBAAmB,EACnB,WAAW,EACX,YAAY,EACZ,WAAW,EACX,qBAAqB,EACrB,YAAY,EACb,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,iBAAiB,EACjB,oBAAoB,EACpB,kBAAkB,EAClB,mBAAmB,EACnB,eAAe,EACf,mBAAmB,EACnB,eAAe,EACf,mBAAmB,EACnB,iBAAiB,EACjB,oBAAoB,EACpB,aAAa,EACb,0BAA0B,EAC1B,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,uBAAuB,EACvB,oBAAoB,EACrB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtE,OAAO,EACL,SAAS,EACT,mBAAmB,EACnB,eAAe,EACf,aAAa,EACb,SAAS,EACT,cAAc,EACf,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACrF,OAAO,EACL,sBAAsB,EACtB,kBAAkB,EAClB,qBAAqB,EACrB,2BAA2B,EAC5B,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,sBAAsB,EACtB,kBAAkB,EAClB,qBAAqB,EACrB,2BAA2B,EAC3B,kBAAkB,EAClB,OAAO,EACP,eAAe,EACf,SAAS,EACT,kBAAkB,EAClB,eAAe,EACf,UAAU,EACV,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,EACf,cAAc,EACd,mBAAmB,EACnB,aAAa,EACb,SAAS,EACT,UAAU,EACV,mBAAmB,EACnB,WAAW,EACX,mBAAmB,EACnB,uBAAuB,EACvB,oBAAoB,EACpB,kBAAkB,EAClB,mBAAmB,EACnB,QAAQ,EACR,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,iBAAiB,EACjB,oBAAoB,EACpB,kBAAkB,EAClB,mBAAmB,EACnB,eAAe,EACf,mBAAmB,EACnB,eAAe,EACf,mBAAmB,EACnB,iBAAiB,EACjB,oBAAoB,EACpB,aAAa,EACb,0BAA0B,EAC1B,kBAAkB,EAClB,iBAAiB,EACjB,YAAY,EACZ,yBAAyB,EACzB,eAAe,EACf,SAAS,EACT,SAAS,EACT,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,YAAY,EACZ,oBAAoB,EACpB,cAAc,EACd,iBAAiB,EACjB,cAAc,EACd,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACnB,YAAY,EACZ,kBAAkB,EAClB,WAAW,EACX,mBAAmB,EACnB,aAAa,EACb,mBAAmB,EACnB,iBAAiB,EACjB,QAAQ,EACR,SAAS,EACT,WAAW,EACX,OAAO,EACP,WAAW,EACX,aAAa,EACb,YAAY,EACZ,MAAM,EACN,iBAAiB,EACjB,cAAc,EACd,WAAW,EACX,eAAe,EACf,YAAY,EACZ,WAAW,EACX,qBAAqB,GACtB,CAAC"}
@@ -12,4 +12,5 @@ import { extractMediaId3Tags, parseMediaMetadata, valMediaContentMetadata, valFe
12
12
  import { createSingletonTask, waitForTrue } from './promiseUtils.mjs';
13
13
  import { browserIs, getBrowserCssPrefix, getBrowserPings, getDuckTyping, isBrowser, isBrowserAgent, } from './browserDetector.mjs';
14
14
  import { jsonFilter, jsonFilterRecursive, jsonFilterByKeys } from './jsonFilter.mjs';
15
- export { isAnyClassInstance, isClass, isClassInstance, isBrowser, getObjTypeRegistry, getObjTypeOrder, jsonFilter, jsonFilterRecursive, jsonFilterByKeys, getUserTimeFormat, getBrowserPings, isBrowserAgent, getBrowserCssPrefix, getDuckTyping, browserIs, isValidObj, createSingletonTask, waitForTrue, multiplyArrayBlocks, valMediaContentMetadata, valFetchMediaContent, parseMediaMetadata, extractMediaId3Tags, hashText, diffObjList, diffArrayList, breakdownDuration, calculateMarketcap, compareMarketcap, getPercentage, areElsCollTop, areElsCollBottom, areElsCollLeft, areElsCollRight, areElsCollPerfTop, areElsCollPerfBottom, areElsCollPerfLeft, areElsCollPerfRight, areElsColliding, areElsPerfColliding, getElsColliding, getElsPerfColliding, getElsCollOverlap, getElsCollOverlapPos, getRectCenter, getElsRelativeCenterOffset, getElsCollDirDepth, getElsCollDetails, safeTextTrim, installWindowHiddenScript, genFibonacciSeq, fetchJson, fetchText, readJsonBlob, readFileBlob, readBase64Blob, saveJsonFile, documentIsFullScreen, isScreenFilled, requestFullScreen, exitFullScreen, isFullScreenMode, onFullScreenChange, offFullScreenChange, isJsonObject, arraySortPositions, formatBytes, addAiMarkerShortcut, extendObjType, reorderObjTypeOrder, cloneObjTypeOrder, countObj, isObjType, objTypeName, objType, ruleOfThree, getSimplePerc, asyncReplace, getAge, formatCustomTimer, formatDayTimer, formatTimer, getTimeDuration, shuffleArray, toTitleCase, toTitleCaseLowerFirst, };
15
+ import { getYouTubeThumbnailUrl, fetchYouTubeOEmbed, extractYouTubeVideoId, assertYouTubeOEmbedResponse, } from './media/youtube.mjs';
16
+ export { getYouTubeThumbnailUrl, fetchYouTubeOEmbed, extractYouTubeVideoId, assertYouTubeOEmbedResponse, isAnyClassInstance, isClass, isClassInstance, isBrowser, getObjTypeRegistry, getObjTypeOrder, jsonFilter, jsonFilterRecursive, jsonFilterByKeys, getUserTimeFormat, getBrowserPings, isBrowserAgent, getBrowserCssPrefix, getDuckTyping, browserIs, isValidObj, createSingletonTask, waitForTrue, multiplyArrayBlocks, valMediaContentMetadata, valFetchMediaContent, parseMediaMetadata, extractMediaId3Tags, hashText, diffObjList, diffArrayList, breakdownDuration, calculateMarketcap, compareMarketcap, getPercentage, areElsCollTop, areElsCollBottom, areElsCollLeft, areElsCollRight, areElsCollPerfTop, areElsCollPerfBottom, areElsCollPerfLeft, areElsCollPerfRight, areElsColliding, areElsPerfColliding, getElsColliding, getElsPerfColliding, getElsCollOverlap, getElsCollOverlapPos, getRectCenter, getElsRelativeCenterOffset, getElsCollDirDepth, getElsCollDetails, safeTextTrim, installWindowHiddenScript, genFibonacciSeq, fetchJson, fetchText, readJsonBlob, readFileBlob, readBase64Blob, saveJsonFile, documentIsFullScreen, isScreenFilled, requestFullScreen, exitFullScreen, isFullScreenMode, onFullScreenChange, offFullScreenChange, isJsonObject, arraySortPositions, formatBytes, addAiMarkerShortcut, extendObjType, reorderObjTypeOrder, cloneObjTypeOrder, countObj, isObjType, objTypeName, objType, ruleOfThree, getSimplePerc, asyncReplace, getAge, formatCustomTimer, formatDayTimer, formatTimer, getTimeDuration, shuffleArray, toTitleCase, toTitleCaseLowerFirst, };