@svta/cml-cmcd 0.20.0 → 0.22.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.
- package/README.md +1 -2
- package/dist/index.d.ts +7 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -11,8 +11,7 @@ npm i @svta/cml-cmcd
|
|
|
11
11
|
## Usage
|
|
12
12
|
|
|
13
13
|
```typescript
|
|
14
|
-
import { encodeCmcd } from "@svta/cml-cmcd
|
|
15
|
-
import { CmcdReportingMode } from "@svta/cml-cmcd/CmcdReportingMode";
|
|
14
|
+
import { CmcdReportingMode, encodeCmcd } from "@svta/cml-cmcd";
|
|
16
15
|
|
|
17
16
|
const input = {
|
|
18
17
|
br: 1000,
|
package/dist/index.d.ts
CHANGED
|
@@ -497,7 +497,7 @@ type CmcdRequest = Omit<Cmcd, "nrr"> & {
|
|
|
497
497
|
*
|
|
498
498
|
* The aggregate encoded bitrate of the complete media object including all object types. This SHOULD be derived from
|
|
499
499
|
* playlist/manifest declarations, or it MAY be estimated by the player. If the playlist declares both peak and average bitrate values,
|
|
500
|
-
* the peak value MUST be transmitted. This value MUST NOT be sent for objects which do not have an object type of
|
|
500
|
+
* the peak value MUST be transmitted. This value MUST NOT be sent for objects which do not have an object type of 'a', 'v', 'av' or 'o'.
|
|
501
501
|
* This value MUST NOT be sent if the encoded bitrate is known.
|
|
502
502
|
*
|
|
503
503
|
* Integer kbps
|
|
@@ -508,7 +508,7 @@ type CmcdRequest = Omit<Cmcd, "nrr"> & {
|
|
|
508
508
|
*
|
|
509
509
|
* The target buffer length associated with the media object being requested at the time of the request.
|
|
510
510
|
* This value SHOULD be rounded to the nearest 100 ms. This value MUST NOT be sent for objects which do not have an object
|
|
511
|
-
* type of
|
|
511
|
+
* type of 'a', 'v', 'av', 'tt', 'c', or 'o'
|
|
512
512
|
*
|
|
513
513
|
* Integer milliseconds
|
|
514
514
|
*/
|
|
@@ -589,7 +589,7 @@ type CmcdRequest = Omit<Cmcd, "nrr"> & {
|
|
|
589
589
|
* If the playlist declares both peak and average bitrate values, the peak value MUST be transmitted.
|
|
590
590
|
* This top playable bitrate MUST apply to the object type being requested.
|
|
591
591
|
* Requests for video objects MUST specify the top playable video bitrate and requests for audio objects MUST specify the top playable audio bitrate.
|
|
592
|
-
* This value MUST NOT be sent for objects which do not have an object type of
|
|
592
|
+
* This value MUST NOT be sent for objects which do not have an object type of 'a', 'v', 'av' or 'c'.
|
|
593
593
|
*
|
|
594
594
|
* Integer Kbps
|
|
595
595
|
*/
|
|
@@ -602,7 +602,7 @@ type CmcdRequest = Omit<Cmcd, "nrr"> & {
|
|
|
602
602
|
* If the playlist declares both peak and average bitrate values, the peak value MUST be transmitted.
|
|
603
603
|
* This lowest bitrate MUST apply to the object type being requested.
|
|
604
604
|
* Requests for video objects MUST specify the lowest video bitrate and requests for audio objects MUST specify the lowest audio bitrate.
|
|
605
|
-
* This value MUST NOT be sent for objects which do not have an object type of
|
|
605
|
+
* This value MUST NOT be sent for objects which do not have an object type of 'a', 'v', 'av' or 'c'.
|
|
606
606
|
*
|
|
607
607
|
* Integer Kbps
|
|
608
608
|
*/
|
|
@@ -614,7 +614,7 @@ type CmcdRequest = Omit<Cmcd, "nrr"> & {
|
|
|
614
614
|
* This SHOULD be derived from playlist/manifest declarations, or it MAY be estimated by the player.
|
|
615
615
|
* If the playlist declares both peak and average bitrate values,the peak value MUST be transmitted.
|
|
616
616
|
* The aggregate encoded bitrate is of the complete media object including all object types.
|
|
617
|
-
* This value MUST NOT be sent for objects which do not have an object type of
|
|
617
|
+
* This value MUST NOT be sent for objects which do not have an object type of 'a', 'v', 'av' or 'c'.
|
|
618
618
|
* This value MUST NOT be sent if the top encoded bitrate is known
|
|
619
619
|
*
|
|
620
620
|
* Integer Kbps
|
|
@@ -627,7 +627,7 @@ type CmcdRequest = Omit<Cmcd, "nrr"> & {
|
|
|
627
627
|
* This SHOULD be derived from playlist/manifest declarations, or it MAY be estimated by the player.
|
|
628
628
|
* If the playlist declares both peak and average bitrate values, the peak value MUST be transmitted.
|
|
629
629
|
* The aggregate encoded bitrate is of the complete media object including all object types.
|
|
630
|
-
* This value MUST NOT be sent for objects which do not have an object type of
|
|
630
|
+
* This value MUST NOT be sent for objects which do not have an object type of 'a', 'v', 'av' or 'c'.
|
|
631
631
|
* This value MUST NOT be sent if the lowest encoded bitrate is known.
|
|
632
632
|
*
|
|
633
633
|
* Integer Kbps
|
|
@@ -680,7 +680,7 @@ type CmcdRequest = Omit<Cmcd, "nrr"> & {
|
|
|
680
680
|
*
|
|
681
681
|
* Duration of the latest rebuffering period reported once the rebuffering has completed. This value MUST only be reported once per rebuffering incident, per object type.
|
|
682
682
|
*
|
|
683
|
-
* If the object type
|
|
683
|
+
* If the object type 'ot' key is sent along with this key, then the 'bsd' key refers to the buffer associated with the particular object type. If no object type is communicated, then the buffer state applies to the current session.
|
|
684
684
|
*
|
|
685
685
|
* Integer milliseconds
|
|
686
686
|
*/
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":["CMCD_FORMATTER_MAP: Record<string, CmcdFormatter>","CMCD_KEYS: CmcdKey[]","CmcdEncoding: typeof CmcdTransmissionMode","CmcdFormatters: Record<string, CmcdFormatter>"],"sources":["../src/CmcdCustomKey.ts","../src/CmcdObjectType.ts","../src/CmcdStreamType.ts","../src/CmcdStreamingFormat.ts","../src/CmcdValue.ts","../src/Cmcd.ts","../src/CMCD_EVENT_MODE.ts","../src/CMCD_REQUEST_MODE.ts","../src/CMCD_RESPONSE_MODE.ts","../src/CmcdReportingMode.ts","../src/CmcdFormatterOptions.ts","../src/CmcdFormatter.ts","../src/CmcdEventExcludedKeys.ts","../src/CmcdEventType.ts","../src/CmcdPlayerState.ts","../src/CmcdRequest.ts","../src/CmcdEvent.ts","../src/CmcdResponse.ts","../src/CmcdData.ts","../src/CmcdKey.ts","../src/CmcdFormatterMap.ts","../src/CMCD_OBJECT.ts","../src/CMCD_REQUEST.ts","../src/CMCD_SESSION.ts","../src/CMCD_STATUS.ts","../src/CmcdHeaderField.ts","../src/CmcdHeaderMap.ts","../src/CmcdEncodeOptions.ts","../src/appendCmcdHeaders.ts","../src/appendCmcdQuery.ts","../src/CMCD_COMMON_KEYS.ts","../src/CMCD_DEFAULT_TIME_INTERVAL.ts","../src/CMCD_EVENT_KEYS.ts","../src/CMCD_FORMATTER_MAP.ts","../src/CMCD_HEADERS.ts","../src/CMCD_JSON.ts","../src/CMCD_KEYS.ts","../src/CMCD_PARAM.ts","../src/CMCD_QUERY.ts","../src/CMCD_REQUEST_KEYS.ts","../src/CMCD_RESPONSE_KEYS.ts","../src/CMCD_V1.ts","../src/CMCD_V1_KEYS.ts","../src/CMCD_V2.ts","../src/CmcdTransmissionMode.ts","../src/CmcdEncoding.ts","../src/CmcdFormatters.ts","../src/CmcdHeadersMap.ts","../src/CmcdReportTarget.ts","../src/decodeCmcd.ts","../src/encodeCmcd.ts","../src/fromCmcdHeaders.ts","../src/fromCmcdQuery.ts","../src/fromCmcdUrl.ts","../src/groupCmcdHeaders.ts","../src/isCmcdCustomKey.ts","../src/isCmcdEventKey.ts","../src/isCmcdRequestKey.ts","../src/isCmcdResponseKey.ts","../src/isCmcdV1Key.ts","../src/prepareCmcdData.ts","../src/toCmcdHeaders.ts","../src/toCmcdJson.ts","../src/toCmcdQuery.ts","../src/toCmcdReport.ts","../src/toCmcdUrl.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;AASA;;;;ACCa,KDDD,aAAA,GCCyC,GAAA,MAAA,IAAA,MAAA,EAAA;;;;;;;ADDrD;;;;ACCa,cAAA,cAAwC,EAAA,OAAA,YAAA;AAKrD;;;KAAY,cAAA,GAAiB;;;;;;;ADN7B;;;;ACCa,cCAA,cDAwC,EAAA,OCAA,YDAA;AAKrD;;;KCAY,cAAA,GAAiB;;;;;;;AFN7B;;;;ACCa,cEAA,mBFAwC,EAAA,OEAU,iBFAV;AAKrD;;;KEAY,mBAAA,GAAsB;;;;AHNlC;;;;ACCA;AAKY,KGJA,SAAA,GACT,cHG0B,GGF1B,mBHE0B,GGD1B,cHC0B,GAAA,MAAA,GAAA,MAAA,EAAA,GAAA,MAAA,GAAA,MAAA,EAAA,GAAA,OAAA,GAAA,MAAA,GGM1B,OHN0B,GGO1B,MHP0B,GGQ1B,MHR0B,EAAA;;;;;AAL7B;AAKA;;;;ACLA;AAKY,KGCA,IAAA,GHDA;;;;ACLZ;EAKA,CAAA,KAAY,EEOH,aFPG,CAAA,EEOa,SFPb;;;;ACJZ;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":["CMCD_FORMATTER_MAP: Record<string, CmcdFormatter>","CMCD_KEYS: CmcdKey[]","CmcdEncoding: typeof CmcdTransmissionMode","CmcdFormatters: Record<string, CmcdFormatter>"],"sources":["../src/CmcdCustomKey.ts","../src/CmcdObjectType.ts","../src/CmcdStreamType.ts","../src/CmcdStreamingFormat.ts","../src/CmcdValue.ts","../src/Cmcd.ts","../src/CMCD_EVENT_MODE.ts","../src/CMCD_REQUEST_MODE.ts","../src/CMCD_RESPONSE_MODE.ts","../src/CmcdReportingMode.ts","../src/CmcdFormatterOptions.ts","../src/CmcdFormatter.ts","../src/CmcdEventExcludedKeys.ts","../src/CmcdEventType.ts","../src/CmcdPlayerState.ts","../src/CmcdRequest.ts","../src/CmcdEvent.ts","../src/CmcdResponse.ts","../src/CmcdData.ts","../src/CmcdKey.ts","../src/CmcdFormatterMap.ts","../src/CMCD_OBJECT.ts","../src/CMCD_REQUEST.ts","../src/CMCD_SESSION.ts","../src/CMCD_STATUS.ts","../src/CmcdHeaderField.ts","../src/CmcdHeaderMap.ts","../src/CmcdEncodeOptions.ts","../src/appendCmcdHeaders.ts","../src/appendCmcdQuery.ts","../src/CMCD_COMMON_KEYS.ts","../src/CMCD_DEFAULT_TIME_INTERVAL.ts","../src/CMCD_EVENT_KEYS.ts","../src/CMCD_FORMATTER_MAP.ts","../src/CMCD_HEADERS.ts","../src/CMCD_JSON.ts","../src/CMCD_KEYS.ts","../src/CMCD_PARAM.ts","../src/CMCD_QUERY.ts","../src/CMCD_REQUEST_KEYS.ts","../src/CMCD_RESPONSE_KEYS.ts","../src/CMCD_V1.ts","../src/CMCD_V1_KEYS.ts","../src/CMCD_V2.ts","../src/CmcdTransmissionMode.ts","../src/CmcdEncoding.ts","../src/CmcdFormatters.ts","../src/CmcdHeadersMap.ts","../src/CmcdReportTarget.ts","../src/decodeCmcd.ts","../src/encodeCmcd.ts","../src/fromCmcdHeaders.ts","../src/fromCmcdQuery.ts","../src/fromCmcdUrl.ts","../src/groupCmcdHeaders.ts","../src/isCmcdCustomKey.ts","../src/isCmcdEventKey.ts","../src/isCmcdRequestKey.ts","../src/isCmcdResponseKey.ts","../src/isCmcdV1Key.ts","../src/prepareCmcdData.ts","../src/toCmcdHeaders.ts","../src/toCmcdJson.ts","../src/toCmcdQuery.ts","../src/toCmcdReport.ts","../src/toCmcdUrl.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;AASA;;;;ACCa,KDDD,aAAA,GCCyC,GAAA,MAAA,IAAA,MAAA,EAAA;;;;;;;ADDrD;;;;ACCa,cAAA,cAAwC,EAAA,OAAA,YAAA;AAKrD;;;KAAY,cAAA,GAAiB;;;;;;;ADN7B;;;;ACCa,cCAA,cDAwC,EAAA,OCAA,YDAA;AAKrD;;;KCAY,cAAA,GAAiB;;;;;;;AFN7B;;;;ACCa,cEAA,mBFAwC,EAAA,OEAU,iBFAV;AAKrD;;;KEAY,mBAAA,GAAsB;;;;AHNlC;;;;ACCA;AAKY,KGJA,SAAA,GACT,cHG0B,GGF1B,mBHE0B,GGD1B,cHC0B,GAAA,MAAA,GAAA,MAAA,EAAA,GAAA,MAAA,GAAA,MAAA,EAAA,GAAA,OAAA,GAAA,MAAA,GGM1B,OHN0B,GGO1B,MHP0B,GGQ1B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AAKA;iB6DIgB,WAAA,OAAkB,gBAAe;;;;A/DVjD;;;;ACCA;AAKA;;;;ACLA;AAKA;;;iB8DWgB,YAAA,OAAmB,kBAAkB,mBAAmB;E7DhBxE,IAAa,E6DgB2E,I7DhB3E;AAKb,CAAA,CAAA,GAAY,IAAA;;;;;;AHNZ;;;;ACCA;AAKA;;;iBgEAgB,SAAA,OAAgB,gBAAe"}
|
package/dist/index.js
CHANGED
|
@@ -981,7 +981,8 @@ function toCmcdReport(data, target) {
|
|
|
981
981
|
version: target.version,
|
|
982
982
|
reportingMode: target.reportingMode
|
|
983
983
|
};
|
|
984
|
-
|
|
984
|
+
const { enabledKeys } = target;
|
|
985
|
+
if (enabledKeys) options.filter = (key) => enabledKeys.includes(key);
|
|
985
986
|
switch (transimissionMode) {
|
|
986
987
|
case CMCD_QUERY:
|
|
987
988
|
const param = encodeCmcd(data, options);
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["CMCD_HEADER_MAP: Record<CmcdKey, CmcdHeaderField>","keys","CMCD_FORMATTER_MAP: Record<string, CmcdFormatter>","results: CmcdData","keys","formatterOptions: CmcdFormatterOptions","CMCD_KEYS: CmcdKey[]","CmcdEncoding: typeof CmcdTransmissionMode","CmcdFormatters: Record<string, CmcdFormatter>","options: CmcdEncodeOptions"],"sources":["../src/CMCD_OBJECT.ts","../src/CMCD_REQUEST.ts","../src/CMCD_SESSION.ts","../src/CMCD_STATUS.ts","../src/CMCD_HEADER_MAP.ts","../src/CmcdHeaderField.ts","../src/groupCmcdHeaders.ts","../src/CMCD_EVENT_MODE.ts","../src/CMCD_FORMATTER_MAP.ts","../src/CMCD_REQUEST_MODE.ts","../src/CMCD_RESPONSE_MODE.ts","../src/CMCD_COMMON_KEYS.ts","../src/CMCD_EVENT_KEYS.ts","../src/isCmcdCustomKey.ts","../src/isCmcdEventKey.ts","../src/CMCD_REQUEST_KEYS.ts","../src/isCmcdRequestKey.ts","../src/CMCD_RESPONSE_KEYS.ts","../src/isCmcdResponseKey.ts","../src/CMCD_V1_KEYS.ts","../src/isCmcdV1Key.ts","../src/prepareCmcdData.ts","../src/toCmcdHeaders.ts","../src/appendCmcdHeaders.ts","../src/CMCD_PARAM.ts","../src/encodeCmcd.ts","../src/toCmcdUrl.ts","../src/toCmcdQuery.ts","../src/appendCmcdQuery.ts","../src/CMCD_DEFAULT_TIME_INTERVAL.ts","../src/CMCD_HEADERS.ts","../src/CMCD_JSON.ts","../src/CMCD_KEYS.ts","../src/CMCD_QUERY.ts","../src/CMCD_V1.ts","../src/CMCD_V2.ts","../src/CmcdTransmissionMode.ts","../src/CmcdEncoding.ts","../src/CmcdEventType.ts","../src/CmcdFormatters.ts","../src/CmcdObjectType.ts","../src/CmcdPlayerState.ts","../src/CmcdReportingMode.ts","../src/CmcdStreamingFormat.ts","../src/CmcdStreamType.ts","../src/decodeCmcd.ts","../src/fromCmcdHeaders.ts","../src/fromCmcdQuery.ts","../src/fromCmcdUrl.ts","../src/toCmcdJson.ts","../src/toCmcdReport.ts"],"sourcesContent":["/**\n * CMCD object header name.\n *\n *\n * @beta\n */\nexport const CMCD_OBJECT = 'CMCD-Object';\n","/**\n * CMCD request header name.\n *\n *\n * @beta\n */\nexport const CMCD_REQUEST = 'CMCD-Request';\n","/**\n * CMCD session header name.\n *\n *\n * @beta\n */\nexport const CMCD_SESSION = 'CMCD-Session';\n","/**\n * CMCD status header name.\n *\n *\n * @beta\n */\nexport const CMCD_STATUS = 'CMCD-Status';\n","import { CMCD_OBJECT } from './CMCD_OBJECT.js';\nimport { CMCD_REQUEST } from './CMCD_REQUEST.js';\nimport { CMCD_SESSION } from './CMCD_SESSION.js';\nimport { CMCD_STATUS } from './CMCD_STATUS.js';\nimport type { CmcdHeaderField } from './CmcdHeaderField.js';\nimport type { CmcdKey } from './CmcdKey.js';\n\n/**\n * The map of CMCD keys to their appropriate header shard.\n *\n *\n * @internal\n */\nexport const CMCD_HEADER_MAP: Record<CmcdKey, CmcdHeaderField> = {\n\t// Object\n\tbr: CMCD_OBJECT,\n\tab: CMCD_OBJECT,\n\td: CMCD_OBJECT,\n\tot: CMCD_OBJECT,\n\ttb: CMCD_OBJECT,\n\ttpb: CMCD_OBJECT,\n\tlb: CMCD_OBJECT,\n\ttab: CMCD_OBJECT,\n\tlab: CMCD_OBJECT,\n\turl: CMCD_OBJECT,\n\n\t// Request\n\tpb: CMCD_REQUEST,\n\tbl: CMCD_REQUEST,\n\ttbl: CMCD_REQUEST,\n\tdl: CMCD_REQUEST,\n\tltc: CMCD_REQUEST,\n\tmtp: CMCD_REQUEST,\n\tnor: CMCD_REQUEST,\n\tnrr: CMCD_REQUEST,\n\trc: CMCD_REQUEST,\n\tsn: CMCD_REQUEST,\n\tsta: CMCD_REQUEST,\n\tsu: CMCD_REQUEST,\n\tttfb: CMCD_REQUEST,\n\tttfbb: CMCD_REQUEST,\n\tttlb: CMCD_REQUEST,\n\tcmsdd: CMCD_REQUEST,\n\tcmsds: CMCD_REQUEST,\n\tsmrt: CMCD_REQUEST,\n\tdf: CMCD_REQUEST,\n\tcs: CMCD_REQUEST,\n\n\t// TODO: Which header to put the `ts` field is not defined yet.\n\tts: CMCD_REQUEST,\n\n\t// Session\n\tcid: CMCD_SESSION,\n\tpr: CMCD_SESSION,\n\tsf: CMCD_SESSION,\n\tsid: CMCD_SESSION,\n\tst: CMCD_SESSION,\n\tv: CMCD_SESSION,\n\tmsd: CMCD_SESSION,\n\n\t// Status\n\tbs: CMCD_STATUS,\n\tbsd: CMCD_STATUS,\n\tcdn: CMCD_STATUS,\n\trtp: CMCD_STATUS,\n\tbg: CMCD_STATUS,\n\tpt: CMCD_STATUS,\n\tec: CMCD_STATUS,\n\te: CMCD_STATUS,\n};\n","import type { ValueOf } from '@svta/cml-utils';\nimport { CMCD_OBJECT } from './CMCD_OBJECT.js';\nimport { CMCD_REQUEST } from './CMCD_REQUEST.js';\nimport { CMCD_SESSION } from './CMCD_SESSION.js';\nimport { CMCD_STATUS } from './CMCD_STATUS.js';\n\n/**\n * CMCD header fields.\n *\n *\n * @enum\n *\n * @beta\n */\nexport const CmcdHeaderField = {\n\t/**\n\t * keys whose values vary with the object being requested.\n\t */\n\tOBJECT: CMCD_OBJECT as typeof CMCD_OBJECT,\n\n\t/**\n\t * keys whose values vary with each request.\n\t */\n\tREQUEST: CMCD_REQUEST as typeof CMCD_REQUEST,\n\n\t/**\n\t * keys whose values are expected to be invariant over the life of the session.\n\t */\n\tSESSION: CMCD_SESSION as typeof CMCD_SESSION,\n\n\t/**\n\t * keys whose values do not vary with every request or object.\n\t */\n\tSTATUS: CMCD_STATUS as typeof CMCD_STATUS,\n} as const;\n\n/**\n * @beta\n */\nexport type CmcdHeaderField = ValueOf<typeof CmcdHeaderField>;\n","import { CMCD_HEADER_MAP } from './CMCD_HEADER_MAP.js';\nimport type { CmcdData } from './CmcdData.js';\nimport { CmcdHeaderField } from './CmcdHeaderField.js';\nimport type { CmcdHeaderMap } from './CmcdHeaderMap.js';\nimport type { CmcdKey } from './CmcdKey.js';\n\nfunction createHeaderMap(headerMap: Partial<CmcdHeaderMap>): Record<CmcdKey, CmcdHeaderField> {\n\treturn Object.keys(headerMap)\n\t\t.reduce((acc, field) => {\n\t\t\theaderMap[field as CmcdHeaderField]?.forEach(key => acc[key] = field as CmcdHeaderField);\n\t\t\treturn acc;\n\t\t}, {} as Record<CmcdKey, CmcdHeaderField>);\n}\n\n/**\n * Group a CMCD data object into header shards\n *\n * @param cmcd - The CMCD data object to convert.\n * @param customHeaderMap - A map of CMCD header fields to custom CMCD keys.\n *\n * @returns The CMCD header shards.\n *\n *\n * @beta\n */\nexport function groupCmcdHeaders(cmcd: CmcdData, customHeaderMap?: Partial<CmcdHeaderMap>): Record<CmcdHeaderField, CmcdData> {\n\tconst result = {} as Record<CmcdHeaderField, CmcdData>;\n\n\tif (!cmcd) {\n\t\treturn result;\n\t}\n\n\tconst keys = Object.keys(cmcd) as CmcdKey[];\n\tconst custom = customHeaderMap ? createHeaderMap(customHeaderMap) : {} as Record<CmcdKey, CmcdHeaderField>;\n\n\treturn keys.reduce((acc: Record<CmcdHeaderField, CmcdData>, key: CmcdKey) => {\n\t\tconst field = CMCD_HEADER_MAP[key] || custom[key] || CmcdHeaderField.REQUEST;\n\t\tconst data = acc[field] ??= {};\n\t\t(data as any)[key] = cmcd[key];\n\t\treturn acc;\n\t}, result);\n}\n","/**\n * CMCD event mode variable name.\n *\n *\n * @beta\n */\nexport const CMCD_EVENT_MODE = 'event';\n","import { SfItem } from '@svta/cml-structured-field-values';\nimport { urlToRelativePath, type ValueOrArray } from '@svta/cml-utils';\nimport type { CmcdFormatter } from './CmcdFormatter.js';\nimport type { CmcdFormatterOptions } from './CmcdFormatterOptions.js';\nimport type { CmcdValue } from './CmcdValue.js';\n\nconst toRounded = (value: CmcdValue) => Math.round(value as number);\n\nconst toUrlSafe = (value: CmcdValue, options: CmcdFormatterOptions): ValueOrArray<string> | ValueOrArray<SfItem> => {\n\tif (Array.isArray(value)) {\n\t\treturn value.map(item => toUrlSafe(item, options) as string);\n\t}\n\n\tif (value instanceof SfItem && typeof value.value === 'string') {\n\t\treturn new SfItem(toUrlSafe(value.value, options), value.params);\n\t}\n\telse {\n\t\tif (options.baseUrl) {\n\t\t\tvalue = urlToRelativePath(value as string, options.baseUrl);\n\t\t}\n\t\treturn options.version === 1 ? encodeURIComponent(value as string) : (value as string);\n\t}\n};\n\nconst toHundred = (value: CmcdValue) => toRounded(value as number / 100) * 100;\n\nconst nor = (value: CmcdValue, options: CmcdFormatterOptions) => {\n\tlet norValue = value;\n\n\tif (options.version >= 2) {\n\t\tif (value instanceof SfItem && typeof value.value === 'string') {\n\t\t\tnorValue = new SfItem([value]);\n\t\t}\n\t\telse if (typeof value === 'string') {\n\t\t\tnorValue = [value];\n\t\t}\n\t}\n\n\treturn toUrlSafe(norValue, options);\n};\n\n/**\n * The default formatters for CMCD values.\n *\n *\n * @beta\n */\nexport const CMCD_FORMATTER_MAP: Record<string, CmcdFormatter> = {\n\t/**\n\t * Bitrate (kbps) rounded integer\n\t */\n\tbr: toRounded,\n\n\t/**\n\t * Duration (milliseconds) rounded integer\n\t */\n\td: toRounded,\n\n\t/**\n\t * Buffer Length (milliseconds) rounded nearest 100ms\n\t */\n\tbl: toHundred,\n\n\t/**\n\t * Deadline (milliseconds) rounded nearest 100ms\n\t */\n\tdl: toHundred,\n\n\t/**\n\t * Measured Throughput (kbps) rounded nearest 100kbps\n\t */\n\tmtp: toHundred,\n\n\t/**\n\t * Next Object Request URL encoded\n\t */\n\tnor,\n\n\t/**\n\t * Requested maximum throughput (kbps) rounded nearest 100kbps\n\t */\n\trtp: toHundred,\n\n\t/**\n\t * Top Bitrate (kbps) rounded integer\n\t */\n\ttb: toRounded,\n} as const;\n","/**\n * CMCD request mode variable name.\n *\n *\n * @beta\n */\nexport const CMCD_REQUEST_MODE = 'request';\n","/**\n * CMCD response mode variable name.\n *\n *\n * @beta\n */\nexport const CMCD_RESPONSE_MODE = 'response';\n","/**\n * Defines the common keys for CMCD (Common Media Client Data) version 2.\n *\n *\n * @beta\n */\nexport const CMCD_COMMON_KEYS = [\n\t'ab',\n\t'bg',\n\t'bl',\n\t'br',\n\t'bs',\n\t'bsd',\n\t'cdn',\n\t'cid',\n\t'cs',\n\t'df',\n\t'ec',\n\t'lab',\n\t'lb',\n\t'ltc',\n\t'msd',\n\t'mtp',\n\t'pb',\n\t'pr',\n\t'pt',\n\t'sf',\n\t'sid',\n\t'sn',\n\t'st',\n\t'sta',\n\t'tab',\n\t'tb',\n\t'tbl',\n\t'tpb',\n\t'ts',\n\t'v',\n] as const;\n","/**\n * Defines the event-specific keys for CMCD (Common Media Client Data) version 2.\n *\n *\n * @beta\n */\nexport const CMCD_EVENT_KEYS = [\n\t'e',\n] as const;\n","import type { CmcdKey } from './CmcdKey.js';\n\nconst CUSTOM_KEY_REGEX = /^[a-zA-Z0-9-.]+-[a-zA-Z0-9-.]+$/;\n\n/**\n * Check if a key is a custom key.\n *\n * @param key - The key to check.\n *\n * @returns `true` if the key is a custom key, `false` otherwise.\n *\n *\n * @beta\n */\nexport function isCmcdCustomKey(key: CmcdKey): boolean {\n\treturn CUSTOM_KEY_REGEX.test(key);\n}\n","import { CMCD_COMMON_KEYS } from './CMCD_COMMON_KEYS.js';\nimport { CMCD_EVENT_KEYS } from './CMCD_EVENT_KEYS.js';\nimport type { CmcdEvent } from './CmcdEvent.js';\nimport { isCmcdCustomKey } from './isCmcdCustomKey.js';\n\n/**\n * Check if a key is a valid CMCD event key.\n *\n * @param key - The key to check.\n *\n * @returns `true` if the key is a valid CMCD event key, `false` otherwise.\n *\n *\n * @beta\n *\n * @example\n * {@includeCode ../test/isCmcdEventKey.test.ts#example}\n */\nexport function isCmcdEventKey(key: string): key is keyof CmcdEvent {\n\treturn CMCD_COMMON_KEYS.includes(key as any) ||\n\t\tCMCD_EVENT_KEYS.includes(key as any) ||\n\t\tisCmcdCustomKey(key as any);\n}\n","/**\n * Defines the request-specific keys for CMCD (Common Media Client Data) version 2.\n *\n *\n * @beta\n */\nexport const CMCD_REQUEST_KEYS = [\n\t'd',\n\t'dl',\n\t'nor',\n\t'ot',\n\t'rtp',\n\t'su',\n] as const;\n","import { CMCD_COMMON_KEYS } from './CMCD_COMMON_KEYS.js';\nimport { CMCD_REQUEST_KEYS } from './CMCD_REQUEST_KEYS.js';\nimport type { CmcdRequest } from './CmcdRequest.js';\nimport { isCmcdCustomKey } from './isCmcdCustomKey.js';\n\n/**\n * Check if a key is a valid CMCD request key.\n *\n * @param key - The key to check.\n *\n * @returns `true` if the key is a valid CMCD request key, `false` otherwise.\n *\n *\n * @beta\n *\n * @example\n * {@includeCode ../test/isCmcdRequestKey.test.ts#example}\n */\nexport function isCmcdRequestKey(key: string): key is keyof CmcdRequest {\n\treturn CMCD_COMMON_KEYS.includes(key as any) ||\n\t\tCMCD_REQUEST_KEYS.includes(key as any) ||\n\t\tisCmcdCustomKey(key as any);\n}\n","/**\n * CMCD v2 - Response-only and timing keys.\n *\n *\n * @beta\n */\nexport const CMCD_RESPONSE_KEYS = [\n\t'cmsdd',\n\t'cmsds',\n\t'rc',\n\t'smrt',\n\t'ttfb',\n\t'ttfbb',\n\t'ttlb',\n\t'url',\n] as const;\n","import { CMCD_COMMON_KEYS } from './CMCD_COMMON_KEYS.js';\nimport { CMCD_REQUEST_KEYS } from './CMCD_REQUEST_KEYS.js';\nimport { CMCD_RESPONSE_KEYS } from './CMCD_RESPONSE_KEYS.js';\nimport type { CmcdResponse } from './CmcdResponse.js';\nimport { isCmcdCustomKey } from './isCmcdCustomKey.js';\n\n/**\n * Check if a key is a valid CMCD response key.\n *\n * @param key - The key to check.\n *\n * @returns `true` if the key is a valid CMCD request key, `false` otherwise.\n *\n *\n * @beta\n *\n * @example\n * {@includeCode ../test/isCmcdResponseKey.test.ts#example}\n */\nexport function isCmcdResponseKey(key: string): key is keyof CmcdResponse {\n\treturn CMCD_COMMON_KEYS.includes(key as any) ||\n\t\tCMCD_REQUEST_KEYS.includes(key as any) ||\n\t\tCMCD_RESPONSE_KEYS.includes(key as any) ||\n\t\tisCmcdCustomKey(key as any);\n}\n","/**\n * Defines the keys for CMCD (Common Media Client Data) version 1.\n *\n *\n * @beta\n */\nexport const CMCD_V1_KEYS = [\n\t'bl',\n\t'br',\n\t'bs',\n\t'cid',\n\t'd',\n\t'dl',\n\t'mtp',\n\t'nor',\n\t'nrr',\n\t'ot',\n\t'pr',\n\t'rtp',\n\t'sf',\n\t'sid',\n\t'st',\n\t'su',\n\t'tb',\n\t'v',\n] as const;\n","import { CMCD_V1_KEYS } from './CMCD_V1_KEYS.js';\nimport type { Cmcd } from './Cmcd.js';\nimport { isCmcdCustomKey } from './isCmcdCustomKey.js';\n\n/**\n * Filter function for CMCD v1 keys.\n *\n * @param key - The CMCD key to filter.\n *\n * @returns `true` if the key should be included, `false` otherwise.\n *\n *\n * @beta\n *\n * @example\n * {@includeCode ../test/isCmcdV1Key.test.ts#example}\n */\nexport function isCmcdV1Key(key: string): key is keyof Cmcd {\n\treturn CMCD_V1_KEYS.includes(key as any) || isCmcdCustomKey(key as any);\n}\n","import { isTokenField, isValid } from '@svta/cml-cta';\nimport { SfToken } from '@svta/cml-structured-field-values';\nimport { CMCD_EVENT_MODE } from './CMCD_EVENT_MODE.js';\nimport { CMCD_FORMATTER_MAP } from './CMCD_FORMATTER_MAP.js';\nimport { CMCD_REQUEST_MODE } from './CMCD_REQUEST_MODE.js';\nimport { CMCD_RESPONSE_MODE } from './CMCD_RESPONSE_MODE.js';\nimport type { CmcdData } from './CmcdData.js';\nimport type { CmcdEncodeOptions } from './CmcdEncodeOptions.js';\nimport type { CmcdFormatterOptions } from './CmcdFormatterOptions.js';\nimport type { CmcdValue } from './CmcdValue.js';\nimport { isCmcdEventKey } from './isCmcdEventKey.js';\nimport { isCmcdRequestKey } from './isCmcdRequestKey.js';\nimport { isCmcdResponseKey } from './isCmcdResponseKey.js';\nimport { isCmcdV1Key } from './isCmcdV1Key.js';\n\nconst filterMap = {\n\t[CMCD_RESPONSE_MODE]: isCmcdResponseKey,\n\t[CMCD_EVENT_MODE]: isCmcdEventKey,\n\t[CMCD_REQUEST_MODE]: isCmcdRequestKey,\n};\n\n/**\n * Convert a generic object to CMCD data.\n *\n * @param obj - The CMCD object to process.\n * @param options - Options for encoding.\n *\n *\n * @beta\n */\nexport function prepareCmcdData(obj: Record<string, any>, options: CmcdEncodeOptions = {}): CmcdData {\n\tconst results: CmcdData = {};\n\n\tif (obj == null || typeof obj !== 'object') {\n\t\treturn results;\n\t}\n\n\tconst version = options.version || (obj['v'] as number) || 1;\n\tconst reportingMode = options.reportingMode || CMCD_REQUEST_MODE;\n\tconst keyFilter = version === 1 ? isCmcdV1Key : filterMap[reportingMode];\n\n\t// Filter keys based on the version, reporting mode and options\n\tlet keys = Object.keys(obj).filter(keyFilter);\n\n\tconst filter = options.filter;\n\tif (typeof filter === 'function') {\n\t\tkeys = keys.filter(filter);\n\t}\n\n\t// Ensure all required keys are present before sorting\n\tconst needsTimestamp = reportingMode === CMCD_RESPONSE_MODE || reportingMode === CMCD_EVENT_MODE;\n\tif (needsTimestamp && !keys.includes('ts')) {\n\t\tkeys.push('ts');\n\t}\n\n\tif (version > 1 && !keys.includes('v')) {\n\t\tkeys.push('v');\n\t}\n\n\tconst formatters = Object.assign({}, CMCD_FORMATTER_MAP, options.formatters);\n\tconst formatterOptions: CmcdFormatterOptions = {\n\t\tversion,\n\t\treportingMode,\n\t\tbaseUrl: options.baseUrl,\n\t};\n\n\tkeys.sort().forEach(key => {\n\t\tlet value = obj[key] as CmcdValue;\n\n\t\tconst formatter = formatters[key];\n\t\tif (typeof formatter === 'function') {\n\t\t\tvalue = formatter(value, formatterOptions);\n\t\t}\n\n\t\t// Version should only be reported if not equal to 1.\n\t\tif (key === 'v') {\n\t\t\tif (version === 1) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tvalue = version;\n\t\t\t}\n\t\t}\n\n\t\t// Playback rate should only be sent if not equal to 1.\n\t\tif (key == 'pr' && value === 1) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Ensure a timestamp is set for response and event modes\n\t\tif (needsTimestamp && key === 'ts' && !Number.isFinite(value)) {\n\t\t\tvalue = Date.now();\n\t\t}\n\n\t\t// ignore invalid values\n\t\tif (!isValid(value)) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (isTokenField(key) && typeof value === 'string') {\n\t\t\tvalue = new SfToken(value);\n\t\t}\n\n\t\t(results as any)[key] = value;\n\t});\n\n\treturn results;\n}\n","import { encodeSfDict } from '@svta/cml-structured-field-values';\nimport type { CmcdData } from './CmcdData.js';\nimport type { CmcdEncodeOptions } from './CmcdEncodeOptions.js';\nimport type { CmcdHeaderField } from './CmcdHeaderField.js';\nimport { groupCmcdHeaders } from './groupCmcdHeaders.js';\nimport { prepareCmcdData } from './prepareCmcdData.js';\n\n/**\n * Convert a CMCD data object to request headers\n *\n * @param cmcd - The CMCD data object to convert.\n * @param options - Options for encoding the CMCD object.\n *\n * @returns The CMCD header shards.\n *\n *\n * @beta\n *\n * @example\n * {@includeCode ../test/toCmcdHeaders.test.ts#example}\n */\nexport function toCmcdHeaders(cmcd: CmcdData, options: CmcdEncodeOptions = {}): Record<CmcdHeaderField, string> {\n\tconst result = {} as Record<CmcdHeaderField, string>;\n\n\tif (!cmcd) {\n\t\treturn result;\n\t}\n\n\tconst data = prepareCmcdData(cmcd, options);\n\tconst shards = groupCmcdHeaders(data, options?.customHeaderMap);\n\n\treturn Object.entries(shards)\n\t\t.reduce((acc, [field, value]) => {\n\t\t\tconst shard = encodeSfDict(value, { whitespace: false });\n\t\t\tif (shard) {\n\t\t\t\tacc[field as CmcdHeaderField] = shard;\n\t\t\t}\n\t\t\treturn acc;\n\t\t}, result);\n}\n","import type { Cmcd } from './Cmcd.js';\nimport type { CmcdEncodeOptions } from './CmcdEncodeOptions.js';\nimport { toCmcdHeaders } from './toCmcdHeaders.js';\n\n/**\n * Append CMCD query args to a header object.\n *\n * @param headers - The headers to append to.\n * @param cmcd - The CMCD object to append.\n * @param options - Encode options.\n *\n * @returns The headers with the CMCD header shards appended.\n *\n *\n * @beta\n *\n * @example\n * {@includeCode ../test/appendCmcdHeaders.test.ts#example}\n */\nexport function appendCmcdHeaders(headers: Record<string, string>, cmcd: Cmcd, options?: CmcdEncodeOptions): Record<string, string> {\n\treturn Object.assign(headers, toCmcdHeaders(cmcd, options));\n}\n","/**\n * CMCD parameter name.\n *\n *\n * @beta\n */\nexport const CMCD_PARAM = 'CMCD';\n","import { encodeSfDict } from '@svta/cml-structured-field-values';\nimport type { CmcdData } from './CmcdData.js';\nimport type { CmcdEncodeOptions } from './CmcdEncodeOptions.js';\nimport { prepareCmcdData } from './prepareCmcdData.js';\n\n/**\n * Encode a CMCD object to a string.\n *\n * @param cmcd - The CMCD object to encode.\n * @param options - Options for encoding.\n *\n * @returns The encoded CMCD string.\n *\n *\n * @beta\n *\n * @example\n * {@includeCode ../test/encodeCmcd.test.ts#example}\n */\nexport function encodeCmcd(cmcd: CmcdData, options: CmcdEncodeOptions = {}): string {\n\tif (!cmcd) {\n\t\treturn '';\n\t}\n\n\treturn encodeSfDict(prepareCmcdData(cmcd, options), { whitespace: false });\n}\n","import type { Cmcd } from './Cmcd.js';\nimport type { CmcdEncodeOptions } from './CmcdEncodeOptions.js';\nimport { encodeCmcd } from './encodeCmcd.js';\n\n/**\n * Convert a CMCD data object to a URL encoded string.\n *\n * @param cmcd - The CMCD object to convert.\n * @param options - Options for encoding the CMCD object.\n *\n * @returns The URL encoded CMCD data.\n *\n *\n * @beta\n */\nexport function toCmcdUrl(cmcd: Cmcd, options: CmcdEncodeOptions = {}): string {\n\tif (!cmcd) {\n\t\treturn '';\n\t}\n\n\tconst params = encodeCmcd(cmcd, options);\n\n\treturn encodeURIComponent(params);\n}\n","import { CMCD_PARAM } from './CMCD_PARAM.js';\nimport type { Cmcd } from './Cmcd.js';\nimport type { CmcdEncodeOptions } from './CmcdEncodeOptions.js';\nimport { toCmcdUrl } from './toCmcdUrl.js';\n\n/**\n * Convert a CMCD data object to a query arg.\n *\n * @param cmcd - The CMCD object to convert.\n * @param options - Options for encoding the CMCD object.\n *\n * @returns The CMCD query arg.\n *\n *\n * @beta\n *\n * @example\n * {@includeCode ../test/toCmcdQuery.test.ts#example}\n */\nexport function toCmcdQuery(cmcd: Cmcd, options: CmcdEncodeOptions = {}): string {\n\tif (!cmcd) {\n\t\treturn '';\n\t}\n\n\tconst value = toCmcdUrl(cmcd, options);\n\n\treturn `${CMCD_PARAM}=${value}`;\n}\n","import type { Cmcd } from './Cmcd.js';\nimport type { CmcdEncodeOptions } from './CmcdEncodeOptions.js';\nimport { toCmcdQuery } from './toCmcdQuery.js';\n\nconst REGEX = /CMCD=[^&#]+/;\n\n/**\n * Append CMCD query args to a URL.\n *\n * @param url - The URL to append to.\n * @param cmcd - The CMCD object to append.\n * @param options - Options for encoding the CMCD object.\n *\n * @returns The URL with the CMCD query args appended.\n *\n *\n * @beta\n *\n * @example\n * {@includeCode ../test/appendCmcdQuery.test.ts#example}\n */\nexport function appendCmcdQuery(url: string, cmcd: Cmcd, options?: CmcdEncodeOptions): string {\n\t// TODO: Replace with URLSearchParams once we drop Safari < 10.1 & Chrome < 49 support.\n\t// https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams\n\n\tconst query = toCmcdQuery(cmcd, options);\n\tif (!query) {\n\t\treturn url;\n\t}\n\n\tif (REGEX.test(url)) {\n\t\treturn url.replace(REGEX, query);\n\t}\n\n\tconst separator = url.includes('?') ? '&' : '?';\n\treturn `${url}${separator}${query}`;\n}\n","/**\n * The default time interval in secondswhen using using event mode\n *\n *\n * @beta\n */\nexport const CMCD_DEFAULT_TIME_INTERVAL = 30;\n","/**\n * CMCD `headers` transmission mode.\n *\n *\n * @beta\n */\nexport const CMCD_HEADERS = 'headers';\n","/**\n * CMCD `json` transmission mode.\n *\n *\n * @beta\n *\n * @deprecated JSON transmission mode is deprecated and will be removed in future versions.\n */\nexport const CMCD_JSON = 'json';\n","import { CMCD_COMMON_KEYS } from './CMCD_COMMON_KEYS.js';\nimport { CMCD_EVENT_KEYS } from './CMCD_EVENT_KEYS.js';\nimport { CMCD_REQUEST_KEYS } from './CMCD_REQUEST_KEYS.js';\nimport { CMCD_RESPONSE_KEYS } from './CMCD_RESPONSE_KEYS.js';\nimport { CMCD_V1_KEYS } from './CMCD_V1_KEYS.js';\nimport type { CmcdKey } from './CmcdKey.js';\n\nconst keySet = new Set([...CMCD_V1_KEYS, ...CMCD_COMMON_KEYS, ...CMCD_REQUEST_KEYS, ...CMCD_RESPONSE_KEYS, ...CMCD_EVENT_KEYS]);\n\n/**\n * A list of all CMCD keys.\n *\n *\n * @beta\n */\nexport const CMCD_KEYS: CmcdKey[] = Array.from(keySet);\n","/**\n * CMCD `query` transmission mode.\n *\n *\n * @beta\n */\nexport const CMCD_QUERY = 'query';\n","/**\n * CMCD Version 1\n *\n *\n * @beta\n */\nexport const CMCD_V1 = 1;\n","/**\n * CMCD Version 2\n *\n *\n * @beta\n */\nexport const CMCD_V2 = 2;\n","import type { ValueOf } from '@svta/cml-utils';\nimport { CMCD_HEADERS } from './CMCD_HEADERS.js';\nimport { CMCD_JSON } from './CMCD_JSON.js';\nimport { CMCD_QUERY } from './CMCD_QUERY.js';\n\n/**\n * CMCD transmission modes.\n *\n *\n * @enum\n *\n * @beta\n */\nexport const CmcdTransmissionMode = {\n\t/**\n\t * JSON\n\t *\n\t * @deprecated JSON transmission mode is deprecated and will be removed in future versions.\n\t */\n\tJSON: CMCD_JSON as typeof CMCD_JSON,\n\n\t/**\n\t * Query string\n\t */\n\tQUERY: CMCD_QUERY as typeof CMCD_QUERY,\n\n\t/**\n\t * Request headers\n\t */\n\tHEADERS: CMCD_HEADERS as typeof CMCD_HEADERS,\n\n} as const;\n\n/**\n * @beta\n */\nexport type CmcdTransmissionMode = ValueOf<typeof CmcdTransmissionMode>;\n","import type { ValueOf } from '@svta/cml-utils';\nimport { CmcdTransmissionMode } from './CmcdTransmissionMode.js';\n\n/**\n * CMCD encoding types.\n *\n *\n * @enum\n *\n * @beta\n *\n * @deprecated Use {@link CmcdTransmissionMode} instead.\n *\n * @see {@link CmcdTransmissionMode}\n */\nexport const CmcdEncoding: typeof CmcdTransmissionMode = CmcdTransmissionMode;\n\n/**\n * @beta\n */\nexport type CmcdEncoding = ValueOf<typeof CmcdEncoding>;\n","import type { ValueOf } from '@svta/cml-utils';\n\n/**\n * CMCD event types for the 'e' key (event mode).\n *\n *\n * @enum\n *\n * @beta\n */\nexport const CmcdEventType = {\n\t/**\n\t * A change in the player state.\n\t */\n\tPLAY_STATE: 'ps',\n\n\t/**\n\t * An error event.\n\t */\n\tERROR: 'e',\n\n\t/**\n\t * A periodic report sent on a time interval.\n\t */\n\tTIME_INTERVAL: 't',\n\n\t/**\n\t * A change of the content ID.\n\t */\n\tCONTENT_ID: 'c',\n\n\t/**\n\t * A change in the application's backgrounded state.\n\t */\n\tBACKGROUNDED_MODE: 'b',\n\n\t/**\n\t * The player was muted.\n\t */\n\tMUTE: 'm',\n\n\t/**\n\t * Player unmuted.\n\t */\n\tUNMUTE: 'um',\n\n\t/**\n\t * The player view was expanded.\n\t */\n\tPLAYER_EXPAND: 'pe',\n\n\t/**\n\t * The player view was collapsed.\n\t */\n\tPLAYER_COLLAPSE: 'pc',\n} as const;\n\n/**\n * @beta\n */\nexport type CmcdEventType = ValueOf<typeof CmcdEventType>;\n","import { CMCD_FORMATTER_MAP } from './CMCD_FORMATTER_MAP.js';\nimport type { CmcdFormatter } from './CmcdFormatter.js';\n\n/**\n * The default formatters for CMCD values.\n *\n *\n * @beta\n *\n * @deprecated Use `CMCD_FORMATTER_MAP` instead.\n */\nexport const CmcdFormatters: Record<string, CmcdFormatter> = CMCD_FORMATTER_MAP;\n","import { CmObjectType } from '@svta/cml-cta';\n\n/**\n * Common Media Client Data Object Type\n *\n *\n * @beta\n *\n * @enum\n */\nexport const CmcdObjectType = CmObjectType as typeof CmObjectType;\n\n/**\n * @beta\n */\nexport type CmcdObjectType = CmObjectType;\n","import type { ValueOf } from '@svta/cml-utils';\n\n/**\n * CMCD v2 player states for the 'sta' key.\n *\n *\n * @enum\n *\n * @beta\n */\nexport const CmcdPlayerState = {\n\t/**\n\t * Starting: Initial startup of the player.\n\t */\n\tSTARTING: 's',\n\n\t/**\n\t * Playing: The player is actively rendering content.\n\t */\n\tPLAYING: 'p',\n\n\t/**\n\t * Seeking: The player is seeking to a new position.\n\t */\n\tSEEKING: 'k',\n\n\t/**\n\t * Rebuffering: The player is buffering data during playback.\n\t */\n\tREBUFFERING: 'r',\n\n\t/**\n\t * Paused: The player is paused.\n\t */\n\tPAUSED: 'a',\n\n\t/**\n\t * Waiting: The player is waiting for a user action or another event.\n\t */\n\tWAITING: 'w',\n\n\t/**\n\t * Ended: The media has finished playing.\n\t */\n\tENDED: 'e',\n\n\t/**\n\t * Fatal Error: The player has encountered a fatal error.\n\t */\n\tFATAL_ERROR: 'f',\n\n\t/**\n\t * Quit: User initiated end of playback before media asset completion.\n\t */\n\tQUIT: 'q',\n\n\t/**\n\t * Preloading: The player is loading assets ahead of starting in order to provide a fast startup. The expectation is that playback will commence at a future time.\n\t */\n\tPRELOADING: 'd',\n} as const;\n\n/**\n * @beta\n */\nexport type CmcdPlayerState = ValueOf<typeof CmcdPlayerState>;\n","import type { ValueOf } from '@svta/cml-utils';\nimport { CMCD_EVENT_MODE } from './CMCD_EVENT_MODE.js';\nimport { CMCD_REQUEST_MODE } from './CMCD_REQUEST_MODE.js';\nimport { CMCD_RESPONSE_MODE } from './CMCD_RESPONSE_MODE.js';\n\n/**\n * CMCD reporting mode types.\n *\n *\n * @enum\n *\n * @beta\n */\nexport const CmcdReportingMode = {\n\t/**\n\t * Request mode\n\t */\n\tREQUEST: CMCD_REQUEST_MODE as typeof CMCD_REQUEST_MODE,\n\n\t/**\n\t * Response mode\n\t */\n\tRESPONSE: CMCD_RESPONSE_MODE as typeof CMCD_RESPONSE_MODE,\n\n\t/**\n\t * Event mode\n\t */\n\tEVENT: CMCD_EVENT_MODE as typeof CMCD_EVENT_MODE,\n} as const;\n\n/**\n * @beta\n */\nexport type CmcdReportingMode = ValueOf<typeof CmcdReportingMode>;\n","import { CmStreamingFormat } from '@svta/cml-cta';\n\n/**\n * Common Media Client Data Streaming Format\n *\n *\n * @enum\n *\n * @beta\n */\nexport const CmcdStreamingFormat = CmStreamingFormat as typeof CmStreamingFormat;\n\n/**\n * @beta\n */\nexport type CmcdStreamingFormat = CmStreamingFormat;\n","import { CmStreamType } from '@svta/cml-cta';\n\n/**\n * Common Media Client Data Stream Type\n *\n *\n * @enum\n *\n * @beta\n */\nexport const CmcdStreamType = CmStreamType as typeof CmStreamType;\n\n/**\n * @beta\n */\nexport type CmcdStreamType = CmStreamType;\n","import type { SfBareItem } from '@svta/cml-structured-field-values';\nimport { decodeSfDict, SfItem, symbolToStr } from '@svta/cml-structured-field-values';\nimport type { CmcdData } from './CmcdData.js';\nimport type { CmcdValue } from './CmcdValue.js';\n\n// Define the input type for reduceValue\ntype ReduceValueInput = SfBareItem | SfItem | ReduceValueInput[];\n\n// Define the output type for reduceValue - matches what CMCD values can be, including arrays\ntype ReduceValueOutput = CmcdValue | ReduceValueOutput[];\n\nfunction reduceValue(value: ReduceValueInput): ReduceValueOutput {\n\tif (Array.isArray(value)) {\n\t\treturn value.map(reduceValue);\n\t}\n\n\tif (typeof value === 'symbol') {\n\t\treturn symbolToStr(value);\n\t}\n\n\tif (value instanceof SfItem && !value.params) {\n\t\treturn reduceValue(value.value);\n\t}\n\n\tif (typeof value === 'string') {\n\t\treturn decodeURIComponent(value);\n\t}\n\n\treturn value as ReduceValueOutput;\n};\n\n/**\n * Decode a CMCD string to an object.\n *\n * @param cmcd - The CMCD string to decode.\n *\n * @returns The decoded CMCD object.\n *\n *\n * @beta\n *\n * @example\n * {@includeCode ../test/decodeCmcd.test.ts#example}\n */\nexport function decodeCmcd<T extends CmcdData = CmcdData>(cmcd: string): T {\n\tif (!cmcd) {\n\t\treturn {} as T;\n\t}\n\n\tconst sfDict = decodeSfDict(cmcd);\n\n\treturn Object\n\t\t.entries<SfItem>(sfDict as any)\n\t\t.reduce((acc, [key, item]) => {\n\t\t\tacc[key as keyof T] = reduceValue(item.value) as T[keyof T];\n\t\t\treturn acc;\n\t\t}, {} as T);\n}\n","import { CMCD_OBJECT } from './CMCD_OBJECT.js';\nimport { CMCD_REQUEST } from './CMCD_REQUEST.js';\nimport { CMCD_SESSION } from './CMCD_SESSION.js';\nimport { CMCD_STATUS } from './CMCD_STATUS.js';\nimport type { CmcdData } from './CmcdData.js';\nimport { decodeCmcd } from './decodeCmcd.js';\n\nconst keys = [CMCD_OBJECT, CMCD_REQUEST, CMCD_SESSION, CMCD_STATUS];\n\n/**\n * Decode CMCD data from request headers.\n *\n * @param headers - The request headers to decode.\n *\n * @returns The decoded CMCD data.\n *\n *\n * @beta\n *\n * @example\n * {@includeCode ../test/fromCmcdHeaders.test.ts#example}\n */\nexport function fromCmcdHeaders(headers: Record<string, string> | Headers): CmcdData {\n\tif (!(headers instanceof Headers)) {\n\t\theaders = new Headers(headers);\n\t}\n\n\treturn keys.reduce((acc, key) => {\n\t\tconst value = headers.get(key);\n\t\treturn Object.assign(acc, decodeCmcd(value as string));\n\t}, {} as CmcdData);\n}\n","import type { Cmcd } from './Cmcd.js';\nimport { CMCD_PARAM } from './CMCD_PARAM.js';\nimport { decodeCmcd } from './decodeCmcd.js';\n\n/**\n * Decode CMCD data from a query string.\n *\n * @param query - The query string to decode.\n *\n * @returns The decoded CMCD data.\n *\n *\n * @beta\n *\n * @example\n * {@includeCode ../test/fromCmcdQuery.test.ts#example}\n */\nexport function fromCmcdQuery(query: string | URLSearchParams): Cmcd {\n\tif (typeof query === 'string') {\n\t\tquery = new URLSearchParams(query);\n\t}\n\n\tconst value = query.get(CMCD_PARAM);\n\n\treturn decodeCmcd(value as string);\n}\n","import type { Cmcd } from './Cmcd.js';\nimport { decodeCmcd } from './decodeCmcd.js';\n\n/**\n * Decode CMCD data from a url encoded string.\n *\n * @param url - The url encoded string to decode.\n *\n * @returns The decoded CMCD data.\n *\n *\n * @beta\n *\n * @example\n * {@includeCode ../test/fromCmcdUrl.test.ts#example}\n */\nexport function fromCmcdUrl(url: string): Cmcd {\n\treturn decodeCmcd(decodeURIComponent(url.replace(/^CMCD=/, '')));\n}\n","import { SfToken, symbolToStr } from '@svta/cml-structured-field-values';\nimport type { Cmcd } from './Cmcd.js';\nimport type { CmcdEncodeOptions } from './CmcdEncodeOptions.js';\nimport { prepareCmcdData } from './prepareCmcdData.js';\n\n/**\n * Convert a CMCD data object to JSON.\n *\n * @param cmcd - The CMCD object to convert.\n * @param options - Options for encoding the CMCD object.\n *\n * @returns The CMCD JSON.\n *\n *\n * @beta\n *\n * @deprecated Sending CMCD as JSON objects is deprecated. Use `toCmcdUrl` to create an array of url strings instead.\n */\nexport function toCmcdJson(cmcd: Cmcd, options?: CmcdEncodeOptions): string {\n\tconst data = prepareCmcdData(cmcd, options);\n\n\treturn JSON.stringify(data, (_, value) => typeof value === 'symbol' || value instanceof SfToken ? symbolToStr(value) : value);\n}\n","import type { Request } from '@svta/cml-utils';\nimport type { Cmcd } from './Cmcd.js';\nimport { CMCD_HEADERS } from './CMCD_HEADERS.js';\nimport { CMCD_PARAM } from './CMCD_PARAM.js';\nimport { CMCD_QUERY } from './CMCD_QUERY.js';\nimport type { CmcdData } from './CmcdData.js';\nimport type { CmcdEncodeOptions } from './CmcdEncodeOptions.js';\nimport type { CmcdKey } from './CmcdKey.js';\nimport type { CmcdReportTarget } from './CmcdReportTarget.js';\nimport { encodeCmcd } from './encodeCmcd.js';\nimport { toCmcdHeaders } from './toCmcdHeaders.js';\n\n/**\n * Converts CMCD data into a report format.\n *\n * @param data - The CMCD data to be transformed into a report\n * @param target - The target configuration for the CMCD report\n *\n * @return A CMCD report object\n *\n *\n * @beta\n *\n * @example\n * {@includeCode ../test/toCmcdReport.test.ts#example}\n */\nexport function toCmcdReport(data: CmcdData, target: CmcdReportTarget): Request<{ cmcd: Cmcd }> | null {\n\tif (!target || !target.url) {\n\t\treturn null;\n\t}\n\n\tconst url = new URL(target.url);\n\tconst method = target.method || 'GET';\n\tconst headers = {};\n\tconst transimissionMode = target.transmissionMode || CMCD_QUERY;\n\tconst options: CmcdEncodeOptions = {\n\t\tversion: target.version,\n\t\treportingMode: target.reportingMode,\n\t};\n\n\tif (target.enabledKeys) {\n\t\toptions.filter = (key: CmcdKey) => target.enabledKeys!.includes(key);\n\t}\n\n\tswitch (transimissionMode) {\n\t\tcase CMCD_QUERY:\n\t\t\tconst param = encodeCmcd(data, options);\n\t\t\tif (param) {\n\t\t\t\turl.searchParams.set(CMCD_PARAM, param);\n\t\t\t}\n\t\t\tbreak;\n\n\t\tcase CMCD_HEADERS:\n\t\t\tObject.assign(headers, toCmcdHeaders(data, options));\n\t\t\tbreak;\n\t}\n\n\treturn {\n\t\turl: url.toString(),\n\t\tmethod,\n\t\theaders,\n\t};\n}\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;EACC,KAAK;GACJ,MAAM,QAAQ,WAAW,MAAM,QAAQ;AACvC,OAAI,MACH,KAAI,aAAa,IAAI,YAAY,MAAM;AAExC;EAED,KAAK;AACJ,UAAO,OAAO,SAAS,cAAc,MAAM,QAAQ,CAAC;AACpD;;AAGF,QAAO;EACN,KAAK,IAAI,UAAU;EACnB;EACA;EACA"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["CMCD_HEADER_MAP: Record<CmcdKey, CmcdHeaderField>","keys","CMCD_FORMATTER_MAP: Record<string, CmcdFormatter>","results: CmcdData","keys","formatterOptions: CmcdFormatterOptions","CMCD_KEYS: CmcdKey[]","CmcdEncoding: typeof CmcdTransmissionMode","CmcdFormatters: Record<string, CmcdFormatter>","options: CmcdEncodeOptions"],"sources":["../src/CMCD_OBJECT.ts","../src/CMCD_REQUEST.ts","../src/CMCD_SESSION.ts","../src/CMCD_STATUS.ts","../src/CMCD_HEADER_MAP.ts","../src/CmcdHeaderField.ts","../src/groupCmcdHeaders.ts","../src/CMCD_EVENT_MODE.ts","../src/CMCD_FORMATTER_MAP.ts","../src/CMCD_REQUEST_MODE.ts","../src/CMCD_RESPONSE_MODE.ts","../src/CMCD_COMMON_KEYS.ts","../src/CMCD_EVENT_KEYS.ts","../src/isCmcdCustomKey.ts","../src/isCmcdEventKey.ts","../src/CMCD_REQUEST_KEYS.ts","../src/isCmcdRequestKey.ts","../src/CMCD_RESPONSE_KEYS.ts","../src/isCmcdResponseKey.ts","../src/CMCD_V1_KEYS.ts","../src/isCmcdV1Key.ts","../src/prepareCmcdData.ts","../src/toCmcdHeaders.ts","../src/appendCmcdHeaders.ts","../src/CMCD_PARAM.ts","../src/encodeCmcd.ts","../src/toCmcdUrl.ts","../src/toCmcdQuery.ts","../src/appendCmcdQuery.ts","../src/CMCD_DEFAULT_TIME_INTERVAL.ts","../src/CMCD_HEADERS.ts","../src/CMCD_JSON.ts","../src/CMCD_KEYS.ts","../src/CMCD_QUERY.ts","../src/CMCD_V1.ts","../src/CMCD_V2.ts","../src/CmcdTransmissionMode.ts","../src/CmcdEncoding.ts","../src/CmcdEventType.ts","../src/CmcdFormatters.ts","../src/CmcdObjectType.ts","../src/CmcdPlayerState.ts","../src/CmcdReportingMode.ts","../src/CmcdStreamingFormat.ts","../src/CmcdStreamType.ts","../src/decodeCmcd.ts","../src/fromCmcdHeaders.ts","../src/fromCmcdQuery.ts","../src/fromCmcdUrl.ts","../src/toCmcdJson.ts","../src/toCmcdReport.ts"],"sourcesContent":["/**\n * CMCD object header name.\n *\n *\n * @beta\n */\nexport const CMCD_OBJECT = 'CMCD-Object'\n","/**\n * CMCD request header name.\n *\n *\n * @beta\n */\nexport const CMCD_REQUEST = 'CMCD-Request'\n","/**\n * CMCD session header name.\n *\n *\n * @beta\n */\nexport const CMCD_SESSION = 'CMCD-Session'\n","/**\n * CMCD status header name.\n *\n *\n * @beta\n */\nexport const CMCD_STATUS = 'CMCD-Status'\n","import { CMCD_OBJECT } from './CMCD_OBJECT.ts'\nimport { CMCD_REQUEST } from './CMCD_REQUEST.ts'\nimport { CMCD_SESSION } from './CMCD_SESSION.ts'\nimport { CMCD_STATUS } from './CMCD_STATUS.ts'\nimport type { CmcdHeaderField } from './CmcdHeaderField.ts'\nimport type { CmcdKey } from './CmcdKey.ts'\n\n/**\n * The map of CMCD keys to their appropriate header shard.\n *\n *\n * @internal\n */\nexport const CMCD_HEADER_MAP: Record<CmcdKey, CmcdHeaderField> = {\n\t// Object\n\tbr: CMCD_OBJECT,\n\tab: CMCD_OBJECT,\n\td: CMCD_OBJECT,\n\tot: CMCD_OBJECT,\n\ttb: CMCD_OBJECT,\n\ttpb: CMCD_OBJECT,\n\tlb: CMCD_OBJECT,\n\ttab: CMCD_OBJECT,\n\tlab: CMCD_OBJECT,\n\turl: CMCD_OBJECT,\n\n\t// Request\n\tpb: CMCD_REQUEST,\n\tbl: CMCD_REQUEST,\n\ttbl: CMCD_REQUEST,\n\tdl: CMCD_REQUEST,\n\tltc: CMCD_REQUEST,\n\tmtp: CMCD_REQUEST,\n\tnor: CMCD_REQUEST,\n\tnrr: CMCD_REQUEST,\n\trc: CMCD_REQUEST,\n\tsn: CMCD_REQUEST,\n\tsta: CMCD_REQUEST,\n\tsu: CMCD_REQUEST,\n\tttfb: CMCD_REQUEST,\n\tttfbb: CMCD_REQUEST,\n\tttlb: CMCD_REQUEST,\n\tcmsdd: CMCD_REQUEST,\n\tcmsds: CMCD_REQUEST,\n\tsmrt: CMCD_REQUEST,\n\tdf: CMCD_REQUEST,\n\tcs: CMCD_REQUEST,\n\n\t// TODO: Which header to put the `ts` field is not defined yet.\n\tts: CMCD_REQUEST,\n\n\t// Session\n\tcid: CMCD_SESSION,\n\tpr: CMCD_SESSION,\n\tsf: CMCD_SESSION,\n\tsid: CMCD_SESSION,\n\tst: CMCD_SESSION,\n\tv: CMCD_SESSION,\n\tmsd: CMCD_SESSION,\n\n\t// Status\n\tbs: CMCD_STATUS,\n\tbsd: CMCD_STATUS,\n\tcdn: CMCD_STATUS,\n\trtp: CMCD_STATUS,\n\tbg: CMCD_STATUS,\n\tpt: CMCD_STATUS,\n\tec: CMCD_STATUS,\n\te: CMCD_STATUS,\n}\n","import type { ValueOf } from '@svta/cml-utils'\nimport { CMCD_OBJECT } from './CMCD_OBJECT.ts'\nimport { CMCD_REQUEST } from './CMCD_REQUEST.ts'\nimport { CMCD_SESSION } from './CMCD_SESSION.ts'\nimport { CMCD_STATUS } from './CMCD_STATUS.ts'\n\n/**\n * CMCD header fields.\n *\n *\n * @enum\n *\n * @beta\n */\nexport const CmcdHeaderField = {\n\t/**\n\t * keys whose values vary with the object being requested.\n\t */\n\tOBJECT: CMCD_OBJECT as typeof CMCD_OBJECT,\n\n\t/**\n\t * keys whose values vary with each request.\n\t */\n\tREQUEST: CMCD_REQUEST as typeof CMCD_REQUEST,\n\n\t/**\n\t * keys whose values are expected to be invariant over the life of the session.\n\t */\n\tSESSION: CMCD_SESSION as typeof CMCD_SESSION,\n\n\t/**\n\t * keys whose values do not vary with every request or object.\n\t */\n\tSTATUS: CMCD_STATUS as typeof CMCD_STATUS,\n} as const\n\n/**\n * @beta\n */\nexport type CmcdHeaderField = ValueOf<typeof CmcdHeaderField>;\n","import { CMCD_HEADER_MAP } from './CMCD_HEADER_MAP.ts'\nimport type { CmcdData } from './CmcdData.ts'\nimport { CmcdHeaderField } from './CmcdHeaderField.ts'\nimport type { CmcdHeaderMap } from './CmcdHeaderMap.ts'\nimport type { CmcdKey } from './CmcdKey.ts'\n\nfunction createHeaderMap(headerMap: Partial<CmcdHeaderMap>): Record<CmcdKey, CmcdHeaderField> {\n\treturn Object.keys(headerMap)\n\t\t.reduce((acc, field) => {\n\t\t\theaderMap[field as CmcdHeaderField]?.forEach(key => acc[key] = field as CmcdHeaderField)\n\t\t\treturn acc\n\t\t}, {} as Record<CmcdKey, CmcdHeaderField>)\n}\n\n/**\n * Group a CMCD data object into header shards\n *\n * @param cmcd - The CMCD data object to convert.\n * @param customHeaderMap - A map of CMCD header fields to custom CMCD keys.\n *\n * @returns The CMCD header shards.\n *\n *\n * @beta\n */\nexport function groupCmcdHeaders(cmcd: CmcdData, customHeaderMap?: Partial<CmcdHeaderMap>): Record<CmcdHeaderField, CmcdData> {\n\tconst result = {} as Record<CmcdHeaderField, CmcdData>\n\n\tif (!cmcd) {\n\t\treturn result\n\t}\n\n\tconst keys = Object.keys(cmcd) as CmcdKey[]\n\tconst custom = customHeaderMap ? createHeaderMap(customHeaderMap) : {} as Record<CmcdKey, CmcdHeaderField>\n\n\treturn keys.reduce((acc: Record<CmcdHeaderField, CmcdData>, key: CmcdKey) => {\n\t\tconst field = CMCD_HEADER_MAP[key] || custom[key] || CmcdHeaderField.REQUEST\n\t\tconst data = acc[field] ??= {};\n\t\t(data as any)[key] = cmcd[key]\n\t\treturn acc\n\t}, result)\n}\n","/**\n * CMCD event mode variable name.\n *\n *\n * @beta\n */\nexport const CMCD_EVENT_MODE = 'event'\n","import { SfItem } from '@svta/cml-structured-field-values'\nimport { urlToRelativePath, type ValueOrArray } from '@svta/cml-utils'\nimport type { CmcdFormatter } from './CmcdFormatter.ts'\nimport type { CmcdFormatterOptions } from './CmcdFormatterOptions.ts'\nimport type { CmcdValue } from './CmcdValue.ts'\n\nconst toRounded = (value: CmcdValue) => Math.round(value as number)\n\nconst toUrlSafe = (value: CmcdValue, options: CmcdFormatterOptions): ValueOrArray<string> | ValueOrArray<SfItem> => {\n\tif (Array.isArray(value)) {\n\t\treturn value.map(item => toUrlSafe(item, options) as string)\n\t}\n\n\tif (value instanceof SfItem && typeof value.value === 'string') {\n\t\treturn new SfItem(toUrlSafe(value.value, options), value.params)\n\t}\n\telse {\n\t\tif (options.baseUrl) {\n\t\t\tvalue = urlToRelativePath(value as string, options.baseUrl)\n\t\t}\n\t\treturn options.version === 1 ? encodeURIComponent(value as string) : (value as string)\n\t}\n}\n\nconst toHundred = (value: CmcdValue) => toRounded(value as number / 100) * 100\n\nconst nor = (value: CmcdValue, options: CmcdFormatterOptions) => {\n\tlet norValue = value\n\n\tif (options.version >= 2) {\n\t\tif (value instanceof SfItem && typeof value.value === 'string') {\n\t\t\tnorValue = new SfItem([value])\n\t\t}\n\t\telse if (typeof value === 'string') {\n\t\t\tnorValue = [value]\n\t\t}\n\t}\n\n\treturn toUrlSafe(norValue, options)\n}\n\n/**\n * The default formatters for CMCD values.\n *\n *\n * @beta\n */\nexport const CMCD_FORMATTER_MAP: Record<string, CmcdFormatter> = {\n\t/**\n\t * Bitrate (kbps) rounded integer\n\t */\n\tbr: toRounded,\n\n\t/**\n\t * Duration (milliseconds) rounded integer\n\t */\n\td: toRounded,\n\n\t/**\n\t * Buffer Length (milliseconds) rounded nearest 100ms\n\t */\n\tbl: toHundred,\n\n\t/**\n\t * Deadline (milliseconds) rounded nearest 100ms\n\t */\n\tdl: toHundred,\n\n\t/**\n\t * Measured Throughput (kbps) rounded nearest 100kbps\n\t */\n\tmtp: toHundred,\n\n\t/**\n\t * Next Object Request URL encoded\n\t */\n\tnor,\n\n\t/**\n\t * Requested maximum throughput (kbps) rounded nearest 100kbps\n\t */\n\trtp: toHundred,\n\n\t/**\n\t * Top Bitrate (kbps) rounded integer\n\t */\n\ttb: toRounded,\n} as const\n","/**\n * CMCD request mode variable name.\n *\n *\n * @beta\n */\nexport const CMCD_REQUEST_MODE = 'request'\n","/**\n * CMCD response mode variable name.\n *\n *\n * @beta\n */\nexport const CMCD_RESPONSE_MODE = 'response'\n","/**\n * Defines the common keys for CMCD (Common Media Client Data) version 2.\n *\n *\n * @beta\n */\nexport const CMCD_COMMON_KEYS = [\n\t'ab',\n\t'bg',\n\t'bl',\n\t'br',\n\t'bs',\n\t'bsd',\n\t'cdn',\n\t'cid',\n\t'cs',\n\t'df',\n\t'ec',\n\t'lab',\n\t'lb',\n\t'ltc',\n\t'msd',\n\t'mtp',\n\t'pb',\n\t'pr',\n\t'pt',\n\t'sf',\n\t'sid',\n\t'sn',\n\t'st',\n\t'sta',\n\t'tab',\n\t'tb',\n\t'tbl',\n\t'tpb',\n\t'ts',\n\t'v',\n] as const\n","/**\n * Defines the event-specific keys for CMCD (Common Media Client Data) version 2.\n *\n *\n * @beta\n */\nexport const CMCD_EVENT_KEYS = [\n\t'e',\n] as const\n","import type { CmcdKey } from './CmcdKey.ts'\n\nconst CUSTOM_KEY_REGEX = /^[a-zA-Z0-9-.]+-[a-zA-Z0-9-.]+$/\n\n/**\n * Check if a key is a custom key.\n *\n * @param key - The key to check.\n *\n * @returns `true` if the key is a custom key, `false` otherwise.\n *\n *\n * @beta\n */\nexport function isCmcdCustomKey(key: CmcdKey): boolean {\n\treturn CUSTOM_KEY_REGEX.test(key)\n}\n","import { CMCD_COMMON_KEYS } from './CMCD_COMMON_KEYS.ts'\nimport { CMCD_EVENT_KEYS } from './CMCD_EVENT_KEYS.ts'\nimport type { CmcdEvent } from './CmcdEvent.ts'\nimport { isCmcdCustomKey } from './isCmcdCustomKey.ts'\n\n/**\n * Check if a key is a valid CMCD event key.\n *\n * @param key - The key to check.\n *\n * @returns `true` if the key is a valid CMCD event key, `false` otherwise.\n *\n *\n * @beta\n *\n * @example\n * {@includeCode ../test/isCmcdEventKey.test.ts#example}\n */\nexport function isCmcdEventKey(key: string): key is keyof CmcdEvent {\n\treturn CMCD_COMMON_KEYS.includes(key as any) ||\n\t\tCMCD_EVENT_KEYS.includes(key as any) ||\n\t\tisCmcdCustomKey(key as any)\n}\n","/**\n * Defines the request-specific keys for CMCD (Common Media Client Data) version 2.\n *\n *\n * @beta\n */\nexport const CMCD_REQUEST_KEYS = [\n\t'd',\n\t'dl',\n\t'nor',\n\t'ot',\n\t'rtp',\n\t'su',\n] as const\n","import { CMCD_COMMON_KEYS } from './CMCD_COMMON_KEYS.ts'\nimport { CMCD_REQUEST_KEYS } from './CMCD_REQUEST_KEYS.ts'\nimport type { CmcdRequest } from './CmcdRequest.ts'\nimport { isCmcdCustomKey } from './isCmcdCustomKey.ts'\n\n/**\n * Check if a key is a valid CMCD request key.\n *\n * @param key - The key to check.\n *\n * @returns `true` if the key is a valid CMCD request key, `false` otherwise.\n *\n *\n * @beta\n *\n * @example\n * {@includeCode ../test/isCmcdRequestKey.test.ts#example}\n */\nexport function isCmcdRequestKey(key: string): key is keyof CmcdRequest {\n\treturn CMCD_COMMON_KEYS.includes(key as any) ||\n\t\tCMCD_REQUEST_KEYS.includes(key as any) ||\n\t\tisCmcdCustomKey(key as any)\n}\n","/**\n * CMCD v2 - Response-only and timing keys.\n *\n *\n * @beta\n */\nexport const CMCD_RESPONSE_KEYS = [\n\t'cmsdd',\n\t'cmsds',\n\t'rc',\n\t'smrt',\n\t'ttfb',\n\t'ttfbb',\n\t'ttlb',\n\t'url',\n] as const\n","import { CMCD_COMMON_KEYS } from './CMCD_COMMON_KEYS.ts'\nimport { CMCD_REQUEST_KEYS } from './CMCD_REQUEST_KEYS.ts'\nimport { CMCD_RESPONSE_KEYS } from './CMCD_RESPONSE_KEYS.ts'\nimport type { CmcdResponse } from './CmcdResponse.ts'\nimport { isCmcdCustomKey } from './isCmcdCustomKey.ts'\n\n/**\n * Check if a key is a valid CMCD response key.\n *\n * @param key - The key to check.\n *\n * @returns `true` if the key is a valid CMCD request key, `false` otherwise.\n *\n *\n * @beta\n *\n * @example\n * {@includeCode ../test/isCmcdResponseKey.test.ts#example}\n */\nexport function isCmcdResponseKey(key: string): key is keyof CmcdResponse {\n\treturn CMCD_COMMON_KEYS.includes(key as any) ||\n\t\tCMCD_REQUEST_KEYS.includes(key as any) ||\n\t\tCMCD_RESPONSE_KEYS.includes(key as any) ||\n\t\tisCmcdCustomKey(key as any)\n}\n","/**\n * Defines the keys for CMCD (Common Media Client Data) version 1.\n *\n *\n * @beta\n */\nexport const CMCD_V1_KEYS = [\n\t'bl',\n\t'br',\n\t'bs',\n\t'cid',\n\t'd',\n\t'dl',\n\t'mtp',\n\t'nor',\n\t'nrr',\n\t'ot',\n\t'pr',\n\t'rtp',\n\t'sf',\n\t'sid',\n\t'st',\n\t'su',\n\t'tb',\n\t'v',\n] as const\n","import { CMCD_V1_KEYS } from './CMCD_V1_KEYS.ts'\nimport type { Cmcd } from './Cmcd.ts'\nimport { isCmcdCustomKey } from './isCmcdCustomKey.ts'\n\n/**\n * Filter function for CMCD v1 keys.\n *\n * @param key - The CMCD key to filter.\n *\n * @returns `true` if the key should be included, `false` otherwise.\n *\n *\n * @beta\n *\n * @example\n * {@includeCode ../test/isCmcdV1Key.test.ts#example}\n */\nexport function isCmcdV1Key(key: string): key is keyof Cmcd {\n\treturn CMCD_V1_KEYS.includes(key as any) || isCmcdCustomKey(key as any)\n}\n","import { isTokenField, isValid } from '@svta/cml-cta'\nimport { SfToken } from '@svta/cml-structured-field-values'\nimport { CMCD_EVENT_MODE } from './CMCD_EVENT_MODE.ts'\nimport { CMCD_FORMATTER_MAP } from './CMCD_FORMATTER_MAP.ts'\nimport { CMCD_REQUEST_MODE } from './CMCD_REQUEST_MODE.ts'\nimport { CMCD_RESPONSE_MODE } from './CMCD_RESPONSE_MODE.ts'\nimport type { CmcdData } from './CmcdData.ts'\nimport type { CmcdEncodeOptions } from './CmcdEncodeOptions.ts'\nimport type { CmcdFormatterOptions } from './CmcdFormatterOptions.ts'\nimport type { CmcdValue } from './CmcdValue.ts'\nimport { isCmcdEventKey } from './isCmcdEventKey.ts'\nimport { isCmcdRequestKey } from './isCmcdRequestKey.ts'\nimport { isCmcdResponseKey } from './isCmcdResponseKey.ts'\nimport { isCmcdV1Key } from './isCmcdV1Key.ts'\n\nconst filterMap = {\n\t[CMCD_RESPONSE_MODE]: isCmcdResponseKey,\n\t[CMCD_EVENT_MODE]: isCmcdEventKey,\n\t[CMCD_REQUEST_MODE]: isCmcdRequestKey,\n}\n\n/**\n * Convert a generic object to CMCD data.\n *\n * @param obj - The CMCD object to process.\n * @param options - Options for encoding.\n *\n *\n * @beta\n */\nexport function prepareCmcdData(obj: Record<string, any>, options: CmcdEncodeOptions = {}): CmcdData {\n\tconst results: CmcdData = {}\n\n\tif (obj == null || typeof obj !== 'object') {\n\t\treturn results\n\t}\n\n\tconst version = options.version || (obj['v'] as number) || 1\n\tconst reportingMode = options.reportingMode || CMCD_REQUEST_MODE\n\tconst keyFilter = version === 1 ? isCmcdV1Key : filterMap[reportingMode]\n\n\t// Filter keys based on the version, reporting mode and options\n\tlet keys = Object.keys(obj).filter(keyFilter)\n\n\tconst filter = options.filter\n\tif (typeof filter === 'function') {\n\t\tkeys = keys.filter(filter)\n\t}\n\n\t// Ensure all required keys are present before sorting\n\tconst needsTimestamp = reportingMode === CMCD_RESPONSE_MODE || reportingMode === CMCD_EVENT_MODE\n\tif (needsTimestamp && !keys.includes('ts')) {\n\t\tkeys.push('ts')\n\t}\n\n\tif (version > 1 && !keys.includes('v')) {\n\t\tkeys.push('v')\n\t}\n\n\tconst formatters = Object.assign({}, CMCD_FORMATTER_MAP, options.formatters)\n\tconst formatterOptions: CmcdFormatterOptions = {\n\t\tversion,\n\t\treportingMode,\n\t\tbaseUrl: options.baseUrl,\n\t}\n\n\tkeys.sort().forEach(key => {\n\t\tlet value = obj[key] as CmcdValue\n\n\t\tconst formatter = formatters[key]\n\t\tif (typeof formatter === 'function') {\n\t\t\tvalue = formatter(value, formatterOptions)\n\t\t}\n\n\t\t// Version should only be reported if not equal to 1.\n\t\tif (key === 'v') {\n\t\t\tif (version === 1) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\telse {\n\t\t\t\tvalue = version\n\t\t\t}\n\t\t}\n\n\t\t// Playback rate should only be sent if not equal to 1.\n\t\tif (key == 'pr' && value === 1) {\n\t\t\treturn\n\t\t}\n\n\t\t// Ensure a timestamp is set for response and event modes\n\t\tif (needsTimestamp && key === 'ts' && !Number.isFinite(value)) {\n\t\t\tvalue = Date.now()\n\t\t}\n\n\t\t// ignore invalid values\n\t\tif (!isValid(value)) {\n\t\t\treturn\n\t\t}\n\n\t\tif (isTokenField(key) && typeof value === 'string') {\n\t\t\tvalue = new SfToken(value)\n\t\t}\n\n\t\t(results as any)[key] = value\n\t})\n\n\treturn results\n}\n","import { encodeSfDict } from '@svta/cml-structured-field-values'\nimport type { CmcdData } from './CmcdData.ts'\nimport type { CmcdEncodeOptions } from './CmcdEncodeOptions.ts'\nimport type { CmcdHeaderField } from './CmcdHeaderField.ts'\nimport { groupCmcdHeaders } from './groupCmcdHeaders.ts'\nimport { prepareCmcdData } from './prepareCmcdData.ts'\n\n/**\n * Convert a CMCD data object to request headers\n *\n * @param cmcd - The CMCD data object to convert.\n * @param options - Options for encoding the CMCD object.\n *\n * @returns The CMCD header shards.\n *\n *\n * @beta\n *\n * @example\n * {@includeCode ../test/toCmcdHeaders.test.ts#example}\n */\nexport function toCmcdHeaders(cmcd: CmcdData, options: CmcdEncodeOptions = {}): Record<CmcdHeaderField, string> {\n\tconst result = {} as Record<CmcdHeaderField, string>\n\n\tif (!cmcd) {\n\t\treturn result\n\t}\n\n\tconst data = prepareCmcdData(cmcd, options)\n\tconst shards = groupCmcdHeaders(data, options?.customHeaderMap)\n\n\treturn Object.entries(shards)\n\t\t.reduce((acc, [field, value]) => {\n\t\t\tconst shard = encodeSfDict(value, { whitespace: false })\n\t\t\tif (shard) {\n\t\t\t\tacc[field as CmcdHeaderField] = shard\n\t\t\t}\n\t\t\treturn acc\n\t\t}, result)\n}\n","import type { Cmcd } from './Cmcd.ts'\nimport type { CmcdEncodeOptions } from './CmcdEncodeOptions.ts'\nimport { toCmcdHeaders } from './toCmcdHeaders.ts'\n\n/**\n * Append CMCD query args to a header object.\n *\n * @param headers - The headers to append to.\n * @param cmcd - The CMCD object to append.\n * @param options - Encode options.\n *\n * @returns The headers with the CMCD header shards appended.\n *\n *\n * @beta\n *\n * @example\n * {@includeCode ../test/appendCmcdHeaders.test.ts#example}\n */\nexport function appendCmcdHeaders(headers: Record<string, string>, cmcd: Cmcd, options?: CmcdEncodeOptions): Record<string, string> {\n\treturn Object.assign(headers, toCmcdHeaders(cmcd, options))\n}\n","/**\n * CMCD parameter name.\n *\n *\n * @beta\n */\nexport const CMCD_PARAM = 'CMCD'\n","import { encodeSfDict } from '@svta/cml-structured-field-values'\nimport type { CmcdData } from './CmcdData.ts'\nimport type { CmcdEncodeOptions } from './CmcdEncodeOptions.ts'\nimport { prepareCmcdData } from './prepareCmcdData.ts'\n\n/**\n * Encode a CMCD object to a string.\n *\n * @param cmcd - The CMCD object to encode.\n * @param options - Options for encoding.\n *\n * @returns The encoded CMCD string.\n *\n *\n * @beta\n *\n * @example\n * {@includeCode ../test/encodeCmcd.test.ts#example}\n */\nexport function encodeCmcd(cmcd: CmcdData, options: CmcdEncodeOptions = {}): string {\n\tif (!cmcd) {\n\t\treturn ''\n\t}\n\n\treturn encodeSfDict(prepareCmcdData(cmcd, options), { whitespace: false })\n}\n","import type { Cmcd } from './Cmcd.ts'\nimport type { CmcdEncodeOptions } from './CmcdEncodeOptions.ts'\nimport { encodeCmcd } from './encodeCmcd.ts'\n\n/**\n * Convert a CMCD data object to a URL encoded string.\n *\n * @param cmcd - The CMCD object to convert.\n * @param options - Options for encoding the CMCD object.\n *\n * @returns The URL encoded CMCD data.\n *\n *\n * @beta\n */\nexport function toCmcdUrl(cmcd: Cmcd, options: CmcdEncodeOptions = {}): string {\n\tif (!cmcd) {\n\t\treturn ''\n\t}\n\n\tconst params = encodeCmcd(cmcd, options)\n\n\treturn encodeURIComponent(params)\n}\n","import { CMCD_PARAM } from './CMCD_PARAM.ts'\nimport type { Cmcd } from './Cmcd.ts'\nimport type { CmcdEncodeOptions } from './CmcdEncodeOptions.ts'\nimport { toCmcdUrl } from './toCmcdUrl.ts'\n\n/**\n * Convert a CMCD data object to a query arg.\n *\n * @param cmcd - The CMCD object to convert.\n * @param options - Options for encoding the CMCD object.\n *\n * @returns The CMCD query arg.\n *\n *\n * @beta\n *\n * @example\n * {@includeCode ../test/toCmcdQuery.test.ts#example}\n */\nexport function toCmcdQuery(cmcd: Cmcd, options: CmcdEncodeOptions = {}): string {\n\tif (!cmcd) {\n\t\treturn ''\n\t}\n\n\tconst value = toCmcdUrl(cmcd, options)\n\n\treturn `${CMCD_PARAM}=${value}`\n}\n","import type { Cmcd } from './Cmcd.ts'\nimport type { CmcdEncodeOptions } from './CmcdEncodeOptions.ts'\nimport { toCmcdQuery } from './toCmcdQuery.ts'\n\nconst REGEX = /CMCD=[^&#]+/\n\n/**\n * Append CMCD query args to a URL.\n *\n * @param url - The URL to append to.\n * @param cmcd - The CMCD object to append.\n * @param options - Options for encoding the CMCD object.\n *\n * @returns The URL with the CMCD query args appended.\n *\n *\n * @beta\n *\n * @example\n * {@includeCode ../test/appendCmcdQuery.test.ts#example}\n */\nexport function appendCmcdQuery(url: string, cmcd: Cmcd, options?: CmcdEncodeOptions): string {\n\t// TODO: Replace with URLSearchParams once we drop Safari < 10.1 & Chrome < 49 support.\n\t// https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams\n\n\tconst query = toCmcdQuery(cmcd, options)\n\tif (!query) {\n\t\treturn url\n\t}\n\n\tif (REGEX.test(url)) {\n\t\treturn url.replace(REGEX, query)\n\t}\n\n\tconst separator = url.includes('?') ? '&' : '?'\n\treturn `${url}${separator}${query}`\n}\n","/**\n * The default time interval in secondswhen using using event mode\n *\n *\n * @beta\n */\nexport const CMCD_DEFAULT_TIME_INTERVAL = 30\n","/**\n * CMCD `headers` transmission mode.\n *\n *\n * @beta\n */\nexport const CMCD_HEADERS = 'headers'\n","/**\n * CMCD `json` transmission mode.\n *\n *\n * @beta\n *\n * @deprecated JSON transmission mode is deprecated and will be removed in future versions.\n */\nexport const CMCD_JSON = 'json'\n","import { CMCD_COMMON_KEYS } from './CMCD_COMMON_KEYS.ts'\nimport { CMCD_EVENT_KEYS } from './CMCD_EVENT_KEYS.ts'\nimport { CMCD_REQUEST_KEYS } from './CMCD_REQUEST_KEYS.ts'\nimport { CMCD_RESPONSE_KEYS } from './CMCD_RESPONSE_KEYS.ts'\nimport { CMCD_V1_KEYS } from './CMCD_V1_KEYS.ts'\nimport type { CmcdKey } from './CmcdKey.ts'\n\nconst keySet = new Set([...CMCD_V1_KEYS, ...CMCD_COMMON_KEYS, ...CMCD_REQUEST_KEYS, ...CMCD_RESPONSE_KEYS, ...CMCD_EVENT_KEYS])\n\n/**\n * A list of all CMCD keys.\n *\n *\n * @beta\n */\nexport const CMCD_KEYS: CmcdKey[] = Array.from(keySet)\n","/**\n * CMCD `query` transmission mode.\n *\n *\n * @beta\n */\nexport const CMCD_QUERY = 'query'\n","/**\n * CMCD Version 1\n *\n *\n * @beta\n */\nexport const CMCD_V1 = 1\n","/**\n * CMCD Version 2\n *\n *\n * @beta\n */\nexport const CMCD_V2 = 2\n","import type { ValueOf } from '@svta/cml-utils'\nimport { CMCD_HEADERS } from './CMCD_HEADERS.ts'\nimport { CMCD_JSON } from './CMCD_JSON.ts'\nimport { CMCD_QUERY } from './CMCD_QUERY.ts'\n\n/**\n * CMCD transmission modes.\n *\n *\n * @enum\n *\n * @beta\n */\nexport const CmcdTransmissionMode = {\n\t/**\n\t * JSON\n\t *\n\t * @deprecated JSON transmission mode is deprecated and will be removed in future versions.\n\t */\n\tJSON: CMCD_JSON as typeof CMCD_JSON,\n\n\t/**\n\t * Query string\n\t */\n\tQUERY: CMCD_QUERY as typeof CMCD_QUERY,\n\n\t/**\n\t * Request headers\n\t */\n\tHEADERS: CMCD_HEADERS as typeof CMCD_HEADERS,\n\n} as const\n\n/**\n * @beta\n */\nexport type CmcdTransmissionMode = ValueOf<typeof CmcdTransmissionMode>;\n","import type { ValueOf } from '@svta/cml-utils'\nimport { CmcdTransmissionMode } from './CmcdTransmissionMode.ts'\n\n/**\n * CMCD encoding types.\n *\n *\n * @enum\n *\n * @beta\n *\n * @deprecated Use {@link CmcdTransmissionMode} instead.\n *\n * @see {@link CmcdTransmissionMode}\n */\nexport const CmcdEncoding: typeof CmcdTransmissionMode = CmcdTransmissionMode\n\n/**\n * @beta\n */\nexport type CmcdEncoding = ValueOf<typeof CmcdEncoding>;\n","import type { ValueOf } from '@svta/cml-utils'\n\n/**\n * CMCD event types for the 'e' key (event mode).\n *\n *\n * @enum\n *\n * @beta\n */\nexport const CmcdEventType = {\n\t/**\n\t * A change in the player state.\n\t */\n\tPLAY_STATE: 'ps',\n\n\t/**\n\t * An error event.\n\t */\n\tERROR: 'e',\n\n\t/**\n\t * A periodic report sent on a time interval.\n\t */\n\tTIME_INTERVAL: 't',\n\n\t/**\n\t * A change of the content ID.\n\t */\n\tCONTENT_ID: 'c',\n\n\t/**\n\t * A change in the application's backgrounded state.\n\t */\n\tBACKGROUNDED_MODE: 'b',\n\n\t/**\n\t * The player was muted.\n\t */\n\tMUTE: 'm',\n\n\t/**\n\t * Player unmuted.\n\t */\n\tUNMUTE: 'um',\n\n\t/**\n\t * The player view was expanded.\n\t */\n\tPLAYER_EXPAND: 'pe',\n\n\t/**\n\t * The player view was collapsed.\n\t */\n\tPLAYER_COLLAPSE: 'pc',\n} as const\n\n/**\n * @beta\n */\nexport type CmcdEventType = ValueOf<typeof CmcdEventType>;\n","import { CMCD_FORMATTER_MAP } from './CMCD_FORMATTER_MAP.ts'\nimport type { CmcdFormatter } from './CmcdFormatter.ts'\n\n/**\n * The default formatters for CMCD values.\n *\n *\n * @beta\n *\n * @deprecated Use `CMCD_FORMATTER_MAP` instead.\n */\nexport const CmcdFormatters: Record<string, CmcdFormatter> = CMCD_FORMATTER_MAP\n","import { CmObjectType } from '@svta/cml-cta'\n\n/**\n * Common Media Client Data Object Type\n *\n *\n * @beta\n *\n * @enum\n */\nexport const CmcdObjectType = CmObjectType as typeof CmObjectType\n\n/**\n * @beta\n */\nexport type CmcdObjectType = CmObjectType;\n","import type { ValueOf } from '@svta/cml-utils'\n\n/**\n * CMCD v2 player states for the 'sta' key.\n *\n *\n * @enum\n *\n * @beta\n */\nexport const CmcdPlayerState = {\n\t/**\n\t * Starting: Initial startup of the player.\n\t */\n\tSTARTING: 's',\n\n\t/**\n\t * Playing: The player is actively rendering content.\n\t */\n\tPLAYING: 'p',\n\n\t/**\n\t * Seeking: The player is seeking to a new position.\n\t */\n\tSEEKING: 'k',\n\n\t/**\n\t * Rebuffering: The player is buffering data during playback.\n\t */\n\tREBUFFERING: 'r',\n\n\t/**\n\t * Paused: The player is paused.\n\t */\n\tPAUSED: 'a',\n\n\t/**\n\t * Waiting: The player is waiting for a user action or another event.\n\t */\n\tWAITING: 'w',\n\n\t/**\n\t * Ended: The media has finished playing.\n\t */\n\tENDED: 'e',\n\n\t/**\n\t * Fatal Error: The player has encountered a fatal error.\n\t */\n\tFATAL_ERROR: 'f',\n\n\t/**\n\t * Quit: User initiated end of playback before media asset completion.\n\t */\n\tQUIT: 'q',\n\n\t/**\n\t * Preloading: The player is loading assets ahead of starting in order to provide a fast startup. The expectation is that playback will commence at a future time.\n\t */\n\tPRELOADING: 'd',\n} as const\n\n/**\n * @beta\n */\nexport type CmcdPlayerState = ValueOf<typeof CmcdPlayerState>;\n","import type { ValueOf } from '@svta/cml-utils'\nimport { CMCD_EVENT_MODE } from './CMCD_EVENT_MODE.ts'\nimport { CMCD_REQUEST_MODE } from './CMCD_REQUEST_MODE.ts'\nimport { CMCD_RESPONSE_MODE } from './CMCD_RESPONSE_MODE.ts'\n\n/**\n * CMCD reporting mode types.\n *\n *\n * @enum\n *\n * @beta\n */\nexport const CmcdReportingMode = {\n\t/**\n\t * Request mode\n\t */\n\tREQUEST: CMCD_REQUEST_MODE as typeof CMCD_REQUEST_MODE,\n\n\t/**\n\t * Response mode\n\t */\n\tRESPONSE: CMCD_RESPONSE_MODE as typeof CMCD_RESPONSE_MODE,\n\n\t/**\n\t * Event mode\n\t */\n\tEVENT: CMCD_EVENT_MODE as typeof CMCD_EVENT_MODE,\n} as const\n\n/**\n * @beta\n */\nexport type CmcdReportingMode = ValueOf<typeof CmcdReportingMode>;\n","import { CmStreamingFormat } from '@svta/cml-cta'\n\n/**\n * Common Media Client Data Streaming Format\n *\n *\n * @enum\n *\n * @beta\n */\nexport const CmcdStreamingFormat = CmStreamingFormat as typeof CmStreamingFormat\n\n/**\n * @beta\n */\nexport type CmcdStreamingFormat = CmStreamingFormat;\n","import { CmStreamType } from '@svta/cml-cta'\n\n/**\n * Common Media Client Data Stream Type\n *\n *\n * @enum\n *\n * @beta\n */\nexport const CmcdStreamType = CmStreamType as typeof CmStreamType\n\n/**\n * @beta\n */\nexport type CmcdStreamType = CmStreamType;\n","import type { SfBareItem } from '@svta/cml-structured-field-values'\nimport { decodeSfDict, SfItem, symbolToStr } from '@svta/cml-structured-field-values'\nimport type { CmcdData } from './CmcdData.ts'\nimport type { CmcdValue } from './CmcdValue.ts'\n\n// Define the input type for reduceValue\ntype ReduceValueInput = SfBareItem | SfItem | ReduceValueInput[];\n\n// Define the output type for reduceValue - matches what CMCD values can be, including arrays\ntype ReduceValueOutput = CmcdValue | ReduceValueOutput[];\n\nfunction reduceValue(value: ReduceValueInput): ReduceValueOutput {\n\tif (Array.isArray(value)) {\n\t\treturn value.map(reduceValue)\n\t}\n\n\tif (typeof value === 'symbol') {\n\t\treturn symbolToStr(value)\n\t}\n\n\tif (value instanceof SfItem && !value.params) {\n\t\treturn reduceValue(value.value)\n\t}\n\n\tif (typeof value === 'string') {\n\t\treturn decodeURIComponent(value)\n\t}\n\n\treturn value as ReduceValueOutput\n};\n\n/**\n * Decode a CMCD string to an object.\n *\n * @param cmcd - The CMCD string to decode.\n *\n * @returns The decoded CMCD object.\n *\n *\n * @beta\n *\n * @example\n * {@includeCode ../test/decodeCmcd.test.ts#example}\n */\nexport function decodeCmcd<T extends CmcdData = CmcdData>(cmcd: string): T {\n\tif (!cmcd) {\n\t\treturn {} as T\n\t}\n\n\tconst sfDict = decodeSfDict(cmcd)\n\n\treturn Object\n\t\t.entries<SfItem>(sfDict as any)\n\t\t.reduce((acc, [key, item]) => {\n\t\t\tacc[key as keyof T] = reduceValue(item.value) as T[keyof T]\n\t\t\treturn acc\n\t\t}, {} as T)\n}\n","import { CMCD_OBJECT } from './CMCD_OBJECT.ts'\nimport { CMCD_REQUEST } from './CMCD_REQUEST.ts'\nimport { CMCD_SESSION } from './CMCD_SESSION.ts'\nimport { CMCD_STATUS } from './CMCD_STATUS.ts'\nimport type { CmcdData } from './CmcdData.ts'\nimport { decodeCmcd } from './decodeCmcd.ts'\n\nconst keys = [CMCD_OBJECT, CMCD_REQUEST, CMCD_SESSION, CMCD_STATUS]\n\n/**\n * Decode CMCD data from request headers.\n *\n * @param headers - The request headers to decode.\n *\n * @returns The decoded CMCD data.\n *\n *\n * @beta\n *\n * @example\n * {@includeCode ../test/fromCmcdHeaders.test.ts#example}\n */\nexport function fromCmcdHeaders(headers: Record<string, string> | Headers): CmcdData {\n\tif (!(headers instanceof Headers)) {\n\t\theaders = new Headers(headers)\n\t}\n\n\treturn keys.reduce((acc, key) => {\n\t\tconst value = headers.get(key)\n\t\treturn Object.assign(acc, decodeCmcd(value as string))\n\t}, {} as CmcdData)\n}\n","import type { Cmcd } from './Cmcd.ts'\nimport { CMCD_PARAM } from './CMCD_PARAM.ts'\nimport { decodeCmcd } from './decodeCmcd.ts'\n\n/**\n * Decode CMCD data from a query string.\n *\n * @param query - The query string to decode.\n *\n * @returns The decoded CMCD data.\n *\n *\n * @beta\n *\n * @example\n * {@includeCode ../test/fromCmcdQuery.test.ts#example}\n */\nexport function fromCmcdQuery(query: string | URLSearchParams): Cmcd {\n\tif (typeof query === 'string') {\n\t\tquery = new URLSearchParams(query)\n\t}\n\n\tconst value = query.get(CMCD_PARAM)\n\n\treturn decodeCmcd(value as string)\n}\n","import type { Cmcd } from './Cmcd.ts'\nimport { decodeCmcd } from './decodeCmcd.ts'\n\n/**\n * Decode CMCD data from a url encoded string.\n *\n * @param url - The url encoded string to decode.\n *\n * @returns The decoded CMCD data.\n *\n *\n * @beta\n *\n * @example\n * {@includeCode ../test/fromCmcdUrl.test.ts#example}\n */\nexport function fromCmcdUrl(url: string): Cmcd {\n\treturn decodeCmcd(decodeURIComponent(url.replace(/^CMCD=/, '')))\n}\n","import { SfToken, symbolToStr } from '@svta/cml-structured-field-values'\nimport type { Cmcd } from './Cmcd.ts'\nimport type { CmcdEncodeOptions } from './CmcdEncodeOptions.ts'\nimport { prepareCmcdData } from './prepareCmcdData.ts'\n\n/**\n * Convert a CMCD data object to JSON.\n *\n * @param cmcd - The CMCD object to convert.\n * @param options - Options for encoding the CMCD object.\n *\n * @returns The CMCD JSON.\n *\n *\n * @beta\n *\n * @deprecated Sending CMCD as JSON objects is deprecated. Use `toCmcdUrl` to create an array of url strings instead.\n */\nexport function toCmcdJson(cmcd: Cmcd, options?: CmcdEncodeOptions): string {\n\tconst data = prepareCmcdData(cmcd, options)\n\n\treturn JSON.stringify(data, (_, value) => typeof value === 'symbol' || value instanceof SfToken ? symbolToStr(value) : value)\n}\n","import type { Request } from '@svta/cml-utils'\nimport type { Cmcd } from './Cmcd.ts'\nimport { CMCD_HEADERS } from './CMCD_HEADERS.ts'\nimport { CMCD_PARAM } from './CMCD_PARAM.ts'\nimport { CMCD_QUERY } from './CMCD_QUERY.ts'\nimport type { CmcdData } from './CmcdData.ts'\nimport type { CmcdEncodeOptions } from './CmcdEncodeOptions.ts'\nimport type { CmcdKey } from './CmcdKey.ts'\nimport type { CmcdReportTarget } from './CmcdReportTarget.ts'\nimport { encodeCmcd } from './encodeCmcd.ts'\nimport { toCmcdHeaders } from './toCmcdHeaders.ts'\n\n/**\n * Converts CMCD data into a report format.\n *\n * @param data - The CMCD data to be transformed into a report\n * @param target - The target configuration for the CMCD report\n *\n * @return A CMCD report object\n *\n *\n * @beta\n *\n * @example\n * {@includeCode ../test/toCmcdReport.test.ts#example}\n */\nexport function toCmcdReport(data: CmcdData, target: CmcdReportTarget): Request<{ cmcd: Cmcd }> | null {\n\tif (!target || !target.url) {\n\t\treturn null\n\t}\n\n\tconst url = new URL(target.url)\n\tconst method = target.method || 'GET'\n\tconst headers = {}\n\tconst transimissionMode = target.transmissionMode || CMCD_QUERY\n\tconst options: CmcdEncodeOptions = {\n\t\tversion: target.version,\n\t\treportingMode: target.reportingMode,\n\t}\n\n\tconst { enabledKeys } = target\n\tif (enabledKeys) {\n\t\toptions.filter = (key: CmcdKey) => enabledKeys.includes(key)\n\t}\n\n\tswitch (transimissionMode) {\n\t\tcase CMCD_QUERY:\n\t\t\tconst param = encodeCmcd(data, options)\n\t\t\tif (param) {\n\t\t\t\turl.searchParams.set(CMCD_PARAM, param)\n\t\t\t}\n\t\t\tbreak\n\n\t\tcase CMCD_HEADERS:\n\t\t\tObject.assign(headers, toCmcdHeaders(data, options))\n\t\t\tbreak\n\t}\n\n\treturn {\n\t\turl: url.toString(),\n\t\tmethod,\n\t\theaders,\n\t}\n}\n"],"mappings":";;;;;;;;;;;AAMA,MAAa,cAAc;;;;;;;;;;ACA3B,MAAa,eAAe;;;;;;;;;;ACA5B,MAAa,eAAe;;;;;;;;;;ACA5B,MAAa,cAAc;;;;;;;;;;ACO3B,MAAaA,kBAAoD;CAEhE,IAAI;CACJ,IAAI;CACJ,GAAG;CACH,IAAI;CACJ,IAAI;CACJ,KAAK;CACL,IAAI;CACJ,KAAK;CACL,KAAK;CACL,KAAK;CAGL,IAAI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
|
|
2
2
|
"name": "@svta/cml-cmcd",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.22.0",
|
|
4
4
|
"description": "Common Media Client Data (CMCD) encoding and decoding",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -52,8 +52,8 @@
|
|
|
52
52
|
}
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
|
-
"@svta/cml-cta": "
|
|
56
|
-
"@svta/cml-structured-field-values": "
|
|
57
|
-
"@svta/cml-utils": "
|
|
55
|
+
"@svta/cml-cta": "*",
|
|
56
|
+
"@svta/cml-structured-field-values": "*",
|
|
57
|
+
"@svta/cml-utils": "*"
|
|
58
58
|
}
|
|
59
59
|
}
|