wavesurfer.js 6.2.0 → 6.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/CHANGES.md +8 -0
  2. package/LICENSE +1 -1
  3. package/README.md +0 -10
  4. package/dist/plugin/wavesurfer.cursor.js +1 -1
  5. package/dist/plugin/wavesurfer.cursor.min.js +1 -1
  6. package/dist/plugin/wavesurfer.cursor.min.js.map +1 -1
  7. package/dist/plugin/wavesurfer.elan.js +1 -1
  8. package/dist/plugin/wavesurfer.elan.min.js +1 -1
  9. package/dist/plugin/wavesurfer.elan.min.js.map +1 -1
  10. package/dist/plugin/wavesurfer.markers.js +41 -6
  11. package/dist/plugin/wavesurfer.markers.js.map +1 -1
  12. package/dist/plugin/wavesurfer.markers.min.js +2 -2
  13. package/dist/plugin/wavesurfer.markers.min.js.map +1 -1
  14. package/dist/plugin/wavesurfer.mediasession.js +1 -1
  15. package/dist/plugin/wavesurfer.mediasession.min.js +1 -1
  16. package/dist/plugin/wavesurfer.mediasession.min.js.map +1 -1
  17. package/dist/plugin/wavesurfer.microphone.js +1 -1
  18. package/dist/plugin/wavesurfer.microphone.min.js +1 -1
  19. package/dist/plugin/wavesurfer.microphone.min.js.map +1 -1
  20. package/dist/plugin/wavesurfer.minimap.js +1 -1
  21. package/dist/plugin/wavesurfer.minimap.min.js +1 -1
  22. package/dist/plugin/wavesurfer.minimap.min.js.map +1 -1
  23. package/dist/plugin/wavesurfer.playhead.js +1 -1
  24. package/dist/plugin/wavesurfer.playhead.min.js +1 -1
  25. package/dist/plugin/wavesurfer.playhead.min.js.map +1 -1
  26. package/dist/plugin/wavesurfer.regions.js +2 -2
  27. package/dist/plugin/wavesurfer.regions.js.map +1 -1
  28. package/dist/plugin/wavesurfer.regions.min.js +2 -2
  29. package/dist/plugin/wavesurfer.regions.min.js.map +1 -1
  30. package/dist/plugin/wavesurfer.spectrogram.js +2 -2
  31. package/dist/plugin/wavesurfer.spectrogram.js.map +1 -1
  32. package/dist/plugin/wavesurfer.spectrogram.min.js +2 -2
  33. package/dist/plugin/wavesurfer.spectrogram.min.js.map +1 -1
  34. package/dist/plugin/wavesurfer.timeline.js +1 -1
  35. package/dist/plugin/wavesurfer.timeline.min.js +1 -1
  36. package/dist/plugin/wavesurfer.timeline.min.js.map +1 -1
  37. package/dist/wavesurfer-html-init.js +1 -1
  38. package/dist/wavesurfer-html-init.js.map +1 -1
  39. package/dist/wavesurfer-html-init.min.js +1 -1
  40. package/dist/wavesurfer-html-init.min.js.map +1 -1
  41. package/dist/wavesurfer.js +32 -29
  42. package/dist/wavesurfer.js.map +1 -1
  43. package/dist/wavesurfer.min.js +2 -2
  44. package/dist/wavesurfer.min.js.map +1 -1
  45. package/package.json +18 -19
  46. package/src/drawer.multicanvas.js +4 -4
  47. package/src/plugin/markers/index.js +31 -5
  48. package/src/plugin/regions/index.js +1 -1
  49. package/src/plugin/spectrogram/index.js +1 -1
  50. package/src/wavesurfer.js +12 -9
