diff --git a/app.js b/app.js index cb1bc01..ad4abcf 100644 --- a/app.js +++ b/app.js @@ -2685,7 +2685,6 @@ function extendDevicePropertiesForGen2(rawProps) { return { ...rawProps, KEY_DATA_OFFSET: 3, - SUPPORTS_RGB_KEY_FILL: true, }; } function createBaseGen2Properties(device, options, properties, propertiesService, disableXYFlip) { @@ -2780,6 +2779,7 @@ const neoProperties = { FULLSCREEN_PANELS: 0, HAS_NFC_READER: false, SUPPORTS_CHILD_DEVICES: false, + SUPPORTS_RGB_KEY_FILL: true, }; const lcdSegmentControls = neoProperties.CONTROLS.filter((control) => control.type === 'lcd-segment'); function StreamDeckNeoFactory(device, options) { @@ -2804,6 +2804,7 @@ const controlsGenerator_js_1 = __webpack_require__(3794); const origMK2Properties = { MODEL: id_js_1.DeviceModelId.ORIGINALMK2, PRODUCT_NAME: id_js_1.MODEL_NAMES[id_js_1.DeviceModelId.ORIGINALMK2], + SUPPORTS_RGB_KEY_FILL: false, // TODO - verify SUPPORTS_RGB_KEY_FILL CONTROLS: (0, controlsGenerator_js_1.freezeDefinitions)((0, controlsGenerator_js_1.generateButtonsGrid)(5, 3, { width: 72, height: 72 })), KEY_SPACING_HORIZONTAL: 25, KEY_SPACING_VERTICAL: 25, @@ -2858,7 +2859,7 @@ const controlsGenerator_js_1 = __webpack_require__(3794); const origV2Properties = { MODEL: id_js_1.DeviceModelId.ORIGINALV2, PRODUCT_NAME: id_js_1.MODEL_NAMES[id_js_1.DeviceModelId.ORIGINALV2], - // SUPPORTS_RGB_KEY_FILL: false, // TODO - verify SUPPORTS_RGB_KEY_FILL + SUPPORTS_RGB_KEY_FILL: false, // TODO - verify SUPPORTS_RGB_KEY_FILL CONTROLS: (0, controlsGenerator_js_1.freezeDefinitions)((0, controlsGenerator_js_1.generateButtonsGrid)(5, 3, { width: 72, height: 72 })), KEY_SPACING_HORIZONTAL: 25, KEY_SPACING_VERTICAL: 25, @@ -3001,6 +3002,7 @@ plusControls.push({ const plusProperties = { MODEL: id_js_1.DeviceModelId.PLUS, PRODUCT_NAME: id_js_1.MODEL_NAMES[id_js_1.DeviceModelId.PLUS], + SUPPORTS_RGB_KEY_FILL: true, CONTROLS: (0, controlsGenerator_js_1.freezeDefinitions)(plusControls), KEY_SPACING_HORIZONTAL: 99, KEY_SPACING_VERTICAL: 40, @@ -3053,6 +3055,7 @@ const studioControls = [ exports.studioProperties = { MODEL: id_js_1.DeviceModelId.STUDIO, PRODUCT_NAME: id_js_1.MODEL_NAMES[id_js_1.DeviceModelId.STUDIO], + SUPPORTS_RGB_KEY_FILL: true, CONTROLS: (0, controlsGenerator_js_1.freezeDefinitions)(studioControls), KEY_SPACING_HORIZONTAL: 0, // TODO KEY_SPACING_VERTICAL: 0, // TODO @@ -3081,6 +3084,7 @@ const controlsGenerator_js_1 = __webpack_require__(3794); const xlProperties = { MODEL: id_js_1.DeviceModelId.XL, PRODUCT_NAME: id_js_1.MODEL_NAMES[id_js_1.DeviceModelId.XL], + SUPPORTS_RGB_KEY_FILL: false, // rev2 doesn't support it, even though rev1 does CONTROLS: (0, controlsGenerator_js_1.freezeDefinitions)((0, controlsGenerator_js_1.generateButtonsGrid)(8, 4, { width: 96, height: 96 })), KEY_SPACING_HORIZONTAL: 32, KEY_SPACING_VERTICAL: 39, @@ -5033,7 +5037,7 @@ const chase_1 = __webpack_require__(1889); if (true) { const elm = document.querySelector('#version_str'); if (elm) { - elm.innerHTML = `v${"7.0.0"}`; + elm.innerHTML = `v${"7.0.1"}`; } } function appendLog(str) { diff --git a/main.map b/main.map index 4c95155..63ed4e6 100644 --- a/main.map +++ b/main.map @@ -1 +1 @@ -{"version":3,"file":"app.js","mappings":";;;;;;;AAAa;;AAEb;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,UAAU;AACrB,WAAW,GAAG;AACd,WAAW,SAAS;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,cAAc;AACzB,WAAW,iBAAiB;AAC5B,WAAW,UAAU;AACrB,WAAW,GAAG;AACd,WAAW,SAAS;AACpB,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,cAAc;AACzB,WAAW,iBAAiB;AAC5B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,iBAAiB;AAC5B,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,0DAA0D,OAAO;AACjE;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,iBAAiB;AAC5B,aAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,iBAAiB;AAC5B,aAAa,SAAS;AACtB;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,0CAA0C,SAAS;AACnD;AACA;;AAEA;AACA,IAAI;AACJ;AACA;;AAEA,gBAAgB,YAAY;AAC5B;;AAEA;AACA,4DAA4D;AAC5D,gEAAgE;AAChE,oEAAoE;AACpE,wEAAwE;AACxE;AACA,2DAA2D,SAAS;AACpE;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,iBAAiB;AAC5B,WAAW,UAAU;AACrB,WAAW,GAAG;AACd,aAAa,cAAc;AAC3B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,iBAAiB;AAC5B,WAAW,UAAU;AACrB,WAAW,GAAG;AACd,aAAa,cAAc;AAC3B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,iBAAiB;AAC5B,WAAW,UAAU;AACrB,WAAW,GAAG;AACd,WAAW,SAAS;AACpB,aAAa,cAAc;AAC3B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ,4DAA4D,YAAY;AACxE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,iBAAiB;AAC5B,aAAa,cAAc;AAC3B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAI,IAA6B;AACjC;AACA;;;;;;;;;;;;;;;;;;;;;;;AC/UO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,8CAA8C;AACzD;AACA;AACA,mBAAmB,SAAS,EAAE,QAAQ;AACtC;AACA,CAAC;AACM;AACP;AACA;AACA,KAAK;AACL;AACO;AACP;AACA,0CAA0C,OAAO;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,8CAA8C;AACrD;AACA;AACA,aAAa;AACb;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,0CAA0C;AACjD;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,SAAS;AACjC;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACO;AACP;AACA;AACA;AACA,4CAA4C,gBAAgB,KAAK;AACjE;AACO;AACP;AACA;AACA;AACA,iCAAiC,MAAM;AACvC,kCAAkC,OAAO;AACzC,uCAAuC,OAAO,EAAE,OAAO;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjLuC;AACvC;AACA;AACA,cAAc,eAAe,YAAY,4BAA4B,EAAE;AACvE;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA,kBAAkB,KAAK,IAAI,MAAM,EAAE,+BAA+B;AAClE,KAAK;AACL;AACA;AACA;AACA,yBAAyB,UAAU,GAAG,OAAO;AAC7C;AACA;AACA;AACA,sCAAsC,UAAU,EAAE,SAAS;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,IAAI;AAC1B;AACA,kCAAkC,sBAAsB,EAAE,UAAU;AACpE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;;AC1CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;;ACvBA;AACA;AACA;AACO;AACP;AACA;AACO;AACP,mBAAmB,UAAU,SAAS,QAAQ;AAC9C;AACO;AACP;AACA;AACA,qCAAqC,QAAQ;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC,4BAA4B;AAC9D;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B,YAAY,GAAG,IAAI;AAChD;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uFAAuF,aAAa;AACpG;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,+CAA+C,YAAY;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3EsD;AACa;AAC7B;AACQ;AAC9C;AACA;AACA;AACA;AACA;AACA,WAAW,WAAW;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,WAAW;AAC1B;AACA;AACA,wBAAwB,WAAW;AACnC,0BAA0B,iBAAiB;AAC3C,WAAW,WAAW;AACtB;AACA;AACA;AACA;AACA;AACA,mEAAmE;AACnE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,mBAAmB;AAC3B;AACA;AACA,QAAQ,mBAAmB;AAC3B;AACA;AACA,QAAQ,mBAAmB;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B;AACA,aAAa,mBAAmB;AAChC;AACA,mBAAmB,OAAO;AAC1B;AACA;AACA,mBAAmB,OAAO;AAC1B;AACA;AACA,QAAQ,mBAAmB;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,OAAO;AACf;AACA;AACA;AACA,2BAA2B,YAAY;AACvC;AACA,gBAAgB,mBAAmB;AACnC;AACA;AACA;AACA;AACA;AACA,gCAAgC,6BAA6B;AAC7D;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,QAAQ,mBAAmB;AAC3B;AACA;AACA,QAAQ,mBAAmB;AAC3B;AACA;AACA;AACA;AACA,QAAQ,mBAAmB;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,mBAAmB;AAC3B;AACA,QAAQ,mBAAmB;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,iBAAiB;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,kBAAkB;AAC1C;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnLoC;AACE;AACgC;AACtE;AACA;AACA,mEAAmE;AACnE;AACA;AACA,2CAA2C;AAC3C,uCAAuC,QAAQ;AAC/C;AACO;AACP;AACA;AACA;AACA;AACA,KAAK;AACL,iCAAiC,SAAS;AAC1C;AACO,eAAe,qBAAK;AAC3B;AACA,sCAAsC,UAAU;AAChD,4BAA4B,WAAW;AACvC;AACA;AACA;AACA,sBAAsB,WAAW;AACjC;AACA;AACA,4BAA4B,iBAAiB;AAC7C;AACA,0DAA0D,QAAQ;AAClE;AACA;AACA;AACA;AACA;AACA;AACA,0CAA0C,qBAAqB;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC,KAAK;AACxC;AACA;AACA,SAAS;AACT;AACO;AACP;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA,iEAAiE,qBAAK;AACtE;AACA;;ACjEmD;AACG;AACG;AACnB;AACtC;AACA;AACA;AACA;AACA,gCAAgC,cAAc;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,mBAAmB;AAC9C,6BAA6B,SAAS;AACtC,UAAU,mBAAmB;AAC7B,aAAa,SAAS;AACtB;AACA;AACA;AACA,0BAA0B,iBAAiB,MAAM,WAAW;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,qBAAqB,OAAO;AAC5B;AACA;AACA;AACO;AACP,QAAQ,mBAAmB;AAC3B;AACA;AACA;AACA;AACA;AACA;;AC9DO;AACP,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,yBAAyB,cAAc;AACvC;AACA;AACA,0BAA0B,eAAe;AACzC;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;ACnBiC;AACU;AACqB;AAChE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,cAAc,mCAAmC,QAAQ;AACxE,kDAAkD,OAAO;AACzD;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mEAAmE,YAAY,OAAO;AACtF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6DAA6D;AAC7D;AACA;AACA,aAAa,aAAa,MAAM,gBAAgB,aAAa;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC;AACjC;AACA,yBAAyB;AACzB;AACA;AACA,yBAAyB;AACzB;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,oBAAoB,OAAO;AAC3B;AACA,qBAAqB;AACrB;AACA;AACA,wEAAwE,WAAW;AACnF;AACA;AACA,SAAS;AACT;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,0BAA0B,WAAW;AACrC;AACA;AACA;AACA;AACA;AACA,wBAAwB,OAAO;AAC/B;AACA;AACA;AACO;AACP;AACA;AACA;AACA,eAAe,cAAc;AAC7B,KAAK;AACL;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpLyC;AACI;AACF;AACqB;AACuD;AAChH,uCAAuC;AAC9C,YAAY,gBAAgB,EAAE,YAAY;AAC1C,8BAA8B,SAAS;AACvC,UAAU,aAAa;AACvB,UAAU,WAAW;AACrB,IAAI,UAAU;AACd,0BAA0B,aAAa;AACvC;AACA;AACO,0CAA0C;AACjD,YAAY,gBAAgB,EAAE,YAAY;AAC1C;AACA,sBAAsB,WAAW;AACjC;AACA;AACA,wCAAwC,aAAa;AACrD;AACA;AACA;AACA;AACA;AACA,QAAQ,qBAAqB;AAC7B;AACA,4BAA4B,YAAY;AACxC,6BAA6B,aAAa;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACO,6CAA6C;AACpD,YAAY,gBAAgB,EAAE,YAAY;AAC1C;AACA;AACA;AACA;AACO,uCAAuC;AAC9C;AACA;AACA;AACO,wCAAwC;AAC/C;AACA;AACA;AACO,wCAAwC;AAC/C;AACA,uBAAuB,YAAY;AACnC;AACA;AACO,iDAAiD;AACxD,WAAW,aAAa;AACxB;AACA;;;;;;;AC3Da;AACb;AACA,mCAAmC;;AAEnC;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;;;;;;;;ACda;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,qBAAqB,mBAAO,CAAC,IAAe;AAC5C,oBAAoB,mBAAO,CAAC,IAAW;AACvC,yBAAyB,mBAAO,CAAC,IAAkB;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC,oJAAoJ;AACtL;AACA,gGAAgG,yHAAyH,MAAM,2BAA2B;AAC1P;AACA;AACA,2FAA2F,sHAAsH,MAAM,wBAAwB;AAC/O;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gGAAgG,eAAe,MAAM,sBAAsB;AAC3I;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA,mGAAmG;AACnG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAe;;;;;;;;ACtRF;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAe;;;;;;;;ACpBF;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,sBAAsB,mBAAO,CAAC,GAAe;AAC7C;AACA;AACA;AACA;AACA;AACA,kCAAkC,aAAa;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAe;;;;;;;;AC/BF;;AAEb;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,UAAU;AACrB,WAAW,GAAG;AACd,WAAW,SAAS;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,cAAc;AACzB,WAAW,iBAAiB;AAC5B,WAAW,UAAU;AACrB,WAAW,GAAG;AACd,WAAW,SAAS;AACpB,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,cAAc;AACzB,WAAW,iBAAiB;AAC5B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,iBAAiB;AAC5B,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,0DAA0D,OAAO;AACjE;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,iBAAiB;AAC5B,aAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,iBAAiB;AAC5B,aAAa,SAAS;AACtB;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,0CAA0C,SAAS;AACnD;AACA;;AAEA;AACA,IAAI;AACJ;AACA;;AAEA,gBAAgB,YAAY;AAC5B;;AAEA;AACA,4DAA4D;AAC5D,gEAAgE;AAChE,oEAAoE;AACpE,wEAAwE;AACxE;AACA,2DAA2D,SAAS;AACpE;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,iBAAiB;AAC5B,WAAW,UAAU;AACrB,WAAW,GAAG;AACd,aAAa,cAAc;AAC3B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,iBAAiB;AAC5B,WAAW,UAAU;AACrB,WAAW,GAAG;AACd,aAAa,cAAc;AAC3B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,iBAAiB;AAC5B,WAAW,UAAU;AACrB,WAAW,GAAG;AACd,WAAW,SAAS;AACpB,aAAa,cAAc;AAC3B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ,4DAA4D,YAAY;AACxE;AACA;AACA;AACA;AACA;A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BAAO,CAAC,IAAkB;AAC5C,gBAAgB,mBAAO,CAAC,IAAgB;AACxC,wBAAwB,mBAAO,CAAC,GAAwB;AACxD,0BAA0B,mBAAO,CAAC,IAA0B;AAC5D,kBAAkB,mBAAO,CAAC,IAAkB;AAC5C,mBAAmB,mBAAO,CAAC,IAAmB;AAC9C,iBAAiB,mBAAO,CAAC,IAAiB;AAC1C,oBAAoB,mBAAO,CAAC,IAAoB;AAChD,qBAAqB,mBAAO,CAAC,IAAY;AACzC,qBAAqB,mBAAO,CAAC,IAAS;AACtC,qBAAqB,mBAAO,CAAC,IAAwB;AACrD,iBAAiB,mBAAO,CAAC,IAAY;AACrC,mDAAkD,EAAE,qCAAqC,sCAAsC,EAAC;AAChI,gBAAgB,mBAAO,CAAC,IAAW;AACnC,wDAAuD,EAAE,qCAAqC,0CAA0C,EAAC;AACzI;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA,CAAC,sBAAsB,uBAAuB,uBAAuB;AACrE;AACA,sBAAsB;AACtB;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;;;;;;;AC9Fa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,sBAAsB;AACtB,wBAAwB,mBAAO,CAAC,IAAe;AAC/C,mBAAmB,mBAAO,CAAC,IAAa;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB;AACtB;;;;;;;ACjJa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,6BAA6B;AAC7B,kBAAkB,mBAAO,CAAC,IAAW;AACrC,kBAAkB,mBAAO,CAAC,GAAgC;AAC1D,qBAAqB,mBAAO,CAAC,IAA0C;AACvE,oBAAoB,mBAAO,CAAC,IAAmC;AAC/D,2BAA2B,mBAAO,CAAC,GAA8B;AACjE,kBAAkB,mBAAO,CAAC,IAA2B;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;;;;;;AC9Ba;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,gCAAgC;AAChC,yBAAyB,mBAAO,CAAC,IAAwC;AACzE,6BAA6B,mBAAO,CAAC,IAA4C;AACjF,qBAAqB,mBAAO,CAAC,IAA0C;AACvE,2BAA2B,mBAAO,CAAC,GAA8B;AACjE,kBAAkB,mBAAO,CAAC,IAAgC;AAC1D,kB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A;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;;;;;;AC5Da;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,6BAA6B;AAC7B,kBAAkB,mBAAO,CAAC,IAAW;AACrC,0BAA0B,mBAAO,CAAC,GAAmB;AACrD,gBAAgB,mBAAO,CAAC,IAAU;AAClC,+BAA+B,mBAAO,CAAC,IAAyB;AAChE,kBAAkB,mBAAO,CAAC,IAAuC;AACjE,6EAA6E,yBAAyB;AACtG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;ACtEa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,wBAAwB;AACxB,+BAA+B;AAC/B,kBAAkB,mBAAO,CAAC,IAAW;AACrC,0BAA0B,mBAAO,CAAC,GAAmB;AACrD,gBAAgB,mBAAO,CAAC,IAAU;AAClC,+BAA+B,mBAAO,CAAC,IAAyB;AAChE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,gEAAgE,yBAAyB;AACzF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,wBAAwB;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;AC3Ca;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,2BAA2B;AAC3B,kBAAkB,mBAAO,CAAC,IAAW;AACrC,0BAA0B,mBAAO,CAAC,GAAmB;AACrD,gBAAgB,mBAAO,CAAC,IAAU;AAClC,+BAA+B,mBAAO,CAAC,IAAyB;AAChE;AACA;AACA;AACA,oHAAoH,uBAAuB;AAC3I;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;ACrBa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,uBAAuB;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB;AACvB;;;;;;;ACzIa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,gCAAgC;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC,wDAAwD;AAC9F;AACA;AACA;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,gBAAgB;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4CAA4C,eAAe;AAC3D;AACA;AACA,oEAAoE,UAAU,eAAe,mBAAmB;AAChH;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oEAAoE,kBAAkB,eAAe,mBAAmB;AACxH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4CAA4C,qBAAqB;AACjE;AACA,oEAAoE,kCAAkC;AACtG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0EAA0E,IAAI;AAC9E;AACA;AACA;AACA;AACA,gCAAgC;AAChC;;;;;;;AC7Na;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,uBAAuB;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB;AACvB;;;;;;;ACzBa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;;;;;;;AClBa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qDAAqD,QAAQ;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qDAAqD,QAAQ;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,0BAA0B;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qDAAqD,QAAQ;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;;;;;;;ACvEa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,kCAAkC;AAClC,kBAAkB,mBAAO,CAAC,IAAe;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC;AAClC;;;;;;;AClBa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,gCAAgC;AAChC,kBAAkB,mBAAO,CAAC,IAAe;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8FAA8F,6DAA6D;AAC3J;AACA;AACA;AACA,gCAAgC;AAChC;;;;;;;ACjBa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,4CAA4C,GAAG,6CAA6C,GAAG,0CAA0C,GAAG,0CAA0C;AACtL,kBAAkB,mBAAO,CAAC,IAAe;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0CAA0C;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0CAA0C;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6CAA6C;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4CAA4C;AAC5C;;;;;;;AClEa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,oCAAoC,GAAG,qCAAqC;AAC5E,6BAA6B,mBAAO,CAAC,IAAsB;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,oBAAoB;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC;AACpC;;;;;;;AC7Ca;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,8BAA8B;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B;AAC9B;;;;;;;ACjCa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,wBAAwB;AACxB,kBAAkB,mBAAO,CAAC,IAAW;AACrC,kBAAkB,mBAAO,CAAC,IAAe;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB;AACxB;;;;;;;ACpGa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,+BAA+B;AAC/B,6BAA6B,mBAAO,CAAC,IAAmC;AACxE,yBAAyB,mBAAO,CAAC,IAA+B;AAChE,kBAAkB,mBAAO,CAAC,IAAe;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yDAAyD,MAAM;AAC/D;AACA;AACA,oEAAoE,UAAU,eAAe,mBAAmB;AAChH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yDAAyD,MAAM;AAC/D;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+FAA+F,6CAA6C;AAC5I;AACA;AACA;AACA,+BAA+B;AAC/B;;;;;;;AC3Da;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,gCAAgC;AAChC,6BAA6B,mBAAO,CAAC,IAAmC;AACxE,yBAAyB,mBAAO,CAAC,IAA+B;AAChE,kBAAkB,mBAAO,CAAC,IAAe;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yDAAyD,MAAM;AAC/D;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,yDAAyD,MAAM;AAC/D;AACA;AACA;AACA;AACA;AACA,yDAAyD,MAAM;AAC/D;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oEAAoE,UAAU,eAAe,mBAAmB;AAChH;AACA;AACA;AACA,uEAAuE,wBAAwB;AAC/F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+FAA+F,mBAAmB;AAClH;AACA;AACA;AACA,gCAAgC;AAChC;;;;;;;AC/Ea;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,6BAA6B;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;;;;;;;ACtDa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,6BAA6B;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;;;;;;;AC7Ca;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,8BAA8B;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B;AAC9B;;;;;;;ACzBa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D;;;;;;;ACFa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,yBAAyB;AACzB,4BAA4B;AAC5B,sBAAsB;AACtB,4BAA4B;AAC5B;AACA;AACA;AACA;AACA;AACA,oBAAoB,iBAAiB;AACrC;AACA,wBAAwB,gBAAgB;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA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;AACb;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8DAA8D;AAC9D;AACA;AACA;AACA,uDAAuD;AACvD;AACA;AACA;AACA;;;;;;;ACnEa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,kBAAkB;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;;;;;;ACnCa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,qBAAqB;AACrB,eAAe,mBAAO,CAAC,IAA0B;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4CAA4C,eAAe;AAC3D;AACA,gEAAgE,gBAAgB;AAChF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wDAAwD,gBAAgB;AACxE;AACA;AACA,qBAAqB;AACrB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC7CA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,SAAS,gBAAgB,sCAAsC,kBAAkB;AACjF,wBAAwB;AACxB;AACA;;AAEO;AACP;AACA;AACA;AACA,kBAAkB;AAClB;AACA;;AAEO;AACP;AACA,+CAA+C,OAAO;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO;AACP;AACA;AACA;AACA;AACA,2DAA2D,cAAc;AACzE;AACA;AACA;AACA;AACA;;AAEO;AACP;AACA;AACA,2CAA2C,QAAQ;A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AK,IAAI,EAAE;QAC/B,IAAI,MAAM,EAAE,CAAC;YACZ,SAAS,CAAC,gBAAgB,CAAC;YAC3B,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;YAC7C,MAAM,MAAM,CAAC,KAAK,EAAE;YACpB,MAAM,GAAG,IAAI;QACd,CAAC;QACD,sBAAsB;QACtB,IAAI,CAAC;YACJ,MAAM,OAAO,GAAG,MAAM,+BAAkB,GAAE;YAC1C,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC;YACnB,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBAC1B,SAAS,CAAC,wBAAwB,CAAC;gBACnC,OAAM;YACP,CAAC;QACF,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,SAAS,CAAC,6BAA6B,KAAe,EAAE,CAAC;YACzD,OAAM;QACP,CAAC;QAED,UAAU,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;IACxC,CAAC;IACD,aAAa,CAAC,gBAAgB,CAAC,OAAO,EAAE,GAAG,EAAE;QAC5C,YAAY,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAC9C,CAAC,CAAC;IAEF,SAAS,CAAC,aAAa,CAAC;AACzB,CAAC","sources":["webpack:///../../../node_modules/eventemitter3/index.js","webpack:///../../../node_modules/html-to-image/es/util.js","webpack:///../../../node_modules/html-to-image/es/clone-pseudos.js","webpack:///../../../node_modules/html-to-image/es/mimes.js","webpack:///../../../node_modules/html-to-image/es/dataurl.js","webpack:///../../../node_modules/html-to-image/es/clone-node.js","webpack:///../../../node_modules/html-to-image/es/embed-resources.js","webpack:///../../../node_modules/html-to-image/es/embed-images.js","webpack:///../../../node_modules/html-to-image/es/apply-style.js","webpack:///../../../node_modules/html-to-image/es/embed-webfonts.js","webpack:///../../../node_modules/html-to-image/es/index.js","webpack:///../../../node_modules/p-finally/index.js","webpack:///../../../node_modules/p-queue/dist/index.js","webpack:///../../../node_modules/p-queue/dist/lower-bound.js","webpack:///../../../node_modules/p-queue/dist/priority-queue.js","webpack:///../../../node_modules/p-queue/node_modules/eventemitter3/index.js","webpack:///../../../node_modules/p-timeout/index.js","webpack:///./demo/chase.ts","webpack:///./demo/dom.ts","webpack:///./demo/fill-when-pressed.ts","webpack:///./demo/rapid-fill.ts","webpack:///../../core/dist/controlDefinition.js","webpack:///../../core/dist/controlsGenerator.js","webpack:///../../core/dist/id.js","webpack:///../../core/dist/index.js","webpack:///../../core/dist/models/base.js","webpack:///../../core/dist/models/generic-gen1.js","webpack:///../../core/dist/models/generic-gen2.js","webpack:///../../core/dist/models/mini.js","webpack:///../../core/dist/models/neo.js","webpack:///../../core/dist/models/original-mk2.js","webpack:///../../core/dist/models/original.js","webpack:///../../core/dist/models/originalv2.js","webpack:///../../core/dist/models/pedal.js","webpack:///../../core/dist/models/plus.js","webpack:///../../core/dist/models/studio.js","webpack:///../../core/dist/models/xl.js","webpack:///../../core/dist/proxy.js","webpack:///../../core/dist/services/buttonsLcdDisplay/default.js","webpack:///../../core/dist/services/buttonsLcdDisplay/pedal.js","webpack:///../../core/dist/services/callback-hook.js","webpack:///../../core/dist/services/encoderLed.js","webpack:///../../core/dist/services/imagePacker/bitmap.js","webpack:///../../core/dist/services/imagePacker/jpeg.js","webpack:///../../core/dist/services/imageWriter/headerGenerator.js","webpack:///../../core/dist/services/imageWriter/imageWriter.js","webpack:///../../core/dist/services/input/gen1.js","webpack:///../../core/dist/services/input/gen2.js","webpack:///../../core/dist/services/lcdSegmentDisplay/neo.js","webpack:///../../core/dist/services/lcdSegmentDisplay/plus.js","webpack:///../../core/dist/services/properties/gen1.js","webpack:///../../core/dist/services/properties/gen2.js","webpack:///../../core/dist/services/properties/pedal.js","webpack:///../../core/dist/types.js","webpack:///../../core/dist/util.js","webpack:///../../webhid/dist/hid-device.js","webpack:///../../webhid/dist/index.js","webpack:///../../webhid/dist/jpeg.js","webpack:///../../webhid/dist/wrapper.js","webpack:///../../../node_modules/tslib/tslib.es6.mjs","webpack:///webpack/bootstrap","webpack:///webpack/runtime/define property getters","webpack:///webpack/runtime/hasOwnProperty shorthand","webpack:///webpack/runtime/make namespace object","webpack:///./app.ts"],"sourcesContent":["'use strict';\n\nvar has = Object.prototype.hasOwnProperty\n , prefix = '~';\n\n/**\n * Constructor to create a storage for our `EE` objects.\n * An `Events` instance is a plain object whose properties are event names.\n *\n * @constructor\n * @private\n */\nfunction Events() {}\n\n//\n// We try to not inherit from `Object.prototype`. In some engines creating an\n// instance in this way is faster than calling `Object.create(null)` directly.\n// If `Object.create(null)` is not supported we prefix the event names with a\n// character to make sure that the built-in object properties are not\n// overridden or used as an attack vector.\n//\nif (Object.create) {\n Events.prototype = Object.create(null);\n\n //\n // This hack is needed because the `__proto__` property is still inherited in\n // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.\n //\n if (!new Events().__proto__) prefix = false;\n}\n\n/**\n * Representation of a single event listener.\n *\n * @param {Function} fn The listener function.\n * @param {*} context The context to invoke the listener with.\n * @param {Boolean} [once=false] Specify if the listener is a one-time listener.\n * @constructor\n * @private\n */\nfunction EE(fn, context, once) {\n this.fn = fn;\n this.context = context;\n this.once = once || false;\n}\n\n/**\n * Add a listener for a given event.\n *\n * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} context The context to invoke the listener with.\n * @param {Boolean} once Specify if the listener is a one-time listener.\n * @returns {EventEmitter}\n * @private\n */\nfunction addListener(emitter, event, fn, context, once) {\n if (typeof fn !== 'function') {\n throw new TypeError('The listener must be a function');\n }\n\n var listener = new EE(fn, context || emitter, once)\n , evt = prefix ? prefix + event : event;\n\n if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++;\n else if (!emitter._events[evt].fn) emitter._events[evt].push(listener);\n else emitter._events[evt] = [emitter._events[evt], listener];\n\n return emitter;\n}\n\n/**\n * Clear event by name.\n *\n * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.\n * @param {(String|Symbol)} evt The Event name.\n * @private\n */\nfunction clearEvent(emitter, evt) {\n if (--emitter._eventsCount === 0) emitter._events = new Events();\n else delete emitter._events[evt];\n}\n\n/**\n * Minimal `EventEmitter` interface that is molded against the Node.js\n * `EventEmitter` interface.\n *\n * @constructor\n * @public\n */\nfunction EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}\n\n/**\n * Return an array listing the events for which the emitter has registered\n * listeners.\n *\n * @returns {Array}\n * @public\n */\nEventEmitter.prototype.eventNames = function eventNames() {\n var names = []\n , events\n , name;\n\n if (this._eventsCount === 0) return names;\n\n for (name in (events = this._events)) {\n if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);\n }\n\n if (Object.getOwnPropertySymbols) {\n return names.concat(Object.getOwnPropertySymbols(events));\n }\n\n return names;\n};\n\n/**\n * Return the listeners registered for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Array} The registered listeners.\n * @public\n */\nEventEmitter.prototype.listeners = function listeners(event) {\n var evt = prefix ? prefix + event : event\n , handlers = this._events[evt];\n\n if (!handlers) return [];\n if (handlers.fn) return [handlers.fn];\n\n for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) {\n ee[i] = handlers[i].fn;\n }\n\n return ee;\n};\n\n/**\n * Return the number of listeners listening to a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Number} The number of listeners.\n * @public\n */\nEventEmitter.prototype.listenerCount = function listenerCount(event) {\n var evt = prefix ? prefix + event : event\n , listeners = this._events[evt];\n\n if (!listeners) return 0;\n if (listeners.fn) return 1;\n return listeners.length;\n};\n\n/**\n * Calls each of the listeners registered for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Boolean} `true` if the event had listeners, else `false`.\n * @public\n */\nEventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {\n var evt = prefix ? prefix + event : event;\n\n if (!this._events[evt]) return false;\n\n var listeners = this._events[evt]\n , len = arguments.length\n , args\n , i;\n\n if (listeners.fn) {\n if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);\n\n switch (len) {\n case 1: return listeners.fn.call(listeners.context), true;\n case 2: return listeners.fn.call(listeners.context, a1), true;\n case 3: return listeners.fn.call(listeners.context, a1, a2), true;\n case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;\n case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;\n case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;\n }\n\n for (i = 1, args = new Array(len -1); i < len; i++) {\n args[i - 1] = arguments[i];\n }\n\n listeners.fn.apply(listeners.context, args);\n } else {\n var length = listeners.length\n , j;\n\n for (i = 0; i < length; i++) {\n if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);\n\n switch (len) {\n case 1: listeners[i].fn.call(listeners[i].context); break;\n case 2: listeners[i].fn.call(listeners[i].context, a1); break;\n case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;\n case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break;\n default:\n if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {\n args[j - 1] = arguments[j];\n }\n\n listeners[i].fn.apply(listeners[i].context, args);\n }\n }\n }\n\n return true;\n};\n\n/**\n * Add a listener for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} [context=this] The context to invoke the listener with.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.on = function on(event, fn, context) {\n return addListener(this, event, fn, context, false);\n};\n\n/**\n * Add a one-time listener for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} [context=this] The context to invoke the listener with.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.once = function once(event, fn, context) {\n return addListener(this, event, fn, context, true);\n};\n\n/**\n * Remove the listeners of a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn Only remove the listeners that match this function.\n * @param {*} context Only remove the listeners that have this context.\n * @param {Boolean} once Only remove one-time listeners.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {\n var evt = prefix ? prefix + event : event;\n\n if (!this._events[evt]) return this;\n if (!fn) {\n clearEvent(this, evt);\n return this;\n }\n\n var listeners = this._events[evt];\n\n if (listeners.fn) {\n if (\n listeners.fn === fn &&\n (!once || listeners.once) &&\n (!context || listeners.context === context)\n ) {\n clearEvent(this, evt);\n }\n } else {\n for (var i = 0, events = [], length = listeners.length; i < length; i++) {\n if (\n listeners[i].fn !== fn ||\n (once && !listeners[i].once) ||\n (context && listeners[i].context !== context)\n ) {\n events.push(listeners[i]);\n }\n }\n\n //\n // Reset the array, or remove it completely if we have no more listeners.\n //\n if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;\n else clearEvent(this, evt);\n }\n\n return this;\n};\n\n/**\n * Remove all listeners, or those of the specified event.\n *\n * @param {(String|Symbol)} [event] The event name.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {\n var evt;\n\n if (event) {\n evt = prefix ? prefix + event : event;\n if (this._events[evt]) clearEvent(this, evt);\n } else {\n this._events = new Events();\n this._eventsCount = 0;\n }\n\n return this;\n};\n\n//\n// Alias methods names because people roll like that.\n//\nEventEmitter.prototype.off = EventEmitter.prototype.removeListener;\nEventEmitter.prototype.addListener = EventEmitter.prototype.on;\n\n//\n// Expose the prefix.\n//\nEventEmitter.prefixed = prefix;\n\n//\n// Allow `EventEmitter` to be imported as module namespace.\n//\nEventEmitter.EventEmitter = EventEmitter;\n\n//\n// Expose the module.\n//\nif ('undefined' !== typeof module) {\n module.exports = EventEmitter;\n}\n","export function resolveUrl(url, baseUrl) {\n // url is absolute already\n if (url.match(/^[a-z]+:\\/\\//i)) {\n return url;\n }\n // url is absolute already, without protocol\n if (url.match(/^\\/\\//)) {\n return window.location.protocol + url;\n }\n // dataURI, mailto:, tel:, etc.\n if (url.match(/^[a-z]+:/i)) {\n return url;\n }\n const doc = document.implementation.createHTMLDocument();\n const base = doc.createElement('base');\n const a = doc.createElement('a');\n doc.head.appendChild(base);\n doc.body.appendChild(a);\n if (baseUrl) {\n base.href = baseUrl;\n }\n a.href = url;\n return a.href;\n}\nexport const uuid = (() => {\n // generate uuid for className of pseudo elements.\n // We should not use GUIDs, otherwise pseudo elements sometimes cannot be captured.\n let counter = 0;\n // ref: http://stackoverflow.com/a/6248722/2519373\n const random = () => \n // eslint-disable-next-line no-bitwise\n `0000${((Math.random() * 36 ** 4) << 0).toString(36)}`.slice(-4);\n return () => {\n counter += 1;\n return `u${random()}${counter}`;\n };\n})();\nexport function delay(ms) {\n return (args) => new Promise((resolve) => {\n setTimeout(() => resolve(args), ms);\n });\n}\nexport function toArray(arrayLike) {\n const arr = [];\n for (let i = 0, l = arrayLike.length; i < l; i++) {\n arr.push(arrayLike[i]);\n }\n return arr;\n}\nfunction px(node, styleProperty) {\n const win = node.ownerDocument.defaultView || window;\n const val = win.getComputedStyle(node).getPropertyValue(styleProperty);\n return val ? parseFloat(val.replace('px', '')) : 0;\n}\nfunction getNodeWidth(node) {\n const leftBorder = px(node, 'border-left-width');\n const rightBorder = px(node, 'border-right-width');\n return node.clientWidth + leftBorder + rightBorder;\n}\nfunction getNodeHeight(node) {\n const topBorder = px(node, 'border-top-width');\n const bottomBorder = px(node, 'border-bottom-width');\n return node.clientHeight + topBorder + bottomBorder;\n}\nexport function getImageSize(targetNode, options = {}) {\n const width = options.width || getNodeWidth(targetNode);\n const height = options.height || getNodeHeight(targetNode);\n return { width, height };\n}\nexport function getPixelRatio() {\n let ratio;\n let FINAL_PROCESS;\n try {\n FINAL_PROCESS = process;\n }\n catch (e) {\n // pass\n }\n const val = FINAL_PROCESS && FINAL_PROCESS.env\n ? FINAL_PROCESS.env.devicePixelRatio\n : null;\n if (val) {\n ratio = parseInt(val, 10);\n if (Number.isNaN(ratio)) {\n ratio = 1;\n }\n }\n return ratio || window.devicePixelRatio || 1;\n}\n// @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/canvas#maximum_canvas_size\nconst canvasDimensionLimit = 16384;\nexport function checkCanvasDimensions(canvas) {\n if (canvas.width > canvasDimensionLimit ||\n canvas.height > canvasDimensionLimit) {\n if (canvas.width > canvasDimensionLimit &&\n canvas.height > canvasDimensionLimit) {\n if (canvas.width > canvas.height) {\n canvas.height *= canvasDimensionLimit / canvas.width;\n canvas.width = canvasDimensionLimit;\n }\n else {\n canvas.width *= canvasDimensionLimit / canvas.height;\n canvas.height = canvasDimensionLimit;\n }\n }\n else if (canvas.width > canvasDimensionLimit) {\n canvas.height *= canvasDimensionLimit / canvas.width;\n canvas.width = canvasDimensionLimit;\n }\n else {\n canvas.width *= canvasDimensionLimit / canvas.height;\n canvas.height = canvasDimensionLimit;\n }\n }\n}\nexport function canvasToBlob(canvas, options = {}) {\n if (canvas.toBlob) {\n return new Promise((resolve) => {\n canvas.toBlob(resolve, options.type ? options.type : 'image/png', options.quality ? options.quality : 1);\n });\n }\n return new Promise((resolve) => {\n const binaryString = window.atob(canvas\n .toDataURL(options.type ? options.type : undefined, options.quality ? options.quality : undefined)\n .split(',')[1]);\n const len = binaryString.length;\n const binaryArray = new Uint8Array(len);\n for (let i = 0; i < len; i += 1) {\n binaryArray[i] = binaryString.charCodeAt(i);\n }\n resolve(new Blob([binaryArray], {\n type: options.type ? options.type : 'image/png',\n }));\n });\n}\nexport function createImage(url) {\n return new Promise((resolve, reject) => {\n const img = new Image();\n img.decode = () => resolve(img);\n img.onload = () => resolve(img);\n img.onerror = reject;\n img.crossOrigin = 'anonymous';\n img.decoding = 'async';\n img.src = url;\n });\n}\nexport async function svgToDataURL(svg) {\n return Promise.resolve()\n .then(() => new XMLSerializer().serializeToString(svg))\n .then(encodeURIComponent)\n .then((html) => `data:image/svg+xml;charset=utf-8,${html}`);\n}\nexport async function nodeToDataURL(node, width, height) {\n const xmlns = 'http://www.w3.org/2000/svg';\n const svg = document.createElementNS(xmlns, 'svg');\n const foreignObject = document.createElementNS(xmlns, 'foreignObject');\n svg.setAttribute('width', `${width}`);\n svg.setAttribute('height', `${height}`);\n svg.setAttribute('viewBox', `0 0 ${width} ${height}`);\n foreignObject.setAttribute('width', '100%');\n foreignObject.setAttribute('height', '100%');\n foreignObject.setAttribute('x', '0');\n foreignObject.setAttribute('y', '0');\n foreignObject.setAttribute('externalResourcesRequired', 'true');\n svg.appendChild(foreignObject);\n foreignObject.appendChild(node);\n return svgToDataURL(svg);\n}\nexport const isInstanceOfElement = (node, instance) => {\n if (node instanceof instance)\n return true;\n const nodePrototype = Object.getPrototypeOf(node);\n if (nodePrototype === null)\n return false;\n return (nodePrototype.constructor.name === instance.name ||\n isInstanceOfElement(nodePrototype, instance));\n};\n//# sourceMappingURL=util.js.map","import { uuid, toArray } from './util';\nfunction formatCSSText(style) {\n const content = style.getPropertyValue('content');\n return `${style.cssText} content: '${content.replace(/'|\"/g, '')}';`;\n}\nfunction formatCSSProperties(style) {\n return toArray(style)\n .map((name) => {\n const value = style.getPropertyValue(name);\n const priority = style.getPropertyPriority(name);\n return `${name}: ${value}${priority ? ' !important' : ''};`;\n })\n .join(' ');\n}\nfunction getPseudoElementStyle(className, pseudo, style) {\n const selector = `.${className}:${pseudo}`;\n const cssText = style.cssText\n ? formatCSSText(style)\n : formatCSSProperties(style);\n return document.createTextNode(`${selector}{${cssText}}`);\n}\nfunction clonePseudoElement(nativeNode, clonedNode, pseudo) {\n const style = window.getComputedStyle(nativeNode, pseudo);\n const content = style.getPropertyValue('content');\n if (content === '' || content === 'none') {\n return;\n }\n const className = uuid();\n try {\n clonedNode.className = `${clonedNode.className} ${className}`;\n }\n catch (err) {\n return;\n }\n const styleElement = document.createElement('style');\n styleElement.appendChild(getPseudoElementStyle(className, pseudo, style));\n clonedNode.appendChild(styleElement);\n}\nexport function clonePseudoElements(nativeNode, clonedNode) {\n clonePseudoElement(nativeNode, clonedNode, ':before');\n clonePseudoElement(nativeNode, clonedNode, ':after');\n}\n//# sourceMappingURL=clone-pseudos.js.map","const WOFF = 'application/font-woff';\nconst JPEG = 'image/jpeg';\nconst mimes = {\n woff: WOFF,\n woff2: WOFF,\n ttf: 'application/font-truetype',\n eot: 'application/vnd.ms-fontobject',\n png: 'image/png',\n jpg: JPEG,\n jpeg: JPEG,\n gif: 'image/gif',\n tiff: 'image/tiff',\n svg: 'image/svg+xml',\n webp: 'image/webp',\n};\nfunction getExtension(url) {\n const match = /\\.([^./]*?)$/g.exec(url);\n return match ? match[1] : '';\n}\nexport function getMimeType(url) {\n const extension = getExtension(url).toLowerCase();\n return mimes[extension] || '';\n}\n//# sourceMappingURL=mimes.js.map","function getContentFromDataUrl(dataURL) {\n return dataURL.split(/,/)[1];\n}\nexport function isDataUrl(url) {\n return url.search(/^(data:)/) !== -1;\n}\nexport function makeDataUrl(content, mimeType) {\n return `data:${mimeType};base64,${content}`;\n}\nexport async function fetchAsDataURL(url, init, process) {\n const res = await fetch(url, init);\n if (res.status === 404) {\n throw new Error(`Resource \"${res.url}\" not found`);\n }\n const blob = await res.blob();\n return new Promise((resolve, reject) => {\n const reader = new FileReader();\n reader.onerror = reject;\n reader.onloadend = () => {\n try {\n resolve(process({ res, result: reader.result }));\n }\n catch (error) {\n reject(error);\n }\n };\n reader.readAsDataURL(blob);\n });\n}\nconst cache = {};\nfunction getCacheKey(url, contentType, includeQueryParams) {\n let key = url.replace(/\\?.*/, '');\n if (includeQueryParams) {\n key = url;\n }\n // font resource\n if (/ttf|otf|eot|woff2?/i.test(key)) {\n key = key.replace(/.*\\//, '');\n }\n return contentType ? `[${contentType}]${key}` : key;\n}\nexport async function resourceToDataURL(resourceUrl, contentType, options) {\n const cacheKey = getCacheKey(resourceUrl, contentType, options.includeQueryParams);\n if (cache[cacheKey] != null) {\n return cache[cacheKey];\n }\n // ref: https://developer.mozilla.org/en/docs/Web/API/XMLHttpRequest/Using_XMLHttpRequest#Bypassing_the_cache\n if (options.cacheBust) {\n // eslint-disable-next-line no-param-reassign\n resourceUrl += (/\\?/.test(resourceUrl) ? '&' : '?') + new Date().getTime();\n }\n let dataURL;\n try {\n const content = await fetchAsDataURL(resourceUrl, options.fetchRequestInit, ({ res, result }) => {\n if (!contentType) {\n // eslint-disable-next-line no-param-reassign\n contentType = res.headers.get('Content-Type') || '';\n }\n return getContentFromDataUrl(result);\n });\n dataURL = makeDataUrl(content, contentType);\n }\n catch (error) {\n dataURL = options.imagePlaceholder || '';\n let msg = `Failed to fetch resource: ${resourceUrl}`;\n if (error) {\n msg = typeof error === 'string' ? error : error.message;\n }\n if (msg) {\n console.warn(msg);\n }\n }\n cache[cacheKey] = dataURL;\n return dataURL;\n}\n//# sourceMappingURL=dataurl.js.map","import { clonePseudoElements } from './clone-pseudos';\nimport { createImage, toArray, isInstanceOfElement } from './util';\nimport { getMimeType } from './mimes';\nimport { resourceToDataURL } from './dataurl';\nasync function cloneCanvasElement(canvas) {\n const dataURL = canvas.toDataURL();\n if (dataURL === 'data:,') {\n return canvas.cloneNode(false);\n }\n return createImage(dataURL);\n}\nasync function cloneVideoElement(video, options) {\n if (video.currentSrc) {\n const canvas = document.createElement('canvas');\n const ctx = canvas.getContext('2d');\n canvas.width = video.clientWidth;\n canvas.height = video.clientHeight;\n ctx === null || ctx === void 0 ? void 0 : ctx.drawImage(video, 0, 0, canvas.width, canvas.height);\n const dataURL = canvas.toDataURL();\n return createImage(dataURL);\n }\n const poster = video.poster;\n const contentType = getMimeType(poster);\n const dataURL = await resourceToDataURL(poster, contentType, options);\n return createImage(dataURL);\n}\nasync function cloneIFrameElement(iframe) {\n var _a;\n try {\n if ((_a = iframe === null || iframe === void 0 ? void 0 : iframe.contentDocument) === null || _a === void 0 ? void 0 : _a.body) {\n return (await cloneNode(iframe.contentDocument.body, {}, true));\n }\n }\n catch (_b) {\n // Failed to clone iframe\n }\n return iframe.cloneNode(false);\n}\nasync function cloneSingleNode(node, options) {\n if (isInstanceOfElement(node, HTMLCanvasElement)) {\n return cloneCanvasElement(node);\n }\n if (isInstanceOfElement(node, HTMLVideoElement)) {\n return cloneVideoElement(node, options);\n }\n if (isInstanceOfElement(node, HTMLIFrameElement)) {\n return cloneIFrameElement(node);\n }\n return node.cloneNode(false);\n}\nconst isSlotElement = (node) => node.tagName != null && node.tagName.toUpperCase() === 'SLOT';\nasync function cloneChildren(nativeNode, clonedNode, options) {\n var _a, _b;\n let children = [];\n if (isSlotElement(nativeNode) && nativeNode.assignedNodes) {\n children = toArray(nativeNode.assignedNodes());\n }\n else if (isInstanceOfElement(nativeNode, HTMLIFrameElement) &&\n ((_a = nativeNode.contentDocument) === null || _a === void 0 ? void 0 : _a.body)) {\n children = toArray(nativeNode.contentDocument.body.childNodes);\n }\n else {\n children = toArray(((_b = nativeNode.shadowRoot) !== null && _b !== void 0 ? _b : nativeNode).childNodes);\n }\n if (children.length === 0 ||\n isInstanceOfElement(nativeNode, HTMLVideoElement)) {\n return clonedNode;\n }\n await children.reduce((deferred, child) => deferred\n .then(() => cloneNode(child, options))\n .then((clonedChild) => {\n if (clonedChild) {\n clonedNode.appendChild(clonedChild);\n }\n }), Promise.resolve());\n return clonedNode;\n}\nfunction cloneCSSStyle(nativeNode, clonedNode) {\n const targetStyle = clonedNode.style;\n if (!targetStyle) {\n return;\n }\n const sourceStyle = window.getComputedStyle(nativeNode);\n if (sourceStyle.cssText) {\n targetStyle.cssText = sourceStyle.cssText;\n targetStyle.transformOrigin = sourceStyle.transformOrigin;\n }\n else {\n toArray(sourceStyle).forEach((name) => {\n let value = sourceStyle.getPropertyValue(name);\n if (name === 'font-size' && value.endsWith('px')) {\n const reducedFont = Math.floor(parseFloat(value.substring(0, value.length - 2))) - 0.1;\n value = `${reducedFont}px`;\n }\n if (isInstanceOfElement(nativeNode, HTMLIFrameElement) &&\n name === 'display' &&\n value === 'inline') {\n value = 'block';\n }\n if (name === 'd' && clonedNode.getAttribute('d')) {\n value = `path(${clonedNode.getAttribute('d')})`;\n }\n targetStyle.setProperty(name, value, sourceStyle.getPropertyPriority(name));\n });\n }\n}\nfunction cloneInputValue(nativeNode, clonedNode) {\n if (isInstanceOfElement(nativeNode, HTMLTextAreaElement)) {\n clonedNode.innerHTML = nativeNode.value;\n }\n if (isInstanceOfElement(nativeNode, HTMLInputElement)) {\n clonedNode.setAttribute('value', nativeNode.value);\n }\n}\nfunction cloneSelectValue(nativeNode, clonedNode) {\n if (isInstanceOfElement(nativeNode, HTMLSelectElement)) {\n const clonedSelect = clonedNode;\n const selectedOption = Array.from(clonedSelect.children).find((child) => nativeNode.value === child.getAttribute('value'));\n if (selectedOption) {\n selectedOption.setAttribute('selected', '');\n }\n }\n}\nfunction decorate(nativeNode, clonedNode) {\n if (isInstanceOfElement(clonedNode, Element)) {\n cloneCSSStyle(nativeNode, clonedNode);\n clonePseudoElements(nativeNode, clonedNode);\n cloneInputValue(nativeNode, clonedNode);\n cloneSelectValue(nativeNode, clonedNode);\n }\n return clonedNode;\n}\nasync function ensureSVGSymbols(clone, options) {\n const uses = clone.querySelectorAll ? clone.querySelectorAll('use') : [];\n if (uses.length === 0) {\n return clone;\n }\n const processedDefs = {};\n for (let i = 0; i < uses.length; i++) {\n const use = uses[i];\n const id = use.getAttribute('xlink:href');\n if (id) {\n const exist = clone.querySelector(id);\n const definition = document.querySelector(id);\n if (!exist && definition && !processedDefs[id]) {\n // eslint-disable-next-line no-await-in-loop\n processedDefs[id] = (await cloneNode(definition, options, true));\n }\n }\n }\n const nodes = Object.values(processedDefs);\n if (nodes.length) {\n const ns = 'http://www.w3.org/1999/xhtml';\n const svg = document.createElementNS(ns, 'svg');\n svg.setAttribute('xmlns', ns);\n svg.style.position = 'absolute';\n svg.style.width = '0';\n svg.style.height = '0';\n svg.style.overflow = 'hidden';\n svg.style.display = 'none';\n const defs = document.createElementNS(ns, 'defs');\n svg.appendChild(defs);\n for (let i = 0; i < nodes.length; i++) {\n defs.appendChild(nodes[i]);\n }\n clone.appendChild(svg);\n }\n return clone;\n}\nexport async function cloneNode(node, options, isRoot) {\n if (!isRoot && options.filter && !options.filter(node)) {\n return null;\n }\n return Promise.resolve(node)\n .then((clonedNode) => cloneSingleNode(clonedNode, options))\n .then((clonedNode) => cloneChildren(node, clonedNode, options))\n .then((clonedNode) => decorate(node, clonedNode))\n .then((clonedNode) => ensureSVGSymbols(clonedNode, options));\n}\n//# sourceMappingURL=clone-node.js.map","import { resolveUrl } from './util';\nimport { getMimeType } from './mimes';\nimport { isDataUrl, makeDataUrl, resourceToDataURL } from './dataurl';\nconst URL_REGEX = /url\\((['\"]?)([^'\"]+?)\\1\\)/g;\nconst URL_WITH_FORMAT_REGEX = /url\\([^)]+\\)\\s*format\\(([\"']?)([^\"']+)\\1\\)/g;\nconst FONT_SRC_REGEX = /src:\\s*(?:url\\([^)]+\\)\\s*format\\([^)]+\\)[,;]\\s*)+/g;\nfunction toRegex(url) {\n // eslint-disable-next-line no-useless-escape\n const escaped = url.replace(/([.*+?^${}()|\\[\\]\\/\\\\])/g, '\\\\$1');\n return new RegExp(`(url\\\\(['\"]?)(${escaped})(['\"]?\\\\))`, 'g');\n}\nexport function parseURLs(cssText) {\n const urls = [];\n cssText.replace(URL_REGEX, (raw, quotation, url) => {\n urls.push(url);\n return raw;\n });\n return urls.filter((url) => !isDataUrl(url));\n}\nexport async function embed(cssText, resourceURL, baseURL, options, getContentFromUrl) {\n try {\n const resolvedURL = baseURL ? resolveUrl(resourceURL, baseURL) : resourceURL;\n const contentType = getMimeType(resourceURL);\n let dataURL;\n if (getContentFromUrl) {\n const content = await getContentFromUrl(resolvedURL);\n dataURL = makeDataUrl(content, contentType);\n }\n else {\n dataURL = await resourceToDataURL(resolvedURL, contentType, options);\n }\n return cssText.replace(toRegex(resourceURL), `$1${dataURL}$3`);\n }\n catch (error) {\n // pass\n }\n return cssText;\n}\nfunction filterPreferredFontFormat(str, { preferredFontFormat }) {\n return !preferredFontFormat\n ? str\n : str.replace(FONT_SRC_REGEX, (match) => {\n // eslint-disable-next-line no-constant-condition\n while (true) {\n const [src, , format] = URL_WITH_FORMAT_REGEX.exec(match) || [];\n if (!format) {\n return '';\n }\n if (format === preferredFontFormat) {\n return `src: ${src};`;\n }\n }\n });\n}\nexport function shouldEmbed(url) {\n return url.search(URL_REGEX) !== -1;\n}\nexport async function embedResources(cssText, baseUrl, options) {\n if (!shouldEmbed(cssText)) {\n return cssText;\n }\n const filteredCSSText = filterPreferredFontFormat(cssText, options);\n const urls = parseURLs(filteredCSSText);\n return urls.reduce((deferred, url) => deferred.then((css) => embed(css, url, baseUrl, options)), Promise.resolve(filteredCSSText));\n}\n//# sourceMappingURL=embed-resources.js.map","import { embedResources } from './embed-resources';\nimport { toArray, isInstanceOfElement } from './util';\nimport { isDataUrl, resourceToDataURL } from './dataurl';\nimport { getMimeType } from './mimes';\nasync function embedProp(propName, node, options) {\n var _a;\n const propValue = (_a = node.style) === null || _a === void 0 ? void 0 : _a.getPropertyValue(propName);\n if (propValue) {\n const cssString = await embedResources(propValue, null, options);\n node.style.setProperty(propName, cssString, node.style.getPropertyPriority(propName));\n return true;\n }\n return false;\n}\nasync function embedBackground(clonedNode, options) {\n if (!(await embedProp('background', clonedNode, options))) {\n await embedProp('background-image', clonedNode, options);\n }\n if (!(await embedProp('mask', clonedNode, options))) {\n await embedProp('mask-image', clonedNode, options);\n }\n}\nasync function embedImageNode(clonedNode, options) {\n const isImageElement = isInstanceOfElement(clonedNode, HTMLImageElement);\n if (!(isImageElement && !isDataUrl(clonedNode.src)) &&\n !(isInstanceOfElement(clonedNode, SVGImageElement) &&\n !isDataUrl(clonedNode.href.baseVal))) {\n return;\n }\n const url = isImageElement ? clonedNode.src : clonedNode.href.baseVal;\n const dataURL = await resourceToDataURL(url, getMimeType(url), options);\n await new Promise((resolve, reject) => {\n clonedNode.onload = resolve;\n clonedNode.onerror = reject;\n const image = clonedNode;\n if (image.decode) {\n image.decode = resolve;\n }\n if (image.loading === 'lazy') {\n image.loading = 'eager';\n }\n if (isImageElement) {\n clonedNode.srcset = '';\n clonedNode.src = dataURL;\n }\n else {\n clonedNode.href.baseVal = dataURL;\n }\n });\n}\nasync function embedChildren(clonedNode, options) {\n const children = toArray(clonedNode.childNodes);\n const deferreds = children.map((child) => embedImages(child, options));\n await Promise.all(deferreds).then(() => clonedNode);\n}\nexport async function embedImages(clonedNode, options) {\n if (isInstanceOfElement(clonedNode, Element)) {\n await embedBackground(clonedNode, options);\n await embedImageNode(clonedNode, options);\n await embedChildren(clonedNode, options);\n }\n}\n//# sourceMappingURL=embed-images.js.map","export function applyStyle(node, options) {\n const { style } = node;\n if (options.backgroundColor) {\n style.backgroundColor = options.backgroundColor;\n }\n if (options.width) {\n style.width = `${options.width}px`;\n }\n if (options.height) {\n style.height = `${options.height}px`;\n }\n const manual = options.style;\n if (manual != null) {\n Object.keys(manual).forEach((key) => {\n style[key] = manual[key];\n });\n }\n return node;\n}\n//# sourceMappingURL=apply-style.js.map","import { toArray } from './util';\nimport { fetchAsDataURL } from './dataurl';\nimport { shouldEmbed, embedResources } from './embed-resources';\nconst cssFetchCache = {};\nasync function fetchCSS(url) {\n let cache = cssFetchCache[url];\n if (cache != null) {\n return cache;\n }\n const res = await fetch(url);\n const cssText = await res.text();\n cache = { url, cssText };\n cssFetchCache[url] = cache;\n return cache;\n}\nasync function embedFonts(data, options) {\n let cssText = data.cssText;\n const regexUrl = /url\\([\"']?([^\"')]+)[\"']?\\)/g;\n const fontLocs = cssText.match(/url\\([^)]+\\)/g) || [];\n const loadFonts = fontLocs.map(async (loc) => {\n let url = loc.replace(regexUrl, '$1');\n if (!url.startsWith('https://')) {\n url = new URL(url, data.url).href;\n }\n return fetchAsDataURL(url, options.fetchRequestInit, ({ result }) => {\n cssText = cssText.replace(loc, `url(${result})`);\n return [loc, result];\n });\n });\n return Promise.all(loadFonts).then(() => cssText);\n}\nfunction parseCSS(source) {\n if (source == null) {\n return [];\n }\n const result = [];\n const commentsRegex = /(\\/\\*[\\s\\S]*?\\*\\/)/gi;\n // strip out comments\n let cssText = source.replace(commentsRegex, '');\n // eslint-disable-next-line prefer-regex-literals\n const keyframesRegex = new RegExp('((@.*?keyframes [\\\\s\\\\S]*?){([\\\\s\\\\S]*?}\\\\s*?)})', 'gi');\n // eslint-disable-next-line no-constant-condition\n while (true) {\n const matches = keyframesRegex.exec(cssText);\n if (matches === null) {\n break;\n }\n result.push(matches[0]);\n }\n cssText = cssText.replace(keyframesRegex, '');\n const importRegex = /@import[\\s\\S]*?url\\([^)]*\\)[\\s\\S]*?;/gi;\n // to match css & media queries together\n const combinedCSSRegex = '((\\\\s*?(?:\\\\/\\\\*[\\\\s\\\\S]*?\\\\*\\\\/)?\\\\s*?@media[\\\\s\\\\S]' +\n '*?){([\\\\s\\\\S]*?)}\\\\s*?})|(([\\\\s\\\\S]*?){([\\\\s\\\\S]*?)})';\n // unified regex\n const unifiedRegex = new RegExp(combinedCSSRegex, 'gi');\n // eslint-disable-next-line no-constant-condition\n while (true) {\n let matches = importRegex.exec(cssText);\n if (matches === null) {\n matches = unifiedRegex.exec(cssText);\n if (matches === null) {\n break;\n }\n else {\n importRegex.lastIndex = unifiedRegex.lastIndex;\n }\n }\n else {\n unifiedRegex.lastIndex = importRegex.lastIndex;\n }\n result.push(matches[0]);\n }\n return result;\n}\nasync function getCSSRules(styleSheets, options) {\n const ret = [];\n const deferreds = [];\n // First loop inlines imports\n styleSheets.forEach((sheet) => {\n if ('cssRules' in sheet) {\n try {\n toArray(sheet.cssRules || []).forEach((item, index) => {\n if (item.type === CSSRule.IMPORT_RULE) {\n let importIndex = index + 1;\n const url = item.href;\n const deferred = fetchCSS(url)\n .then((metadata) => embedFonts(metadata, options))\n .then((cssText) => parseCSS(cssText).forEach((rule) => {\n try {\n sheet.insertRule(rule, rule.startsWith('@import')\n ? (importIndex += 1)\n : sheet.cssRules.length);\n }\n catch (error) {\n console.error('Error inserting rule from remote css', {\n rule,\n error,\n });\n }\n }))\n .catch((e) => {\n console.error('Error loading remote css', e.toString());\n });\n deferreds.push(deferred);\n }\n });\n }\n catch (e) {\n const inline = styleSheets.find((a) => a.href == null) || document.styleSheets[0];\n if (sheet.href != null) {\n deferreds.push(fetchCSS(sheet.href)\n .then((metadata) => embedFonts(metadata, options))\n .then((cssText) => parseCSS(cssText).forEach((rule) => {\n inline.insertRule(rule, sheet.cssRules.length);\n }))\n .catch((err) => {\n console.error('Error loading remote stylesheet', err);\n }));\n }\n console.error('Error inlining remote css file', e);\n }\n }\n });\n return Promise.all(deferreds).then(() => {\n // Second loop parses rules\n styleSheets.forEach((sheet) => {\n if ('cssRules' in sheet) {\n try {\n toArray(sheet.cssRules || []).forEach((item) => {\n ret.push(item);\n });\n }\n catch (e) {\n console.error(`Error while reading CSS rules from ${sheet.href}`, e);\n }\n }\n });\n return ret;\n });\n}\nfunction getWebFontRules(cssRules) {\n return cssRules\n .filter((rule) => rule.type === CSSRule.FONT_FACE_RULE)\n .filter((rule) => shouldEmbed(rule.style.getPropertyValue('src')));\n}\nasync function parseWebFontRules(node, options) {\n if (node.ownerDocument == null) {\n throw new Error('Provided element is not within a Document');\n }\n const styleSheets = toArray(node.ownerDocument.styleSheets);\n const cssRules = await getCSSRules(styleSheets, options);\n return getWebFontRules(cssRules);\n}\nexport async function getWebFontCSS(node, options) {\n const rules = await parseWebFontRules(node, options);\n const cssTexts = await Promise.all(rules.map((rule) => {\n const baseUrl = rule.parentStyleSheet ? rule.parentStyleSheet.href : null;\n return embedResources(rule.cssText, baseUrl, options);\n }));\n return cssTexts.join('\\n');\n}\nexport async function embedWebFonts(clonedNode, options) {\n const cssText = options.fontEmbedCSS != null\n ? options.fontEmbedCSS\n : options.skipFonts\n ? null\n : await getWebFontCSS(clonedNode, options);\n if (cssText) {\n const styleNode = document.createElement('style');\n const sytleContent = document.createTextNode(cssText);\n styleNode.appendChild(sytleContent);\n if (clonedNode.firstChild) {\n clonedNode.insertBefore(styleNode, clonedNode.firstChild);\n }\n else {\n clonedNode.appendChild(styleNode);\n }\n }\n}\n//# sourceMappingURL=embed-webfonts.js.map","import { cloneNode } from './clone-node';\nimport { embedImages } from './embed-images';\nimport { applyStyle } from './apply-style';\nimport { embedWebFonts, getWebFontCSS } from './embed-webfonts';\nimport { getImageSize, getPixelRatio, createImage, canvasToBlob, nodeToDataURL, checkCanvasDimensions, } from './util';\nexport async function toSvg(node, options = {}) {\n const { width, height } = getImageSize(node, options);\n const clonedNode = (await cloneNode(node, options, true));\n await embedWebFonts(clonedNode, options);\n await embedImages(clonedNode, options);\n applyStyle(clonedNode, options);\n const datauri = await nodeToDataURL(clonedNode, width, height);\n return datauri;\n}\nexport async function toCanvas(node, options = {}) {\n const { width, height } = getImageSize(node, options);\n const svg = await toSvg(node, options);\n const img = await createImage(svg);\n const canvas = document.createElement('canvas');\n const context = canvas.getContext('2d');\n const ratio = options.pixelRatio || getPixelRatio();\n const canvasWidth = options.canvasWidth || width;\n const canvasHeight = options.canvasHeight || height;\n canvas.width = canvasWidth * ratio;\n canvas.height = canvasHeight * ratio;\n if (!options.skipAutoScale) {\n checkCanvasDimensions(canvas);\n }\n canvas.style.width = `${canvasWidth}`;\n canvas.style.height = `${canvasHeight}`;\n if (options.backgroundColor) {\n context.fillStyle = options.backgroundColor;\n context.fillRect(0, 0, canvas.width, canvas.height);\n }\n context.drawImage(img, 0, 0, canvas.width, canvas.height);\n return canvas;\n}\nexport async function toPixelData(node, options = {}) {\n const { width, height } = getImageSize(node, options);\n const canvas = await toCanvas(node, options);\n const ctx = canvas.getContext('2d');\n return ctx.getImageData(0, 0, width, height).data;\n}\nexport async function toPng(node, options = {}) {\n const canvas = await toCanvas(node, options);\n return canvas.toDataURL();\n}\nexport async function toJpeg(node, options = {}) {\n const canvas = await toCanvas(node, options);\n return canvas.toDataURL('image/jpeg', options.quality || 1);\n}\nexport async function toBlob(node, options = {}) {\n const canvas = await toCanvas(node, options);\n const blob = await canvasToBlob(canvas);\n return blob;\n}\nexport async function getFontEmbedCSS(node, options = {}) {\n return getWebFontCSS(node, options);\n}\n//# sourceMappingURL=index.js.map","'use strict';\nmodule.exports = (promise, onFinally) => {\n\tonFinally = onFinally || (() => {});\n\n\treturn promise.then(\n\t\tval => new Promise(resolve => {\n\t\t\tresolve(onFinally());\n\t\t}).then(() => val),\n\t\terr => new Promise(resolve => {\n\t\t\tresolve(onFinally());\n\t\t}).then(() => {\n\t\t\tthrow err;\n\t\t})\n\t);\n};\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst EventEmitter = require(\"eventemitter3\");\nconst p_timeout_1 = require(\"p-timeout\");\nconst priority_queue_1 = require(\"./priority-queue\");\n// eslint-disable-next-line @typescript-eslint/no-empty-function\nconst empty = () => { };\nconst timeoutError = new p_timeout_1.TimeoutError();\n/**\nPromise queue with concurrency control.\n*/\nclass PQueue extends EventEmitter {\n constructor(options) {\n var _a, _b, _c, _d;\n super();\n this._intervalCount = 0;\n this._intervalEnd = 0;\n this._pendingCount = 0;\n this._resolveEmpty = empty;\n this._resolveIdle = empty;\n // eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n options = Object.assign({ carryoverConcurrencyCount: false, intervalCap: Infinity, interval: 0, concurrency: Infinity, autoStart: true, queueClass: priority_queue_1.default }, options);\n if (!(typeof options.intervalCap === 'number' && options.intervalCap >= 1)) {\n throw new TypeError(`Expected \\`intervalCap\\` to be a number from 1 and up, got \\`${(_b = (_a = options.intervalCap) === null || _a === void 0 ? void 0 : _a.toString()) !== null && _b !== void 0 ? _b : ''}\\` (${typeof options.intervalCap})`);\n }\n if (options.interval === undefined || !(Number.isFinite(options.interval) && options.interval >= 0)) {\n throw new TypeError(`Expected \\`interval\\` to be a finite number >= 0, got \\`${(_d = (_c = options.interval) === null || _c === void 0 ? void 0 : _c.toString()) !== null && _d !== void 0 ? _d : ''}\\` (${typeof options.interval})`);\n }\n this._carryoverConcurrencyCount = options.carryoverConcurrencyCount;\n this._isIntervalIgnored = options.intervalCap === Infinity || options.interval === 0;\n this._intervalCap = options.intervalCap;\n this._interval = options.interval;\n this._queue = new options.queueClass();\n this._queueClass = options.queueClass;\n this.concurrency = options.concurrency;\n this._timeout = options.timeout;\n this._throwOnTimeout = options.throwOnTimeout === true;\n this._isPaused = options.autoStart === false;\n }\n get _doesIntervalAllowAnother() {\n return this._isIntervalIgnored || this._intervalCount < this._intervalCap;\n }\n get _doesConcurrentAllowAnother() {\n return this._pendingCount < this._concurrency;\n }\n _next() {\n this._pendingCount--;\n this._tryToStartAnother();\n this.emit('next');\n }\n _resolvePromises() {\n this._resolveEmpty();\n this._resolveEmpty = empty;\n if (this._pendingCount === 0) {\n this._resolveIdle();\n this._resolveIdle = empty;\n this.emit('idle');\n }\n }\n _onResumeInterval() {\n this._onInterval();\n this._initializeIntervalIfNeeded();\n this._timeoutId = undefined;\n }\n _isIntervalPaused() {\n const now = Date.now();\n if (this._intervalId === undefined) {\n const delay = this._intervalEnd - now;\n if (delay < 0) {\n // Act as the interval was done\n // We don't need to resume it here because it will be resumed on line 160\n this._intervalCount = (this._carryoverConcurrencyCount) ? this._pendingCount : 0;\n }\n else {\n // Act as the interval is pending\n if (this._timeoutId === undefined) {\n this._timeoutId = setTimeout(() => {\n this._onResumeInterval();\n }, delay);\n }\n return true;\n }\n }\n return false;\n }\n _tryToStartAnother() {\n if (this._queue.size === 0) {\n // We can clear the interval (\"pause\")\n // Because we can redo it later (\"resume\")\n if (this._intervalId) {\n clearInterval(this._intervalId);\n }\n this._intervalId = undefined;\n this._resolvePromises();\n return false;\n }\n if (!this._isPaused) {\n const canInitializeInterval = !this._isIntervalPaused();\n if (this._doesIntervalAllowAnother && this._doesConcurrentAllowAnother) {\n const job = this._queue.dequeue();\n if (!job) {\n return false;\n }\n this.emit('active');\n job();\n if (canInitializeInterval) {\n this._initializeIntervalIfNeeded();\n }\n return true;\n }\n }\n return false;\n }\n _initializeIntervalIfNeeded() {\n if (this._isIntervalIgnored || this._intervalId !== undefined) {\n return;\n }\n this._intervalId = setInterval(() => {\n this._onInterval();\n }, this._interval);\n this._intervalEnd = Date.now() + this._interval;\n }\n _onInterval() {\n if (this._intervalCount === 0 && this._pendingCount === 0 && this._intervalId) {\n clearInterval(this._intervalId);\n this._intervalId = undefined;\n }\n this._intervalCount = this._carryoverConcurrencyCount ? this._pendingCount : 0;\n this._processQueue();\n }\n /**\n Executes all queued functions until it reaches the limit.\n */\n _processQueue() {\n // eslint-disable-next-line no-empty\n while (this._tryToStartAnother()) { }\n }\n get concurrency() {\n return this._concurrency;\n }\n set concurrency(newConcurrency) {\n if (!(typeof newConcurrency === 'number' && newConcurrency >= 1)) {\n throw new TypeError(`Expected \\`concurrency\\` to be a number from 1 and up, got \\`${newConcurrency}\\` (${typeof newConcurrency})`);\n }\n this._concurrency = newConcurrency;\n this._processQueue();\n }\n /**\n Adds a sync or async task to the queue. Always returns a promise.\n */\n async add(fn, options = {}) {\n return new Promise((resolve, reject) => {\n const run = async () => {\n this._pendingCount++;\n this._intervalCount++;\n try {\n const operation = (this._timeout === undefined && options.timeout === undefined) ? fn() : p_timeout_1.default(Promise.resolve(fn()), (options.timeout === undefined ? this._timeout : options.timeout), () => {\n if (options.throwOnTimeout === undefined ? this._throwOnTimeout : options.throwOnTimeout) {\n reject(timeoutError);\n }\n return undefined;\n });\n resolve(await operation);\n }\n catch (error) {\n reject(error);\n }\n this._next();\n };\n this._queue.enqueue(run, options);\n this._tryToStartAnother();\n this.emit('add');\n });\n }\n /**\n Same as `.add()`, but accepts an array of sync or async functions.\n\n @returns A promise that resolves when all functions are resolved.\n */\n async addAll(functions, options) {\n return Promise.all(functions.map(async (function_) => this.add(function_, options)));\n }\n /**\n Start (or resume) executing enqueued tasks within concurrency limit. No need to call this if queue is not paused (via `options.autoStart = false` or by `.pause()` method.)\n */\n start() {\n if (!this._isPaused) {\n return this;\n }\n this._isPaused = false;\n this._processQueue();\n return this;\n }\n /**\n Put queue execution on hold.\n */\n pause() {\n this._isPaused = true;\n }\n /**\n Clear the queue.\n */\n clear() {\n this._queue = new this._queueClass();\n }\n /**\n Can be called multiple times. Useful if you for example add additional items at a later time.\n\n @returns A promise that settles when the queue becomes empty.\n */\n async onEmpty() {\n // Instantly resolve if the queue is empty\n if (this._queue.size === 0) {\n return;\n }\n return new Promise(resolve => {\n const existingResolve = this._resolveEmpty;\n this._resolveEmpty = () => {\n existingResolve();\n resolve();\n };\n });\n }\n /**\n The difference with `.onEmpty` is that `.onIdle` guarantees that all work from the queue has finished. `.onEmpty` merely signals that the queue is empty, but it could mean that some promises haven't completed yet.\n\n @returns A promise that settles when the queue becomes empty, and all promises have completed; `queue.size === 0 && queue.pending === 0`.\n */\n async onIdle() {\n // Instantly resolve if none pending and if nothing else is queued\n if (this._pendingCount === 0 && this._queue.size === 0) {\n return;\n }\n return new Promise(resolve => {\n const existingResolve = this._resolveIdle;\n this._resolveIdle = () => {\n existingResolve();\n resolve();\n };\n });\n }\n /**\n Size of the queue.\n */\n get size() {\n return this._queue.size;\n }\n /**\n Size of the queue, filtered by the given options.\n\n For example, this can be used to find the number of items remaining in the queue with a specific priority level.\n */\n sizeBy(options) {\n // eslint-disable-next-line unicorn/no-fn-reference-in-iterator\n return this._queue.filter(options).length;\n }\n /**\n Number of pending promises.\n */\n get pending() {\n return this._pendingCount;\n }\n /**\n Whether the queue is currently paused.\n */\n get isPaused() {\n return this._isPaused;\n }\n get timeout() {\n return this._timeout;\n }\n /**\n Set the timeout for future operations.\n */\n set timeout(milliseconds) {\n this._timeout = milliseconds;\n }\n}\nexports.default = PQueue;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\n// Port of lower_bound from https://en.cppreference.com/w/cpp/algorithm/lower_bound\n// Used to compute insertion index to keep queue sorted after insertion\nfunction lowerBound(array, value, comparator) {\n let first = 0;\n let count = array.length;\n while (count > 0) {\n const step = (count / 2) | 0;\n let it = first + step;\n if (comparator(array[it], value) <= 0) {\n first = ++it;\n count -= step + 1;\n }\n else {\n count = step;\n }\n }\n return first;\n}\nexports.default = lowerBound;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst lower_bound_1 = require(\"./lower-bound\");\nclass PriorityQueue {\n constructor() {\n this._queue = [];\n }\n enqueue(run, options) {\n options = Object.assign({ priority: 0 }, options);\n const element = {\n priority: options.priority,\n run\n };\n if (this.size && this._queue[this.size - 1].priority >= options.priority) {\n this._queue.push(element);\n return;\n }\n const index = lower_bound_1.default(this._queue, element, (a, b) => b.priority - a.priority);\n this._queue.splice(index, 0, element);\n }\n dequeue() {\n const item = this._queue.shift();\n return item === null || item === void 0 ? void 0 : item.run;\n }\n filter(options) {\n return this._queue.filter((element) => element.priority === options.priority).map((element) => element.run);\n }\n get size() {\n return this._queue.length;\n }\n}\nexports.default = PriorityQueue;\n","'use strict';\n\nvar has = Object.prototype.hasOwnProperty\n , prefix = '~';\n\n/**\n * Constructor to create a storage for our `EE` objects.\n * An `Events` instance is a plain object whose properties are event names.\n *\n * @constructor\n * @private\n */\nfunction Events() {}\n\n//\n// We try to not inherit from `Object.prototype`. In some engines creating an\n// instance in this way is faster than calling `Object.create(null)` directly.\n// If `Object.create(null)` is not supported we prefix the event names with a\n// character to make sure that the built-in object properties are not\n// overridden or used as an attack vector.\n//\nif (Object.create) {\n Events.prototype = Object.create(null);\n\n //\n // This hack is needed because the `__proto__` property is still inherited in\n // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.\n //\n if (!new Events().__proto__) prefix = false;\n}\n\n/**\n * Representation of a single event listener.\n *\n * @param {Function} fn The listener function.\n * @param {*} context The context to invoke the listener with.\n * @param {Boolean} [once=false] Specify if the listener is a one-time listener.\n * @constructor\n * @private\n */\nfunction EE(fn, context, once) {\n this.fn = fn;\n this.context = context;\n this.once = once || false;\n}\n\n/**\n * Add a listener for a given event.\n *\n * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} context The context to invoke the listener with.\n * @param {Boolean} once Specify if the listener is a one-time listener.\n * @returns {EventEmitter}\n * @private\n */\nfunction addListener(emitter, event, fn, context, once) {\n if (typeof fn !== 'function') {\n throw new TypeError('The listener must be a function');\n }\n\n var listener = new EE(fn, context || emitter, once)\n , evt = prefix ? prefix + event : event;\n\n if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++;\n else if (!emitter._events[evt].fn) emitter._events[evt].push(listener);\n else emitter._events[evt] = [emitter._events[evt], listener];\n\n return emitter;\n}\n\n/**\n * Clear event by name.\n *\n * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.\n * @param {(String|Symbol)} evt The Event name.\n * @private\n */\nfunction clearEvent(emitter, evt) {\n if (--emitter._eventsCount === 0) emitter._events = new Events();\n else delete emitter._events[evt];\n}\n\n/**\n * Minimal `EventEmitter` interface that is molded against the Node.js\n * `EventEmitter` interface.\n *\n * @constructor\n * @public\n */\nfunction EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}\n\n/**\n * Return an array listing the events for which the emitter has registered\n * listeners.\n *\n * @returns {Array}\n * @public\n */\nEventEmitter.prototype.eventNames = function eventNames() {\n var names = []\n , events\n , name;\n\n if (this._eventsCount === 0) return names;\n\n for (name in (events = this._events)) {\n if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);\n }\n\n if (Object.getOwnPropertySymbols) {\n return names.concat(Object.getOwnPropertySymbols(events));\n }\n\n return names;\n};\n\n/**\n * Return the listeners registered for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Array} The registered listeners.\n * @public\n */\nEventEmitter.prototype.listeners = function listeners(event) {\n var evt = prefix ? prefix + event : event\n , handlers = this._events[evt];\n\n if (!handlers) return [];\n if (handlers.fn) return [handlers.fn];\n\n for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) {\n ee[i] = handlers[i].fn;\n }\n\n return ee;\n};\n\n/**\n * Return the number of listeners listening to a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Number} The number of listeners.\n * @public\n */\nEventEmitter.prototype.listenerCount = function listenerCount(event) {\n var evt = prefix ? prefix + event : event\n , listeners = this._events[evt];\n\n if (!listeners) return 0;\n if (listeners.fn) return 1;\n return listeners.length;\n};\n\n/**\n * Calls each of the listeners registered for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Boolean} `true` if the event had listeners, else `false`.\n * @public\n */\nEventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {\n var evt = prefix ? prefix + event : event;\n\n if (!this._events[evt]) return false;\n\n var listeners = this._events[evt]\n , len = arguments.length\n , args\n , i;\n\n if (listeners.fn) {\n if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);\n\n switch (len) {\n case 1: return listeners.fn.call(listeners.context), true;\n case 2: return listeners.fn.call(listeners.context, a1), true;\n case 3: return listeners.fn.call(listeners.context, a1, a2), true;\n case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;\n case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;\n case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;\n }\n\n for (i = 1, args = new Array(len -1); i < len; i++) {\n args[i - 1] = arguments[i];\n }\n\n listeners.fn.apply(listeners.context, args);\n } else {\n var length = listeners.length\n , j;\n\n for (i = 0; i < length; i++) {\n if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);\n\n switch (len) {\n case 1: listeners[i].fn.call(listeners[i].context); break;\n case 2: listeners[i].fn.call(listeners[i].context, a1); break;\n case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;\n case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break;\n default:\n if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {\n args[j - 1] = arguments[j];\n }\n\n listeners[i].fn.apply(listeners[i].context, args);\n }\n }\n }\n\n return true;\n};\n\n/**\n * Add a listener for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} [context=this] The context to invoke the listener with.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.on = function on(event, fn, context) {\n return addListener(this, event, fn, context, false);\n};\n\n/**\n * Add a one-time listener for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} [context=this] The context to invoke the listener with.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.once = function once(event, fn, context) {\n return addListener(this, event, fn, context, true);\n};\n\n/**\n * Remove the listeners of a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn Only remove the listeners that match this function.\n * @param {*} context Only remove the listeners that have this context.\n * @param {Boolean} once Only remove one-time listeners.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {\n var evt = prefix ? prefix + event : event;\n\n if (!this._events[evt]) return this;\n if (!fn) {\n clearEvent(this, evt);\n return this;\n }\n\n var listeners = this._events[evt];\n\n if (listeners.fn) {\n if (\n listeners.fn === fn &&\n (!once || listeners.once) &&\n (!context || listeners.context === context)\n ) {\n clearEvent(this, evt);\n }\n } else {\n for (var i = 0, events = [], length = listeners.length; i < length; i++) {\n if (\n listeners[i].fn !== fn ||\n (once && !listeners[i].once) ||\n (context && listeners[i].context !== context)\n ) {\n events.push(listeners[i]);\n }\n }\n\n //\n // Reset the array, or remove it completely if we have no more listeners.\n //\n if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;\n else clearEvent(this, evt);\n }\n\n return this;\n};\n\n/**\n * Remove all listeners, or those of the specified event.\n *\n * @param {(String|Symbol)} [event] The event name.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {\n var evt;\n\n if (event) {\n evt = prefix ? prefix + event : event;\n if (this._events[evt]) clearEvent(this, evt);\n } else {\n this._events = new Events();\n this._eventsCount = 0;\n }\n\n return this;\n};\n\n//\n// Alias methods names because people roll like that.\n//\nEventEmitter.prototype.off = EventEmitter.prototype.removeListener;\nEventEmitter.prototype.addListener = EventEmitter.prototype.on;\n\n//\n// Expose the prefix.\n//\nEventEmitter.prefixed = prefix;\n\n//\n// Allow `EventEmitter` to be imported as module namespace.\n//\nEventEmitter.EventEmitter = EventEmitter;\n\n//\n// Expose the module.\n//\nif ('undefined' !== typeof module) {\n module.exports = EventEmitter;\n}\n","'use strict';\n\nconst pFinally = require('p-finally');\n\nclass TimeoutError extends Error {\n\tconstructor(message) {\n\t\tsuper(message);\n\t\tthis.name = 'TimeoutError';\n\t}\n}\n\nconst pTimeout = (promise, milliseconds, fallback) => new Promise((resolve, reject) => {\n\tif (typeof milliseconds !== 'number' || milliseconds < 0) {\n\t\tthrow new TypeError('Expected `milliseconds` to be a positive number');\n\t}\n\n\tif (milliseconds === Infinity) {\n\t\tresolve(promise);\n\t\treturn;\n\t}\n\n\tconst timer = setTimeout(() => {\n\t\tif (typeof fallback === 'function') {\n\t\t\ttry {\n\t\t\t\tresolve(fallback());\n\t\t\t} catch (error) {\n\t\t\t\treject(error);\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\t\tconst message = typeof fallback === 'string' ? fallback : `Promise timed out after ${milliseconds} milliseconds`;\n\t\tconst timeoutError = fallback instanceof Error ? fallback : new TimeoutError(message);\n\n\t\tif (typeof promise.cancel === 'function') {\n\t\t\tpromise.cancel();\n\t\t}\n\n\t\treject(timeoutError);\n\t}, milliseconds);\n\n\t// TODO: Use native `finally` keyword when targeting Node.js 10\n\tpFinally(\n\t\t// eslint-disable-next-line promise/prefer-await-to-then\n\t\tpromise.then(resolve, reject),\n\t\t() => {\n\t\t\tclearTimeout(timer);\n\t\t}\n\t);\n});\n\nmodule.exports = pTimeout;\n// TODO: Remove this for the next major release\nmodule.exports.default = pTimeout;\n\nmodule.exports.TimeoutError = TimeoutError;\n","import type { StreamDeck, StreamDeckButtonControlDefinitionLcdFeedback } from '@elgato-stream-deck/webhid'\nimport type { Demo } from './demo.js'\n\ninterface ControlAndCanvas {\n\tcontrol: StreamDeckButtonControlDefinitionLcdFeedback\n\tcanvas: HTMLCanvasElement\n}\n\nexport class ChaseDemo implements Demo {\n\tprivate pressed: number[] = []\n\tprivate counter = 0\n\tprivate interval: number | undefined\n\tprivate running: Promise | undefined\n\n\tprivate async drawButtons(device: StreamDeck, controls: ControlAndCanvas[], c: number): Promise {\n\t\tconst ps: Array> = []\n\n\t\tfor (const { control, canvas } of controls) {\n\t\t\t// We probably should reuse this instead of creating it each time.\n\t\t\tconst ctx = canvas.getContext('2d')\n\n\t\t\tif (ctx) {\n\t\t\t\tconst n = c + control.index\n\t\t\t\tctx.save()\n\t\t\t\tctx.clearRect(0, 0, canvas.width, canvas.height)\n\t\t\t\t// Start with a font that's 80% as high as the button. maxWidth\n\t\t\t\t// is used on the stroke and fill calls below to scale down.\n\t\t\t\tctx.font = `${canvas.height * 0.8}px \"Arial\"`\n\t\t\t\tctx.strokeStyle = 'blue'\n\t\t\t\tctx.lineWidth = 1\n\t\t\t\tctx.strokeText(n.toString(), 8, canvas.height * 0.9, canvas.width * 0.8)\n\t\t\t\tctx.fillStyle = 'white'\n\t\t\t\tctx.fillText(n.toString(), 8, canvas.height * 0.9, canvas.width * 0.8)\n\n\t\t\t\tconst id = ctx.getImageData(0, 0, canvas.width, canvas.height)\n\t\t\t\tps.push(device.fillKeyBuffer(control.index, id.data, { format: 'rgba' }))\n\t\t\t\tctx.restore()\n\t\t\t}\n\t\t}\n\n\t\tawait Promise.all(ps)\n\t}\n\n\tpublic async start(device: StreamDeck): Promise {\n\t\tawait device.clearPanel()\n\n\t\tthis.counter = 0\n\n\t\tconst controls = device.CONTROLS.filter(\n\t\t\t(control): control is StreamDeckButtonControlDefinitionLcdFeedback =>\n\t\t\t\tcontrol.type === 'button' && control.feedbackType === 'lcd',\n\t\t).sort((a, b) => b.index - a.index)\n\n\t\tconst controlsAndCanvases: ControlAndCanvas[] = controls.map((control) => {\n\t\t\tconst canvas = document.createElement('canvas')\n\t\t\tcanvas.width = control.pixelSize.width\n\t\t\tcanvas.height = control.pixelSize.height\n\n\t\t\treturn { control, canvas }\n\t\t})\n\n\t\tawait this.drawButtons(device, controlsAndCanvases, this.counter)\n\n\t\tif (!this.interval) {\n\t\t\tconst doThing = async () => {\n\t\t\t\tif (!this.running) {\n\t\t\t\t\tthis.running = this.drawButtons(device, controlsAndCanvases, ++this.counter)\n\t\t\t\t\tawait this.running\n\t\t\t\t\tthis.running = undefined\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.interval = window.setInterval(() => {\n\t\t\t\tdoThing().catch((e) => console.error(e))\n\t\t\t}, 1000 / 5)\n\t\t}\n\t}\n\tpublic async stop(device: StreamDeck): Promise {\n\t\tif (this.interval) {\n\t\t\twindow.clearInterval(this.interval)\n\t\t\tthis.interval = undefined\n\t\t}\n\t\tawait this.running\n\t\tawait device.clearPanel()\n\t}\n\tpublic async keyDown(device: StreamDeck, keyIndex: number): Promise {\n\t\tif (this.pressed.indexOf(keyIndex) === -1) {\n\t\t\tthis.pressed.push(keyIndex)\n\n\t\t\tawait device.fillKeyColor(keyIndex, 255, 0, 0)\n\t\t}\n\t}\n\tpublic async keyUp(device: StreamDeck, keyIndex: number): Promise {\n\t\tconst index = this.pressed.indexOf(keyIndex)\n\t\tif (index !== -1) {\n\t\t\tthis.pressed.splice(index, 1)\n\n\t\t\tawait device.clearKey(keyIndex)\n\t\t}\n\t}\n}\n","import type { StreamDeckWeb } from '@elgato-stream-deck/webhid'\nimport { toCanvas } from 'html-to-image'\nimport type { Demo } from './demo.js'\n\nfunction getRandomColor() {\n\tconst letters = '0123456789ABCDEF'\n\tlet color = '#'\n\tfor (let i = 0; i < 6; i++) {\n\t\tcolor += letters[Math.floor(Math.random() * 16)]\n\t}\n\treturn color\n}\n\n/**\n * This demo is using html-to-image to render a div to the streamdeck.\n * Performance is not great, and the conversion library has many issues with rendering in\n * various cases, but if the source material is very controlled it could be useful.\n * It would be better to render natively on a canvas.\n */\nexport class DomImageDemo implements Demo {\n\tprivate element: HTMLElement | undefined\n\tprivate run = false\n\tprivate running: Promise | undefined\n\n\tpublic async start(device: StreamDeckWeb): Promise {\n\t\tthis.element = document.querySelector('#image-source') || undefined\n\t\tif (this.element) {\n\t\t\tthis.element.style.display = 'block'\n\t\t}\n\n\t\tif (!this.run) {\n\t\t\tthis.run = true\n\n\t\t\tconst runTick = () => {\n\t\t\t\tif (this.element && this.run) {\n\t\t\t\t\tconst elm = this.element\n\n\t\t\t\t\ttoCanvas(elm)\n\t\t\t\t\t\t.then(async (canvas) => {\n\t\t\t\t\t\t\tthis.running = device.fillPanelCanvas(canvas)\n\t\t\t\t\t\t\tawait this.running\n\t\t\t\t\t\t\tthis.running = undefined\n\n\t\t\t\t\t\t\t// It would run smoother to set the next tick going before sending to the panel, but then it becomes a race that could go wrong\n\t\t\t\t\t\t\trunTick()\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.catch(console.error)\n\t\t\t\t}\n\t\t\t}\n\t\t\trunTick()\n\t\t}\n\t}\n\tpublic async stop(device: StreamDeckWeb): Promise {\n\t\tif (this.element) {\n\t\t\tthis.element.style.display = 'none'\n\t\t}\n\n\t\tthis.run = false\n\n\t\tawait this.running\n\t\tawait device.clearPanel()\n\t}\n\tpublic async keyDown(_device: StreamDeckWeb, _keyIndex: number): Promise {\n\t\tif (this.element) {\n\t\t\tthis.element.style.background = getRandomColor()\n\t\t}\n\t}\n\tpublic async keyUp(_device: StreamDeckWeb, _keyIndex: number): Promise {\n\t\t// Nothing to do\n\t}\n}\n","import type { StreamDeck } from '@elgato-stream-deck/webhid'\nimport type { Demo } from './demo.js'\n\nexport class FillWhenPressedDemo implements Demo {\n\tprivate pressed: number[] = []\n\n\tpublic async start(device: StreamDeck): Promise {\n\t\tawait device.clearPanel()\n\t}\n\tpublic async stop(device: StreamDeck): Promise {\n\t\tawait device.clearPanel()\n\t}\n\tpublic async keyDown(device: StreamDeck, keyIndex: number): Promise {\n\t\tif (this.pressed.indexOf(keyIndex) === -1) {\n\t\t\tthis.pressed.push(keyIndex)\n\n\t\t\tawait device.fillKeyColor(keyIndex, 255, 0, 0)\n\t\t}\n\t}\n\tpublic async keyUp(device: StreamDeck, keyIndex: number): Promise {\n\t\tconst index = this.pressed.indexOf(keyIndex)\n\t\tif (index !== -1) {\n\t\t\tthis.pressed.splice(index, 1)\n\n\t\t\tawait device.clearKey(keyIndex)\n\t\t}\n\t}\n}\n","import type { StreamDeck } from '@elgato-stream-deck/webhid'\nimport type { Demo } from './demo.js'\n\nfunction getRandomIntInclusive(min: number, max: number) {\n\tmin = Math.ceil(min)\n\tmax = Math.floor(max)\n\treturn Math.floor(Math.random() * (max - min + 1)) + min\n}\n\nexport class RapidFillDemo implements Demo {\n\tprivate interval: number | undefined\n\tprivate running: Promise | undefined\n\n\tpublic async start(device: StreamDeck): Promise {\n\t\tif (!this.interval) {\n\t\t\tconst doThing = async () => {\n\t\t\t\tif (!this.running) {\n\t\t\t\t\tconst r = getRandomIntInclusive(0, 255)\n\t\t\t\t\tconst g = getRandomIntInclusive(0, 255)\n\t\t\t\t\tconst b = getRandomIntInclusive(0, 255)\n\t\t\t\t\tconsole.log('Filling with rgb(%d, %d, %d)', r, g, b)\n\n\t\t\t\t\tconst ps: Array> = []\n\t\t\t\t\tfor (const control of device.CONTROLS) {\n\t\t\t\t\t\tif (control.type === 'button') {\n\t\t\t\t\t\t\tps.push(device.fillKeyColor(control.index, r, g, b))\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tthis.running = Promise.all(ps)\n\t\t\t\t\tawait this.running\n\t\t\t\t\tthis.running = undefined\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.interval = window.setInterval(() => {\n\t\t\t\tdoThing().catch((e) => console.log(e))\n\t\t\t}, 1000 / 5)\n\t\t}\n\t}\n\tpublic async stop(device: StreamDeck): Promise {\n\t\tif (this.interval) {\n\t\t\twindow.clearInterval(this.interval)\n\t\t\tthis.interval = undefined\n\t\t}\n\t\tawait this.running\n\t\tawait device.clearPanel()\n\t}\n\tpublic async keyDown(_device: StreamDeck, _keyIndex: number): Promise {\n\t\t// Nothing to do\n\t}\n\tpublic async keyUp(_device: StreamDeck, _keyIndex: number): Promise {\n\t\t// Nothing to do\n\t}\n}\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\n//# sourceMappingURL=controlDefinition.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.generateButtonsGrid = generateButtonsGrid;\nexports.freezeDefinitions = freezeDefinitions;\nfunction generateButtonsGrid(width, height, pixelSize, rtl = false, columnOffset = 0) {\n const controls = [];\n for (let row = 0; row < height; row++) {\n for (let column = 0; column < width; column++) {\n const index = row * width + column;\n const hidIndex = rtl ? flipKeyIndex(width, index) : index;\n controls.push({\n type: 'button',\n row,\n column: column + columnOffset,\n index,\n hidIndex,\n feedbackType: 'lcd',\n pixelSize,\n });\n }\n }\n return controls;\n}\nfunction flipKeyIndex(columns, keyIndex) {\n // Horizontal flip\n const half = (columns - 1) / 2;\n const diff = ((keyIndex % columns) - half) * -half;\n return keyIndex + diff;\n}\nfunction freezeDefinitions(controls) {\n return Object.freeze(controls.map((control) => Object.freeze(control)));\n}\n//# sourceMappingURL=controlsGenerator.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.MODEL_NAMES = exports.DeviceModelId = void 0;\nvar DeviceModelId;\n(function (DeviceModelId) {\n DeviceModelId[\"ORIGINAL\"] = \"original\";\n DeviceModelId[\"ORIGINALV2\"] = \"originalv2\";\n DeviceModelId[\"ORIGINALMK2\"] = \"original-mk2\";\n DeviceModelId[\"MINI\"] = \"mini\";\n DeviceModelId[\"XL\"] = \"xl\";\n DeviceModelId[\"PEDAL\"] = \"pedal\";\n DeviceModelId[\"PLUS\"] = \"plus\";\n DeviceModelId[\"NEO\"] = \"neo\";\n DeviceModelId[\"STUDIO\"] = \"studio\";\n})(DeviceModelId || (exports.DeviceModelId = DeviceModelId = {}));\nexports.MODEL_NAMES = {\n [DeviceModelId.ORIGINAL]: 'Stream Deck',\n [DeviceModelId.MINI]: 'Stream Deck Mini',\n [DeviceModelId.XL]: 'Stream Deck XL',\n [DeviceModelId.ORIGINALV2]: 'Stream Deck',\n [DeviceModelId.ORIGINALMK2]: 'Stream Deck MK.2',\n [DeviceModelId.PLUS]: 'Stream Deck +',\n [DeviceModelId.PEDAL]: 'Stream Deck Pedal',\n [DeviceModelId.NEO]: 'Stream Deck Neo',\n [DeviceModelId.STUDIO]: 'Stream Deck Studio',\n};\n//# sourceMappingURL=id.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.DEVICE_MODELS = exports.DEVICE_MODELS2 = exports.DeviceModelType = exports.VENDOR_ID = exports.uint8ArrayToDataView = exports.StreamDeckProxy = void 0;\nconst tslib_1 = require(\"tslib\");\nconst id_js_1 = require(\"./id.js\");\nconst original_js_1 = require(\"./models/original.js\");\nconst mini_js_1 = require(\"./models/mini.js\");\nconst xl_js_1 = require(\"./models/xl.js\");\nconst originalv2_js_1 = require(\"./models/originalv2.js\");\nconst original_mk2_js_1 = require(\"./models/original-mk2.js\");\nconst plus_js_1 = require(\"./models/plus.js\");\nconst pedal_js_1 = require(\"./models/pedal.js\");\nconst neo_js_1 = require(\"./models/neo.js\");\nconst studio_js_1 = require(\"./models/studio.js\");\ntslib_1.__exportStar(require(\"./types.js\"), exports);\ntslib_1.__exportStar(require(\"./id.js\"), exports);\ntslib_1.__exportStar(require(\"./controlDefinition.js\"), exports);\nvar proxy_js_1 = require(\"./proxy.js\");\nObject.defineProperty(exports, \"StreamDeckProxy\", { enumerable: true, get: function () { return proxy_js_1.StreamDeckProxy; } });\nvar util_js_1 = require(\"./util.js\");\nObject.defineProperty(exports, \"uint8ArrayToDataView\", { enumerable: true, get: function () { return util_js_1.uint8ArrayToDataView; } });\n/** Elgato vendor id */\nexports.VENDOR_ID = 0x0fd9;\nvar DeviceModelType;\n(function (DeviceModelType) {\n DeviceModelType[\"STREAMDECK\"] = \"streamdeck\";\n DeviceModelType[\"PEDAL\"] = \"pedal\";\n})(DeviceModelType || (exports.DeviceModelType = DeviceModelType = {}));\n/** List of all the known models, and the classes to use them */\nexports.DEVICE_MODELS2 = {\n [id_js_1.DeviceModelId.ORIGINAL]: {\n type: DeviceModelType.STREAMDECK,\n productIds: [0x0060],\n factory: original_js_1.StreamDeckOriginalFactory,\n hasNativeTcp: false,\n },\n [id_js_1.DeviceModelId.MINI]: {\n type: DeviceModelType.STREAMDECK,\n productIds: [0x0063, 0x0090],\n factory: mini_js_1.StreamDeckMiniFactory,\n hasNativeTcp: false,\n },\n [id_js_1.DeviceModelId.XL]: {\n type: DeviceModelType.STREAMDECK,\n productIds: [0x006c, 0x008f],\n factory: xl_js_1.StreamDeckXLFactory,\n hasNativeTcp: false,\n },\n [id_js_1.DeviceModelId.ORIGINALV2]: {\n type: DeviceModelType.STREAMDECK,\n productIds: [0x006d],\n factory: originalv2_js_1.StreamDeckOriginalV2Factory,\n hasNativeTcp: false,\n },\n [id_js_1.DeviceModelId.ORIGINALMK2]: {\n type: DeviceModelType.STREAMDECK,\n productIds: [0x0080],\n factory: original_mk2_js_1.StreamDeckOriginalMK2Factory,\n hasNativeTcp: false,\n },\n [id_js_1.DeviceModelId.PLUS]: {\n type: DeviceModelType.STREAMDECK,\n productIds: [0x0084],\n factory: plus_js_1.StreamDeckPlusFactory,\n hasNativeTcp: false,\n },\n [id_js_1.DeviceModelId.PEDAL]: {\n type: DeviceModelType.PEDAL,\n productIds: [0x0086],\n factory: pedal_js_1.StreamDeckPedalFactory,\n hasNativeTcp: false,\n },\n [id_js_1.DeviceModelId.NEO]: {\n type: DeviceModelType.STREAMDECK,\n productIds: [0x009a],\n factory: neo_js_1.StreamDeckNeoFactory,\n hasNativeTcp: false,\n },\n [id_js_1.DeviceModelId.STUDIO]: {\n type: DeviceModelType.STREAMDECK,\n productIds: [0x00aa],\n factory: studio_js_1.StreamDeckStudioFactory,\n hasNativeTcp: true,\n },\n};\n/** @deprecated maybe? */\nexports.DEVICE_MODELS = Object.entries(exports.DEVICE_MODELS2).map(([id, spec]) => {\n const modelId = id;\n return {\n id: modelId,\n productName: id_js_1.MODEL_NAMES[modelId],\n ...spec,\n };\n});\n//# sourceMappingURL=index.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.StreamDeckBase = void 0;\nconst eventemitter3_1 = require(\"eventemitter3\");\nconst index_js_1 = require(\"../index.js\");\nclass StreamDeckBase extends eventemitter3_1.EventEmitter {\n get CONTROLS() {\n return this.deviceProperties.CONTROLS;\n }\n // get KEY_SPACING_HORIZONTAL(): number {\n // \treturn this.deviceProperties.KEY_SPACING_HORIZONTAL\n // }\n // get KEY_SPACING_VERTICAL(): number {\n // \treturn this.deviceProperties.KEY_SPACING_VERTICAL\n // }\n get MODEL() {\n return this.deviceProperties.MODEL;\n }\n get PRODUCT_NAME() {\n return this.deviceProperties.PRODUCT_NAME;\n }\n get HAS_NFC_READER() {\n return this.deviceProperties.HAS_NFC_READER;\n }\n device;\n deviceProperties;\n // readonly #options: Readonly>\n #propertiesService;\n #buttonsLcdService;\n #lcdSegmentDisplayService;\n #inputService;\n #encoderLedService;\n constructor(device, _options, services) {\n super();\n this.device = device;\n this.deviceProperties = services.deviceProperties;\n // this.#options = options\n this.#propertiesService = services.properties;\n this.#buttonsLcdService = services.buttonsLcd;\n this.#lcdSegmentDisplayService = services.lcdSegmentDisplay;\n this.#inputService = services.inputService;\n this.#encoderLedService = services.encoderLed;\n // propogate events\n services.events?.listen((key, ...args) => this.emit(key, ...args));\n this.device.on('input', (data) => this.#inputService.handleInput(data));\n this.device.on('error', (err) => {\n this.emit('error', err);\n });\n }\n checkValidKeyIndex(keyIndex, feedbackType) {\n const buttonControl = this.deviceProperties.CONTROLS.find((control) => control.type === 'button' && control.index === keyIndex);\n if (!buttonControl) {\n throw new TypeError(`Expected a valid keyIndex`);\n }\n if (feedbackType && buttonControl.feedbackType !== feedbackType) {\n throw new TypeError(`Expected a keyIndex with expected feedbackType`);\n }\n }\n calculateFillPanelDimensions(options) {\n return this.#buttonsLcdService.calculateFillPanelDimensions(options);\n }\n async close() {\n return this.device.close();\n }\n async getHidDeviceInfo() {\n return this.device.getDeviceInfo();\n }\n async setBrightness(percentage) {\n return this.#propertiesService.setBrightness(percentage);\n }\n async resetToLogo() {\n return this.#propertiesService.resetToLogo();\n }\n async getFirmwareVersion() {\n return this.#propertiesService.getFirmwareVersion();\n }\n async getSerialNumber() {\n return this.#propertiesService.getSerialNumber();\n }\n async fillKeyColor(keyIndex, r, g, b) {\n this.checkValidKeyIndex(keyIndex, null);\n await this.#buttonsLcdService.fillKeyColor(keyIndex, r, g, b);\n }\n async fillKeyBuffer(keyIndex, imageBuffer, options) {\n this.checkValidKeyIndex(keyIndex, 'lcd');\n await this.#buttonsLcdService.fillKeyBuffer(keyIndex, imageBuffer, options);\n }\n async fillPanelBuffer(imageBuffer, options) {\n await this.#buttonsLcdService.fillPanelBuffer(imageBuffer, options);\n }\n async clearKey(keyIndex) {\n this.checkValidKeyIndex(keyIndex, null);\n await this.#buttonsLcdService.clearKey(keyIndex);\n }\n async clearPanel() {\n const ps = [];\n ps.push(this.#buttonsLcdService.clearPanel());\n if (this.#lcdSegmentDisplayService)\n ps.push(this.#lcdSegmentDisplayService.clearAllLcdSegments());\n await Promise.all(ps);\n }\n async fillLcd(...args) {\n if (!this.#lcdSegmentDisplayService)\n throw new Error('Not supported for this model');\n return this.#lcdSegmentDisplayService.fillLcd(...args);\n }\n async fillLcdRegion(...args) {\n if (!this.#lcdSegmentDisplayService)\n throw new Error('Not supported for this model');\n return this.#lcdSegmentDisplayService.fillLcdRegion(...args);\n }\n async clearLcdSegment(...args) {\n if (!this.#lcdSegmentDisplayService)\n throw new Error('Not supported for this model');\n return this.#lcdSegmentDisplayService.clearLcdSegment(...args);\n }\n async setEncoderColor(...args) {\n if (!this.#encoderLedService)\n throw new Error('Not supported for this model');\n return this.#encoderLedService.setEncoderColor(...args);\n }\n async setEncoderRingSingleColor(...args) {\n if (!this.#encoderLedService)\n throw new Error('Not supported for this model');\n return this.#encoderLedService.setEncoderRingSingleColor(...args);\n }\n async setEncoderRingColors(...args) {\n if (!this.#encoderLedService)\n throw new Error('Not supported for this model');\n return this.#encoderLedService.setEncoderRingColors(...args);\n }\n async getChildDeviceInfo() {\n const info = await this.device.getChildDeviceInfo();\n if (!info || info.vendorId !== index_js_1.VENDOR_ID)\n return null;\n const model = index_js_1.DEVICE_MODELS.find((m) => m.productIds.includes(info.productId));\n if (!model)\n return null;\n return {\n ...info,\n model: model.id,\n };\n }\n}\nexports.StreamDeckBase = StreamDeckBase;\n//# sourceMappingURL=base.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.StreamDeckGen1Factory = StreamDeckGen1Factory;\nconst base_js_1 = require(\"./base.js\");\nconst gen1_js_1 = require(\"../services/properties/gen1.js\");\nconst default_js_1 = require(\"../services/buttonsLcdDisplay/default.js\");\nconst bitmap_js_1 = require(\"../services/imagePacker/bitmap.js\");\nconst callback_hook_js_1 = require(\"../services/callback-hook.js\");\nconst gen1_js_2 = require(\"../services/input/gen1.js\");\nfunction extendDevicePropertiesForGen1(rawProps) {\n return {\n ...rawProps,\n KEY_DATA_OFFSET: 0,\n HAS_NFC_READER: false,\n SUPPORTS_CHILD_DEVICES: false,\n };\n}\nfunction StreamDeckGen1Factory(device, options, properties, imageWriter, targetOptions, bmpImagePPM) {\n const fullProperties = extendDevicePropertiesForGen1(properties);\n const events = new callback_hook_js_1.CallbackHook();\n return new base_js_1.StreamDeckBase(device, options, {\n deviceProperties: fullProperties,\n events,\n properties: new gen1_js_1.Gen1PropertiesService(device),\n buttonsLcd: new default_js_1.DefaultButtonsLcdService(imageWriter, new bitmap_js_1.BitmapButtonLcdImagePacker(targetOptions, bmpImagePPM), device, fullProperties),\n lcdSegmentDisplay: null,\n inputService: new gen1_js_2.ButtonOnlyInputService(fullProperties, events),\n encoderLed: null,\n });\n}\n//# sourceMappingURL=generic-gen1.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.createBaseGen2Properties = createBaseGen2Properties;\nconst imageWriter_js_1 = require(\"../services/imageWriter/imageWriter.js\");\nconst headerGenerator_js_1 = require(\"../services/imageWriter/headerGenerator.js\");\nconst default_js_1 = require(\"../services/buttonsLcdDisplay/default.js\");\nconst callback_hook_js_1 = require(\"../services/callback-hook.js\");\nconst gen2_js_1 = require(\"../services/properties/gen2.js\");\nconst jpeg_js_1 = require(\"../services/imagePacker/jpeg.js\");\nconst gen2_js_2 = require(\"../services/input/gen2.js\");\nconst encoderLed_js_1 = require(\"../services/encoderLed.js\");\nfunction extendDevicePropertiesForGen2(rawProps) {\n return {\n ...rawProps,\n KEY_DATA_OFFSET: 3,\n SUPPORTS_RGB_KEY_FILL: true,\n };\n}\nfunction createBaseGen2Properties(device, options, properties, propertiesService, disableXYFlip) {\n const fullProperties = extendDevicePropertiesForGen2(properties);\n const events = new callback_hook_js_1.CallbackHook();\n return {\n deviceProperties: fullProperties,\n events,\n properties: propertiesService ?? new gen2_js_1.Gen2PropertiesService(device),\n buttonsLcd: new default_js_1.DefaultButtonsLcdService(new imageWriter_js_1.StreamdeckDefaultImageWriter(new headerGenerator_js_1.StreamdeckGen2ImageHeaderGenerator()), new jpeg_js_1.JpegButtonLcdImagePacker(options.encodeJPEG, !disableXYFlip), device, fullProperties),\n lcdSegmentDisplay: null,\n inputService: new gen2_js_2.Gen2InputService(fullProperties, events),\n encoderLed: new encoderLed_js_1.EncoderLedService(device, properties.CONTROLS),\n };\n}\n//# sourceMappingURL=generic-gen2.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.StreamDeckMiniFactory = StreamDeckMiniFactory;\nconst generic_gen1_js_1 = require(\"./generic-gen1.js\");\nconst id_js_1 = require(\"../id.js\");\nconst controlsGenerator_js_1 = require(\"../controlsGenerator.js\");\nconst imageWriter_js_1 = require(\"../services/imageWriter/imageWriter.js\");\nconst headerGenerator_js_1 = require(\"../services/imageWriter/headerGenerator.js\");\nconst miniProperties = {\n MODEL: id_js_1.DeviceModelId.MINI,\n PRODUCT_NAME: id_js_1.MODEL_NAMES[id_js_1.DeviceModelId.MINI],\n SUPPORTS_RGB_KEY_FILL: false, // TODO - verify this\n CONTROLS: (0, controlsGenerator_js_1.freezeDefinitions)((0, controlsGenerator_js_1.generateButtonsGrid)(3, 2, { width: 80, height: 80 })),\n KEY_SPACING_HORIZONTAL: 28,\n KEY_SPACING_VERTICAL: 28,\n FULLSCREEN_PANELS: 0,\n};\nfunction StreamDeckMiniFactory(device, options) {\n return (0, generic_gen1_js_1.StreamDeckGen1Factory)(device, options, miniProperties, new imageWriter_js_1.StreamdeckDefaultImageWriter(new headerGenerator_js_1.StreamdeckGen1ImageHeaderGenerator()), { colorMode: 'bgr', rotate: true, yFlip: true }, 2835);\n}\n//# sourceMappingURL=mini.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.StreamDeckNeoFactory = StreamDeckNeoFactory;\nconst base_js_1 = require(\"./base.js\");\nconst id_js_1 = require(\"../id.js\");\nconst generic_gen2_js_1 = require(\"./generic-gen2.js\");\nconst controlsGenerator_js_1 = require(\"../controlsGenerator.js\");\nconst neo_js_1 = require(\"../services/lcdSegmentDisplay/neo.js\");\nconst neoControls = (0, controlsGenerator_js_1.generateButtonsGrid)(4, 2, { width: 96, height: 96 });\nneoControls.push({\n type: 'button',\n row: 2,\n column: 0,\n index: 8,\n hidIndex: 8,\n feedbackType: 'rgb',\n}, {\n type: 'lcd-segment',\n row: 2,\n column: 1,\n columnSpan: 2,\n rowSpan: 1,\n id: 0,\n pixelSize: {\n width: 248,\n height: 58,\n },\n drawRegions: false,\n}, {\n type: 'button',\n row: 2,\n column: 3,\n index: 9,\n hidIndex: 9,\n feedbackType: 'rgb',\n});\nconst neoProperties = {\n MODEL: id_js_1.DeviceModelId.NEO,\n PRODUCT_NAME: id_js_1.MODEL_NAMES[id_js_1.DeviceModelId.NEO],\n CONTROLS: (0, controlsGenerator_js_1.freezeDefinitions)(neoControls),\n KEY_SPACING_HORIZONTAL: 30,\n KEY_SPACING_VERTICAL: 30,\n FULLSCREEN_PANELS: 0,\n HAS_NFC_READER: false,\n SUPPORTS_CHILD_DEVICES: false,\n};\nconst lcdSegmentControls = neoProperties.CONTROLS.filter((control) => control.type === 'lcd-segment');\nfunction StreamDeckNeoFactory(device, options) {\n const services = (0, generic_gen2_js_1.createBaseGen2Properties)(device, options, neoProperties, null);\n services.lcdSegmentDisplay = new neo_js_1.StreamDeckNeoLcdService(options.encodeJPEG, device, lcdSegmentControls);\n return new base_js_1.StreamDeckBase(device, options, services);\n}\n//# sourceMappingURL=neo.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.StreamDeckOriginalMK2Factory = StreamDeckOriginalMK2Factory;\nconst base_js_1 = require(\"./base.js\");\nconst generic_gen2_js_1 = require(\"./generic-gen2.js\");\nconst id_js_1 = require(\"../id.js\");\nconst controlsGenerator_js_1 = require(\"../controlsGenerator.js\");\nconst origMK2Properties = {\n MODEL: id_js_1.DeviceModelId.ORIGINALMK2,\n PRODUCT_NAME: id_js_1.MODEL_NAMES[id_js_1.DeviceModelId.ORIGINALMK2],\n CONTROLS: (0, controlsGenerator_js_1.freezeDefinitions)((0, controlsGenerator_js_1.generateButtonsGrid)(5, 3, { width: 72, height: 72 })),\n KEY_SPACING_HORIZONTAL: 25,\n KEY_SPACING_VERTICAL: 25,\n FULLSCREEN_PANELS: 0,\n HAS_NFC_READER: false,\n SUPPORTS_CHILD_DEVICES: false,\n};\nfunction StreamDeckOriginalMK2Factory(device, options) {\n const services = (0, generic_gen2_js_1.createBaseGen2Properties)(device, options, origMK2Properties, null);\n return new base_js_1.StreamDeckBase(device, options, services);\n}\n//# sourceMappingURL=original-mk2.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.StreamDeckOriginalFactory = StreamDeckOriginalFactory;\nconst generic_gen1_js_1 = require(\"./generic-gen1.js\");\nconst id_js_1 = require(\"../id.js\");\nconst imageWriter_js_1 = require(\"../services/imageWriter/imageWriter.js\");\nconst controlsGenerator_js_1 = require(\"../controlsGenerator.js\");\nconst originalProperties = {\n MODEL: id_js_1.DeviceModelId.ORIGINAL,\n PRODUCT_NAME: id_js_1.MODEL_NAMES[id_js_1.DeviceModelId.ORIGINAL],\n SUPPORTS_RGB_KEY_FILL: false,\n CONTROLS: (0, controlsGenerator_js_1.freezeDefinitions)((0, controlsGenerator_js_1.generateButtonsGrid)(5, 3, { width: 72, height: 72 }, true)),\n KEY_SPACING_HORIZONTAL: 25,\n KEY_SPACING_VERTICAL: 25,\n FULLSCREEN_PANELS: 0,\n};\nfunction StreamDeckOriginalFactory(device, options) {\n return (0, generic_gen1_js_1.StreamDeckGen1Factory)(device, options, originalProperties, new imageWriter_js_1.StreamdeckOriginalImageWriter(), { colorMode: 'bgr', xFlip: true }, 3780);\n}\n//# sourceMappingURL=original.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.StreamDeckOriginalV2Factory = StreamDeckOriginalV2Factory;\nconst base_js_1 = require(\"./base.js\");\nconst generic_gen2_js_1 = require(\"./generic-gen2.js\");\nconst id_js_1 = require(\"../id.js\");\nconst controlsGenerator_js_1 = require(\"../controlsGenerator.js\");\nconst origV2Properties = {\n MODEL: id_js_1.DeviceModelId.ORIGINALV2,\n PRODUCT_NAME: id_js_1.MODEL_NAMES[id_js_1.DeviceModelId.ORIGINALV2],\n // SUPPORTS_RGB_KEY_FILL: false, // TODO - verify SUPPORTS_RGB_KEY_FILL\n CONTROLS: (0, controlsGenerator_js_1.freezeDefinitions)((0, controlsGenerator_js_1.generateButtonsGrid)(5, 3, { width: 72, height: 72 })),\n KEY_SPACING_HORIZONTAL: 25,\n KEY_SPACING_VERTICAL: 25,\n FULLSCREEN_PANELS: 0,\n HAS_NFC_READER: false,\n SUPPORTS_CHILD_DEVICES: false,\n};\nfunction StreamDeckOriginalV2Factory(device, options) {\n const services = (0, generic_gen2_js_1.createBaseGen2Properties)(device, options, origV2Properties, null);\n return new base_js_1.StreamDeckBase(device, options, services);\n}\n//# sourceMappingURL=originalv2.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.StreamDeckPedalFactory = StreamDeckPedalFactory;\nconst base_js_1 = require(\"./base.js\");\nconst id_js_1 = require(\"../id.js\");\nconst controlsGenerator_js_1 = require(\"../controlsGenerator.js\");\nconst pedal_js_1 = require(\"../services/properties/pedal.js\");\nconst pedal_js_2 = require(\"../services/buttonsLcdDisplay/pedal.js\");\nconst callback_hook_js_1 = require(\"../services/callback-hook.js\");\nconst gen1_js_1 = require(\"../services/input/gen1.js\");\nconst pedalControls = [\n {\n type: 'button',\n row: 0,\n column: 0,\n index: 0,\n hidIndex: 0,\n feedbackType: 'none',\n },\n {\n type: 'button',\n row: 0,\n column: 1,\n index: 1,\n hidIndex: 1,\n feedbackType: 'none',\n },\n {\n type: 'button',\n row: 0,\n column: 2,\n index: 2,\n hidIndex: 2,\n feedbackType: 'none',\n },\n];\nconst pedalProperties = {\n MODEL: id_js_1.DeviceModelId.PEDAL,\n PRODUCT_NAME: id_js_1.MODEL_NAMES[id_js_1.DeviceModelId.PEDAL],\n KEY_DATA_OFFSET: 3,\n SUPPORTS_RGB_KEY_FILL: false,\n CONTROLS: (0, controlsGenerator_js_1.freezeDefinitions)(pedalControls),\n KEY_SPACING_HORIZONTAL: 0,\n KEY_SPACING_VERTICAL: 0,\n FULLSCREEN_PANELS: 0,\n HAS_NFC_READER: false,\n SUPPORTS_CHILD_DEVICES: false,\n};\nfunction StreamDeckPedalFactory(device, options) {\n const events = new callback_hook_js_1.CallbackHook();\n return new base_js_1.StreamDeckBase(device, options, {\n deviceProperties: pedalProperties,\n events,\n properties: new pedal_js_1.PedalPropertiesService(device),\n buttonsLcd: new pedal_js_2.PedalLcdService(),\n lcdSegmentDisplay: null,\n inputService: new gen1_js_1.ButtonOnlyInputService(pedalProperties, events),\n encoderLed: null,\n });\n}\n//# sourceMappingURL=pedal.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.StreamDeckPlusFactory = StreamDeckPlusFactory;\nconst base_js_1 = require(\"./base.js\");\nconst generic_gen2_js_1 = require(\"./generic-gen2.js\");\nconst id_js_1 = require(\"../id.js\");\nconst controlsGenerator_js_1 = require(\"../controlsGenerator.js\");\nconst plus_js_1 = require(\"../services/lcdSegmentDisplay/plus.js\");\nconst plusControls = (0, controlsGenerator_js_1.generateButtonsGrid)(4, 2, { width: 120, height: 120 });\nplusControls.push({\n type: 'lcd-segment',\n row: 2,\n column: 0,\n columnSpan: 4,\n rowSpan: 1,\n id: 0,\n pixelSize: Object.freeze({\n width: 800,\n height: 100,\n }),\n drawRegions: true,\n}, {\n type: 'encoder',\n row: 3,\n column: 0,\n index: 0,\n hidIndex: 0,\n hasLed: false,\n ledRingSteps: 0,\n}, {\n type: 'encoder',\n row: 3,\n column: 1,\n index: 1,\n hidIndex: 1,\n hasLed: false,\n ledRingSteps: 0,\n}, {\n type: 'encoder',\n row: 3,\n column: 2,\n index: 2,\n hidIndex: 2,\n hasLed: false,\n ledRingSteps: 0,\n}, {\n type: 'encoder',\n row: 3,\n column: 3,\n index: 3,\n hidIndex: 3,\n hasLed: false,\n ledRingSteps: 0,\n});\nconst plusProperties = {\n MODEL: id_js_1.DeviceModelId.PLUS,\n PRODUCT_NAME: id_js_1.MODEL_NAMES[id_js_1.DeviceModelId.PLUS],\n CONTROLS: (0, controlsGenerator_js_1.freezeDefinitions)(plusControls),\n KEY_SPACING_HORIZONTAL: 99,\n KEY_SPACING_VERTICAL: 40,\n FULLSCREEN_PANELS: 0,\n HAS_NFC_READER: false,\n SUPPORTS_CHILD_DEVICES: false,\n};\nconst lcdSegmentControls = plusProperties.CONTROLS.filter((control) => control.type === 'lcd-segment');\nfunction StreamDeckPlusFactory(device, options) {\n const services = (0, generic_gen2_js_1.createBaseGen2Properties)(device, options, plusProperties, null, true);\n services.lcdSegmentDisplay = new plus_js_1.StreamDeckPlusLcdService(options.encodeJPEG, device, lcdSegmentControls);\n return new base_js_1.StreamDeckBase(device, options, services);\n}\n//# sourceMappingURL=plus.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.studioProperties = void 0;\nexports.StreamDeckStudioFactory = StreamDeckStudioFactory;\nconst base_js_1 = require(\"./base.js\");\nconst generic_gen2_js_1 = require(\"./generic-gen2.js\");\nconst id_js_1 = require(\"../id.js\");\nconst controlsGenerator_js_1 = require(\"../controlsGenerator.js\");\nconst studioControls = [\n {\n type: 'encoder',\n row: 0,\n column: 0,\n index: 0,\n hidIndex: 0,\n hasLed: true,\n ledRingSteps: 24,\n },\n ...(0, controlsGenerator_js_1.generateButtonsGrid)(16, 2, { width: 144, height: 112 }, false, 1),\n {\n type: 'encoder',\n row: 0,\n column: 17,\n index: 1,\n hidIndex: 1,\n hasLed: true,\n ledRingSteps: 24,\n },\n];\nexports.studioProperties = {\n MODEL: id_js_1.DeviceModelId.STUDIO,\n PRODUCT_NAME: id_js_1.MODEL_NAMES[id_js_1.DeviceModelId.STUDIO],\n CONTROLS: (0, controlsGenerator_js_1.freezeDefinitions)(studioControls),\n KEY_SPACING_HORIZONTAL: 0, // TODO\n KEY_SPACING_VERTICAL: 0, // TODO\n FULLSCREEN_PANELS: 2,\n HAS_NFC_READER: true,\n SUPPORTS_CHILD_DEVICES: true,\n};\nfunction StreamDeckStudioFactory(device, options, propertiesService) {\n const services = (0, generic_gen2_js_1.createBaseGen2Properties)(device, options, exports.studioProperties, propertiesService ?? null, true);\n return new base_js_1.StreamDeckBase(device, options, services);\n}\n//# sourceMappingURL=studio.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.StreamDeckXLFactory = StreamDeckXLFactory;\nconst base_js_1 = require(\"./base.js\");\nconst generic_gen2_js_1 = require(\"./generic-gen2.js\");\nconst id_js_1 = require(\"../id.js\");\nconst controlsGenerator_js_1 = require(\"../controlsGenerator.js\");\nconst xlProperties = {\n MODEL: id_js_1.DeviceModelId.XL,\n PRODUCT_NAME: id_js_1.MODEL_NAMES[id_js_1.DeviceModelId.XL],\n CONTROLS: (0, controlsGenerator_js_1.freezeDefinitions)((0, controlsGenerator_js_1.generateButtonsGrid)(8, 4, { width: 96, height: 96 })),\n KEY_SPACING_HORIZONTAL: 32,\n KEY_SPACING_VERTICAL: 39,\n FULLSCREEN_PANELS: 0,\n HAS_NFC_READER: false,\n SUPPORTS_CHILD_DEVICES: false,\n};\nfunction StreamDeckXLFactory(device, options) {\n const services = (0, generic_gen2_js_1.createBaseGen2Properties)(device, options, xlProperties, null);\n return new base_js_1.StreamDeckBase(device, options, services);\n}\n//# sourceMappingURL=xl.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.StreamDeckProxy = void 0;\n/**\n * A minimal proxy around a StreamDeck instance.\n * This is intended to be used by libraries wrapping this that want to add more methods to the StreamDeck\n */\nclass StreamDeckProxy {\n device;\n constructor(device) {\n this.device = device;\n }\n get CONTROLS() {\n return this.device.CONTROLS;\n }\n // public get KEY_SPACING_VERTICAL(): number {\n // \treturn this.device.KEY_SPACING_VERTICAL\n // }\n // public get KEY_SPACING_HORIZONTAL(): number {\n // \treturn this.device.KEY_SPACING_HORIZONTAL\n // }\n get MODEL() {\n return this.device.MODEL;\n }\n get PRODUCT_NAME() {\n return this.device.PRODUCT_NAME;\n }\n get HAS_NFC_READER() {\n return this.device.HAS_NFC_READER;\n }\n calculateFillPanelDimensions(...args) {\n return this.device.calculateFillPanelDimensions(...args);\n }\n async close() {\n return this.device.close();\n }\n async getHidDeviceInfo(...args) {\n return this.device.getHidDeviceInfo(...args);\n }\n async fillKeyColor(...args) {\n return this.device.fillKeyColor(...args);\n }\n async fillKeyBuffer(...args) {\n return this.device.fillKeyBuffer(...args);\n }\n async fillPanelBuffer(...args) {\n return this.device.fillPanelBuffer(...args);\n }\n async clearKey(...args) {\n return this.device.clearKey(...args);\n }\n async clearPanel(...args) {\n return this.device.clearPanel(...args);\n }\n async setBrightness(...args) {\n return this.device.setBrightness(...args);\n }\n async resetToLogo(...args) {\n return this.device.resetToLogo(...args);\n }\n async getFirmwareVersion() {\n return this.device.getFirmwareVersion();\n }\n async getSerialNumber() {\n return this.device.getSerialNumber();\n }\n async fillLcd(...args) {\n return this.device.fillLcd(...args);\n }\n async setEncoderColor(...args) {\n return this.device.setEncoderColor(...args);\n }\n async setEncoderRingSingleColor(...args) {\n return this.device.setEncoderRingSingleColor(...args);\n }\n async setEncoderRingColors(...args) {\n return this.device.setEncoderRingColors(...args);\n }\n async fillLcdRegion(...args) {\n return this.device.fillLcdRegion(...args);\n }\n async clearLcdSegment(...args) {\n return this.device.clearLcdSegment(...args);\n }\n async getChildDeviceInfo(...args) {\n return this.device.getChildDeviceInfo(...args);\n }\n /**\n * EventEmitter\n */\n eventNames() {\n return this.device.eventNames();\n }\n listeners(event) {\n return this.device.listeners(event);\n }\n listenerCount(event) {\n return this.device.listenerCount(event);\n }\n emit(event, ...args) {\n return this.device.emit(event, ...args);\n }\n /**\n * Add a listener for a given event.\n */\n on(event, fn, context) {\n this.device.on(event, fn, context);\n return this;\n }\n addListener(event, fn, context) {\n this.device.addListener(event, fn, context);\n return this;\n }\n /**\n * Add a one-time listener for a given event.\n */\n once(event, fn, context) {\n this.device.once(event, fn, context);\n return this;\n }\n /**\n * Remove the listeners of a given event.\n */\n removeListener(event, fn, context, once) {\n this.device.removeListener(event, fn, context, once);\n return this;\n }\n off(event, fn, context, once) {\n this.device.off(event, fn, context, once);\n return this;\n }\n removeAllListeners(event) {\n this.device.removeAllListeners(event);\n return this;\n }\n}\nexports.StreamDeckProxy = StreamDeckProxy;\n//# sourceMappingURL=proxy.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.DefaultButtonsLcdService = void 0;\nclass DefaultButtonsLcdService {\n #imageWriter;\n #imagePacker;\n #device;\n #deviceProperties;\n constructor(imageWriter, imagePacker, device, deviceProperties) {\n this.#imageWriter = imageWriter;\n this.#imagePacker = imagePacker;\n this.#device = device;\n this.#deviceProperties = deviceProperties;\n }\n getLcdButtonControls() {\n return this.#deviceProperties.CONTROLS.filter((control) => control.type === 'button' && control.feedbackType === 'lcd');\n }\n calculateLcdGridSpan(buttonsLcd) {\n if (buttonsLcd.length === 0)\n return null;\n const allRowValues = buttonsLcd.map((button) => button.row);\n const allColumnValues = buttonsLcd.map((button) => button.column);\n return {\n minRow: Math.min(...allRowValues),\n maxRow: Math.max(...allRowValues),\n minCol: Math.min(...allColumnValues),\n maxCol: Math.max(...allColumnValues),\n };\n }\n calculateDimensionsFromGridSpan(gridSpan, buttonPixelSize, withPadding) {\n if (withPadding) {\n // TODO: Implement padding\n throw new Error('Not implemented');\n }\n else {\n const rowCount = gridSpan.maxRow - gridSpan.minRow + 1;\n const columnCount = gridSpan.maxCol - gridSpan.minCol + 1;\n // TODO: Consider that different rows/columns could have different dimensions\n return {\n width: columnCount * buttonPixelSize.width,\n height: rowCount * buttonPixelSize.height,\n };\n }\n }\n calculateFillPanelDimensions(options) {\n const buttonLcdControls = this.getLcdButtonControls();\n const gridSpan = this.calculateLcdGridSpan(buttonLcdControls);\n if (!gridSpan || buttonLcdControls.length === 0)\n return null;\n return this.calculateDimensionsFromGridSpan(gridSpan, buttonLcdControls[0].pixelSize, options?.withPadding);\n }\n async clearPanel() {\n const ps = [];\n if (this.#deviceProperties.FULLSCREEN_PANELS > 0) {\n // TODO - should this be a separate property?\n for (let screenIndex = 0; screenIndex < this.#deviceProperties.FULLSCREEN_PANELS; screenIndex++) {\n const buffer = new Uint8Array(1024);\n buffer[0] = 0x03;\n buffer[1] = 0x05;\n buffer[2] = screenIndex; // TODO - index\n ps.push(this.#device.sendReports([buffer]));\n }\n // TODO - clear rgb?\n }\n else {\n for (const control of this.#deviceProperties.CONTROLS) {\n if (control.type !== 'button')\n continue;\n switch (control.feedbackType) {\n case 'rgb':\n ps.push(this.sendKeyRgb(control.hidIndex, 0, 0, 0));\n break;\n case 'lcd':\n if (this.#deviceProperties.SUPPORTS_RGB_KEY_FILL) {\n ps.push(this.sendKeyRgb(control.hidIndex, 0, 0, 0));\n }\n else {\n const pixels = new Uint8Array(control.pixelSize.width * control.pixelSize.height * 3);\n ps.push(this.fillImageRangeControl(control, pixels, {\n format: 'rgb',\n offset: 0,\n stride: control.pixelSize.width * 3,\n }));\n }\n break;\n case 'none':\n // Do nothing\n break;\n }\n }\n }\n await Promise.all(ps);\n }\n async clearKey(keyIndex) {\n const control = this.#deviceProperties.CONTROLS.find((control) => control.type === 'button' && control.index === keyIndex);\n if (!control || control.feedbackType === 'none')\n throw new TypeError(`Expected a valid keyIndex`);\n if (this.#deviceProperties.SUPPORTS_RGB_KEY_FILL || control.feedbackType === 'rgb') {\n await this.sendKeyRgb(keyIndex, 0, 0, 0);\n }\n else {\n const pixels = new Uint8Array(control.pixelSize.width * control.pixelSize.height * 3);\n await this.fillImageRangeControl(control, pixels, {\n format: 'rgb',\n offset: 0,\n stride: control.pixelSize.width * 3,\n });\n }\n }\n async fillKeyColor(keyIndex, r, g, b) {\n this.checkRGBValue(r);\n this.checkRGBValue(g);\n this.checkRGBValue(b);\n const control = this.#deviceProperties.CONTROLS.find((control) => control.type === 'button' && control.index === keyIndex);\n if (!control || control.feedbackType === 'none')\n throw new TypeError(`Expected a valid keyIndex`);\n if (this.#deviceProperties.SUPPORTS_RGB_KEY_FILL || control.feedbackType === 'rgb') {\n await this.sendKeyRgb(keyIndex, r, g, b);\n }\n else {\n // rgba is excessive here, but it makes the fill easier as it can be done in a 32bit uint\n const pixelCount = control.pixelSize.width * control.pixelSize.height;\n const pixels = new Uint8Array(pixelCount * 4);\n const view = new DataView(pixels.buffer, pixels.byteOffset, pixels.byteLength);\n // write first pixel\n view.setUint8(0, r);\n view.setUint8(1, g);\n view.setUint8(2, b);\n view.setUint8(3, 255);\n // read computed pixel\n const sample = view.getUint32(0);\n // fill with computed pixel\n for (let i = 1; i < pixelCount; i++) {\n view.setUint32(i * 4, sample);\n }\n await this.fillImageRangeControl(control, pixels, {\n format: 'rgba',\n offset: 0,\n stride: control.pixelSize.width * 3,\n });\n }\n }\n async fillKeyBuffer(keyIndex, imageBuffer, options) {\n const sourceFormat = options?.format ?? 'rgb';\n this.checkSourceFormat(sourceFormat);\n const control = this.#deviceProperties.CONTROLS.find((control) => control.type === 'button' && control.index === keyIndex);\n if (!control || control.feedbackType === 'none')\n throw new TypeError(`Expected a valid keyIndex`);\n if (control.feedbackType !== 'lcd')\n throw new TypeError(`keyIndex ${control.index} does not support lcd feedback`);\n const imageSize = control.pixelSize.width * control.pixelSize.height * sourceFormat.length;\n if (imageBuffer.length !== imageSize) {\n throw new RangeError(`Expected image buffer of length ${imageSize}, got length ${imageBuffer.length}`);\n }\n await this.fillImageRangeControl(control, imageBuffer, {\n format: sourceFormat,\n offset: 0,\n stride: control.pixelSize.width * sourceFormat.length,\n });\n }\n async fillPanelBuffer(imageBuffer, options) {\n const sourceFormat = options?.format ?? 'rgb';\n this.checkSourceFormat(sourceFormat);\n const buttonLcdControls = this.getLcdButtonControls();\n const panelGridSpan = this.calculateLcdGridSpan(buttonLcdControls);\n if (!panelGridSpan || buttonLcdControls.length === 0) {\n throw new Error(`Panel does not support being filled`);\n }\n const panelDimensions = this.calculateDimensionsFromGridSpan(panelGridSpan, buttonLcdControls[0].pixelSize, options?.withPadding);\n const expectedByteCount = sourceFormat.length * panelDimensions.width * panelDimensions.height;\n if (imageBuffer.length !== expectedByteCount) {\n throw new RangeError(`Expected image buffer of length ${expectedByteCount}, got length ${imageBuffer.length}`);\n }\n const stride = panelDimensions.width * sourceFormat.length;\n const ps = [];\n for (const control of buttonLcdControls) {\n const controlRow = control.row - panelGridSpan.minRow;\n const controlCol = control.column - panelGridSpan.minCol;\n // TODO: Consider that different rows/columns could have different dimensions\n const iconSize = control.pixelSize.width * sourceFormat.length;\n const rowOffset = stride * controlRow * control.pixelSize.height;\n const colOffset = controlCol * iconSize;\n // TODO: Implement padding\n ps.push(this.fillImageRangeControl(control, imageBuffer, {\n format: sourceFormat,\n offset: rowOffset + colOffset,\n stride,\n }));\n }\n await Promise.all(ps);\n }\n async sendKeyRgb(keyIndex, red, green, blue) {\n await this.#device.sendFeatureReport(new Uint8Array([0x03, 0x06, keyIndex, red, green, blue]));\n }\n async fillImageRangeControl(buttonControl, imageBuffer, sourceOptions) {\n if (buttonControl.feedbackType !== 'lcd')\n throw new TypeError(`keyIndex ${buttonControl.index} does not support lcd feedback`);\n const byteBuffer = await this.#imagePacker.convertPixelBuffer(imageBuffer, sourceOptions, buttonControl.pixelSize);\n const packets = this.#imageWriter.generateFillImageWrites({ keyIndex: buttonControl.hidIndex }, byteBuffer);\n await this.#device.sendReports(packets);\n }\n checkRGBValue(value) {\n if (value < 0 || value > 255) {\n throw new TypeError('Expected a valid color RGB value 0 - 255');\n }\n }\n checkSourceFormat(format) {\n switch (format) {\n case 'rgb':\n case 'rgba':\n case 'bgr':\n case 'bgra':\n break;\n default: {\n const fmt = format;\n throw new TypeError(`Expected a known color format not \"${fmt}\"`);\n }\n }\n }\n}\nexports.DefaultButtonsLcdService = DefaultButtonsLcdService;\n//# sourceMappingURL=default.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.PedalLcdService = void 0;\nclass PedalLcdService {\n calculateFillPanelDimensions(_options) {\n // Not supported\n return null;\n }\n async clearKey(_keyIndex) {\n // Not supported\n }\n async clearPanel() {\n // Not supported\n }\n async fillKeyColor(_keyIndex, _r, _g, _b) {\n // Not supported\n }\n async fillKeyBuffer(_keyIndex, _imageBuffer, _options) {\n // Not supported\n }\n async fillPanelBuffer(_imageBuffer, _options) {\n // Not supported\n }\n}\nexports.PedalLcdService = PedalLcdService;\n//# sourceMappingURL=pedal.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.CallbackHook = void 0;\n/**\n * A simple helper that allows for the delayed registering of a listener, to avoid dependency cycles\n */\nclass CallbackHook {\n #listener = null;\n emit(key, ...args) {\n if (!this.#listener)\n throw new Error('No listener setup');\n this.#listener(key, ...args);\n }\n listen(fn) {\n this.#listener = fn;\n }\n}\nexports.CallbackHook = CallbackHook;\n//# sourceMappingURL=callback-hook.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.EncoderLedService = void 0;\nclass EncoderLedService {\n #device;\n #encoderControls;\n constructor(device, allControls) {\n this.#device = device;\n this.#encoderControls = allControls.filter((control) => control.type === 'encoder');\n }\n async clearAll() {\n const ps = [];\n for (const control of this.#encoderControls) {\n if (control.hasLed)\n ps.push(this.setEncoderColor(control.index, 0, 0, 0));\n if (control.ledRingSteps > 0)\n ps.push(this.setEncoderRingSingleColor(control.index, 0, 0, 0));\n }\n await Promise.all(ps);\n }\n async setEncoderColor(encoder, red, green, blue) {\n const control = this.#encoderControls.find((c) => c.index === encoder);\n if (!control)\n throw new Error(`Invalid encoder index ${encoder}`);\n if (!control.hasLed)\n throw new Error('Encoder does not have an LED');\n const buffer = new Uint8Array(1024);\n buffer[0] = 0x02;\n buffer[1] = 0x10;\n buffer[2] = encoder;\n buffer[3] = red;\n buffer[4] = green;\n buffer[5] = blue;\n await this.#device.sendReports([buffer]);\n }\n async setEncoderRingSingleColor(encoder, red, green, blue) {\n const control = this.#encoderControls.find((c) => c.index === encoder);\n if (!control)\n throw new Error(`Invalid encoder index ${encoder}`);\n if (control.ledRingSteps <= 0)\n throw new Error('Encoder does not have an LED ring');\n const buffer = new Uint8Array(1024);\n buffer[0] = 0x02;\n buffer[1] = 0x0f;\n buffer[2] = encoder;\n for (let i = 0; i < control.ledRingSteps; i++) {\n const offset = 3 + i * 3;\n buffer[offset] = red;\n buffer[offset + 1] = green;\n buffer[offset + 2] = blue;\n }\n await this.#device.sendReports([buffer]);\n }\n async setEncoderRingColors(encoder, colors) {\n const control = this.#encoderControls.find((c) => c.index === encoder);\n if (!control)\n throw new Error(`Invalid encoder index ${encoder}`);\n if (control.ledRingSteps <= 0)\n throw new Error('Encoder does not have an LED ring');\n if (colors.length !== control.ledRingSteps * 3)\n throw new Error('Invalid colors length');\n const colorsBuffer = colors instanceof Uint8Array ? colors : new Uint8Array(colors);\n const buffer = new Uint8Array(1024);\n buffer[0] = 0x02;\n buffer[1] = 0x0f;\n buffer[2] = encoder;\n buffer.set(colorsBuffer, 3);\n await this.#device.sendReports([buffer]);\n }\n}\nexports.EncoderLedService = EncoderLedService;\n//# sourceMappingURL=encoderLed.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.BitmapButtonLcdImagePacker = void 0;\nconst util_js_1 = require(\"../../util.js\");\nclass BitmapButtonLcdImagePacker {\n #targetOptions;\n #bmpImagePPM;\n constructor(targetOptions, bmpImagePPM) {\n this.#targetOptions = targetOptions;\n this.#bmpImagePPM = bmpImagePPM;\n }\n async convertPixelBuffer(sourceBuffer, sourceOptions, targetSize) {\n const byteBuffer = (0, util_js_1.transformImageBuffer)(sourceBuffer, sourceOptions, this.#targetOptions, util_js_1.BMP_HEADER_LENGTH, targetSize.width, targetSize.height);\n (0, util_js_1.writeBMPHeader)(byteBuffer, targetSize.width, targetSize.height, byteBuffer.length - util_js_1.BMP_HEADER_LENGTH, this.#bmpImagePPM);\n return byteBuffer;\n }\n}\nexports.BitmapButtonLcdImagePacker = BitmapButtonLcdImagePacker;\n//# sourceMappingURL=bitmap.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.JpegButtonLcdImagePacker = void 0;\nconst util_js_1 = require(\"../../util.js\");\nclass JpegButtonLcdImagePacker {\n #encodeJPEG;\n #xyFlip;\n constructor(encodeJPEG, xyFlip) {\n this.#encodeJPEG = encodeJPEG;\n this.#xyFlip = xyFlip;\n }\n async convertPixelBuffer(sourceBuffer, sourceOptions, targetSize) {\n const byteBuffer = (0, util_js_1.transformImageBuffer)(sourceBuffer, sourceOptions, { colorMode: 'rgba', xFlip: this.#xyFlip, yFlip: this.#xyFlip }, 0, targetSize.width, targetSize.height);\n return this.#encodeJPEG(byteBuffer, targetSize.width, targetSize.height);\n }\n}\nexports.JpegButtonLcdImagePacker = JpegButtonLcdImagePacker;\n//# sourceMappingURL=jpeg.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.StreamdeckNeoLcdImageHeaderGenerator = exports.StreamdeckPlusLcdImageHeaderGenerator = exports.StreamdeckGen2ImageHeaderGenerator = exports.StreamdeckGen1ImageHeaderGenerator = void 0;\nconst util_js_1 = require(\"../../util.js\");\nclass StreamdeckGen1ImageHeaderGenerator {\n getFillImageCommandHeaderLength() {\n return 16;\n }\n writeFillImageCommandHeader(buffer, props, partIndex, isLast, _bodyLength) {\n const bufferView = (0, util_js_1.uint8ArrayToDataView)(buffer);\n bufferView.setUint8(0, 0x02);\n bufferView.setUint8(1, 0x01);\n bufferView.setUint16(2, partIndex, true);\n bufferView.setUint8(4, isLast ? 1 : 0);\n bufferView.setUint8(5, props.keyIndex + 1);\n }\n}\nexports.StreamdeckGen1ImageHeaderGenerator = StreamdeckGen1ImageHeaderGenerator;\nclass StreamdeckGen2ImageHeaderGenerator {\n getFillImageCommandHeaderLength() {\n return 8;\n }\n writeFillImageCommandHeader(buffer, props, partIndex, isLast, bodyLength) {\n const bufferView = (0, util_js_1.uint8ArrayToDataView)(buffer);\n bufferView.setUint8(0, 0x02);\n bufferView.setUint8(1, 0x07);\n bufferView.setUint8(2, props.keyIndex);\n bufferView.setUint8(3, isLast ? 1 : 0);\n bufferView.setUint16(4, bodyLength, true);\n bufferView.setUint16(6, partIndex++, true);\n }\n}\nexports.StreamdeckGen2ImageHeaderGenerator = StreamdeckGen2ImageHeaderGenerator;\nclass StreamdeckPlusLcdImageHeaderGenerator {\n getFillImageCommandHeaderLength() {\n return 16;\n }\n writeFillImageCommandHeader(buffer, props, partIndex, isLast, bodyLength) {\n const bufferView = (0, util_js_1.uint8ArrayToDataView)(buffer);\n bufferView.setUint8(0, 0x02);\n bufferView.setUint8(1, 0x0c);\n bufferView.setUint16(2, props.x, true);\n bufferView.setUint16(4, props.y, true);\n bufferView.setUint16(6, props.width, true);\n bufferView.setUint16(8, props.height, true);\n bufferView.setUint8(10, isLast ? 1 : 0);\n bufferView.setUint16(11, partIndex, true);\n bufferView.setUint16(13, bodyLength, true);\n }\n}\nexports.StreamdeckPlusLcdImageHeaderGenerator = StreamdeckPlusLcdImageHeaderGenerator;\nclass StreamdeckNeoLcdImageHeaderGenerator {\n getFillImageCommandHeaderLength() {\n return 8;\n }\n writeFillImageCommandHeader(buffer, _props, partIndex, isLast, bodyLength) {\n const bufferView = (0, util_js_1.uint8ArrayToDataView)(buffer);\n bufferView.setUint8(0, 0x02);\n bufferView.setUint8(1, 0x0b);\n bufferView.setUint8(2, 0);\n bufferView.setUint8(3, isLast ? 1 : 0);\n bufferView.setUint16(4, bodyLength, true);\n bufferView.setUint16(6, partIndex, true);\n }\n}\nexports.StreamdeckNeoLcdImageHeaderGenerator = StreamdeckNeoLcdImageHeaderGenerator;\n//# sourceMappingURL=headerGenerator.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.StreamdeckDefaultImageWriter = exports.StreamdeckOriginalImageWriter = void 0;\nconst headerGenerator_js_1 = require(\"./headerGenerator.js\");\nclass StreamdeckOriginalImageWriter {\n headerGenerator = new headerGenerator_js_1.StreamdeckGen1ImageHeaderGenerator();\n generateFillImageWrites(props, byteBuffer) {\n const MAX_PACKET_SIZE = 8191;\n const PACKET_HEADER_LENGTH = this.headerGenerator.getFillImageCommandHeaderLength();\n // The original uses larger packets, and splits the payload equally across 2\n const packet1Bytes = byteBuffer.length / 2;\n const packet1 = new Uint8Array(MAX_PACKET_SIZE);\n this.headerGenerator.writeFillImageCommandHeader(packet1, props, 0x01, false, packet1Bytes);\n packet1.set(byteBuffer.subarray(0, packet1Bytes), PACKET_HEADER_LENGTH);\n const packet2 = new Uint8Array(MAX_PACKET_SIZE);\n this.headerGenerator.writeFillImageCommandHeader(packet2, props, 0x02, true, packet1Bytes);\n packet2.set(byteBuffer.subarray(packet1Bytes), PACKET_HEADER_LENGTH);\n return [packet1, packet2];\n }\n}\nexports.StreamdeckOriginalImageWriter = StreamdeckOriginalImageWriter;\nclass StreamdeckDefaultImageWriter {\n headerGenerator;\n constructor(headerGenerator) {\n this.headerGenerator = headerGenerator;\n }\n generateFillImageWrites(props, byteBuffer) {\n const MAX_PACKET_SIZE = 1024;\n const PACKET_HEADER_LENGTH = this.headerGenerator.getFillImageCommandHeaderLength();\n const MAX_PAYLOAD_SIZE = MAX_PACKET_SIZE - PACKET_HEADER_LENGTH;\n const result = [];\n let remainingBytes = byteBuffer.length;\n for (let part = 0; remainingBytes > 0; part++) {\n const packet = new Uint8Array(MAX_PACKET_SIZE);\n const byteCount = Math.min(remainingBytes, MAX_PAYLOAD_SIZE);\n this.headerGenerator.writeFillImageCommandHeader(packet, props, part, remainingBytes <= MAX_PAYLOAD_SIZE, byteCount);\n const byteOffset = byteBuffer.length - remainingBytes;\n remainingBytes -= byteCount;\n packet.set(byteBuffer.subarray(byteOffset, byteOffset + byteCount), PACKET_HEADER_LENGTH);\n result.push(packet);\n }\n return result;\n }\n}\nexports.StreamdeckDefaultImageWriter = StreamdeckDefaultImageWriter;\n//# sourceMappingURL=imageWriter.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.ButtonOnlyInputService = void 0;\nclass ButtonOnlyInputService {\n deviceProperties;\n #keyState;\n #eventSource;\n constructor(deviceProperties, eventSource) {\n this.deviceProperties = deviceProperties;\n this.#eventSource = eventSource;\n const maxButtonIndex = this.deviceProperties.CONTROLS.filter((control) => control.type === 'button').map((control) => control.index);\n this.#keyState = new Array(Math.max(-1, ...maxButtonIndex) + 1).fill(false);\n }\n handleInput(data) {\n const dataOffset = this.deviceProperties.KEY_DATA_OFFSET || 0;\n for (const control of this.deviceProperties.CONTROLS) {\n if (control.type !== 'button')\n continue;\n const keyPressed = Boolean(data[dataOffset + control.hidIndex]);\n const stateChanged = keyPressed !== this.#keyState[control.index];\n if (stateChanged) {\n this.#keyState[control.index] = keyPressed;\n if (keyPressed) {\n this.#eventSource.emit('down', control);\n }\n else {\n this.#eventSource.emit('up', control);\n }\n }\n }\n }\n}\nexports.ButtonOnlyInputService = ButtonOnlyInputService;\n//# sourceMappingURL=gen1.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Gen2InputService = void 0;\nconst gen1_js_1 = require(\"./gen1.js\");\nconst util_js_1 = require(\"../../util.js\");\nclass Gen2InputService extends gen1_js_1.ButtonOnlyInputService {\n #eventSource;\n #encoderControls;\n #encoderState;\n #lcdSegmentControls;\n constructor(deviceProperties, eventSource) {\n super(deviceProperties, eventSource);\n this.#eventSource = eventSource;\n this.#encoderControls = deviceProperties.CONTROLS.filter((control) => control.type === 'encoder');\n const maxIndex = Math.max(-1, ...this.#encoderControls.map((control) => control.index));\n this.#encoderState = new Array(maxIndex + 1).fill(false);\n this.#lcdSegmentControls = deviceProperties.CONTROLS.filter((control) => control.type === 'lcd-segment');\n }\n handleInput(data) {\n const inputType = data[0];\n switch (inputType) {\n case 0x00: // Button\n super.handleInput(data);\n break;\n case 0x02: // LCD\n this.#handleLcdSegmentInput(data);\n break;\n case 0x03: // Encoder\n this.#handleEncoderInput(data);\n break;\n case 0x04: // NFC\n this.#handleNfcRead(data);\n break;\n }\n }\n #handleLcdSegmentInput(data) {\n // Future: This will need to handle selecting the correct control\n const lcdSegmentControl = this.#lcdSegmentControls.find((control) => control.id === 0);\n if (!lcdSegmentControl)\n return;\n const bufferView = (0, util_js_1.uint8ArrayToDataView)(data);\n const position = {\n x: bufferView.getUint16(5, true),\n y: bufferView.getUint16(7, true),\n };\n switch (data[3]) {\n case 1: // short press\n this.#eventSource.emit('lcdShortPress', lcdSegmentControl, position);\n break;\n case 2: // long press\n this.#eventSource.emit('lcdLongPress', lcdSegmentControl, position);\n break;\n case 3: {\n // swipe\n const positionTo = {\n x: bufferView.getUint16(9, true),\n y: bufferView.getUint16(11, true),\n };\n this.#eventSource.emit('lcdSwipe', lcdSegmentControl, position, positionTo);\n break;\n }\n }\n }\n #handleEncoderInput(data) {\n switch (data[3]) {\n case 0x00: // press/release\n for (const encoderControl of this.#encoderControls) {\n const keyPressed = Boolean(data[4 + encoderControl.hidIndex]);\n const stateChanged = keyPressed !== this.#encoderState[encoderControl.index];\n if (stateChanged) {\n this.#encoderState[encoderControl.index] = keyPressed;\n if (keyPressed) {\n this.#eventSource.emit('down', encoderControl);\n }\n else {\n this.#eventSource.emit('up', encoderControl);\n }\n }\n }\n break;\n case 0x01: // rotate\n for (const encoderControl of this.#encoderControls) {\n const intArray = new Int8Array(data.buffer, data.byteOffset, data.byteLength);\n const value = intArray[4 + encoderControl.hidIndex];\n if (value !== 0) {\n this.#eventSource.emit('rotate', encoderControl, value);\n }\n }\n break;\n }\n }\n #handleNfcRead(data) {\n if (!this.deviceProperties.HAS_NFC_READER)\n return;\n const length = data[1] + data[2] * 256;\n const id = new TextDecoder('ascii').decode(data.subarray(3, 3 + length));\n this.#eventSource.emit('nfcRead', id);\n }\n}\nexports.Gen2InputService = Gen2InputService;\n//# sourceMappingURL=gen2.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.StreamDeckNeoLcdService = void 0;\nconst headerGenerator_js_1 = require(\"../imageWriter/headerGenerator.js\");\nconst imageWriter_js_1 = require(\"../imageWriter/imageWriter.js\");\nconst util_js_1 = require(\"../../util.js\");\nclass StreamDeckNeoLcdService {\n #encodeJPEG;\n #device;\n #lcdControls;\n #lcdImageWriter = new imageWriter_js_1.StreamdeckDefaultImageWriter(new headerGenerator_js_1.StreamdeckNeoLcdImageHeaderGenerator());\n constructor(encodeJPEG, device, lcdControls) {\n this.#encodeJPEG = encodeJPEG;\n this.#device = device;\n this.#lcdControls = lcdControls;\n }\n async fillLcdRegion(_index, _x, _y, _imageBuffer, _sourceOptions) {\n throw new Error('Not supported for this model');\n }\n async fillLcd(index, imageBuffer, sourceOptions) {\n const lcdControl = this.#lcdControls.find((control) => control.id === index);\n if (!lcdControl)\n throw new Error(`Invalid lcd segment index ${index}`);\n const imageSize = lcdControl.pixelSize.width * lcdControl.pixelSize.height * sourceOptions.format.length;\n if (imageBuffer.length !== imageSize) {\n throw new RangeError(`Expected image buffer of length ${imageSize}, got length ${imageBuffer.length}`);\n }\n // A lot of this drawing code is heavily based on the normal button\n const byteBuffer = await this.convertFillLcdBuffer(imageBuffer, lcdControl.pixelSize, sourceOptions);\n const packets = this.#lcdImageWriter.generateFillImageWrites(null, byteBuffer);\n await this.#device.sendReports(packets);\n }\n async clearLcdSegment(index) {\n const lcdControl = this.#lcdControls.find((control) => control.id === index);\n if (!lcdControl)\n throw new Error(`Invalid lcd segment index ${index}`);\n const buffer = new Uint8Array(lcdControl.pixelSize.width * lcdControl.pixelSize.height * 4);\n await this.fillLcd(index, buffer, {\n format: 'rgba',\n });\n }\n async clearAllLcdSegments() {\n const ps = [];\n for (const control of this.#lcdControls) {\n ps.push(this.clearLcdSegment(control.id));\n }\n await Promise.all(ps);\n }\n async convertFillLcdBuffer(sourceBuffer, size, sourceOptions) {\n const sourceOptions2 = {\n format: sourceOptions.format,\n offset: 0,\n stride: size.width * sourceOptions.format.length,\n };\n const byteBuffer = (0, util_js_1.transformImageBuffer)(sourceBuffer, sourceOptions2, { colorMode: 'rgba', xFlip: true, yFlip: true }, 0, size.width, size.height);\n return this.#encodeJPEG(byteBuffer, size.width, size.height);\n }\n}\nexports.StreamDeckNeoLcdService = StreamDeckNeoLcdService;\n//# sourceMappingURL=neo.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.StreamDeckPlusLcdService = void 0;\nconst headerGenerator_js_1 = require(\"../imageWriter/headerGenerator.js\");\nconst imageWriter_js_1 = require(\"../imageWriter/imageWriter.js\");\nconst util_js_1 = require(\"../../util.js\");\nclass StreamDeckPlusLcdService {\n #encodeJPEG;\n #device;\n #lcdControls;\n #lcdImageWriter = new imageWriter_js_1.StreamdeckDefaultImageWriter(new headerGenerator_js_1.StreamdeckPlusLcdImageHeaderGenerator());\n constructor(encodeJPEG, device, lcdControls) {\n this.#encodeJPEG = encodeJPEG;\n this.#device = device;\n this.#lcdControls = lcdControls;\n }\n async fillLcd(index, buffer, sourceOptions) {\n const lcdControl = this.#lcdControls.find((control) => control.id === index);\n if (!lcdControl)\n throw new Error(`Invalid lcd segment index ${index}`);\n return this.fillControlRegion(lcdControl, 0, 0, buffer, {\n format: sourceOptions.format,\n width: lcdControl.pixelSize.width,\n height: lcdControl.pixelSize.height,\n });\n }\n async fillLcdRegion(index, x, y, imageBuffer, sourceOptions) {\n const lcdControl = this.#lcdControls.find((control) => control.id === index);\n if (!lcdControl)\n throw new Error(`Invalid lcd segment index ${index}`);\n return this.fillControlRegion(lcdControl, x, y, imageBuffer, sourceOptions);\n }\n async clearLcdSegment(index) {\n const lcdControl = this.#lcdControls.find((control) => control.id === index);\n if (!lcdControl)\n throw new Error(`Invalid lcd segment index ${index}`);\n const buffer = new Uint8Array(lcdControl.pixelSize.width * lcdControl.pixelSize.height * 4);\n await this.fillControlRegion(lcdControl, 0, 0, buffer, {\n format: 'rgba',\n width: lcdControl.pixelSize.width,\n height: lcdControl.pixelSize.height,\n });\n }\n async clearAllLcdSegments() {\n const ps = [];\n for (const control of this.#lcdControls) {\n ps.push(this.clearLcdSegment(control.id));\n }\n await Promise.all(ps);\n }\n async fillControlRegion(lcdControl, x, y, imageBuffer, sourceOptions) {\n // Basic bounds checking\n const maxSize = lcdControl.pixelSize;\n if (x < 0 || x + sourceOptions.width > maxSize.width) {\n throw new TypeError(`Image will not fit within the lcd segment`);\n }\n if (y < 0 || y + sourceOptions.height > maxSize.height) {\n throw new TypeError(`Image will not fit within the lcd segment`);\n }\n const imageSize = sourceOptions.width * sourceOptions.height * sourceOptions.format.length;\n if (imageBuffer.length !== imageSize) {\n throw new RangeError(`Expected image buffer of length ${imageSize}, got length ${imageBuffer.length}`);\n }\n // A lot of this drawing code is heavily based on the normal button\n const byteBuffer = await this.convertFillLcdBuffer(imageBuffer, sourceOptions);\n const packets = this.#lcdImageWriter.generateFillImageWrites({ ...sourceOptions, x, y }, byteBuffer);\n await this.#device.sendReports(packets);\n }\n async convertFillLcdBuffer(sourceBuffer, sourceOptions) {\n const sourceOptions2 = {\n format: sourceOptions.format,\n offset: 0,\n stride: sourceOptions.width * sourceOptions.format.length,\n };\n const byteBuffer = (0, util_js_1.transformImageBuffer)(sourceBuffer, sourceOptions2, { colorMode: 'rgba' }, 0, sourceOptions.width, sourceOptions.height);\n return this.#encodeJPEG(byteBuffer, sourceOptions.width, sourceOptions.height);\n }\n}\nexports.StreamDeckPlusLcdService = StreamDeckPlusLcdService;\n//# sourceMappingURL=plus.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Gen1PropertiesService = void 0;\nclass Gen1PropertiesService {\n #device;\n constructor(device) {\n this.#device = device;\n }\n async setBrightness(percentage) {\n if (percentage < 0 || percentage > 100) {\n throw new RangeError('Expected brightness percentage to be between 0 and 100');\n }\n // prettier-ignore\n const brightnessCommandBuffer = new Uint8Array([\n 0x05,\n 0x55, 0xaa, 0xd1, 0x01, percentage, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00\n ]);\n await this.#device.sendFeatureReport(brightnessCommandBuffer);\n }\n async resetToLogo() {\n // prettier-ignore\n const resetCommandBuffer = new Uint8Array([\n 0x0b,\n 0x63, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00\n ]);\n await this.#device.sendFeatureReport(resetCommandBuffer);\n }\n async getFirmwareVersion() {\n let val;\n try {\n val = await this.#device.getFeatureReport(4, 32);\n }\n catch (_e) {\n // In case some devices can't handle the different report length\n val = await this.#device.getFeatureReport(4, 17);\n }\n const end = val.indexOf(0, 5);\n return new TextDecoder('ascii').decode(val.subarray(5, end === -1 ? undefined : end));\n }\n async getSerialNumber() {\n let val;\n try {\n val = await this.#device.getFeatureReport(3, 32);\n }\n catch (_e) {\n // In case some devices can't handle the different report length\n val = await this.#device.getFeatureReport(3, 17);\n }\n return new TextDecoder('ascii').decode(val.subarray(5, 17));\n }\n}\nexports.Gen1PropertiesService = Gen1PropertiesService;\n//# sourceMappingURL=gen1.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Gen2PropertiesService = void 0;\nclass Gen2PropertiesService {\n #device;\n constructor(device) {\n this.#device = device;\n }\n async setBrightness(percentage) {\n if (percentage < 0 || percentage > 100) {\n throw new RangeError('Expected brightness percentage to be between 0 and 100');\n }\n // prettier-ignore\n const brightnessCommandBuffer = new Uint8Array([\n 0x03,\n 0x08, percentage, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00\n ]);\n await this.#device.sendFeatureReport(brightnessCommandBuffer);\n }\n async resetToLogo() {\n // prettier-ignore\n const resetCommandBuffer = new Uint8Array([\n 0x03,\n 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00\n ]);\n await this.#device.sendFeatureReport(resetCommandBuffer);\n }\n async getFirmwareVersion() {\n const val = await this.#device.getFeatureReport(5, 32);\n const end = val[1] + 2;\n return new TextDecoder('ascii').decode(val.subarray(6, end));\n }\n async getSerialNumber() {\n const val = await this.#device.getFeatureReport(6, 32);\n const end = val[1] + 2;\n return new TextDecoder('ascii').decode(val.subarray(2, end));\n }\n}\nexports.Gen2PropertiesService = Gen2PropertiesService;\n//# sourceMappingURL=gen2.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.PedalPropertiesService = void 0;\nclass PedalPropertiesService {\n #device;\n constructor(device) {\n this.#device = device;\n }\n async setBrightness(_percentage) {\n // Not supported\n }\n async resetToLogo() {\n // Not supported\n }\n async getFirmwareVersion() {\n const val = await this.#device.getFeatureReport(5, 32);\n const end = val.indexOf(0, 6);\n return new TextDecoder('ascii').decode(val.subarray(6, end === -1 ? undefined : end));\n }\n async getSerialNumber() {\n const val = await this.#device.getFeatureReport(6, 32);\n return new TextDecoder('ascii').decode(val.subarray(2, 14));\n }\n}\nexports.PedalPropertiesService = PedalPropertiesService;\n//# sourceMappingURL=pedal.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\n//# sourceMappingURL=types.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.BMP_HEADER_LENGTH = void 0;\nexports.transformImageBuffer = transformImageBuffer;\nexports.writeBMPHeader = writeBMPHeader;\nexports.uint8ArrayToDataView = uint8ArrayToDataView;\nfunction transformImageBuffer(imageBuffer, sourceOptions, targetOptions, destPadding, imageWidth, imageHeight) {\n const imageBufferView = uint8ArrayToDataView(imageBuffer);\n const byteBuffer = new Uint8Array(destPadding + imageWidth * imageHeight * targetOptions.colorMode.length);\n const byteBufferView = uint8ArrayToDataView(byteBuffer);\n const flipColours = sourceOptions.format.substring(0, 3) !== targetOptions.colorMode.substring(0, 3);\n for (let y = 0; y < imageHeight; y++) {\n const rowOffset = destPadding + imageWidth * targetOptions.colorMode.length * y;\n for (let x = 0; x < imageWidth; x++) {\n // Apply x/y flips\n let x2 = targetOptions.xFlip ? imageWidth - x - 1 : x;\n let y2 = targetOptions.yFlip ? imageHeight - y - 1 : y;\n if (targetOptions.rotate) {\n // Swap x and y\n const tmpX = x2;\n x2 = y2;\n y2 = tmpX;\n }\n const srcOffset = y2 * sourceOptions.stride + sourceOptions.offset + x2 * sourceOptions.format.length;\n const red = imageBufferView.getUint8(srcOffset);\n const green = imageBufferView.getUint8(srcOffset + 1);\n const blue = imageBufferView.getUint8(srcOffset + 2);\n const targetOffset = rowOffset + x * targetOptions.colorMode.length;\n if (flipColours) {\n byteBufferView.setUint8(targetOffset, blue);\n byteBufferView.setUint8(targetOffset + 1, green);\n byteBufferView.setUint8(targetOffset + 2, red);\n }\n else {\n byteBufferView.setUint8(targetOffset, red);\n byteBufferView.setUint8(targetOffset + 1, green);\n byteBufferView.setUint8(targetOffset + 2, blue);\n }\n if (targetOptions.colorMode.length === 4) {\n byteBufferView.setUint8(targetOffset + 3, 255);\n }\n }\n }\n return byteBuffer;\n}\nexports.BMP_HEADER_LENGTH = 54;\nfunction writeBMPHeader(buf, imageWidth, imageHeight, imageBytes, imagePPM) {\n const bufView = uint8ArrayToDataView(buf);\n // Uses header format BITMAPINFOHEADER https://en.wikipedia.org/wiki/BMP_file_format\n // Bitmap file header\n bufView.setUint8(0, 0x42); // B\n bufView.setUint8(1, 0x4d); // M\n bufView.setUint32(2, imageBytes + 54, true);\n bufView.setInt16(6, 0, true);\n bufView.setInt16(8, 0, true);\n bufView.setUint32(10, 54, true); // Full header size\n // DIB header (BITMAPINFOHEADER)\n bufView.setUint32(14, 40, true); // DIB header size\n bufView.setInt32(18, imageWidth, true);\n bufView.setInt32(22, imageHeight, true);\n bufView.setInt16(26, 1, true); // Color planes\n bufView.setInt16(28, 24, true); // Bit depth\n bufView.setInt32(30, 0, true); // Compression\n bufView.setInt32(34, imageBytes, true); // Image size\n bufView.setInt32(38, imagePPM, true); // Horizontal resolution ppm\n bufView.setInt32(42, imagePPM, true); // Vertical resolution ppm\n bufView.setInt32(46, 0, true); // Colour pallette size\n bufView.setInt32(50, 0, true); // 'Important' Colour count\n}\nfunction uint8ArrayToDataView(buffer) {\n return new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);\n}\n//# sourceMappingURL=util.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.WebHIDDevice = void 0;\nconst eventemitter3_1 = require(\"eventemitter3\");\nconst p_queue_1 = require(\"p-queue\");\n/**\n * The wrapped browser HIDDevice.\n * This translates it into the common format expected by @elgato-stream-deck/core\n */\nclass WebHIDDevice extends eventemitter3_1.EventEmitter {\n device;\n reportQueue = new p_queue_1.default({ concurrency: 1 });\n constructor(device) {\n super();\n this.device = device;\n // this.device.on('data', data => this.emit('data', data))\n // this.device.on('error', error => this.emit('error', error))\n this.device.addEventListener('inputreport', (event) => {\n // Button press\n if (event.reportId === 0x01) {\n const data = new Uint8Array(event.data.buffer, event.data.byteOffset, event.data.byteLength);\n this.emit('input', data);\n }\n });\n }\n async close() {\n return this.device.close();\n }\n async forget() {\n return this.device.forget();\n }\n async sendFeatureReport(data) {\n return this.device.sendFeatureReport(data[0], data.subarray(1));\n }\n async getFeatureReport(reportId, _reportLength) {\n const view = await this.device.receiveFeatureReport(reportId);\n return new Uint8Array(view.buffer, view.byteOffset, view.byteLength);\n }\n async sendReports(buffers) {\n return this.reportQueue.add(async () => {\n for (const data of buffers) {\n await this.device.sendReport(data[0], data.subarray(1));\n }\n });\n }\n async getDeviceInfo() {\n return {\n path: undefined,\n productId: this.device.productId,\n vendorId: this.device.vendorId,\n };\n }\n async getChildDeviceInfo() {\n // Not supported\n return null;\n }\n}\nexports.WebHIDDevice = WebHIDDevice;\n//# sourceMappingURL=hid-device.js.map","\"use strict\";\n/* eslint-disable n/no-unsupported-features/node-builtins */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.StreamDeckWeb = exports.DeviceModelId = exports.VENDOR_ID = void 0;\nexports.requestStreamDecks = requestStreamDecks;\nexports.getStreamDecks = getStreamDecks;\nexports.openDevice = openDevice;\nconst core_1 = require(\"@elgato-stream-deck/core\");\nconst hid_device_js_1 = require(\"./hid-device.js\");\nconst jpeg_js_1 = require(\"./jpeg.js\");\nconst wrapper_js_1 = require(\"./wrapper.js\");\nvar core_2 = require(\"@elgato-stream-deck/core\");\nObject.defineProperty(exports, \"VENDOR_ID\", { enumerable: true, get: function () { return core_2.VENDOR_ID; } });\nObject.defineProperty(exports, \"DeviceModelId\", { enumerable: true, get: function () { return core_2.DeviceModelId; } });\nvar wrapper_js_2 = require(\"./wrapper.js\");\nObject.defineProperty(exports, \"StreamDeckWeb\", { enumerable: true, get: function () { return wrapper_js_2.StreamDeckWeb; } });\n/**\n * Request the user to select some streamdecks to open\n * @param userOptions Options to customise the device behvaiour\n */\nasync function requestStreamDecks(options) {\n // TODO - error handling\n const browserDevices = await navigator.hid.requestDevice({\n filters: [\n {\n vendorId: core_1.VENDOR_ID,\n },\n ],\n });\n return Promise.all(browserDevices.map(async (dev) => openDevice(dev, options)));\n}\n/**\n * Reopen previously selected streamdecks.\n * The browser remembers what the user previously allowed your site to access, and this will open those without the request dialog\n * @param options Options to customise the device behvaiour\n */\nasync function getStreamDecks(options) {\n const browserDevices = await navigator.hid.getDevices();\n const validDevices = browserDevices.filter((d) => d.vendorId === core_1.VENDOR_ID);\n const resultDevices = await Promise.all(validDevices.map(async (dev) => openDevice(dev, options).catch((_) => null)));\n return resultDevices.filter((v) => !!v);\n}\n/**\n * Open a StreamDeck from a manually selected HIDDevice handle\n * @param browserDevice The unopened browser HIDDevice\n * @param userOptions Options to customise the device behvaiour\n */\nasync function openDevice(browserDevice, userOptions) {\n const model = core_1.DEVICE_MODELS.find((m) => browserDevice.vendorId === core_1.VENDOR_ID && m.productIds.includes(browserDevice.productId));\n if (!model) {\n throw new Error('Stream Deck is of unexpected type.');\n }\n await browserDevice.open();\n try {\n const options = {\n encodeJPEG: jpeg_js_1.encodeJPEG,\n ...userOptions,\n };\n const browserHid = new hid_device_js_1.WebHIDDevice(browserDevice);\n const device = model.factory(browserHid, options || {});\n return new wrapper_js_1.StreamDeckWeb(device, browserHid);\n }\n catch (e) {\n await browserDevice.close().catch(() => null); // Suppress error\n throw e;\n }\n}\n//# sourceMappingURL=index.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.encodeJPEG = encodeJPEG;\n/**\n * The default JPEG encoder.\n * Utilises a hidden canvas to convert a byte array buffer into a jpeg\n * @param buffer The buffer to convert\n * @param width Width of the image\n * @param height Hieght of the image\n */\nasync function encodeJPEG(buffer, width, height) {\n const blob = await new Promise((resolve, reject) => {\n const canvas = document.createElement('canvas');\n canvas.width = width;\n canvas.height = height;\n const ctx = canvas.getContext('2d');\n if (ctx) {\n const imageData = ctx.createImageData(width, height);\n imageData.data.set(buffer);\n ctx.putImageData(imageData, 0, 0);\n canvas.toBlob((b) => {\n if (b) {\n resolve(b);\n }\n else {\n reject(new Error('No image generated'));\n }\n }, 'image/jpeg', 0.9);\n }\n else {\n reject(new Error('Failed to get canvas context'));\n }\n });\n return new Uint8Array(await blob.arrayBuffer());\n}\n//# sourceMappingURL=jpeg.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.StreamDeckWeb = void 0;\nconst core_1 = require(\"@elgato-stream-deck/core\");\n/**\n * A StreamDeck instance.\n * This is an extended variant of the class, to provide some more web friendly helpers, such as accepting a canvas\n */\nclass StreamDeckWeb extends core_1.StreamDeckProxy {\n hid;\n constructor(device, hid) {\n super(device);\n this.hid = hid;\n }\n /**\n * Instruct the browser to close and forget the device. This will revoke the website's permissions to access the device.\n */\n async forget() {\n await this.hid.forget();\n }\n async fillKeyCanvas(keyIndex, canvas) {\n // this.checkValidKeyIndex(keyIndex)\n const ctx = canvas.getContext('2d');\n if (!ctx)\n throw new Error('Failed to get canvas context');\n const control = this.CONTROLS.find((control) => control.type === 'button' && control.index === keyIndex);\n if (!control || control.feedbackType === 'none')\n throw new TypeError(`Expected a valid keyIndex`);\n if (control.feedbackType !== 'lcd')\n throw new TypeError(`keyIndex ${control.index} does not support lcd feedback`);\n const data = ctx.getImageData(0, 0, control.pixelSize.width, control.pixelSize.height);\n return this.device.fillKeyBuffer(keyIndex, data.data, { format: 'rgba' });\n }\n async fillPanelCanvas(canvas) {\n const ctx = canvas.getContext('2d');\n if (!ctx)\n throw new Error('Failed to get canvas context');\n const dimensions = this.device.calculateFillPanelDimensions();\n if (!dimensions)\n throw new Error('Panel does not support filling');\n const data = ctx.getImageData(0, 0, dimensions.width, dimensions.height);\n return this.device.fillPanelBuffer(data.data, { format: 'rgba' });\n }\n}\nexports.StreamDeckWeb = StreamDeckWeb;\n//# sourceMappingURL=wrapper.js.map","/******************************************************************************\nCopyright (c) Microsoft Corporation.\n\nPermission to use, copy, modify, and/or distribute this software for any\npurpose with or without fee is hereby granted.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\nPERFORMANCE OF THIS SOFTWARE.\n***************************************************************************** */\n/* global Reflect, Promise, SuppressedError, Symbol, Iterator */\n\nvar extendStatics = function(d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n};\n\nexport function __extends(d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n}\n\nexport var __assign = function() {\n __assign = Object.assign || function __assign(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\n }\n return t;\n }\n return __assign.apply(this, arguments);\n}\n\nexport function __rest(s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n}\n\nexport function __decorate(decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n}\n\nexport function __param(paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n}\n\nexport function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\n function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\n var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\n var _, done = false;\n for (var i = decorators.length - 1; i >= 0; i--) {\n var context = {};\n for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\n context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\n var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\n if (kind === \"accessor\") {\n if (result === void 0) continue;\n if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\n if (_ = accept(result.get)) descriptor.get = _;\n if (_ = accept(result.set)) descriptor.set = _;\n if (_ = accept(result.init)) initializers.unshift(_);\n }\n else if (_ = accept(result)) {\n if (kind === \"field\") initializers.unshift(_);\n else descriptor[key] = _;\n }\n }\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\n done = true;\n};\n\nexport function __runInitializers(thisArg, initializers, value) {\n var useValue = arguments.length > 2;\n for (var i = 0; i < initializers.length; i++) {\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\n }\n return useValue ? value : void 0;\n};\n\nexport function __propKey(x) {\n return typeof x === \"symbol\" ? x : \"\".concat(x);\n};\n\nexport function __setFunctionName(f, name, prefix) {\n if (typeof name === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\n return Object.defineProperty(f, \"name\", { configurable: true, value: prefix ? \"\".concat(prefix, \" \", name) : name });\n};\n\nexport function __metadata(metadataKey, metadataValue) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\n}\n\nexport function __awaiter(thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n}\n\nexport function __generator(thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === \"function\" ? Iterator : Object).prototype);\n return g.next = verb(0), g[\"throw\"] = verb(1), g[\"return\"] = verb(2), typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n}\n\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n});\n\nexport function __exportStar(m, o) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\n}\n\nexport function __values(o) {\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\n if (m) return m.call(o);\n if (o && typeof o.length === \"number\") return {\n next: function () {\n if (o && i >= o.length) o = void 0;\n return { value: o && o[i++], done: !o };\n }\n };\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\n}\n\nexport function __read(o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n}\n\n/** @deprecated */\nexport function __spread() {\n for (var ar = [], i = 0; i < arguments.length; i++)\n ar = ar.concat(__read(arguments[i]));\n return ar;\n}\n\n/** @deprecated */\nexport function __spreadArrays() {\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\n r[k] = a[j];\n return r;\n}\n\nexport function __spreadArray(to, from, pack) {\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\n if (ar || !(i in from)) {\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\n ar[i] = from[i];\n }\n }\n return to.concat(ar || Array.prototype.slice.call(from));\n}\n\nexport function __await(v) {\n return this instanceof __await ? (this.v = v, this) : new __await(v);\n}\n\nexport function __asyncGenerator(thisArg, _arguments, generator) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\n return i = Object.create((typeof AsyncIterator === \"function\" ? AsyncIterator : Object).prototype), verb(\"next\"), verb(\"throw\"), verb(\"return\", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;\n function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }\n function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\n function fulfill(value) { resume(\"next\", value); }\n function reject(value) { resume(\"throw\", value); }\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\n}\n\nexport function __asyncDelegator(o) {\n var i, p;\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }\n}\n\nexport function __asyncValues(o) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var m = o[Symbol.asyncIterator], i;\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\n}\n\nexport function __makeTemplateObject(cooked, raw) {\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\n return cooked;\n};\n\nvar __setModuleDefault = Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n};\n\nexport function __importStar(mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\n __setModuleDefault(result, mod);\n return result;\n}\n\nexport function __importDefault(mod) {\n return (mod && mod.__esModule) ? mod : { default: mod };\n}\n\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\n}\n\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\n}\n\nexport function __classPrivateFieldIn(state, receiver) {\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\n}\n\nexport function __addDisposableResource(env, value, async) {\n if (value !== null && value !== void 0) {\n if (typeof value !== \"object\" && typeof value !== \"function\") throw new TypeError(\"Object expected.\");\n var dispose, inner;\n if (async) {\n if (!Symbol.asyncDispose) throw new TypeError(\"Symbol.asyncDispose is not defined.\");\n dispose = value[Symbol.asyncDispose];\n }\n if (dispose === void 0) {\n if (!Symbol.dispose) throw new TypeError(\"Symbol.dispose is not defined.\");\n dispose = value[Symbol.dispose];\n if (async) inner = dispose;\n }\n if (typeof dispose !== \"function\") throw new TypeError(\"Object not disposable.\");\n if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };\n env.stack.push({ value: value, dispose: dispose, async: async });\n }\n else if (async) {\n env.stack.push({ async: true });\n }\n return value;\n}\n\nvar _SuppressedError = typeof SuppressedError === \"function\" ? SuppressedError : function (error, suppressed, message) {\n var e = new Error(message);\n return e.name = \"SuppressedError\", e.error = error, e.suppressed = suppressed, e;\n};\n\nexport function __disposeResources(env) {\n function fail(e) {\n env.error = env.hasError ? new _SuppressedError(e, env.error, \"An error was suppressed during disposal.\") : e;\n env.hasError = true;\n }\n var r, s = 0;\n function next() {\n while (r = env.stack.pop()) {\n try {\n if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);\n if (r.dispose) {\n var result = r.dispose.call(r.value);\n if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });\n }\n else s |= 1;\n }\n catch (e) {\n fail(e);\n }\n }\n if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();\n if (env.hasError) throw env.error;\n }\n return next();\n}\n\nexport default {\n __extends,\n __assign,\n __rest,\n __decorate,\n __param,\n __metadata,\n __awaiter,\n __generator,\n __createBinding,\n __exportStar,\n __values,\n __read,\n __spread,\n __spreadArrays,\n __spreadArray,\n __await,\n __asyncGenerator,\n __asyncDelegator,\n __asyncValues,\n __makeTemplateObject,\n __importStar,\n __importDefault,\n __classPrivateFieldGet,\n __classPrivateFieldSet,\n __classPrivateFieldIn,\n __addDisposableResource,\n __disposeResources,\n};\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import type { StreamDeckWeb, LcdPosition } from '@elgato-stream-deck/webhid'\nimport { requestStreamDecks, getStreamDecks } from '@elgato-stream-deck/webhid'\nimport type { Demo } from './demo/demo'\nimport { DomImageDemo } from './demo/dom'\nimport { FillWhenPressedDemo } from './demo/fill-when-pressed'\nimport { RapidFillDemo } from './demo/rapid-fill'\nimport { ChaseDemo } from './demo/chase'\n\ndeclare const LIB_VERSION: any\nif (LIB_VERSION) {\n\tconst elm = document.querySelector('#version_str')\n\tif (elm) {\n\t\telm.innerHTML = `v${LIB_VERSION}`\n\t}\n}\n\nfunction appendLog(str: string) {\n\tconst logElm = document.getElementById('log')\n\tif (logElm) {\n\t\tlogElm.textContent = `${str}\\n${logElm.textContent ?? ''}`\n\t}\n}\n\nconst demoSelect = document.getElementById('demo-select') as HTMLInputElement | undefined\nconst consentButton = document.getElementById('consent-button')\n\nlet device: StreamDeckWeb | null = null\nlet currentDemo: Demo = new FillWhenPressedDemo()\nasync function demoChange() {\n\tif (demoSelect) {\n\t\tconsole.log(`Selected demo: ${demoSelect.value}`)\n\t\tif (device) {\n\t\t\tawait currentDemo.stop(device)\n\t\t}\n\n\t\tswitch (demoSelect.value) {\n\t\t\tcase 'rapid-fill':\n\t\t\t\tcurrentDemo = new RapidFillDemo()\n\t\t\t\tbreak\n\t\t\tcase 'dom':\n\t\t\t\tcurrentDemo = new DomImageDemo()\n\t\t\t\tbreak\n\t\t\tcase 'chase':\n\t\t\t\tcurrentDemo = new ChaseDemo()\n\t\t\t\tbreak\n\t\t\tcase 'fill-when-pressed':\n\t\t\tdefault:\n\t\t\t\tcurrentDemo = new FillWhenPressedDemo()\n\t\t\t\tbreak\n\t\t}\n\n\t\tif (device) {\n\t\t\tawait currentDemo.start(device)\n\t\t}\n\t}\n}\n\nasync function openDevice(device: StreamDeckWeb): Promise {\n\tappendLog(`Device opened. Serial: ${await device.getSerialNumber()} Firmware: ${await device.getFirmwareVersion()}`)\n\n\tdevice.on('down', (control) => {\n\t\tif (control.type === 'button') {\n\t\t\tappendLog(`Key ${control.index} down`)\n\t\t\tcurrentDemo.keyDown(device, control.index).catch(console.error)\n\t\t} else {\n\t\t\tappendLog(`Encoder ${control.index} down`)\n\t\t}\n\t})\n\tdevice.on('up', (control) => {\n\t\tif (control.type === 'button') {\n\t\t\tappendLog(`Key ${control.index} up`)\n\t\t\tcurrentDemo.keyUp(device, control.index).catch(console.error)\n\t\t} else {\n\t\t\tappendLog(`Encoder ${control.index} down`)\n\t\t}\n\t})\n\tdevice.on('rotate', (control, amount) => {\n\t\tappendLog(`Encoder ${control.index} rotate (${amount})`)\n\t})\n\tdevice.on('lcdShortPress', (control, position: LcdPosition) => {\n\t\tappendLog(`LCD (${control.id}) short press (${position.x},${position.y})`)\n\t})\n\tdevice.on('lcdLongPress', (control, position: LcdPosition) => {\n\t\tappendLog(`LCD (${control.id}) long press (${position.x},${position.y})`)\n\t})\n\tdevice.on('lcdSwipe', (control, fromPosition: LcdPosition, toPosition: LcdPosition) => {\n\t\tappendLog(\n\t\t\t`LCD (${control.id}) swipe (${fromPosition.x},${fromPosition.y}) -> (${toPosition.x},${toPosition.y})`,\n\t\t)\n\t})\n\n\tawait currentDemo.start(device)\n\n\t// Sample actions\n\tawait device.setBrightness(70)\n\n\t// device.fillColor(2, 255, 0, 0)\n\t// device.fillColor(12, 0, 0, 255)\n}\n\nif (consentButton) {\n\tconst doLoad = async () => {\n\t\t// attempt to open a previously selected device.\n\t\tconst devices = await getStreamDecks()\n\t\tif (devices.length > 0) {\n\t\t\tdevice = devices[0]\n\t\t\topenDevice(device).catch(console.error)\n\t\t}\n\t\tconsole.log(devices)\n\t}\n\twindow.addEventListener('load', () => {\n\t\tdoLoad().catch((e) => console.error(e))\n\t})\n\n\tconst brightnessRange = document.getElementById('brightness-range') as HTMLInputElement | undefined\n\tif (brightnessRange) {\n\t\tbrightnessRange.addEventListener('input', (_e) => {\n\t\t\tconst value = brightnessRange.value as any as number\n\t\t\tif (device) {\n\t\t\t\tdevice.setBrightness(value).catch(console.error)\n\t\t\t}\n\t\t})\n\t}\n\n\tif (demoSelect) {\n\t\tdemoSelect.addEventListener('input', () => {\n\t\t\tdemoChange().catch(console.error)\n\t\t})\n\t\tdemoChange().catch(console.error)\n\t}\n\n\tconst consentClick = async () => {\n\t\tif (device) {\n\t\t\tappendLog('Closing device')\n\t\t\tcurrentDemo.stop(device).catch(console.error)\n\t\t\tawait device.close()\n\t\t\tdevice = null\n\t\t}\n\t\t// Prompt for a device\n\t\ttry {\n\t\t\tconst devices = await requestStreamDecks()\n\t\t\tdevice = devices[0]\n\t\t\tif (devices.length === 0) {\n\t\t\t\tappendLog('No device was selected')\n\t\t\t\treturn\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tappendLog(`No device access granted: ${error as string}`)\n\t\t\treturn\n\t\t}\n\n\t\topenDevice(device).catch(console.error)\n\t}\n\tconsentButton.addEventListener('click', () => {\n\t\tconsentClick().catch((e) => console.error(e))\n\t})\n\n\tappendLog('Page loaded')\n}\n"],"names":[],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"app.js","mappings":";;;;;;;AAAa;;AAEb;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,UAAU;AACrB,WAAW,GAAG;AACd,WAAW,SAAS;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,cAAc;AACzB,WAAW,iBAAiB;AAC5B,WAAW,UAAU;AACrB,WAAW,GAAG;AACd,WAAW,SAAS;AACpB,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,cAAc;AACzB,WAAW,iBAAiB;AAC5B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,iBAAiB;AAC5B,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,0DAA0D,OAAO;AACjE;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,iBAAiB;AAC5B,aAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,iBAAiB;AAC5B,aAAa,SAAS;AACtB;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,0CAA0C,SAAS;AACnD;AACA;;AAEA;AACA,IAAI;AACJ;AACA;;AAEA,gBAAgB,YAAY;AAC5B;;AAEA;AACA,4DAA4D;AAC5D,gEAAgE;AAChE,oEAAoE;AACpE,wEAAwE;AACxE;AACA,2DAA2D,SAAS;AACpE;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,iBAAiB;AAC5B,WAAW,UAAU;AACrB,WAAW,GAAG;AACd,aAAa,cAAc;AAC3B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,iBAAiB;AAC5B,WAAW,UAAU;AACrB,WAAW,GAAG;AACd,aAAa,cAAc;AAC3B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,iBAAiB;AAC5B,WAAW,UAAU;AACrB,WAAW,GAAG;AACd,WAAW,SAAS;AACpB,aAAa,cAAc;AAC3B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ,4DAA4D,YAAY;AACxE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,iBAAiB;AAC5B,aAAa,cAAc;AAC3B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAI,IAA6B;AACjC;AACA;;;;;;;;;;;;;;;;;;;;;;;AC/UO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,8CAA8C;AACzD;AACA;AACA,mBAAmB,SAAS,EAAE,QAAQ;AACtC;AACA,CAAC;AACM;AACP;AACA;AACA,KAAK;AACL;AACO;AACP;AACA,0CAA0C,OAAO;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,8CAA8C;AACrD;AACA;AACA,aAAa;AACb;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,0CAA0C;AACjD;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,SAAS;AACjC;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACO;AACP;AACA;AACA;AACA,4CAA4C,gBAAgB,KAAK;AACjE;AACO;AACP;AACA;AACA;AACA,iCAAiC,MAAM;AACvC,kCAAkC,OAAO;AACzC,uCAAuC,OAAO,EAAE,OAAO;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjLuC;AACvC;AACA;AACA,cAAc,eAAe,YAAY,4BAA4B,EAAE;AACvE;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA,kBAAkB,KAAK,IAAI,MAAM,EAAE,+BAA+B;AAClE,KAAK;AACL;AACA;AACA;AACA,yBAAyB,UAAU,GAAG,OAAO;AAC7C;AACA;AACA;AACA,sCAAsC,UAAU,EAAE,SAAS;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,IAAI;AAC1B;AACA,kCAAkC,sBAAsB,EAAE,UAAU;AACpE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;;AC1CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;;ACvBA;AACA;AACA;AACO;AACP;AACA;AACO;AACP,mBAAmB,UAAU,SAAS,QAAQ;AAC9C;AACO;AACP;AACA;AACA,qCAAqC,QAAQ;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC,4BAA4B;AAC9D;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B,YAAY,GAAG,IAAI;AAChD;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uFAAuF,aAAa;AACpG;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,+CAA+C,YAAY;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3EsD;AACa;AAC7B;AACQ;AAC9C;AACA;AACA;AACA;AACA;AACA,WAAW,WAAW;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,WAAW;AAC1B;AACA;AACA,wBAAwB,WAAW;AACnC,0BAA0B,iBAAiB;AAC3C,WAAW,WAAW;AACtB;AACA;AACA;AACA;AACA;AACA,mEAAmE;AACnE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,mBAAmB;AAC3B;AACA;AACA,QAAQ,mBAAmB;AAC3B;AACA;AACA,QAAQ,mBAAmB;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B;AACA,aAAa,mBAAmB;AAChC;AACA,mBAAmB,OAAO;AAC1B;AACA;AACA,mBAAmB,OAAO;AAC1B;AACA;AACA,QAAQ,mBAAmB;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,OAAO;AACf;AACA;AACA;AACA,2BAA2B,YAAY;AACvC;AACA,gBAAgB,mBAAmB;AACnC;AACA;AACA;AACA;AACA;AACA,gCAAgC,6BAA6B;AAC7D;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,QAAQ,mBAAmB;AAC3B;AACA;AACA,QAAQ,mBAAmB;AAC3B;AACA;AACA;AACA;AACA,QAAQ,mBAAmB;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,mBAAmB;AAC3B;AACA,QAAQ,mBAAmB;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,iBAAiB;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,kBAAkB;AAC1C;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnLoC;AACE;AACgC;AACtE;AACA;AACA,mEAAmE;AACnE;AACA;AACA,2CAA2C;AAC3C,uCAAuC,QAAQ;AAC/C;AACO;AACP;AACA;AACA;AACA;AACA,KAAK;AACL,iCAAiC,SAAS;AAC1C;AACO,eAAe,qBAAK;AAC3B;AACA,sCAAsC,UAAU;AAChD,4BAA4B,WAAW;AACvC;AACA;AACA;AACA,sBAAsB,WAAW;AACjC;AACA;AACA,4BAA4B,iBAAiB;AAC7C;AACA,0DAA0D,QAAQ;AAClE;AACA;AACA;AACA;AACA;AACA;AACA,0CAA0C,qBAAqB;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC,KAAK;AACxC;AACA;AACA,SAAS;AACT;AACO;AACP;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA,iEAAiE,qBAAK;AACtE;AACA;;ACjEmD;AACG;AACG;AACnB;AACtC;AACA;AACA;AACA;AACA,gCAAgC,cAAc;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,mBAAmB;AAC9C,6BAA6B,SAAS;AACtC,UAAU,mBAAmB;AAC7B,aAAa,SAAS;AACtB;AACA;AACA;AACA,0BAA0B,iBAAiB,MAAM,WAAW;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,qBAAqB,OAAO;AAC5B;AACA;AACA;AACO;AACP,QAAQ,mBAAmB;AAC3B;AACA;AACA;AACA;AACA;AACA;;AC9DO;AACP,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,yBAAyB,cAAc;AACvC;AACA;AACA,0BAA0B,eAAe;AACzC;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;ACnBiC;AACU;AACqB;AAChE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,cAAc,mCAAmC,QAAQ;AACxE,kDAAkD,OAAO;AACzD;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mEAAmE,YAAY,OAAO;AACtF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6DAA6D;AAC7D;AACA;AACA,aAAa,aAAa,MAAM,gBAAgB,aAAa;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC;AACjC;AACA,yBAAyB;AACzB;AACA;AACA,yBAAyB;AACzB;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,oBAAoB,OAAO;AAC3B;AACA,qBAAqB;AACrB;AACA;AACA,wEAAwE,WAAW;AACnF;AACA;AACA,SAAS;AACT;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,0BAA0B,WAAW;AACrC;AACA;AACA;AACA;AACA;AACA,wBAAwB,OAAO;AAC/B;AACA;AACA;AACO;AACP;AACA;AACA;AACA,eAAe,cAAc;AAC7B,KAAK;AACL;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpLyC;AACI;AACF;AACqB;AACuD;AAChH,uCAAuC;AAC9C,YAAY,gBAAgB,EAAE,YAAY;AAC1C,8BAA8B,SAAS;AACvC,UAAU,aAAa;AACvB,UAAU,WAAW;AACrB,IAAI,UAAU;AACd,0BAA0B,aAAa;AACvC;AACA;AACO,0CAA0C;AACjD,YAAY,gBAAgB,EAAE,YAAY;AAC1C;AACA,sBAAsB,WAAW;AACjC;AACA;AACA,wCAAwC,aAAa;AACrD;AACA;AACA;AACA;AACA;AACA,QAAQ,qBAAqB;AAC7B;AACA,4BAA4B,YAAY;AACxC,6BAA6B,aAAa;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACO,6CAA6C;AACpD,YAAY,gBAAgB,EAAE,YAAY;AAC1C;AACA;AACA;AACA;AACO,uCAAuC;AAC9C;AACA;AACA;AACO,wCAAwC;AAC/C;AACA;AACA;AACO,wCAAwC;AAC/C;AACA,uBAAuB,YAAY;AACnC;AACA;AACO,iDAAiD;AACxD,WAAW,aAAa;AACxB;AACA;;;;;;;AC3Da;AACb;AACA,mCAAmC;;AAEnC;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;;;;;;;;ACda;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,qBAAqB,mBAAO,CAAC,IAAe;AAC5C,oBAAoB,mBAAO,CAAC,IAAW;AACvC,yBAAyB,mBAAO,CAAC,IAAkB;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC,oJAAoJ;AACtL;AACA,gGAAgG,yHAAyH,MAAM,2BAA2B;AAC1P;AACA;AACA,2FAA2F,sHAAsH,MAAM,wBAAwB;AAC/O;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gGAAgG,eAAe,MAAM,sBAAsB;AAC3I;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA,mGAAmG;AACnG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAe;;;;;;;;ACtRF;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAe;;;;;;;;ACpBF;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,sBAAsB,mBAAO,CAAC,GAAe;AAC7C;AACA;AACA;AACA;AACA;AACA,kCAAkC,aAAa;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAe;;;;;;;;AC/BF;;AAEb;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,UAAU;AACrB,WAAW,GAAG;AACd,WAAW,SAAS;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,cAAc;AACzB,WAAW,iBAAiB;AAC5B,WAAW,UAAU;AACrB,WAAW,GAAG;AACd,WAAW,SAAS;AACpB,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,cAAc;AACzB,WAAW,iBAAiB;AAC5B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,iBAAiB;AAC5B,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,0DAA0D,OAAO;AACjE;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,iBAAiB;AAC5B,aAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,iBAAiB;AAC5B,aAAa,SAAS;AACtB;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,0CAA0C,SAAS;AACnD;AACA;;AAEA;AACA,IAAI;AACJ;AACA;;AAEA,gBAAgB,YAAY;AAC5B;;AAEA;AACA,4DAA4D;AAC5D,gEAAgE;AAChE,oEAAoE;AACpE,wEAAwE;AACxE;AACA,2DAA2D,SAAS;AACpE;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,iBAAiB;AAC5B,WAAW,UAAU;AACrB,WAAW,GAAG;AACd,aAAa,cAAc;AAC3B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,iBAAiB;AAC5B,WAAW,UAAU;AACrB,WAAW,GAAG;AACd,aAAa,cAAc;AAC3B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,iBAAiB;AAC5B,WAAW,UAAU;AACrB,WAAW,GAAG;AACd,WAAW,SAAS;AACpB,aAAa,cAAc;AAC3B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;A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AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB;AACtB;;;;;;;ACjJa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,6BAA6B;AAC7B,kBAAkB,mBAAO,CAAC,IAAW;AACrC,kBAAkB,mBAAO,CAAC,GAAgC;AAC1D,qBAAqB,mBAAO,CAAC,IAA0C;AACvE,oBAAoB,mBAAO,CAAC,IAAmC;AAC/D,2BAA2B,mBAAO,CAAC,GAA8B;AACjE,kBAAkB,mBAAO,CAAC,IAA2B;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;;;;;;AC9Ba;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,gCAAgC;AAChC,yBAAyB,mBAAO,CAAC,IAAwC;AACzE,6BAA6B,mBAAO,CAAC,IAA4C;AACjF,qBAAqB,mBA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,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;;;;;;AC5Da;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,6BAA6B;AAC7B,kBAAkB,mBAAO,CAAC,IAAW;AACrC,0BAA0B,mBAAO,CAAC,GAAmB;AACrD,gBAAgB,mBAAO,CAAC,IAAU;AAClC,+BAA+B,mBAAO,CAAC,IAAyB;AAChE,kBAAkB,mBAAO,CAAC,IAAuC;AACjE,6EAA6E,yBAAyB;AACtG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;ACvEa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,wBAAwB;AACxB,+BAA+B;AAC/B,kBAAkB,mBAAO,CAAC,IAAW;AACrC,0BAA0B,mBAAO,CAAC,GAAmB;AACrD,gBAAgB,mBAAO,CAAC,IAAU;AAClC,+BAA+B,mBAAO,CAAC,IAAyB;AAChE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,gEAAgE,yBAAyB;AACzF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,wBAAwB;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;AC5Ca;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,2BAA2B;AAC3B,kBAAkB,mBAAO,CAAC,IAAW;AACrC,0BAA0B,mBAAO,CAAC,GAAmB;AACrD,gBAAgB,mBAAO,CAAC,IAAU;AAClC,+BAA+B,mBAAO,CAAC,IAAyB;AAChE;AACA;AACA;AACA;AACA,oHAAoH,uBAAuB;AAC3I;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;ACtBa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,uBAAuB;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB;AACvB;;;;;;;ACzIa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,gCAAgC;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC,wDAAwD;AAC9F;AACA;AACA;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,gBAAgB;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4CAA4C,eAAe;AAC3D;AACA;AACA,oEAAoE,UAAU,eAAe,mBAAmB;AAChH;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oEAAoE,kBAAkB,eAAe,mBAAmB;AACxH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4CAA4C,qBAAqB;AACjE;AACA,oEAAoE,kCAAkC;AACtG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0EAA0E,IAAI;AAC9E;AACA;AACA;AACA;AACA,gCAAgC;AAChC;;;;;;;AC7Na;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,uBAAuB;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB;AACvB;;;;;;;ACzBa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;;;;;;;AClBa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qDAAqD,QAAQ;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qDAAqD,QAAQ;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,0BAA0B;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qDAAqD,QAAQ;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;;;;;;;ACvEa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,kCAAkC;AAClC,kBAAkB,mBAAO,CAAC,IAAe;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC;AAClC;;;;;;;AClBa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,gCAAgC;AAChC,kBAAkB,mBAAO,CAAC,IAAe;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8FAA8F,6DAA6D;AAC3J;AACA;AACA;AACA,gCAAgC;AAChC;;;;;;;ACjBa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,4CAA4C,GAAG,6CAA6C,GAAG,0CAA0C,GAAG,0CAA0C;AACtL,kBAAkB,mBAAO,CAAC,IAAe;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0CAA0C;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0CAA0C;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6CAA6C;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4CAA4C;AAC5C;;;;;;;AClEa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,oCAAoC,GAAG,qCAAqC;AAC5E,6BAA6B,mBAAO,CAAC,IAAsB;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,oBAAoB;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC;AACpC;;;;;;;AC7Ca;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,8BAA8B;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B;AAC9B;;;;;;;ACjCa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,wBAAwB;AACxB,kBAAkB,mBAAO,CAAC,IAAW;AACrC,kBAAkB,mBAAO,CAAC,IAAe;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB;AACxB;;;;;;;ACpGa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,+BAA+B;AAC/B,6BAA6B,mBAAO,CAAC,IAAmC;AACxE,yBAAyB,mBAAO,CAAC,IAA+B;AAChE,kBAAkB,mBAAO,CAAC,IAAe;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yDAAyD,MAAM;AAC/D;AACA;AACA,oEAAoE,UAAU,eAAe,mBAAmB;AAChH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yDAAyD,MAAM;AAC/D;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+FAA+F,6CAA6C;AAC5I;AACA;AACA;AACA,+BAA+B;AAC/B;;;;;;;AC3Da;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,gCAAgC;AAChC,6BAA6B,mBAAO,CAAC,IAAmC;AACxE,yBAAyB,mBAAO,CAAC,IAA+B;AAChE,kBAAkB,mBAAO,CAAC,IAAe;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yDAAyD,MAAM;AAC/D;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,yDAAyD,MAAM;AAC/D;AACA;AACA;AACA;AACA;AACA,yDAAyD,MAAM;AAC/D;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oEAAoE,UAAU,eAAe,mBAAmB;AAChH;AACA;AACA;AACA,uEAAuE,wBAAwB;AAC/F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+FAA+F,mBAAmB;AAClH;AACA;AACA;AACA,gCAAgC;AAChC;;;;;;;AC/Ea;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,6BAA6B;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;;;;;;;ACtDa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,6BAA6B;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;;;;;;;AC7Ca;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,8BAA8B;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B;AAC9B;;;;;;;ACzBa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D;;;;;;;ACFa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,yBAAyB;AACzB,4BAA4B;AAC5B,sBAAsB;AACtB,4BAA4B;AAC5B;AACA;AACA;AACA;AACA;AACA,oBAAoB,iBAAiB;AACrC;AACA,wBAAwB,gBAAgB;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA,+BAA+B;AAC/B,+BAA+B;AAC/B;AACA;AACA;AACA,qCAAqC;AACrC;AACA,qCAAqC;AACrC;AACA;AACA,mCAAmC;AACnC,oCAAoC;AACpC,mCAAmC;AACnC,4CAA4C;AAC5C,0CAA0C;AAC1C,0CAA0C;AAC1C,mCAAmC;AACnC,mCAAmC;AACnC;AACA;AACA;AACA;AACA;;;;;;;ACxEa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,oBAAoB;AACpB,wBAAwB,mBAAO,CAAC,IAAe;AAC/C,kBAAkB,mBAAO,CAAC,IAAS;AACnC;AACA;AACA;AACA;AACA;AACA;AACA,0CAA0C,gBAAgB;AAC1D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;;;;;;;AC1Da;AACb;AACA,8CAA6C,EAAE,aAAa,EAAC;AAC7D,qBAAqB,GAAG,qBAAqB,GAAG,iBAAiB;AACjE,0BAA0B;AAC1B,sBAAsB;AACtB,kBAAkB;AAClB,eAAe,mBAAO,CAAC,IAA0B;AACjD,wBAAwB,mBAAO,CAAC,IAAiB;AACjD,kBAAkB,mBAAO,CAAC,IAAW;AACrC,qBAAqB,mBAAO,CAAC,IAAc;AAC3C,aAAa,mBAAO,CAAC,IAA0B;AAC/C,6CAA4C,EAAE,qCAAqC,4BAA4B,EAAC;AAChH,iDAAgD,EAAE,qCAAqC,gCAAgC,EAAC;AACxH,mBAAmB,mBAAO,CAAC,IAAc;AACzC,iDAAgD,EAAE,qCAAqC,sCAAsC,EAAC;AAC9H;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8DAA8D;AAC9D;AACA;AACA;AACA,uDAAuD;AACvD;AACA;AACA;AACA;;;;;;;ACnEa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,kBAAkB;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;;;;;;ACnCa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,qBAAqB;AACrB,eAAe,mBAAO,CAAC,IAA0B;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4CAA4C,eAAe;AAC3D;AACA,gEAAgE,gBAAgB;AAChF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wDAAwD,gBAAgB;AACxE;AACA;AACA,qBAAqB;AACrB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC7CA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,SAAS,gBAAgB,sCAAsC,kBAAkB;AACjF,wBAAwB;AACxB;AACA;;AAEO;AACP;AACA;AACA;AACA,kBAAkB;AAClB;AACA;;AAEO;AACP;AACA,+CAA+C,OAAO;AACtD;AACA;AACA;AACA;AACA;AACA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;QAClC,CAAC,CAAC;QACF,UAAU,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;IAClC,CAAC;IAED,MAAM,YAAY,GAAG,KAAK,IAAI,EAAE;QAC/B,IAAI,MAAM,EAAE,CAAC;YACZ,SAAS,CAAC,gBAAgB,CAAC;YAC3B,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;YAC7C,MAAM,MAAM,CAAC,KAAK,EAAE;YACpB,MAAM,GAAG,IAAI;QACd,CAAC;QACD,sBAAsB;QACtB,IAAI,CAAC;YACJ,MAAM,OAAO,GAAG,MAAM,+BAAkB,GAAE;YAC1C,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC;YACnB,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBAC1B,SAAS,CAAC,wBAAwB,CAAC;gBACnC,OAAM;YACP,CAAC;QACF,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,SAAS,CAAC,6BAA6B,KAAe,EAAE,CAAC;YACzD,OAAM;QACP,CAAC;QAED,UAAU,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;IACxC,CAAC;IACD,aAAa,CAAC,gBAAgB,CAAC,OAAO,EAAE,GAAG,EAAE;QAC5C,YAAY,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAC9C,CAAC,CAAC;IAEF,SAAS,CAAC,aAAa,CAAC;AACzB,CAAC","sources":["webpack:///../../../node_modules/eventemitter3/index.js","webpack:///../../../node_modules/html-to-image/es/util.js","webpack:///../../../node_modules/html-to-image/es/clone-pseudos.js","webpack:///../../../node_modules/html-to-image/es/mimes.js","webpack:///../../../node_modules/html-to-image/es/dataurl.js","webpack:///../../../node_modules/html-to-image/es/clone-node.js","webpack:///../../../node_modules/html-to-image/es/embed-resources.js","webpack:///../../../node_modules/html-to-image/es/embed-images.js","webpack:///../../../node_modules/html-to-image/es/apply-style.js","webpack:///../../../node_modules/html-to-image/es/embed-webfonts.js","webpack:///../../../node_modules/html-to-image/es/index.js","webpack:///../../../node_modules/p-finally/index.js","webpack:///../../../node_modules/p-queue/dist/index.js","webpack:///../../../node_modules/p-queue/dist/lower-bound.js","webpack:///../../../node_modules/p-queue/dist/priority-queue.js","webpack:///../../../node_modules/p-queue/node_modules/eventemitter3/index.js","webpack:///../../../node_modules/p-timeout/index.js","webpack:///./demo/chase.ts","webpack:///./demo/dom.ts","webpack:///./demo/fill-when-pressed.ts","webpack:///./demo/rapid-fill.ts","webpack:///../../core/dist/controlDefinition.js","webpack:///../../core/dist/controlsGenerator.js","webpack:///../../core/dist/id.js","webpack:///../../core/dist/index.js","webpack:///../../core/dist/models/base.js","webpack:///../../core/dist/models/generic-gen1.js","webpack:///../../core/dist/models/generic-gen2.js","webpack:///../../core/dist/models/mini.js","webpack:///../../core/dist/models/neo.js","webpack:///../../core/dist/models/original-mk2.js","webpack:///../../core/dist/models/original.js","webpack:///../../core/dist/models/originalv2.js","webpack:///../../core/dist/models/pedal.js","webpack:///../../core/dist/models/plus.js","webpack:///../../core/dist/models/studio.js","webpack:///../../core/dist/models/xl.js","webpack:///../../core/dist/proxy.js","webpack:///../../core/dist/services/buttonsLcdDisplay/default.js","webpack:///../../core/dist/services/buttonsLcdDisplay/pedal.js","webpack:///../../core/dist/services/callback-hook.js","webpack:///../../core/dist/services/encoderLed.js","webpack:///../../core/dist/services/imagePacker/bitmap.js","webpack:///../../core/dist/services/imagePacker/jpeg.js","webpack:///../../core/dist/services/imageWriter/headerGenerator.js","webpack:///../../core/dist/services/imageWriter/imageWriter.js","webpack:///../../core/dist/services/input/gen1.js","webpack:///../../core/dist/services/input/gen2.js","webpack:///../../core/dist/services/lcdSegmentDisplay/neo.js","webpack:///../../core/dist/services/lcdSegmentDisplay/plus.js","webpack:///../../core/dist/services/properties/gen1.js","webpack:///../../core/dist/services/properties/gen2.js","webpack:///../../core/dist/services/properties/pedal.js","webpack:///../../core/dist/types.js","webpack:///../../core/dist/util.js","webpack:///../../webhid/dist/hid-device.js","webpack:///../../webhid/dist/index.js","webpack:///../../webhid/dist/jpeg.js","webpack:///../../webhid/dist/wrapper.js","webpack:///../../../node_modules/tslib/tslib.es6.mjs","webpack:///webpack/bootstrap","webpack:///webpack/runtime/define property getters","webpack:///webpack/runtime/hasOwnProperty shorthand","webpack:///webpack/runtime/make namespace object","webpack:///./app.ts"],"sourcesContent":["'use strict';\n\nvar has = Object.prototype.hasOwnProperty\n , prefix = '~';\n\n/**\n * Constructor to create a storage for our `EE` objects.\n * An `Events` instance is a plain object whose properties are event names.\n *\n * @constructor\n * @private\n */\nfunction Events() {}\n\n//\n// We try to not inherit from `Object.prototype`. In some engines creating an\n// instance in this way is faster than calling `Object.create(null)` directly.\n// If `Object.create(null)` is not supported we prefix the event names with a\n// character to make sure that the built-in object properties are not\n// overridden or used as an attack vector.\n//\nif (Object.create) {\n Events.prototype = Object.create(null);\n\n //\n // This hack is needed because the `__proto__` property is still inherited in\n // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.\n //\n if (!new Events().__proto__) prefix = false;\n}\n\n/**\n * Representation of a single event listener.\n *\n * @param {Function} fn The listener function.\n * @param {*} context The context to invoke the listener with.\n * @param {Boolean} [once=false] Specify if the listener is a one-time listener.\n * @constructor\n * @private\n */\nfunction EE(fn, context, once) {\n this.fn = fn;\n this.context = context;\n this.once = once || false;\n}\n\n/**\n * Add a listener for a given event.\n *\n * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} context The context to invoke the listener with.\n * @param {Boolean} once Specify if the listener is a one-time listener.\n * @returns {EventEmitter}\n * @private\n */\nfunction addListener(emitter, event, fn, context, once) {\n if (typeof fn !== 'function') {\n throw new TypeError('The listener must be a function');\n }\n\n var listener = new EE(fn, context || emitter, once)\n , evt = prefix ? prefix + event : event;\n\n if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++;\n else if (!emitter._events[evt].fn) emitter._events[evt].push(listener);\n else emitter._events[evt] = [emitter._events[evt], listener];\n\n return emitter;\n}\n\n/**\n * Clear event by name.\n *\n * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.\n * @param {(String|Symbol)} evt The Event name.\n * @private\n */\nfunction clearEvent(emitter, evt) {\n if (--emitter._eventsCount === 0) emitter._events = new Events();\n else delete emitter._events[evt];\n}\n\n/**\n * Minimal `EventEmitter` interface that is molded against the Node.js\n * `EventEmitter` interface.\n *\n * @constructor\n * @public\n */\nfunction EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}\n\n/**\n * Return an array listing the events for which the emitter has registered\n * listeners.\n *\n * @returns {Array}\n * @public\n */\nEventEmitter.prototype.eventNames = function eventNames() {\n var names = []\n , events\n , name;\n\n if (this._eventsCount === 0) return names;\n\n for (name in (events = this._events)) {\n if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);\n }\n\n if (Object.getOwnPropertySymbols) {\n return names.concat(Object.getOwnPropertySymbols(events));\n }\n\n return names;\n};\n\n/**\n * Return the listeners registered for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Array} The registered listeners.\n * @public\n */\nEventEmitter.prototype.listeners = function listeners(event) {\n var evt = prefix ? prefix + event : event\n , handlers = this._events[evt];\n\n if (!handlers) return [];\n if (handlers.fn) return [handlers.fn];\n\n for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) {\n ee[i] = handlers[i].fn;\n }\n\n return ee;\n};\n\n/**\n * Return the number of listeners listening to a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Number} The number of listeners.\n * @public\n */\nEventEmitter.prototype.listenerCount = function listenerCount(event) {\n var evt = prefix ? prefix + event : event\n , listeners = this._events[evt];\n\n if (!listeners) return 0;\n if (listeners.fn) return 1;\n return listeners.length;\n};\n\n/**\n * Calls each of the listeners registered for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Boolean} `true` if the event had listeners, else `false`.\n * @public\n */\nEventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {\n var evt = prefix ? prefix + event : event;\n\n if (!this._events[evt]) return false;\n\n var listeners = this._events[evt]\n , len = arguments.length\n , args\n , i;\n\n if (listeners.fn) {\n if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);\n\n switch (len) {\n case 1: return listeners.fn.call(listeners.context), true;\n case 2: return listeners.fn.call(listeners.context, a1), true;\n case 3: return listeners.fn.call(listeners.context, a1, a2), true;\n case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;\n case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;\n case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;\n }\n\n for (i = 1, args = new Array(len -1); i < len; i++) {\n args[i - 1] = arguments[i];\n }\n\n listeners.fn.apply(listeners.context, args);\n } else {\n var length = listeners.length\n , j;\n\n for (i = 0; i < length; i++) {\n if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);\n\n switch (len) {\n case 1: listeners[i].fn.call(listeners[i].context); break;\n case 2: listeners[i].fn.call(listeners[i].context, a1); break;\n case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;\n case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break;\n default:\n if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {\n args[j - 1] = arguments[j];\n }\n\n listeners[i].fn.apply(listeners[i].context, args);\n }\n }\n }\n\n return true;\n};\n\n/**\n * Add a listener for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} [context=this] The context to invoke the listener with.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.on = function on(event, fn, context) {\n return addListener(this, event, fn, context, false);\n};\n\n/**\n * Add a one-time listener for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} [context=this] The context to invoke the listener with.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.once = function once(event, fn, context) {\n return addListener(this, event, fn, context, true);\n};\n\n/**\n * Remove the listeners of a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn Only remove the listeners that match this function.\n * @param {*} context Only remove the listeners that have this context.\n * @param {Boolean} once Only remove one-time listeners.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {\n var evt = prefix ? prefix + event : event;\n\n if (!this._events[evt]) return this;\n if (!fn) {\n clearEvent(this, evt);\n return this;\n }\n\n var listeners = this._events[evt];\n\n if (listeners.fn) {\n if (\n listeners.fn === fn &&\n (!once || listeners.once) &&\n (!context || listeners.context === context)\n ) {\n clearEvent(this, evt);\n }\n } else {\n for (var i = 0, events = [], length = listeners.length; i < length; i++) {\n if (\n listeners[i].fn !== fn ||\n (once && !listeners[i].once) ||\n (context && listeners[i].context !== context)\n ) {\n events.push(listeners[i]);\n }\n }\n\n //\n // Reset the array, or remove it completely if we have no more listeners.\n //\n if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;\n else clearEvent(this, evt);\n }\n\n return this;\n};\n\n/**\n * Remove all listeners, or those of the specified event.\n *\n * @param {(String|Symbol)} [event] The event name.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {\n var evt;\n\n if (event) {\n evt = prefix ? prefix + event : event;\n if (this._events[evt]) clearEvent(this, evt);\n } else {\n this._events = new Events();\n this._eventsCount = 0;\n }\n\n return this;\n};\n\n//\n// Alias methods names because people roll like that.\n//\nEventEmitter.prototype.off = EventEmitter.prototype.removeListener;\nEventEmitter.prototype.addListener = EventEmitter.prototype.on;\n\n//\n// Expose the prefix.\n//\nEventEmitter.prefixed = prefix;\n\n//\n// Allow `EventEmitter` to be imported as module namespace.\n//\nEventEmitter.EventEmitter = EventEmitter;\n\n//\n// Expose the module.\n//\nif ('undefined' !== typeof module) {\n module.exports = EventEmitter;\n}\n","export function resolveUrl(url, baseUrl) {\n // url is absolute already\n if (url.match(/^[a-z]+:\\/\\//i)) {\n return url;\n }\n // url is absolute already, without protocol\n if (url.match(/^\\/\\//)) {\n return window.location.protocol + url;\n }\n // dataURI, mailto:, tel:, etc.\n if (url.match(/^[a-z]+:/i)) {\n return url;\n }\n const doc = document.implementation.createHTMLDocument();\n const base = doc.createElement('base');\n const a = doc.createElement('a');\n doc.head.appendChild(base);\n doc.body.appendChild(a);\n if (baseUrl) {\n base.href = baseUrl;\n }\n a.href = url;\n return a.href;\n}\nexport const uuid = (() => {\n // generate uuid for className of pseudo elements.\n // We should not use GUIDs, otherwise pseudo elements sometimes cannot be captured.\n let counter = 0;\n // ref: http://stackoverflow.com/a/6248722/2519373\n const random = () => \n // eslint-disable-next-line no-bitwise\n `0000${((Math.random() * 36 ** 4) << 0).toString(36)}`.slice(-4);\n return () => {\n counter += 1;\n return `u${random()}${counter}`;\n };\n})();\nexport function delay(ms) {\n return (args) => new Promise((resolve) => {\n setTimeout(() => resolve(args), ms);\n });\n}\nexport function toArray(arrayLike) {\n const arr = [];\n for (let i = 0, l = arrayLike.length; i < l; i++) {\n arr.push(arrayLike[i]);\n }\n return arr;\n}\nfunction px(node, styleProperty) {\n const win = node.ownerDocument.defaultView || window;\n const val = win.getComputedStyle(node).getPropertyValue(styleProperty);\n return val ? parseFloat(val.replace('px', '')) : 0;\n}\nfunction getNodeWidth(node) {\n const leftBorder = px(node, 'border-left-width');\n const rightBorder = px(node, 'border-right-width');\n return node.clientWidth + leftBorder + rightBorder;\n}\nfunction getNodeHeight(node) {\n const topBorder = px(node, 'border-top-width');\n const bottomBorder = px(node, 'border-bottom-width');\n return node.clientHeight + topBorder + bottomBorder;\n}\nexport function getImageSize(targetNode, options = {}) {\n const width = options.width || getNodeWidth(targetNode);\n const height = options.height || getNodeHeight(targetNode);\n return { width, height };\n}\nexport function getPixelRatio() {\n let ratio;\n let FINAL_PROCESS;\n try {\n FINAL_PROCESS = process;\n }\n catch (e) {\n // pass\n }\n const val = FINAL_PROCESS && FINAL_PROCESS.env\n ? FINAL_PROCESS.env.devicePixelRatio\n : null;\n if (val) {\n ratio = parseInt(val, 10);\n if (Number.isNaN(ratio)) {\n ratio = 1;\n }\n }\n return ratio || window.devicePixelRatio || 1;\n}\n// @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/canvas#maximum_canvas_size\nconst canvasDimensionLimit = 16384;\nexport function checkCanvasDimensions(canvas) {\n if (canvas.width > canvasDimensionLimit ||\n canvas.height > canvasDimensionLimit) {\n if (canvas.width > canvasDimensionLimit &&\n canvas.height > canvasDimensionLimit) {\n if (canvas.width > canvas.height) {\n canvas.height *= canvasDimensionLimit / canvas.width;\n canvas.width = canvasDimensionLimit;\n }\n else {\n canvas.width *= canvasDimensionLimit / canvas.height;\n canvas.height = canvasDimensionLimit;\n }\n }\n else if (canvas.width > canvasDimensionLimit) {\n canvas.height *= canvasDimensionLimit / canvas.width;\n canvas.width = canvasDimensionLimit;\n }\n else {\n canvas.width *= canvasDimensionLimit / canvas.height;\n canvas.height = canvasDimensionLimit;\n }\n }\n}\nexport function canvasToBlob(canvas, options = {}) {\n if (canvas.toBlob) {\n return new Promise((resolve) => {\n canvas.toBlob(resolve, options.type ? options.type : 'image/png', options.quality ? options.quality : 1);\n });\n }\n return new Promise((resolve) => {\n const binaryString = window.atob(canvas\n .toDataURL(options.type ? options.type : undefined, options.quality ? options.quality : undefined)\n .split(',')[1]);\n const len = binaryString.length;\n const binaryArray = new Uint8Array(len);\n for (let i = 0; i < len; i += 1) {\n binaryArray[i] = binaryString.charCodeAt(i);\n }\n resolve(new Blob([binaryArray], {\n type: options.type ? options.type : 'image/png',\n }));\n });\n}\nexport function createImage(url) {\n return new Promise((resolve, reject) => {\n const img = new Image();\n img.decode = () => resolve(img);\n img.onload = () => resolve(img);\n img.onerror = reject;\n img.crossOrigin = 'anonymous';\n img.decoding = 'async';\n img.src = url;\n });\n}\nexport async function svgToDataURL(svg) {\n return Promise.resolve()\n .then(() => new XMLSerializer().serializeToString(svg))\n .then(encodeURIComponent)\n .then((html) => `data:image/svg+xml;charset=utf-8,${html}`);\n}\nexport async function nodeToDataURL(node, width, height) {\n const xmlns = 'http://www.w3.org/2000/svg';\n const svg = document.createElementNS(xmlns, 'svg');\n const foreignObject = document.createElementNS(xmlns, 'foreignObject');\n svg.setAttribute('width', `${width}`);\n svg.setAttribute('height', `${height}`);\n svg.setAttribute('viewBox', `0 0 ${width} ${height}`);\n foreignObject.setAttribute('width', '100%');\n foreignObject.setAttribute('height', '100%');\n foreignObject.setAttribute('x', '0');\n foreignObject.setAttribute('y', '0');\n foreignObject.setAttribute('externalResourcesRequired', 'true');\n svg.appendChild(foreignObject);\n foreignObject.appendChild(node);\n return svgToDataURL(svg);\n}\nexport const isInstanceOfElement = (node, instance) => {\n if (node instanceof instance)\n return true;\n const nodePrototype = Object.getPrototypeOf(node);\n if (nodePrototype === null)\n return false;\n return (nodePrototype.constructor.name === instance.name ||\n isInstanceOfElement(nodePrototype, instance));\n};\n//# sourceMappingURL=util.js.map","import { uuid, toArray } from './util';\nfunction formatCSSText(style) {\n const content = style.getPropertyValue('content');\n return `${style.cssText} content: '${content.replace(/'|\"/g, '')}';`;\n}\nfunction formatCSSProperties(style) {\n return toArray(style)\n .map((name) => {\n const value = style.getPropertyValue(name);\n const priority = style.getPropertyPriority(name);\n return `${name}: ${value}${priority ? ' !important' : ''};`;\n })\n .join(' ');\n}\nfunction getPseudoElementStyle(className, pseudo, style) {\n const selector = `.${className}:${pseudo}`;\n const cssText = style.cssText\n ? formatCSSText(style)\n : formatCSSProperties(style);\n return document.createTextNode(`${selector}{${cssText}}`);\n}\nfunction clonePseudoElement(nativeNode, clonedNode, pseudo) {\n const style = window.getComputedStyle(nativeNode, pseudo);\n const content = style.getPropertyValue('content');\n if (content === '' || content === 'none') {\n return;\n }\n const className = uuid();\n try {\n clonedNode.className = `${clonedNode.className} ${className}`;\n }\n catch (err) {\n return;\n }\n const styleElement = document.createElement('style');\n styleElement.appendChild(getPseudoElementStyle(className, pseudo, style));\n clonedNode.appendChild(styleElement);\n}\nexport function clonePseudoElements(nativeNode, clonedNode) {\n clonePseudoElement(nativeNode, clonedNode, ':before');\n clonePseudoElement(nativeNode, clonedNode, ':after');\n}\n//# sourceMappingURL=clone-pseudos.js.map","const WOFF = 'application/font-woff';\nconst JPEG = 'image/jpeg';\nconst mimes = {\n woff: WOFF,\n woff2: WOFF,\n ttf: 'application/font-truetype',\n eot: 'application/vnd.ms-fontobject',\n png: 'image/png',\n jpg: JPEG,\n jpeg: JPEG,\n gif: 'image/gif',\n tiff: 'image/tiff',\n svg: 'image/svg+xml',\n webp: 'image/webp',\n};\nfunction getExtension(url) {\n const match = /\\.([^./]*?)$/g.exec(url);\n return match ? match[1] : '';\n}\nexport function getMimeType(url) {\n const extension = getExtension(url).toLowerCase();\n return mimes[extension] || '';\n}\n//# sourceMappingURL=mimes.js.map","function getContentFromDataUrl(dataURL) {\n return dataURL.split(/,/)[1];\n}\nexport function isDataUrl(url) {\n return url.search(/^(data:)/) !== -1;\n}\nexport function makeDataUrl(content, mimeType) {\n return `data:${mimeType};base64,${content}`;\n}\nexport async function fetchAsDataURL(url, init, process) {\n const res = await fetch(url, init);\n if (res.status === 404) {\n throw new Error(`Resource \"${res.url}\" not found`);\n }\n const blob = await res.blob();\n return new Promise((resolve, reject) => {\n const reader = new FileReader();\n reader.onerror = reject;\n reader.onloadend = () => {\n try {\n resolve(process({ res, result: reader.result }));\n }\n catch (error) {\n reject(error);\n }\n };\n reader.readAsDataURL(blob);\n });\n}\nconst cache = {};\nfunction getCacheKey(url, contentType, includeQueryParams) {\n let key = url.replace(/\\?.*/, '');\n if (includeQueryParams) {\n key = url;\n }\n // font resource\n if (/ttf|otf|eot|woff2?/i.test(key)) {\n key = key.replace(/.*\\//, '');\n }\n return contentType ? `[${contentType}]${key}` : key;\n}\nexport async function resourceToDataURL(resourceUrl, contentType, options) {\n const cacheKey = getCacheKey(resourceUrl, contentType, options.includeQueryParams);\n if (cache[cacheKey] != null) {\n return cache[cacheKey];\n }\n // ref: https://developer.mozilla.org/en/docs/Web/API/XMLHttpRequest/Using_XMLHttpRequest#Bypassing_the_cache\n if (options.cacheBust) {\n // eslint-disable-next-line no-param-reassign\n resourceUrl += (/\\?/.test(resourceUrl) ? '&' : '?') + new Date().getTime();\n }\n let dataURL;\n try {\n const content = await fetchAsDataURL(resourceUrl, options.fetchRequestInit, ({ res, result }) => {\n if (!contentType) {\n // eslint-disable-next-line no-param-reassign\n contentType = res.headers.get('Content-Type') || '';\n }\n return getContentFromDataUrl(result);\n });\n dataURL = makeDataUrl(content, contentType);\n }\n catch (error) {\n dataURL = options.imagePlaceholder || '';\n let msg = `Failed to fetch resource: ${resourceUrl}`;\n if (error) {\n msg = typeof error === 'string' ? error : error.message;\n }\n if (msg) {\n console.warn(msg);\n }\n }\n cache[cacheKey] = dataURL;\n return dataURL;\n}\n//# sourceMappingURL=dataurl.js.map","import { clonePseudoElements } from './clone-pseudos';\nimport { createImage, toArray, isInstanceOfElement } from './util';\nimport { getMimeType } from './mimes';\nimport { resourceToDataURL } from './dataurl';\nasync function cloneCanvasElement(canvas) {\n const dataURL = canvas.toDataURL();\n if (dataURL === 'data:,') {\n return canvas.cloneNode(false);\n }\n return createImage(dataURL);\n}\nasync function cloneVideoElement(video, options) {\n if (video.currentSrc) {\n const canvas = document.createElement('canvas');\n const ctx = canvas.getContext('2d');\n canvas.width = video.clientWidth;\n canvas.height = video.clientHeight;\n ctx === null || ctx === void 0 ? void 0 : ctx.drawImage(video, 0, 0, canvas.width, canvas.height);\n const dataURL = canvas.toDataURL();\n return createImage(dataURL);\n }\n const poster = video.poster;\n const contentType = getMimeType(poster);\n const dataURL = await resourceToDataURL(poster, contentType, options);\n return createImage(dataURL);\n}\nasync function cloneIFrameElement(iframe) {\n var _a;\n try {\n if ((_a = iframe === null || iframe === void 0 ? void 0 : iframe.contentDocument) === null || _a === void 0 ? void 0 : _a.body) {\n return (await cloneNode(iframe.contentDocument.body, {}, true));\n }\n }\n catch (_b) {\n // Failed to clone iframe\n }\n return iframe.cloneNode(false);\n}\nasync function cloneSingleNode(node, options) {\n if (isInstanceOfElement(node, HTMLCanvasElement)) {\n return cloneCanvasElement(node);\n }\n if (isInstanceOfElement(node, HTMLVideoElement)) {\n return cloneVideoElement(node, options);\n }\n if (isInstanceOfElement(node, HTMLIFrameElement)) {\n return cloneIFrameElement(node);\n }\n return node.cloneNode(false);\n}\nconst isSlotElement = (node) => node.tagName != null && node.tagName.toUpperCase() === 'SLOT';\nasync function cloneChildren(nativeNode, clonedNode, options) {\n var _a, _b;\n let children = [];\n if (isSlotElement(nativeNode) && nativeNode.assignedNodes) {\n children = toArray(nativeNode.assignedNodes());\n }\n else if (isInstanceOfElement(nativeNode, HTMLIFrameElement) &&\n ((_a = nativeNode.contentDocument) === null || _a === void 0 ? void 0 : _a.body)) {\n children = toArray(nativeNode.contentDocument.body.childNodes);\n }\n else {\n children = toArray(((_b = nativeNode.shadowRoot) !== null && _b !== void 0 ? _b : nativeNode).childNodes);\n }\n if (children.length === 0 ||\n isInstanceOfElement(nativeNode, HTMLVideoElement)) {\n return clonedNode;\n }\n await children.reduce((deferred, child) => deferred\n .then(() => cloneNode(child, options))\n .then((clonedChild) => {\n if (clonedChild) {\n clonedNode.appendChild(clonedChild);\n }\n }), Promise.resolve());\n return clonedNode;\n}\nfunction cloneCSSStyle(nativeNode, clonedNode) {\n const targetStyle = clonedNode.style;\n if (!targetStyle) {\n return;\n }\n const sourceStyle = window.getComputedStyle(nativeNode);\n if (sourceStyle.cssText) {\n targetStyle.cssText = sourceStyle.cssText;\n targetStyle.transformOrigin = sourceStyle.transformOrigin;\n }\n else {\n toArray(sourceStyle).forEach((name) => {\n let value = sourceStyle.getPropertyValue(name);\n if (name === 'font-size' && value.endsWith('px')) {\n const reducedFont = Math.floor(parseFloat(value.substring(0, value.length - 2))) - 0.1;\n value = `${reducedFont}px`;\n }\n if (isInstanceOfElement(nativeNode, HTMLIFrameElement) &&\n name === 'display' &&\n value === 'inline') {\n value = 'block';\n }\n if (name === 'd' && clonedNode.getAttribute('d')) {\n value = `path(${clonedNode.getAttribute('d')})`;\n }\n targetStyle.setProperty(name, value, sourceStyle.getPropertyPriority(name));\n });\n }\n}\nfunction cloneInputValue(nativeNode, clonedNode) {\n if (isInstanceOfElement(nativeNode, HTMLTextAreaElement)) {\n clonedNode.innerHTML = nativeNode.value;\n }\n if (isInstanceOfElement(nativeNode, HTMLInputElement)) {\n clonedNode.setAttribute('value', nativeNode.value);\n }\n}\nfunction cloneSelectValue(nativeNode, clonedNode) {\n if (isInstanceOfElement(nativeNode, HTMLSelectElement)) {\n const clonedSelect = clonedNode;\n const selectedOption = Array.from(clonedSelect.children).find((child) => nativeNode.value === child.getAttribute('value'));\n if (selectedOption) {\n selectedOption.setAttribute('selected', '');\n }\n }\n}\nfunction decorate(nativeNode, clonedNode) {\n if (isInstanceOfElement(clonedNode, Element)) {\n cloneCSSStyle(nativeNode, clonedNode);\n clonePseudoElements(nativeNode, clonedNode);\n cloneInputValue(nativeNode, clonedNode);\n cloneSelectValue(nativeNode, clonedNode);\n }\n return clonedNode;\n}\nasync function ensureSVGSymbols(clone, options) {\n const uses = clone.querySelectorAll ? clone.querySelectorAll('use') : [];\n if (uses.length === 0) {\n return clone;\n }\n const processedDefs = {};\n for (let i = 0; i < uses.length; i++) {\n const use = uses[i];\n const id = use.getAttribute('xlink:href');\n if (id) {\n const exist = clone.querySelector(id);\n const definition = document.querySelector(id);\n if (!exist && definition && !processedDefs[id]) {\n // eslint-disable-next-line no-await-in-loop\n processedDefs[id] = (await cloneNode(definition, options, true));\n }\n }\n }\n const nodes = Object.values(processedDefs);\n if (nodes.length) {\n const ns = 'http://www.w3.org/1999/xhtml';\n const svg = document.createElementNS(ns, 'svg');\n svg.setAttribute('xmlns', ns);\n svg.style.position = 'absolute';\n svg.style.width = '0';\n svg.style.height = '0';\n svg.style.overflow = 'hidden';\n svg.style.display = 'none';\n const defs = document.createElementNS(ns, 'defs');\n svg.appendChild(defs);\n for (let i = 0; i < nodes.length; i++) {\n defs.appendChild(nodes[i]);\n }\n clone.appendChild(svg);\n }\n return clone;\n}\nexport async function cloneNode(node, options, isRoot) {\n if (!isRoot && options.filter && !options.filter(node)) {\n return null;\n }\n return Promise.resolve(node)\n .then((clonedNode) => cloneSingleNode(clonedNode, options))\n .then((clonedNode) => cloneChildren(node, clonedNode, options))\n .then((clonedNode) => decorate(node, clonedNode))\n .then((clonedNode) => ensureSVGSymbols(clonedNode, options));\n}\n//# sourceMappingURL=clone-node.js.map","import { resolveUrl } from './util';\nimport { getMimeType } from './mimes';\nimport { isDataUrl, makeDataUrl, resourceToDataURL } from './dataurl';\nconst URL_REGEX = /url\\((['\"]?)([^'\"]+?)\\1\\)/g;\nconst URL_WITH_FORMAT_REGEX = /url\\([^)]+\\)\\s*format\\(([\"']?)([^\"']+)\\1\\)/g;\nconst FONT_SRC_REGEX = /src:\\s*(?:url\\([^)]+\\)\\s*format\\([^)]+\\)[,;]\\s*)+/g;\nfunction toRegex(url) {\n // eslint-disable-next-line no-useless-escape\n const escaped = url.replace(/([.*+?^${}()|\\[\\]\\/\\\\])/g, '\\\\$1');\n return new RegExp(`(url\\\\(['\"]?)(${escaped})(['\"]?\\\\))`, 'g');\n}\nexport function parseURLs(cssText) {\n const urls = [];\n cssText.replace(URL_REGEX, (raw, quotation, url) => {\n urls.push(url);\n return raw;\n });\n return urls.filter((url) => !isDataUrl(url));\n}\nexport async function embed(cssText, resourceURL, baseURL, options, getContentFromUrl) {\n try {\n const resolvedURL = baseURL ? resolveUrl(resourceURL, baseURL) : resourceURL;\n const contentType = getMimeType(resourceURL);\n let dataURL;\n if (getContentFromUrl) {\n const content = await getContentFromUrl(resolvedURL);\n dataURL = makeDataUrl(content, contentType);\n }\n else {\n dataURL = await resourceToDataURL(resolvedURL, contentType, options);\n }\n return cssText.replace(toRegex(resourceURL), `$1${dataURL}$3`);\n }\n catch (error) {\n // pass\n }\n return cssText;\n}\nfunction filterPreferredFontFormat(str, { preferredFontFormat }) {\n return !preferredFontFormat\n ? str\n : str.replace(FONT_SRC_REGEX, (match) => {\n // eslint-disable-next-line no-constant-condition\n while (true) {\n const [src, , format] = URL_WITH_FORMAT_REGEX.exec(match) || [];\n if (!format) {\n return '';\n }\n if (format === preferredFontFormat) {\n return `src: ${src};`;\n }\n }\n });\n}\nexport function shouldEmbed(url) {\n return url.search(URL_REGEX) !== -1;\n}\nexport async function embedResources(cssText, baseUrl, options) {\n if (!shouldEmbed(cssText)) {\n return cssText;\n }\n const filteredCSSText = filterPreferredFontFormat(cssText, options);\n const urls = parseURLs(filteredCSSText);\n return urls.reduce((deferred, url) => deferred.then((css) => embed(css, url, baseUrl, options)), Promise.resolve(filteredCSSText));\n}\n//# sourceMappingURL=embed-resources.js.map","import { embedResources } from './embed-resources';\nimport { toArray, isInstanceOfElement } from './util';\nimport { isDataUrl, resourceToDataURL } from './dataurl';\nimport { getMimeType } from './mimes';\nasync function embedProp(propName, node, options) {\n var _a;\n const propValue = (_a = node.style) === null || _a === void 0 ? void 0 : _a.getPropertyValue(propName);\n if (propValue) {\n const cssString = await embedResources(propValue, null, options);\n node.style.setProperty(propName, cssString, node.style.getPropertyPriority(propName));\n return true;\n }\n return false;\n}\nasync function embedBackground(clonedNode, options) {\n if (!(await embedProp('background', clonedNode, options))) {\n await embedProp('background-image', clonedNode, options);\n }\n if (!(await embedProp('mask', clonedNode, options))) {\n await embedProp('mask-image', clonedNode, options);\n }\n}\nasync function embedImageNode(clonedNode, options) {\n const isImageElement = isInstanceOfElement(clonedNode, HTMLImageElement);\n if (!(isImageElement && !isDataUrl(clonedNode.src)) &&\n !(isInstanceOfElement(clonedNode, SVGImageElement) &&\n !isDataUrl(clonedNode.href.baseVal))) {\n return;\n }\n const url = isImageElement ? clonedNode.src : clonedNode.href.baseVal;\n const dataURL = await resourceToDataURL(url, getMimeType(url), options);\n await new Promise((resolve, reject) => {\n clonedNode.onload = resolve;\n clonedNode.onerror = reject;\n const image = clonedNode;\n if (image.decode) {\n image.decode = resolve;\n }\n if (image.loading === 'lazy') {\n image.loading = 'eager';\n }\n if (isImageElement) {\n clonedNode.srcset = '';\n clonedNode.src = dataURL;\n }\n else {\n clonedNode.href.baseVal = dataURL;\n }\n });\n}\nasync function embedChildren(clonedNode, options) {\n const children = toArray(clonedNode.childNodes);\n const deferreds = children.map((child) => embedImages(child, options));\n await Promise.all(deferreds).then(() => clonedNode);\n}\nexport async function embedImages(clonedNode, options) {\n if (isInstanceOfElement(clonedNode, Element)) {\n await embedBackground(clonedNode, options);\n await embedImageNode(clonedNode, options);\n await embedChildren(clonedNode, options);\n }\n}\n//# sourceMappingURL=embed-images.js.map","export function applyStyle(node, options) {\n const { style } = node;\n if (options.backgroundColor) {\n style.backgroundColor = options.backgroundColor;\n }\n if (options.width) {\n style.width = `${options.width}px`;\n }\n if (options.height) {\n style.height = `${options.height}px`;\n }\n const manual = options.style;\n if (manual != null) {\n Object.keys(manual).forEach((key) => {\n style[key] = manual[key];\n });\n }\n return node;\n}\n//# sourceMappingURL=apply-style.js.map","import { toArray } from './util';\nimport { fetchAsDataURL } from './dataurl';\nimport { shouldEmbed, embedResources } from './embed-resources';\nconst cssFetchCache = {};\nasync function fetchCSS(url) {\n let cache = cssFetchCache[url];\n if (cache != null) {\n return cache;\n }\n const res = await fetch(url);\n const cssText = await res.text();\n cache = { url, cssText };\n cssFetchCache[url] = cache;\n return cache;\n}\nasync function embedFonts(data, options) {\n let cssText = data.cssText;\n const regexUrl = /url\\([\"']?([^\"')]+)[\"']?\\)/g;\n const fontLocs = cssText.match(/url\\([^)]+\\)/g) || [];\n const loadFonts = fontLocs.map(async (loc) => {\n let url = loc.replace(regexUrl, '$1');\n if (!url.startsWith('https://')) {\n url = new URL(url, data.url).href;\n }\n return fetchAsDataURL(url, options.fetchRequestInit, ({ result }) => {\n cssText = cssText.replace(loc, `url(${result})`);\n return [loc, result];\n });\n });\n return Promise.all(loadFonts).then(() => cssText);\n}\nfunction parseCSS(source) {\n if (source == null) {\n return [];\n }\n const result = [];\n const commentsRegex = /(\\/\\*[\\s\\S]*?\\*\\/)/gi;\n // strip out comments\n let cssText = source.replace(commentsRegex, '');\n // eslint-disable-next-line prefer-regex-literals\n const keyframesRegex = new RegExp('((@.*?keyframes [\\\\s\\\\S]*?){([\\\\s\\\\S]*?}\\\\s*?)})', 'gi');\n // eslint-disable-next-line no-constant-condition\n while (true) {\n const matches = keyframesRegex.exec(cssText);\n if (matches === null) {\n break;\n }\n result.push(matches[0]);\n }\n cssText = cssText.replace(keyframesRegex, '');\n const importRegex = /@import[\\s\\S]*?url\\([^)]*\\)[\\s\\S]*?;/gi;\n // to match css & media queries together\n const combinedCSSRegex = '((\\\\s*?(?:\\\\/\\\\*[\\\\s\\\\S]*?\\\\*\\\\/)?\\\\s*?@media[\\\\s\\\\S]' +\n '*?){([\\\\s\\\\S]*?)}\\\\s*?})|(([\\\\s\\\\S]*?){([\\\\s\\\\S]*?)})';\n // unified regex\n const unifiedRegex = new RegExp(combinedCSSRegex, 'gi');\n // eslint-disable-next-line no-constant-condition\n while (true) {\n let matches = importRegex.exec(cssText);\n if (matches === null) {\n matches = unifiedRegex.exec(cssText);\n if (matches === null) {\n break;\n }\n else {\n importRegex.lastIndex = unifiedRegex.lastIndex;\n }\n }\n else {\n unifiedRegex.lastIndex = importRegex.lastIndex;\n }\n result.push(matches[0]);\n }\n return result;\n}\nasync function getCSSRules(styleSheets, options) {\n const ret = [];\n const deferreds = [];\n // First loop inlines imports\n styleSheets.forEach((sheet) => {\n if ('cssRules' in sheet) {\n try {\n toArray(sheet.cssRules || []).forEach((item, index) => {\n if (item.type === CSSRule.IMPORT_RULE) {\n let importIndex = index + 1;\n const url = item.href;\n const deferred = fetchCSS(url)\n .then((metadata) => embedFonts(metadata, options))\n .then((cssText) => parseCSS(cssText).forEach((rule) => {\n try {\n sheet.insertRule(rule, rule.startsWith('@import')\n ? (importIndex += 1)\n : sheet.cssRules.length);\n }\n catch (error) {\n console.error('Error inserting rule from remote css', {\n rule,\n error,\n });\n }\n }))\n .catch((e) => {\n console.error('Error loading remote css', e.toString());\n });\n deferreds.push(deferred);\n }\n });\n }\n catch (e) {\n const inline = styleSheets.find((a) => a.href == null) || document.styleSheets[0];\n if (sheet.href != null) {\n deferreds.push(fetchCSS(sheet.href)\n .then((metadata) => embedFonts(metadata, options))\n .then((cssText) => parseCSS(cssText).forEach((rule) => {\n inline.insertRule(rule, sheet.cssRules.length);\n }))\n .catch((err) => {\n console.error('Error loading remote stylesheet', err);\n }));\n }\n console.error('Error inlining remote css file', e);\n }\n }\n });\n return Promise.all(deferreds).then(() => {\n // Second loop parses rules\n styleSheets.forEach((sheet) => {\n if ('cssRules' in sheet) {\n try {\n toArray(sheet.cssRules || []).forEach((item) => {\n ret.push(item);\n });\n }\n catch (e) {\n console.error(`Error while reading CSS rules from ${sheet.href}`, e);\n }\n }\n });\n return ret;\n });\n}\nfunction getWebFontRules(cssRules) {\n return cssRules\n .filter((rule) => rule.type === CSSRule.FONT_FACE_RULE)\n .filter((rule) => shouldEmbed(rule.style.getPropertyValue('src')));\n}\nasync function parseWebFontRules(node, options) {\n if (node.ownerDocument == null) {\n throw new Error('Provided element is not within a Document');\n }\n const styleSheets = toArray(node.ownerDocument.styleSheets);\n const cssRules = await getCSSRules(styleSheets, options);\n return getWebFontRules(cssRules);\n}\nexport async function getWebFontCSS(node, options) {\n const rules = await parseWebFontRules(node, options);\n const cssTexts = await Promise.all(rules.map((rule) => {\n const baseUrl = rule.parentStyleSheet ? rule.parentStyleSheet.href : null;\n return embedResources(rule.cssText, baseUrl, options);\n }));\n return cssTexts.join('\\n');\n}\nexport async function embedWebFonts(clonedNode, options) {\n const cssText = options.fontEmbedCSS != null\n ? options.fontEmbedCSS\n : options.skipFonts\n ? null\n : await getWebFontCSS(clonedNode, options);\n if (cssText) {\n const styleNode = document.createElement('style');\n const sytleContent = document.createTextNode(cssText);\n styleNode.appendChild(sytleContent);\n if (clonedNode.firstChild) {\n clonedNode.insertBefore(styleNode, clonedNode.firstChild);\n }\n else {\n clonedNode.appendChild(styleNode);\n }\n }\n}\n//# sourceMappingURL=embed-webfonts.js.map","import { cloneNode } from './clone-node';\nimport { embedImages } from './embed-images';\nimport { applyStyle } from './apply-style';\nimport { embedWebFonts, getWebFontCSS } from './embed-webfonts';\nimport { getImageSize, getPixelRatio, createImage, canvasToBlob, nodeToDataURL, checkCanvasDimensions, } from './util';\nexport async function toSvg(node, options = {}) {\n const { width, height } = getImageSize(node, options);\n const clonedNode = (await cloneNode(node, options, true));\n await embedWebFonts(clonedNode, options);\n await embedImages(clonedNode, options);\n applyStyle(clonedNode, options);\n const datauri = await nodeToDataURL(clonedNode, width, height);\n return datauri;\n}\nexport async function toCanvas(node, options = {}) {\n const { width, height } = getImageSize(node, options);\n const svg = await toSvg(node, options);\n const img = await createImage(svg);\n const canvas = document.createElement('canvas');\n const context = canvas.getContext('2d');\n const ratio = options.pixelRatio || getPixelRatio();\n const canvasWidth = options.canvasWidth || width;\n const canvasHeight = options.canvasHeight || height;\n canvas.width = canvasWidth * ratio;\n canvas.height = canvasHeight * ratio;\n if (!options.skipAutoScale) {\n checkCanvasDimensions(canvas);\n }\n canvas.style.width = `${canvasWidth}`;\n canvas.style.height = `${canvasHeight}`;\n if (options.backgroundColor) {\n context.fillStyle = options.backgroundColor;\n context.fillRect(0, 0, canvas.width, canvas.height);\n }\n context.drawImage(img, 0, 0, canvas.width, canvas.height);\n return canvas;\n}\nexport async function toPixelData(node, options = {}) {\n const { width, height } = getImageSize(node, options);\n const canvas = await toCanvas(node, options);\n const ctx = canvas.getContext('2d');\n return ctx.getImageData(0, 0, width, height).data;\n}\nexport async function toPng(node, options = {}) {\n const canvas = await toCanvas(node, options);\n return canvas.toDataURL();\n}\nexport async function toJpeg(node, options = {}) {\n const canvas = await toCanvas(node, options);\n return canvas.toDataURL('image/jpeg', options.quality || 1);\n}\nexport async function toBlob(node, options = {}) {\n const canvas = await toCanvas(node, options);\n const blob = await canvasToBlob(canvas);\n return blob;\n}\nexport async function getFontEmbedCSS(node, options = {}) {\n return getWebFontCSS(node, options);\n}\n//# sourceMappingURL=index.js.map","'use strict';\nmodule.exports = (promise, onFinally) => {\n\tonFinally = onFinally || (() => {});\n\n\treturn promise.then(\n\t\tval => new Promise(resolve => {\n\t\t\tresolve(onFinally());\n\t\t}).then(() => val),\n\t\terr => new Promise(resolve => {\n\t\t\tresolve(onFinally());\n\t\t}).then(() => {\n\t\t\tthrow err;\n\t\t})\n\t);\n};\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst EventEmitter = require(\"eventemitter3\");\nconst p_timeout_1 = require(\"p-timeout\");\nconst priority_queue_1 = require(\"./priority-queue\");\n// eslint-disable-next-line @typescript-eslint/no-empty-function\nconst empty = () => { };\nconst timeoutError = new p_timeout_1.TimeoutError();\n/**\nPromise queue with concurrency control.\n*/\nclass PQueue extends EventEmitter {\n constructor(options) {\n var _a, _b, _c, _d;\n super();\n this._intervalCount = 0;\n this._intervalEnd = 0;\n this._pendingCount = 0;\n this._resolveEmpty = empty;\n this._resolveIdle = empty;\n // eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n options = Object.assign({ carryoverConcurrencyCount: false, intervalCap: Infinity, interval: 0, concurrency: Infinity, autoStart: true, queueClass: priority_queue_1.default }, options);\n if (!(typeof options.intervalCap === 'number' && options.intervalCap >= 1)) {\n throw new TypeError(`Expected \\`intervalCap\\` to be a number from 1 and up, got \\`${(_b = (_a = options.intervalCap) === null || _a === void 0 ? void 0 : _a.toString()) !== null && _b !== void 0 ? _b : ''}\\` (${typeof options.intervalCap})`);\n }\n if (options.interval === undefined || !(Number.isFinite(options.interval) && options.interval >= 0)) {\n throw new TypeError(`Expected \\`interval\\` to be a finite number >= 0, got \\`${(_d = (_c = options.interval) === null || _c === void 0 ? void 0 : _c.toString()) !== null && _d !== void 0 ? _d : ''}\\` (${typeof options.interval})`);\n }\n this._carryoverConcurrencyCount = options.carryoverConcurrencyCount;\n this._isIntervalIgnored = options.intervalCap === Infinity || options.interval === 0;\n this._intervalCap = options.intervalCap;\n this._interval = options.interval;\n this._queue = new options.queueClass();\n this._queueClass = options.queueClass;\n this.concurrency = options.concurrency;\n this._timeout = options.timeout;\n this._throwOnTimeout = options.throwOnTimeout === true;\n this._isPaused = options.autoStart === false;\n }\n get _doesIntervalAllowAnother() {\n return this._isIntervalIgnored || this._intervalCount < this._intervalCap;\n }\n get _doesConcurrentAllowAnother() {\n return this._pendingCount < this._concurrency;\n }\n _next() {\n this._pendingCount--;\n this._tryToStartAnother();\n this.emit('next');\n }\n _resolvePromises() {\n this._resolveEmpty();\n this._resolveEmpty = empty;\n if (this._pendingCount === 0) {\n this._resolveIdle();\n this._resolveIdle = empty;\n this.emit('idle');\n }\n }\n _onResumeInterval() {\n this._onInterval();\n this._initializeIntervalIfNeeded();\n this._timeoutId = undefined;\n }\n _isIntervalPaused() {\n const now = Date.now();\n if (this._intervalId === undefined) {\n const delay = this._intervalEnd - now;\n if (delay < 0) {\n // Act as the interval was done\n // We don't need to resume it here because it will be resumed on line 160\n this._intervalCount = (this._carryoverConcurrencyCount) ? this._pendingCount : 0;\n }\n else {\n // Act as the interval is pending\n if (this._timeoutId === undefined) {\n this._timeoutId = setTimeout(() => {\n this._onResumeInterval();\n }, delay);\n }\n return true;\n }\n }\n return false;\n }\n _tryToStartAnother() {\n if (this._queue.size === 0) {\n // We can clear the interval (\"pause\")\n // Because we can redo it later (\"resume\")\n if (this._intervalId) {\n clearInterval(this._intervalId);\n }\n this._intervalId = undefined;\n this._resolvePromises();\n return false;\n }\n if (!this._isPaused) {\n const canInitializeInterval = !this._isIntervalPaused();\n if (this._doesIntervalAllowAnother && this._doesConcurrentAllowAnother) {\n const job = this._queue.dequeue();\n if (!job) {\n return false;\n }\n this.emit('active');\n job();\n if (canInitializeInterval) {\n this._initializeIntervalIfNeeded();\n }\n return true;\n }\n }\n return false;\n }\n _initializeIntervalIfNeeded() {\n if (this._isIntervalIgnored || this._intervalId !== undefined) {\n return;\n }\n this._intervalId = setInterval(() => {\n this._onInterval();\n }, this._interval);\n this._intervalEnd = Date.now() + this._interval;\n }\n _onInterval() {\n if (this._intervalCount === 0 && this._pendingCount === 0 && this._intervalId) {\n clearInterval(this._intervalId);\n this._intervalId = undefined;\n }\n this._intervalCount = this._carryoverConcurrencyCount ? this._pendingCount : 0;\n this._processQueue();\n }\n /**\n Executes all queued functions until it reaches the limit.\n */\n _processQueue() {\n // eslint-disable-next-line no-empty\n while (this._tryToStartAnother()) { }\n }\n get concurrency() {\n return this._concurrency;\n }\n set concurrency(newConcurrency) {\n if (!(typeof newConcurrency === 'number' && newConcurrency >= 1)) {\n throw new TypeError(`Expected \\`concurrency\\` to be a number from 1 and up, got \\`${newConcurrency}\\` (${typeof newConcurrency})`);\n }\n this._concurrency = newConcurrency;\n this._processQueue();\n }\n /**\n Adds a sync or async task to the queue. Always returns a promise.\n */\n async add(fn, options = {}) {\n return new Promise((resolve, reject) => {\n const run = async () => {\n this._pendingCount++;\n this._intervalCount++;\n try {\n const operation = (this._timeout === undefined && options.timeout === undefined) ? fn() : p_timeout_1.default(Promise.resolve(fn()), (options.timeout === undefined ? this._timeout : options.timeout), () => {\n if (options.throwOnTimeout === undefined ? this._throwOnTimeout : options.throwOnTimeout) {\n reject(timeoutError);\n }\n return undefined;\n });\n resolve(await operation);\n }\n catch (error) {\n reject(error);\n }\n this._next();\n };\n this._queue.enqueue(run, options);\n this._tryToStartAnother();\n this.emit('add');\n });\n }\n /**\n Same as `.add()`, but accepts an array of sync or async functions.\n\n @returns A promise that resolves when all functions are resolved.\n */\n async addAll(functions, options) {\n return Promise.all(functions.map(async (function_) => this.add(function_, options)));\n }\n /**\n Start (or resume) executing enqueued tasks within concurrency limit. No need to call this if queue is not paused (via `options.autoStart = false` or by `.pause()` method.)\n */\n start() {\n if (!this._isPaused) {\n return this;\n }\n this._isPaused = false;\n this._processQueue();\n return this;\n }\n /**\n Put queue execution on hold.\n */\n pause() {\n this._isPaused = true;\n }\n /**\n Clear the queue.\n */\n clear() {\n this._queue = new this._queueClass();\n }\n /**\n Can be called multiple times. Useful if you for example add additional items at a later time.\n\n @returns A promise that settles when the queue becomes empty.\n */\n async onEmpty() {\n // Instantly resolve if the queue is empty\n if (this._queue.size === 0) {\n return;\n }\n return new Promise(resolve => {\n const existingResolve = this._resolveEmpty;\n this._resolveEmpty = () => {\n existingResolve();\n resolve();\n };\n });\n }\n /**\n The difference with `.onEmpty` is that `.onIdle` guarantees that all work from the queue has finished. `.onEmpty` merely signals that the queue is empty, but it could mean that some promises haven't completed yet.\n\n @returns A promise that settles when the queue becomes empty, and all promises have completed; `queue.size === 0 && queue.pending === 0`.\n */\n async onIdle() {\n // Instantly resolve if none pending and if nothing else is queued\n if (this._pendingCount === 0 && this._queue.size === 0) {\n return;\n }\n return new Promise(resolve => {\n const existingResolve = this._resolveIdle;\n this._resolveIdle = () => {\n existingResolve();\n resolve();\n };\n });\n }\n /**\n Size of the queue.\n */\n get size() {\n return this._queue.size;\n }\n /**\n Size of the queue, filtered by the given options.\n\n For example, this can be used to find the number of items remaining in the queue with a specific priority level.\n */\n sizeBy(options) {\n // eslint-disable-next-line unicorn/no-fn-reference-in-iterator\n return this._queue.filter(options).length;\n }\n /**\n Number of pending promises.\n */\n get pending() {\n return this._pendingCount;\n }\n /**\n Whether the queue is currently paused.\n */\n get isPaused() {\n return this._isPaused;\n }\n get timeout() {\n return this._timeout;\n }\n /**\n Set the timeout for future operations.\n */\n set timeout(milliseconds) {\n this._timeout = milliseconds;\n }\n}\nexports.default = PQueue;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\n// Port of lower_bound from https://en.cppreference.com/w/cpp/algorithm/lower_bound\n// Used to compute insertion index to keep queue sorted after insertion\nfunction lowerBound(array, value, comparator) {\n let first = 0;\n let count = array.length;\n while (count > 0) {\n const step = (count / 2) | 0;\n let it = first + step;\n if (comparator(array[it], value) <= 0) {\n first = ++it;\n count -= step + 1;\n }\n else {\n count = step;\n }\n }\n return first;\n}\nexports.default = lowerBound;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst lower_bound_1 = require(\"./lower-bound\");\nclass PriorityQueue {\n constructor() {\n this._queue = [];\n }\n enqueue(run, options) {\n options = Object.assign({ priority: 0 }, options);\n const element = {\n priority: options.priority,\n run\n };\n if (this.size && this._queue[this.size - 1].priority >= options.priority) {\n this._queue.push(element);\n return;\n }\n const index = lower_bound_1.default(this._queue, element, (a, b) => b.priority - a.priority);\n this._queue.splice(index, 0, element);\n }\n dequeue() {\n const item = this._queue.shift();\n return item === null || item === void 0 ? void 0 : item.run;\n }\n filter(options) {\n return this._queue.filter((element) => element.priority === options.priority).map((element) => element.run);\n }\n get size() {\n return this._queue.length;\n }\n}\nexports.default = PriorityQueue;\n","'use strict';\n\nvar has = Object.prototype.hasOwnProperty\n , prefix = '~';\n\n/**\n * Constructor to create a storage for our `EE` objects.\n * An `Events` instance is a plain object whose properties are event names.\n *\n * @constructor\n * @private\n */\nfunction Events() {}\n\n//\n// We try to not inherit from `Object.prototype`. In some engines creating an\n// instance in this way is faster than calling `Object.create(null)` directly.\n// If `Object.create(null)` is not supported we prefix the event names with a\n// character to make sure that the built-in object properties are not\n// overridden or used as an attack vector.\n//\nif (Object.create) {\n Events.prototype = Object.create(null);\n\n //\n // This hack is needed because the `__proto__` property is still inherited in\n // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.\n //\n if (!new Events().__proto__) prefix = false;\n}\n\n/**\n * Representation of a single event listener.\n *\n * @param {Function} fn The listener function.\n * @param {*} context The context to invoke the listener with.\n * @param {Boolean} [once=false] Specify if the listener is a one-time listener.\n * @constructor\n * @private\n */\nfunction EE(fn, context, once) {\n this.fn = fn;\n this.context = context;\n this.once = once || false;\n}\n\n/**\n * Add a listener for a given event.\n *\n * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} context The context to invoke the listener with.\n * @param {Boolean} once Specify if the listener is a one-time listener.\n * @returns {EventEmitter}\n * @private\n */\nfunction addListener(emitter, event, fn, context, once) {\n if (typeof fn !== 'function') {\n throw new TypeError('The listener must be a function');\n }\n\n var listener = new EE(fn, context || emitter, once)\n , evt = prefix ? prefix + event : event;\n\n if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++;\n else if (!emitter._events[evt].fn) emitter._events[evt].push(listener);\n else emitter._events[evt] = [emitter._events[evt], listener];\n\n return emitter;\n}\n\n/**\n * Clear event by name.\n *\n * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.\n * @param {(String|Symbol)} evt The Event name.\n * @private\n */\nfunction clearEvent(emitter, evt) {\n if (--emitter._eventsCount === 0) emitter._events = new Events();\n else delete emitter._events[evt];\n}\n\n/**\n * Minimal `EventEmitter` interface that is molded against the Node.js\n * `EventEmitter` interface.\n *\n * @constructor\n * @public\n */\nfunction EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}\n\n/**\n * Return an array listing the events for which the emitter has registered\n * listeners.\n *\n * @returns {Array}\n * @public\n */\nEventEmitter.prototype.eventNames = function eventNames() {\n var names = []\n , events\n , name;\n\n if (this._eventsCount === 0) return names;\n\n for (name in (events = this._events)) {\n if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);\n }\n\n if (Object.getOwnPropertySymbols) {\n return names.concat(Object.getOwnPropertySymbols(events));\n }\n\n return names;\n};\n\n/**\n * Return the listeners registered for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Array} The registered listeners.\n * @public\n */\nEventEmitter.prototype.listeners = function listeners(event) {\n var evt = prefix ? prefix + event : event\n , handlers = this._events[evt];\n\n if (!handlers) return [];\n if (handlers.fn) return [handlers.fn];\n\n for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) {\n ee[i] = handlers[i].fn;\n }\n\n return ee;\n};\n\n/**\n * Return the number of listeners listening to a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Number} The number of listeners.\n * @public\n */\nEventEmitter.prototype.listenerCount = function listenerCount(event) {\n var evt = prefix ? prefix + event : event\n , listeners = this._events[evt];\n\n if (!listeners) return 0;\n if (listeners.fn) return 1;\n return listeners.length;\n};\n\n/**\n * Calls each of the listeners registered for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Boolean} `true` if the event had listeners, else `false`.\n * @public\n */\nEventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {\n var evt = prefix ? prefix + event : event;\n\n if (!this._events[evt]) return false;\n\n var listeners = this._events[evt]\n , len = arguments.length\n , args\n , i;\n\n if (listeners.fn) {\n if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);\n\n switch (len) {\n case 1: return listeners.fn.call(listeners.context), true;\n case 2: return listeners.fn.call(listeners.context, a1), true;\n case 3: return listeners.fn.call(listeners.context, a1, a2), true;\n case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;\n case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;\n case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;\n }\n\n for (i = 1, args = new Array(len -1); i < len; i++) {\n args[i - 1] = arguments[i];\n }\n\n listeners.fn.apply(listeners.context, args);\n } else {\n var length = listeners.length\n , j;\n\n for (i = 0; i < length; i++) {\n if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);\n\n switch (len) {\n case 1: listeners[i].fn.call(listeners[i].context); break;\n case 2: listeners[i].fn.call(listeners[i].context, a1); break;\n case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;\n case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break;\n default:\n if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {\n args[j - 1] = arguments[j];\n }\n\n listeners[i].fn.apply(listeners[i].context, args);\n }\n }\n }\n\n return true;\n};\n\n/**\n * Add a listener for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} [context=this] The context to invoke the listener with.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.on = function on(event, fn, context) {\n return addListener(this, event, fn, context, false);\n};\n\n/**\n * Add a one-time listener for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} [context=this] The context to invoke the listener with.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.once = function once(event, fn, context) {\n return addListener(this, event, fn, context, true);\n};\n\n/**\n * Remove the listeners of a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn Only remove the listeners that match this function.\n * @param {*} context Only remove the listeners that have this context.\n * @param {Boolean} once Only remove one-time listeners.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {\n var evt = prefix ? prefix + event : event;\n\n if (!this._events[evt]) return this;\n if (!fn) {\n clearEvent(this, evt);\n return this;\n }\n\n var listeners = this._events[evt];\n\n if (listeners.fn) {\n if (\n listeners.fn === fn &&\n (!once || listeners.once) &&\n (!context || listeners.context === context)\n ) {\n clearEvent(this, evt);\n }\n } else {\n for (var i = 0, events = [], length = listeners.length; i < length; i++) {\n if (\n listeners[i].fn !== fn ||\n (once && !listeners[i].once) ||\n (context && listeners[i].context !== context)\n ) {\n events.push(listeners[i]);\n }\n }\n\n //\n // Reset the array, or remove it completely if we have no more listeners.\n //\n if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;\n else clearEvent(this, evt);\n }\n\n return this;\n};\n\n/**\n * Remove all listeners, or those of the specified event.\n *\n * @param {(String|Symbol)} [event] The event name.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {\n var evt;\n\n if (event) {\n evt = prefix ? prefix + event : event;\n if (this._events[evt]) clearEvent(this, evt);\n } else {\n this._events = new Events();\n this._eventsCount = 0;\n }\n\n return this;\n};\n\n//\n// Alias methods names because people roll like that.\n//\nEventEmitter.prototype.off = EventEmitter.prototype.removeListener;\nEventEmitter.prototype.addListener = EventEmitter.prototype.on;\n\n//\n// Expose the prefix.\n//\nEventEmitter.prefixed = prefix;\n\n//\n// Allow `EventEmitter` to be imported as module namespace.\n//\nEventEmitter.EventEmitter = EventEmitter;\n\n//\n// Expose the module.\n//\nif ('undefined' !== typeof module) {\n module.exports = EventEmitter;\n}\n","'use strict';\n\nconst pFinally = require('p-finally');\n\nclass TimeoutError extends Error {\n\tconstructor(message) {\n\t\tsuper(message);\n\t\tthis.name = 'TimeoutError';\n\t}\n}\n\nconst pTimeout = (promise, milliseconds, fallback) => new Promise((resolve, reject) => {\n\tif (typeof milliseconds !== 'number' || milliseconds < 0) {\n\t\tthrow new TypeError('Expected `milliseconds` to be a positive number');\n\t}\n\n\tif (milliseconds === Infinity) {\n\t\tresolve(promise);\n\t\treturn;\n\t}\n\n\tconst timer = setTimeout(() => {\n\t\tif (typeof fallback === 'function') {\n\t\t\ttry {\n\t\t\t\tresolve(fallback());\n\t\t\t} catch (error) {\n\t\t\t\treject(error);\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\t\tconst message = typeof fallback === 'string' ? fallback : `Promise timed out after ${milliseconds} milliseconds`;\n\t\tconst timeoutError = fallback instanceof Error ? fallback : new TimeoutError(message);\n\n\t\tif (typeof promise.cancel === 'function') {\n\t\t\tpromise.cancel();\n\t\t}\n\n\t\treject(timeoutError);\n\t}, milliseconds);\n\n\t// TODO: Use native `finally` keyword when targeting Node.js 10\n\tpFinally(\n\t\t// eslint-disable-next-line promise/prefer-await-to-then\n\t\tpromise.then(resolve, reject),\n\t\t() => {\n\t\t\tclearTimeout(timer);\n\t\t}\n\t);\n});\n\nmodule.exports = pTimeout;\n// TODO: Remove this for the next major release\nmodule.exports.default = pTimeout;\n\nmodule.exports.TimeoutError = TimeoutError;\n","import type { StreamDeck, StreamDeckButtonControlDefinitionLcdFeedback } from '@elgato-stream-deck/webhid'\nimport type { Demo } from './demo.js'\n\ninterface ControlAndCanvas {\n\tcontrol: StreamDeckButtonControlDefinitionLcdFeedback\n\tcanvas: HTMLCanvasElement\n}\n\nexport class ChaseDemo implements Demo {\n\tprivate pressed: number[] = []\n\tprivate counter = 0\n\tprivate interval: number | undefined\n\tprivate running: Promise | undefined\n\n\tprivate async drawButtons(device: StreamDeck, controls: ControlAndCanvas[], c: number): Promise {\n\t\tconst ps: Array> = []\n\n\t\tfor (const { control, canvas } of controls) {\n\t\t\t// We probably should reuse this instead of creating it each time.\n\t\t\tconst ctx = canvas.getContext('2d')\n\n\t\t\tif (ctx) {\n\t\t\t\tconst n = c + control.index\n\t\t\t\tctx.save()\n\t\t\t\tctx.clearRect(0, 0, canvas.width, canvas.height)\n\t\t\t\t// Start with a font that's 80% as high as the button. maxWidth\n\t\t\t\t// is used on the stroke and fill calls below to scale down.\n\t\t\t\tctx.font = `${canvas.height * 0.8}px \"Arial\"`\n\t\t\t\tctx.strokeStyle = 'blue'\n\t\t\t\tctx.lineWidth = 1\n\t\t\t\tctx.strokeText(n.toString(), 8, canvas.height * 0.9, canvas.width * 0.8)\n\t\t\t\tctx.fillStyle = 'white'\n\t\t\t\tctx.fillText(n.toString(), 8, canvas.height * 0.9, canvas.width * 0.8)\n\n\t\t\t\tconst id = ctx.getImageData(0, 0, canvas.width, canvas.height)\n\t\t\t\tps.push(device.fillKeyBuffer(control.index, id.data, { format: 'rgba' }))\n\t\t\t\tctx.restore()\n\t\t\t}\n\t\t}\n\n\t\tawait Promise.all(ps)\n\t}\n\n\tpublic async start(device: StreamDeck): Promise {\n\t\tawait device.clearPanel()\n\n\t\tthis.counter = 0\n\n\t\tconst controls = device.CONTROLS.filter(\n\t\t\t(control): control is StreamDeckButtonControlDefinitionLcdFeedback =>\n\t\t\t\tcontrol.type === 'button' && control.feedbackType === 'lcd',\n\t\t).sort((a, b) => b.index - a.index)\n\n\t\tconst controlsAndCanvases: ControlAndCanvas[] = controls.map((control) => {\n\t\t\tconst canvas = document.createElement('canvas')\n\t\t\tcanvas.width = control.pixelSize.width\n\t\t\tcanvas.height = control.pixelSize.height\n\n\t\t\treturn { control, canvas }\n\t\t})\n\n\t\tawait this.drawButtons(device, controlsAndCanvases, this.counter)\n\n\t\tif (!this.interval) {\n\t\t\tconst doThing = async () => {\n\t\t\t\tif (!this.running) {\n\t\t\t\t\tthis.running = this.drawButtons(device, controlsAndCanvases, ++this.counter)\n\t\t\t\t\tawait this.running\n\t\t\t\t\tthis.running = undefined\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.interval = window.setInterval(() => {\n\t\t\t\tdoThing().catch((e) => console.error(e))\n\t\t\t}, 1000 / 5)\n\t\t}\n\t}\n\tpublic async stop(device: StreamDeck): Promise {\n\t\tif (this.interval) {\n\t\t\twindow.clearInterval(this.interval)\n\t\t\tthis.interval = undefined\n\t\t}\n\t\tawait this.running\n\t\tawait device.clearPanel()\n\t}\n\tpublic async keyDown(device: StreamDeck, keyIndex: number): Promise {\n\t\tif (this.pressed.indexOf(keyIndex) === -1) {\n\t\t\tthis.pressed.push(keyIndex)\n\n\t\t\tawait device.fillKeyColor(keyIndex, 255, 0, 0)\n\t\t}\n\t}\n\tpublic async keyUp(device: StreamDeck, keyIndex: number): Promise {\n\t\tconst index = this.pressed.indexOf(keyIndex)\n\t\tif (index !== -1) {\n\t\t\tthis.pressed.splice(index, 1)\n\n\t\t\tawait device.clearKey(keyIndex)\n\t\t}\n\t}\n}\n","import type { StreamDeckWeb } from '@elgato-stream-deck/webhid'\nimport { toCanvas } from 'html-to-image'\nimport type { Demo } from './demo.js'\n\nfunction getRandomColor() {\n\tconst letters = '0123456789ABCDEF'\n\tlet color = '#'\n\tfor (let i = 0; i < 6; i++) {\n\t\tcolor += letters[Math.floor(Math.random() * 16)]\n\t}\n\treturn color\n}\n\n/**\n * This demo is using html-to-image to render a div to the streamdeck.\n * Performance is not great, and the conversion library has many issues with rendering in\n * various cases, but if the source material is very controlled it could be useful.\n * It would be better to render natively on a canvas.\n */\nexport class DomImageDemo implements Demo {\n\tprivate element: HTMLElement | undefined\n\tprivate run = false\n\tprivate running: Promise | undefined\n\n\tpublic async start(device: StreamDeckWeb): Promise {\n\t\tthis.element = document.querySelector('#image-source') || undefined\n\t\tif (this.element) {\n\t\t\tthis.element.style.display = 'block'\n\t\t}\n\n\t\tif (!this.run) {\n\t\t\tthis.run = true\n\n\t\t\tconst runTick = () => {\n\t\t\t\tif (this.element && this.run) {\n\t\t\t\t\tconst elm = this.element\n\n\t\t\t\t\ttoCanvas(elm)\n\t\t\t\t\t\t.then(async (canvas) => {\n\t\t\t\t\t\t\tthis.running = device.fillPanelCanvas(canvas)\n\t\t\t\t\t\t\tawait this.running\n\t\t\t\t\t\t\tthis.running = undefined\n\n\t\t\t\t\t\t\t// It would run smoother to set the next tick going before sending to the panel, but then it becomes a race that could go wrong\n\t\t\t\t\t\t\trunTick()\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.catch(console.error)\n\t\t\t\t}\n\t\t\t}\n\t\t\trunTick()\n\t\t}\n\t}\n\tpublic async stop(device: StreamDeckWeb): Promise {\n\t\tif (this.element) {\n\t\t\tthis.element.style.display = 'none'\n\t\t}\n\n\t\tthis.run = false\n\n\t\tawait this.running\n\t\tawait device.clearPanel()\n\t}\n\tpublic async keyDown(_device: StreamDeckWeb, _keyIndex: number): Promise {\n\t\tif (this.element) {\n\t\t\tthis.element.style.background = getRandomColor()\n\t\t}\n\t}\n\tpublic async keyUp(_device: StreamDeckWeb, _keyIndex: number): Promise {\n\t\t// Nothing to do\n\t}\n}\n","import type { StreamDeck } from '@elgato-stream-deck/webhid'\nimport type { Demo } from './demo.js'\n\nexport class FillWhenPressedDemo implements Demo {\n\tprivate pressed: number[] = []\n\n\tpublic async start(device: StreamDeck): Promise {\n\t\tawait device.clearPanel()\n\t}\n\tpublic async stop(device: StreamDeck): Promise {\n\t\tawait device.clearPanel()\n\t}\n\tpublic async keyDown(device: StreamDeck, keyIndex: number): Promise {\n\t\tif (this.pressed.indexOf(keyIndex) === -1) {\n\t\t\tthis.pressed.push(keyIndex)\n\n\t\t\tawait device.fillKeyColor(keyIndex, 255, 0, 0)\n\t\t}\n\t}\n\tpublic async keyUp(device: StreamDeck, keyIndex: number): Promise {\n\t\tconst index = this.pressed.indexOf(keyIndex)\n\t\tif (index !== -1) {\n\t\t\tthis.pressed.splice(index, 1)\n\n\t\t\tawait device.clearKey(keyIndex)\n\t\t}\n\t}\n}\n","import type { StreamDeck } from '@elgato-stream-deck/webhid'\nimport type { Demo } from './demo.js'\n\nfunction getRandomIntInclusive(min: number, max: number) {\n\tmin = Math.ceil(min)\n\tmax = Math.floor(max)\n\treturn Math.floor(Math.random() * (max - min + 1)) + min\n}\n\nexport class RapidFillDemo implements Demo {\n\tprivate interval: number | undefined\n\tprivate running: Promise | undefined\n\n\tpublic async start(device: StreamDeck): Promise {\n\t\tif (!this.interval) {\n\t\t\tconst doThing = async () => {\n\t\t\t\tif (!this.running) {\n\t\t\t\t\tconst r = getRandomIntInclusive(0, 255)\n\t\t\t\t\tconst g = getRandomIntInclusive(0, 255)\n\t\t\t\t\tconst b = getRandomIntInclusive(0, 255)\n\t\t\t\t\tconsole.log('Filling with rgb(%d, %d, %d)', r, g, b)\n\n\t\t\t\t\tconst ps: Array> = []\n\t\t\t\t\tfor (const control of device.CONTROLS) {\n\t\t\t\t\t\tif (control.type === 'button') {\n\t\t\t\t\t\t\tps.push(device.fillKeyColor(control.index, r, g, b))\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tthis.running = Promise.all(ps)\n\t\t\t\t\tawait this.running\n\t\t\t\t\tthis.running = undefined\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.interval = window.setInterval(() => {\n\t\t\t\tdoThing().catch((e) => console.log(e))\n\t\t\t}, 1000 / 5)\n\t\t}\n\t}\n\tpublic async stop(device: StreamDeck): Promise {\n\t\tif (this.interval) {\n\t\t\twindow.clearInterval(this.interval)\n\t\t\tthis.interval = undefined\n\t\t}\n\t\tawait this.running\n\t\tawait device.clearPanel()\n\t}\n\tpublic async keyDown(_device: StreamDeck, _keyIndex: number): Promise {\n\t\t// Nothing to do\n\t}\n\tpublic async keyUp(_device: StreamDeck, _keyIndex: number): Promise {\n\t\t// Nothing to do\n\t}\n}\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\n//# sourceMappingURL=controlDefinition.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.generateButtonsGrid = generateButtonsGrid;\nexports.freezeDefinitions = freezeDefinitions;\nfunction generateButtonsGrid(width, height, pixelSize, rtl = false, columnOffset = 0) {\n const controls = [];\n for (let row = 0; row < height; row++) {\n for (let column = 0; column < width; column++) {\n const index = row * width + column;\n const hidIndex = rtl ? flipKeyIndex(width, index) : index;\n controls.push({\n type: 'button',\n row,\n column: column + columnOffset,\n index,\n hidIndex,\n feedbackType: 'lcd',\n pixelSize,\n });\n }\n }\n return controls;\n}\nfunction flipKeyIndex(columns, keyIndex) {\n // Horizontal flip\n const half = (columns - 1) / 2;\n const diff = ((keyIndex % columns) - half) * -half;\n return keyIndex + diff;\n}\nfunction freezeDefinitions(controls) {\n return Object.freeze(controls.map((control) => Object.freeze(control)));\n}\n//# sourceMappingURL=controlsGenerator.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.MODEL_NAMES = exports.DeviceModelId = void 0;\nvar DeviceModelId;\n(function (DeviceModelId) {\n DeviceModelId[\"ORIGINAL\"] = \"original\";\n DeviceModelId[\"ORIGINALV2\"] = \"originalv2\";\n DeviceModelId[\"ORIGINALMK2\"] = \"original-mk2\";\n DeviceModelId[\"MINI\"] = \"mini\";\n DeviceModelId[\"XL\"] = \"xl\";\n DeviceModelId[\"PEDAL\"] = \"pedal\";\n DeviceModelId[\"PLUS\"] = \"plus\";\n DeviceModelId[\"NEO\"] = \"neo\";\n DeviceModelId[\"STUDIO\"] = \"studio\";\n})(DeviceModelId || (exports.DeviceModelId = DeviceModelId = {}));\nexports.MODEL_NAMES = {\n [DeviceModelId.ORIGINAL]: 'Stream Deck',\n [DeviceModelId.MINI]: 'Stream Deck Mini',\n [DeviceModelId.XL]: 'Stream Deck XL',\n [DeviceModelId.ORIGINALV2]: 'Stream Deck',\n [DeviceModelId.ORIGINALMK2]: 'Stream Deck MK.2',\n [DeviceModelId.PLUS]: 'Stream Deck +',\n [DeviceModelId.PEDAL]: 'Stream Deck Pedal',\n [DeviceModelId.NEO]: 'Stream Deck Neo',\n [DeviceModelId.STUDIO]: 'Stream Deck Studio',\n};\n//# sourceMappingURL=id.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.DEVICE_MODELS = exports.DEVICE_MODELS2 = exports.DeviceModelType = exports.VENDOR_ID = exports.uint8ArrayToDataView = exports.StreamDeckProxy = void 0;\nconst tslib_1 = require(\"tslib\");\nconst id_js_1 = require(\"./id.js\");\nconst original_js_1 = require(\"./models/original.js\");\nconst mini_js_1 = require(\"./models/mini.js\");\nconst xl_js_1 = require(\"./models/xl.js\");\nconst originalv2_js_1 = require(\"./models/originalv2.js\");\nconst original_mk2_js_1 = require(\"./models/original-mk2.js\");\nconst plus_js_1 = require(\"./models/plus.js\");\nconst pedal_js_1 = require(\"./models/pedal.js\");\nconst neo_js_1 = require(\"./models/neo.js\");\nconst studio_js_1 = require(\"./models/studio.js\");\ntslib_1.__exportStar(require(\"./types.js\"), exports);\ntslib_1.__exportStar(require(\"./id.js\"), exports);\ntslib_1.__exportStar(require(\"./controlDefinition.js\"), exports);\nvar proxy_js_1 = require(\"./proxy.js\");\nObject.defineProperty(exports, \"StreamDeckProxy\", { enumerable: true, get: function () { return proxy_js_1.StreamDeckProxy; } });\nvar util_js_1 = require(\"./util.js\");\nObject.defineProperty(exports, \"uint8ArrayToDataView\", { enumerable: true, get: function () { return util_js_1.uint8ArrayToDataView; } });\n/** Elgato vendor id */\nexports.VENDOR_ID = 0x0fd9;\nvar DeviceModelType;\n(function (DeviceModelType) {\n DeviceModelType[\"STREAMDECK\"] = \"streamdeck\";\n DeviceModelType[\"PEDAL\"] = \"pedal\";\n})(DeviceModelType || (exports.DeviceModelType = DeviceModelType = {}));\n/** List of all the known models, and the classes to use them */\nexports.DEVICE_MODELS2 = {\n [id_js_1.DeviceModelId.ORIGINAL]: {\n type: DeviceModelType.STREAMDECK,\n productIds: [0x0060],\n factory: original_js_1.StreamDeckOriginalFactory,\n hasNativeTcp: false,\n },\n [id_js_1.DeviceModelId.MINI]: {\n type: DeviceModelType.STREAMDECK,\n productIds: [0x0063, 0x0090],\n factory: mini_js_1.StreamDeckMiniFactory,\n hasNativeTcp: false,\n },\n [id_js_1.DeviceModelId.XL]: {\n type: DeviceModelType.STREAMDECK,\n productIds: [0x006c, 0x008f],\n factory: xl_js_1.StreamDeckXLFactory,\n hasNativeTcp: false,\n },\n [id_js_1.DeviceModelId.ORIGINALV2]: {\n type: DeviceModelType.STREAMDECK,\n productIds: [0x006d],\n factory: originalv2_js_1.StreamDeckOriginalV2Factory,\n hasNativeTcp: false,\n },\n [id_js_1.DeviceModelId.ORIGINALMK2]: {\n type: DeviceModelType.STREAMDECK,\n productIds: [0x0080],\n factory: original_mk2_js_1.StreamDeckOriginalMK2Factory,\n hasNativeTcp: false,\n },\n [id_js_1.DeviceModelId.PLUS]: {\n type: DeviceModelType.STREAMDECK,\n productIds: [0x0084],\n factory: plus_js_1.StreamDeckPlusFactory,\n hasNativeTcp: false,\n },\n [id_js_1.DeviceModelId.PEDAL]: {\n type: DeviceModelType.PEDAL,\n productIds: [0x0086],\n factory: pedal_js_1.StreamDeckPedalFactory,\n hasNativeTcp: false,\n },\n [id_js_1.DeviceModelId.NEO]: {\n type: DeviceModelType.STREAMDECK,\n productIds: [0x009a],\n factory: neo_js_1.StreamDeckNeoFactory,\n hasNativeTcp: false,\n },\n [id_js_1.DeviceModelId.STUDIO]: {\n type: DeviceModelType.STREAMDECK,\n productIds: [0x00aa],\n factory: studio_js_1.StreamDeckStudioFactory,\n hasNativeTcp: true,\n },\n};\n/** @deprecated maybe? */\nexports.DEVICE_MODELS = Object.entries(exports.DEVICE_MODELS2).map(([id, spec]) => {\n const modelId = id;\n return {\n id: modelId,\n productName: id_js_1.MODEL_NAMES[modelId],\n ...spec,\n };\n});\n//# sourceMappingURL=index.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.StreamDeckBase = void 0;\nconst eventemitter3_1 = require(\"eventemitter3\");\nconst index_js_1 = require(\"../index.js\");\nclass StreamDeckBase extends eventemitter3_1.EventEmitter {\n get CONTROLS() {\n return this.deviceProperties.CONTROLS;\n }\n // get KEY_SPACING_HORIZONTAL(): number {\n // \treturn this.deviceProperties.KEY_SPACING_HORIZONTAL\n // }\n // get KEY_SPACING_VERTICAL(): number {\n // \treturn this.deviceProperties.KEY_SPACING_VERTICAL\n // }\n get MODEL() {\n return this.deviceProperties.MODEL;\n }\n get PRODUCT_NAME() {\n return this.deviceProperties.PRODUCT_NAME;\n }\n get HAS_NFC_READER() {\n return this.deviceProperties.HAS_NFC_READER;\n }\n device;\n deviceProperties;\n // readonly #options: Readonly>\n #propertiesService;\n #buttonsLcdService;\n #lcdSegmentDisplayService;\n #inputService;\n #encoderLedService;\n constructor(device, _options, services) {\n super();\n this.device = device;\n this.deviceProperties = services.deviceProperties;\n // this.#options = options\n this.#propertiesService = services.properties;\n this.#buttonsLcdService = services.buttonsLcd;\n this.#lcdSegmentDisplayService = services.lcdSegmentDisplay;\n this.#inputService = services.inputService;\n this.#encoderLedService = services.encoderLed;\n // propogate events\n services.events?.listen((key, ...args) => this.emit(key, ...args));\n this.device.on('input', (data) => this.#inputService.handleInput(data));\n this.device.on('error', (err) => {\n this.emit('error', err);\n });\n }\n checkValidKeyIndex(keyIndex, feedbackType) {\n const buttonControl = this.deviceProperties.CONTROLS.find((control) => control.type === 'button' && control.index === keyIndex);\n if (!buttonControl) {\n throw new TypeError(`Expected a valid keyIndex`);\n }\n if (feedbackType && buttonControl.feedbackType !== feedbackType) {\n throw new TypeError(`Expected a keyIndex with expected feedbackType`);\n }\n }\n calculateFillPanelDimensions(options) {\n return this.#buttonsLcdService.calculateFillPanelDimensions(options);\n }\n async close() {\n return this.device.close();\n }\n async getHidDeviceInfo() {\n return this.device.getDeviceInfo();\n }\n async setBrightness(percentage) {\n return this.#propertiesService.setBrightness(percentage);\n }\n async resetToLogo() {\n return this.#propertiesService.resetToLogo();\n }\n async getFirmwareVersion() {\n return this.#propertiesService.getFirmwareVersion();\n }\n async getSerialNumber() {\n return this.#propertiesService.getSerialNumber();\n }\n async fillKeyColor(keyIndex, r, g, b) {\n this.checkValidKeyIndex(keyIndex, null);\n await this.#buttonsLcdService.fillKeyColor(keyIndex, r, g, b);\n }\n async fillKeyBuffer(keyIndex, imageBuffer, options) {\n this.checkValidKeyIndex(keyIndex, 'lcd');\n await this.#buttonsLcdService.fillKeyBuffer(keyIndex, imageBuffer, options);\n }\n async fillPanelBuffer(imageBuffer, options) {\n await this.#buttonsLcdService.fillPanelBuffer(imageBuffer, options);\n }\n async clearKey(keyIndex) {\n this.checkValidKeyIndex(keyIndex, null);\n await this.#buttonsLcdService.clearKey(keyIndex);\n }\n async clearPanel() {\n const ps = [];\n ps.push(this.#buttonsLcdService.clearPanel());\n if (this.#lcdSegmentDisplayService)\n ps.push(this.#lcdSegmentDisplayService.clearAllLcdSegments());\n await Promise.all(ps);\n }\n async fillLcd(...args) {\n if (!this.#lcdSegmentDisplayService)\n throw new Error('Not supported for this model');\n return this.#lcdSegmentDisplayService.fillLcd(...args);\n }\n async fillLcdRegion(...args) {\n if (!this.#lcdSegmentDisplayService)\n throw new Error('Not supported for this model');\n return this.#lcdSegmentDisplayService.fillLcdRegion(...args);\n }\n async clearLcdSegment(...args) {\n if (!this.#lcdSegmentDisplayService)\n throw new Error('Not supported for this model');\n return this.#lcdSegmentDisplayService.clearLcdSegment(...args);\n }\n async setEncoderColor(...args) {\n if (!this.#encoderLedService)\n throw new Error('Not supported for this model');\n return this.#encoderLedService.setEncoderColor(...args);\n }\n async setEncoderRingSingleColor(...args) {\n if (!this.#encoderLedService)\n throw new Error('Not supported for this model');\n return this.#encoderLedService.setEncoderRingSingleColor(...args);\n }\n async setEncoderRingColors(...args) {\n if (!this.#encoderLedService)\n throw new Error('Not supported for this model');\n return this.#encoderLedService.setEncoderRingColors(...args);\n }\n async getChildDeviceInfo() {\n const info = await this.device.getChildDeviceInfo();\n if (!info || info.vendorId !== index_js_1.VENDOR_ID)\n return null;\n const model = index_js_1.DEVICE_MODELS.find((m) => m.productIds.includes(info.productId));\n if (!model)\n return null;\n return {\n ...info,\n model: model.id,\n };\n }\n}\nexports.StreamDeckBase = StreamDeckBase;\n//# sourceMappingURL=base.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.StreamDeckGen1Factory = StreamDeckGen1Factory;\nconst base_js_1 = require(\"./base.js\");\nconst gen1_js_1 = require(\"../services/properties/gen1.js\");\nconst default_js_1 = require(\"../services/buttonsLcdDisplay/default.js\");\nconst bitmap_js_1 = require(\"../services/imagePacker/bitmap.js\");\nconst callback_hook_js_1 = require(\"../services/callback-hook.js\");\nconst gen1_js_2 = require(\"../services/input/gen1.js\");\nfunction extendDevicePropertiesForGen1(rawProps) {\n return {\n ...rawProps,\n KEY_DATA_OFFSET: 0,\n HAS_NFC_READER: false,\n SUPPORTS_CHILD_DEVICES: false,\n };\n}\nfunction StreamDeckGen1Factory(device, options, properties, imageWriter, targetOptions, bmpImagePPM) {\n const fullProperties = extendDevicePropertiesForGen1(properties);\n const events = new callback_hook_js_1.CallbackHook();\n return new base_js_1.StreamDeckBase(device, options, {\n deviceProperties: fullProperties,\n events,\n properties: new gen1_js_1.Gen1PropertiesService(device),\n buttonsLcd: new default_js_1.DefaultButtonsLcdService(imageWriter, new bitmap_js_1.BitmapButtonLcdImagePacker(targetOptions, bmpImagePPM), device, fullProperties),\n lcdSegmentDisplay: null,\n inputService: new gen1_js_2.ButtonOnlyInputService(fullProperties, events),\n encoderLed: null,\n });\n}\n//# sourceMappingURL=generic-gen1.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.createBaseGen2Properties = createBaseGen2Properties;\nconst imageWriter_js_1 = require(\"../services/imageWriter/imageWriter.js\");\nconst headerGenerator_js_1 = require(\"../services/imageWriter/headerGenerator.js\");\nconst default_js_1 = require(\"../services/buttonsLcdDisplay/default.js\");\nconst callback_hook_js_1 = require(\"../services/callback-hook.js\");\nconst gen2_js_1 = require(\"../services/properties/gen2.js\");\nconst jpeg_js_1 = require(\"../services/imagePacker/jpeg.js\");\nconst gen2_js_2 = require(\"../services/input/gen2.js\");\nconst encoderLed_js_1 = require(\"../services/encoderLed.js\");\nfunction extendDevicePropertiesForGen2(rawProps) {\n return {\n ...rawProps,\n KEY_DATA_OFFSET: 3,\n };\n}\nfunction createBaseGen2Properties(device, options, properties, propertiesService, disableXYFlip) {\n const fullProperties = extendDevicePropertiesForGen2(properties);\n const events = new callback_hook_js_1.CallbackHook();\n return {\n deviceProperties: fullProperties,\n events,\n properties: propertiesService ?? new gen2_js_1.Gen2PropertiesService(device),\n buttonsLcd: new default_js_1.DefaultButtonsLcdService(new imageWriter_js_1.StreamdeckDefaultImageWriter(new headerGenerator_js_1.StreamdeckGen2ImageHeaderGenerator()), new jpeg_js_1.JpegButtonLcdImagePacker(options.encodeJPEG, !disableXYFlip), device, fullProperties),\n lcdSegmentDisplay: null,\n inputService: new gen2_js_2.Gen2InputService(fullProperties, events),\n encoderLed: new encoderLed_js_1.EncoderLedService(device, properties.CONTROLS),\n };\n}\n//# sourceMappingURL=generic-gen2.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.StreamDeckMiniFactory = StreamDeckMiniFactory;\nconst generic_gen1_js_1 = require(\"./generic-gen1.js\");\nconst id_js_1 = require(\"../id.js\");\nconst controlsGenerator_js_1 = require(\"../controlsGenerator.js\");\nconst imageWriter_js_1 = require(\"../services/imageWriter/imageWriter.js\");\nconst headerGenerator_js_1 = require(\"../services/imageWriter/headerGenerator.js\");\nconst miniProperties = {\n MODEL: id_js_1.DeviceModelId.MINI,\n PRODUCT_NAME: id_js_1.MODEL_NAMES[id_js_1.DeviceModelId.MINI],\n SUPPORTS_RGB_KEY_FILL: false, // TODO - verify this\n CONTROLS: (0, controlsGenerator_js_1.freezeDefinitions)((0, controlsGenerator_js_1.generateButtonsGrid)(3, 2, { width: 80, height: 80 })),\n KEY_SPACING_HORIZONTAL: 28,\n KEY_SPACING_VERTICAL: 28,\n FULLSCREEN_PANELS: 0,\n};\nfunction StreamDeckMiniFactory(device, options) {\n return (0, generic_gen1_js_1.StreamDeckGen1Factory)(device, options, miniProperties, new imageWriter_js_1.StreamdeckDefaultImageWriter(new headerGenerator_js_1.StreamdeckGen1ImageHeaderGenerator()), { colorMode: 'bgr', rotate: true, yFlip: true }, 2835);\n}\n//# sourceMappingURL=mini.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.StreamDeckNeoFactory = StreamDeckNeoFactory;\nconst base_js_1 = require(\"./base.js\");\nconst id_js_1 = require(\"../id.js\");\nconst generic_gen2_js_1 = require(\"./generic-gen2.js\");\nconst controlsGenerator_js_1 = require(\"../controlsGenerator.js\");\nconst neo_js_1 = require(\"../services/lcdSegmentDisplay/neo.js\");\nconst neoControls = (0, controlsGenerator_js_1.generateButtonsGrid)(4, 2, { width: 96, height: 96 });\nneoControls.push({\n type: 'button',\n row: 2,\n column: 0,\n index: 8,\n hidIndex: 8,\n feedbackType: 'rgb',\n}, {\n type: 'lcd-segment',\n row: 2,\n column: 1,\n columnSpan: 2,\n rowSpan: 1,\n id: 0,\n pixelSize: {\n width: 248,\n height: 58,\n },\n drawRegions: false,\n}, {\n type: 'button',\n row: 2,\n column: 3,\n index: 9,\n hidIndex: 9,\n feedbackType: 'rgb',\n});\nconst neoProperties = {\n MODEL: id_js_1.DeviceModelId.NEO,\n PRODUCT_NAME: id_js_1.MODEL_NAMES[id_js_1.DeviceModelId.NEO],\n CONTROLS: (0, controlsGenerator_js_1.freezeDefinitions)(neoControls),\n KEY_SPACING_HORIZONTAL: 30,\n KEY_SPACING_VERTICAL: 30,\n FULLSCREEN_PANELS: 0,\n HAS_NFC_READER: false,\n SUPPORTS_CHILD_DEVICES: false,\n SUPPORTS_RGB_KEY_FILL: true,\n};\nconst lcdSegmentControls = neoProperties.CONTROLS.filter((control) => control.type === 'lcd-segment');\nfunction StreamDeckNeoFactory(device, options) {\n const services = (0, generic_gen2_js_1.createBaseGen2Properties)(device, options, neoProperties, null);\n services.lcdSegmentDisplay = new neo_js_1.StreamDeckNeoLcdService(options.encodeJPEG, device, lcdSegmentControls);\n return new base_js_1.StreamDeckBase(device, options, services);\n}\n//# sourceMappingURL=neo.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.StreamDeckOriginalMK2Factory = StreamDeckOriginalMK2Factory;\nconst base_js_1 = require(\"./base.js\");\nconst generic_gen2_js_1 = require(\"./generic-gen2.js\");\nconst id_js_1 = require(\"../id.js\");\nconst controlsGenerator_js_1 = require(\"../controlsGenerator.js\");\nconst origMK2Properties = {\n MODEL: id_js_1.DeviceModelId.ORIGINALMK2,\n PRODUCT_NAME: id_js_1.MODEL_NAMES[id_js_1.DeviceModelId.ORIGINALMK2],\n SUPPORTS_RGB_KEY_FILL: false, // TODO - verify SUPPORTS_RGB_KEY_FILL\n CONTROLS: (0, controlsGenerator_js_1.freezeDefinitions)((0, controlsGenerator_js_1.generateButtonsGrid)(5, 3, { width: 72, height: 72 })),\n KEY_SPACING_HORIZONTAL: 25,\n KEY_SPACING_VERTICAL: 25,\n FULLSCREEN_PANELS: 0,\n HAS_NFC_READER: false,\n SUPPORTS_CHILD_DEVICES: false,\n};\nfunction StreamDeckOriginalMK2Factory(device, options) {\n const services = (0, generic_gen2_js_1.createBaseGen2Properties)(device, options, origMK2Properties, null);\n return new base_js_1.StreamDeckBase(device, options, services);\n}\n//# sourceMappingURL=original-mk2.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.StreamDeckOriginalFactory = StreamDeckOriginalFactory;\nconst generic_gen1_js_1 = require(\"./generic-gen1.js\");\nconst id_js_1 = require(\"../id.js\");\nconst imageWriter_js_1 = require(\"../services/imageWriter/imageWriter.js\");\nconst controlsGenerator_js_1 = require(\"../controlsGenerator.js\");\nconst originalProperties = {\n MODEL: id_js_1.DeviceModelId.ORIGINAL,\n PRODUCT_NAME: id_js_1.MODEL_NAMES[id_js_1.DeviceModelId.ORIGINAL],\n SUPPORTS_RGB_KEY_FILL: false,\n CONTROLS: (0, controlsGenerator_js_1.freezeDefinitions)((0, controlsGenerator_js_1.generateButtonsGrid)(5, 3, { width: 72, height: 72 }, true)),\n KEY_SPACING_HORIZONTAL: 25,\n KEY_SPACING_VERTICAL: 25,\n FULLSCREEN_PANELS: 0,\n};\nfunction StreamDeckOriginalFactory(device, options) {\n return (0, generic_gen1_js_1.StreamDeckGen1Factory)(device, options, originalProperties, new imageWriter_js_1.StreamdeckOriginalImageWriter(), { colorMode: 'bgr', xFlip: true }, 3780);\n}\n//# sourceMappingURL=original.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.StreamDeckOriginalV2Factory = StreamDeckOriginalV2Factory;\nconst base_js_1 = require(\"./base.js\");\nconst generic_gen2_js_1 = require(\"./generic-gen2.js\");\nconst id_js_1 = require(\"../id.js\");\nconst controlsGenerator_js_1 = require(\"../controlsGenerator.js\");\nconst origV2Properties = {\n MODEL: id_js_1.DeviceModelId.ORIGINALV2,\n PRODUCT_NAME: id_js_1.MODEL_NAMES[id_js_1.DeviceModelId.ORIGINALV2],\n SUPPORTS_RGB_KEY_FILL: false, // TODO - verify SUPPORTS_RGB_KEY_FILL\n CONTROLS: (0, controlsGenerator_js_1.freezeDefinitions)((0, controlsGenerator_js_1.generateButtonsGrid)(5, 3, { width: 72, height: 72 })),\n KEY_SPACING_HORIZONTAL: 25,\n KEY_SPACING_VERTICAL: 25,\n FULLSCREEN_PANELS: 0,\n HAS_NFC_READER: false,\n SUPPORTS_CHILD_DEVICES: false,\n};\nfunction StreamDeckOriginalV2Factory(device, options) {\n const services = (0, generic_gen2_js_1.createBaseGen2Properties)(device, options, origV2Properties, null);\n return new base_js_1.StreamDeckBase(device, options, services);\n}\n//# sourceMappingURL=originalv2.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.StreamDeckPedalFactory = StreamDeckPedalFactory;\nconst base_js_1 = require(\"./base.js\");\nconst id_js_1 = require(\"../id.js\");\nconst controlsGenerator_js_1 = require(\"../controlsGenerator.js\");\nconst pedal_js_1 = require(\"../services/properties/pedal.js\");\nconst pedal_js_2 = require(\"../services/buttonsLcdDisplay/pedal.js\");\nconst callback_hook_js_1 = require(\"../services/callback-hook.js\");\nconst gen1_js_1 = require(\"../services/input/gen1.js\");\nconst pedalControls = [\n {\n type: 'button',\n row: 0,\n column: 0,\n index: 0,\n hidIndex: 0,\n feedbackType: 'none',\n },\n {\n type: 'button',\n row: 0,\n column: 1,\n index: 1,\n hidIndex: 1,\n feedbackType: 'none',\n },\n {\n type: 'button',\n row: 0,\n column: 2,\n index: 2,\n hidIndex: 2,\n feedbackType: 'none',\n },\n];\nconst pedalProperties = {\n MODEL: id_js_1.DeviceModelId.PEDAL,\n PRODUCT_NAME: id_js_1.MODEL_NAMES[id_js_1.DeviceModelId.PEDAL],\n KEY_DATA_OFFSET: 3,\n SUPPORTS_RGB_KEY_FILL: false,\n CONTROLS: (0, controlsGenerator_js_1.freezeDefinitions)(pedalControls),\n KEY_SPACING_HORIZONTAL: 0,\n KEY_SPACING_VERTICAL: 0,\n FULLSCREEN_PANELS: 0,\n HAS_NFC_READER: false,\n SUPPORTS_CHILD_DEVICES: false,\n};\nfunction StreamDeckPedalFactory(device, options) {\n const events = new callback_hook_js_1.CallbackHook();\n return new base_js_1.StreamDeckBase(device, options, {\n deviceProperties: pedalProperties,\n events,\n properties: new pedal_js_1.PedalPropertiesService(device),\n buttonsLcd: new pedal_js_2.PedalLcdService(),\n lcdSegmentDisplay: null,\n inputService: new gen1_js_1.ButtonOnlyInputService(pedalProperties, events),\n encoderLed: null,\n });\n}\n//# sourceMappingURL=pedal.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.StreamDeckPlusFactory = StreamDeckPlusFactory;\nconst base_js_1 = require(\"./base.js\");\nconst generic_gen2_js_1 = require(\"./generic-gen2.js\");\nconst id_js_1 = require(\"../id.js\");\nconst controlsGenerator_js_1 = require(\"../controlsGenerator.js\");\nconst plus_js_1 = require(\"../services/lcdSegmentDisplay/plus.js\");\nconst plusControls = (0, controlsGenerator_js_1.generateButtonsGrid)(4, 2, { width: 120, height: 120 });\nplusControls.push({\n type: 'lcd-segment',\n row: 2,\n column: 0,\n columnSpan: 4,\n rowSpan: 1,\n id: 0,\n pixelSize: Object.freeze({\n width: 800,\n height: 100,\n }),\n drawRegions: true,\n}, {\n type: 'encoder',\n row: 3,\n column: 0,\n index: 0,\n hidIndex: 0,\n hasLed: false,\n ledRingSteps: 0,\n}, {\n type: 'encoder',\n row: 3,\n column: 1,\n index: 1,\n hidIndex: 1,\n hasLed: false,\n ledRingSteps: 0,\n}, {\n type: 'encoder',\n row: 3,\n column: 2,\n index: 2,\n hidIndex: 2,\n hasLed: false,\n ledRingSteps: 0,\n}, {\n type: 'encoder',\n row: 3,\n column: 3,\n index: 3,\n hidIndex: 3,\n hasLed: false,\n ledRingSteps: 0,\n});\nconst plusProperties = {\n MODEL: id_js_1.DeviceModelId.PLUS,\n PRODUCT_NAME: id_js_1.MODEL_NAMES[id_js_1.DeviceModelId.PLUS],\n SUPPORTS_RGB_KEY_FILL: true,\n CONTROLS: (0, controlsGenerator_js_1.freezeDefinitions)(plusControls),\n KEY_SPACING_HORIZONTAL: 99,\n KEY_SPACING_VERTICAL: 40,\n FULLSCREEN_PANELS: 0,\n HAS_NFC_READER: false,\n SUPPORTS_CHILD_DEVICES: false,\n};\nconst lcdSegmentControls = plusProperties.CONTROLS.filter((control) => control.type === 'lcd-segment');\nfunction StreamDeckPlusFactory(device, options) {\n const services = (0, generic_gen2_js_1.createBaseGen2Properties)(device, options, plusProperties, null, true);\n services.lcdSegmentDisplay = new plus_js_1.StreamDeckPlusLcdService(options.encodeJPEG, device, lcdSegmentControls);\n return new base_js_1.StreamDeckBase(device, options, services);\n}\n//# sourceMappingURL=plus.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.studioProperties = void 0;\nexports.StreamDeckStudioFactory = StreamDeckStudioFactory;\nconst base_js_1 = require(\"./base.js\");\nconst generic_gen2_js_1 = require(\"./generic-gen2.js\");\nconst id_js_1 = require(\"../id.js\");\nconst controlsGenerator_js_1 = require(\"../controlsGenerator.js\");\nconst studioControls = [\n {\n type: 'encoder',\n row: 0,\n column: 0,\n index: 0,\n hidIndex: 0,\n hasLed: true,\n ledRingSteps: 24,\n },\n ...(0, controlsGenerator_js_1.generateButtonsGrid)(16, 2, { width: 144, height: 112 }, false, 1),\n {\n type: 'encoder',\n row: 0,\n column: 17,\n index: 1,\n hidIndex: 1,\n hasLed: true,\n ledRingSteps: 24,\n },\n];\nexports.studioProperties = {\n MODEL: id_js_1.DeviceModelId.STUDIO,\n PRODUCT_NAME: id_js_1.MODEL_NAMES[id_js_1.DeviceModelId.STUDIO],\n SUPPORTS_RGB_KEY_FILL: true,\n CONTROLS: (0, controlsGenerator_js_1.freezeDefinitions)(studioControls),\n KEY_SPACING_HORIZONTAL: 0, // TODO\n KEY_SPACING_VERTICAL: 0, // TODO\n FULLSCREEN_PANELS: 2,\n HAS_NFC_READER: true,\n SUPPORTS_CHILD_DEVICES: true,\n};\nfunction StreamDeckStudioFactory(device, options, propertiesService) {\n const services = (0, generic_gen2_js_1.createBaseGen2Properties)(device, options, exports.studioProperties, propertiesService ?? null, true);\n return new base_js_1.StreamDeckBase(device, options, services);\n}\n//# sourceMappingURL=studio.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.StreamDeckXLFactory = StreamDeckXLFactory;\nconst base_js_1 = require(\"./base.js\");\nconst generic_gen2_js_1 = require(\"./generic-gen2.js\");\nconst id_js_1 = require(\"../id.js\");\nconst controlsGenerator_js_1 = require(\"../controlsGenerator.js\");\nconst xlProperties = {\n MODEL: id_js_1.DeviceModelId.XL,\n PRODUCT_NAME: id_js_1.MODEL_NAMES[id_js_1.DeviceModelId.XL],\n SUPPORTS_RGB_KEY_FILL: false, // rev2 doesn't support it, even though rev1 does\n CONTROLS: (0, controlsGenerator_js_1.freezeDefinitions)((0, controlsGenerator_js_1.generateButtonsGrid)(8, 4, { width: 96, height: 96 })),\n KEY_SPACING_HORIZONTAL: 32,\n KEY_SPACING_VERTICAL: 39,\n FULLSCREEN_PANELS: 0,\n HAS_NFC_READER: false,\n SUPPORTS_CHILD_DEVICES: false,\n};\nfunction StreamDeckXLFactory(device, options) {\n const services = (0, generic_gen2_js_1.createBaseGen2Properties)(device, options, xlProperties, null);\n return new base_js_1.StreamDeckBase(device, options, services);\n}\n//# sourceMappingURL=xl.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.StreamDeckProxy = void 0;\n/**\n * A minimal proxy around a StreamDeck instance.\n * This is intended to be used by libraries wrapping this that want to add more methods to the StreamDeck\n */\nclass StreamDeckProxy {\n device;\n constructor(device) {\n this.device = device;\n }\n get CONTROLS() {\n return this.device.CONTROLS;\n }\n // public get KEY_SPACING_VERTICAL(): number {\n // \treturn this.device.KEY_SPACING_VERTICAL\n // }\n // public get KEY_SPACING_HORIZONTAL(): number {\n // \treturn this.device.KEY_SPACING_HORIZONTAL\n // }\n get MODEL() {\n return this.device.MODEL;\n }\n get PRODUCT_NAME() {\n return this.device.PRODUCT_NAME;\n }\n get HAS_NFC_READER() {\n return this.device.HAS_NFC_READER;\n }\n calculateFillPanelDimensions(...args) {\n return this.device.calculateFillPanelDimensions(...args);\n }\n async close() {\n return this.device.close();\n }\n async getHidDeviceInfo(...args) {\n return this.device.getHidDeviceInfo(...args);\n }\n async fillKeyColor(...args) {\n return this.device.fillKeyColor(...args);\n }\n async fillKeyBuffer(...args) {\n return this.device.fillKeyBuffer(...args);\n }\n async fillPanelBuffer(...args) {\n return this.device.fillPanelBuffer(...args);\n }\n async clearKey(...args) {\n return this.device.clearKey(...args);\n }\n async clearPanel(...args) {\n return this.device.clearPanel(...args);\n }\n async setBrightness(...args) {\n return this.device.setBrightness(...args);\n }\n async resetToLogo(...args) {\n return this.device.resetToLogo(...args);\n }\n async getFirmwareVersion() {\n return this.device.getFirmwareVersion();\n }\n async getSerialNumber() {\n return this.device.getSerialNumber();\n }\n async fillLcd(...args) {\n return this.device.fillLcd(...args);\n }\n async setEncoderColor(...args) {\n return this.device.setEncoderColor(...args);\n }\n async setEncoderRingSingleColor(...args) {\n return this.device.setEncoderRingSingleColor(...args);\n }\n async setEncoderRingColors(...args) {\n return this.device.setEncoderRingColors(...args);\n }\n async fillLcdRegion(...args) {\n return this.device.fillLcdRegion(...args);\n }\n async clearLcdSegment(...args) {\n return this.device.clearLcdSegment(...args);\n }\n async getChildDeviceInfo(...args) {\n return this.device.getChildDeviceInfo(...args);\n }\n /**\n * EventEmitter\n */\n eventNames() {\n return this.device.eventNames();\n }\n listeners(event) {\n return this.device.listeners(event);\n }\n listenerCount(event) {\n return this.device.listenerCount(event);\n }\n emit(event, ...args) {\n return this.device.emit(event, ...args);\n }\n /**\n * Add a listener for a given event.\n */\n on(event, fn, context) {\n this.device.on(event, fn, context);\n return this;\n }\n addListener(event, fn, context) {\n this.device.addListener(event, fn, context);\n return this;\n }\n /**\n * Add a one-time listener for a given event.\n */\n once(event, fn, context) {\n this.device.once(event, fn, context);\n return this;\n }\n /**\n * Remove the listeners of a given event.\n */\n removeListener(event, fn, context, once) {\n this.device.removeListener(event, fn, context, once);\n return this;\n }\n off(event, fn, context, once) {\n this.device.off(event, fn, context, once);\n return this;\n }\n removeAllListeners(event) {\n this.device.removeAllListeners(event);\n return this;\n }\n}\nexports.StreamDeckProxy = StreamDeckProxy;\n//# sourceMappingURL=proxy.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.DefaultButtonsLcdService = void 0;\nclass DefaultButtonsLcdService {\n #imageWriter;\n #imagePacker;\n #device;\n #deviceProperties;\n constructor(imageWriter, imagePacker, device, deviceProperties) {\n this.#imageWriter = imageWriter;\n this.#imagePacker = imagePacker;\n this.#device = device;\n this.#deviceProperties = deviceProperties;\n }\n getLcdButtonControls() {\n return this.#deviceProperties.CONTROLS.filter((control) => control.type === 'button' && control.feedbackType === 'lcd');\n }\n calculateLcdGridSpan(buttonsLcd) {\n if (buttonsLcd.length === 0)\n return null;\n const allRowValues = buttonsLcd.map((button) => button.row);\n const allColumnValues = buttonsLcd.map((button) => button.column);\n return {\n minRow: Math.min(...allRowValues),\n maxRow: Math.max(...allRowValues),\n minCol: Math.min(...allColumnValues),\n maxCol: Math.max(...allColumnValues),\n };\n }\n calculateDimensionsFromGridSpan(gridSpan, buttonPixelSize, withPadding) {\n if (withPadding) {\n // TODO: Implement padding\n throw new Error('Not implemented');\n }\n else {\n const rowCount = gridSpan.maxRow - gridSpan.minRow + 1;\n const columnCount = gridSpan.maxCol - gridSpan.minCol + 1;\n // TODO: Consider that different rows/columns could have different dimensions\n return {\n width: columnCount * buttonPixelSize.width,\n height: rowCount * buttonPixelSize.height,\n };\n }\n }\n calculateFillPanelDimensions(options) {\n const buttonLcdControls = this.getLcdButtonControls();\n const gridSpan = this.calculateLcdGridSpan(buttonLcdControls);\n if (!gridSpan || buttonLcdControls.length === 0)\n return null;\n return this.calculateDimensionsFromGridSpan(gridSpan, buttonLcdControls[0].pixelSize, options?.withPadding);\n }\n async clearPanel() {\n const ps = [];\n if (this.#deviceProperties.FULLSCREEN_PANELS > 0) {\n // TODO - should this be a separate property?\n for (let screenIndex = 0; screenIndex < this.#deviceProperties.FULLSCREEN_PANELS; screenIndex++) {\n const buffer = new Uint8Array(1024);\n buffer[0] = 0x03;\n buffer[1] = 0x05;\n buffer[2] = screenIndex; // TODO - index\n ps.push(this.#device.sendReports([buffer]));\n }\n // TODO - clear rgb?\n }\n else {\n for (const control of this.#deviceProperties.CONTROLS) {\n if (control.type !== 'button')\n continue;\n switch (control.feedbackType) {\n case 'rgb':\n ps.push(this.sendKeyRgb(control.hidIndex, 0, 0, 0));\n break;\n case 'lcd':\n if (this.#deviceProperties.SUPPORTS_RGB_KEY_FILL) {\n ps.push(this.sendKeyRgb(control.hidIndex, 0, 0, 0));\n }\n else {\n const pixels = new Uint8Array(control.pixelSize.width * control.pixelSize.height * 3);\n ps.push(this.fillImageRangeControl(control, pixels, {\n format: 'rgb',\n offset: 0,\n stride: control.pixelSize.width * 3,\n }));\n }\n break;\n case 'none':\n // Do nothing\n break;\n }\n }\n }\n await Promise.all(ps);\n }\n async clearKey(keyIndex) {\n const control = this.#deviceProperties.CONTROLS.find((control) => control.type === 'button' && control.index === keyIndex);\n if (!control || control.feedbackType === 'none')\n throw new TypeError(`Expected a valid keyIndex`);\n if (this.#deviceProperties.SUPPORTS_RGB_KEY_FILL || control.feedbackType === 'rgb') {\n await this.sendKeyRgb(keyIndex, 0, 0, 0);\n }\n else {\n const pixels = new Uint8Array(control.pixelSize.width * control.pixelSize.height * 3);\n await this.fillImageRangeControl(control, pixels, {\n format: 'rgb',\n offset: 0,\n stride: control.pixelSize.width * 3,\n });\n }\n }\n async fillKeyColor(keyIndex, r, g, b) {\n this.checkRGBValue(r);\n this.checkRGBValue(g);\n this.checkRGBValue(b);\n const control = this.#deviceProperties.CONTROLS.find((control) => control.type === 'button' && control.index === keyIndex);\n if (!control || control.feedbackType === 'none')\n throw new TypeError(`Expected a valid keyIndex`);\n if (this.#deviceProperties.SUPPORTS_RGB_KEY_FILL || control.feedbackType === 'rgb') {\n await this.sendKeyRgb(keyIndex, r, g, b);\n }\n else {\n // rgba is excessive here, but it makes the fill easier as it can be done in a 32bit uint\n const pixelCount = control.pixelSize.width * control.pixelSize.height;\n const pixels = new Uint8Array(pixelCount * 4);\n const view = new DataView(pixels.buffer, pixels.byteOffset, pixels.byteLength);\n // write first pixel\n view.setUint8(0, r);\n view.setUint8(1, g);\n view.setUint8(2, b);\n view.setUint8(3, 255);\n // read computed pixel\n const sample = view.getUint32(0);\n // fill with computed pixel\n for (let i = 1; i < pixelCount; i++) {\n view.setUint32(i * 4, sample);\n }\n await this.fillImageRangeControl(control, pixels, {\n format: 'rgba',\n offset: 0,\n stride: control.pixelSize.width * 3,\n });\n }\n }\n async fillKeyBuffer(keyIndex, imageBuffer, options) {\n const sourceFormat = options?.format ?? 'rgb';\n this.checkSourceFormat(sourceFormat);\n const control = this.#deviceProperties.CONTROLS.find((control) => control.type === 'button' && control.index === keyIndex);\n if (!control || control.feedbackType === 'none')\n throw new TypeError(`Expected a valid keyIndex`);\n if (control.feedbackType !== 'lcd')\n throw new TypeError(`keyIndex ${control.index} does not support lcd feedback`);\n const imageSize = control.pixelSize.width * control.pixelSize.height * sourceFormat.length;\n if (imageBuffer.length !== imageSize) {\n throw new RangeError(`Expected image buffer of length ${imageSize}, got length ${imageBuffer.length}`);\n }\n await this.fillImageRangeControl(control, imageBuffer, {\n format: sourceFormat,\n offset: 0,\n stride: control.pixelSize.width * sourceFormat.length,\n });\n }\n async fillPanelBuffer(imageBuffer, options) {\n const sourceFormat = options?.format ?? 'rgb';\n this.checkSourceFormat(sourceFormat);\n const buttonLcdControls = this.getLcdButtonControls();\n const panelGridSpan = this.calculateLcdGridSpan(buttonLcdControls);\n if (!panelGridSpan || buttonLcdControls.length === 0) {\n throw new Error(`Panel does not support being filled`);\n }\n const panelDimensions = this.calculateDimensionsFromGridSpan(panelGridSpan, buttonLcdControls[0].pixelSize, options?.withPadding);\n const expectedByteCount = sourceFormat.length * panelDimensions.width * panelDimensions.height;\n if (imageBuffer.length !== expectedByteCount) {\n throw new RangeError(`Expected image buffer of length ${expectedByteCount}, got length ${imageBuffer.length}`);\n }\n const stride = panelDimensions.width * sourceFormat.length;\n const ps = [];\n for (const control of buttonLcdControls) {\n const controlRow = control.row - panelGridSpan.minRow;\n const controlCol = control.column - panelGridSpan.minCol;\n // TODO: Consider that different rows/columns could have different dimensions\n const iconSize = control.pixelSize.width * sourceFormat.length;\n const rowOffset = stride * controlRow * control.pixelSize.height;\n const colOffset = controlCol * iconSize;\n // TODO: Implement padding\n ps.push(this.fillImageRangeControl(control, imageBuffer, {\n format: sourceFormat,\n offset: rowOffset + colOffset,\n stride,\n }));\n }\n await Promise.all(ps);\n }\n async sendKeyRgb(keyIndex, red, green, blue) {\n await this.#device.sendFeatureReport(new Uint8Array([0x03, 0x06, keyIndex, red, green, blue]));\n }\n async fillImageRangeControl(buttonControl, imageBuffer, sourceOptions) {\n if (buttonControl.feedbackType !== 'lcd')\n throw new TypeError(`keyIndex ${buttonControl.index} does not support lcd feedback`);\n const byteBuffer = await this.#imagePacker.convertPixelBuffer(imageBuffer, sourceOptions, buttonControl.pixelSize);\n const packets = this.#imageWriter.generateFillImageWrites({ keyIndex: buttonControl.hidIndex }, byteBuffer);\n await this.#device.sendReports(packets);\n }\n checkRGBValue(value) {\n if (value < 0 || value > 255) {\n throw new TypeError('Expected a valid color RGB value 0 - 255');\n }\n }\n checkSourceFormat(format) {\n switch (format) {\n case 'rgb':\n case 'rgba':\n case 'bgr':\n case 'bgra':\n break;\n default: {\n const fmt = format;\n throw new TypeError(`Expected a known color format not \"${fmt}\"`);\n }\n }\n }\n}\nexports.DefaultButtonsLcdService = DefaultButtonsLcdService;\n//# sourceMappingURL=default.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.PedalLcdService = void 0;\nclass PedalLcdService {\n calculateFillPanelDimensions(_options) {\n // Not supported\n return null;\n }\n async clearKey(_keyIndex) {\n // Not supported\n }\n async clearPanel() {\n // Not supported\n }\n async fillKeyColor(_keyIndex, _r, _g, _b) {\n // Not supported\n }\n async fillKeyBuffer(_keyIndex, _imageBuffer, _options) {\n // Not supported\n }\n async fillPanelBuffer(_imageBuffer, _options) {\n // Not supported\n }\n}\nexports.PedalLcdService = PedalLcdService;\n//# sourceMappingURL=pedal.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.CallbackHook = void 0;\n/**\n * A simple helper that allows for the delayed registering of a listener, to avoid dependency cycles\n */\nclass CallbackHook {\n #listener = null;\n emit(key, ...args) {\n if (!this.#listener)\n throw new Error('No listener setup');\n this.#listener(key, ...args);\n }\n listen(fn) {\n this.#listener = fn;\n }\n}\nexports.CallbackHook = CallbackHook;\n//# sourceMappingURL=callback-hook.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.EncoderLedService = void 0;\nclass EncoderLedService {\n #device;\n #encoderControls;\n constructor(device, allControls) {\n this.#device = device;\n this.#encoderControls = allControls.filter((control) => control.type === 'encoder');\n }\n async clearAll() {\n const ps = [];\n for (const control of this.#encoderControls) {\n if (control.hasLed)\n ps.push(this.setEncoderColor(control.index, 0, 0, 0));\n if (control.ledRingSteps > 0)\n ps.push(this.setEncoderRingSingleColor(control.index, 0, 0, 0));\n }\n await Promise.all(ps);\n }\n async setEncoderColor(encoder, red, green, blue) {\n const control = this.#encoderControls.find((c) => c.index === encoder);\n if (!control)\n throw new Error(`Invalid encoder index ${encoder}`);\n if (!control.hasLed)\n throw new Error('Encoder does not have an LED');\n const buffer = new Uint8Array(1024);\n buffer[0] = 0x02;\n buffer[1] = 0x10;\n buffer[2] = encoder;\n buffer[3] = red;\n buffer[4] = green;\n buffer[5] = blue;\n await this.#device.sendReports([buffer]);\n }\n async setEncoderRingSingleColor(encoder, red, green, blue) {\n const control = this.#encoderControls.find((c) => c.index === encoder);\n if (!control)\n throw new Error(`Invalid encoder index ${encoder}`);\n if (control.ledRingSteps <= 0)\n throw new Error('Encoder does not have an LED ring');\n const buffer = new Uint8Array(1024);\n buffer[0] = 0x02;\n buffer[1] = 0x0f;\n buffer[2] = encoder;\n for (let i = 0; i < control.ledRingSteps; i++) {\n const offset = 3 + i * 3;\n buffer[offset] = red;\n buffer[offset + 1] = green;\n buffer[offset + 2] = blue;\n }\n await this.#device.sendReports([buffer]);\n }\n async setEncoderRingColors(encoder, colors) {\n const control = this.#encoderControls.find((c) => c.index === encoder);\n if (!control)\n throw new Error(`Invalid encoder index ${encoder}`);\n if (control.ledRingSteps <= 0)\n throw new Error('Encoder does not have an LED ring');\n if (colors.length !== control.ledRingSteps * 3)\n throw new Error('Invalid colors length');\n const colorsBuffer = colors instanceof Uint8Array ? colors : new Uint8Array(colors);\n const buffer = new Uint8Array(1024);\n buffer[0] = 0x02;\n buffer[1] = 0x0f;\n buffer[2] = encoder;\n buffer.set(colorsBuffer, 3);\n await this.#device.sendReports([buffer]);\n }\n}\nexports.EncoderLedService = EncoderLedService;\n//# sourceMappingURL=encoderLed.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.BitmapButtonLcdImagePacker = void 0;\nconst util_js_1 = require(\"../../util.js\");\nclass BitmapButtonLcdImagePacker {\n #targetOptions;\n #bmpImagePPM;\n constructor(targetOptions, bmpImagePPM) {\n this.#targetOptions = targetOptions;\n this.#bmpImagePPM = bmpImagePPM;\n }\n async convertPixelBuffer(sourceBuffer, sourceOptions, targetSize) {\n const byteBuffer = (0, util_js_1.transformImageBuffer)(sourceBuffer, sourceOptions, this.#targetOptions, util_js_1.BMP_HEADER_LENGTH, targetSize.width, targetSize.height);\n (0, util_js_1.writeBMPHeader)(byteBuffer, targetSize.width, targetSize.height, byteBuffer.length - util_js_1.BMP_HEADER_LENGTH, this.#bmpImagePPM);\n return byteBuffer;\n }\n}\nexports.BitmapButtonLcdImagePacker = BitmapButtonLcdImagePacker;\n//# sourceMappingURL=bitmap.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.JpegButtonLcdImagePacker = void 0;\nconst util_js_1 = require(\"../../util.js\");\nclass JpegButtonLcdImagePacker {\n #encodeJPEG;\n #xyFlip;\n constructor(encodeJPEG, xyFlip) {\n this.#encodeJPEG = encodeJPEG;\n this.#xyFlip = xyFlip;\n }\n async convertPixelBuffer(sourceBuffer, sourceOptions, targetSize) {\n const byteBuffer = (0, util_js_1.transformImageBuffer)(sourceBuffer, sourceOptions, { colorMode: 'rgba', xFlip: this.#xyFlip, yFlip: this.#xyFlip }, 0, targetSize.width, targetSize.height);\n return this.#encodeJPEG(byteBuffer, targetSize.width, targetSize.height);\n }\n}\nexports.JpegButtonLcdImagePacker = JpegButtonLcdImagePacker;\n//# sourceMappingURL=jpeg.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.StreamdeckNeoLcdImageHeaderGenerator = exports.StreamdeckPlusLcdImageHeaderGenerator = exports.StreamdeckGen2ImageHeaderGenerator = exports.StreamdeckGen1ImageHeaderGenerator = void 0;\nconst util_js_1 = require(\"../../util.js\");\nclass StreamdeckGen1ImageHeaderGenerator {\n getFillImageCommandHeaderLength() {\n return 16;\n }\n writeFillImageCommandHeader(buffer, props, partIndex, isLast, _bodyLength) {\n const bufferView = (0, util_js_1.uint8ArrayToDataView)(buffer);\n bufferView.setUint8(0, 0x02);\n bufferView.setUint8(1, 0x01);\n bufferView.setUint16(2, partIndex, true);\n bufferView.setUint8(4, isLast ? 1 : 0);\n bufferView.setUint8(5, props.keyIndex + 1);\n }\n}\nexports.StreamdeckGen1ImageHeaderGenerator = StreamdeckGen1ImageHeaderGenerator;\nclass StreamdeckGen2ImageHeaderGenerator {\n getFillImageCommandHeaderLength() {\n return 8;\n }\n writeFillImageCommandHeader(buffer, props, partIndex, isLast, bodyLength) {\n const bufferView = (0, util_js_1.uint8ArrayToDataView)(buffer);\n bufferView.setUint8(0, 0x02);\n bufferView.setUint8(1, 0x07);\n bufferView.setUint8(2, props.keyIndex);\n bufferView.setUint8(3, isLast ? 1 : 0);\n bufferView.setUint16(4, bodyLength, true);\n bufferView.setUint16(6, partIndex++, true);\n }\n}\nexports.StreamdeckGen2ImageHeaderGenerator = StreamdeckGen2ImageHeaderGenerator;\nclass StreamdeckPlusLcdImageHeaderGenerator {\n getFillImageCommandHeaderLength() {\n return 16;\n }\n writeFillImageCommandHeader(buffer, props, partIndex, isLast, bodyLength) {\n const bufferView = (0, util_js_1.uint8ArrayToDataView)(buffer);\n bufferView.setUint8(0, 0x02);\n bufferView.setUint8(1, 0x0c);\n bufferView.setUint16(2, props.x, true);\n bufferView.setUint16(4, props.y, true);\n bufferView.setUint16(6, props.width, true);\n bufferView.setUint16(8, props.height, true);\n bufferView.setUint8(10, isLast ? 1 : 0);\n bufferView.setUint16(11, partIndex, true);\n bufferView.setUint16(13, bodyLength, true);\n }\n}\nexports.StreamdeckPlusLcdImageHeaderGenerator = StreamdeckPlusLcdImageHeaderGenerator;\nclass StreamdeckNeoLcdImageHeaderGenerator {\n getFillImageCommandHeaderLength() {\n return 8;\n }\n writeFillImageCommandHeader(buffer, _props, partIndex, isLast, bodyLength) {\n const bufferView = (0, util_js_1.uint8ArrayToDataView)(buffer);\n bufferView.setUint8(0, 0x02);\n bufferView.setUint8(1, 0x0b);\n bufferView.setUint8(2, 0);\n bufferView.setUint8(3, isLast ? 1 : 0);\n bufferView.setUint16(4, bodyLength, true);\n bufferView.setUint16(6, partIndex, true);\n }\n}\nexports.StreamdeckNeoLcdImageHeaderGenerator = StreamdeckNeoLcdImageHeaderGenerator;\n//# sourceMappingURL=headerGenerator.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.StreamdeckDefaultImageWriter = exports.StreamdeckOriginalImageWriter = void 0;\nconst headerGenerator_js_1 = require(\"./headerGenerator.js\");\nclass StreamdeckOriginalImageWriter {\n headerGenerator = new headerGenerator_js_1.StreamdeckGen1ImageHeaderGenerator();\n generateFillImageWrites(props, byteBuffer) {\n const MAX_PACKET_SIZE = 8191;\n const PACKET_HEADER_LENGTH = this.headerGenerator.getFillImageCommandHeaderLength();\n // The original uses larger packets, and splits the payload equally across 2\n const packet1Bytes = byteBuffer.length / 2;\n const packet1 = new Uint8Array(MAX_PACKET_SIZE);\n this.headerGenerator.writeFillImageCommandHeader(packet1, props, 0x01, false, packet1Bytes);\n packet1.set(byteBuffer.subarray(0, packet1Bytes), PACKET_HEADER_LENGTH);\n const packet2 = new Uint8Array(MAX_PACKET_SIZE);\n this.headerGenerator.writeFillImageCommandHeader(packet2, props, 0x02, true, packet1Bytes);\n packet2.set(byteBuffer.subarray(packet1Bytes), PACKET_HEADER_LENGTH);\n return [packet1, packet2];\n }\n}\nexports.StreamdeckOriginalImageWriter = StreamdeckOriginalImageWriter;\nclass StreamdeckDefaultImageWriter {\n headerGenerator;\n constructor(headerGenerator) {\n this.headerGenerator = headerGenerator;\n }\n generateFillImageWrites(props, byteBuffer) {\n const MAX_PACKET_SIZE = 1024;\n const PACKET_HEADER_LENGTH = this.headerGenerator.getFillImageCommandHeaderLength();\n const MAX_PAYLOAD_SIZE = MAX_PACKET_SIZE - PACKET_HEADER_LENGTH;\n const result = [];\n let remainingBytes = byteBuffer.length;\n for (let part = 0; remainingBytes > 0; part++) {\n const packet = new Uint8Array(MAX_PACKET_SIZE);\n const byteCount = Math.min(remainingBytes, MAX_PAYLOAD_SIZE);\n this.headerGenerator.writeFillImageCommandHeader(packet, props, part, remainingBytes <= MAX_PAYLOAD_SIZE, byteCount);\n const byteOffset = byteBuffer.length - remainingBytes;\n remainingBytes -= byteCount;\n packet.set(byteBuffer.subarray(byteOffset, byteOffset + byteCount), PACKET_HEADER_LENGTH);\n result.push(packet);\n }\n return result;\n }\n}\nexports.StreamdeckDefaultImageWriter = StreamdeckDefaultImageWriter;\n//# sourceMappingURL=imageWriter.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.ButtonOnlyInputService = void 0;\nclass ButtonOnlyInputService {\n deviceProperties;\n #keyState;\n #eventSource;\n constructor(deviceProperties, eventSource) {\n this.deviceProperties = deviceProperties;\n this.#eventSource = eventSource;\n const maxButtonIndex = this.deviceProperties.CONTROLS.filter((control) => control.type === 'button').map((control) => control.index);\n this.#keyState = new Array(Math.max(-1, ...maxButtonIndex) + 1).fill(false);\n }\n handleInput(data) {\n const dataOffset = this.deviceProperties.KEY_DATA_OFFSET || 0;\n for (const control of this.deviceProperties.CONTROLS) {\n if (control.type !== 'button')\n continue;\n const keyPressed = Boolean(data[dataOffset + control.hidIndex]);\n const stateChanged = keyPressed !== this.#keyState[control.index];\n if (stateChanged) {\n this.#keyState[control.index] = keyPressed;\n if (keyPressed) {\n this.#eventSource.emit('down', control);\n }\n else {\n this.#eventSource.emit('up', control);\n }\n }\n }\n }\n}\nexports.ButtonOnlyInputService = ButtonOnlyInputService;\n//# sourceMappingURL=gen1.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Gen2InputService = void 0;\nconst gen1_js_1 = require(\"./gen1.js\");\nconst util_js_1 = require(\"../../util.js\");\nclass Gen2InputService extends gen1_js_1.ButtonOnlyInputService {\n #eventSource;\n #encoderControls;\n #encoderState;\n #lcdSegmentControls;\n constructor(deviceProperties, eventSource) {\n super(deviceProperties, eventSource);\n this.#eventSource = eventSource;\n this.#encoderControls = deviceProperties.CONTROLS.filter((control) => control.type === 'encoder');\n const maxIndex = Math.max(-1, ...this.#encoderControls.map((control) => control.index));\n this.#encoderState = new Array(maxIndex + 1).fill(false);\n this.#lcdSegmentControls = deviceProperties.CONTROLS.filter((control) => control.type === 'lcd-segment');\n }\n handleInput(data) {\n const inputType = data[0];\n switch (inputType) {\n case 0x00: // Button\n super.handleInput(data);\n break;\n case 0x02: // LCD\n this.#handleLcdSegmentInput(data);\n break;\n case 0x03: // Encoder\n this.#handleEncoderInput(data);\n break;\n case 0x04: // NFC\n this.#handleNfcRead(data);\n break;\n }\n }\n #handleLcdSegmentInput(data) {\n // Future: This will need to handle selecting the correct control\n const lcdSegmentControl = this.#lcdSegmentControls.find((control) => control.id === 0);\n if (!lcdSegmentControl)\n return;\n const bufferView = (0, util_js_1.uint8ArrayToDataView)(data);\n const position = {\n x: bufferView.getUint16(5, true),\n y: bufferView.getUint16(7, true),\n };\n switch (data[3]) {\n case 1: // short press\n this.#eventSource.emit('lcdShortPress', lcdSegmentControl, position);\n break;\n case 2: // long press\n this.#eventSource.emit('lcdLongPress', lcdSegmentControl, position);\n break;\n case 3: {\n // swipe\n const positionTo = {\n x: bufferView.getUint16(9, true),\n y: bufferView.getUint16(11, true),\n };\n this.#eventSource.emit('lcdSwipe', lcdSegmentControl, position, positionTo);\n break;\n }\n }\n }\n #handleEncoderInput(data) {\n switch (data[3]) {\n case 0x00: // press/release\n for (const encoderControl of this.#encoderControls) {\n const keyPressed = Boolean(data[4 + encoderControl.hidIndex]);\n const stateChanged = keyPressed !== this.#encoderState[encoderControl.index];\n if (stateChanged) {\n this.#encoderState[encoderControl.index] = keyPressed;\n if (keyPressed) {\n this.#eventSource.emit('down', encoderControl);\n }\n else {\n this.#eventSource.emit('up', encoderControl);\n }\n }\n }\n break;\n case 0x01: // rotate\n for (const encoderControl of this.#encoderControls) {\n const intArray = new Int8Array(data.buffer, data.byteOffset, data.byteLength);\n const value = intArray[4 + encoderControl.hidIndex];\n if (value !== 0) {\n this.#eventSource.emit('rotate', encoderControl, value);\n }\n }\n break;\n }\n }\n #handleNfcRead(data) {\n if (!this.deviceProperties.HAS_NFC_READER)\n return;\n const length = data[1] + data[2] * 256;\n const id = new TextDecoder('ascii').decode(data.subarray(3, 3 + length));\n this.#eventSource.emit('nfcRead', id);\n }\n}\nexports.Gen2InputService = Gen2InputService;\n//# sourceMappingURL=gen2.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.StreamDeckNeoLcdService = void 0;\nconst headerGenerator_js_1 = require(\"../imageWriter/headerGenerator.js\");\nconst imageWriter_js_1 = require(\"../imageWriter/imageWriter.js\");\nconst util_js_1 = require(\"../../util.js\");\nclass StreamDeckNeoLcdService {\n #encodeJPEG;\n #device;\n #lcdControls;\n #lcdImageWriter = new imageWriter_js_1.StreamdeckDefaultImageWriter(new headerGenerator_js_1.StreamdeckNeoLcdImageHeaderGenerator());\n constructor(encodeJPEG, device, lcdControls) {\n this.#encodeJPEG = encodeJPEG;\n this.#device = device;\n this.#lcdControls = lcdControls;\n }\n async fillLcdRegion(_index, _x, _y, _imageBuffer, _sourceOptions) {\n throw new Error('Not supported for this model');\n }\n async fillLcd(index, imageBuffer, sourceOptions) {\n const lcdControl = this.#lcdControls.find((control) => control.id === index);\n if (!lcdControl)\n throw new Error(`Invalid lcd segment index ${index}`);\n const imageSize = lcdControl.pixelSize.width * lcdControl.pixelSize.height * sourceOptions.format.length;\n if (imageBuffer.length !== imageSize) {\n throw new RangeError(`Expected image buffer of length ${imageSize}, got length ${imageBuffer.length}`);\n }\n // A lot of this drawing code is heavily based on the normal button\n const byteBuffer = await this.convertFillLcdBuffer(imageBuffer, lcdControl.pixelSize, sourceOptions);\n const packets = this.#lcdImageWriter.generateFillImageWrites(null, byteBuffer);\n await this.#device.sendReports(packets);\n }\n async clearLcdSegment(index) {\n const lcdControl = this.#lcdControls.find((control) => control.id === index);\n if (!lcdControl)\n throw new Error(`Invalid lcd segment index ${index}`);\n const buffer = new Uint8Array(lcdControl.pixelSize.width * lcdControl.pixelSize.height * 4);\n await this.fillLcd(index, buffer, {\n format: 'rgba',\n });\n }\n async clearAllLcdSegments() {\n const ps = [];\n for (const control of this.#lcdControls) {\n ps.push(this.clearLcdSegment(control.id));\n }\n await Promise.all(ps);\n }\n async convertFillLcdBuffer(sourceBuffer, size, sourceOptions) {\n const sourceOptions2 = {\n format: sourceOptions.format,\n offset: 0,\n stride: size.width * sourceOptions.format.length,\n };\n const byteBuffer = (0, util_js_1.transformImageBuffer)(sourceBuffer, sourceOptions2, { colorMode: 'rgba', xFlip: true, yFlip: true }, 0, size.width, size.height);\n return this.#encodeJPEG(byteBuffer, size.width, size.height);\n }\n}\nexports.StreamDeckNeoLcdService = StreamDeckNeoLcdService;\n//# sourceMappingURL=neo.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.StreamDeckPlusLcdService = void 0;\nconst headerGenerator_js_1 = require(\"../imageWriter/headerGenerator.js\");\nconst imageWriter_js_1 = require(\"../imageWriter/imageWriter.js\");\nconst util_js_1 = require(\"../../util.js\");\nclass StreamDeckPlusLcdService {\n #encodeJPEG;\n #device;\n #lcdControls;\n #lcdImageWriter = new imageWriter_js_1.StreamdeckDefaultImageWriter(new headerGenerator_js_1.StreamdeckPlusLcdImageHeaderGenerator());\n constructor(encodeJPEG, device, lcdControls) {\n this.#encodeJPEG = encodeJPEG;\n this.#device = device;\n this.#lcdControls = lcdControls;\n }\n async fillLcd(index, buffer, sourceOptions) {\n const lcdControl = this.#lcdControls.find((control) => control.id === index);\n if (!lcdControl)\n throw new Error(`Invalid lcd segment index ${index}`);\n return this.fillControlRegion(lcdControl, 0, 0, buffer, {\n format: sourceOptions.format,\n width: lcdControl.pixelSize.width,\n height: lcdControl.pixelSize.height,\n });\n }\n async fillLcdRegion(index, x, y, imageBuffer, sourceOptions) {\n const lcdControl = this.#lcdControls.find((control) => control.id === index);\n if (!lcdControl)\n throw new Error(`Invalid lcd segment index ${index}`);\n return this.fillControlRegion(lcdControl, x, y, imageBuffer, sourceOptions);\n }\n async clearLcdSegment(index) {\n const lcdControl = this.#lcdControls.find((control) => control.id === index);\n if (!lcdControl)\n throw new Error(`Invalid lcd segment index ${index}`);\n const buffer = new Uint8Array(lcdControl.pixelSize.width * lcdControl.pixelSize.height * 4);\n await this.fillControlRegion(lcdControl, 0, 0, buffer, {\n format: 'rgba',\n width: lcdControl.pixelSize.width,\n height: lcdControl.pixelSize.height,\n });\n }\n async clearAllLcdSegments() {\n const ps = [];\n for (const control of this.#lcdControls) {\n ps.push(this.clearLcdSegment(control.id));\n }\n await Promise.all(ps);\n }\n async fillControlRegion(lcdControl, x, y, imageBuffer, sourceOptions) {\n // Basic bounds checking\n const maxSize = lcdControl.pixelSize;\n if (x < 0 || x + sourceOptions.width > maxSize.width) {\n throw new TypeError(`Image will not fit within the lcd segment`);\n }\n if (y < 0 || y + sourceOptions.height > maxSize.height) {\n throw new TypeError(`Image will not fit within the lcd segment`);\n }\n const imageSize = sourceOptions.width * sourceOptions.height * sourceOptions.format.length;\n if (imageBuffer.length !== imageSize) {\n throw new RangeError(`Expected image buffer of length ${imageSize}, got length ${imageBuffer.length}`);\n }\n // A lot of this drawing code is heavily based on the normal button\n const byteBuffer = await this.convertFillLcdBuffer(imageBuffer, sourceOptions);\n const packets = this.#lcdImageWriter.generateFillImageWrites({ ...sourceOptions, x, y }, byteBuffer);\n await this.#device.sendReports(packets);\n }\n async convertFillLcdBuffer(sourceBuffer, sourceOptions) {\n const sourceOptions2 = {\n format: sourceOptions.format,\n offset: 0,\n stride: sourceOptions.width * sourceOptions.format.length,\n };\n const byteBuffer = (0, util_js_1.transformImageBuffer)(sourceBuffer, sourceOptions2, { colorMode: 'rgba' }, 0, sourceOptions.width, sourceOptions.height);\n return this.#encodeJPEG(byteBuffer, sourceOptions.width, sourceOptions.height);\n }\n}\nexports.StreamDeckPlusLcdService = StreamDeckPlusLcdService;\n//# sourceMappingURL=plus.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Gen1PropertiesService = void 0;\nclass Gen1PropertiesService {\n #device;\n constructor(device) {\n this.#device = device;\n }\n async setBrightness(percentage) {\n if (percentage < 0 || percentage > 100) {\n throw new RangeError('Expected brightness percentage to be between 0 and 100');\n }\n // prettier-ignore\n const brightnessCommandBuffer = new Uint8Array([\n 0x05,\n 0x55, 0xaa, 0xd1, 0x01, percentage, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00\n ]);\n await this.#device.sendFeatureReport(brightnessCommandBuffer);\n }\n async resetToLogo() {\n // prettier-ignore\n const resetCommandBuffer = new Uint8Array([\n 0x0b,\n 0x63, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00\n ]);\n await this.#device.sendFeatureReport(resetCommandBuffer);\n }\n async getFirmwareVersion() {\n let val;\n try {\n val = await this.#device.getFeatureReport(4, 32);\n }\n catch (_e) {\n // In case some devices can't handle the different report length\n val = await this.#device.getFeatureReport(4, 17);\n }\n const end = val.indexOf(0, 5);\n return new TextDecoder('ascii').decode(val.subarray(5, end === -1 ? undefined : end));\n }\n async getSerialNumber() {\n let val;\n try {\n val = await this.#device.getFeatureReport(3, 32);\n }\n catch (_e) {\n // In case some devices can't handle the different report length\n val = await this.#device.getFeatureReport(3, 17);\n }\n return new TextDecoder('ascii').decode(val.subarray(5, 17));\n }\n}\nexports.Gen1PropertiesService = Gen1PropertiesService;\n//# sourceMappingURL=gen1.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Gen2PropertiesService = void 0;\nclass Gen2PropertiesService {\n #device;\n constructor(device) {\n this.#device = device;\n }\n async setBrightness(percentage) {\n if (percentage < 0 || percentage > 100) {\n throw new RangeError('Expected brightness percentage to be between 0 and 100');\n }\n // prettier-ignore\n const brightnessCommandBuffer = new Uint8Array([\n 0x03,\n 0x08, percentage, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00\n ]);\n await this.#device.sendFeatureReport(brightnessCommandBuffer);\n }\n async resetToLogo() {\n // prettier-ignore\n const resetCommandBuffer = new Uint8Array([\n 0x03,\n 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00\n ]);\n await this.#device.sendFeatureReport(resetCommandBuffer);\n }\n async getFirmwareVersion() {\n const val = await this.#device.getFeatureReport(5, 32);\n const end = val[1] + 2;\n return new TextDecoder('ascii').decode(val.subarray(6, end));\n }\n async getSerialNumber() {\n const val = await this.#device.getFeatureReport(6, 32);\n const end = val[1] + 2;\n return new TextDecoder('ascii').decode(val.subarray(2, end));\n }\n}\nexports.Gen2PropertiesService = Gen2PropertiesService;\n//# sourceMappingURL=gen2.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.PedalPropertiesService = void 0;\nclass PedalPropertiesService {\n #device;\n constructor(device) {\n this.#device = device;\n }\n async setBrightness(_percentage) {\n // Not supported\n }\n async resetToLogo() {\n // Not supported\n }\n async getFirmwareVersion() {\n const val = await this.#device.getFeatureReport(5, 32);\n const end = val.indexOf(0, 6);\n return new TextDecoder('ascii').decode(val.subarray(6, end === -1 ? undefined : end));\n }\n async getSerialNumber() {\n const val = await this.#device.getFeatureReport(6, 32);\n return new TextDecoder('ascii').decode(val.subarray(2, 14));\n }\n}\nexports.PedalPropertiesService = PedalPropertiesService;\n//# sourceMappingURL=pedal.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\n//# sourceMappingURL=types.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.BMP_HEADER_LENGTH = void 0;\nexports.transformImageBuffer = transformImageBuffer;\nexports.writeBMPHeader = writeBMPHeader;\nexports.uint8ArrayToDataView = uint8ArrayToDataView;\nfunction transformImageBuffer(imageBuffer, sourceOptions, targetOptions, destPadding, imageWidth, imageHeight) {\n const imageBufferView = uint8ArrayToDataView(imageBuffer);\n const byteBuffer = new Uint8Array(destPadding + imageWidth * imageHeight * targetOptions.colorMode.length);\n const byteBufferView = uint8ArrayToDataView(byteBuffer);\n const flipColours = sourceOptions.format.substring(0, 3) !== targetOptions.colorMode.substring(0, 3);\n for (let y = 0; y < imageHeight; y++) {\n const rowOffset = destPadding + imageWidth * targetOptions.colorMode.length * y;\n for (let x = 0; x < imageWidth; x++) {\n // Apply x/y flips\n let x2 = targetOptions.xFlip ? imageWidth - x - 1 : x;\n let y2 = targetOptions.yFlip ? imageHeight - y - 1 : y;\n if (targetOptions.rotate) {\n // Swap x and y\n const tmpX = x2;\n x2 = y2;\n y2 = tmpX;\n }\n const srcOffset = y2 * sourceOptions.stride + sourceOptions.offset + x2 * sourceOptions.format.length;\n const red = imageBufferView.getUint8(srcOffset);\n const green = imageBufferView.getUint8(srcOffset + 1);\n const blue = imageBufferView.getUint8(srcOffset + 2);\n const targetOffset = rowOffset + x * targetOptions.colorMode.length;\n if (flipColours) {\n byteBufferView.setUint8(targetOffset, blue);\n byteBufferView.setUint8(targetOffset + 1, green);\n byteBufferView.setUint8(targetOffset + 2, red);\n }\n else {\n byteBufferView.setUint8(targetOffset, red);\n byteBufferView.setUint8(targetOffset + 1, green);\n byteBufferView.setUint8(targetOffset + 2, blue);\n }\n if (targetOptions.colorMode.length === 4) {\n byteBufferView.setUint8(targetOffset + 3, 255);\n }\n }\n }\n return byteBuffer;\n}\nexports.BMP_HEADER_LENGTH = 54;\nfunction writeBMPHeader(buf, imageWidth, imageHeight, imageBytes, imagePPM) {\n const bufView = uint8ArrayToDataView(buf);\n // Uses header format BITMAPINFOHEADER https://en.wikipedia.org/wiki/BMP_file_format\n // Bitmap file header\n bufView.setUint8(0, 0x42); // B\n bufView.setUint8(1, 0x4d); // M\n bufView.setUint32(2, imageBytes + 54, true);\n bufView.setInt16(6, 0, true);\n bufView.setInt16(8, 0, true);\n bufView.setUint32(10, 54, true); // Full header size\n // DIB header (BITMAPINFOHEADER)\n bufView.setUint32(14, 40, true); // DIB header size\n bufView.setInt32(18, imageWidth, true);\n bufView.setInt32(22, imageHeight, true);\n bufView.setInt16(26, 1, true); // Color planes\n bufView.setInt16(28, 24, true); // Bit depth\n bufView.setInt32(30, 0, true); // Compression\n bufView.setInt32(34, imageBytes, true); // Image size\n bufView.setInt32(38, imagePPM, true); // Horizontal resolution ppm\n bufView.setInt32(42, imagePPM, true); // Vertical resolution ppm\n bufView.setInt32(46, 0, true); // Colour pallette size\n bufView.setInt32(50, 0, true); // 'Important' Colour count\n}\nfunction uint8ArrayToDataView(buffer) {\n return new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);\n}\n//# sourceMappingURL=util.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.WebHIDDevice = void 0;\nconst eventemitter3_1 = require(\"eventemitter3\");\nconst p_queue_1 = require(\"p-queue\");\n/**\n * The wrapped browser HIDDevice.\n * This translates it into the common format expected by @elgato-stream-deck/core\n */\nclass WebHIDDevice extends eventemitter3_1.EventEmitter {\n device;\n reportQueue = new p_queue_1.default({ concurrency: 1 });\n constructor(device) {\n super();\n this.device = device;\n // this.device.on('data', data => this.emit('data', data))\n // this.device.on('error', error => this.emit('error', error))\n this.device.addEventListener('inputreport', (event) => {\n // Button press\n if (event.reportId === 0x01) {\n const data = new Uint8Array(event.data.buffer, event.data.byteOffset, event.data.byteLength);\n this.emit('input', data);\n }\n });\n }\n async close() {\n return this.device.close();\n }\n async forget() {\n return this.device.forget();\n }\n async sendFeatureReport(data) {\n return this.device.sendFeatureReport(data[0], data.subarray(1));\n }\n async getFeatureReport(reportId, _reportLength) {\n const view = await this.device.receiveFeatureReport(reportId);\n return new Uint8Array(view.buffer, view.byteOffset, view.byteLength);\n }\n async sendReports(buffers) {\n return this.reportQueue.add(async () => {\n for (const data of buffers) {\n await this.device.sendReport(data[0], data.subarray(1));\n }\n });\n }\n async getDeviceInfo() {\n return {\n path: undefined,\n productId: this.device.productId,\n vendorId: this.device.vendorId,\n };\n }\n async getChildDeviceInfo() {\n // Not supported\n return null;\n }\n}\nexports.WebHIDDevice = WebHIDDevice;\n//# sourceMappingURL=hid-device.js.map","\"use strict\";\n/* eslint-disable n/no-unsupported-features/node-builtins */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.StreamDeckWeb = exports.DeviceModelId = exports.VENDOR_ID = void 0;\nexports.requestStreamDecks = requestStreamDecks;\nexports.getStreamDecks = getStreamDecks;\nexports.openDevice = openDevice;\nconst core_1 = require(\"@elgato-stream-deck/core\");\nconst hid_device_js_1 = require(\"./hid-device.js\");\nconst jpeg_js_1 = require(\"./jpeg.js\");\nconst wrapper_js_1 = require(\"./wrapper.js\");\nvar core_2 = require(\"@elgato-stream-deck/core\");\nObject.defineProperty(exports, \"VENDOR_ID\", { enumerable: true, get: function () { return core_2.VENDOR_ID; } });\nObject.defineProperty(exports, \"DeviceModelId\", { enumerable: true, get: function () { return core_2.DeviceModelId; } });\nvar wrapper_js_2 = require(\"./wrapper.js\");\nObject.defineProperty(exports, \"StreamDeckWeb\", { enumerable: true, get: function () { return wrapper_js_2.StreamDeckWeb; } });\n/**\n * Request the user to select some streamdecks to open\n * @param userOptions Options to customise the device behvaiour\n */\nasync function requestStreamDecks(options) {\n // TODO - error handling\n const browserDevices = await navigator.hid.requestDevice({\n filters: [\n {\n vendorId: core_1.VENDOR_ID,\n },\n ],\n });\n return Promise.all(browserDevices.map(async (dev) => openDevice(dev, options)));\n}\n/**\n * Reopen previously selected streamdecks.\n * The browser remembers what the user previously allowed your site to access, and this will open those without the request dialog\n * @param options Options to customise the device behvaiour\n */\nasync function getStreamDecks(options) {\n const browserDevices = await navigator.hid.getDevices();\n const validDevices = browserDevices.filter((d) => d.vendorId === core_1.VENDOR_ID);\n const resultDevices = await Promise.all(validDevices.map(async (dev) => openDevice(dev, options).catch((_) => null)));\n return resultDevices.filter((v) => !!v);\n}\n/**\n * Open a StreamDeck from a manually selected HIDDevice handle\n * @param browserDevice The unopened browser HIDDevice\n * @param userOptions Options to customise the device behvaiour\n */\nasync function openDevice(browserDevice, userOptions) {\n const model = core_1.DEVICE_MODELS.find((m) => browserDevice.vendorId === core_1.VENDOR_ID && m.productIds.includes(browserDevice.productId));\n if (!model) {\n throw new Error('Stream Deck is of unexpected type.');\n }\n await browserDevice.open();\n try {\n const options = {\n encodeJPEG: jpeg_js_1.encodeJPEG,\n ...userOptions,\n };\n const browserHid = new hid_device_js_1.WebHIDDevice(browserDevice);\n const device = model.factory(browserHid, options || {});\n return new wrapper_js_1.StreamDeckWeb(device, browserHid);\n }\n catch (e) {\n await browserDevice.close().catch(() => null); // Suppress error\n throw e;\n }\n}\n//# sourceMappingURL=index.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.encodeJPEG = encodeJPEG;\n/**\n * The default JPEG encoder.\n * Utilises a hidden canvas to convert a byte array buffer into a jpeg\n * @param buffer The buffer to convert\n * @param width Width of the image\n * @param height Hieght of the image\n */\nasync function encodeJPEG(buffer, width, height) {\n const blob = await new Promise((resolve, reject) => {\n const canvas = document.createElement('canvas');\n canvas.width = width;\n canvas.height = height;\n const ctx = canvas.getContext('2d');\n if (ctx) {\n const imageData = ctx.createImageData(width, height);\n imageData.data.set(buffer);\n ctx.putImageData(imageData, 0, 0);\n canvas.toBlob((b) => {\n if (b) {\n resolve(b);\n }\n else {\n reject(new Error('No image generated'));\n }\n }, 'image/jpeg', 0.9);\n }\n else {\n reject(new Error('Failed to get canvas context'));\n }\n });\n return new Uint8Array(await blob.arrayBuffer());\n}\n//# sourceMappingURL=jpeg.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.StreamDeckWeb = void 0;\nconst core_1 = require(\"@elgato-stream-deck/core\");\n/**\n * A StreamDeck instance.\n * This is an extended variant of the class, to provide some more web friendly helpers, such as accepting a canvas\n */\nclass StreamDeckWeb extends core_1.StreamDeckProxy {\n hid;\n constructor(device, hid) {\n super(device);\n this.hid = hid;\n }\n /**\n * Instruct the browser to close and forget the device. This will revoke the website's permissions to access the device.\n */\n async forget() {\n await this.hid.forget();\n }\n async fillKeyCanvas(keyIndex, canvas) {\n // this.checkValidKeyIndex(keyIndex)\n const ctx = canvas.getContext('2d');\n if (!ctx)\n throw new Error('Failed to get canvas context');\n const control = this.CONTROLS.find((control) => control.type === 'button' && control.index === keyIndex);\n if (!control || control.feedbackType === 'none')\n throw new TypeError(`Expected a valid keyIndex`);\n if (control.feedbackType !== 'lcd')\n throw new TypeError(`keyIndex ${control.index} does not support lcd feedback`);\n const data = ctx.getImageData(0, 0, control.pixelSize.width, control.pixelSize.height);\n return this.device.fillKeyBuffer(keyIndex, data.data, { format: 'rgba' });\n }\n async fillPanelCanvas(canvas) {\n const ctx = canvas.getContext('2d');\n if (!ctx)\n throw new Error('Failed to get canvas context');\n const dimensions = this.device.calculateFillPanelDimensions();\n if (!dimensions)\n throw new Error('Panel does not support filling');\n const data = ctx.getImageData(0, 0, dimensions.width, dimensions.height);\n return this.device.fillPanelBuffer(data.data, { format: 'rgba' });\n }\n}\nexports.StreamDeckWeb = StreamDeckWeb;\n//# sourceMappingURL=wrapper.js.map","/******************************************************************************\nCopyright (c) Microsoft Corporation.\n\nPermission to use, copy, modify, and/or distribute this software for any\npurpose with or without fee is hereby granted.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\nPERFORMANCE OF THIS SOFTWARE.\n***************************************************************************** */\n/* global Reflect, Promise, SuppressedError, Symbol, Iterator */\n\nvar extendStatics = function(d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n};\n\nexport function __extends(d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n}\n\nexport var __assign = function() {\n __assign = Object.assign || function __assign(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\n }\n return t;\n }\n return __assign.apply(this, arguments);\n}\n\nexport function __rest(s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n}\n\nexport function __decorate(decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n}\n\nexport function __param(paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n}\n\nexport function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\n function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\n var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\n var _, done = false;\n for (var i = decorators.length - 1; i >= 0; i--) {\n var context = {};\n for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\n context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\n var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\n if (kind === \"accessor\") {\n if (result === void 0) continue;\n if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\n if (_ = accept(result.get)) descriptor.get = _;\n if (_ = accept(result.set)) descriptor.set = _;\n if (_ = accept(result.init)) initializers.unshift(_);\n }\n else if (_ = accept(result)) {\n if (kind === \"field\") initializers.unshift(_);\n else descriptor[key] = _;\n }\n }\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\n done = true;\n};\n\nexport function __runInitializers(thisArg, initializers, value) {\n var useValue = arguments.length > 2;\n for (var i = 0; i < initializers.length; i++) {\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\n }\n return useValue ? value : void 0;\n};\n\nexport function __propKey(x) {\n return typeof x === \"symbol\" ? x : \"\".concat(x);\n};\n\nexport function __setFunctionName(f, name, prefix) {\n if (typeof name === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\n return Object.defineProperty(f, \"name\", { configurable: true, value: prefix ? \"\".concat(prefix, \" \", name) : name });\n};\n\nexport function __metadata(metadataKey, metadataValue) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\n}\n\nexport function __awaiter(thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n}\n\nexport function __generator(thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === \"function\" ? Iterator : Object).prototype);\n return g.next = verb(0), g[\"throw\"] = verb(1), g[\"return\"] = verb(2), typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n}\n\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n});\n\nexport function __exportStar(m, o) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\n}\n\nexport function __values(o) {\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\n if (m) return m.call(o);\n if (o && typeof o.length === \"number\") return {\n next: function () {\n if (o && i >= o.length) o = void 0;\n return { value: o && o[i++], done: !o };\n }\n };\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\n}\n\nexport function __read(o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n}\n\n/** @deprecated */\nexport function __spread() {\n for (var ar = [], i = 0; i < arguments.length; i++)\n ar = ar.concat(__read(arguments[i]));\n return ar;\n}\n\n/** @deprecated */\nexport function __spreadArrays() {\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\n r[k] = a[j];\n return r;\n}\n\nexport function __spreadArray(to, from, pack) {\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\n if (ar || !(i in from)) {\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\n ar[i] = from[i];\n }\n }\n return to.concat(ar || Array.prototype.slice.call(from));\n}\n\nexport function __await(v) {\n return this instanceof __await ? (this.v = v, this) : new __await(v);\n}\n\nexport function __asyncGenerator(thisArg, _arguments, generator) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\n return i = Object.create((typeof AsyncIterator === \"function\" ? AsyncIterator : Object).prototype), verb(\"next\"), verb(\"throw\"), verb(\"return\", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;\n function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }\n function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\n function fulfill(value) { resume(\"next\", value); }\n function reject(value) { resume(\"throw\", value); }\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\n}\n\nexport function __asyncDelegator(o) {\n var i, p;\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }\n}\n\nexport function __asyncValues(o) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var m = o[Symbol.asyncIterator], i;\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\n}\n\nexport function __makeTemplateObject(cooked, raw) {\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\n return cooked;\n};\n\nvar __setModuleDefault = Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n};\n\nexport function __importStar(mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\n __setModuleDefault(result, mod);\n return result;\n}\n\nexport function __importDefault(mod) {\n return (mod && mod.__esModule) ? mod : { default: mod };\n}\n\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\n}\n\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\n}\n\nexport function __classPrivateFieldIn(state, receiver) {\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\n}\n\nexport function __addDisposableResource(env, value, async) {\n if (value !== null && value !== void 0) {\n if (typeof value !== \"object\" && typeof value !== \"function\") throw new TypeError(\"Object expected.\");\n var dispose, inner;\n if (async) {\n if (!Symbol.asyncDispose) throw new TypeError(\"Symbol.asyncDispose is not defined.\");\n dispose = value[Symbol.asyncDispose];\n }\n if (dispose === void 0) {\n if (!Symbol.dispose) throw new TypeError(\"Symbol.dispose is not defined.\");\n dispose = value[Symbol.dispose];\n if (async) inner = dispose;\n }\n if (typeof dispose !== \"function\") throw new TypeError(\"Object not disposable.\");\n if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };\n env.stack.push({ value: value, dispose: dispose, async: async });\n }\n else if (async) {\n env.stack.push({ async: true });\n }\n return value;\n}\n\nvar _SuppressedError = typeof SuppressedError === \"function\" ? SuppressedError : function (error, suppressed, message) {\n var e = new Error(message);\n return e.name = \"SuppressedError\", e.error = error, e.suppressed = suppressed, e;\n};\n\nexport function __disposeResources(env) {\n function fail(e) {\n env.error = env.hasError ? new _SuppressedError(e, env.error, \"An error was suppressed during disposal.\") : e;\n env.hasError = true;\n }\n var r, s = 0;\n function next() {\n while (r = env.stack.pop()) {\n try {\n if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);\n if (r.dispose) {\n var result = r.dispose.call(r.value);\n if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });\n }\n else s |= 1;\n }\n catch (e) {\n fail(e);\n }\n }\n if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();\n if (env.hasError) throw env.error;\n }\n return next();\n}\n\nexport default {\n __extends,\n __assign,\n __rest,\n __decorate,\n __param,\n __metadata,\n __awaiter,\n __generator,\n __createBinding,\n __exportStar,\n __values,\n __read,\n __spread,\n __spreadArrays,\n __spreadArray,\n __await,\n __asyncGenerator,\n __asyncDelegator,\n __asyncValues,\n __makeTemplateObject,\n __importStar,\n __importDefault,\n __classPrivateFieldGet,\n __classPrivateFieldSet,\n __classPrivateFieldIn,\n __addDisposableResource,\n __disposeResources,\n};\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import type { StreamDeckWeb, LcdPosition } from '@elgato-stream-deck/webhid'\nimport { requestStreamDecks, getStreamDecks } from '@elgato-stream-deck/webhid'\nimport type { Demo } from './demo/demo'\nimport { DomImageDemo } from './demo/dom'\nimport { FillWhenPressedDemo } from './demo/fill-when-pressed'\nimport { RapidFillDemo } from './demo/rapid-fill'\nimport { ChaseDemo } from './demo/chase'\n\ndeclare const LIB_VERSION: any\nif (LIB_VERSION) {\n\tconst elm = document.querySelector('#version_str')\n\tif (elm) {\n\t\telm.innerHTML = `v${LIB_VERSION}`\n\t}\n}\n\nfunction appendLog(str: string) {\n\tconst logElm = document.getElementById('log')\n\tif (logElm) {\n\t\tlogElm.textContent = `${str}\\n${logElm.textContent ?? ''}`\n\t}\n}\n\nconst demoSelect = document.getElementById('demo-select') as HTMLInputElement | undefined\nconst consentButton = document.getElementById('consent-button')\n\nlet device: StreamDeckWeb | null = null\nlet currentDemo: Demo = new FillWhenPressedDemo()\nasync function demoChange() {\n\tif (demoSelect) {\n\t\tconsole.log(`Selected demo: ${demoSelect.value}`)\n\t\tif (device) {\n\t\t\tawait currentDemo.stop(device)\n\t\t}\n\n\t\tswitch (demoSelect.value) {\n\t\t\tcase 'rapid-fill':\n\t\t\t\tcurrentDemo = new RapidFillDemo()\n\t\t\t\tbreak\n\t\t\tcase 'dom':\n\t\t\t\tcurrentDemo = new DomImageDemo()\n\t\t\t\tbreak\n\t\t\tcase 'chase':\n\t\t\t\tcurrentDemo = new ChaseDemo()\n\t\t\t\tbreak\n\t\t\tcase 'fill-when-pressed':\n\t\t\tdefault:\n\t\t\t\tcurrentDemo = new FillWhenPressedDemo()\n\t\t\t\tbreak\n\t\t}\n\n\t\tif (device) {\n\t\t\tawait currentDemo.start(device)\n\t\t}\n\t}\n}\n\nasync function openDevice(device: StreamDeckWeb): Promise {\n\tappendLog(`Device opened. Serial: ${await device.getSerialNumber()} Firmware: ${await device.getFirmwareVersion()}`)\n\n\tdevice.on('down', (control) => {\n\t\tif (control.type === 'button') {\n\t\t\tappendLog(`Key ${control.index} down`)\n\t\t\tcurrentDemo.keyDown(device, control.index).catch(console.error)\n\t\t} else {\n\t\t\tappendLog(`Encoder ${control.index} down`)\n\t\t}\n\t})\n\tdevice.on('up', (control) => {\n\t\tif (control.type === 'button') {\n\t\t\tappendLog(`Key ${control.index} up`)\n\t\t\tcurrentDemo.keyUp(device, control.index).catch(console.error)\n\t\t} else {\n\t\t\tappendLog(`Encoder ${control.index} down`)\n\t\t}\n\t})\n\tdevice.on('rotate', (control, amount) => {\n\t\tappendLog(`Encoder ${control.index} rotate (${amount})`)\n\t})\n\tdevice.on('lcdShortPress', (control, position: LcdPosition) => {\n\t\tappendLog(`LCD (${control.id}) short press (${position.x},${position.y})`)\n\t})\n\tdevice.on('lcdLongPress', (control, position: LcdPosition) => {\n\t\tappendLog(`LCD (${control.id}) long press (${position.x},${position.y})`)\n\t})\n\tdevice.on('lcdSwipe', (control, fromPosition: LcdPosition, toPosition: LcdPosition) => {\n\t\tappendLog(\n\t\t\t`LCD (${control.id}) swipe (${fromPosition.x},${fromPosition.y}) -> (${toPosition.x},${toPosition.y})`,\n\t\t)\n\t})\n\n\tawait currentDemo.start(device)\n\n\t// Sample actions\n\tawait device.setBrightness(70)\n\n\t// device.fillColor(2, 255, 0, 0)\n\t// device.fillColor(12, 0, 0, 255)\n}\n\nif (consentButton) {\n\tconst doLoad = async () => {\n\t\t// attempt to open a previously selected device.\n\t\tconst devices = await getStreamDecks()\n\t\tif (devices.length > 0) {\n\t\t\tdevice = devices[0]\n\t\t\topenDevice(device).catch(console.error)\n\t\t}\n\t\tconsole.log(devices)\n\t}\n\twindow.addEventListener('load', () => {\n\t\tdoLoad().catch((e) => console.error(e))\n\t})\n\n\tconst brightnessRange = document.getElementById('brightness-range') as HTMLInputElement | undefined\n\tif (brightnessRange) {\n\t\tbrightnessRange.addEventListener('input', (_e) => {\n\t\t\tconst value = brightnessRange.value as any as number\n\t\t\tif (device) {\n\t\t\t\tdevice.setBrightness(value).catch(console.error)\n\t\t\t}\n\t\t})\n\t}\n\n\tif (demoSelect) {\n\t\tdemoSelect.addEventListener('input', () => {\n\t\t\tdemoChange().catch(console.error)\n\t\t})\n\t\tdemoChange().catch(console.error)\n\t}\n\n\tconst consentClick = async () => {\n\t\tif (device) {\n\t\t\tappendLog('Closing device')\n\t\t\tcurrentDemo.stop(device).catch(console.error)\n\t\t\tawait device.close()\n\t\t\tdevice = null\n\t\t}\n\t\t// Prompt for a device\n\t\ttry {\n\t\t\tconst devices = await requestStreamDecks()\n\t\t\tdevice = devices[0]\n\t\t\tif (devices.length === 0) {\n\t\t\t\tappendLog('No device was selected')\n\t\t\t\treturn\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tappendLog(`No device access granted: ${error as string}`)\n\t\t\treturn\n\t\t}\n\n\t\topenDevice(device).catch(console.error)\n\t}\n\tconsentButton.addEventListener('click', () => {\n\t\tconsentClick().catch((e) => console.error(e))\n\t})\n\n\tappendLog('Page loaded')\n}\n"],"names":[],"sourceRoot":""} \ No newline at end of file