@prolibu-suite/cobalt-core 0.11.4 → 0.11.5
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.
- package/custom-elements.json +31 -31
- package/dist/cjs/co-audio-player.cjs.entry.js +198 -46
- package/dist/cjs/index-bHoidDwv.js +4 -4
- package/dist/cobalt/cobalt.esm.js +1 -1
- package/dist/cobalt/p-4a7fd0b4.entry.js +1 -0
- package/dist/collection/components/co-audio-player/co-audio-player.js +40 -47
- package/dist/collection/components/co-audio-player/co-audio-player.peaks-cache.js +104 -0
- package/dist/collection/components/co-audio-player/co-audio-player.utils.js +61 -0
- package/dist/collection/components/co-autocomplete/co-autocomplete.js +1 -1
- package/dist/collection/components/co-avatar-group/co-avatar-group.js +1 -1
- package/dist/collection/components/co-checkbox-group/co-checkbox-group.js +1 -1
- package/dist/collection/components/co-color-area/co-color-area.js +2 -2
- package/dist/collection/components/co-color-slider/co-color-slider.js +1 -1
- package/dist/collection/components/co-combobox/co-combobox.js +1 -1
- package/dist/collection/components/co-command-search/co-command-search.js +1 -1
- package/dist/collection/components/co-data-table/co-data-table.js +1 -1
- package/dist/collection/components/co-date-range-picker/co-date-range-picker.js +2 -2
- package/dist/collection/components/co-document-editor/co-document-editor.js +5 -5
- package/dist/collection/components/co-popover/co-popover.js +1 -1
- package/dist/collection/components/co-radio-group/co-radio-group.js +1 -1
- package/dist/collection/components/co-ref-field/co-ref-field.js +4 -4
- package/dist/collection/components/co-segmented-bar/co-segmented-bar.js +1 -1
- package/dist/collection/components/co-select/co-select.js +1 -1
- package/dist/collection/components/co-sidebar-nav/co-sidebar-nav.js +1 -1
- package/dist/collection/components/co-toast/co-toast.js +2 -2
- package/dist/collection/components/co-transfer-list/co-transfer-list.js +1 -1
- package/dist/collection/components/co-tree-item/co-tree-item.js +2 -2
- package/dist/components/co-audio-player.js +1 -1
- package/dist/esm/co-audio-player.entry.js +198 -46
- package/dist/esm/index-DJkaRtbb.js +4 -4
- package/dist/types/components/co-audio-player/co-audio-player.d.ts +8 -1
- package/dist/types/components/co-audio-player/co-audio-player.peaks-cache.d.ts +58 -0
- package/dist/types/components/co-audio-player/co-audio-player.utils.d.ts +33 -0
- package/package.json +3 -3
- package/dist/cobalt/p-358a6c2a.entry.js +0 -1
|
@@ -431,7 +431,7 @@ export class CoAutocomplete {
|
|
|
431
431
|
"references": {
|
|
432
432
|
"AutocompleteOption": {
|
|
433
433
|
"location": "local",
|
|
434
|
-
"path": "/Users/agox/worktrees/cobalt-
|
|
434
|
+
"path": "/Users/agox/worktrees/cobalt-audio-peaks/packages/core/src/components/co-autocomplete/co-autocomplete.tsx",
|
|
435
435
|
"id": "src/components/co-autocomplete/co-autocomplete.tsx::AutocompleteOption"
|
|
436
436
|
}
|
|
437
437
|
}
|
|
@@ -92,7 +92,7 @@ export class CoAvatarGroup {
|
|
|
92
92
|
"references": {
|
|
93
93
|
"CoAvatarGroupItem": {
|
|
94
94
|
"location": "local",
|
|
95
|
-
"path": "/Users/agox/worktrees/cobalt-
|
|
95
|
+
"path": "/Users/agox/worktrees/cobalt-audio-peaks/packages/core/src/components/co-avatar-group/co-avatar-group.tsx",
|
|
96
96
|
"id": "src/components/co-avatar-group/co-avatar-group.tsx::CoAvatarGroupItem"
|
|
97
97
|
}
|
|
98
98
|
}
|
|
@@ -236,7 +236,7 @@ export class CoCheckboxGroup {
|
|
|
236
236
|
"references": {
|
|
237
237
|
"CheckboxOption": {
|
|
238
238
|
"location": "local",
|
|
239
|
-
"path": "/Users/agox/worktrees/cobalt-
|
|
239
|
+
"path": "/Users/agox/worktrees/cobalt-audio-peaks/packages/core/src/components/co-checkbox-group/co-checkbox-group.tsx",
|
|
240
240
|
"id": "src/components/co-checkbox-group/co-checkbox-group.tsx::CheckboxOption"
|
|
241
241
|
}
|
|
242
242
|
}
|
|
@@ -310,7 +310,7 @@ export class CoColorArea {
|
|
|
310
310
|
"references": {
|
|
311
311
|
"ColorAreaDetail": {
|
|
312
312
|
"location": "local",
|
|
313
|
-
"path": "/Users/agox/worktrees/cobalt-
|
|
313
|
+
"path": "/Users/agox/worktrees/cobalt-audio-peaks/packages/core/src/components/co-color-area/co-color-area.tsx",
|
|
314
314
|
"id": "src/components/co-color-area/co-color-area.tsx::ColorAreaDetail"
|
|
315
315
|
}
|
|
316
316
|
}
|
|
@@ -331,7 +331,7 @@ export class CoColorArea {
|
|
|
331
331
|
"references": {
|
|
332
332
|
"ColorAreaDetail": {
|
|
333
333
|
"location": "local",
|
|
334
|
-
"path": "/Users/agox/worktrees/cobalt-
|
|
334
|
+
"path": "/Users/agox/worktrees/cobalt-audio-peaks/packages/core/src/components/co-color-area/co-color-area.tsx",
|
|
335
335
|
"id": "src/components/co-color-area/co-color-area.tsx::ColorAreaDetail"
|
|
336
336
|
}
|
|
337
337
|
}
|
|
@@ -215,7 +215,7 @@ export class CoColorSlider {
|
|
|
215
215
|
"references": {
|
|
216
216
|
"ColorSliderChannel": {
|
|
217
217
|
"location": "local",
|
|
218
|
-
"path": "/Users/agox/worktrees/cobalt-
|
|
218
|
+
"path": "/Users/agox/worktrees/cobalt-audio-peaks/packages/core/src/components/co-color-slider/co-color-slider.tsx",
|
|
219
219
|
"id": "src/components/co-color-slider/co-color-slider.tsx::ColorSliderChannel"
|
|
220
220
|
}
|
|
221
221
|
}
|
|
@@ -545,7 +545,7 @@ export class CoCombobox {
|
|
|
545
545
|
"references": {
|
|
546
546
|
"ComboboxOption": {
|
|
547
547
|
"location": "local",
|
|
548
|
-
"path": "/Users/agox/worktrees/cobalt-
|
|
548
|
+
"path": "/Users/agox/worktrees/cobalt-audio-peaks/packages/core/src/components/co-combobox/co-combobox.tsx",
|
|
549
549
|
"id": "src/components/co-combobox/co-combobox.tsx::ComboboxOption"
|
|
550
550
|
}
|
|
551
551
|
}
|
|
@@ -257,7 +257,7 @@ export class CoCommandSearch {
|
|
|
257
257
|
"references": {
|
|
258
258
|
"CommandItem": {
|
|
259
259
|
"location": "local",
|
|
260
|
-
"path": "/Users/agox/worktrees/cobalt-
|
|
260
|
+
"path": "/Users/agox/worktrees/cobalt-audio-peaks/packages/core/src/components/co-command-search/co-command-search.tsx",
|
|
261
261
|
"id": "src/components/co-command-search/co-command-search.tsx::CommandItem"
|
|
262
262
|
}
|
|
263
263
|
}
|
|
@@ -509,7 +509,7 @@ export class CoDataTable {
|
|
|
509
509
|
"references": {
|
|
510
510
|
"CoDataTableColumn": {
|
|
511
511
|
"location": "local",
|
|
512
|
-
"path": "/Users/agox/worktrees/cobalt-
|
|
512
|
+
"path": "/Users/agox/worktrees/cobalt-audio-peaks/packages/core/src/components/co-data-table/co-data-table.tsx",
|
|
513
513
|
"id": "src/components/co-data-table/co-data-table.tsx::CoDataTableColumn"
|
|
514
514
|
}
|
|
515
515
|
}
|
|
@@ -1055,7 +1055,7 @@ export class CoDateRangePicker {
|
|
|
1055
1055
|
"references": {
|
|
1056
1056
|
"DateRangeValue": {
|
|
1057
1057
|
"location": "local",
|
|
1058
|
-
"path": "/Users/agox/worktrees/cobalt-
|
|
1058
|
+
"path": "/Users/agox/worktrees/cobalt-audio-peaks/packages/core/src/components/co-date-range-picker/co-date-range-picker.tsx",
|
|
1059
1059
|
"id": "src/components/co-date-range-picker/co-date-range-picker.tsx::DateRangeValue"
|
|
1060
1060
|
}
|
|
1061
1061
|
}
|
|
@@ -1076,7 +1076,7 @@ export class CoDateRangePicker {
|
|
|
1076
1076
|
"references": {
|
|
1077
1077
|
"DateRangeValue": {
|
|
1078
1078
|
"location": "local",
|
|
1079
|
-
"path": "/Users/agox/worktrees/cobalt-
|
|
1079
|
+
"path": "/Users/agox/worktrees/cobalt-audio-peaks/packages/core/src/components/co-date-range-picker/co-date-range-picker.tsx",
|
|
1080
1080
|
"id": "src/components/co-date-range-picker/co-date-range-picker.tsx::DateRangeValue"
|
|
1081
1081
|
}
|
|
1082
1082
|
}
|
|
@@ -936,7 +936,7 @@ export class CoDocumentEditor {
|
|
|
936
936
|
"references": {
|
|
937
937
|
"DocumentPageSize": {
|
|
938
938
|
"location": "local",
|
|
939
|
-
"path": "/Users/agox/worktrees/cobalt-
|
|
939
|
+
"path": "/Users/agox/worktrees/cobalt-audio-peaks/packages/core/src/components/co-document-editor/co-document-editor.tsx",
|
|
940
940
|
"id": "src/components/co-document-editor/co-document-editor.tsx::DocumentPageSize"
|
|
941
941
|
}
|
|
942
942
|
}
|
|
@@ -962,7 +962,7 @@ export class CoDocumentEditor {
|
|
|
962
962
|
"references": {
|
|
963
963
|
"DocumentMargins": {
|
|
964
964
|
"location": "local",
|
|
965
|
-
"path": "/Users/agox/worktrees/cobalt-
|
|
965
|
+
"path": "/Users/agox/worktrees/cobalt-audio-peaks/packages/core/src/components/co-document-editor/co-document-editor.tsx",
|
|
966
966
|
"id": "src/components/co-document-editor/co-document-editor.tsx::DocumentMargins"
|
|
967
967
|
}
|
|
968
968
|
}
|
|
@@ -1027,7 +1027,7 @@ export class CoDocumentEditor {
|
|
|
1027
1027
|
"references": {
|
|
1028
1028
|
"DocumentFeatures": {
|
|
1029
1029
|
"location": "local",
|
|
1030
|
-
"path": "/Users/agox/worktrees/cobalt-
|
|
1030
|
+
"path": "/Users/agox/worktrees/cobalt-audio-peaks/packages/core/src/components/co-document-editor/co-document-editor.tsx",
|
|
1031
1031
|
"id": "src/components/co-document-editor/co-document-editor.tsx::DocumentFeatures"
|
|
1032
1032
|
}
|
|
1033
1033
|
}
|
|
@@ -1220,7 +1220,7 @@ export class CoDocumentEditor {
|
|
|
1220
1220
|
"references": {
|
|
1221
1221
|
"DocumentHeaderDetail": {
|
|
1222
1222
|
"location": "local",
|
|
1223
|
-
"path": "/Users/agox/worktrees/cobalt-
|
|
1223
|
+
"path": "/Users/agox/worktrees/cobalt-audio-peaks/packages/core/src/components/co-document-editor/co-document-editor.tsx",
|
|
1224
1224
|
"id": "src/components/co-document-editor/co-document-editor.tsx::DocumentHeaderDetail"
|
|
1225
1225
|
}
|
|
1226
1226
|
}
|
|
@@ -1256,7 +1256,7 @@ export class CoDocumentEditor {
|
|
|
1256
1256
|
"references": {
|
|
1257
1257
|
"DocumentActionDetail": {
|
|
1258
1258
|
"location": "local",
|
|
1259
|
-
"path": "/Users/agox/worktrees/cobalt-
|
|
1259
|
+
"path": "/Users/agox/worktrees/cobalt-audio-peaks/packages/core/src/components/co-document-editor/co-document-editor.tsx",
|
|
1260
1260
|
"id": "src/components/co-document-editor/co-document-editor.tsx::DocumentActionDetail"
|
|
1261
1261
|
}
|
|
1262
1262
|
}
|
|
@@ -446,7 +446,7 @@ export class CoPopover {
|
|
|
446
446
|
"references": {
|
|
447
447
|
"PopoverPlacement": {
|
|
448
448
|
"location": "local",
|
|
449
|
-
"path": "/Users/agox/worktrees/cobalt-
|
|
449
|
+
"path": "/Users/agox/worktrees/cobalt-audio-peaks/packages/core/src/components/co-popover/co-popover.tsx",
|
|
450
450
|
"id": "src/components/co-popover/co-popover.tsx::PopoverPlacement"
|
|
451
451
|
}
|
|
452
452
|
}
|
|
@@ -224,7 +224,7 @@ export class CoRadioGroup {
|
|
|
224
224
|
"references": {
|
|
225
225
|
"RadioOption": {
|
|
226
226
|
"location": "local",
|
|
227
|
-
"path": "/Users/agox/worktrees/cobalt-
|
|
227
|
+
"path": "/Users/agox/worktrees/cobalt-audio-peaks/packages/core/src/components/co-radio-group/co-radio-group.tsx",
|
|
228
228
|
"id": "src/components/co-radio-group/co-radio-group.tsx::RadioOption"
|
|
229
229
|
}
|
|
230
230
|
}
|
|
@@ -1349,7 +1349,7 @@ export class CoRefField {
|
|
|
1349
1349
|
"references": {
|
|
1350
1350
|
"RefFieldOption": {
|
|
1351
1351
|
"location": "local",
|
|
1352
|
-
"path": "/Users/agox/worktrees/cobalt-
|
|
1352
|
+
"path": "/Users/agox/worktrees/cobalt-audio-peaks/packages/core/src/components/co-ref-field/co-ref-field.tsx",
|
|
1353
1353
|
"id": "src/components/co-ref-field/co-ref-field.tsx::RefFieldOption"
|
|
1354
1354
|
}
|
|
1355
1355
|
}
|
|
@@ -1490,7 +1490,7 @@ export class CoRefField {
|
|
|
1490
1490
|
"references": {
|
|
1491
1491
|
"RefFieldOption": {
|
|
1492
1492
|
"location": "local",
|
|
1493
|
-
"path": "/Users/agox/worktrees/cobalt-
|
|
1493
|
+
"path": "/Users/agox/worktrees/cobalt-audio-peaks/packages/core/src/components/co-ref-field/co-ref-field.tsx",
|
|
1494
1494
|
"id": "src/components/co-ref-field/co-ref-field.tsx::RefFieldOption"
|
|
1495
1495
|
}
|
|
1496
1496
|
}
|
|
@@ -1511,7 +1511,7 @@ export class CoRefField {
|
|
|
1511
1511
|
"references": {
|
|
1512
1512
|
"RefFieldOption": {
|
|
1513
1513
|
"location": "local",
|
|
1514
|
-
"path": "/Users/agox/worktrees/cobalt-
|
|
1514
|
+
"path": "/Users/agox/worktrees/cobalt-audio-peaks/packages/core/src/components/co-ref-field/co-ref-field.tsx",
|
|
1515
1515
|
"id": "src/components/co-ref-field/co-ref-field.tsx::RefFieldOption"
|
|
1516
1516
|
}
|
|
1517
1517
|
}
|
|
@@ -1550,7 +1550,7 @@ export class CoRefField {
|
|
|
1550
1550
|
},
|
|
1551
1551
|
"RefFieldOption": {
|
|
1552
1552
|
"location": "local",
|
|
1553
|
-
"path": "/Users/agox/worktrees/cobalt-
|
|
1553
|
+
"path": "/Users/agox/worktrees/cobalt-audio-peaks/packages/core/src/components/co-ref-field/co-ref-field.tsx",
|
|
1554
1554
|
"id": "src/components/co-ref-field/co-ref-field.tsx::RefFieldOption"
|
|
1555
1555
|
}
|
|
1556
1556
|
},
|
|
@@ -160,7 +160,7 @@ export class CoSegmentedBar {
|
|
|
160
160
|
"references": {
|
|
161
161
|
"CoSegment": {
|
|
162
162
|
"location": "local",
|
|
163
|
-
"path": "/Users/agox/worktrees/cobalt-
|
|
163
|
+
"path": "/Users/agox/worktrees/cobalt-audio-peaks/packages/core/src/components/co-segmented-bar/co-segmented-bar.tsx",
|
|
164
164
|
"id": "src/components/co-segmented-bar/co-segmented-bar.tsx::CoSegment"
|
|
165
165
|
}
|
|
166
166
|
}
|
|
@@ -846,7 +846,7 @@ export class CoSelect {
|
|
|
846
846
|
"references": {
|
|
847
847
|
"SelectOption": {
|
|
848
848
|
"location": "local",
|
|
849
|
-
"path": "/Users/agox/worktrees/cobalt-
|
|
849
|
+
"path": "/Users/agox/worktrees/cobalt-audio-peaks/packages/core/src/components/co-select/co-select.tsx",
|
|
850
850
|
"id": "src/components/co-select/co-select.tsx::SelectOption"
|
|
851
851
|
}
|
|
852
852
|
}
|
|
@@ -718,7 +718,7 @@ export class CoSidebarNav {
|
|
|
718
718
|
"references": {
|
|
719
719
|
"NavigateDetail": {
|
|
720
720
|
"location": "local",
|
|
721
|
-
"path": "/Users/agox/worktrees/cobalt-
|
|
721
|
+
"path": "/Users/agox/worktrees/cobalt-audio-peaks/packages/core/src/components/co-sidebar-nav/co-sidebar-nav.tsx",
|
|
722
722
|
"id": "src/components/co-sidebar-nav/co-sidebar-nav.tsx::NavigateDetail"
|
|
723
723
|
}
|
|
724
724
|
}
|
|
@@ -189,7 +189,7 @@ export class CoToast {
|
|
|
189
189
|
"references": {
|
|
190
190
|
"CoToastActionsLayout": {
|
|
191
191
|
"location": "local",
|
|
192
|
-
"path": "/Users/agox/worktrees/cobalt-
|
|
192
|
+
"path": "/Users/agox/worktrees/cobalt-audio-peaks/packages/core/src/components/co-toast/co-toast.tsx",
|
|
193
193
|
"id": "src/components/co-toast/co-toast.tsx::CoToastActionsLayout"
|
|
194
194
|
}
|
|
195
195
|
}
|
|
@@ -215,7 +215,7 @@ export class CoToast {
|
|
|
215
215
|
"references": {
|
|
216
216
|
"CoToastVariant": {
|
|
217
217
|
"location": "local",
|
|
218
|
-
"path": "/Users/agox/worktrees/cobalt-
|
|
218
|
+
"path": "/Users/agox/worktrees/cobalt-audio-peaks/packages/core/src/components/co-toast/co-toast.tsx",
|
|
219
219
|
"id": "src/components/co-toast/co-toast.tsx::CoToastVariant"
|
|
220
220
|
}
|
|
221
221
|
}
|
|
@@ -214,7 +214,7 @@ export class CoTransferList {
|
|
|
214
214
|
"references": {
|
|
215
215
|
"TransferOption": {
|
|
216
216
|
"location": "local",
|
|
217
|
-
"path": "/Users/agox/worktrees/cobalt-
|
|
217
|
+
"path": "/Users/agox/worktrees/cobalt-audio-peaks/packages/core/src/components/co-transfer-list/co-transfer-list.tsx",
|
|
218
218
|
"id": "src/components/co-transfer-list/co-transfer-list.tsx::TransferOption"
|
|
219
219
|
}
|
|
220
220
|
}
|
|
@@ -243,7 +243,7 @@ export class CoTreeItem {
|
|
|
243
243
|
"references": {
|
|
244
244
|
"TreeItemSelection": {
|
|
245
245
|
"location": "local",
|
|
246
|
-
"path": "/Users/agox/worktrees/cobalt-
|
|
246
|
+
"path": "/Users/agox/worktrees/cobalt-audio-peaks/packages/core/src/components/co-tree-item/co-tree-item.tsx",
|
|
247
247
|
"id": "src/components/co-tree-item/co-tree-item.tsx::TreeItemSelection"
|
|
248
248
|
}
|
|
249
249
|
}
|
|
@@ -269,7 +269,7 @@ export class CoTreeItem {
|
|
|
269
269
|
"references": {
|
|
270
270
|
"TreeItemSize": {
|
|
271
271
|
"location": "local",
|
|
272
|
-
"path": "/Users/agox/worktrees/cobalt-
|
|
272
|
+
"path": "/Users/agox/worktrees/cobalt-audio-peaks/packages/core/src/components/co-tree-item/co-tree-item.tsx",
|
|
273
273
|
"id": "src/components/co-tree-item/co-tree-item.tsx::TreeItemSize"
|
|
274
274
|
}
|
|
275
275
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t,p as i,H as a,c as s,h as e}from"./index.js";import{d as o}from"./p-KK2vAKs-.js";function r(t){if(!Number.isFinite(t)||t<0)return"--:--";const i=Math.floor(t);return`${Math.floor(i/60)}:${(""+i%60).padStart(2,"0")}`}function c(t,i){const a=t.length;if(!a||i<=0)return[];const s=Math.max(1,Math.floor(a/i)),e=[];for(let o=0;o<i;o++){let i=0;const r=o*s;for(let e=r;e<r+s&&e<a;e++){const a=Math.abs(t[e]);a>i&&(i=a)}e.push(.12+.88*i)}return e}function h(t){if(t<=0)return[];const i=[];for(let a=0;a<t;a++)i.push(.12+(.6*Math.sin(a/Math.max(1,t)*Math.PI)+.3)*(.75+.25*Math.abs(Math.sin(1.7*a)))*.88);return i}const n=i(class extends a{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.coPlay=s(this,"coPlay",7),this.coPause=s(this,"coPause",7),this.coEnded=s(this,"coEnded",7),this.coError=s(this,"coError",7),this.coTimeUpdate=s(this,"coTimeUpdate",3),this.compact=!1,this.bars=64,this.barDensity=3,this.preload="metadata",this.downloadFilename="audio",this.noDownload=!1,this.isPlaying=!1,this.isLoading=!1,this.hasError=!1,this.currentTime=0,this.duration=NaN,this.peaks=[],this.containerWidth=0,this.playbackRate=1,this.rawChannelData=null,this.decodedDuration=NaN,this.loadToken=0,this.onMeta=()=>{this.syncDuration(),this.applyPendingSeek()},this.pendingSeek=null,this.onCanPlay=()=>{this.isLoading=!1,this.applyPendingSeek()},this.onWaiting=()=>{this.isLoading=!0},this.onTime=()=>{var t;this.currentTime=(null===(t=this.audio)||void 0===t?void 0:t.currentTime)||0,this.coTimeUpdate.emit({currentTime:this.currentTime,duration:this.knownDuration})},this.onEnded=()=>{this.isPlaying=!1,this.currentTime=0,this.coEnded.emit()},this.onErr=t=>{this.isLoading=!1,this.hasError=!0,this.coError.emit(t)},this.toggle=()=>{this.audio&&!this.hasError&&(this.isPlaying?(this.audio.pause(),this.isPlaying=!1,this.coPause.emit()):this.audio.play().then((()=>{this.isPlaying=!0,this.coPlay.emit()})).catch((()=>{})))},this.SPEEDS=[1,1.5,2,.5],this.cycleSpeed=()=>{const t=this.SPEEDS.indexOf(this.playbackRate);this.playbackRate=this.SPEEDS[(t+1)%this.SPEEDS.length],this.audio&&(this.audio.playbackRate=this.playbackRate)},this.seekAt=t=>{const i=this.knownDuration;if(!this.audio||!this.waveEl||!i)return;const a=function(t,i){return i.width?Math.max(0,Math.min(1,(t-i.left)/i.width)):0}(t,this.waveEl.getBoundingClientRect());this.audio.currentTime=a*i,this.currentTime=this.audio.currentTime},this.onWaveKey=t=>{if(" "===t.key||"Enter"===t.key)return t.preventDefault(),void this.toggle();if(!this.audio)return;const i=this.knownDuration,a=this.audio.currentTime;if("ArrowRight"===t.key)this.audio.currentTime=i?Math.min(i,a+5):a+5;else{if("ArrowLeft"!==t.key)return;this.audio.currentTime=Math.max(0,a-5)}this.currentTime=this.audio.currentTime}}get knownDuration(){return Number.isFinite(this.duration)&&this.duration>0?this.duration:0}get effectiveBars(){return this.containerWidth>0?Math.max(24,Math.floor(this.containerWidth/this.barDensity)):this.bars}componentWillLoad(){this.init()}componentDidLoad(){if("undefined"==typeof ResizeObserver||!this.waveEl)return;this.resizeObserver=new ResizeObserver((t=>{var i;for(const a of t){const t=(null===(i=a.contentRect)||void 0===i?void 0:i.width)||a.target.clientWidth||0;t>2&&Math.abs(t-this.containerWidth)>2&&(this.containerWidth=t,this.rebuildBars())}})),this.resizeObserver.observe(this.waveEl);const t=this.waveEl.clientWidth||0;t>2&&(this.containerWidth=t,this.rebuildBars())}disconnectedCallback(){var t;this.loadToken++,this.teardown(),null===(t=this.resizeObserver)||void 0===t||t.disconnect(),this.resizeObserver=void 0}onSrcChange(){this.init()}rebuildBars(){this.peaks=this.rawChannelData?c(this.rawChannelData,this.effectiveBars):h(this.effectiveBars)}init(){this.teardown();const t=++this.loadToken;if(this.rawChannelData=null,this.decodedDuration=NaN,this.peaks=h(this.effectiveBars),this.currentTime=0,this.duration=NaN,this.playbackRate=1,this.hasError=!1,!this.src)return;if(this.isLoading=!0,this.extractPeaks(this.src,t),"undefined"==typeof Audio)return;const i=new Audio;i.preload=this.preload,i.crossOrigin="anonymous",i.src=this.src,i.addEventListener("loadedmetadata",this.onMeta),i.addEventListener("timeupdate",this.onTime),i.addEventListener("ended",this.onEnded),i.addEventListener("error",this.onErr),i.addEventListener("canplay",this.onCanPlay),i.addEventListener("waiting",this.onWaiting),this.audio=i}teardown(){this.audio&&(this.audio.pause(),this.audio.removeEventListener("loadedmetadata",this.onMeta),this.audio.removeEventListener("timeupdate",this.onTime),this.audio.removeEventListener("ended",this.onEnded),this.audio.removeEventListener("error",this.onErr),this.audio.removeEventListener("canplay",this.onCanPlay),this.audio.removeEventListener("waiting",this.onWaiting),this.audio.src="",this.audio=void 0),this.isPlaying=!1}async extractPeaks(t,i){var a;let s;try{const a=window.OfflineAudioContext||window.webkitOfflineAudioContext,e=window.AudioContext||window.webkitAudioContext;if(!a&&!e||"undefined"==typeof fetch)return;s=a?new a(1,1,44100):new e;const o=await(await fetch(t)).arrayBuffer(),r=await s.decodeAudioData(o);if(i!==this.loadToken)return;this.rawChannelData=r.getChannelData(0),this.decodedDuration=r.duration,this.peaks=c(this.rawChannelData,this.effectiveBars)}catch(t){if(i!==this.loadToken)return;this.rawChannelData=null,this.decodedDuration=NaN,this.peaks=h(this.effectiveBars)}finally{try{await(null===(a=null==s?void 0:s.close)||void 0===a?void 0:a.call(s))}catch(t){}}i===this.loadToken&&this.syncDuration()}syncDuration(){var t,i;const a=function(t,i){return Number.isFinite(t)&&t>0?t:Number.isFinite(i)&&i>0?i:NaN}(null!==(i=null===(t=this.audio)||void 0===t?void 0:t.duration)&&void 0!==i?i:NaN,this.decodedDuration);Object.is(a,this.duration)||(this.duration=a)}applyPendingSeek(){if(null==this.pendingSeek||!this.audio)return;const t=this.pendingSeek;this.pendingSeek=null,this.audio.currentTime=t,this.currentTime=this.audio.currentTime,this.coTimeUpdate.emit({currentTime:this.currentTime,duration:this.knownDuration})}async seek(t){var i;if(!this.audio||!Number.isFinite(t))return;const a=this.knownDuration,s=Math.max(0,a?Math.min(a,t):t);this.audio.currentTime=s,Math.abs((null!==(i=this.audio.currentTime)&&void 0!==i?i:0)-s)>.05&&(this.pendingSeek=s),this.currentTime=s,this.coTimeUpdate.emit({currentTime:this.currentTime,duration:a})}async play(){if(this.audio&&!this.isPlaying&&!this.hasError)try{await this.audio.play(),this.isPlaying=!0,this.coPlay.emit()}catch(t){}}async download(){if(this.src&&"undefined"!=typeof fetch)try{const t=await(await fetch(this.src)).blob(),i=URL.createObjectURL(t),a=document.createElement("a");a.href=i,a.download=this.downloadFilename,document.body.appendChild(a),a.click(),a.remove(),URL.revokeObjectURL(i)}catch(t){}}render(){const t=Math.max(1,3*this.peaks.length),i=this.knownDuration,a=i?this.currentTime/i*100:0,s=i?Math.floor(i):void 0,o=(t,i,a=!1)=>e("rect",{key:"4b294190b3be5e7cf15282d43e7e51164a3dda4c",x:3*i,y:20-40*t/2,width:1.8,height:Math.max(40*t,2),rx:.6,class:{"co-audio-player__bar":!0,"co-audio-player__bar--played":a}});return e("div",{key:"0758a438c4a71e822de94f8b41219945f62ae62d",class:{"co-audio-player":!0,"co-audio-player--compact":this.compact,"co-audio-player--error":this.hasError,"co-audio-player--playing":this.isPlaying},part:"player"},e("button",{key:"4c4161e7ba7344a9c6a32dcc8fd92c300b750d95",type:"button",class:"co-audio-player__play",part:"play","aria-label":this.hasError?"Audio no disponible":this.isPlaying?"Pausar":"Reproducir","aria-busy":this.isLoading?"true":"false",disabled:this.hasError||!this.src,onClick:this.toggle},e("co-icon",{key:"ea749ee1cf627a49e3859029ca274170c8d69c63",name:this.hasError?"warning-circle":this.isPlaying?"pause":"play",weight:"fill",size:this.compact?12:14})),e("div",{key:"f39bf8bf114860a672979fa53287672dccea1b7f",class:"co-audio-player__wave",part:"wave",role:"slider",tabindex:"0","aria-label":"Progreso de reproducción","aria-valuemin":0,"aria-valuemax":s,"aria-valuenow":Math.floor(this.currentTime),ref:t=>this.waveEl=t,onClick:t=>this.seekAt(t.clientX),onKeyDown:this.onWaveKey},e("svg",{key:"2145f303271ca676988999b5ea7d76ab384c5e2d",class:"co-audio-player__svg",viewBox:`0 0 ${t} 40`,preserveAspectRatio:"none","aria-hidden":"true"},this.peaks.map(((t,i)=>o(t,i))),e("clipPath",{key:"6014c9f96f5df60086265a5e01344be80ebff741",id:"co-ap-clip"},e("rect",{key:"5857fa3098fc0eb9df58b643c2b44316cf819ae8",x:"0",y:"0",width:a/100*t,height:40})),e("g",{key:"241608ddfdb863ba5b18444ed2bffb39e72abeb5","clip-path":"url(#co-ap-clip)"},this.peaks.map(((t,i)=>o(t,i,!0)))))),e("span",{key:"18f190b8b23f8939da5dd2c230214d42a5b330c1",class:"co-audio-player__time",part:"time"},r(this.currentTime)," / ",r(this.duration)),!this.compact&&e("button",{key:"4a29cae938ab347997bc76e0cfe5621b402730f7",type:"button",class:"co-audio-player__speed",part:"speed","aria-label":`Velocidad de reproducción ${this.playbackRate}x`,onClick:this.cycleSpeed},this.playbackRate,"x"),!this.compact&&!this.noDownload&&e("button",{key:"c451449e629584bc3937b27b31b1124e510af91e",type:"button",class:"co-audio-player__dl",part:"download","aria-label":"Descargar",onClick:()=>this.download()},e("co-icon",{key:"f4d014129829ab57ddae0d3e32b1e0930f1bc288",name:"download-simple",size:14})))}static get watchers(){return{src:[{onSrcChange:0}]}}static get style(){return":host{display:block;font-family:var(--co-font-family-primary)}.co-audio-player{display:flex;align-items:center;gap:var(--co-spacing-md);padding:var(--co-spacing-sm) var(--co-spacing-md);border:1px solid var(--co-semantic-border-default);border-radius:var(--co-border-radius-xs);background:var(--co-semantic-surface-secondary);min-width:180px}.co-audio-player--compact{gap:var(--co-spacing-sm2);padding:var(--co-spacing-sm2) var(--co-spacing-sm);min-width:140px}.co-audio-player__play{flex:0 0 auto;width:28px;height:28px;border:none;border-radius:50%;cursor:pointer;background:var(--co-semantic-surface-primary);color:var(--co-semantic-text-inverse);display:inline-flex;align-items:center;justify-content:center}.co-audio-player--compact .co-audio-player__play{width:24px;height:24px}.co-audio-player__play:disabled{opacity:.5;cursor:not-allowed}.co-audio-player__play:focus-visible{outline:2px solid var(--co-semantic-border-focus);outline-offset:2px}.co-audio-player__wave{flex:1;height:40px;min-width:0;cursor:pointer;display:flex;align-items:center}.co-audio-player__wave:focus-visible{outline:2px solid var(--co-semantic-border-focus);outline-offset:2px;border-radius:var(--co-border-radius-xxs)}.co-audio-player__svg{width:100%;height:100%;display:block}.co-audio-player__bar{fill:var(--co-semantic-border-field);transition:fill var(--co-motion-duration-fast)}.co-audio-player__wave:hover .co-audio-player__bar{fill:var(--co-semantic-text-muted)}.co-audio-player__bar--played{fill:var(--co-semantic-surface-primary)}.co-audio-player__time{flex:0 0 auto;font-size:var(--co-font-size-12);color:var(--co-semantic-text-muted);font-variant-numeric:tabular-nums;min-width:62px;text-align:right}.co-audio-player__speed{flex:0 0 auto;border:none;background:transparent;cursor:pointer;padding:2px 4px;color:var(--co-semantic-text-muted);font-family:var(--co-font-family-primary);font-size:var(--co-font-size-12);font-variant-numeric:tabular-nums;min-width:34px;text-align:center}.co-audio-player__speed:hover{color:var(--co-semantic-text-default)}.co-audio-player__speed:focus-visible{outline:2px solid var(--co-semantic-border-focus);outline-offset:2px;border-radius:var(--co-border-radius-xxs)}.co-audio-player__dl{flex:0 0 auto;border:none;background:transparent;cursor:pointer;padding:2px;color:var(--co-semantic-text-muted);display:inline-flex}.co-audio-player__dl:hover{color:var(--co-semantic-text-default)}.co-audio-player__dl:focus-visible{outline:2px solid var(--co-semantic-border-focus);outline-offset:2px}.co-audio-player--error .co-audio-player__wave{opacity:.5}.co-audio-player--error .co-audio-player__play{background:var(--co-color-status-error);color:var(--co-semantic-text-inverse);opacity:1}"}},[1,"co-audio-player",{src:[1],compact:[4],bars:[2],barDensity:[2,"bar-density"],preload:[1],downloadFilename:[1,"download-filename"],noDownload:[4,"no-download"],isPlaying:[32],isLoading:[32],hasError:[32],currentTime:[32],duration:[32],peaks:[32],containerWidth:[32],playbackRate:[32],seek:[64],play:[64]},void 0,{src:[{onSrcChange:0}]}]);function d(){"undefined"!=typeof customElements&&["co-audio-player","co-icon"].forEach((i=>{switch(i){case"co-audio-player":customElements.get(t(i))||customElements.define(t(i),n);break;case"co-icon":customElements.get(t(i))||o()}}))}d();const l=n,u=d;export{l as CoAudioPlayer,u as defineCustomElement}
|
|
1
|
+
import{t,p as i,H as a,c as e,h as s}from"./index.js";import{d as o}from"./p-KK2vAKs-.js";function r(t){if(!Number.isFinite(t)||t<0)return"--:--";const i=Math.floor(t);return`${Math.floor(i/60)}:${(""+i%60).padStart(2,"0")}`}function n(t,i){const a=t.length;if(!a||i<=0)return[];const e=Math.max(1,Math.floor(a/i)),s=[];for(let o=0;o<i;o++){let i=0;const r=o*e;for(let s=r;s<r+e&&s<a;s++){const a=Math.abs(t[s]);a>i&&(i=a)}s.push(.12+.88*i)}return s}function h(t,i=65536){const a=t.length,e=Math.max(1,Math.ceil(a/Math.max(1,i))),s=Math.ceil(a/e),o=new Float32Array(s);for(let i=0;i<s;i++){let s=0;const r=Math.min(a,(i+1)*e);for(let a=i*e;a<r;a++){const i=Math.abs(t[a]);i>s&&(s=i)}o[i]=s}return{peaks:o,blockSize:e,length:a}}function c(t){if(t<=0)return[];const i=[];for(let a=0;a<t;a++)i.push(.12+(.6*Math.sin(a/Math.max(1,t)*Math.PI)+.3)*(.75+.25*Math.abs(Math.sin(1.7*a)))*.88);return i}const d=new Map,l=new Map;function u(t,i){for(d.delete(t),d.set(t,i);d.size>16;)d.delete(d.keys().next().value)}function p(t,i,a=f){const e=d.get(t);if(e)return u(t,e),Promise.resolve(e);const s=l.get(t);if(s)return i&&s.wanted.add(i),s.promise;const o=new Set(i?[i]:[]),r=a(t,o).then((i=>(l.delete(t),i&&u(t,i),i)),(i=>{throw l.delete(t),i}));return l.set(t,{promise:r,wanted:o}),r}async function f(t,i=new Set){var a;let e;try{const a=window.OfflineAudioContext||window.webkitOfflineAudioContext,s=window.AudioContext||window.webkitAudioContext;if(!a&&!s||"undefined"==typeof fetch)return null;e=a?new a(1,1,44100):new s;const o=await(await fetch(t)).arrayBuffer(),r=await e.decodeAudioData(o),n=r.getChannelData(0);return{envelope:h(n),exact:y(n,i),duration:r.duration}}finally{try{await(null===(a=null==e?void 0:e.close)||void 0===a?void 0:a.call(e))}catch(t){}}}function y(t,i){const a=new Map;for(const e of i){const i=e();i>0&&!a.has(i)&&a.set(i,n(t,i))}return a}const b=i(class extends a{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.coPlay=e(this,"coPlay",7),this.coPause=e(this,"coPause",7),this.coEnded=e(this,"coEnded",7),this.coError=e(this,"coError",7),this.coTimeUpdate=e(this,"coTimeUpdate",3),this.compact=!1,this.bars=64,this.barDensity=3,this.preload="metadata",this.downloadFilename="audio",this.noDownload=!1,this.isPlaying=!1,this.isLoading=!1,this.hasError=!1,this.currentTime=0,this.duration=NaN,this.peaks=[],this.containerWidth=0,this.playbackRate=1,this.peakEnvelope=null,this.exactPeaks=null,this.decodedDuration=NaN,this.loadToken=0,this.onMeta=()=>{this.syncDuration(),this.applyPendingSeek()},this.pendingSeek=null,this.onCanPlay=()=>{this.isLoading=!1,this.applyPendingSeek()},this.onWaiting=()=>{this.isLoading=!0},this.onTime=()=>{var t;this.currentTime=(null===(t=this.audio)||void 0===t?void 0:t.currentTime)||0,this.coTimeUpdate.emit({currentTime:this.currentTime,duration:this.knownDuration})},this.onEnded=()=>{this.isPlaying=!1,this.currentTime=0,this.coEnded.emit()},this.onErr=t=>{this.isLoading=!1,this.hasError=!0,this.coError.emit(t)},this.toggle=()=>{this.audio&&!this.hasError&&(this.isPlaying?(this.audio.pause(),this.isPlaying=!1,this.coPause.emit()):this.audio.play().then((()=>{this.isPlaying=!0,this.coPlay.emit()})).catch((()=>{})))},this.SPEEDS=[1,1.5,2,.5],this.cycleSpeed=()=>{const t=this.SPEEDS.indexOf(this.playbackRate);this.playbackRate=this.SPEEDS[(t+1)%this.SPEEDS.length],this.audio&&(this.audio.playbackRate=this.playbackRate)},this.seekAt=t=>{const i=this.knownDuration;if(!this.audio||!this.waveEl||!i)return;const a=function(t,i){return i.width?Math.max(0,Math.min(1,(t-i.left)/i.width)):0}(t,this.waveEl.getBoundingClientRect());this.audio.currentTime=a*i,this.currentTime=this.audio.currentTime},this.onWaveKey=t=>{if(" "===t.key||"Enter"===t.key)return t.preventDefault(),void this.toggle();if(!this.audio)return;const i=this.knownDuration,a=this.audio.currentTime;if("ArrowRight"===t.key)this.audio.currentTime=i?Math.min(i,a+5):a+5;else{if("ArrowLeft"!==t.key)return;this.audio.currentTime=Math.max(0,a-5)}this.currentTime=this.audio.currentTime}}get knownDuration(){return Number.isFinite(this.duration)&&this.duration>0?this.duration:0}get effectiveBars(){return this.containerWidth>0?Math.max(24,Math.floor(this.containerWidth/this.barDensity)):this.bars}componentWillLoad(){this.init()}componentDidLoad(){if("undefined"==typeof ResizeObserver||!this.waveEl)return;this.resizeObserver=new ResizeObserver((t=>{var i;for(const a of t){const t=(null===(i=a.contentRect)||void 0===i?void 0:i.width)||a.target.clientWidth||0;t>2&&Math.abs(t-this.containerWidth)>2&&(this.containerWidth=t,this.rebuildBars())}})),this.resizeObserver.observe(this.waveEl);const t=this.waveEl.clientWidth||0;t>2&&(this.containerWidth=t,this.rebuildBars())}disconnectedCallback(){var t;this.loadToken++,this.teardown(),null===(t=this.resizeObserver)||void 0===t||t.disconnect(),this.resizeObserver=void 0}onSrcChange(){this.init()}rebuildBars(){this.peaks=this.peakEnvelope?this.decodedBars(this.effectiveBars):c(this.effectiveBars)}decodedBars(t){var i,a;return null!==(a=null===(i=this.exactPeaks)||void 0===i?void 0:i.get(t))&&void 0!==a?a:function(t,i){const{peaks:a,blockSize:e,length:s}=t;if(!s||i<=0)return[];const o=Math.max(1,Math.floor(s/i)),r=[];for(let t=0;t<i;t++){const i=t*o,n=Math.min(i+o,s);let h=0;if(i<n){const t=Math.floor((n-1)/e);for(let s=Math.floor(i/e);s<=t;s++)a[s]>h&&(h=a[s])}r.push(.12+.88*h)}return r}(this.peakEnvelope,t)}init(){this.teardown();const t=++this.loadToken;if(this.peakEnvelope=null,this.exactPeaks=null,this.decodedDuration=NaN,this.peaks=c(this.effectiveBars),this.currentTime=0,this.duration=NaN,this.playbackRate=1,this.hasError=!1,!this.src)return;if(this.isLoading=!0,this.extractPeaks(this.src,t),"undefined"==typeof Audio)return;const i=new Audio;i.preload=this.preload,i.crossOrigin="anonymous",i.src=this.src,i.addEventListener("loadedmetadata",this.onMeta),i.addEventListener("timeupdate",this.onTime),i.addEventListener("ended",this.onEnded),i.addEventListener("error",this.onErr),i.addEventListener("canplay",this.onCanPlay),i.addEventListener("waiting",this.onWaiting),this.audio=i}teardown(){this.audio&&(this.audio.pause(),this.audio.removeEventListener("loadedmetadata",this.onMeta),this.audio.removeEventListener("timeupdate",this.onTime),this.audio.removeEventListener("ended",this.onEnded),this.audio.removeEventListener("error",this.onErr),this.audio.removeEventListener("canplay",this.onCanPlay),this.audio.removeEventListener("waiting",this.onWaiting),this.audio.src="",this.audio=void 0),this.isPlaying=!1}async extractPeaks(t,i){try{const a=await p(t,(()=>i===this.loadToken?this.effectiveBars:0));if(i!==this.loadToken)return;if(!a)return;this.peakEnvelope=a.envelope,this.exactPeaks=a.exact,this.decodedDuration=a.duration,this.peaks=this.decodedBars(this.effectiveBars)}catch(t){if(i!==this.loadToken)return;this.peakEnvelope=null,this.exactPeaks=null,this.decodedDuration=NaN,this.peaks=c(this.effectiveBars)}i===this.loadToken&&this.syncDuration()}syncDuration(){var t,i;const a=function(t,i){return Number.isFinite(t)&&t>0?t:Number.isFinite(i)&&i>0?i:NaN}(null!==(i=null===(t=this.audio)||void 0===t?void 0:t.duration)&&void 0!==i?i:NaN,this.decodedDuration);Object.is(a,this.duration)||(this.duration=a)}applyPendingSeek(){if(null==this.pendingSeek||!this.audio)return;const t=this.pendingSeek;this.pendingSeek=null,this.audio.currentTime=t,this.currentTime=this.audio.currentTime,this.coTimeUpdate.emit({currentTime:this.currentTime,duration:this.knownDuration})}async seek(t){var i;if(!this.audio||!Number.isFinite(t))return;const a=this.knownDuration,e=Math.max(0,a?Math.min(a,t):t);this.audio.currentTime=e,Math.abs((null!==(i=this.audio.currentTime)&&void 0!==i?i:0)-e)>.05&&(this.pendingSeek=e),this.currentTime=e,this.coTimeUpdate.emit({currentTime:this.currentTime,duration:a})}async play(){if(this.audio&&!this.isPlaying&&!this.hasError)try{await this.audio.play(),this.isPlaying=!0,this.coPlay.emit()}catch(t){}}async download(){if(this.src&&"undefined"!=typeof fetch)try{const t=await(await fetch(this.src)).blob(),i=URL.createObjectURL(t),a=document.createElement("a");a.href=i,a.download=this.downloadFilename,document.body.appendChild(a),a.click(),a.remove(),URL.revokeObjectURL(i)}catch(t){}}render(){const t=Math.max(1,3*this.peaks.length),i=this.knownDuration,a=i?this.currentTime/i*100:0,e=i?Math.floor(i):void 0,o=(t,i,a=!1)=>s("rect",{key:"a3d5a225a904e22ba9905ef8198fa7e1b14e0e2f",x:3*i,y:20-40*t/2,width:1.8,height:Math.max(40*t,2),rx:.6,class:{"co-audio-player__bar":!0,"co-audio-player__bar--played":a}});return s("div",{key:"afbbf524713a1146653e69928ee21e263202315f",class:{"co-audio-player":!0,"co-audio-player--compact":this.compact,"co-audio-player--error":this.hasError,"co-audio-player--playing":this.isPlaying},part:"player"},s("button",{key:"5918385fbd8fb6fad4795e1a75eed5d073e0654c",type:"button",class:"co-audio-player__play",part:"play","aria-label":this.hasError?"Audio no disponible":this.isPlaying?"Pausar":"Reproducir","aria-busy":this.isLoading?"true":"false",disabled:this.hasError||!this.src,onClick:this.toggle},s("co-icon",{key:"e7a566257df253914593712bd20029bb8f1bcdfd",name:this.hasError?"warning-circle":this.isPlaying?"pause":"play",weight:"fill",size:this.compact?12:14})),s("div",{key:"70488015726d0c966fa3e738d9f2893d71b99ebf",class:"co-audio-player__wave",part:"wave",role:"slider",tabindex:"0","aria-label":"Progreso de reproducción","aria-valuemin":0,"aria-valuemax":e,"aria-valuenow":Math.floor(this.currentTime),ref:t=>this.waveEl=t,onClick:t=>this.seekAt(t.clientX),onKeyDown:this.onWaveKey},s("svg",{key:"8c70e4f74537e5f8ab6f66bc0da464a72507e81c",class:"co-audio-player__svg",viewBox:`0 0 ${t} 40`,preserveAspectRatio:"none","aria-hidden":"true"},this.peaks.map(((t,i)=>o(t,i))),s("clipPath",{key:"f0d37d76b3d6ab09dbd09582c8657b3fe7cb8c4c",id:"co-ap-clip"},s("rect",{key:"436de0ce10f98c868760c76505d134f3db2dbb54",x:"0",y:"0",width:a/100*t,height:40})),s("g",{key:"939a1a8851d6e41b4d3c37d7201f87a6403830bb","clip-path":"url(#co-ap-clip)"},this.peaks.map(((t,i)=>o(t,i,!0)))))),s("span",{key:"bd57bdd97a780864aa633ec5174d4f733799a278",class:"co-audio-player__time",part:"time"},r(this.currentTime)," / ",r(this.duration)),!this.compact&&s("button",{key:"d1f559546da0b0f97009afca79fe922ce569e67f",type:"button",class:"co-audio-player__speed",part:"speed","aria-label":`Velocidad de reproducción ${this.playbackRate}x`,onClick:this.cycleSpeed},this.playbackRate,"x"),!this.compact&&!this.noDownload&&s("button",{key:"a1503b85bb2edf02566dcad9b8e83b1fea20b159",type:"button",class:"co-audio-player__dl",part:"download","aria-label":"Descargar",onClick:()=>this.download()},s("co-icon",{key:"dc96b8afdb8036e76a0c515d76c625460f4fc44d",name:"download-simple",size:14})))}static get watchers(){return{src:[{onSrcChange:0}]}}static get style(){return":host{display:block;font-family:var(--co-font-family-primary)}.co-audio-player{display:flex;align-items:center;gap:var(--co-spacing-md);padding:var(--co-spacing-sm) var(--co-spacing-md);border:1px solid var(--co-semantic-border-default);border-radius:var(--co-border-radius-xs);background:var(--co-semantic-surface-secondary);min-width:180px}.co-audio-player--compact{gap:var(--co-spacing-sm2);padding:var(--co-spacing-sm2) var(--co-spacing-sm);min-width:140px}.co-audio-player__play{flex:0 0 auto;width:28px;height:28px;border:none;border-radius:50%;cursor:pointer;background:var(--co-semantic-surface-primary);color:var(--co-semantic-text-inverse);display:inline-flex;align-items:center;justify-content:center}.co-audio-player--compact .co-audio-player__play{width:24px;height:24px}.co-audio-player__play:disabled{opacity:.5;cursor:not-allowed}.co-audio-player__play:focus-visible{outline:2px solid var(--co-semantic-border-focus);outline-offset:2px}.co-audio-player__wave{flex:1;height:40px;min-width:0;cursor:pointer;display:flex;align-items:center}.co-audio-player__wave:focus-visible{outline:2px solid var(--co-semantic-border-focus);outline-offset:2px;border-radius:var(--co-border-radius-xxs)}.co-audio-player__svg{width:100%;height:100%;display:block}.co-audio-player__bar{fill:var(--co-semantic-border-field);transition:fill var(--co-motion-duration-fast)}.co-audio-player__wave:hover .co-audio-player__bar{fill:var(--co-semantic-text-muted)}.co-audio-player__bar--played{fill:var(--co-semantic-surface-primary)}.co-audio-player__time{flex:0 0 auto;font-size:var(--co-font-size-12);color:var(--co-semantic-text-muted);font-variant-numeric:tabular-nums;min-width:62px;text-align:right}.co-audio-player__speed{flex:0 0 auto;border:none;background:transparent;cursor:pointer;padding:2px 4px;color:var(--co-semantic-text-muted);font-family:var(--co-font-family-primary);font-size:var(--co-font-size-12);font-variant-numeric:tabular-nums;min-width:34px;text-align:center}.co-audio-player__speed:hover{color:var(--co-semantic-text-default)}.co-audio-player__speed:focus-visible{outline:2px solid var(--co-semantic-border-focus);outline-offset:2px;border-radius:var(--co-border-radius-xxs)}.co-audio-player__dl{flex:0 0 auto;border:none;background:transparent;cursor:pointer;padding:2px;color:var(--co-semantic-text-muted);display:inline-flex}.co-audio-player__dl:hover{color:var(--co-semantic-text-default)}.co-audio-player__dl:focus-visible{outline:2px solid var(--co-semantic-border-focus);outline-offset:2px}.co-audio-player--error .co-audio-player__wave{opacity:.5}.co-audio-player--error .co-audio-player__play{background:var(--co-color-status-error);color:var(--co-semantic-text-inverse);opacity:1}"}},[1,"co-audio-player",{src:[1],compact:[4],bars:[2],barDensity:[2,"bar-density"],preload:[1],downloadFilename:[1,"download-filename"],noDownload:[4,"no-download"],isPlaying:[32],isLoading:[32],hasError:[32],currentTime:[32],duration:[32],peaks:[32],containerWidth:[32],playbackRate:[32],seek:[64],play:[64]},void 0,{src:[{onSrcChange:0}]}]);function m(){"undefined"!=typeof customElements&&["co-audio-player","co-icon"].forEach((i=>{switch(i){case"co-audio-player":customElements.get(t(i))||customElements.define(t(i),b);break;case"co-icon":customElements.get(t(i))||o()}}))}m();const v=b,w=m;export{v as CoAudioPlayer,w as defineCustomElement}
|