@@ -1 +1 @@
1
- {"version":3,"file":"wavesurfer.timeline.min.js","mappings":";;;;;CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,aAAc,GAAIH,GACC,iBAAZC,QACdA,QAAoB,WAAID,KAExBD,EAAiB,WAAIA,EAAiB,YAAK,GAAIA,EAAiB,WAAY,SAAIC,KARlF,CASGK,MAAM,IACT,M,oYCiDqBC,EAAAA,WAiEjB,WAAYC,EAAQC,GAAI,WAMpB,G,4FANoB,6BA7CZ,WACJ,EAAKC,SAAW,EAAKC,OAAOD,UAC5B,EAAKA,QAAQE,WAAa,EAAKD,OAAOD,QAAQE,eA2C9B,oBApCZ,kBAAM,EAAKC,YAoCC,mBAlCb,WACP,IAAMJ,EAAK,EAAKK,WAChB,EAAKH,OAASF,EAAGE,OACjB,EAAKI,WAAaN,EAAGE,OAAOH,O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GC,GACd,IAAIU,EACAC,EAAU,EAEdlH,KAAK6B,SAAS2C,SAAQ,SAAAZ,GAClB,IAAMuC,EAAUvC,EAAOwC,WAAW,MAClC,GAAID,EAAS,CACT,IAAMzB,EAAcyB,EAAQvC,OAAO5E,MAEnC,GAAIkI,EAAUZ,EAAIW,EACd,OAGAC,EAAUxC,EAAc4B,GAAKH,IAC7Bc,EAAYd,EAAQgB,YAAYH,GAAMhI,MACtCmH,EAAQF,SAASe,EAAMV,EAAIY,EAASX,IAGxCW,GAAWxC,Q,uCAYvB,SAA0B0C,EAASC,GAC/B,GAAID,EAAU,GAAK,EAAG,CAElB,IAAME,EAAUvC,SAASqC,EAAU,GAAI,IAIvC,OADAA,GAFAA,EAAUrC,SAASqC,EAAU,GAAI,KAEb,GAAK,IAAMA,EAAUA,EAClC,GAAP,OAAUE,EAAV,YAAqBF,GAEzB,OAAOlI,KAAKC,MAAgB,IAAViI,GAAkB,M,iCASxC,SAAoBC,GAChB,OAAIA,GAAY,GACL,EACW,EAAXA,GAAgB,GAChB,EACW,GAAXA,GAAiB,GACjB,GAEwB,GAA5BnI,KAAKiF,KAAK,GAAMkD,K,yCAS3B,SAA4BA,GACxB,OAAIA,GAAY,GACL,GACW,EAAXA,GAAgB,GAChB,EAEA,I,2CAWf,SAA8BA,GAC1B,OAAIA,GAAY,GACL,EAEA,O,gFAthBE/I,G,kCC1DjBiJ,EAA2B,GCE/B,IAAIC,EDCJ,SAASC,EAAoBC,GAE5B,IAAIC,EAAeJ,EAAyBG,GAC5C,QAAqBE,IAAjBD,EACH,OAAOA,EAAa1J,QAGrB,IAAIC,EAASqJ,EAAyBG,GAAY,CAGjDzJ,QAAS,IAOV,OAHA4J,EAAoBH,GAAUxJ,EAAQA,EAAOD,QAASwJ,GAG/CvJ,EAAOD,QClBWwJ,CAAoB,K,UHO9C","sources":["webpack://WaveSurfer/webpack/universalModuleDefinition","webpack://WaveSurfer/./src/plugin/timeline/index.js","webpack://WaveSurfer/webpack/bootstrap","webpack://WaveSurfer/webpack/startup"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"WaveSurfer\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"WaveSurfer\"] = factory();\n\telse\n\t\troot[\"WaveSurfer\"] = root[\"WaveSurfer\"] || {}, root[\"WaveSurfer\"][\"timeline\"] = factory();\n})(self, () => {\nreturn ","/**\n * @typedef {Object} TimelinePluginParams\n * @desc Extends the `WavesurferParams` wavesurfer was initialised with\n * @property {!string|HTMLElement} container CSS selector or HTML element where\n * the timeline should be drawn. This is the only required parameter.\n * @property {number} notchPercentHeight=90 Height of notches in percent\n * @property {string} unlabeledNotchColor='#c0c0c0' The colour of the notches\n * that do not have labels\n * @property {string} primaryColor='#000' The colour of the main notches\n * @property {string} secondaryColor='#c0c0c0' The colour of the secondary\n * notches\n * @property {string} primaryFontColor='#000' The colour of the labels next to\n * the main notches\n * @property {string} secondaryFontColor='#000' The colour of the labels next to\n * the secondary notches\n * @property {number} labelPadding=5 The padding between the label and the notch\n * @property {?number} zoomDebounce A debounce timeout to increase rendering\n * performance for large files\n * @property {string} fontFamily='Arial'\n * @property {number} fontSize=10 Font size of labels in pixels\n * @property {?number} duration Length of the track in seconds. Overrides\n * getDuration() for setting length of timeline\n * @property {function} formatTimeCallback (sec, pxPerSec) -> label\n * @property {function} timeInterval (pxPerSec) -> seconds between notches\n * @property {function} primaryLabelInterval (pxPerSec) -> cadence between\n * labels in primary color\n * @property {function} secondaryLabelInterval (pxPerSec) -> cadence between\n * labels in secondary color\n * @property {?number} offset Offset for the timeline start in seconds. May also be\n * negative.\n * @property {?boolean} deferInit Set to true to manually call\n * `initPlugin('timeline')`\n */\n\n/**\n * Adds a timeline to the waveform.\n *\n * @implements {PluginClass}\n * @extends {Observer}\n * @example\n * // es6\n * import TimelinePlugin from 'wavesurfer.timeline.js';\n *\n * // commonjs\n * var TimelinePlugin = require('wavesurfer.timeline.js');\n *\n * // if you are using <script> tags\n * var TimelinePlugin = window.WaveSurfer.timeline;\n *\n * // ... initialising wavesurfer with the plugin\n * var wavesurfer = WaveSurfer.create({\n * // wavesurfer options ...\n * plugins: [\n * TimelinePlugin.create({\n * // plugin options ...\n * })\n * ]\n * });\n */\nexport default class TimelinePlugin {\n /**\n * Timeline plugin definition factory\n *\n * This function must be used to create a plugin definition which can be\n * used by wavesurfer to correctly instantiate the plugin.\n *\n * @param {TimelinePluginParams} params parameters use to initialise the plugin\n * @return {PluginDefinition} an object representing the plugin\n */\n static create(params) {\n return {\n name: 'timeline',\n deferInit: params && params.deferInit ? params.deferInit : false,\n params: params,\n instance: TimelinePlugin\n };\n }\n\n // event handlers\n _onScroll = () => {\n if (this.wrapper && this.drawer.wrapper) {\n this.wrapper.scrollLeft = this.drawer.wrapper.scrollLeft;\n }\n };\n\n /**\n * @returns {void}\n */\n _onRedraw = () => this.render();\n\n _onReady = () => {\n const ws = this.wavesurfer;\n this.drawer = ws.drawer;\n this.pixelRatio = ws.drawer.params.pixelRatio;\n this.maxCanvasWidth = ws.drawer.maxCanvasWidth || ws.drawer.width;\n this.maxCanvasElementWidth =\n ws.drawer.maxCanvasElementWidth ||\n Math.round(this.maxCanvasWidth / this.pixelRatio);\n\n // add listeners\n ws.drawer.wrapper.addEventListener('scroll', this._onScroll);\n ws.on('redraw', this._onRedraw);\n ws.on('zoom', this._onZoom);\n\n this.render();\n };\n\n /**\n * @param {object} e Click event\n */\n _onWrapperClick = e => {\n e.preventDefault();\n const relX = 'offsetX' in e ? e.offsetX : e.layerX;\n this.fireEvent('click', relX / this.wrapper.scrollWidth || 0);\n };\n\n /**\n * Creates an instance of TimelinePlugin.\n *\n * You probably want to use TimelinePlugin.create()\n *\n * @param {TimelinePluginParams} params Plugin parameters\n * @param {object} ws Wavesurfer instance\n */\n constructor(params, ws) {\n this.container =\n 'string' == typeof params.container\n ? document.querySelector(params.container)\n : params.container;\n\n if (!this.container) {\n throw new Error('No container for wavesurfer timeline');\n }\n\n this.wavesurfer = ws;\n this.util = ws.util;\n this.params = Object.assign(\n {},\n {\n height: 20,\n notchPercentHeight: 90,\n labelPadding: 5,\n unlabeledNotchColor: '#c0c0c0',\n primaryColor: '#000',\n secondaryColor: '#c0c0c0',\n primaryFontColor: '#000',\n secondaryFontColor: '#000',\n fontFamily: 'Arial',\n fontSize: 10,\n duration: null,\n zoomDebounce: false,\n formatTimeCallback: this.defaultFormatTimeCallback,\n timeInterval: this.defaultTimeInterval,\n primaryLabelInterval: this.defaultPrimaryLabelInterval,\n secondaryLabelInterval: this.defaultSecondaryLabelInterval,\n offset: 0\n },\n params\n );\n\n this.canvases = [];\n this.wrapper = null;\n this.drawer = null;\n this.pixelRatio = null;\n this.maxCanvasWidth = null;\n this.maxCanvasElementWidth = null;\n /**\n * This event handler has to be in the constructor function because it\n * relies on the debounce function which is only available after\n * instantiation\n *\n * Use a debounced function if `params.zoomDebounce` is defined\n *\n * @returns {void}\n */\n this._onZoom = this.params.zoomDebounce\n ? this.wavesurfer.util.debounce(\n () => this.render(),\n this.params.zoomDebounce\n )\n : () => this.render();\n }\n\n /**\n * Initialisation function used by the plugin API\n */\n init() {\n // Check if ws is ready\n if (this.wavesurfer.isReady) {\n this._onReady();\n } else {\n this.wavesurfer.once('ready', this._onReady);\n }\n }\n\n /**\n * Destroy function used by the plugin API\n */\n destroy() {\n this.unAll();\n this.wavesurfer.un('redraw', this._onRedraw);\n this.wavesurfer.un('zoom', this._onZoom);\n this.wavesurfer.un('ready', this._onReady);\n this.wavesurfer.drawer.wrapper.removeEventListener(\n 'scroll',\n this._onScroll\n );\n if (this.wrapper && this.wrapper.parentNode) {\n this.wrapper.removeEventListener('click', this._onWrapperClick);\n this.wrapper.parentNode.removeChild(this.wrapper);\n this.wrapper = null;\n }\n }\n\n /**\n * Create a timeline element to wrap the canvases drawn by this plugin\n *\n */\n createWrapper() {\n const wsParams = this.wavesurfer.params;\n this.container.innerHTML = '';\n this.wrapper = this.container.appendChild(\n document.createElement('timeline')\n );\n this.util.style(this.wrapper, {\n display: 'block',\n position: 'relative',\n userSelect: 'none',\n webkitUserSelect: 'none',\n height: `${this.params.height}px`\n });\n\n if (wsParams.fillParent || wsParams.scrollParent) {\n this.util.style(this.wrapper, {\n width: '100%',\n overflowX: 'hidden',\n overflowY: 'hidden'\n });\n }\n\n this.wrapper.addEventListener('click', this._onWrapperClick);\n }\n\n /**\n * Render the timeline (also updates the already rendered timeline)\n *\n */\n render() {\n if (!this.wrapper) {\n this.createWrapper();\n }\n this.updateCanvases();\n this.updateCanvasesPositioning();\n this.renderCanvases();\n }\n\n /**\n * Add new timeline canvas\n *\n */\n addCanvas() {\n const canvas = this.wrapper.appendChild(\n document.createElement('canvas')\n );\n this.canvases.push(canvas);\n this.util.style(canvas, {\n position: 'absolute',\n zIndex: 4\n });\n }\n\n /**\n * Remove timeline canvas\n *\n */\n removeCanvas() {\n const canvas = this.canvases.pop();\n canvas.parentElement.removeChild(canvas);\n }\n\n /**\n * Make sure the correct of timeline canvas elements exist and are cached in\n * this.canvases\n *\n */\n updateCanvases() {\n const totalWidth = Math.round(this.drawer.wrapper.scrollWidth);\n const requiredCanvases = Math.ceil(\n totalWidth / this.maxCanvasElementWidth\n );\n\n while (this.canvases.length < requiredCanvases) {\n this.addCanvas();\n }\n\n while (this.canvases.length > requiredCanvases) {\n this.removeCanvas();\n }\n }\n\n /**\n * Update the dimensions and positioning style for all the timeline canvases\n *\n */\n updateCanvasesPositioning() {\n // cache length for performance\n const canvasesLength = this.canvases.length;\n this.canvases.forEach((canvas, i) => {\n // canvas width is the max element width, or if it is the last the\n // required width\n const canvasWidth =\n i === canvasesLength - 1\n ? this.drawer.wrapper.scrollWidth -\n this.maxCanvasElementWidth * (canvasesLength - 1)\n : this.maxCanvasElementWidth;\n // set dimensions and style\n canvas.width = canvasWidth * this.pixelRatio;\n // on certain pixel ratios the canvas appears cut off at the bottom,\n // therefore leave 1px extra\n canvas.height = (this.params.height + 1) * this.pixelRatio;\n this.util.style(canvas, {\n width: `${canvasWidth}px`,\n height: `${this.params.height}px`,\n left: `${i * this.maxCanvasElementWidth}px`\n });\n });\n }\n\n /**\n * Render the timeline labels and notches\n *\n */\n renderCanvases() {\n const duration =\n this.params.duration ||\n this.wavesurfer.backend.getDuration();\n\n if (duration <= 0) {\n return;\n }\n const wsParams = this.wavesurfer.params;\n const fontSize = this.params.fontSize * wsParams.pixelRatio;\n const totalSeconds = parseInt(duration, 10) + 1;\n const width =\n wsParams.fillParent && !wsParams.scrollParent\n ? this.drawer.getWidth()\n : this.drawer.wrapper.scrollWidth * wsParams.pixelRatio;\n const height1 = this.params.height * this.pixelRatio;\n const height2 =\n this.params.height *\n (this.params.notchPercentHeight / 100) *\n this.pixelRatio;\n const pixelsPerSecond = width / duration;\n\n const formatTime = this.params.formatTimeCallback;\n // if parameter is function, call the function with\n // pixelsPerSecond, otherwise simply take the value as-is\n const intervalFnOrVal = option =>\n typeof option === 'function' ? option(pixelsPerSecond) : option;\n const timeInterval = intervalFnOrVal(this.params.timeInterval);\n const primaryLabelInterval = intervalFnOrVal(\n this.params.primaryLabelInterval\n );\n const secondaryLabelInterval = intervalFnOrVal(\n this.params.secondaryLabelInterval\n );\n\n let curPixel = pixelsPerSecond * this.params.offset;\n let curSeconds = 0;\n let i;\n // build an array of position data with index, second and pixel data,\n // this is then used multiple times below\n const positioning = [];\n\n // render until end in case we have a negative offset\n const renderSeconds = (this.params.offset < 0)\n ? totalSeconds - this.params.offset\n : totalSeconds;\n\n for (i = 0; i < renderSeconds / timeInterval; i++) {\n positioning.push([i, curSeconds, curPixel]);\n curSeconds += timeInterval;\n curPixel += pixelsPerSecond * timeInterval;\n }\n\n // iterate over each position\n const renderPositions = cb => {\n positioning.forEach(pos => {\n cb(pos[0], pos[1], pos[2]);\n });\n };\n\n // render primary labels\n this.setFillStyles(this.params.primaryColor);\n this.setFonts(`${fontSize}px ${this.params.fontFamily}`);\n this.setFillStyles(this.params.primaryFontColor);\n renderPositions((i, curSeconds, curPixel) => {\n if (i % primaryLabelInterval === 0) {\n this.fillRect(curPixel, 0, 1, height1);\n this.fillText(\n formatTime(curSeconds, pixelsPerSecond),\n curPixel + this.params.labelPadding * this.pixelRatio,\n height1\n );\n }\n });\n\n // render secondary labels\n this.setFillStyles(this.params.secondaryColor);\n this.setFonts(`${fontSize}px ${this.params.fontFamily}`);\n this.setFillStyles(this.params.secondaryFontColor);\n renderPositions((i, curSeconds, curPixel) => {\n if (i % secondaryLabelInterval === 0) {\n this.fillRect(curPixel, 0, 1, height1);\n this.fillText(\n formatTime(curSeconds, pixelsPerSecond),\n curPixel + this.params.labelPadding * this.pixelRatio,\n height1\n );\n }\n });\n\n // render the actual notches (when no labels are used)\n this.setFillStyles(this.params.unlabeledNotchColor);\n renderPositions((i, curSeconds, curPixel) => {\n if (\n i % secondaryLabelInterval !== 0 &&\n i % primaryLabelInterval !== 0\n ) {\n this.fillRect(curPixel, 0, 1, height2);\n }\n });\n }\n\n /**\n * Set the canvas fill style\n *\n * @param {DOMString|CanvasGradient|CanvasPattern} fillStyle Fill style to\n * use\n */\n setFillStyles(fillStyle) {\n this.canvases.forEach(canvas => {\n const context = canvas.getContext('2d');\n if (context) {\n context.fillStyle = fillStyle;\n }\n });\n }\n\n /**\n * Set the canvas font\n *\n * @param {DOMString} font Font to use\n */\n setFonts(font) {\n this.canvases.forEach(canvas => {\n const context = canvas.getContext('2d');\n if (context) {\n context.font = font;\n }\n });\n }\n\n /**\n * Draw a rectangle on the canvases\n *\n * (it figures out the offset for each canvas)\n *\n * @param {number} x X-position\n * @param {number} y Y-position\n * @param {number} width Width\n * @param {number} height Height\n */\n fillRect(x, y, width, height) {\n this.canvases.forEach((canvas, i) => {\n const leftOffset = i * this.maxCanvasWidth;\n\n const intersection = {\n x1: Math.max(x, i * this.maxCanvasWidth),\n y1: y,\n x2: Math.min(x + width, i * this.maxCanvasWidth + canvas.width),\n y2: y + height\n };\n\n if (intersection.x1 < intersection.x2) {\n const context = canvas\n .getContext('2d');\n if (context) {\n context\n .fillRect(\n intersection.x1 - leftOffset,\n intersection.y1,\n intersection.x2 - intersection.x1,\n intersection.y2 - intersection.y1\n );\n }\n }\n });\n }\n\n /**\n * Fill a given text on the canvases\n *\n * @param {string} text Text to render\n * @param {number} x X-position\n * @param {number} y Y-position\n */\n fillText(text, x, y) {\n let textWidth;\n let xOffset = 0;\n\n this.canvases.forEach(canvas => {\n const context = canvas.getContext('2d');\n if (context) {\n const canvasWidth = context.canvas.width;\n\n if (xOffset > x + textWidth) {\n return;\n }\n\n if (xOffset + canvasWidth > x && context) {\n textWidth = context.measureText(text).width;\n context.fillText(text, x - xOffset, y);\n }\n\n xOffset += canvasWidth;\n }\n });\n }\n\n /**\n * Turn the time into a suitable label for the time.\n *\n * @param {number} seconds Seconds to format\n * @param {number} pxPerSec Pixels per second\n * @returns {number} Time\n */\n defaultFormatTimeCallback(seconds, pxPerSec) {\n if (seconds / 60 > 1) {\n // calculate minutes and seconds from seconds count\n const minutes = parseInt(seconds / 60, 10);\n seconds = parseInt(seconds % 60, 10);\n // fill up seconds with zeroes\n seconds = seconds < 10 ? '0' + seconds : seconds;\n return `${minutes}:${seconds}`;\n }\n return Math.round(seconds * 1000) / 1000;\n }\n\n /**\n * Return how many seconds should be between each notch\n *\n * @param {number} pxPerSec Pixels per second\n * @returns {number} Time\n */\n defaultTimeInterval(pxPerSec) {\n if (pxPerSec >= 25) {\n return 1;\n } else if (pxPerSec * 5 >= 25) {\n return 5;\n } else if (pxPerSec * 15 >= 25) {\n return 15;\n }\n return Math.ceil(0.5 / pxPerSec) * 60;\n }\n\n /**\n * Return the cadence of notches that get labels in the primary color.\n *\n * @param {number} pxPerSec Pixels per second\n * @returns {number} Cadence\n */\n defaultPrimaryLabelInterval(pxPerSec) {\n if (pxPerSec >= 25) {\n return 10;\n } else if (pxPerSec * 5 >= 25) {\n return 6;\n } else if (pxPerSec * 15 >= 25) {\n return 4;\n }\n return 4;\n }\n\n /**\n * Return the cadence of notches that get labels in the secondary color.\n *\n * @param {number} pxPerSec Pixels per second\n * @returns {number} Cadence\n */\n defaultSecondaryLabelInterval(pxPerSec) {\n if (pxPerSec >= 25) {\n return 5;\n } else if (pxPerSec * 5 >= 25) {\n return 2;\n } else if (pxPerSec * 15 >= 25) {\n return 2;\n }\n return 2;\n }\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(171);\n"],"names":["root","factory","exports","module","define","amd","self","TimelinePlugin","params","ws","wrapper","drawer","scrollLeft","render","wavesurfer","pixelRatio","maxCanvasWidth","width","maxCanvasElementWidth","Math","round","addEventListener","_onScroll","on","_onRedraw","_onZoom","e","preventDefault","relX","offsetX","layerX","fireEvent","scrollWidth","this","container","document","querySelector","Error","util","Object","assign","height","notchPercentHeight","labelPadding","unlabeledNotchColor","primaryColor","secondaryColor","primaryFontColor","secondaryFontColor","fontFamily","fontSize","duration","zoomDebounce","formatTimeCallback","defaultFormatTimeCallback","timeInterval","defaultTimeInterval","primaryLabelInterval","defaultPrimaryLabelInterval","secondaryLabelInterval","defaultSecondaryLabelInterval","offset","canvases","debounce","name","deferInit","instance","isReady","_onReady","once","unAll","un","removeEventListener","parentNode","_onWrapperClick","removeChild","wsParams","innerHTML","appendChild","createElement","style","display","position","userSelect","webkitUserSelect","fillParent","scrollParent","overflowX","overflowY","createWrapper","updateCanvases","updateCanvasesPositioning","renderCanvases","canvas","push","zIndex","pop","parentElement","totalWidth","requiredCanvases","ceil","length","addCanvas","removeCanvas","canvasesLength","forEach","i","canvasWidth","left","backend","getDuration","totalSeconds","parseInt","getWidth","height1","height2","pixelsPerSecond","formatTime","intervalFnOrVal","option","curPixel","curSeconds","positioning","renderSeconds","renderPositions","cb","pos","setFillStyles","setFonts","fillRect","fillText","fillStyle","context","getContext","font","x","y","leftOffset","intersection","x1","max","y1","x2","min","y2","text","textWidth","xOffset","measureText","seconds","pxPerSec","minutes","__webpack_module_cache__","__webpack_exports__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__"],"sourceRoot":""}
1
+ {"version":3,"file":"wavesurfer.timeline.min.js","mappings":";;;;;CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,aAAc,GAAIH,GACC,iBAAZC,QACdA,QAAoB,WAAID,KAExBD,EAAiB,WAAIA,EAAiB,YAAK,CAAC,EAAGA,EAAiB,WAAY,SAAIC,IACjF,CATD,CASGK,MAAM,IACT,M,oYCiDqBC,EAAAA,WAiEjB,WAAYC,EAAQC,GAAI,WAMpB,G,4FANoB,6BA7CZ,WACJ,EAAKC,SAAW,EAAKC,OAAOD,UAC5B,EAAKA,QAAQE,WAAa,EAAKD,OAAOD,QAAQE,WAErD,IAyCuB,oBApCZ,kBAAM,EAAKC,QAAX,IAoCY,mBAlCb,WACP,IAAMJ,EAAK,EAAKK,WAChB,EAAKH,OAASF,EAAGE,OACjB,EAAKI,WAAaN,EAAGE,OAAOH,OAAOO,WACnC,EAAKC,eAAiBP,EAAGE,OAAOK,gBAAkBP,EAAGE,OAAOM,MAC5D,EAAKC,sBACDT,EAAGE,OAAOO,uBACVC,KAAKC,MAAM,EAAKJ,eAAiB,EAAKD,YAG1CN,E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ack://WaveSurfer/webpack/universalModuleDefinition","webpack://WaveSurfer/./src/plugin/timeline/index.js","webpack://WaveSurfer/webpack/bootstrap","webpack://WaveSurfer/webpack/startup"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"WaveSurfer\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"WaveSurfer\"] = factory();\n\telse\n\t\troot[\"WaveSurfer\"] = root[\"WaveSurfer\"] || {}, root[\"WaveSurfer\"][\"timeline\"] = factory();\n})(self, () => {\nreturn ","/**\n * @typedef {Object} TimelinePluginParams\n * @desc Extends the `WavesurferParams` wavesurfer was initialised with\n * @property {!string|HTMLElement} container CSS selector or HTML element where\n * the timeline should be drawn. This is the only required parameter.\n * @property {number} notchPercentHeight=90 Height of notches in percent\n * @property {string} unlabeledNotchColor='#c0c0c0' The colour of the notches\n * that do not have labels\n * @property {string} primaryColor='#000' The colour of the main notches\n * @property {string} secondaryColor='#c0c0c0' The colour of the secondary\n * notches\n * @property {string} primaryFontColor='#000' The colour of the labels next to\n * the main notches\n * @property {string} secondaryFontColor='#000' The colour of the labels next to\n * the secondary notches\n * @property {number} labelPadding=5 The padding between the label and the notch\n * @property {?number} zoomDebounce A debounce timeout to increase rendering\n * performance for large files\n * @property {string} fontFamily='Arial'\n * @property {number} fontSize=10 Font size of labels in pixels\n * @property {?number} duration Length of the track in seconds. Overrides\n * getDuration() for setting length of timeline\n * @property {function} formatTimeCallback (sec, pxPerSec) -> label\n * @property {function} timeInterval (pxPerSec) -> seconds between notches\n * @property {function} primaryLabelInterval (pxPerSec) -> cadence between\n * labels in primary color\n * @property {function} secondaryLabelInterval (pxPerSec) -> cadence between\n * labels in secondary color\n * @property {?number} offset Offset for the timeline start in seconds. May also be\n * negative.\n * @property {?boolean} deferInit Set to true to manually call\n * `initPlugin('timeline')`\n */\n\n/**\n * Adds a timeline to the waveform.\n *\n * @implements {PluginClass}\n * @extends {Observer}\n * @example\n * // es6\n * import TimelinePlugin from 'wavesurfer.timeline.js';\n *\n * // commonjs\n * var TimelinePlugin = require('wavesurfer.timeline.js');\n *\n * // if you are using <script> tags\n * var TimelinePlugin = window.WaveSurfer.timeline;\n *\n * // ... initialising wavesurfer with the plugin\n * var wavesurfer = WaveSurfer.create({\n * // wavesurfer options ...\n * plugins: [\n * TimelinePlugin.create({\n * // plugin options ...\n * })\n * ]\n * });\n */\nexport default class TimelinePlugin {\n /**\n * Timeline plugin definition factory\n *\n * This function must be used to create a plugin definition which can be\n * used by wavesurfer to correctly instantiate the plugin.\n *\n * @param {TimelinePluginParams} params parameters use to initialise the plugin\n * @return {PluginDefinition} an object representing the plugin\n */\n static create(params) {\n return {\n name: 'timeline',\n deferInit: params && params.deferInit ? params.deferInit : false,\n params: params,\n instance: TimelinePlugin\n };\n }\n\n // event handlers\n _onScroll = () => {\n if (this.wrapper && this.drawer.wrapper) {\n this.wrapper.scrollLeft = this.drawer.wrapper.scrollLeft;\n }\n };\n\n /**\n * @returns {void}\n */\n _onRedraw = () => this.render();\n\n _onReady = () => {\n const ws = this.wavesurfer;\n this.drawer = ws.drawer;\n this.pixelRatio = ws.drawer.params.pixelRatio;\n this.maxCanvasWidth = ws.drawer.maxCanvasWidth || ws.drawer.width;\n this.maxCanvasElementWidth =\n ws.drawer.maxCanvasElementWidth ||\n Math.round(this.maxCanvasWidth / this.pixelRatio);\n\n // add listeners\n ws.drawer.wrapper.addEventListener('scroll', this._onScroll);\n ws.on('redraw', this._onRedraw);\n ws.on('zoom', this._onZoom);\n\n this.render();\n };\n\n /**\n * @param {object} e Click event\n */\n _onWrapperClick = e => {\n e.preventDefault();\n const relX = 'offsetX' in e ? e.offsetX : e.layerX;\n this.fireEvent('click', relX / this.wrapper.scrollWidth || 0);\n };\n\n /**\n * Creates an instance of TimelinePlugin.\n *\n * You probably want to use TimelinePlugin.create()\n *\n * @param {TimelinePluginParams} params Plugin parameters\n * @param {object} ws Wavesurfer instance\n */\n constructor(params, ws) {\n this.container =\n 'string' == typeof params.container\n ? document.querySelector(params.container)\n : params.container;\n\n if (!this.container) {\n throw new Error('No container for wavesurfer timeline');\n }\n\n this.wavesurfer = ws;\n this.util = ws.util;\n this.params = Object.assign(\n {},\n {\n height: 20,\n notchPercentHeight: 90,\n labelPadding: 5,\n unlabeledNotchColor: '#c0c0c0',\n primaryColor: '#000',\n secondaryColor: '#c0c0c0',\n primaryFontColor: '#000',\n secondaryFontColor: '#000',\n fontFamily: 'Arial',\n fontSize: 10,\n duration: null,\n zoomDebounce: false,\n formatTimeCallback: this.defaultFormatTimeCallback,\n timeInterval: this.defaultTimeInterval,\n primaryLabelInterval: this.defaultPrimaryLabelInterval,\n secondaryLabelInterval: this.defaultSecondaryLabelInterval,\n offset: 0\n },\n params\n );\n\n this.canvases = [];\n this.wrapper = null;\n this.drawer = null;\n this.pixelRatio = null;\n this.maxCanvasWidth = null;\n this.maxCanvasElementWidth = null;\n /**\n * This event handler has to be in the constructor function because it\n * relies on the debounce function which is only available after\n * instantiation\n *\n * Use a debounced function if `params.zoomDebounce` is defined\n *\n * @returns {void}\n */\n this._onZoom = this.params.zoomDebounce\n ? this.wavesurfer.util.debounce(\n () => this.render(),\n this.params.zoomDebounce\n )\n : () => this.render();\n }\n\n /**\n * Initialisation function used by the plugin API\n */\n init() {\n // Check if ws is ready\n if (this.wavesurfer.isReady) {\n this._onReady();\n } else {\n this.wavesurfer.once('ready', this._onReady);\n }\n }\n\n /**\n * Destroy function used by the plugin API\n */\n destroy() {\n this.unAll();\n this.wavesurfer.un('redraw', this._onRedraw);\n this.wavesurfer.un('zoom', this._onZoom);\n this.wavesurfer.un('ready', this._onReady);\n this.wavesurfer.drawer.wrapper.removeEventListener(\n 'scroll',\n this._onScroll\n );\n if (this.wrapper && this.wrapper.parentNode) {\n this.wrapper.removeEventListener('click', this._onWrapperClick);\n this.wrapper.parentNode.removeChild(this.wrapper);\n this.wrapper = null;\n }\n }\n\n /**\n * Create a timeline element to wrap the canvases drawn by this plugin\n *\n */\n createWrapper() {\n const wsParams = this.wavesurfer.params;\n this.container.innerHTML = '';\n this.wrapper = this.container.appendChild(\n document.createElement('timeline')\n );\n this.util.style(this.wrapper, {\n display: 'block',\n position: 'relative',\n userSelect: 'none',\n webkitUserSelect: 'none',\n height: `${this.params.height}px`\n });\n\n if (wsParams.fillParent || wsParams.scrollParent) {\n this.util.style(this.wrapper, {\n width: '100%',\n overflowX: 'hidden',\n overflowY: 'hidden'\n });\n }\n\n this.wrapper.addEventListener('click', this._onWrapperClick);\n }\n\n /**\n * Render the timeline (also updates the already rendered timeline)\n *\n */\n render() {\n if (!this.wrapper) {\n this.createWrapper();\n }\n this.updateCanvases();\n this.updateCanvasesPositioning();\n this.renderCanvases();\n }\n\n /**\n * Add new timeline canvas\n *\n */\n addCanvas() {\n const canvas = this.wrapper.appendChild(\n document.createElement('canvas')\n );\n this.canvases.push(canvas);\n this.util.style(canvas, {\n position: 'absolute',\n zIndex: 4\n });\n }\n\n /**\n * Remove timeline canvas\n *\n */\n removeCanvas() {\n const canvas = this.canvases.pop();\n canvas.parentElement.removeChild(canvas);\n }\n\n /**\n * Make sure the correct of timeline canvas elements exist and are cached in\n * this.canvases\n *\n */\n updateCanvases() {\n const totalWidth = Math.round(this.drawer.wrapper.scrollWidth);\n const requiredCanvases = Math.ceil(\n totalWidth / this.maxCanvasElementWidth\n );\n\n while (this.canvases.length < requiredCanvases) {\n this.addCanvas();\n }\n\n while (this.canvases.length > requiredCanvases) {\n this.removeCanvas();\n }\n }\n\n /**\n * Update the dimensions and positioning style for all the timeline canvases\n *\n */\n updateCanvasesPositioning() {\n // cache length for performance\n const canvasesLength = this.canvases.length;\n this.canvases.forEach((canvas, i) => {\n // canvas width is the max element width, or if it is the last the\n // required width\n const canvasWidth =\n i === canvasesLength - 1\n ? this.drawer.wrapper.scrollWidth -\n this.maxCanvasElementWidth * (canvasesLength - 1)\n : this.maxCanvasElementWidth;\n // set dimensions and style\n canvas.width = canvasWidth * this.pixelRatio;\n // on certain pixel ratios the canvas appears cut off at the bottom,\n // therefore leave 1px extra\n canvas.height = (this.params.height + 1) * this.pixelRatio;\n this.util.style(canvas, {\n width: `${canvasWidth}px`,\n height: `${this.params.height}px`,\n left: `${i * this.maxCanvasElementWidth}px`\n });\n });\n }\n\n /**\n * Render the timeline labels and notches\n *\n */\n renderCanvases() {\n const duration =\n this.params.duration ||\n this.wavesurfer.backend.getDuration();\n\n if (duration <= 0) {\n return;\n }\n const wsParams = this.wavesurfer.params;\n const fontSize = this.params.fontSize * wsParams.pixelRatio;\n const totalSeconds = parseInt(duration, 10) + 1;\n const width =\n wsParams.fillParent && !wsParams.scrollParent\n ? this.drawer.getWidth()\n : this.drawer.wrapper.scrollWidth * wsParams.pixelRatio;\n const height1 = this.params.height * this.pixelRatio;\n const height2 =\n this.params.height *\n (this.params.notchPercentHeight / 100) *\n this.pixelRatio;\n const pixelsPerSecond = width / duration;\n\n const formatTime = this.params.formatTimeCallback;\n // if parameter is function, call the function with\n // pixelsPerSecond, otherwise simply take the value as-is\n const intervalFnOrVal = option =>\n typeof option === 'function' ? option(pixelsPerSecond) : option;\n const timeInterval = intervalFnOrVal(this.params.timeInterval);\n const primaryLabelInterval = intervalFnOrVal(\n this.params.primaryLabelInterval\n );\n const secondaryLabelInterval = intervalFnOrVal(\n this.params.secondaryLabelInterval\n );\n\n let curPixel = pixelsPerSecond * this.params.offset;\n let curSeconds = 0;\n let i;\n // build an array of position data with index, second and pixel data,\n // this is then used multiple times below\n const positioning = [];\n\n // render until end in case we have a negative offset\n const renderSeconds = (this.params.offset < 0)\n ? totalSeconds - this.params.offset\n : totalSeconds;\n\n for (i = 0; i < renderSeconds / timeInterval; i++) {\n positioning.push([i, curSeconds, curPixel]);\n curSeconds += timeInterval;\n curPixel += pixelsPerSecond * timeInterval;\n }\n\n // iterate over each position\n const renderPositions = cb => {\n positioning.forEach(pos => {\n cb(pos[0], pos[1], pos[2]);\n });\n };\n\n // render primary labels\n this.setFillStyles(this.params.primaryColor);\n this.setFonts(`${fontSize}px ${this.params.fontFamily}`);\n this.setFillStyles(this.params.primaryFontColor);\n renderPositions((i, curSeconds, curPixel) => {\n if (i % primaryLabelInterval === 0) {\n this.fillRect(curPixel, 0, 1, height1);\n this.fillText(\n formatTime(curSeconds, pixelsPerSecond),\n curPixel + this.params.labelPadding * this.pixelRatio,\n height1\n );\n }\n });\n\n // render secondary labels\n this.setFillStyles(this.params.secondaryColor);\n this.setFonts(`${fontSize}px ${this.params.fontFamily}`);\n this.setFillStyles(this.params.secondaryFontColor);\n renderPositions((i, curSeconds, curPixel) => {\n if (i % secondaryLabelInterval === 0) {\n this.fillRect(curPixel, 0, 1, height1);\n this.fillText(\n formatTime(curSeconds, pixelsPerSecond),\n curPixel + this.params.labelPadding * this.pixelRatio,\n height1\n );\n }\n });\n\n // render the actual notches (when no labels are used)\n this.setFillStyles(this.params.unlabeledNotchColor);\n renderPositions((i, curSeconds, curPixel) => {\n if (\n i % secondaryLabelInterval !== 0 &&\n i % primaryLabelInterval !== 0\n ) {\n this.fillRect(curPixel, 0, 1, height2);\n }\n });\n }\n\n /**\n * Set the canvas fill style\n *\n * @param {DOMString|CanvasGradient|CanvasPattern} fillStyle Fill style to\n * use\n */\n setFillStyles(fillStyle) {\n this.canvases.forEach(canvas => {\n const context = canvas.getContext('2d');\n if (context) {\n context.fillStyle = fillStyle;\n }\n });\n }\n\n /**\n * Set the canvas font\n *\n * @param {DOMString} font Font to use\n */\n setFonts(font) {\n this.canvases.forEach(canvas => {\n const context = canvas.getContext('2d');\n if (context) {\n context.font = font;\n }\n });\n }\n\n /**\n * Draw a rectangle on the canvases\n *\n * (it figures out the offset for each canvas)\n *\n * @param {number} x X-position\n * @param {number} y Y-position\n * @param {number} width Width\n * @param {number} height Height\n */\n fillRect(x, y, width, height) {\n this.canvases.forEach((canvas, i) => {\n const leftOffset = i * this.maxCanvasWidth;\n\n const intersection = {\n x1: Math.max(x, i * this.maxCanvasWidth),\n y1: y,\n x2: Math.min(x + width, i * this.maxCanvasWidth + canvas.width),\n y2: y + height\n };\n\n if (intersection.x1 < intersection.x2) {\n const context = canvas\n .getContext('2d');\n if (context) {\n context\n .fillRect(\n intersection.x1 - leftOffset,\n intersection.y1,\n intersection.x2 - intersection.x1,\n intersection.y2 - intersection.y1\n );\n }\n }\n });\n }\n\n /**\n * Fill a given text on the canvases\n *\n * @param {string} text Text to render\n * @param {number} x X-position\n * @param {number} y Y-position\n */\n fillText(text, x, y) {\n let textWidth;\n let xOffset = 0;\n\n this.canvases.forEach(canvas => {\n const context = canvas.getContext('2d');\n if (context) {\n const canvasWidth = context.canvas.width;\n\n if (xOffset > x + textWidth) {\n return;\n }\n\n if (xOffset + canvasWidth > x && context) {\n textWidth = context.measureText(text).width;\n context.fillText(text, x - xOffset, y);\n }\n\n xOffset += canvasWidth;\n }\n });\n }\n\n /**\n * Turn the time into a suitable label for the time.\n *\n * @param {number} seconds Seconds to format\n * @param {number} pxPerSec Pixels per second\n * @returns {number} Time\n */\n defaultFormatTimeCallback(seconds, pxPerSec) {\n if (seconds / 60 > 1) {\n // calculate minutes and seconds from seconds count\n const minutes = parseInt(seconds / 60, 10);\n seconds = parseInt(seconds % 60, 10);\n // fill up seconds with zeroes\n seconds = seconds < 10 ? '0' + seconds : seconds;\n return `${minutes}:${seconds}`;\n }\n return Math.round(seconds * 1000) / 1000;\n }\n\n /**\n * Return how many seconds should be between each notch\n *\n * @param {number} pxPerSec Pixels per second\n * @returns {number} Time\n */\n defaultTimeInterval(pxPerSec) {\n if (pxPerSec >= 25) {\n return 1;\n } else if (pxPerSec * 5 >= 25) {\n return 5;\n } else if (pxPerSec * 15 >= 25) {\n return 15;\n }\n return Math.ceil(0.5 / pxPerSec) * 60;\n }\n\n /**\n * Return the cadence of notches that get labels in the primary color.\n *\n * @param {number} pxPerSec Pixels per second\n * @returns {number} Cadence\n */\n defaultPrimaryLabelInterval(pxPerSec) {\n if (pxPerSec >= 25) {\n return 10;\n } else if (pxPerSec * 5 >= 25) {\n return 6;\n } else if (pxPerSec * 15 >= 25) {\n return 4;\n }\n return 4;\n }\n\n /**\n * Return the cadence of notches that get labels in the secondary color.\n *\n * @param {number} pxPerSec Pixels per second\n * @returns {number} Cadence\n */\n defaultSecondaryLabelInterval(pxPerSec) {\n if (pxPerSec >= 25) {\n return 5;\n } else if (pxPerSec * 5 >= 25) {\n return 2;\n } else if (pxPerSec * 15 >= 25) {\n return 2;\n }\n return 2;\n }\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(171);\n"],"names":["root","factory","exports","module","define","amd","self","TimelinePlugin","params","ws","wrapper","drawer","scrollLeft","render","wavesurfer","pixelRatio","maxCanvasWidth","width","maxCanvasElementWidth","Math","round","addEventListener","_onScroll","on","_onRedraw","_onZoom","e","preventDefault","relX","offsetX","layerX","fireEvent","scrollWidth","this","container","document","querySelector","Error","util","Object","assign","height","notchPercentHeight","labelPadding","unlabeledNotchColor","primaryColor","secondaryColor","primaryFontColor","secondaryFontColor","fontFamily","fontSize","duration","zoomDebounce","formatTimeCallback","defaultFormatTimeCallback","timeInterval","defaultTimeInterval","primaryLabelInterval","defaultPrimaryLabelInterval","secondaryLabelInterval","defaultSecondaryLabelInterval","offset","canvases","debounce","name","deferInit","instance","isReady","_onReady","once","unAll","un","removeEventListener","parentNode","_onWrapperClick","removeChild","wsParams","innerHTML","appendChild","createElement","style","display","position","userSelect","webkitUserSelect","fillParent","scrollParent","overflowX","overflowY","createWrapper","updateCanvases","updateCanvasesPositioning","renderCanvases","canvas","push","zIndex","pop","parentElement","totalWidth","requiredCanvases","ceil","length","addCanvas","removeCanvas","canvasesLength","forEach","i","canvasWidth","left","backend","getDuration","totalSeconds","parseInt","getWidth","height1","height2","pixelsPerSecond","formatTime","intervalFnOrVal","option","curPixel","curSeconds","positioning","renderSeconds","renderPositions","cb","pos","setFillStyles","setFonts","fillRect","fillText","fillStyle","context","getContext","font","x","y","leftOffset","intersection","x1","max","y1","x2","min","y2","text","textWidth","xOffset","measureText","seconds","pxPerSec","minutes","__webpack_module_cache__","__webpack_exports__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__"],"sourceRoot":""}
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * wavesurfer.js 6.2.0 (2022-05-16)
2
+ * wavesurfer.js 6.3.0 (2022-10-03)
3
3
  * https://wavesurfer-js.org
4
4
  * @license BSD-3-Clause
5
5
  */
@@ -1 +1 @@
1
- {"version":3,"file":"wavesurfer-html-init.js","mappings":";;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+CAA+C;AAC/C,CAAC;AACD;;;;;;;;;;;;;;;;;ACVA;;;;;;;;;;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;IACMA;EACF;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACI,cAAYC,UAAZ,EAAqC;IAAA,IAAbC,MAAa,uEAAJ,EAAI;;IAAA;;IACjC,IAAI,C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D,KAAP,GAAeV,IAAI,CAACC,KAAL,CAAWnD,MAAM,CAAC4D,KAAlB,CAAf,GAA0CC,SAAxD;MACAF,QAAQ,CAACG,IAAT,CAAc9D,MAAM,CAAC+D,GAArB,EAA0BH,KAA1B,EA1CqB,CA4CrB;;MACA,KAAKpC,SAAL,CAAewC,IAAf,CAAoBL,QAApB;MACA,OAAOA,QAAP;IACH;;;;KAGL;;;AACA,IAAI,QAAOvC,MAAP,yCAAOA,MAAP,OAAkB,QAAlB,IAA8B,CAACA,MAAM,CAAC6C,eAA1C,EAA2D;EACvD;EACA;EACA,IAAI5C,QAAQ,CAAC6C,UAAT,KAAwB,UAA5B,EAAwC;IACpC9C,MAAM,CAAC+C,cAAP,GAAwB,IAAIrE,IAAJ,CACpBsB,MAAM,CAACrB,UADa,EAEpBqB,MAAM,CAACgD,cAFa,CAAxB;EAIH,CALD,MAKO;IACHhD,MAAM,CAACiD,gBAAP,CAAwB,MAAxB,EAAgC,YAAM;MAClCjD,MAAM,CAAC+C,cAAP,GAAwB,IAAIrE,IAAJ,CACpBsB,MAAM,CAACrB,UADa,EAEpBqB,MAAM,CAACgD,cAFa,CAAxB;IAIH,CALD;EAMH;AACJ,EAED;;;eACetE;;;;;;;;;;;;;AC/Of;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;UChEA;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;UEtBA;UACA;UACA;UACA","sources":["webpack://WaveSurfer/webpack/universalModuleDefinition","webpack://WaveSurfer/./src/html-init.js","webpack://WaveSurfer/./node_modules/load-script/index.js","webpack://WaveSurfer/webpack/bootstrap","webpack://WaveSurfer/webpack/before-startup","webpack://WaveSurfer/webpack/startup","webpack://WaveSurfer/webpack/after-startup"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"WaveSurfer\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"WaveSurfer\"] = factory();\n\telse\n\t\troot[\"WaveSurfer\"] = root[\"WaveSurfer\"] || {}, root[\"WaveSurfer\"][\"html-init\"] = factory();\n})(self, () => {\nreturn ","import loadScript from 'load-script';\n\n/**\n * @typedef {Object} InitParams\n * @property {WavesurferParams} [defaults={backend: 'MediaElement,\n * mediaControls: true}] The default wavesurfer initialisation parameters\n * @property {string|NodeList} containers='wavesurfer' Selector or NodeList of\n * elements to attach instances to\n * @property {string}\n * pluginCdnTemplate='//localhost:8080/dist/plugin/wavesurfer.[name].js' URL\n * template for the dynamic loading of plugins\n * @property {function} loadPlugin If set overwrites the default request function,\n * can be used to inject plugins differently.\n */\n/**\n * The HTML initialisation API is not part of the main library bundle file and\n * must be additionally included.\n *\n * The API attaches wavesurfer instances to all `<wavesurfer>` (can be\n * customised), parsing their `data-` attributes to construct an options object\n * for initialisation. Among other things it can dynamically load plugin code.\n *\n * The automatic initialisation can be prevented by setting the\n * `window.WS_StopAutoInit` flag to true. The `html-init[.min].js` file exports\n * the `Init` class, which can be called manually.\n *\n * Site-wide defaults can be added by setting `window.WS_InitOptions`.\n *\n * @example\n * <!-- with minimap and timeline plugin -->\n * <wavesurfer\n * data-url=\"../media/demo.wav\"\n * data-plugins=\"minimap,timeline\"\n * data-minimap-height=\"30\"\n * data-minimap-wave-color=\"#ddd\"\n * data-minimap-progress-color=\"#999\"\n * data-timeline-font-size=\"13px\"\n * data-timeline-container=\"#timeline\"\n * >\n * </wavesurfer>\n * <div id=\"timeline\"></div>\n *\n * <!-- with regions plugin -->\n * <wavesurfer\n * data-url=\"../media/demo.wav\"\n * data-plugins=\"regions\"\n * data-regions-regions='[{\"start\": 1,\"end\": 3,\"color\": \"hsla(400, 100%, 30%, 0.5)\"}]'\n * >\n * </wavesurfer>\n */\nclass Init {\n /**\n * Instantiate Init class and initialize elements\n *\n * This is done automatically if `window` is defined and\n * `window.WS_StopAutoInit` is not set to true\n *\n * @param {WaveSurfer} WaveSurfer The WaveSurfer library object\n * @param {InitParams} params initialisation options\n */\n constructor(WaveSurfer, params = {}) {\n if (!WaveSurfer) {\n throw new Error('WaveSurfer is not available!');\n }\n\n /**\n * cache WaveSurfer\n * @private\n */\n this.WaveSurfer = WaveSurfer;\n\n /**\n * build parameters, cache them in _params so minified builds are smaller\n * @private\n */\n const _params = (this.params = Object.assign(\n {},\n {\n // wavesurfer parameter defaults so by default the audio player is\n // usable with native media element controls\n defaults: {\n backend: 'MediaElement',\n mediaControls: true\n },\n // containers to instantiate on, can be selector string or NodeList\n containers: 'wavesurfer',\n // @TODO insert plugin CDN URIs\n pluginCdnTemplate:\n '//localhost:8080/dist/plugin/wavesurfer.[name].js',\n // loadPlugin function can be overridden to inject plugin definition\n // objects, this default function uses load-script to load a plugin\n // and pass it to a callback\n loadPlugin(name, cb) {\n const src = _params.pluginCdnTemplate.replace(\n '[name]',\n name\n );\n loadScript(src, { async: false }, (err, plugin) => {\n if (err) {\n // eslint-disable-next-line no-console\n return console.error(\n `WaveSurfer plugin ${name} not found at ${src}`\n );\n }\n cb(window.WaveSurfer[name]);\n });\n }\n },\n params\n ));\n /**\n * The nodes that should have instances attached to them\n * @type {NodeList}\n */\n this.containers =\n typeof _params.containers == 'string'\n ? document.querySelectorAll(_params.containers)\n : _params.containers;\n /** @private */\n this.pluginCache = {};\n /**\n * An array of wavesurfer instances\n * @type {Object[]}\n */\n this.instances = [];\n\n this.initAllEls();\n }\n\n /**\n * Initialize all container elements\n */\n initAllEls() {\n // iterate over all the container elements\n Array.prototype.forEach.call(this.containers, el => {\n // load the plugins as an array of plugin names\n const plugins = el.dataset.plugins\n ? el.dataset.plugins.split(',')\n : [];\n\n // no plugins to be loaded, just render\n if (!plugins.length) {\n return this.initEl(el);\n }\n // … or: iterate over all the plugins\n plugins.forEach((name, i) => {\n // plugin is not cached already, load it\n if (!this.pluginCache[name]) {\n this.params.loadPlugin(name, lib => {\n this.pluginCache[name] = lib;\n // plugins were all loaded, render the element\n if (i + 1 === plugins.length) {\n this.initEl(el, plugins);\n }\n });\n } else if (i === plugins.length) {\n // plugin was cached and this plugin was the last\n this.initEl(el, plugins);\n }\n });\n });\n }\n\n /**\n * Initialize a single container element and add to `this.instances`\n *\n * @param {HTMLElement} el The container to instantiate wavesurfer to\n * @param {PluginDefinition[]} plugins An Array of plugin names to initialize with\n * @return {Object} Wavesurfer instance\n */\n initEl(el, plugins = []) {\n const jsonRegex = /^[[|{]/;\n // initialize plugins with the correct options\n const initialisedPlugins = plugins.map(plugin => {\n const options = {};\n // the regex to find this plugin attributes\n const attrNameRegex = new RegExp('^' + plugin);\n let attrName;\n // iterate over all the data attributes and find ones for this\n // plugin\n for (attrName in el.dataset) {\n const regexResult = attrNameRegex.exec(attrName);\n if (regexResult) {\n const attr = el.dataset[attrName];\n // if the string begins with a [ or a { parse it as JSON\n const prop = jsonRegex.test(attr) ? JSON.parse(attr) : attr;\n // this removes the plugin prefix and changes the first letter\n // of the resulting string to lower case to follow the naming\n // convention of ws params\n const unprefixedOptionName =\n attrName\n .slice(plugin.length, plugin.length + 1)\n .toLowerCase() + attrName.slice(plugin.length + 1);\n options[unprefixedOptionName] = prop;\n }\n }\n return this.pluginCache[plugin].create(options);\n });\n // build parameter object for this container\n const params = Object.assign(\n { container: el },\n this.params.defaults,\n el.dataset,\n { plugins: initialisedPlugins }\n );\n\n // @TODO make nicer\n el.style.display = 'block';\n\n // initialize wavesurfer, load audio (with peaks if provided)\n const instance = this.WaveSurfer.create(params);\n const peaks = params.peaks ? JSON.parse(params.peaks) : undefined;\n instance.load(params.url, peaks);\n\n // push this instance into the instances cache\n this.instances.push(instance);\n return instance;\n }\n}\n\n// if window object exists and window.WS_StopAutoInit is not true\nif (typeof window === 'object' && !window.WS_StopAutoInit) {\n // call init when document is ready, apply any custom default settings\n // in window.WS_InitOptions\n if (document.readyState === 'complete') {\n window.WaveSurferInit = new Init(\n window.WaveSurfer,\n window.WS_InitOptions\n );\n } else {\n window.addEventListener('load', () => {\n window.WaveSurferInit = new Init(\n window.WaveSurfer,\n window.WS_InitOptions\n );\n });\n }\n}\n\n// export init for manual usage\nexport default Init;\n","\nmodule.exports = function load (src, opts, cb) {\n var head = document.head || document.getElementsByTagName('head')[0]\n var script = document.createElement('script')\n\n if (typeof opts === 'function') {\n cb = opts\n opts = {}\n }\n\n opts = opts || {}\n cb = cb || function() {}\n\n script.type = opts.type || 'text/javascript'\n script.charset = opts.charset || 'utf8';\n script.async = 'async' in opts ? !!opts.async : true\n script.src = src\n\n if (opts.attrs) {\n setAttributes(script, opts.attrs)\n }\n\n if (opts.text) {\n script.text = '' + opts.text\n }\n\n var onend = 'onload' in script ? stdOnEnd : ieOnEnd\n onend(script, cb)\n\n // some good legacy browsers (firefox) fail the 'in' detection above\n // so as a fallback we always set onload\n // old IE will ignore this and new IE will set onload\n if (!script.onload) {\n stdOnEnd(script, cb);\n }\n\n head.appendChild(script)\n}\n\nfunction setAttributes(script, attrs) {\n for (var attr in attrs) {\n script.setAttribute(attr, attrs[attr]);\n }\n}\n\nfunction stdOnEnd (script, cb) {\n script.onload = function () {\n this.onerror = this.onload = null\n cb(null, script)\n }\n script.onerror = function () {\n // this.onload = null here is necessary\n // because even IE9 works not like others\n this.onerror = this.onload = null\n cb(new Error('Failed to load ' + this.src), script)\n }\n}\n\nfunction ieOnEnd (script, cb) {\n script.onreadystatechange = function () {\n if (this.readyState != 'complete' && this.readyState != 'loaded') return\n this.onreadystatechange = null\n cb(null, script) // there is no way to catch loading errors in IE8\n }\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(\"./src/html-init.js\");\n",""],"names":["Init","WaveSurfer","params","Error","_params","Object","assign","defaults","backend","mediaControls","containers","pluginCdnTemplate","loadPlugin","name","cb","src","replace","async","err","plugin","console","error","window","document","querySelectorAll","pluginCache","instances","initAllEls","Array","prototype","forEach","call","el","plugins","dataset","split","length","initEl","i","lib","jsonRegex","initialisedPlugins","map","options","attrNameRegex","RegExp","attrName","regexResult","exec","attr","prop","test","JSON","parse","unprefixedOptionName","slice","toLowerCase","create","container","style","display","instance","peaks","undefined","load","url","push","WS_StopAutoInit","readyState","WaveSurferInit","WS_InitOptions","addEventListener"],"sourceRoot":""}
1
+ {"version":3,"file":"wavesurfer-html-init.js","mappings":";;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+CAA+C;AAC/C,CAAC;AACD;;;;;;;;;;;;;;;;;ACVA;;;;;;;;;;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;IACMA;EACF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UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;UEtBA;UACA;UACA;UACA","sources":["webpack://WaveSurfer/webpack/universalModuleDefinition","webpack://WaveSurfer/./src/html-init.js","webpack://WaveSurfer/./node_modules/load-script/index.js","webpack://WaveSurfer/webpack/bootstrap","webpack://WaveSurfer/webpack/before-startup","webpack://WaveSurfer/webpack/startup","webpack://WaveSurfer/webpack/after-startup"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"WaveSurfer\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"WaveSurfer\"] = factory();\n\telse\n\t\troot[\"WaveSurfer\"] = root[\"WaveSurfer\"] || {}, root[\"WaveSurfer\"][\"html-init\"] = factory();\n})(self, () => {\nreturn ","import loadScript from 'load-script';\n\n/**\n * @typedef {Object} InitParams\n * @property {WavesurferParams} [defaults={backend: 'MediaElement,\n * mediaControls: true}] The default wavesurfer initialisation parameters\n * @property {string|NodeList} containers='wavesurfer' Selector or NodeList of\n * elements to attach instances to\n * @property {string}\n * pluginCdnTemplate='//localhost:8080/dist/plugin/wavesurfer.[name].js' URL\n * template for the dynamic loading of plugins\n * @property {function} loadPlugin If set overwrites the default request function,\n * can be used to inject plugins differently.\n */\n/**\n * The HTML initialisation API is not part of the main library bundle file and\n * must be additionally included.\n *\n * The API attaches wavesurfer instances to all `<wavesurfer>` (can be\n * customised), parsing their `data-` attributes to construct an options object\n * for initialisation. Among other things it can dynamically load plugin code.\n *\n * The automatic initialisation can be prevented by setting the\n * `window.WS_StopAutoInit` flag to true. The `html-init[.min].js` file exports\n * the `Init` class, which can be called manually.\n *\n * Site-wide defaults can be added by setting `window.WS_InitOptions`.\n *\n * @example\n * <!-- with minimap and timeline plugin -->\n * <wavesurfer\n * data-url=\"../media/demo.wav\"\n * data-plugins=\"minimap,timeline\"\n * data-minimap-height=\"30\"\n * data-minimap-wave-color=\"#ddd\"\n * data-minimap-progress-color=\"#999\"\n * data-timeline-font-size=\"13px\"\n * data-timeline-container=\"#timeline\"\n * >\n * </wavesurfer>\n * <div id=\"timeline\"></div>\n *\n * <!-- with regions plugin -->\n * <wavesurfer\n * data-url=\"../media/demo.wav\"\n * data-plugins=\"regions\"\n * data-regions-regions='[{\"start\": 1,\"end\": 3,\"color\": \"hsla(400, 100%, 30%, 0.5)\"}]'\n * >\n * </wavesurfer>\n */\nclass Init {\n /**\n * Instantiate Init class and initialize elements\n *\n * This is done automatically if `window` is defined and\n * `window.WS_StopAutoInit` is not set to true\n *\n * @param {WaveSurfer} WaveSurfer The WaveSurfer library object\n * @param {InitParams} params initialisation options\n */\n constructor(WaveSurfer, params = {}) {\n if (!WaveSurfer) {\n throw new Error('WaveSurfer is not available!');\n }\n\n /**\n * cache WaveSurfer\n * @private\n */\n this.WaveSurfer = WaveSurfer;\n\n /**\n * build parameters, cache them in _params so minified builds are smaller\n * @private\n */\n const _params = (this.params = Object.assign(\n {},\n {\n // wavesurfer parameter defaults so by default the audio player is\n // usable with native media element controls\n defaults: {\n backend: 'MediaElement',\n mediaControls: true\n },\n // containers to instantiate on, can be selector string or NodeList\n containers: 'wavesurfer',\n // @TODO insert plugin CDN URIs\n pluginCdnTemplate:\n '//localhost:8080/dist/plugin/wavesurfer.[name].js',\n // loadPlugin function can be overridden to inject plugin definition\n // objects, this default function uses load-script to load a plugin\n // and pass it to a callback\n loadPlugin(name, cb) {\n const src = _params.pluginCdnTemplate.replace(\n '[name]',\n name\n );\n loadScript(src, { async: false }, (err, plugin) => {\n if (err) {\n // eslint-disable-next-line no-console\n return console.error(\n `WaveSurfer plugin ${name} not found at ${src}`\n );\n }\n cb(window.WaveSurfer[name]);\n });\n }\n },\n params\n ));\n /**\n * The nodes that should have instances attached to them\n * @type {NodeList}\n */\n this.containers =\n typeof _params.containers == 'string'\n ? document.querySelectorAll(_params.containers)\n : _params.containers;\n /** @private */\n this.pluginCache = {};\n /**\n * An array of wavesurfer instances\n * @type {Object[]}\n */\n this.instances = [];\n\n this.initAllEls();\n }\n\n /**\n * Initialize all container elements\n */\n initAllEls() {\n // iterate over all the container elements\n Array.prototype.forEach.call(this.containers, el => {\n // load the plugins as an array of plugin names\n const plugins = el.dataset.plugins\n ? el.dataset.plugins.split(',')\n : [];\n\n // no plugins to be loaded, just render\n if (!plugins.length) {\n return this.initEl(el);\n }\n // … or: iterate over all the plugins\n plugins.forEach((name, i) => {\n // plugin is not cached already, load it\n if (!this.pluginCache[name]) {\n this.params.loadPlugin(name, lib => {\n this.pluginCache[name] = lib;\n // plugins were all loaded, render the element\n if (i + 1 === plugins.length) {\n this.initEl(el, plugins);\n }\n });\n } else if (i === plugins.length) {\n // plugin was cached and this plugin was the last\n this.initEl(el, plugins);\n }\n });\n });\n }\n\n /**\n * Initialize a single container element and add to `this.instances`\n *\n * @param {HTMLElement} el The container to instantiate wavesurfer to\n * @param {PluginDefinition[]} plugins An Array of plugin names to initialize with\n * @return {Object} Wavesurfer instance\n */\n initEl(el, plugins = []) {\n const jsonRegex = /^[[|{]/;\n // initialize plugins with the correct options\n const initialisedPlugins = plugins.map(plugin => {\n const options = {};\n // the regex to find this plugin attributes\n const attrNameRegex = new RegExp('^' + plugin);\n let attrName;\n // iterate over all the data attributes and find ones for this\n // plugin\n for (attrName in el.dataset) {\n const regexResult = attrNameRegex.exec(attrName);\n if (regexResult) {\n const attr = el.dataset[attrName];\n // if the string begins with a [ or a { parse it as JSON\n const prop = jsonRegex.test(attr) ? JSON.parse(attr) : attr;\n // this removes the plugin prefix and changes the first letter\n // of the resulting string to lower case to follow the naming\n // convention of ws params\n const unprefixedOptionName =\n attrName\n .slice(plugin.length, plugin.length + 1)\n .toLowerCase() + attrName.slice(plugin.length + 1);\n options[unprefixedOptionName] = prop;\n }\n }\n return this.pluginCache[plugin].create(options);\n });\n // build parameter object for this container\n const params = Object.assign(\n { container: el },\n this.params.defaults,\n el.dataset,\n { plugins: initialisedPlugins }\n );\n\n // @TODO make nicer\n el.style.display = 'block';\n\n // initialize wavesurfer, load audio (with peaks if provided)\n const instance = this.WaveSurfer.create(params);\n const peaks = params.peaks ? JSON.parse(params.peaks) : undefined;\n instance.load(params.url, peaks);\n\n // push this instance into the instances cache\n this.instances.push(instance);\n return instance;\n }\n}\n\n// if window object exists and window.WS_StopAutoInit is not true\nif (typeof window === 'object' && !window.WS_StopAutoInit) {\n // call init when document is ready, apply any custom default settings\n // in window.WS_InitOptions\n if (document.readyState === 'complete') {\n window.WaveSurferInit = new Init(\n window.WaveSurfer,\n window.WS_InitOptions\n );\n } else {\n window.addEventListener('load', () => {\n window.WaveSurferInit = new Init(\n window.WaveSurfer,\n window.WS_InitOptions\n );\n });\n }\n}\n\n// export init for manual usage\nexport default Init;\n","\nmodule.exports = function load (src, opts, cb) {\n var head = document.head || document.getElementsByTagName('head')[0]\n var script = document.createElement('script')\n\n if (typeof opts === 'function') {\n cb = opts\n opts = {}\n }\n\n opts = opts || {}\n cb = cb || function() {}\n\n script.type = opts.type || 'text/javascript'\n script.charset = opts.charset || 'utf8';\n script.async = 'async' in opts ? !!opts.async : true\n script.src = src\n\n if (opts.attrs) {\n setAttributes(script, opts.attrs)\n }\n\n if (opts.text) {\n script.text = '' + opts.text\n }\n\n var onend = 'onload' in script ? stdOnEnd : ieOnEnd\n onend(script, cb)\n\n // some good legacy browsers (firefox) fail the 'in' detection above\n // so as a fallback we always set onload\n // old IE will ignore this and new IE will set onload\n if (!script.onload) {\n stdOnEnd(script, cb);\n }\n\n head.appendChild(script)\n}\n\nfunction setAttributes(script, attrs) {\n for (var attr in attrs) {\n script.setAttribute(attr, attrs[attr]);\n }\n}\n\nfunction stdOnEnd (script, cb) {\n script.onload = function () {\n this.onerror = this.onload = null\n cb(null, script)\n }\n script.onerror = function () {\n // this.onload = null here is necessary\n // because even IE9 works not like others\n this.onerror = this.onload = null\n cb(new Error('Failed to load ' + this.src), script)\n }\n}\n\nfunction ieOnEnd (script, cb) {\n script.onreadystatechange = function () {\n if (this.readyState != 'complete' && this.readyState != 'loaded') return\n this.onreadystatechange = null\n cb(null, script) // there is no way to catch loading errors in IE8\n }\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(\"./src/html-init.js\");\n",""],"names":["Init","WaveSurfer","params","Error","_params","Object","assign","defaults","backend","mediaControls","containers","pluginCdnTemplate","loadPlugin","name","cb","src","replace","loadScript","async","err","plugin","console","error","window","document","querySelectorAll","pluginCache","instances","initAllEls","Array","prototype","forEach","call","el","plugins","dataset","split","length","initEl","i","lib","jsonRegex","initialisedPlugins","map","options","attrNameRegex","RegExp","attrName","regexResult","exec","attr","prop","test","JSON","parse","unprefixedOptionName","slice","toLowerCase","create","container","style","display","instance","peaks","undefined","load","url","push","WS_StopAutoInit","readyState","WaveSurferInit","WS_InitOptions","addEventListener"],"sourceRoot":""}
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * wavesurfer.js 6.2.0 (2022-05-16)
2
+ * wavesurfer.js 6.3.0 (2022-10-03)
3
3
  * https://wavesurfer-js.org
4
4
  * @license BSD-3-Clause
5
5
  */
@@ -1 +1 @@
1
- {"version":3,"file":"wavesurfer-html-init.min.js","mappings":";;;;;CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAX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["webpack://WaveSurfer/webpack/universalModuleDefinition","webpack://WaveSurfer/./src/html-init.js","webpack://WaveSurfer/./node_modules/load-script/index.js","webpack://WaveSurfer/webpack/bootstrap","webpack://WaveSurfer/webpack/startup"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"WaveSurfer\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"WaveSurfer\"] = factory();\n\telse\n\t\troot[\"WaveSurfer\"] = root[\"WaveSurfer\"] || {}, root[\"WaveSurfer\"][\"html-init\"] = factory();\n})(self, () => {\nreturn ","import loadScript from 'load-script';\n\n/**\n * @typedef {Object} InitParams\n * @property {WavesurferParams} [defaults={backend: 'MediaElement,\n * mediaControls: true}] The default wavesurfer initialisation parameters\n * @property {string|NodeList} containers='wavesurfer' Selector or NodeList of\n * elements to attach instances to\n * @property {string}\n * pluginCdnTemplate='//localhost:8080/dist/plugin/wavesurfer.[name].js' URL\n * template for the dynamic loading of plugins\n * @property {function} loadPlugin If set overwrites the default request function,\n * can be used to inject plugins differently.\n */\n/**\n * The HTML initialisation API is not part of the main library bundle file and\n * must be additionally included.\n *\n * The API attaches wavesurfer instances to all `<wavesurfer>` (can be\n * customised), parsing their `data-` attributes to construct an options object\n * for initialisation. Among other things it can dynamically load plugin code.\n *\n * The automatic initialisation can be prevented by setting the\n * `window.WS_StopAutoInit` flag to true. The `html-init[.min].js` file exports\n * the `Init` class, which can be called manually.\n *\n * Site-wide defaults can be added by setting `window.WS_InitOptions`.\n *\n * @example\n * <!-- with minimap and timeline plugin -->\n * <wavesurfer\n * data-url=\"../media/demo.wav\"\n * data-plugins=\"minimap,timeline\"\n * data-minimap-height=\"30\"\n * data-minimap-wave-color=\"#ddd\"\n * data-minimap-progress-color=\"#999\"\n * data-timeline-font-size=\"13px\"\n * data-timeline-container=\"#timeline\"\n * >\n * </wavesurfer>\n * <div id=\"timeline\"></div>\n *\n * <!-- with regions plugin -->\n * <wavesurfer\n * data-url=\"../media/demo.wav\"\n * data-plugins=\"regions\"\n * data-regions-regions='[{\"start\": 1,\"end\": 3,\"color\": \"hsla(400, 100%, 30%, 0.5)\"}]'\n * >\n * </wavesurfer>\n */\nclass Init {\n /**\n * Instantiate Init class and initialize elements\n *\n * This is done automatically if `window` is defined and\n * `window.WS_StopAutoInit` is not set to true\n *\n * @param {WaveSurfer} WaveSurfer The WaveSurfer library object\n * @param {InitParams} params initialisation options\n */\n constructor(WaveSurfer, params = {}) {\n if (!WaveSurfer) {\n throw new Error('WaveSurfer is not available!');\n }\n\n /**\n * cache WaveSurfer\n * @private\n */\n this.WaveSurfer = WaveSurfer;\n\n /**\n * build parameters, cache them in _params so minified builds are smaller\n * @private\n */\n const _params = (this.params = Object.assign(\n {},\n {\n // wavesurfer parameter defaults so by default the audio player is\n // usable with native media element controls\n defaults: {\n backend: 'MediaElement',\n mediaControls: true\n },\n // containers to instantiate on, can be selector string or NodeList\n containers: 'wavesurfer',\n // @TODO insert plugin CDN URIs\n pluginCdnTemplate:\n '//localhost:8080/dist/plugin/wavesurfer.[name].js',\n // loadPlugin function can be overridden to inject plugin definition\n // objects, this default function uses load-script to load a plugin\n // and pass it to a callback\n loadPlugin(name, cb) {\n const src = _params.pluginCdnTemplate.replace(\n '[name]',\n name\n );\n loadScript(src, { async: false }, (err, plugin) => {\n if (err) {\n // eslint-disable-next-line no-console\n return console.error(\n `WaveSurfer plugin ${name} not found at ${src}`\n );\n }\n cb(window.WaveSurfer[name]);\n });\n }\n },\n params\n ));\n /**\n * The nodes that should have instances attached to them\n * @type {NodeList}\n */\n this.containers =\n typeof _params.containers == 'string'\n ? document.querySelectorAll(_params.containers)\n : _params.containers;\n /** @private */\n this.pluginCache = {};\n /**\n * An array of wavesurfer instances\n * @type {Object[]}\n */\n this.instances = [];\n\n this.initAllEls();\n }\n\n /**\n * Initialize all container elements\n */\n initAllEls() {\n // iterate over all the container elements\n Array.prototype.forEach.call(this.containers, el => {\n // load the plugins as an array of plugin names\n const plugins = el.dataset.plugins\n ? el.dataset.plugins.split(',')\n : [];\n\n // no plugins to be loaded, just render\n if (!plugins.length) {\n return this.initEl(el);\n }\n // … or: iterate over all the plugins\n plugins.forEach((name, i) => {\n // plugin is not cached already, load it\n if (!this.pluginCache[name]) {\n this.params.loadPlugin(name, lib => {\n this.pluginCache[name] = lib;\n // plugins were all loaded, render the element\n if (i + 1 === plugins.length) {\n this.initEl(el, plugins);\n }\n });\n } else if (i === plugins.length) {\n // plugin was cached and this plugin was the last\n this.initEl(el, plugins);\n }\n });\n });\n }\n\n /**\n * Initialize a single container element and add to `this.instances`\n *\n * @param {HTMLElement} el The container to instantiate wavesurfer to\n * @param {PluginDefinition[]} plugins An Array of plugin names to initialize with\n * @return {Object} Wavesurfer instance\n */\n initEl(el, plugins = []) {\n const jsonRegex = /^[[|{]/;\n // initialize plugins with the correct options\n const initialisedPlugins = plugins.map(plugin => {\n const options = {};\n // the regex to find this plugin attributes\n const attrNameRegex = new RegExp('^' + plugin);\n let attrName;\n // iterate over all the data attributes and find ones for this\n // plugin\n for (attrName in el.dataset) {\n const regexResult = attrNameRegex.exec(attrName);\n if (regexResult) {\n const attr = el.dataset[attrName];\n // if the string begins with a [ or a { parse it as JSON\n const prop = jsonRegex.test(attr) ? JSON.parse(attr) : attr;\n // this removes the plugin prefix and changes the first letter\n // of the resulting string to lower case to follow the naming\n // convention of ws params\n const unprefixedOptionName =\n attrName\n .slice(plugin.length, plugin.length + 1)\n .toLowerCase() + attrName.slice(plugin.length + 1);\n options[unprefixedOptionName] = prop;\n }\n }\n return this.pluginCache[plugin].create(options);\n });\n // build parameter object for this container\n const params = Object.assign(\n { container: el },\n this.params.defaults,\n el.dataset,\n { plugins: initialisedPlugins }\n );\n\n // @TODO make nicer\n el.style.display = 'block';\n\n // initialize wavesurfer, load audio (with peaks if provided)\n const instance = this.WaveSurfer.create(params);\n const peaks = params.peaks ? JSON.parse(params.peaks) : undefined;\n instance.load(params.url, peaks);\n\n // push this instance into the instances cache\n this.instances.push(instance);\n return instance;\n }\n}\n\n// if window object exists and window.WS_StopAutoInit is not true\nif (typeof window === 'object' && !window.WS_StopAutoInit) {\n // call init when document is ready, apply any custom default settings\n // in window.WS_InitOptions\n if (document.readyState === 'complete') {\n window.WaveSurferInit = new Init(\n window.WaveSurfer,\n window.WS_InitOptions\n );\n } else {\n window.addEventListener('load', () => {\n window.WaveSurferInit = new Init(\n window.WaveSurfer,\n window.WS_InitOptions\n );\n });\n }\n}\n\n// export init for manual usage\nexport default Init;\n","\nmodule.exports = function load (src, opts, cb) {\n var head = document.head || document.getElementsByTagName('head')[0]\n var script = document.createElement('script')\n\n if (typeof opts === 'function') {\n cb = opts\n opts = {}\n }\n\n opts = opts || {}\n cb = cb || function() {}\n\n script.type = opts.type || 'text/javascript'\n script.charset = opts.charset || 'utf8';\n script.async = 'async' in opts ? !!opts.async : true\n script.src = src\n\n if (opts.attrs) {\n setAttributes(script, opts.attrs)\n }\n\n if (opts.text) {\n script.text = '' + opts.text\n }\n\n var onend = 'onload' in script ? stdOnEnd : ieOnEnd\n onend(script, cb)\n\n // some good legacy browsers (firefox) fail the 'in' detection above\n // so as a fallback we always set onload\n // old IE will ignore this and new IE will set onload\n if (!script.onload) {\n stdOnEnd(script, cb);\n }\n\n head.appendChild(script)\n}\n\nfunction setAttributes(script, attrs) {\n for (var attr in attrs) {\n script.setAttribute(attr, attrs[attr]);\n }\n}\n\nfunction stdOnEnd (script, cb) {\n script.onload = function () {\n this.onerror = this.onload = null\n cb(null, script)\n }\n script.onerror = function () {\n // this.onload = null here is necessary\n // because even IE9 works not like others\n this.onerror = this.onload = null\n cb(new Error('Failed to load ' + this.src), script)\n }\n}\n\nfunction ieOnEnd (script, cb) {\n script.onreadystatechange = function () {\n if (this.readyState != 'complete' && this.readyState != 'loaded') return\n this.onreadystatechange = null\n cb(null, script) // there is no way to catch loading errors in IE8\n }\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(531);\n"],"names":["root","factory","exports","module","define","amd","self","Init","WaveSurfer","params","Error","this","_params","Object","assign","defaults","backend","mediaControls","containers","pluginCdnTemplate","loadPlugin","name","cb","src","replace","async","err","plugin","console","error","window","document","querySelectorAll","pluginCache","instances","initAllEls","Array","prototype","forEach","call","el","plugins","dataset","split","length","initEl","i","lib","jsonRegex","initialisedPlugins","map","attrName","options","attrNameRegex","RegExp","exec","attr","prop","test","JSON","parse","slice","toLowerCase","create","container","style","display","instance","peaks","undefined","load","url","push","WS_StopAutoInit","readyState","WaveSurferInit","WS_InitOptions","addEventListener","stdOnEnd","script","onload","onerror","ieOnEnd","onreadystatechange","opts","head","getElementsByTagName","createElement","type","charset","attrs","setAttribute","setAttributes","text","appendChild","__webpack_module_cache__","__webpack_exports__","__webpack_require__","moduleId","cachedModule","__webpack_modules__"],"sourceRoot":""}
1
+ {"version":3,"file":"wavesurfer-html-init.min.js","mappings":";;;;;CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,aAAc,GAAIH,GACC,iBAAZC,QACdA,QAAoB,WAAID,KAExBD,EAAiB,WAAIA,EAAiB,YAAK,CAAC,EAAGA,EAAiB,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I,EGTIF,ECEAC,C","sources":["webpack://WaveSurfer/webpack/universalModuleDefinition","webpack://WaveSurfer/./src/html-init.js","webpack://WaveSurfer/./node_modules/load-script/index.js","webpack://WaveSurfer/webpack/bootstrap","webpack://WaveSurfer/webpack/startup"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"WaveSurfer\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"WaveSurfer\"] = factory();\n\telse\n\t\troot[\"WaveSurfer\"] = root[\"WaveSurfer\"] || {}, root[\"WaveSurfer\"][\"html-init\"] = factory();\n})(self, () => {\nreturn ","import loadScript from 'load-script';\n\n/**\n * @typedef {Object} InitParams\n * @property {WavesurferParams} [defaults={backend: 'MediaElement,\n * mediaControls: true}] The default wavesurfer initialisation parameters\n * @property {string|NodeList} containers='wavesurfer' Selector or NodeList of\n * elements to attach instances to\n * @property {string}\n * pluginCdnTemplate='//localhost:8080/dist/plugin/wavesurfer.[name].js' URL\n * template for the dynamic loading of plugins\n * @property {function} loadPlugin If set overwrites the default request function,\n * can be used to inject plugins differently.\n */\n/**\n * The HTML initialisation API is not part of the main library bundle file and\n * must be additionally included.\n *\n * The API attaches wavesurfer instances to all `<wavesurfer>` (can be\n * customised), parsing their `data-` attributes to construct an options object\n * for initialisation. Among other things it can dynamically load plugin code.\n *\n * The automatic initialisation can be prevented by setting the\n * `window.WS_StopAutoInit` flag to true. The `html-init[.min].js` file exports\n * the `Init` class, which can be called manually.\n *\n * Site-wide defaults can be added by setting `window.WS_InitOptions`.\n *\n * @example\n * <!-- with minimap and timeline plugin -->\n * <wavesurfer\n * data-url=\"../media/demo.wav\"\n * data-plugins=\"minimap,timeline\"\n * data-minimap-height=\"30\"\n * data-minimap-wave-color=\"#ddd\"\n * data-minimap-progress-color=\"#999\"\n * data-timeline-font-size=\"13px\"\n * data-timeline-container=\"#timeline\"\n * >\n * </wavesurfer>\n * <div id=\"timeline\"></div>\n *\n * <!-- with regions plugin -->\n * <wavesurfer\n * data-url=\"../media/demo.wav\"\n * data-plugins=\"regions\"\n * data-regions-regions='[{\"start\": 1,\"end\": 3,\"color\": \"hsla(400, 100%, 30%, 0.5)\"}]'\n * >\n * </wavesurfer>\n */\nclass Init {\n /**\n * Instantiate Init class and initialize elements\n *\n * This is done automatically if `window` is defined and\n * `window.WS_StopAutoInit` is not set to true\n *\n * @param {WaveSurfer} WaveSurfer The WaveSurfer library object\n * @param {InitParams} params initialisation options\n */\n constructor(WaveSurfer, params = {}) {\n if (!WaveSurfer) {\n throw new Error('WaveSurfer is not available!');\n }\n\n /**\n * cache WaveSurfer\n * @private\n */\n this.WaveSurfer = WaveSurfer;\n\n /**\n * build parameters, cache them in _params so minified builds are smaller\n * @private\n */\n const _params = (this.params = Object.assign(\n {},\n {\n // wavesurfer parameter defaults so by default the audio player is\n // usable with native media element controls\n defaults: {\n backend: 'MediaElement',\n mediaControls: true\n },\n // containers to instantiate on, can be selector string or NodeList\n containers: 'wavesurfer',\n // @TODO insert plugin CDN URIs\n pluginCdnTemplate:\n '//localhost:8080/dist/plugin/wavesurfer.[name].js',\n // loadPlugin function can be overridden to inject plugin definition\n // objects, this default function uses load-script to load a plugin\n // and pass it to a callback\n loadPlugin(name, cb) {\n const src = _params.pluginCdnTemplate.replace(\n '[name]',\n name\n );\n loadScript(src, { async: false }, (err, plugin) => {\n if (err) {\n // eslint-disable-next-line no-console\n return console.error(\n `WaveSurfer plugin ${name} not found at ${src}`\n );\n }\n cb(window.WaveSurfer[name]);\n });\n }\n },\n params\n ));\n /**\n * The nodes that should have instances attached to them\n * @type {NodeList}\n */\n this.containers =\n typeof _params.containers == 'string'\n ? document.querySelectorAll(_params.containers)\n : _params.containers;\n /** @private */\n this.pluginCache = {};\n /**\n * An array of wavesurfer instances\n * @type {Object[]}\n */\n this.instances = [];\n\n this.initAllEls();\n }\n\n /**\n * Initialize all container elements\n */\n initAllEls() {\n // iterate over all the container elements\n Array.prototype.forEach.call(this.containers, el => {\n // load the plugins as an array of plugin names\n const plugins = el.dataset.plugins\n ? el.dataset.plugins.split(',')\n : [];\n\n // no plugins to be loaded, just render\n if (!plugins.length) {\n return this.initEl(el);\n }\n // … or: iterate over all the plugins\n plugins.forEach((name, i) => {\n // plugin is not cached already, load it\n if (!this.pluginCache[name]) {\n this.params.loadPlugin(name, lib => {\n this.pluginCache[name] = lib;\n // plugins were all loaded, render the element\n if (i + 1 === plugins.length) {\n this.initEl(el, plugins);\n }\n });\n } else if (i === plugins.length) {\n // plugin was cached and this plugin was the last\n this.initEl(el, plugins);\n }\n });\n });\n }\n\n /**\n * Initialize a single container element and add to `this.instances`\n *\n * @param {HTMLElement} el The container to instantiate wavesurfer to\n * @param {PluginDefinition[]} plugins An Array of plugin names to initialize with\n * @return {Object} Wavesurfer instance\n */\n initEl(el, plugins = []) {\n const jsonRegex = /^[[|{]/;\n // initialize plugins with the correct options\n const initialisedPlugins = plugins.map(plugin => {\n const options = {};\n // the regex to find this plugin attributes\n const attrNameRegex = new RegExp('^' + plugin);\n let attrName;\n // iterate over all the data attributes and find ones for this\n // plugin\n for (attrName in el.dataset) {\n const regexResult = attrNameRegex.exec(attrName);\n if (regexResult) {\n const attr = el.dataset[attrName];\n // if the string begins with a [ or a { parse it as JSON\n const prop = jsonRegex.test(attr) ? JSON.parse(attr) : attr;\n // this removes the plugin prefix and changes the first letter\n // of the resulting string to lower case to follow the naming\n // convention of ws params\n const unprefixedOptionName =\n attrName\n .slice(plugin.length, plugin.length + 1)\n .toLowerCase() + attrName.slice(plugin.length + 1);\n options[unprefixedOptionName] = prop;\n }\n }\n return this.pluginCache[plugin].create(options);\n });\n // build parameter object for this container\n const params = Object.assign(\n { container: el },\n this.params.defaults,\n el.dataset,\n { plugins: initialisedPlugins }\n );\n\n // @TODO make nicer\n el.style.display = 'block';\n\n // initialize wavesurfer, load audio (with peaks if provided)\n const instance = this.WaveSurfer.create(params);\n const peaks = params.peaks ? JSON.parse(params.peaks) : undefined;\n instance.load(params.url, peaks);\n\n // push this instance into the instances cache\n this.instances.push(instance);\n return instance;\n }\n}\n\n// if window object exists and window.WS_StopAutoInit is not true\nif (typeof window === 'object' && !window.WS_StopAutoInit) {\n // call init when document is ready, apply any custom default settings\n // in window.WS_InitOptions\n if (document.readyState === 'complete') {\n window.WaveSurferInit = new Init(\n window.WaveSurfer,\n window.WS_InitOptions\n );\n } else {\n window.addEventListener('load', () => {\n window.WaveSurferInit = new Init(\n window.WaveSurfer,\n window.WS_InitOptions\n );\n });\n }\n}\n\n// export init for manual usage\nexport default Init;\n","\nmodule.exports = function load (src, opts, cb) {\n var head = document.head || document.getElementsByTagName('head')[0]\n var script = document.createElement('script')\n\n if (typeof opts === 'function') {\n cb = opts\n opts = {}\n }\n\n opts = opts || {}\n cb = cb || function() {}\n\n script.type = opts.type || 'text/javascript'\n script.charset = opts.charset || 'utf8';\n script.async = 'async' in opts ? !!opts.async : true\n script.src = src\n\n if (opts.attrs) {\n setAttributes(script, opts.attrs)\n }\n\n if (opts.text) {\n script.text = '' + opts.text\n }\n\n var onend = 'onload' in script ? stdOnEnd : ieOnEnd\n onend(script, cb)\n\n // some good legacy browsers (firefox) fail the 'in' detection above\n // so as a fallback we always set onload\n // old IE will ignore this and new IE will set onload\n if (!script.onload) {\n stdOnEnd(script, cb);\n }\n\n head.appendChild(script)\n}\n\nfunction setAttributes(script, attrs) {\n for (var attr in attrs) {\n script.setAttribute(attr, attrs[attr]);\n }\n}\n\nfunction stdOnEnd (script, cb) {\n script.onload = function () {\n this.onerror = this.onload = null\n cb(null, script)\n }\n script.onerror = function () {\n // this.onload = null here is necessary\n // because even IE9 works not like others\n this.onerror = this.onload = null\n cb(new Error('Failed to load ' + this.src), script)\n }\n}\n\nfunction ieOnEnd (script, cb) {\n script.onreadystatechange = function () {\n if (this.readyState != 'complete' && this.readyState != 'loaded') return\n this.onreadystatechange = null\n cb(null, script) // there is no way to catch loading errors in IE8\n }\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(531);\n"],"names":["root","factory","exports","module","define","amd","self","Init","WaveSurfer","params","Error","this","_params","Object","assign","defaults","backend","mediaControls","containers","pluginCdnTemplate","loadPlugin","name","cb","src","replace","loadScript","async","err","plugin","console","error","window","document","querySelectorAll","pluginCache","instances","initAllEls","Array","prototype","forEach","call","el","plugins","dataset","split","length","initEl","i","lib","jsonRegex","initialisedPlugins","map","attrName","options","attrNameRegex","RegExp","exec","attr","prop","test","JSON","parse","slice","toLowerCase","create","container","style","display","instance","peaks","undefined","load","url","push","WS_StopAutoInit","readyState","WaveSurferInit","WS_InitOptions","addEventListener","stdOnEnd","script","onload","onerror","ieOnEnd","onreadystatechange","opts","head","getElementsByTagName","createElement","type","charset","attrs","setAttribute","setAttributes","text","appendChild","__webpack_module_cache__","__webpack_exports__","__webpack_require__","moduleId","cachedModule","__webpack_modules__"],"sourceRoot":""}
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * wavesurfer.js 6.2.0 (2022-05-16)
2
+ * wavesurfer.js 6.3.0 (2022-10-03)
3
3
  * https://wavesurfer-js.org
4
4
  * @license BSD-3-Clause
5
5
  */
@@ -486,7 +486,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
486
486
 
487
487
  function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
488
488
 
489
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
489
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
490
490
 
491
491
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
492
492
 
@@ -496,7 +496,7 @@ function _assertThisInitialized(self) { if (self === void 0) { throw new Referen
496
496
 
497
497
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
498
498
 
499
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
499
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
500
500
 
501
501
  /**
502
502
  * Parent class for renderers
@@ -987,7 +987,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
987
987
 
988
988
  function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
989
989
 
990
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
990
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
991
991
 
992
992
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
993
993
 
@@ -997,7 +997,7 @@ function _assertThisInitialized(self) { if (self === void 0) { throw new Referen
997
997
 
998
998
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
999
999
 
1000
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
1000
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
1001
1001
 
1002
1002
  /**
1003
1003
  * MultiCanvas renderer for wavesurfer. Is currently the default and sole
@@ -1338,11 +1338,11 @@ var MultiCanvas = /*#__PURE__*/function (_Drawer) {
1338
1338
  } while (peakIndexRange < peakIndexEnd); // calculate the height of this bar according to the highest peak found
1339
1339
 
1340
1340
 
1341
- var h = Math.round(peak / absmax * halfH); // in case of silences, allow the user to specify that we
1342
- // always draw *something* (normally a 1px high bar)
1341
+ var h = Math.round(peak / absmax * halfH); // raise the bar height to the specified minimum height
1342
+ // Math.max is used to replace any value smaller than barMinHeight (not just 0) with barMinHeight
1343
1343
 
1344
- if (h == 0 && _this4.params.barMinHeight) {
1345
- h = _this4.params.barMinHeight;
1344
+ if (_this4.params.barMinHeight) {
1345
+ h = Math.max(h, _this4.params.barMinHeight);
1346
1346
  }
1347
1347
 
1348
1348
  _this4.fillRect(peakIndex + _this4.halfPixel, halfH - h + offsetY, bar + _this4.halfPixel, h * 2, _this4.barRadius, ch);
@@ -1680,13 +1680,13 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i+
1680
1680
 
1681
1681
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
1682
1682
 
1683
- function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }
1683
+ function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }
1684
1684
 
1685
1685
  function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
1686
1686
 
1687
1687
  function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
1688
1688
 
1689
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
1689
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
1690
1690
 
1691
1691
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
1692
1692
 
@@ -1696,7 +1696,7 @@ function _assertThisInitialized(self) { if (self === void 0) { throw new Referen
1696
1696
 
1697
1697
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
1698
1698
 
1699
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
1699
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
1700
1700
 
1701
1701
  /**
1702
1702
  * MediaElementWebAudio backend: load audio via an HTML5 audio tag, but playback with the WebAudio API.
@@ -1835,13 +1835,13 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i+
1835
1835
 
1836
1836
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
1837
1837
 
1838
- function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }
1838
+ function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }
1839
1839
 
1840
1840
  function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
1841
1841
 
1842
1842
  function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
1843
1843
 
1844
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
1844
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
1845
1845
 
1846
1846
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
1847
1847
 
@@ -1851,7 +1851,7 @@ function _assertThisInitialized(self) { if (self === void 0) { throw new Referen
1851
1851
 
1852
1852
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
1853
1853
 
1854
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
1854
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
1855
1855
 
1856
1856
  /**
1857
1857
  * MediaElement backend
@@ -3645,7 +3645,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
3645
3645
 
3646
3646
  function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
3647
3647
 
3648
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
3648
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
3649
3649
 
3650
3650
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
3651
3651
 
@@ -3655,7 +3655,7 @@ function _assertThisInitialized(self) { if (self === void 0) { throw new Referen
3655
3655
 
3656
3656
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
3657
3657
 
3658
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
3658
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
3659
3659
 
3660
3660
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
3661
3661
 
@@ -3840,6 +3840,8 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
3840
3840
  * @property {boolean} relativeNormalization=false determines whether
3841
3841
  * normalization is done per channel or maintains proportionality between
3842
3842
  * channels. Only applied when normalize and splitChannels are both true.
3843
+ * @property {boolean} splitDragSelection=false determines if drag selection in regions
3844
+ * plugin works separately on each channel or only one selection for all channels
3843
3845
  * @since 4.3.0
3844
3846
  */
3845
3847
 
@@ -4001,7 +4003,8 @@ var WaveSurfer = /*#__PURE__*/function (_util$Observer) {
4001
4003
  overlay: false,
4002
4004
  channelColors: {},
4003
4005
  filterChannels: [],
4004
- relativeNormalization: false
4006
+ relativeNormalization: false,
4007
+ splitDragSelection: false
4005
4008
  },
4006
4009
  vertical: false,
4007
4010
  waveColor: '#999',
@@ -5446,19 +5449,19 @@ var WaveSurfer = /*#__PURE__*/function (_util$Observer) {
5446
5449
  /**
5447
5450
  * Save waveform image as data URI.
5448
5451
  *
5449
- * The default format is `'image/png'`. Other supported types are
5450
- * `'image/jpeg'` and `'image/webp'`.
5452
+ * The default format is `image/png`. Other supported types are
5453
+ * `image/jpeg` and `image/webp`.
5451
5454
  *
5452
5455
  * @param {string} format='image/png' A string indicating the image format.
5453
- * The default format type is `'image/png'`.
5456
+ * The default format type is `image/png`.
5454
5457
  * @param {number} quality=1 A number between 0 and 1 indicating the image
5455
5458
  * quality to use for image formats that use lossy compression such as
5456
- * `'image/jpeg'`` and `'image/webp'`.
5457
- * @param {string} type Image data type to return. Either 'dataURL' (default)
5458
- * or 'blob'.
5459
- * @return {string|string[]|Promise} When using `'dataURL'` type this returns
5459
+ * `image/jpeg` and `image/webp`.
5460
+ * @param {string} type Image data type to return. Either `dataURL` (default)
5461
+ * or `blob`.
5462
+ * @return {string|string[]|Promise} When using `dataURL` type this returns
5460
5463
  * a single data URL or an array of data URLs, one for each canvas. When using
5461
- * `'blob'` type this returns a `Promise` resolving with an array of `Blob`
5464
+ * `blob` type this returns a `Promise` resolving with an array of `Blob`
5462
5465
  * instances, one for each canvas.
5463
5466
  */
5464
5467
 
@@ -5600,7 +5603,7 @@ var WaveSurfer = /*#__PURE__*/function (_util$Observer) {
5600
5603
 
5601
5604
  exports["default"] = WaveSurfer;
5602
5605
 
5603
- _defineProperty(WaveSurfer, "VERSION", "6.2.0");
5606
+ _defineProperty(WaveSurfer, "VERSION", "6.3.0");
5604
5607
 
5605
5608
  _defineProperty(WaveSurfer, "util", util);
5606
5609
 
@@ -5638,7 +5641,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
5638
5641
 
5639
5642
  function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
5640
5643
 
5641
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
5644
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
5642
5645
 
5643
5646
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
5644
5647
 
@@ -5648,7 +5651,7 @@ function _assertThisInitialized(self) { if (self === void 0) { throw new Referen
5648
5651
 
5649
5652
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
5650
5653
 
5651
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
5654
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
5652
5655
 
5653
5656
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5654
5657