diff --git a/.gitignore b/.gitignore index 12575b0a..1ee02588 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ node_modules dist build +/Test* # local env files .env.local @@ -21,6 +22,46 @@ yarn-error.log* *.sln *.sw? +__pycache__ +~~* +--* +==* package-lock.json yarn.lock .git +/*.zip +/*.py +/*.exe +/*.jar +/*.md +/*.json +/*.js +/*.txt +/.gitattributes +/.*ignore +/DBR-* +/sampleFromGithub +/src +/Web.config + +!/dist +/dist/* +#!/dist/class +#!/dist/enum +#!/dist/interface +!/dist/dbr.js +!/dist/dbr.mjs +!/dist/dbr.browser.mjs +!/dist/dbr-*.worker.js +!/dist/dbr-*.wasm.js +!/dist/dbr-*.wasm +!/dist/dbr.d.ts +!/dist/dbr.reference.d.ts +!/dist/dbr.scanner.html +!/dist/dls.license.dialog.html +!/dist/README.md + +!/README.md +!/README.NODE.md +!/package.json +!/LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..8b67ffa0 --- /dev/null +++ b/LICENSE @@ -0,0 +1,5 @@ +For web: +https://www.dynamsoft.com/Products/barcode-reader-license-agreement.aspx#javascript?utm_source=github + +For node: +https://www.dynamsoft.com/Products/barcode-reader-license-agreement.aspx?utm_source=github \ No newline at end of file diff --git a/README.NODE.md b/README.NODE.md new file mode 100644 index 00000000..6e3ab4fd --- /dev/null +++ b/README.NODE.md @@ -0,0 +1,176 @@ +# Dynamsoft JavaScript Barcode SDK for Node + +> This library is the Node.js edition of Dynamsoft Barcode Reader. If you are looking to implement barcode reading feature in a web page, please check out the other library [Dynamsoft JavaScript Barcode SDK for Web](https://github.com/dynamsoft-dbr/javascript-barcode/?utm_source=github&package=js). + +Both 1D and 2D barcode symbiology are supported including the popular `Code 39`, `EAN-13`, `QR`, `PDF417`, etc.+ Find the full list [here](https://www.dynamsoft.com/barcode-reader/overview/?utm_source=github&package=js). + +The library is based on `webassembly` which has been an official feature of Node.js since `LTS 8`. If you are using Node.js LTS 8 and have no plan to upgrade it, check out [how to use the library in Node.js LTS 8](#how-to-use-the-library-in-nodejs-lts-8). That said, Node.js version >= LTS 12 is recommended because the library will try to use `worker_threads` when decoding. + +> Also see [Dynamsoft JavaScript Barcode SDK for Web](https://github.com/Dynamsoft/javascript-barcode/blob/master/README.md). + +## Get Started + +* Check your Node.js version + +```shell +> node -v +v12.13.1 +``` + +* Installs the library from npm + +```shell +> npm install dynamsoft-javascript-barcode --save +``` +* Create a `js` file and include the library + +```js +let DBR = require("dynamsoft-javascript-barcode"); +``` + +The following also works +```js +let DBR = require("path/to/dist/dbr.js"); +``` + +> **Note** +> The library uses `Promise` a lot, so it's recommended to write the related code in a `async` function so that later you can use `await` +> +> ```js +> (async()=>{ +> // many work will done here +> })(); +> ``` + +* Create an instance of the reader + +```js +let reader = await DBR.BarcodeReader.createInstance(); +``` + +* Decode a file by its path + +```js +let results = await reader.decode('path/to/sample.png'); +``` + +Or just decode a file by its URL + +```js +let results = await reader.decode('https://demo.dynamsoft.com/barcode-reader/img/AllSupportedBarcodeTypes.png'); +``` +> **NOTE** +> The following image formats are supported by default: `png`, `jpg`, `bmp`, `gif`. +> +> If you want to decode other files like `pdf`'s, you need to convert them to images first. Contact [Dynamsoft Support](https://www.dynamsoft.com/company/contact/?utm_source=github&package=js) to find out more. +> +> If you want to decode raw image data (`RGBA`) from sources like a camera. You can use the API `deocdeBuffer`. Check out [C++ API decodeBuffer](https://www.dynamsoft.com/barcode-reader/programming/cplusplus/api-reference/cbarcodereader-methods/decode.html?ver=latest&utm_source=github&package=js#decodebuffer) for more details. + +* Print out the results + +```js +for(let result of results){ + console.log(result.barcodeText); +} +``` + +* Run your code. + +```shell +> node your-code.js +``` + +Last not but least, don't forget to set a `productKey`! If you don't have a key yet, click [here](https://www.dynamsoft.com/customer/license/trialLicense?product=dbr&package=js&utm_source=github) to get one. + +```js +DBR.BarcodeReader.productKeys = 'PRODUCT-KEYS'; +``` + +**Full code** + +```js +let DBR = require('dynamsoft-node-barcode'); +// Please visit https://www.dynamsoft.com/customer/license/trialLicense?product=dbr&package=js&utm_source=github to get a trial license +DBR.BarcodeReader.productKeys = 'PRODUCT-KEYS'; + +let pReader = null; +(async()=>{ + let reader = await DBR.BarcodeReader.createInstance(); + for(let result of await reader.decode('https://demo.dynamsoft.com/barcode-reader/img/AllSupportedBarcodeTypes.png')){ + console.log(result.barcodeText); + } + reader.destroy(); + + // Since the worker keep alive, you can call + await DBR.BarcodeReader._dbrWorker.terminate(); + // when you need to exit this process. + // Or call + process.exit(); + // directly. +})(); + +``` + +## Change Decoding Settings + +To set up the library for decoding, use the APIs `getRuntimeSettings` & `updateRuntimeSettings`. + +```js +await barcodeScanner.updateRuntimeSettings("speed"); +``` +```js +await barcodeScanner.updateRuntimeSettings("balance"); +``` +```js +await barcodeScanner.updateRuntimeSettings("coverage"); +``` +```js +let settings = await reader.getRuntimeSettings(); +settings.localizationModes = [ + Dynamsoft.DBR.EnumLocalizationMode.LM_CONNECTED_BLOCKS, + Dynamsoft.DBR.EnumLocalizationMode.LM_SCAN_DIRECTLY, + Dynamsoft.DBR.EnumLocalizationMode.LM_LINES, 0, 0, 0, 0, 0]; +settings.deblurLevel = 2; +await reader.updateRuntimeSettings(settings); +``` + +See [Barcode reading settings Guide](https://www.dynamsoft.com/barcode-reader/programming/cplusplus/user-guide.html?ver=latest#use-publicruntimesettings-struct-to-change-settings?utm_source=github&package=js) for basic usage. + +See [C++ API RuntimeSettings](https://www.dynamsoft.com/barcode-reader/programming/c-cplusplus/struct/PublicRuntimeSettings.html?utm_source=github&package=js) for more details. + +To find out which settings best suit your usage scenario, visit [DBR Main Online Demo](https://demo.dynamsoft.com/barcode-reader/?utm_source=github&package=js). + +Any questions, please contact [Dynamsoft support](https://www.dynamsoft.com/company/contact/?utm_source=github&package=js). + + + +## How to use the library in Node.js LTS 8 + +Node.js LTS 8 doesn't support `worker_threads`, so the decoding will happen in the same main thread which means it's a blocking operation. The following code snippets demonstrate the basic usage. + +**Decode** + +```js +var dbr = require('path/to/dist/dbr-.node.wasm.js'); +dbr.onRuntimeInitialized = ()=>{ + dbr.BarcodeReaderWasm.init('{"productKeys":"PRODUCT-KEYS"}'); + var reader = new dbr.BarcodeReaderWasm(false,-1); + var fs = require('fs'); + var img = fs.readFileSync('./sample.png'); + var resultsInfo = JSON.parse(reader.decodeFileInMemory(new Uint8Array(img))); + console.log(resultsInfo); +}; +``` + +**Change settings** + +```js +var settings = JSON.parse(reader.getRuntimeSettings()); +settings.expectedBarcodesCount = 999; +reader.updateRuntimeSettings(JSON.stringify(settings)); +``` + + + + + diff --git a/README.html b/README.html new file mode 100644 index 00000000..49cc0c8c --- /dev/null +++ b/README.html @@ -0,0 +1,941 @@ + + + + + Dynamsoft Barcode Reader JavaScript/javascript-barcode · GitHub + + + +
+

Dynamsoft Barcode Reader for Your Website

+

Turn your web page into a barcode scanner with just a few lines of code.

+

version + downloads + jsdelivr +

+

+

Once integrated, your users can open your website in a browser, access their cameras and read barcodes directly from the video input.

+

In this guide, you will learn step by step on how to integrate this library into your website.

+
+

For back-end barcode reading with Node.js, see Dynamsoft Barcode Reader for Node.

+
+

Table of Contents

+ +

Popular Examples

+ +

You can also:

+ +

Hello World - Simplest Implementation

+

Let's start by testing the "Hello World" example of the library which demonstrates how to use the minimum code to enable a web page to read barcodes from a live video stream.

+ +

Step One: Check the code of the example

+

The complete code of the "Hello World" example is shown below

+
<!DOCTYPE html>
+      <html>
+      
+      <body>
+        <script src="https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@8.6.0/dist/dbr.js"></script>
+        <script>
+          // initializes and uses the library
+          let pScanner = null;
+          (async () => {
+            let scanner = await (pScanner = pScanner || Dynamsoft.DBR.BarcodeScanner.createInstance());
+            scanner.onFrameRead = results => {
+              if (results.length > 0) console.log(results);
+            };
+            scanner.onUnduplicatedRead = (txt, result) => {
+              alert(txt);
+            };
+            await scanner.show();
+          })();
+        </script>
+      </body>
+      
+      </html>
+ + + + +
+
+

You can also find the code (with more comments) on GitHub.

+
+

About the code

+
    +
  • +

    createInstance(): This method creates a BarcodeScanner object. This object can read barcodes directly from a video input with the help of its interactive UI (hidden by default) and the MediaDevices interface.

    +
  • +
  • +

    onFrameRead: This event is triggered every time the library finishes scanning a video frame. The results object contains all the barcode results that the library have found on this frame. In this example, we print the results to the browser console.

    +
  • +
  • +

    onUnduplicatedRead: This event is triggered when the library finds a new barcode, which is not a duplicate among multiple frames. txt holds the barcode text value while result is an object that holds details of the barcode. In this example, an alert will be displayed for this new barcode.

    +
  • +
  • +

    show(): This method brings up the built-in UI of the BarcodeScanner object.

    +
  • +
+

Step Two: Test the example

+

You can choose one of three ways to test the example:

+ +

Either way, you open the example page in a browser, allow the page to access your camera and the video will show up on the page. After that, you can point the camera at something with a barcode to read it.

+

If the barcode is decoded, an alert will pop up with the result text. At the same time, the barcode location will be highlighted in the video feed.

+
+

For first use, you may need to wait a few seconds for the library to initialize.

+
+

Note:

+
    +
  • +

    The library only scans a new frame when it has finished scanning the previous frame. The interval between two consecutive frames might not be enough time for the library to process the 1st frame (for 30 FPS, the interval is about 33 ms), therefore, not all frames are scanned.

    +
  • +
  • +

    The library requires a license to work. However, when no license is specified in the code, Dynamsoft allows a 7-day free period during which you can make initial evaluation of the library to decide whether or not you want to evaluate it further. If you do, you can request a trial.

    +
    +

    Network connection is required for the 7-day free license to work.

    +
    +
  • +
+

If the test doesn't go as expected, you can check out the FAQ or contact us.

+

Building your own page

+

Include the library

+

Use a CDN

+

The simplest way to include the library is to use either the jsDelivr or UNPKG CDN. The "hello world" example above uses jsDelivr.

+
    +
  • +

    jsDelivr

    +
    <script src="https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@8.6.0/dist/dbr.js"></script>
    + + + + +
    +
  • +
  • +

    UNPKG

    +
    <script src="https://unpkg.com/dynamsoft-javascript-barcode@8.6.0/dist/dbr.js"></script>
    + + + + +
    +
  • +
+

Host the library yourself (recommended)

+

Besides using the CDN, you can also download the library and host its files on your own website / server before including it in your application.

+

The following shows a few ways to download the library.

+
    +
  • +

    From the website

    +

    Download the JavaScript Package

    +
  • +
  • +

    yarn

    +
    $ yarn add dynamsoft-javascript-barcode
    + + + + +
    +
  • +
  • +

    npm

    +
    $ npm install dynamsoft-javascript-barcode --save
    +      
    + + + + +
    +
  • +
+

Depending on how you downloaded the library and where you put it. You can typically include it like this:

+
<script src="/DBR-JS-8.6.0/dist/dbr.js"></script>
+ + + + +
+

or

+
<script src="/node_modules/dynamsoft-javascript-barcode/dist/dbr.js"></script>
+ + + + +
+

Read more on how to host the library.

+

Configure the library

+

Before using the library, you need to configure a few things.

+

Specify the license

+

The library requires a license to work, use the APIs organizationID and handshakeCode to specify how to acquire the license.

+
Dynamsoft.DBR.BarcodeScanner.organizationID = "YOUR-ORGANIZATION-ID"; // Required.
+      Dynamsoft.DBR.BarcodeScanner.handshakeCode = "A-SPECIFIC-HANDSHAKECODE"; // Optional, if not specified, the default handshake code is used.
+      Dynamsoft.DBR.BarcodeScanner.sessionPassword = "PASSWORD-TO-PROTECT-YOUR-LICENSE"; // Optional but recomended, use it to protect your license.
+      Dynamsoft.DBR.BarcodeScanner.licenseServer = ["YOUR-OWN-MAIN-DLS", "YOUR-OWN-STANDBY-DLS"]; //Optional, ignore this line if you are using Dynamsoft-hosting DLS.
+ + + + +
+

Note:

+
    +
  • Network connection is required for the license to work.
  • +
  • If nothing is specified, a 7-day free license will be used by default which is the case in the above "hello world" example.
  • +
  • The license is actually fetched during the creation of a BarcodeScanner or BarcodeReader instance.
  • +
  • If a public network connection is not available, you can choose to host a license server in your private network.
  • +
+

An alternative way to specify the license is to use an alphanumeric string which does not require a network connection. The following shows how it could be used. Contact us for more information.

+
Dynamsoft.DBR.BarcodeReader.productKeys = "t0068NQAAACgTVU2aucyxqETXKkiomqhV7YoLrnqjLiQQRSH5DBV1UtIs4..."
+ + + + +
+

Or

+
<script src="https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@8.6.0/dist/dbr.js" data-productKeys="t0068NQAAACgTVU2aucyxqETXKkiomqhV7YoLrnqjLiQQRSH5DBV1UtIs4..."></script>
+ + + + +
+

Specify the location of the "engine" files

+

The "engine" files refer to *.worker.js, *.wasm.js and *.wasm, etc. which are loaded by the main library at runtime. This configuration option uses the API engineResourcePath and is often not required as these files usually are in the same location with the main library file (dbr.js). However, in cases where the engine files are not in the same location as the main library file (for example, with frameworks like Angular or React, dbr.js is compiled into another file), this configuration will be required.

+

The following code uses the jsDelivr CDN, feel free to change it to your own location of these files.

+
import DBR from "dynamsoft-javascript-barcode";
+      DBR.BarcodeScanner.engineResourcePath = "https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@8.6.0/dist/";
+      export default DBR;
+ + + + +
+

Interact with the library

+

Create a BarcodeScanner object

+

You can use one of two classes ( BarcodeScanner and BarcodeReader ) to interact with the library. BarcodeReader is a low-level class that processes images directly. BarcodeScanner , on the other hand, inherits from BarcodeReader and provides high-level APIs and a built-in GUI to allow continuous barcode scanning on video frames. We'll focus on BarcodeScanner in this guide.

+

To use the library, we first create a BarcodeScanner object.

+
try {
+        await Dynamsoft.DBR.BarcodeScanner.createInstance();
+      } catch (ex) {
+        console.error(ex);
+      }
+ + + + +
+

Note:

+
    +
  • The creation of an object consists of two parallel tasks: one is to download and compile the "engine", the other is to fetch a license from Dynamsoft License Server (assuming an online license is used).
  • +
+

Configure the BarcodeScanner object

+

Let's take a look at the following code snippets first:

+
// set which camera and what resolution to use
+      var allCameras = await scanner.getAllCameras();
+      await scanner.setCurrentCamera(allCameras[0].deviceId);
+      await scanner.setResolution(1280, 720);
+ + + + +
+
// set up the scanner behavior
+      let scanSettings = await scanner.getScanSettings();
+      // disregard duplicated results found in a specified time period (in milliseconds)
+      scanSettings.duplicateForgetTime = 5000;
+      // set a scan interval in milliseconds so the library may release the CPU from time to time
+      scanSettings.intervalTime = 300;
+      await scanner.updateScanSettings(scanSettings);
+ + + + +
+
// use one of the built-in RuntimeSetting templates: "single" (decode a single barcode, the default mode), "speed", "balance" and "coverage".
+      await scanner.updateRuntimeSettings("speed");
+      
+      // make changes to the template. The code below demonstrates how to specify enabled symbologies
+      let runtimeSettings = await scanner.getRuntimeSettings();
+      runtimeSettings.barcodeFormatIds = Dynamsoft.DBR.EnumBarcodeFormat.BF_ONED | Dynamsoft.DBR.EnumBarcodeFormat.BF_QR_CODE;
+      await scanner.updateRuntimeSettings(runtimeSettings);
+ + + + +
+

Try in JSFiddle

+

As you can see from the above code snippets, there are three types of configurations:

+
    +
  • +

    get/updateVideoSettings: Configures the data source, i.e., the camera. These settings include which camera to use, the resolution, etc. Learn more here.

    +
  • +
  • +

    get/updateScanSettings: Configures the behavior of the scanner which includes duplicateForgetTime, intervalTime and filter, etc.

    +
  • +
  • +

    get/updateRuntimeSettings: Configures the decode engine. Find a full list of these settings and their corresponding descriptions here. For example, the following uses the built-in "speed" settings with updated localizationModes.

    +
    await barcodeScanner.updateRuntimeSettings("speed");
    +      //await barcodeScanner.updateRuntimeSettings("balance"); //alternative
    +      //await barcodeScanner.updateRuntimeSettings("coverage"); //alternative
    +      let settings = await barcodeScanner.getRuntimeSettings();
    +      settings.localizationModes = [
    +          Dynamsoft.DBR.EnumLocalizationMode.LM_CONNECTED_BLOCKS,
    +          Dynamsoft.DBR.EnumLocalizationMode.LM_SCAN_DIRECTLY,
    +          Dynamsoft.DBR.EnumLocalizationMode.LM_LINES, 0, 0, 0, 0, 0
    +      ];
    +      await barcodeScanner.updateRuntimeSettings(settings);
    + + + + +
    +

    Try in JSFiddle.

    +

    See also settings samples.

    +
  • +
+

Customize the UI

+

The built-in UI of the BarcodeScanner object is defined in the file dist/dbr.scanner.html . There are a few ways to customize it:

+
    +
  • +

    Modify the file dist/dbr.scanner.html directly.

    +

    This option is only possible when you host this file on your own web server instead of using a CDN.

    +
  • +
  • +

    Copy the file dist/dbr.scanner.html to your application, modify it and use the the API defaultUIElementURL to set it as the default UI.

    +
    Dynamsoft.DBR.BarcodeScanner.defaultUIElementURL = "THE-URL-TO-THE-FILE";
    + + + + +
    +
    +

    You must set defaultUIElementURL before you call createInstance() .

    +
    +
  • +
  • +

    Append the default UI element to your page, customize it before showing it.

    +
    <div id="scannerUI"></div>
    + + + + +
    +
    document.getElementById('scannerUI').appendChild(scanner.getUIElement());
    +      document.getElementsByClassName('dbrScanner-btn-close')[0].hidden = true; // Hide the close button
    + + + + +
    +
  • +
  • +

    Build the UI element into your own web page and specify it with the API setUIElement(HTMLElement).

    +
      +
    • +

      Embed the video

      +
      <div id="div-video-container">
      +        <video class="dbrScanner-video" playsinline="true" style="width:100%;height:100%;position:absolute;left:0;top:0;"></video>
      +      </div>
      +      <script>
      +        let pScanner = null;
      +        (async()=>{
      +          let scanner = await (pScanner = pScanner || Dynamsoft.DBR.BarcodeScanner.createInstance());
      +          await scanner.setUIElement(document.getElementById('div-video-container'));
      +          scanner.onFrameRead = results => {console.log(results);};
      +          scanner.onUnduplicatedRead = (txt, result) => {alert(txt);};
      +          await scanner.show();
      +        })();
      +      </script>
      + + + + +
      +
      +

      The video element must have the class dbrScanner-video .

      +
      +

      Try in JSFiddle

      +
    • +
    • +

      Add the camera list and resolution list

      +

      If the class names for these lists match the default ones, dbrScanner-sel-camera and dbrScanner-sel-resolution , the library will automatically populate the lists and handle the camera/resolution switching.

      +
      <select class="dbrScanner-sel-camera"></select>
      + + + + +
      +

      Try in JSFiddle

      +
      <select class="dbrScanner-sel-resolution"></select>
      + + + + +
      +

      Try in JSFiddle

      +
      +

      By default, 8 hard-coded resolutions are populated as options. You can show only a custom set of options by hardcoding them.

      +
      +
      <select class="dbrScanner-sel-resolution">
      +        <option class="dbrScanner-opt-gotResolution" value="got"></option>
      +        <option data-width="1920" data-height="1080">1920 x 1080</option>
      +        <option data-width="1280" data-height="720">1280 x 720</option>
      +        <option data-width="640" data-height="480">640 x 480</option>
      +      </select>
      + + + + +
      +

      Try in JSFiddle

      +
      +

      Generally, you need to provide a resolution that the camera supports. However, in case a camera does not support the specified resolution, it usually uses the nearest supported resolution. As a result, the selected resolution may not be the actual resolution used. In this case, add an option with the class name dbrScanner-opt-gotResolution (as shown above) and the library will then use it to show the actual resolution.

      +
      +
    • +
    +
  • +
+

See also UI customization samples.

+

Interested to test it further? Read on to learn how to request a 30-day free trial.

+

Requesting A Trial

+

From version 8.2.5 of the library, if no license is specified, a 7-day free license will be used by default.

+
+

Network connection is required for the 7-day free license to work.

+
+

After that, if you want to evaluate the library further, you can register for a Dynamsoft account (if you haven't already done so) and request a 30-day trial in the customer portal.

+ +

System Requirements

+

This library requires the following features which are supported by all modern mainstream browsers:

+
    +
  • +

    WebAssembly, Blob, URL/createObjectURL, Web Workers

    +

    The above four features are required for the library to work.

    +
  • +
  • +

    MediaDevices/getUserMedia

    +

    This API is only required for in-browser video streaming. If a browser does not support this API, the Single Frame Mode will be used automatically. If the API exists but doesn't work correctly, the Single Frame Mode can be used as an alternative way to access the camera.

    +
  • +
+

The following table is a list of supported browsers based on the above requirements:

+ + + + + + + + + + + + + + + + + + + + + + + + + +
Browser NameVersion
Chromev57+ (v59+ on Android/iOS1)
Firefoxv52+ (v55+ on Android/iOS1)
Edge2v16+
Safari3v11+
+

1 iOS 14.3+ is required for camera video streaming in Chrome and Firefox or Apps using webviews.

+

2 On Edge, due to strict Same-origin policy, you must host the library files on the same domain as your web page.

+

3 Safari 11.2.2 ~ 11.2.6 are not supported.

+

Apart from the browsers, the operating systems may impose some limitations of their own that could restrict the use of the library. Browser compatibility ultimately depends on whether the browser on that particular operating system supports the features listed above.

+

Hosting the library

+

Step One: Deploy the dist folder

+

Once you have downloaded the library, you can locate the "dist" directory and copy it to your server (usually as part of your website / web application). The following shows some of the files in this directory:

+
    +
  • dbr.js // The main library file
  • +
  • dbr.browser.mjs // For using the library as a module (<script type="module">)
  • +
  • dbr.scanner.html // Defines the default scanner UI
  • +
  • dbr-<version>.worker.js // Defines the worker thread for barcode reading
  • +
  • dbr-<version>.wasm.js // Compact edition of the library (.js)
  • +
  • dbr-<version>.wasm // Compact edition of the library (.wasm)
  • +
  • dbr-<version>.full.wasm.js // Full edition of the library (.js)
  • +
  • dbr-<version>.full.wasm // Full edition of the library (.wasm)
  • +
+

Step Two: Configure the Server

+
    +
  • +

    Set the MIME type for .wasm as application/wasm on your webserver.

    +

    The goal is to configure your server to send the correct Content-Type header for the wasm file so that it is processed correctly by the browser.

    +

    Different types of webservers are configured differently, for example:

    + +
  • +
  • +

    Enable HTTPS

    +

    To use the library, you must access your website / web application via a secure HTTPS connection. This is due to browser security restrictions which only grant camera video streaming access to a secure context.

    +
    +

    For convenience, self-signed certificates are allowed during development and testing.

    +
    +
  • +
+

Step Three: Include the library from the server

+

Now that the library is hosted on your server, you can include it accordingly.

+
<script src="https://www.yourwebsite.com/dynamsoft-javascript-barcode/dist/dbr.js"></script>
+ + + + +
+

Optionally, you may also need to (specify the location of the "engine" files)[#specify-the-location-of-the-engine-files].

+

Advanced Usage

+

Read a specific area/region

+

To speed up the scanning process, you can choose to scan only a specific area/region.

+
let settings = await scanner.getRuntimeSettings();
+      /*
+       * The following code shrinks the decoding region by 25% on all sides
+       */
+      settings.region.regionMeasuredByPercentage = 1;
+      settings.region.regionLeft = 25;
+      settings.region.regionTop = 25;
+      settings.region.regionRight = 75;
+      settings.region.regionBottom = 75;
+      await scanner.updateRuntimeSettings(settings);
+ + + + +
+

Try in JSFiddle

+

Show internal logs

+

Include the following in your code to print internal logs in the console.

+
Dynamsoft.DBR.BarcodeReader._onLog = console.log;
+ + + + +
+

Set mode arguments

+

To precisely control a mode, you can adjust its specific parameters.

+
let settings = await scanner.getRuntimeSettings();
+      
+      /*
+       * The following code sets the sensitivity of the TextureDetectionModes to 9
+       */
+      
+      settings.furtherModes.textureDetectionModes = [
+          Dynamsoft.DBR.EnumTextureDetectionMode.TDM_GENERAL_WIDTH_CONCENTRATION, 0, 0, 0, 0, 0, 0, 0
+      ];
+      
+      await scanner.updateRuntimeSettings(settings);
+      // The 2nd parameter 0 specifies the first mode of TextureDetectionModes, which is "Dynamsoft.DBR.EnumTextureDetectionMode.TDM_GENERAL_WIDTH_CONCENTRATION" in this case.
+      await scanner.setModeArgument("TextureDetectionModes", 0, "Sensitivity", "9");
+ + + + +
+

Display the intermediate result images or the original canvas

+

The intermediate result images are created when intermediateResultTypes is set in RuntimeSettings . Then they can be returned with the method getIntermediateResults() . These images can be used to show and debug the barcode reading process.

+

The original canvas ( oriCanvas ) means the actual canvas which holds the image to be passed to the barcode reader engine for decoding.

+
+

NOTE

+

For efficiency, the library may utilize WebGL (Web Graphics Library) for preprocessing an image before passing it to the barcode reader engine. If WebGL is used, the image captured from the camera will not be rendered on the canvas, instead, it gets processed by WebGL first and then is passed to the barcode reader engine directly. In this case, there won't be an original canvas. Therefore, if bSaveOriCanvas is set to true for a BarcodeReader or BarcodeScanenr instance, the WebGL feature will be disabled for that instance.

+

On the other hand, if WebGL is disabled and you try to get the intermediate result specified by EnumIntermediateResultType. IRT_ORIGINAL_IMAGE , it will be exactly the same image as you would get with oriCanvas .

+
+

The following shows how to display these images on the page

+
<div id='scannerV' style="width:50vw;height:50vh"></div>
+      <div id='cvses'></div>
+ + + + +
+
let pScanner = null;
+      (async () => {
+          let scanner = await (pScanner = pScanner || Dynamsoft.DBR.BarcodeScanner.createInstance());
+          /* The default of `_bUseWebgl` is true which means the intermediate result for  
+             IRT_ORIGINAL_IMAGE will be one that has been preprocessed by WebGL */
+          scanner._bUseWebgl = false;
+          document.getElementById('scannerV').appendChild(scanner.getUIElement());;
+          await scanner.updateRuntimeSettings('balance');
+          let rs = await scanner.getRuntimeSettings();
+          rs.intermediateResultTypes = 1;
+          await scanner.updateRuntimeSettings(rs);
+          scanner.onUnduplicatedRead = async (txt, result) => {
+              try {
+                  let cvss = await scanner.getIntermediateCanvas();
+                  for (let cvs of cvss) {
+                      document.getElementById('cvses').appendChild(cvs);
+                  }
+                  scanner.destroy();
+              } catch (ex) {
+                  console.error(ex);
+              }
+          };
+          await scanner.show();
+      })();
+ + + + +
+

How to Upgrade

+

If you are using an older version of the library and want to upgrade it to the latest version, please read more on how to upgrade.

+

FAQ

+

Can I open the web page directly from the hard drive?

+

Yes, for simple testing purposes, it's perfectly fine to open the file directly from the hard drive. However, you might encounter some issues in doing so (like unable to access the camera, etc.). The recommendation is to deploy this page to your web server and run it over HTTPS. If you don't have a ready-to-use web server but have a package manager like npm or yarn, you can set up a simple HTTP server in minutes. Check out http-server on npm or yarn.

+

Why can't I use my camera?

+

If you open the web page as file:/// or http://, the camera may not work and you see the following error in the browser console:

+
+

[Deprecation] getUserMedia() no longer works on insecure origins. To use this feature, you should consider switching your application to a secure origin, such as HTTPS. See https://goo.gl/rStTGz for more details.

+
+
    +
  • In Safari 12 the equivalent error is:
  • +
+
+

Trying to call getUserMedia from an insecure document.

+
+

You get this error because the API getUserMedia requires HTTPS to access the camera.

+
    +
  • If you use Chrome or Firefox, you might not get the error because these two browsers allow camera access via file:/// and http://localhost.
  • +
+

To make sure your web application can access the camera, please configure your web server to support HTTPS. The following links may help.

+ +
+
+ + \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 00000000..66e75cdc --- /dev/null +++ b/README.md @@ -0,0 +1,589 @@ +# Dynamsoft Barcode Reader for Your Website + +Turn your web page into a barcode scanner with just a few lines of code. + +![version](https://img.shields.io/npm/v/dynamsoft-javascript-barcode.svg) +![downloads](https://img.shields.io/npm/dm/dynamsoft-javascript-barcode.svg) +![jsdelivr](https://img.shields.io/jsdelivr/npm/hm/dynamsoft-javascript-barcode.svg) +![](https://img.shields.io/snyk/vulnerabilities/npm/dynamsoft-javascript-barcode.svg) + +[![](https://img.shields.io/badge/Download-Offline%20SDK-orange)](https://www.dynamsoft.com/barcode-reader/downloads/?utm_source=github&product=dbr&package=js) + +Once integrated, your users can open your website in a browser, access their cameras and read barcodes directly from the video input. + +In this guide, you will learn step by step on how to integrate this library into your website. + +> For back-end barcode reading with Node.js, see [Dynamsoft Barcode Reader for Node](https://github.com/Dynamsoft/javascript-barcode/blob/master/README.NODE.md). + +**Table of Contents** + +* [Hello World - Simplest Implementation](#hello-world---simplest-implementation) +* [Building your own page](#building-your-own-page) + - [Include the library](#include-the-library) + - [Configure the library](#configure-the-library) + - [Interact with the library](#interact-with-the-library) +* [Requesting A Trial](#requesting-a-trial) +* [System Requirements](#system-requirements) +* [Hosting the Library](#hosting-the-library) +* [Advanced Usage](#advanced-usage) +* [How to Upgrade](#how-to-upgrade) +* [FAQ](#faq) + +**Popular Examples** + +* [Use the library in Angular](https://www.dynamsoft.com/barcode-reader/programming/javascript/samples-demos/helloworld-angular.html?ver=latest&utm_source=github) +* [Use the library in React](https://www.dynamsoft.com/barcode-reader/programming/javascript/samples-demos/helloworld-reactjs.html?ver=latest&utm_source=github) +* [Use the library in Vue](https://www.dynamsoft.com/barcode-reader/programming/javascript/samples-demos/helloworld-vuejs.html?ver=latest&utm_source=github) + +You can also: + +* [Try All Online Examples](https://demo.dynamsoft.com/Samples/DBR/JS/index.html) +* [Try the Official Demo](https://demo.dynamsoft.com/barcode-reader-js?utm_source=github) + +## Hello World - Simplest Implementation + +Let's start by testing the "Hello World" example of the library which demonstrates how to use the minimum code to enable a web page to read barcodes from a live video stream. + +* Basic Requirements + + Internet connection + + [A supported browser](#system-requirements) + + Camera access + +### Step One: Check the code of the example + +The complete code of the "Hello World" example is shown below + +``` html + + + + + + + + + +``` + +> You can also find the code (with more comments) [on GitHub](https://github.com/Dynamsoft/dbr-browser-samples/blob/master/1.hello-world/1.minimum-code.html). + +*About the code* + + + `createInstance()`: This method creates a `BarcodeScanner` object. This object can read barcodes directly from a video input with the help of its interactive UI (hidden by default) and the [MediaDevices interface](https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices). + + + `onFrameRead`: This event is triggered every time the library finishes scanning a video frame. The `results` object contains all the barcode results that the library have found on this frame. In this example, we print the results to the browser console. + + + `onUnduplicatedRead`: This event is triggered when the library finds a new barcode, which is not a duplicate among multiple frames. `txt` holds the barcode text value while `result` is an object that holds details of the barcode. In this example, an alert will be displayed for this new barcode. + + + `show()`: This method brings up the built-in UI of the `BarcodeScanner` object. + +### Step Two: Test the example + +You can choose one of three ways to test the example: + +* [Hello World example - online](https://demo.dynamsoft.com/Samples/DBR/JS/1.hello-world/1.minimum-code.html) +* [Hello World example via JSFiddle](https://jsfiddle.net/DynamsoftTeam/pL4e7yrd/) +* [Download a copy](https://tst.dynamsoft.com/public/download/dbr/browser/code/helloworld.zip) of the example code and set it up locally + +Either way, you open the example page in a browser, allow the page to access your camera and the video will show up on the page. After that, you can point the camera at something with a barcode to read it. + +If the barcode is decoded, an alert will pop up with the result text. At the same time, the barcode location will be highlighted in the video feed. + + > For first use, you may need to wait a few seconds for the library to initialize. + +*Note*: + + + The library only scans a new frame when it has finished scanning the previous frame. The interval between two consecutive frames might not be enough time for the library to process the 1st frame (for 30 FPS, the interval is about 33 ms), therefore, not all frames are scanned. + + + The library requires a license to work. However, when no license is specified in the code, Dynamsoft allows a 7-day free period during which you can make initial evaluation of the library to decide whether or not you want to evaluate it further. If you do, you can [request a trial](#requesting-a-trial). + + > Network connection is required for the 7-day free license to work. + +If the test doesn't go as expected, you can check out the [FAQ](#faq) or [contact us](https://www.dynamsoft.com/company/contact/?utm_source=github). + +## Building your own page + +### Include the library + +#### Use a CDN + +The simplest way to include the library is to use either the [jsDelivr](https://jsdelivr.com/) or [UNPKG](https://unpkg.com/) CDN. The "hello world" example above uses **jsDelivr**. + +* jsDelivr + + ``` html + + ``` + +* UNPKG + + ``` html + + ``` + +#### Host the library yourself (recommended) + +Besides using the CDN, you can also download the library and host its files on your own website / server before including it in your application. + +The following shows a few ways to download the library. + +* From the website + + [Download the JavaScript Package](https://www.dynamsoft.com/barcode-reader/downloads/?utm_source=github) + +* yarn + + ```cmd + $ yarn add dynamsoft-javascript-barcode + ``` + +* npm + + ``` + $ npm install dynamsoft-javascript-barcode --save + ``` + +Depending on how you downloaded the library and where you put it. You can typically include it like this: + +``` html + +``` + +or + +``` html + +``` + +Read more on [how to host the library](#hosting-the-library). + +### Configure the library + +Before using the library, you need to configure a few things. + +#### Specify the license + +The library requires a license to work, use the APIs `organizationID` and `handshakeCode` to specify how to acquire the license. + +``` javascript +Dynamsoft.DBR.BarcodeScanner.organizationID = "YOUR-ORGANIZATION-ID"; // Required. +Dynamsoft.DBR.BarcodeScanner.handshakeCode = "A-SPECIFIC-HANDSHAKECODE"; // Optional, if not specified, the default handshake code is used. +Dynamsoft.DBR.BarcodeScanner.sessionPassword = "PASSWORD-TO-PROTECT-YOUR-LICENSE"; // Optional but recomended, use it to protect your license. +Dynamsoft.DBR.BarcodeScanner.licenseServer = ["YOUR-OWN-MAIN-DLS", "YOUR-OWN-STANDBY-DLS"]; //Optional, ignore this line if you are using Dynamsoft-hosting DLS. + ``` + +*Note*: + ++ Network connection is required for the license to work. ++ If nothing is specified, a 7-day free license will be used by default which is the case in the above "hello world" example. ++ The license is actually fetched during the creation of a `BarcodeScanner` or `BarcodeReader` instance. ++ If a public network connection is not available, you can choose to host a license server in your private network. + +An alternative way to specify the license is to use an alphanumeric string which does not require a network connection. The following shows how it could be used. [Contact us](https://www.dynamsoft.com/company/contact/?utm_source=github) for more information. + +```javascript +Dynamsoft.DBR.BarcodeReader.productKeys = "t0068NQAAACgTVU2aucyxqETXKkiomqhV7YoLrnqjLiQQRSH5DBV1UtIs4..." +``` + +Or + +```html + +``` + +#### Specify the location of the "engine" files + +The "engine" files refer to *.worker.js, *.wasm.js and *.wasm, etc. which are loaded by the main library at runtime. This configuration option uses the API `engineResourcePath` and is often not required as these files usually are in the same location with the main library file (dbr.js). However, in cases where the engine files are not in the same location as the main library file (for example, with frameworks like Angular or React, dbr.js is compiled into another file), this configuration will be required. + +The following code uses the jsDelivr CDN, feel free to change it to your own location of these files. + +``` javascript +import DBR from "dynamsoft-javascript-barcode"; +DBR.BarcodeScanner.engineResourcePath = "https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@8.6.0/dist/"; +export default DBR; +``` + +### Interact with the library + +#### Create a `BarcodeScanner` object + +You can use one of two classes ( `BarcodeScanner` and `BarcodeReader` ) to interact with the library. `BarcodeReader` is a low-level class that processes images directly. `BarcodeScanner` , on the other hand, inherits from `BarcodeReader` and provides high-level APIs and a built-in GUI to allow continuous barcode scanning on video frames. We'll focus on `BarcodeScanner` in this guide. + +To use the library, we first create a `BarcodeScanner` object. + +``` javascript +try { + await Dynamsoft.DBR.BarcodeScanner.createInstance(); +} catch (ex) { + console.error(ex); +} +``` + +*Note*: + +* The creation of an object consists of two parallel tasks: one is to download and compile the "engine", the other is to fetch a license from Dynamsoft License Server (assuming an online license is used). + +#### Configure the `BarcodeScanner` object + +Let's take a look at the following code snippets first: + +``` javascript +// set which camera and what resolution to use +var allCameras = await scanner.getAllCameras(); +await scanner.setCurrentCamera(allCameras[0].deviceId); +await scanner.setResolution(1280, 720); +``` + +``` javascript +// set up the scanner behavior +let scanSettings = await scanner.getScanSettings(); +// disregard duplicated results found in a specified time period (in milliseconds) +scanSettings.duplicateForgetTime = 5000; +// set a scan interval in milliseconds so the library may release the CPU from time to time +scanSettings.intervalTime = 300; +await scanner.updateScanSettings(scanSettings); +``` + +``` javascript +// use one of the built-in RuntimeSetting templates: "single" (decode a single barcode, the default mode), "speed", "balance" and "coverage". +await scanner.updateRuntimeSettings("speed"); + +// make changes to the template. The code below demonstrates how to specify enabled symbologies +let runtimeSettings = await scanner.getRuntimeSettings(); +runtimeSettings.barcodeFormatIds = Dynamsoft.DBR.EnumBarcodeFormat.BF_ONED | Dynamsoft.DBR.EnumBarcodeFormat.BF_QR_CODE; +await scanner.updateRuntimeSettings(runtimeSettings); +``` + +[Try in JSFiddle](https://jsfiddle.net/DynamsoftTeam/yfkcajxz/) + +As you can see from the above code snippets, there are three types of configurations: + +* `get/updateVideoSettings`: Configures the data source, i.e., the camera. These settings include which camera to use, the resolution, etc. Learn more [here](https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia#Syntax). + +* `get/updateScanSettings`: Configures the behavior of the scanner which includes `duplicateForgetTime`, `intervalTime` and `filter`, etc. + +* `get/updateRuntimeSettings`: Configures the decode engine. Find a full list of these settings and their corresponding descriptions [here](https://www.dynamsoft.com/barcode-reader/programming/javascript/api-reference/global-interfaces.html#runtimesettings?utm_source=github). For example, the following uses the built-in "speed" settings with updated `localizationModes`. + + ``` javascript + await barcodeScanner.updateRuntimeSettings("speed"); + //await barcodeScanner.updateRuntimeSettings("balance"); //alternative + //await barcodeScanner.updateRuntimeSettings("coverage"); //alternative + let settings = await barcodeScanner.getRuntimeSettings(); + settings.localizationModes = [ + Dynamsoft.DBR.EnumLocalizationMode.LM_CONNECTED_BLOCKS, + Dynamsoft.DBR.EnumLocalizationMode.LM_SCAN_DIRECTLY, + Dynamsoft.DBR.EnumLocalizationMode.LM_LINES, 0, 0, 0, 0, 0 + ]; + await barcodeScanner.updateRuntimeSettings(settings); + ``` + + Try in [JSFiddle](https://jsfiddle.net/DynamsoftTeam/f24h8c1m/). + + See also [settings samples](https://www.dynamsoft.com/barcode-reader/programming/javascript/samples-demos/parameter-settings.html?ver=latest&utm_source=github). + +#### Customize the UI + +The built-in UI of the `BarcodeScanner` object is defined in the file `dist/dbr.scanner.html` . There are a few ways to customize it: + +* Modify the file `dist/dbr.scanner.html` directly. + + This option is only possible when you host this file on your own web server instead of using a CDN. + +* Copy the file `dist/dbr.scanner.html` to your application, modify it and use the the API `defaultUIElementURL` to set it as the default UI. + + ``` javascript + Dynamsoft.DBR.BarcodeScanner.defaultUIElementURL = "THE-URL-TO-THE-FILE"; + ``` + + > You must set `defaultUIElementURL` before you call `createInstance()` . + +* Append the default UI element to your page, customize it before showing it. + + ``` html +
+ ``` + + ``` javascript + document.getElementById('scannerUI').appendChild(scanner.getUIElement()); + document.getElementsByClassName('dbrScanner-btn-close')[0].hidden = true; // Hide the close button + ``` + +* Build the UI element into your own web page and specify it with the API `setUIElement(HTMLElement)`. + + - Embed the video + + ``` html +
+ +
+ + ``` + + > The video element must have the class `dbrScanner-video` . + + [Try in JSFiddle](https://jsfiddle.net/DynamsoftTeam/2jzeq1r6/) + + - Add the camera list and resolution list + + If the class names for these lists match the default ones, `dbrScanner-sel-camera` and `dbrScanner-sel-resolution` , the library will automatically populate the lists and handle the camera/resolution switching. + + ``` html + + ``` + + [Try in JSFiddle](https://jsfiddle.net/DynamsoftTeam/nbj75vxu/) + + ``` html + + ``` + + [Try in JSFiddle](https://jsfiddle.net/DynamsoftTeam/25v08paf/) + + > By default, 8 hard-coded resolutions are populated as options. You can show only a custom set of options by hardcoding them. + + ``` html + + ``` + + [Try in JSFiddle](https://jsfiddle.net/DynamsoftTeam/tnfjks4q/) + + > Generally, you need to provide a resolution that the camera supports. However, in case a camera does not support the specified resolution, it usually uses the nearest supported resolution. As a result, the selected resolution may not be the actual resolution used. In this case, add an option with the class name `dbrScanner-opt-gotResolution` (as shown above) and the library will then use it to show the actual resolution. + +See also [UI customization samples](https://www.dynamsoft.com/barcode-reader/programming/javascript/samples-demos/ui-customization.html?ver=latest&utm_source=github). + +Interested to test it further? Read on to learn how to request a 30-day free trial. + +## Requesting A Trial + +From version 8.2.5 of the library, if no license is specified, a 7-day free license will be used by default. + +> Network connection is required for the 7-day free license to work. + +After that, if you want to evaluate the library further, you can [register for a Dynamsoft account](https://www.dynamsoft.com/api-common/Regist/Regist) (if you haven't already done so) and request a 30-day trial in the [customer portal](https://www.dynamsoft.com/customer/license/trialLicense?utm_source=github&product=dbr&package=js). + +* If you like, you can also [contact our support team](https://www.dynamsoft.com/company/contact/?utm_source=github) to get a trial license. + +## System Requirements + +This library requires the following features which are supported by all modern mainstream browsers: + +* `WebAssembly`, `Blob`, `URL`/`createObjectURL`, `Web Workers` + + The above four features are required for the library to work. + +* `MediaDevices`/`getUserMedia` + + This API is only required for in-browser video streaming. If a browser does not support this API, the [Single Frame Mode](https://www.dynamsoft.com/barcode-reader/programming/javascript/api-reference/BarcodeScanner/properties.html?ver=latest&utm_source=github#singleframemode) will be used automatically. If the API exists but doesn't work correctly, the Single Frame Mode can be used as an alternative way to access the camera. + +The following table is a list of supported browsers based on the above requirements: + + Browser Name | Version + :-: | :-: + Chrome | v57+ (v59+ on Android/iOS1) + Firefox | v52+ (v55+ on Android/iOS1) + Edge2 | v16+ + Safari3 | v11+ + + 1 iOS 14.3+ is required for camera video streaming in Chrome and Firefox or Apps using webviews. + + 2 On Edge, due to strict Same-origin policy, you must host the library files on the same domain as your web page. + + 3 Safari 11.2.2 ~ 11.2.6 are not supported. + +Apart from the browsers, the operating systems may impose some limitations of their own that could restrict the use of the library. Browser compatibility ultimately depends on whether the browser on that particular operating system supports the features listed above. + +## Hosting the library + +### Step One: Deploy the dist folder + +Once you have downloaded the library, you can locate the "dist" directory and copy it to your server (usually as part of your website / web application). The following shows some of the files in this directory: + +* `dbr.js` // The main library file +* `dbr.browser.mjs` // For using the library as a module (` +``` + +Optionally, you may also need to (specify the location of the "engine" files)[#specify-the-location-of-the-engine-files]. + +## Advanced Usage + +### Read a specific area/region + +To speed up the scanning process, you can choose to scan only a specific area/region. + +```javascript +let settings = await scanner.getRuntimeSettings(); +/* + * The following code shrinks the decoding region by 25% on all sides + */ +settings.region.regionMeasuredByPercentage = 1; +settings.region.regionLeft = 25; +settings.region.regionTop = 25; +settings.region.regionRight = 75; +settings.region.regionBottom = 75; +await scanner.updateRuntimeSettings(settings); +``` + +[Try in JSFiddle](https://jsfiddle.net/DynamsoftTeam/taykq592/) + +### Show internal logs + +Include the following in your code to print internal logs in the console. + +```javascript +Dynamsoft.DBR.BarcodeReader._onLog = console.log; +``` + +### Set mode arguments + +To precisely control a mode, you can adjust its specific parameters. + +```javascript +let settings = await scanner.getRuntimeSettings(); + +/* + * The following code sets the sensitivity of the TextureDetectionModes to 9 + */ + +settings.furtherModes.textureDetectionModes = [ + Dynamsoft.DBR.EnumTextureDetectionMode.TDM_GENERAL_WIDTH_CONCENTRATION, 0, 0, 0, 0, 0, 0, 0 +]; + +await scanner.updateRuntimeSettings(settings); +// The 2nd parameter 0 specifies the first mode of TextureDetectionModes, which is "Dynamsoft.DBR.EnumTextureDetectionMode.TDM_GENERAL_WIDTH_CONCENTRATION" in this case. +await scanner.setModeArgument("TextureDetectionModes", 0, "Sensitivity", "9"); +``` + +### Display the intermediate result images or the original canvas + +The intermediate result images are created when `intermediateResultTypes` is set in `RuntimeSettings` . Then they can be returned with the method `getIntermediateResults()` . These images can be used to show and debug the barcode reading process. + +The original canvas ( `oriCanvas` ) means the actual canvas which holds the image to be passed to the barcode reader engine for decoding. + +> *NOTE* +> +> For efficiency, the library may utilize WebGL (Web Graphics Library) for preprocessing an image before passing it to the barcode reader engine. If WebGL is used, the image captured from the camera will not be rendered on the canvas, instead, it gets processed by WebGL first and then is passed to the barcode reader engine directly. In this case, there won't be an original canvas. Therefore, if `bSaveOriCanvas` is set to `true` for a `BarcodeReader` or `BarcodeScanenr` instance, the WebGL feature will be disabled for that instance. +> +> On the other hand, if WebGL is disabled and you try to get the intermediate result specified by `EnumIntermediateResultType. IRT_ORIGINAL_IMAGE` , it will be exactly the same image as you would get with `oriCanvas` . + +The following shows how to display these images on the page + +```html +
+
+``` + +```javascript +let pScanner = null; +(async () => { + let scanner = await (pScanner = pScanner || Dynamsoft.DBR.BarcodeScanner.createInstance()); + /* The default of `_bUseWebgl` is true which means the intermediate result for + IRT_ORIGINAL_IMAGE will be one that has been preprocessed by WebGL */ + scanner._bUseWebgl = false; + document.getElementById('scannerV').appendChild(scanner.getUIElement());; + await scanner.updateRuntimeSettings('balance'); + let rs = await scanner.getRuntimeSettings(); + rs.intermediateResultTypes = 1; + await scanner.updateRuntimeSettings(rs); + scanner.onUnduplicatedRead = async (txt, result) => { + try { + let cvss = await scanner.getIntermediateCanvas(); + for (let cvs of cvss) { + document.getElementById('cvses').appendChild(cvs); + } + scanner.destroy(); + } catch (ex) { + console.error(ex); + } + }; + await scanner.show(); +})(); +``` + +## How to Upgrade + +If you are using an older version of the library and want to upgrade it to the latest version, please read more on [how to upgrade](https://www.dynamsoft.com/barcode-reader/programming/javascript/upgrade-guide/?ver=latest&utm_source=github). + +## FAQ + +### Can I open the web page directly from the hard drive? + +Yes, for simple testing purposes, it's perfectly fine to open the file directly from the hard drive. However, you might encounter some issues in doing so (like unable to access the camera, etc.). The recommendation is to deploy this page to your web server and run it over **HTTPS**. If you don't have a ready-to-use web server but have a package manager like *npm* or *yarn*, you can set up a simple HTTP server in minutes. Check out [`http-server` on npm](https://www.npmjs.com/package/http-server) or [yarn](https://yarnpkg.com/package/http-server). + +### Why can't I use my camera? + +If you open the web page as `file:///` or `http://`, the camera may not work and you see the following error in the browser console: + +> [Deprecation] getUserMedia() no longer works on insecure origins. To use this feature, you should consider switching your application to a secure origin, such as HTTPS. See https://goo.gl/rStTGz for more details. + +* In Safari 12 the equivalent error is: + +> Trying to call getUserMedia from an insecure document. + +You get this error because the API [getUserMedia](https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia) requires HTTPS to access the camera. + +* If you use Chrome or Firefox, you might not get the error because these two browsers allow camera access via file:/// and http://localhost. + +To make sure your web application can access the camera, please configure your web server to support HTTPS. The following links may help. + + - NGINX: [Configuring HTTPS servers](https://nginx.org/en/docs/http/configuring_https_servers.html) + - IIS: [Create a Self Signed Certificate in IIS](https://aboutssl.org/how-to-create-a-self-signed-certificate-in-iis/) + - Tomcat: [Setting Up SSL on Tomcat in 5 minutes](https://dzone.com/articles/setting-ssl-tomcat-5-minutes) + - Node.js: [npm tls](https://nodejs.org/docs/v0.4.1/api/tls.html) diff --git a/dist/README.md b/dist/README.md new file mode 100644 index 00000000..cbe53714 --- /dev/null +++ b/dist/README.md @@ -0,0 +1 @@ +https://www.dynamsoft.com/Downloads/Dynamic-Barcode-Reader-Download.aspx?edition=js&utm_source=github&package=js \ No newline at end of file diff --git a/dist/dbr-8.6.0.full.wasm b/dist/dbr-8.6.0.full.wasm new file mode 100644 index 00000000..1b236432 Binary files /dev/null and b/dist/dbr-8.6.0.full.wasm differ diff --git a/dist/dbr-8.6.0.full.wasm.js b/dist/dbr-8.6.0.full.wasm.js new file mode 100644 index 00000000..8b9d436d --- /dev/null +++ b/dist/dbr-8.6.0.full.wasm.js @@ -0,0 +1,134 @@ + +var k;k||(k=typeof Module !== 'undefined' ? Module : {});var aa={},ba;for(ba in k)k.hasOwnProperty(ba)&&(aa[ba]=k[ba]);var ca="./this.program",da="object"===typeof window,ea="function"===typeof importScripts,fa="object"===typeof process&&"object"===typeof process.versions&&"string"===typeof process.versions.node,p="",ha,ia,ja,ka,la; +if(fa)p=ea?require("path").dirname(p)+"/":__dirname+"/",ha=function(a,b){ka||(ka=require("fs"));la||(la=require("path"));a=la.normalize(a);return ka.readFileSync(a,b?null:"utf8")},ja=function(a){a=ha(a,!0);a.buffer||(a=new Uint8Array(a));a.buffer||r("Assertion failed: undefined");return a},ia=function(a,b,c){ka||(ka=require("fs"));la||(la=require("path"));a=la.normalize(a);ka.readFile(a,function(d,e){d?c(d):b(e.buffer)})},1=d);)++c;if(16e?d+=String.fromCharCode(e):(e-=65536,d+=String.fromCharCode(55296|e>>10,56320|e&1023))}}else d+=String.fromCharCode(e)}return d}function z(a,b){return a?ta(A,a,b):""} +function ua(a,b,c,d){if(!(0=g){var l=a.charCodeAt(++f);g=65536+((g&1023)<<10)|l&1023}if(127>=g){if(c>=d)break;b[c++]=g}else{if(2047>=g){if(c+1>=d)break;b[c++]=192|g>>6}else{if(65535>=g){if(c+2>=d)break;b[c++]=224|g>>12}else{if(c+3>=d)break;b[c++]=240|g>>18;b[c++]=128|g>>12&63}b[c++]=128|g>>6&63}b[c++]=128|g&63}}b[c]=0;return c-e} +function va(a){for(var b=0,c=0;c=d&&(d=65536+((d&1023)<<10)|a.charCodeAt(++c)&1023);127>=d?++b:b=2047>=d?b+2:65535>=d?b+3:b+4}return b}var wa="undefined"!==typeof TextDecoder?new TextDecoder("utf-16le"):void 0;function xa(a,b){var c=a>>1;for(var d=c+b/2;!(c>=d)&&ya[c];)++c;c<<=1;if(32=b/2);++d){var e=za[a+2*d>>1];if(0==e)break;c+=String.fromCharCode(e)}return c} +function Aa(a,b,c){void 0===c&&(c=2147483647);if(2>c)return 0;c-=2;var d=b;c=c<2*a.length?c/2:a.length;for(var e=0;e>1]=a.charCodeAt(e),b+=2;za[b>>1]=0;return b-d}function Ba(a){return 2*a.length}function Ca(a,b){for(var c=0,d="";!(c>=b/4);){var e=C[a+4*c>>2];if(0==e)break;++c;65536<=e?(e-=65536,d+=String.fromCharCode(55296|e>>10,56320|e&1023)):d+=String.fromCharCode(e)}return d} +function Da(a,b,c){void 0===c&&(c=2147483647);if(4>c)return 0;var d=b;c=d+c-4;for(var e=0;e=f){var g=a.charCodeAt(++e);f=65536+((f&1023)<<10)|g&1023}C[b>>2]=f;b+=4;if(b+4>c)break}C[b>>2]=0;return b-d}function Ea(a){for(var b=0,c=0;c=d&&++c;b+=4}return b}function Fa(a){var b=va(a)+1,c=Ga(b);c&&ua(a,E,c,b);return c}var Ha,E,A,za,ya,C,F,Ia,Ja; +function Ka(){var a=qa.buffer;Ha=a;k.HEAP8=E=new Int8Array(a);k.HEAP16=za=new Int16Array(a);k.HEAP32=C=new Int32Array(a);k.HEAPU8=A=new Uint8Array(a);k.HEAPU16=ya=new Uint16Array(a);k.HEAPU32=F=new Uint32Array(a);k.HEAPF32=Ia=new Float32Array(a);k.HEAPF64=Ja=new Float64Array(a)}var La,Ma=[],Na=[],Oa=[];function Pa(){var a=k.preRun.shift();Ma.unshift(a)}var Qa=0,Ra=null,Sa=null;k.preloadedImages={};k.preloadedAudios={}; +function r(a){if(k.onAbort)k.onAbort(a);y(a);ra=!0;throw new WebAssembly.RuntimeError("abort("+a+"). Build with -s ASSERTIONS=1 for more info.");}function Ta(){return G.startsWith("data:application/octet-stream;base64,")}var G;G="libDynamsoftBarcodeReader.wasm";if(!Ta()){var Ua=G;G=k.locateFile?k.locateFile(Ua,p):p+Ua}function Va(){var a=G;try{if(a==G&&pa)return new Uint8Array(pa);if(ja)return ja(a);throw"both async and sync fetching of the wasm failed";}catch(b){r(b)}} +function Wa(){if(!pa&&(da||ea)){if("function"===typeof fetch&&!G.startsWith("file://"))return fetch(G,{credentials:"same-origin"}).then(function(a){if(!a.ok)throw"failed to load wasm binary file at '"+G+"'";return a.arrayBuffer()}).catch(function(){return Va()});if(ia)return new Promise(function(a,b){ia(G,function(c){a(new Uint8Array(c))},b)})}return Promise.resolve().then(function(){return Va()})}var H,I; +function Xa(a){for(;0>2]=b};this.Kb=function(b){C[this.ta+8>>2]=b};this.Lb=function(){C[this.ta>>2]=0};this.Jb=function(){E[this.ta+12>>0]=0};this.Mb=function(){E[this.ta+13>>0]=0};this.Ab=function(b,c){this.Nb(b);this.Kb(c);this.Lb();this.Jb();this.Mb()}}var Za=0,$a; +function ab(){function a(g){return(g=g.toTimeString().match(/\(([A-Za-z ]+)\)$/))?g[1]:"GMT"}if(!bb){bb=!0;var b=(new Date).getFullYear(),c=new Date(b,0,1),d=new Date(b,6,1);b=c.getTimezoneOffset();var e=d.getTimezoneOffset(),f=Math.max(b,e);C[cb()>>2]=60*f;C[db()>>2]=Number(b!=e);c=a(c);d=a(d);c=Fa(c);d=Fa(d);e>2]=c,C[eb()+4>>2]=d):(C[eb()>>2]=d,C[eb()+4>>2]=c)}}var bb; +function fb(a,b){for(var c=0,d=a.length-1;0<=d;d--){var e=a[d];"."===e?a.splice(d,1):".."===e?(a.splice(d,1),c++):c&&(a.splice(d,1),c--)}if(b)for(;c;c--)a.unshift("..");return a}function gb(a){var b="/"===a.charAt(0),c="/"===a.substr(-1);(a=fb(a.split("/").filter(function(d){return!!d}),!b).join("/"))||b||(a=".");a&&c&&(a+="/");return(b?"/":"")+a} +function hb(a){var b=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(a).slice(1);a=b[0];b=b[1];if(!a&&!b)return".";b&&(b=b.substr(0,b.length-1));return a+b}function ib(a){if("/"===a)return"/";a=gb(a);a=a.replace(/\/$/,"");var b=a.lastIndexOf("/");return-1===b?a:a.substr(b+1)} +function jb(){if("object"===typeof crypto&&"function"===typeof crypto.getRandomValues){var a=new Uint8Array(1);return function(){crypto.getRandomValues(a);return a[0]}}if(fa)try{var b=require("crypto");return function(){return b.randomBytes(1)[0]}}catch(c){}return function(){r("randomDevice")}} +function kb(){for(var a="",b=!1,c=arguments.length-1;-1<=c&&!b;c--){b=0<=c?arguments[c]:"/";if("string"!==typeof b)throw new TypeError("Arguments to path.resolve must be strings");if(!b)return"";a=b+"/"+a;b="/"===b.charAt(0)}a=fb(a.split("/").filter(function(d){return!!d}),!b).join("/");return(b?"/":"")+a||"."}var lb=[];function mb(a,b){lb[a]={input:[],output:[],Sa:b};nb(a,ob)} +var ob={open:function(a){var b=lb[a.node.rdev];if(!b)throw new J(43);a.tty=b;a.seekable=!1},close:function(a){a.tty.Sa.flush(a.tty)},flush:function(a){a.tty.Sa.flush(a.tty)},read:function(a,b,c,d){if(!a.tty||!a.tty.Sa.ob)throw new J(60);for(var e=0,f=0;f=b||(b=Math.max(b,c*(1048576>c?2:1.125)>>>0),0!=c&&(b=Math.max(b,256)),c=a.sa,a.sa=new Uint8Array(b),0=a.node.xa)return 0;a=Math.min(a.node.xa-e,d);if(8b)throw new J(28);return b},jb:function(a,b,c){K.mb(a.node,b+c);a.node.xa=Math.max(a.node.xa,b+c)},pb:function(a,b,c,d,e,f){if(0!==b)throw new J(28);if(32768!==(a.node.mode&61440))throw new J(43);a=a.node.sa;if(f&2||a.buffer!==Ha){if(0>>0)%Ab.length}function Fb(a){var b=Eb(a.parent.id,a.name);if(Ab[b]===a)Ab[b]=a.Ra;else for(b=Ab[b];b;){if(b.Ra===a){b.Ra=a.Ra;break}b=b.Ra}} +function vb(a,b){var c;if(c=(c=Gb(a,"x"))?c:a.ra.lookup?0:2)throw new J(c,a);for(c=Ab[Eb(a.id,b)];c;c=c.Ra){var d=c.name;if(c.parent.id===a.id&&d===b)return c}return a.ra.lookup(a,b)}function tb(a,b,c,d){a=new Hb(a,b,c,d);b=Eb(a.parent.id,a.name);a.Ra=Ab[b];return Ab[b]=a}function L(a){return 16384===(a&61440)}var Ib={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090};function Jb(a){var b=["r","w","rw"][a&3];a&512&&(b+="w");return b} +function Gb(a,b){if(Bb)return 0;if(!b.includes("r")||a.mode&292){if(b.includes("w")&&!(a.mode&146)||b.includes("x")&&!(a.mode&73))return 2}else return 2;return 0}function Kb(a,b){try{return vb(a,b),20}catch(c){}return Gb(a,"wx")}function Lb(a,b,c){try{var d=vb(a,b)}catch(e){return e.ya}if(a=Gb(a,"wx"))return a;if(c){if(!L(d.mode))return 54;if(d===d.parent||"/"===Db(d))return 10}else if(L(d.mode))return 31;return 0}function Mb(a){var b=4096;for(a=a||0;a<=b;a++)if(!yb[a])return a;throw new J(33);} +function Nb(a,b){Ob||(Ob=function(){},Ob.prototype={});var c=new Ob,d;for(d in a)c[d]=a[d];a=c;b=Mb(b);a.fd=b;return yb[b]=a}var sb={open:function(a){a.va=xb[a.node.rdev].va;a.va.open&&a.va.open(a)},Ma:function(){throw new J(70);}};function nb(a,b){xb[a]={va:b}} +function Pb(a,b){var c="/"===b,d=!b;if(c&&wb)throw new J(10);if(!c&&!d){var e=N(b,{nb:!1});b=e.path;e=e.node;if(e.Qa)throw new J(10);if(!L(e.mode))throw new J(54);}b={type:a,Yb:{},qb:b,Cb:[]};a=a.Ha(b);a.Ha=b;b.root=a;c?wb=a:e&&(e.Qa=b,e.Ha&&e.Ha.Cb.push(b))}function Qb(a,b,c){var d=N(a,{parent:!0}).node;a=ib(a);if(!a||"."===a||".."===a)throw new J(28);var e=Kb(d,a);if(e)throw new J(e);if(!d.ra.Za)throw new J(63);return d.ra.Za(d,a,b,c)} +function O(a,b){return Qb(a,(void 0!==b?b:511)&1023|16384,0)}function Rb(a,b,c){"undefined"===typeof c&&(c=b,b=438);Qb(a,b|8192,c)}function Sb(a,b){if(!kb(a))throw new J(44);var c=N(b,{parent:!0}).node;if(!c)throw new J(44);b=ib(b);var d=Kb(c,b);if(d)throw new J(d);if(!c.ra.symlink)throw new J(63);c.ra.symlink(c,b,a)}function Cb(a){a=N(a).node;if(!a)throw new J(44);if(!a.ra.readlink)throw new J(28);return kb(Db(a.parent),a.ra.readlink(a))} +function Tb(a,b,c,d){if(""===a)throw new J(44);if("string"===typeof b){var e=Ib[b];if("undefined"===typeof e)throw Error("Unknown file open mode: "+b);b=e}c=b&64?("undefined"===typeof c?438:c)&4095|32768:0;if("object"===typeof a)var f=a;else{a=gb(a);try{f=N(a,{eb:!(b&131072)}).node}catch(g){}}e=!1;if(b&64)if(f){if(b&128)throw new J(20);}else f=Qb(a,c,0),e=!0;if(!f)throw new J(44);8192===(f.mode&61440)&&(b&=-513);if(b&65536&&!L(f.mode))throw new J(54);if(!e&&(c=f?40960===(f.mode&61440)?32:L(f.mode)&& +("r"!==Jb(b)||b&512)?31:Gb(f,Jb(b)):44))throw new J(c);if(b&512){c=f;c="string"===typeof c?N(c,{eb:!0}).node:c;if(!c.ra.Fa)throw new J(63);if(L(c.mode))throw new J(31);if(32768!==(c.mode&61440))throw new J(28);if(e=Gb(c,"w"))throw new J(e);c.ra.Fa(c,{size:0,timestamp:Date.now()})}b&=-131713;d=Nb({node:f,path:Db(f),flags:b,seekable:!0,position:0,va:f.va,Tb:[],error:!1},d);d.va.open&&d.va.open(d);!k.logReadFiles||b&1||(Ub||(Ub={}),a in Ub||(Ub[a]=1,y("FS.trackingDelegate error on read file: "+a))); +try{M.onOpenFile&&(f=0,1!==(b&2097155)&&(f|=1),0!==(b&2097155)&&(f|=2),M.onOpenFile(a,f))}catch(g){y("FS.trackingDelegate['onOpenFile']('"+a+"', flags) threw an exception: "+g.message)}return d}function Vb(a,b,c){if(null===a.fd)throw new J(8);if(!a.seekable||!a.va.Ma)throw new J(70);if(0!=c&&1!=c&&2!=c)throw new J(28);a.position=a.va.Ma(a,b,c);a.Tb=[];return a.position} +function Wb(){J||(J=function(a,b){this.node=b;this.Ib=function(c){this.ya=c};this.Ib(a);this.message="FS error"},J.prototype=Error(),J.prototype.constructor=J,[44].forEach(function(a){ub[a]=new J(a);ub[a].stack=""}))}var Xb;function Yb(a,b){var c=0;a&&(c|=365);b&&(c|=146);return c} +function Zb(a,b,c){a=gb("/dev/"+a);var d=Yb(!!b,!!c);$b||($b=64);var e=$b++<<8|0;nb(e,{open:function(f){f.seekable=!1},close:function(){c&&c.buffer&&c.buffer.length&&c(10)},read:function(f,g,l,q){for(var m=0,n=0;n>2]}function cc(a){a=yb[a];if(!a)throw new J(8);return a}function dc(a){switch(a){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+a);}}var ec=void 0;function Q(a){for(var b="";A[a];)b+=ec[A[a++]];return b}var fc={},gc={},hc={};function ic(a){if(void 0===a)return"_unknown";a=a.replace(/[^a-zA-Z0-9_]/g,"$");var b=a.charCodeAt(0);return 48<=b&&57>=b?"_"+a:a} +function jc(a,b){a=ic(a);return(new Function("body","return function "+a+'() {\n "use strict"; return body.apply(this, arguments);\n};\n'))(b)}function kc(a){var b=Error,c=jc(a,function(d){this.name=a;this.message=d;d=Error(d).stack;void 0!==d&&(this.stack=this.toString()+"\n"+d.replace(/^Error(:[^\n]*)?\n/,""))});c.prototype=Object.create(b.prototype);c.prototype.constructor=c;c.prototype.toString=function(){return void 0===this.message?this.name:this.name+": "+this.message};return c} +var lc=void 0;function R(a){throw new lc(a);}var mc=void 0;function nc(a){throw new mc(a);}function S(a,b,c){function d(l){l=c(l);l.length!==a.length&&nc("Mismatched type converter count");for(var q=0;q>2])}function Ic(a,b,c){if(b===c)return a;if(void 0===c.Da)return null;a=Ic(a,b,c.Da);return null===a?null:c.wb(a)} +var Jc={};function Kc(a,b){for(void 0===b&&R("ptr should not be undefined");a.Da;)b=a.Wa(b),a=a.Da;return Jc[b]}function Lc(a,b){b.wa&&b.ta||nc("makeClassHandle requires ptr and ptrType");!!b.Ca!==!!b.Ba&&nc("Both smartPtrType and smartPtr must be specified");b.count={value:1};return sc(Object.create(a,{qa:{value:b}}))} +function U(a,b,c,d){this.name=a;this.ua=b;this.fb=c;this.Xa=d;this.Ya=!1;this.Na=this.Gb=this.Fb=this.sb=this.Ob=this.Db=void 0;void 0!==b.Da?this.toWireType=Ec:(this.toWireType=d?Cc:Gc,this.Ga=null)}function Mc(a,b){k.hasOwnProperty(a)||nc("Replacing nonexistant public symbol");k[a]=b;k[a].Oa=void 0} +function Nc(a,b){var c=[];return function(){c.length=arguments.length;for(var d=0;df&&R("argTypes array size mismatch! Must at least get return value and 'this' types!");var g=null!==b[1]&&null!==c,l=!1;for(c=1;c>2)+d]);return c} +function Xc(a,b,c){a instanceof Object||R(c+' with invalid "this": '+a);a instanceof b.ua.constructor||R(c+' incompatible with "this" of type '+a.constructor.name);a.qa.ta||R("cannot call emscripten binding method "+c+" on deleted object");return Bc(a.qa.ta,a.qa.wa.ua,b.ua)}var Yc=[],X=[{},{value:void 0},{value:null},{value:!0},{value:!1}];function Zc(a){4>2])};case 3:return function(c){return this.fromWireType(Ja[c>>3])};default:throw new TypeError("Unknown float type: "+a);}} +function ad(a,b,c){switch(b){case 0:return c?function(d){return E[d]}:function(d){return A[d]};case 1:return c?function(d){return za[d>>1]}:function(d){return ya[d>>1]};case 2:return c?function(d){return C[d>>2]}:function(d){return F[d>>2]};default:throw new TypeError("Unknown integer type: "+a);}}function bd(){void 0===bd.start&&(bd.start=Date.now());return 1E3*(Date.now()-bd.start)|0}var cd;cd=fa?function(){var a=process.hrtime();return 1E3*a[0]+a[1]/1E6}:function(){return performance.now()}; +function dd(a,b){if(0>=a)return a;var c=32>=b?Math.abs(1<=c&&(32>=b||a>c)&&(a=-2*c+a);return a}function ed(a,b){return 0<=a?a:32>=b?2*Math.abs(1<>3],d+=8):"i64"==D?(D=[C[d>>2],C[d+4>>2]],d+=8):(D=C[d>>2],d+=4);return D}for(var d=b,e=[],f,g;;){var l=a;f=E[a>>0];if(0===f)break;g=E[a+1>>0];if(37==f){var q=!1,m=b=!1,n=!1,x=!1;a:for(;;){switch(g){case 43:q=!0;break;case 45:b=!0;break;case 35:m=!0;break;case 48:if(n)break a;else{n=!0;break}case 32:x=!0;break;default:break a}a++;g=E[a+1>>0]}var v=0;if(42==g)v=c("i32"),a++,g=E[a+1>>0];else for(;48<= +g&&57>=g;)v=10*v+(g-48),a++,g=E[a+1>>0];var h=!1,t=-1;if(46==g){t=0;h=!0;a++;g=E[a+1>>0];if(42==g)t=c("i32"),a++;else for(;;){g=E[a+1>>0];if(48>g||57>0]}0>t&&(t=6,h=!1);switch(String.fromCharCode(g)){case "h":g=E[a+2>>0];if(104==g){a++;var w=1}else w=2;break;case "l":g=E[a+2>>0];108==g?(a++,w=8):w=4;break;case "L":case "q":case "j":w=8;break;case "z":case "t":case "I":w=4;break;default:w=null}w&&a++;g=E[a+1>>0];switch(String.fromCharCode(g)){case "d":case "i":case "u":case "o":case "x":case "X":case "p":l= +100==g||105==g;w=w||4;f=c("i"+8*w);8==w&&(f=117==g?(f[0]>>>0)+4294967296*(f[1]>>>0):(f[0]>>>0)+4294967296*f[1]);4>=w&&(f=(l?dd:ed)(f&Math.pow(256,w)-1,8*w));var B=Math.abs(f);l="";if(100==g||105==g)var u=dd(f,8*w,1).toString(10);else if(117==g)u=ed(f,8*w,1).toString(10),f=Math.abs(f);else if(111==g)u=(m?"0":"")+B.toString(8);else if(120==g||88==g){l=m&&0!=f?"0x":"";if(0>f){f=-f;u=(B-1).toString(16);B=[];for(m=0;mw&&-4<=w?(g=(103==g?"f":"F").charCodeAt(0),t-=w+1):(g=(103==g?"e":"E").charCodeAt(0),t--),w=Math.min(t,20);if(101==g||69==g)u=f.toExponential(w),/[eE][-+]\d$/.test(u)&&(u=u.slice(0,-1)+"0"+u.slice(-1));else if(102==g||70==g)u=f.toFixed(w),0===f&&(0>f||0===f&&-Infinity===1/f)&&(u="-"+u);l=u.split("e");if(h&&!m)for(;1w++;)l[0]+="0";u=l[0]+(1f?"-":"")+"inf",n=!1;for(;u.lengthg&&(u=u.toUpperCase());u.split("").forEach(function(D){e.push(D.charCodeAt(0))});break;case "s":n=(q=c("i8*"))?gd(q):6;h&&(n=Math.min(n,t));if(!b)for(;n>0]);else e=e.concat(pb("(null)".substr(0,n), +!0));if(b)for(;n>2]=e.length;break;case "%":e.push(f);break;default:for(m=l;m>0])}a+=2}else e.push(f),a+=1}return e} +function hd(a){if(!a||!a.callee||!a.callee.name)return[null,"",""];var b=a.callee.name,c="(",d=!0,e;for(e in a){var f=a[e];d||(c+=", ");d=!1;c="number"===typeof f||"string"===typeof f?c+f:c+("("+typeof f+")")}c+=")";a=(a=a.callee.caller)?a.arguments:[];d&&(c="");return[a,b,c]} +function jd(a){a:{var b=Error();if(!b.stack){try{throw Error();}catch(t){b=t}if(!b.stack){b="(no stack trace available)";break a}}b=b.stack.toString()}b=b.slice(b.indexOf("\n",Math.max(b.lastIndexOf("_emscripten_log"),b.lastIndexOf("_emscripten_get_callstack")))+1);a&32&&na("EM_LOG_DEMANGLE is deprecated; ignoring");a&8&&"undefined"===typeof emscripten_source_map&&(na('Source map information is not available, emscripten_log with EM_LOG_C_STACK will be ignored. Build with "--pre-js $EMSCRIPTEN/src/emscripten-source-map.min.js" linker flag to add source map loading to code.'), +a=a^8|16);var c=null;if(a&128)for(c=hd(arguments);c[1].includes("_emscripten_");)c=hd(c[0]);var d=b.split("\n");b="";var e=/\s*(.*?)@(.*?):([0-9]+):([0-9]+)/,f=/\s*(.*?)@(.*):(.*)(:(.*))?/,g=/\s*at (.*?) \((.*):(.*):(.*)\)/,l;for(l in d){var q=d[l],m;if((m=g.exec(q))&&5==m.length){q=m[1];var n=m[2];var x=m[3];m=m[4]}else if((m=e.exec(q))||(m=f.exec(q)),m&&4<=m.length)q=m[1],n=m[2],x=m[3],m=m[4]|0;else{b+=q+"\n";continue}var v=!1;if(a&8){var h=emscripten_source_map.Zb({line:x,ub:m});if(v=h&&h.source)a& +64&&(h.source=h.source.substring(h.source.replace(/\\/g,"/").lastIndexOf("/")+1)),b+=" at "+q+" ("+h.source+":"+h.line+":"+h.ub+")\n"}if(a&16||!v)a&64&&(n=n.substring(n.replace(/\\/g,"/").lastIndexOf("/")+1)),b+=(v?" = "+q:" at "+q)+" ("+n+":"+x+":"+m+")\n";a&128&&c[0]&&(c[1]==q&&0u?-1:0=g(w,h)?0>=g(t,h)?h.getFullYear()+1:h.getFullYear():h.getFullYear()-1}var m=C[d+40>>2];d={Rb:C[d>>2],Qb:C[d+4>>2],$a:C[d+8>>2],Va:C[d+12>>2],Ta:C[d+16>>2],Aa:C[d+20>>2],ab:C[d+24>>2],bb:C[d+28>>2],$b:C[d+32>>2],Pb:C[d+ +36>>2],Sb:m?z(m):""};c=z(c);m={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var n in m)c=c.replace(new RegExp(n,"g"),m[n]);var x="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "), +v="January February March April May June July August September October November December".split(" ");m={"%a":function(h){return x[h.ab].substring(0,3)},"%A":function(h){return x[h.ab]},"%b":function(h){return v[h.Ta].substring(0,3)},"%B":function(h){return v[h.Ta]},"%C":function(h){return f((h.Aa+1900)/100|0,2)},"%d":function(h){return f(h.Va,2)},"%e":function(h){return e(h.Va,2," ")},"%g":function(h){return q(h).toString().substring(2)},"%G":function(h){return q(h)},"%H":function(h){return f(h.$a, +2)},"%I":function(h){h=h.$a;0==h?h=12:12h.$a?"AM":"PM"},"%S":function(h){return f(h.Rb,2)},"%t":function(){return"\t"},"%u":function(h){return h.ab||7},"%U":function(h){var t=new Date(h.Aa+1900,0,1),w=0===t.getDay()?t:rd(t,7-t.getDay());h=new Date(h.Aa+1900,h.Ta,h.Va);return 0> +g(w,h)?f(Math.ceil((31-w.getDate()+(od(nd(h.getFullYear())?pd:qd,h.getMonth()-1)-31)+h.getDate())/7),2):0===g(w,t)?"01":"00"},"%V":function(h){var t=new Date(h.Aa+1901,0,4),w=l(new Date(h.Aa+1900,0,4));t=l(t);var B=rd(new Date(h.Aa+1900,0,1),h.bb);return 0>g(B,w)?"53":0>=g(t,B)?"01":f(Math.ceil((w.getFullYear()g(w,h)?f(Math.ceil((31-w.getDate()+(od(nd(h.getFullYear())?pd:qd,h.getMonth()-1)-31)+h.getDate())/7),2):0===g(w,t)?"01":"00"},"%y":function(h){return(h.Aa+1900).toString().substring(2)},"%Y":function(h){return h.Aa+1900},"%z":function(h){h=h.Pb;var t=0<=h;h=Math.abs(h)/60;return(t?"+":"-")+String("0000"+(h/60*100+h%60)).slice(-4)},"%Z":function(h){return h.Sb},"%%":function(){return"%"}};for(n in m)c.includes(n)&&(c=c.replace(new RegExp(n,"g"),m[n](d)));n=pb(c, +!1);if(n.length>b)return 0;E.set(n,a);return n.length-1}function Hb(a,b,c,d){a||(a=this);this.parent=a;this.Ha=a.Ha;this.Qa=null;this.id=zb++;this.name=b;this.mode=c;this.ra={};this.va={};this.rdev=d}Object.defineProperties(Hb.prototype,{read:{get:function(){return 365===(this.mode&365)},set:function(a){a?this.mode|=365:this.mode&=-366}},write:{get:function(){return 146===(this.mode&146)},set:function(a){a?this.mode|=146:this.mode&=-147}}});Wb();Ab=Array(4096);Pb(K,"/");O("/tmp");O("/home");O("/home/web_user"); +(function(){O("/dev");nb(259,{read:function(){return 0},write:function(b,c,d,e){return e}});Rb("/dev/null",259);mb(1280,qb);mb(1536,rb);Rb("/dev/tty",1280);Rb("/dev/tty1",1536);var a=jb();Zb("random",a);Zb("urandom",a);O("/dev/shm");O("/dev/shm/tmp")})(); +(function(){O("/proc");var a=O("/proc/self");O("/proc/self/fd");Pb({Ha:function(){var b=tb(a,"fd",16895,73);b.ra={lookup:function(c,d){var e=yb[+d];if(!e)throw new J(8);c={parent:null,Ha:{qb:"fake"},ra:{readlink:function(){return e.path}}};return c.parent=c}};return b}},"/proc/self/fd")})();for(var td=Array(256),ud=0;256>ud;++ud)td[ud]=String.fromCharCode(ud);ec=td;lc=k.BindingError=kc("BindingError");mc=k.InternalError=kc("InternalError"); +wc.prototype.isAliasOf=function(a){if(!(this instanceof wc&&a instanceof wc))return!1;var b=this.qa.wa.ua,c=this.qa.ta,d=a.qa.wa.ua;for(a=a.qa.ta;b.Da;)c=b.Wa(c),b=b.Da;for(;d.Da;)a=d.Wa(a),d=d.Da;return b===d&&c===a}; +wc.prototype.clone=function(){this.qa.ta||oc(this);if(this.qa.Ua)return this.qa.count.value+=1,this;var a=sc,b=Object,c=b.create,d=Object.getPrototypeOf(this),e=this.qa;a=a(c.call(b,d,{qa:{value:{count:e.count,Pa:e.Pa,Ua:e.Ua,ta:e.ta,wa:e.wa,Ba:e.Ba,Ca:e.Ca}}}));a.qa.count.value+=1;a.qa.Pa=!1;return a};wc.prototype["delete"]=function(){this.qa.ta||oc(this);this.qa.Pa&&!this.qa.Ua&&R("Object already scheduled for deletion");qc(this);rc(this.qa);this.qa.Ua||(this.qa.Ba=void 0,this.qa.ta=void 0)}; +wc.prototype.isDeleted=function(){return!this.qa.ta};wc.prototype.deleteLater=function(){this.qa.ta||oc(this);this.qa.Pa&&!this.qa.Ua&&R("Object already scheduled for deletion");uc.push(this);1===uc.length&&tc&&tc(vc);this.qa.Pa=!0;return this};U.prototype.yb=function(a){this.sb&&(a=this.sb(a));return a};U.prototype.lb=function(a){this.Na&&this.Na(a)};U.prototype.argPackAdvance=8;U.prototype.readValueFromPointer=Hc;U.prototype.deleteObject=function(a){if(null!==a)a["delete"]()}; +U.prototype.fromWireType=function(a){function b(){return this.Ya?Lc(this.ua.Ja,{wa:this.Db,ta:c,Ca:this,Ba:a}):Lc(this.ua.Ja,{wa:this,ta:a})}var c=this.yb(a);if(!c)return this.lb(a),null;var d=Kc(this.ua,c);if(void 0!==d){if(0===d.qa.count.value)return d.qa.ta=c,d.qa.Ba=a,d.clone();d=d.clone();this.lb(a);return d}d=this.ua.xb(c);d=xc[d];if(!d)return b.call(this);d=this.Xa?d.vb:d.pointerType;var e=Ic(c,this.ua,d.ua);return null===e?b.call(this):this.Ya?Lc(d.ua.Ja,{wa:d,ta:e,Ca:this,Ba:a}):Lc(d.ua.Ja, +{wa:d,ta:e})};k.getInheritedInstanceCount=function(){return Object.keys(Jc).length};k.getLiveInheritedInstances=function(){var a=[],b;for(b in Jc)Jc.hasOwnProperty(b)&&a.push(Jc[b]);return a};k.flushPendingDeletes=vc;k.setDelayFunction=function(a){tc=a;uc.length&&tc&&tc(vc)};Oc=k.UnboundTypeError=kc("UnboundTypeError");k.count_emval_handles=function(){for(var a=0,b=5;b>2]);C[b>>2]=a.getUTCSeconds();C[b+4>>2]=a.getUTCMinutes();C[b+8>>2]=a.getUTCHours();C[b+12>>2]=a.getUTCDate();C[b+16>>2]=a.getUTCMonth();C[b+20>>2]=a.getUTCFullYear()-1900;C[b+24>>2]=a.getUTCDay();C[b+36>>2]=0;C[b+32>>2]=0;C[b+28>>2]=(a.getTime()-Date.UTC(a.getUTCFullYear(),0,1,0,0,0,0))/864E5|0;$a||($a=Fa("GMT"));C[b+40>>2]=$a;return b},G:function(a,b){ab();a=new Date(1E3* +C[a>>2]);C[b>>2]=a.getSeconds();C[b+4>>2]=a.getMinutes();C[b+8>>2]=a.getHours();C[b+12>>2]=a.getDate();C[b+16>>2]=a.getMonth();C[b+20>>2]=a.getFullYear()-1900;C[b+24>>2]=a.getDay();var c=new Date(a.getFullYear(),0,1);C[b+28>>2]=(a.getTime()-c.getTime())/864E5|0;C[b+36>>2]=-(60*a.getTimezoneOffset());var d=(new Date(a.getFullYear(),6,1)).getTimezoneOffset();c=c.getTimezoneOffset();a=(d!=c&&a.getTimezoneOffset()==Math.min(c,d))|0;C[b+32>>2]=a;a=C[eb()+(a?4:0)>>2];C[b+40>>2]=a;return b},r:function(a, +b,c){ac=c;try{var d=cc(a);switch(b){case 0:var e=bc();return 0>e?-28:Tb(d.path,d.flags,0,e).fd;case 1:case 2:return 0;case 3:return d.flags;case 4:return e=bc(),d.flags|=e,0;case 12:return e=bc(),za[e+0>>1]=2,0;case 13:case 14:return 0;case 16:case 8:return-28;case 9:return C[vd()>>2]=28,-1;default:return-28}}catch(f){return"undefined"!==typeof P&&f instanceof J||r(f),-f.ya}},Q:function(a,b,c){try{var d=cc(a);if(!d.La){var e=N(d.path,{eb:!0}).node;if(!e.ra.readdir)throw new J(54);var f=e.ra.readdir(e); +d.La=f}a=0;for(var g=Vb(d,0,1),l=Math.floor(g/280);l>>0,(H=m,1<=+Math.abs(H)?0>>0:~~+Math.ceil((H-+(~~H>>>0))/4294967296)>>>0:0)];C[b+a>>2]=I[0];C[b+a+4>>2]=I[1];I=[280*(l+1)>>>0,(H=280*(l+1),1<=+Math.abs(H)?0>>0:~~+Math.ceil((H- ++(~~H>>>0))/4294967296)>>>0:0)];C[b+a+8>>2]=I[0];C[b+a+12>>2]=I[1];za[b+a+16>>1]=280;E[b+a+18>>0]=n;ua(q,A,b+a+19,256);a+=280;l+=1}Vb(d,280*l,0);return a}catch(v){return"undefined"!==typeof P&&v instanceof J||r(v),-v.ya}},M:function(a,b,c){ac=c;try{var d=cc(a);switch(b){case 21509:case 21505:return d.tty?0:-59;case 21510:case 21511:case 21512:case 21506:case 21507:case 21508:return d.tty?0:-59;case 21519:if(!d.tty)return-59;var e=bc();return C[e>>2]=0;case 21520:return d.tty?-28:-59;case 21531:a= +e=bc();if(!d.va.Bb)throw new J(59);return d.va.Bb(d,b,a);case 21523:return d.tty?0:-59;case 21524:return d.tty?0:-59;default:r("bad ioctl syscall "+b)}}catch(f){return"undefined"!==typeof P&&f instanceof J||r(f),-f.ya}},I:function(a,b){try{return a=z(a),a=gb(a),"/"===a[a.length-1]&&(a=a.substr(0,a.length-1)),O(a,b),0}catch(c){return"undefined"!==typeof P&&c instanceof J||r(c),-c.ya}},s:function(a,b,c){ac=c;try{var d=z(a),e=c?bc():0;return Tb(d,b,e).fd}catch(f){return"undefined"!==typeof P&&f instanceof +J||r(f),-f.ya}},J:function(a,b,c){try{a=z(a);if(0>=c)var d=-28;else{var e=Cb(a),f=Math.min(c,va(e)),g=E[b+f];ua(e,A,b,c+1);E[b+f]=g;d=f}return d}catch(l){return"undefined"!==typeof P&&l instanceof J||r(l),-l.ya}},N:function(a){try{a=z(a);var b=N(a,{parent:!0}).node,c=ib(a),d=vb(b,c),e=Lb(b,c,!0);if(e)throw new J(e);if(!b.ra.rmdir)throw new J(63);if(d.Qa)throw new J(10);try{M.willDeletePath&&M.willDeletePath(a)}catch(f){y("FS.trackingDelegate['willDeletePath']('"+a+"') threw an exception: "+f.message)}b.ra.rmdir(b, +c);Fb(d);try{if(M.onDeletePath)M.onDeletePath(a)}catch(f){y("FS.trackingDelegate['onDeletePath']('"+a+"') threw an exception: "+f.message)}return 0}catch(f){return"undefined"!==typeof P&&f instanceof J||r(f),-f.ya}},P:function(a){try{a=z(a);var b=N(a,{parent:!0}).node,c=ib(a),d=vb(b,c),e=Lb(b,c,!1);if(e)throw new J(e);if(!b.ra.unlink)throw new J(63);if(d.Qa)throw new J(10);try{M.willDeletePath&&M.willDeletePath(a)}catch(f){y("FS.trackingDelegate['willDeletePath']('"+a+"') threw an exception: "+f.message)}b.ra.unlink(b, +c);Fb(d);try{if(M.onDeletePath)M.onDeletePath(a)}catch(f){y("FS.trackingDelegate['onDeletePath']('"+a+"') threw an exception: "+f.message)}return 0}catch(f){return"undefined"!==typeof P&&f instanceof J||r(f),-f.ya}},z:function(){},S:function(a,b,c,d,e){var f=dc(c);b=Q(b);T(a,{name:b,fromWireType:function(g){return!!g},toWireType:function(g,l){return l?d:e},argPackAdvance:8,readValueFromPointer:function(g){if(1===c)var l=E;else if(2===c)l=za;else if(4===c)l=C;else throw new TypeError("Unknown boolean type size: "+ +b);return this.fromWireType(l[g>>f])},Ga:null})},w:function(a,b,c,d,e,f,g,l,q,m,n,x,v){n=Q(n);f=V(e,f);l&&(l=V(g,l));m&&(m=V(q,m));v=V(x,v);var h=ic(n);zc(h,function(){Sc("Cannot construct "+n+" due to unbound types",[d])});S([a,b,c],d?[d]:[],function(t){t=t[0];if(d){var w=t.ua;var B=w.Ja}else B=wc.prototype;t=jc(h,function(){if(Object.getPrototypeOf(this)!==u)throw new lc("Use 'new' to construct "+n);if(void 0===D.Ka)throw new lc(n+" has no accessible constructor");var Pc=D.Ka[arguments.length]; +if(void 0===Pc)throw new lc("Tried to invoke ctor of "+n+" with invalid number of parameters ("+arguments.length+") - expected ("+Object.keys(D.Ka).toString()+") parameters instead!");return Pc.apply(this,arguments)});var u=Object.create(B,{constructor:{value:t}});t.prototype=u;var D=new Ac(n,t,u,v,w,f,l,m);w=new U(n,D,!0,!1);B=new U(n+"*",D,!1,!1);var Z=new U(n+" const*",D,!1,!0);xc[a]={pointerType:B,vb:Z};Mc(h,t);return[w,B,Z]})},i:function(a,b,c,d,e,f,g){var l=Wc(c,d);b=Q(b);f=V(e,f);S([],[a], +function(q){function m(){Sc("Cannot call "+n+" due to unbound types",l)}q=q[0];var n=q.name+"."+b;b.startsWith("@@")&&(b=Symbol[b.substring(2)]);var x=q.ua.constructor;void 0===x[b]?(m.Oa=c-1,x[b]=m):(yc(x,b,n),x[b].za[c-1]=m);S([],l,function(v){v=[v[0],null].concat(v.slice(1));v=Vc(n,v,null,f,g);void 0===x[b].za?(v.Oa=c-1,x[b]=v):x[b].za[c-1]=v;return[]});return[]})},W:function(a,b,c,d,e,f){0>>l}}var q=b.includes("unsigned");T(a,{name:b,fromWireType:f,toWireType:function(m,n){if("number"!==typeof n&& +"boolean"!==typeof n)throw new TypeError('Cannot convert "'+Dc(n)+'" to '+this.name);if(ne)throw new TypeError('Passing a number "'+Dc(n)+'" from JS side to C/C++ side to an argument of type "'+b+'", which is outside the valid range ['+d+", "+e+"]!");return q?n>>>0:n|0},argPackAdvance:8,readValueFromPointer:ad(b,g,0!==d),Ga:null})},e:function(a,b,c){function d(f){f>>=2;var g=F;return new e(Ha,g[f+1],g[f])}var e=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array, +Float64Array][b];c=Q(c);T(a,{name:c,fromWireType:d,argPackAdvance:8,readValueFromPointer:d},{zb:!0})},u:function(a,b){b=Q(b);var c="std::string"===b;T(a,{name:b,fromWireType:function(d){var e=F[d>>2];if(c)for(var f=d+4,g=0;g<=e;++g){var l=d+4+g;if(g==e||0==A[l]){f=z(f,l-f);if(void 0===q)var q=f;else q+=String.fromCharCode(0),q+=f;f=l+1}}else{q=Array(e);for(g=0;g>2]=g;if(c&&f)ua(e,A,l+4,g+1);else if(f)for(f=0;f>2],n=g(),x,v=q+4,h=0;h<=m;++h){var t=q+4+h*b;if(h==m||0==n[t>>l])v=d(v,t-v),void 0===x?x=v:(x+=String.fromCharCode(0),x+=v),v=t+b}W(q);return x},toWireType:function(q,m){"string"!==typeof m&&R("Cannot pass non-string to C++ string type "+c);var n=f(m),x=Ga(4+n+b);F[x>>2]= +n>>l;e(m,x+4,n+b);null!==q&&q.push(W,x);return x},argPackAdvance:8,readValueFromPointer:Hc,Ga:function(q){W(q)}})},T:function(a,b){b=Q(b);T(a,{Xb:!0,name:b,argPackAdvance:0,fromWireType:function(){},toWireType:function(){}})},X:Zc,v:function(a){4> +2]=28,-1;C[b>>2]=a/1E3|0;C[b+4>>2]=a%1E3*1E6|0;return 0},V:function(){r("To use dlopen, you need to use Emscripten's linking support, see https://github.com/emscripten-core/emscripten/wiki/Linking")},b:function(a,b,c){b=fd(b,c);b=ta(b,0);a&24&&(b=b.replace(/\s+$/,""),b+=(0>>=0;if(2147483648< +a)return!1;for(var c=1;4>=c;c*=2){var d=b*(1+.2/c);d=Math.min(d,a+100663296);d=Math.max(a,d);0>>16);Ka();var e=1;break a}catch(f){}e=void 0}if(e)return!0}return!1},m:function(a){eval(z(a))},O:function(a){return eval(z(a))|0},p:Y,E:function(a,b){try{var c=0;ld().forEach(function(d,e){var f=b+c;e=C[a+4*e>>2]=f;for(f=0;f>0]=d.charCodeAt(f);E[e>>0]=0;c+=d.length+1});return 0}catch(d){return"undefined"!== +typeof P&&d instanceof J||r(d),d.ya}},F:function(a,b){try{var c=ld();C[a>>2]=c.length;var d=0;c.forEach(function(e){d+=e.length+1});C[b>>2]=d;return 0}catch(e){return"undefined"!==typeof P&&e instanceof J||r(e),e.ya}},j:function(a){try{var b=cc(a);if(null===b.fd)throw new J(8);b.La&&(b.La=null);try{b.va.close&&b.va.close(b)}catch(c){throw c;}finally{yb[b.fd]=null}b.fd=null;return 0}catch(c){return"undefined"!==typeof P&&c instanceof J||r(c),c.ya}},L:function(a,b,c,d){try{a:{for(var e=cc(a),f=a=0;f< +c;f++){var g=C[b+(8*f+4)>>2],l=e,q=C[b+8*f>>2],m=g,n=void 0,x=E;if(0>m||0>n)throw new J(28);if(null===l.fd)throw new J(8);if(1===(l.flags&2097155))throw new J(8);if(L(l.node.mode))throw new J(31);if(!l.va.read)throw new J(28);var v="undefined"!==typeof n;if(!v)n=l.position;else if(!l.seekable)throw new J(70);var h=l.va.read(l,x,q,m,n);v||(l.position+=h);var t=h;if(0>t){var w=-1;break a}a+=t;if(t>2]=w;return 0}catch(B){return"undefined"!==typeof P&&B instanceof J||r(B),B.ya}},y:function(a, +b,c,d,e){try{var f=cc(a);a=4294967296*c+(b>>>0);if(-9007199254740992>=a||9007199254740992<=a)return-61;Vb(f,a,d);I=[f.position>>>0,(H=f.position,1<=+Math.abs(H)?0>>0:~~+Math.ceil((H-+(~~H>>>0))/4294967296)>>>0:0)];C[e>>2]=I[0];C[e+4>>2]=I[1];f.La&&0===a&&0===d&&(f.La=null);return 0}catch(g){return"undefined"!==typeof P&&g instanceof J||r(g),g.ya}},K:function(a,b,c,d){try{a:{for(var e=cc(a),f=a=0;f>2],q=C[b+(8*f+4)>>2], +m=void 0,n=E;if(0>q||0>m)throw new J(28);if(null===g.fd)throw new J(8);if(0===(g.flags&2097155))throw new J(8);if(L(g.node.mode))throw new J(31);if(!g.va.write)throw new J(28);g.seekable&&g.flags&1024&&Vb(g,0,2);var x="undefined"!==typeof m;if(!x)m=g.position;else if(!g.seekable)throw new J(70);var v=g.va.write(g,n,l,q,m,void 0);x||(g.position+=v);try{if(g.path&&M.onWriteToFile)M.onWriteToFile(g.path)}catch(w){y("FS.trackingDelegate['onWriteToFile']('"+g.path+"') threw an exception: "+w.message)}var h= +v;if(0>h){var t=-1;break a}a+=h}t=a}C[d>>2]=t;return 0}catch(w){return"undefined"!==typeof P&&w instanceof J||r(w),w.ya}},k:function(a){ab();var b=new Date(C[a+20>>2]+1900,C[a+16>>2],C[a+12>>2],C[a+8>>2],C[a+4>>2],C[a>>2],0),c=C[a+32>>2],d=b.getTimezoneOffset(),e=new Date(b.getFullYear(),0,1),f=(new Date(b.getFullYear(),6,1)).getTimezoneOffset(),g=e.getTimezoneOffset(),l=Math.min(g,f);0>c?C[a+32>>2]=Number(f!=g&&l==d):0> +2]=b.getDay();C[a+28>>2]=(b.getTime()-e.getTime())/864E5|0;C[a>>2]=b.getSeconds();C[a+4>>2]=b.getMinutes();C[a+8>>2]=b.getHours();C[a+12>>2]=b.getDate();C[a+16>>2]=b.getMonth();return b.getTime()/1E3|0},A:function(){},U:sd,D:function(a,b,c,d){return sd(a,b,c,d)},h:function(a){var b=Date.now()/1E3|0;a&&(C[a>>2]=b);return b}}; +(function(){function a(e){k.asm=e.exports;qa=k.asm.Y;Ka();La=k.asm.ha;Na.unshift(k.asm.Z);Qa--;k.monitorRunDependencies&&k.monitorRunDependencies(Qa);0==Qa&&(null!==Ra&&(clearInterval(Ra),Ra=null),Sa&&(e=Sa,Sa=null,e()))}function b(e){a(e.instance)}function c(e){return Wa().then(function(f){return WebAssembly.instantiate(f,d)}).then(e,function(f){y("failed to asynchronously prepare wasm: "+f);r(f)})}var d={a:wd};Qa++;k.monitorRunDependencies&&k.monitorRunDependencies(Qa);if(k.instantiateWasm)try{return k.instantiateWasm(d, +a)}catch(e){return y("Module.instantiateWasm callback failed with error: "+e),!1}(function(){return pa||"function"!==typeof WebAssembly.instantiateStreaming||Ta()||G.startsWith("file://")||"function"!==typeof fetch?c(b):fetch(G,{credentials:"same-origin"}).then(function(e){return WebAssembly.instantiateStreaming(e,d).then(b,function(f){y("wasm streaming compile failed: "+f);y("falling back to ArrayBuffer instantiation");return c(b)})})})();return{}})(); +k.___wasm_call_ctors=function(){return(k.___wasm_call_ctors=k.asm.Z).apply(null,arguments)};var gd=k._strlen=function(){return(gd=k._strlen=k.asm._).apply(null,arguments)},Ga=k._malloc=function(){return(Ga=k._malloc=k.asm.$).apply(null,arguments)},vd=k.___errno_location=function(){return(vd=k.___errno_location=k.asm.aa).apply(null,arguments)},W=k._free=function(){return(W=k._free=k.asm.ba).apply(null,arguments)},Rc=k.___getTypeName=function(){return(Rc=k.___getTypeName=k.asm.ca).apply(null,arguments)}; +k.___embind_register_native_and_builtin_types=function(){return(k.___embind_register_native_and_builtin_types=k.asm.da).apply(null,arguments)};var eb=k.__get_tzname=function(){return(eb=k.__get_tzname=k.asm.ea).apply(null,arguments)},db=k.__get_daylight=function(){return(db=k.__get_daylight=k.asm.fa).apply(null,arguments)},cb=k.__get_timezone=function(){return(cb=k.__get_timezone=k.asm.ga).apply(null,arguments)};k.dynCall_jiji=function(){return(k.dynCall_jiji=k.asm.ia).apply(null,arguments)}; +k.dynCall_viiiiiiji=function(){return(k.dynCall_viiiiiiji=k.asm.ja).apply(null,arguments)};k.dynCall_viiijj=function(){return(k.dynCall_viiijj=k.asm.ka).apply(null,arguments)};k.dynCall_viiiiiijjii=function(){return(k.dynCall_viiiiiijjii=k.asm.la).apply(null,arguments)};k.dynCall_iiiiij=function(){return(k.dynCall_iiiiij=k.asm.ma).apply(null,arguments)};k.dynCall_iiiiijj=function(){return(k.dynCall_iiiiijj=k.asm.na).apply(null,arguments)}; +k.dynCall_iiiiiijj=function(){return(k.dynCall_iiiiiijj=k.asm.oa).apply(null,arguments)};k.dynCall_viijii=function(){return(k.dynCall_viijii=k.asm.pa).apply(null,arguments)};var xd;Sa=function yd(){xd||zd();xd||(Sa=yd)}; +function zd(){function a(){if(!xd&&(xd=!0,k.calledRun=!0,!ra)){k.noFSInit||Xb||(Xb=!0,Wb(),k.stdin=k.stdin,k.stdout=k.stdout,k.stderr=k.stderr,k.stdin?Zb("stdin",k.stdin):Sb("/dev/tty","/dev/stdin"),k.stdout?Zb("stdout",null,k.stdout):Sb("/dev/tty","/dev/stdout"),k.stderr?Zb("stderr",null,k.stderr):Sb("/dev/tty1","/dev/stderr"),Tb("/dev/stdin",0),Tb("/dev/stdout",1),Tb("/dev/stderr",1));Bb=!1;Xa(Na);if(k.onRuntimeInitialized)k.onRuntimeInitialized();if(k.postRun)for("function"==typeof k.postRun&& +(k.postRun=[k.postRun]);k.postRun.length;){var b=k.postRun.shift();Oa.unshift(b)}Xa(Oa)}}if(!(0=d);)++c;if(16e?d+=String.fromCharCode(e):(e-=65536,d+=String.fromCharCode(55296|e>>10,56320|e&1023))}}else d+=String.fromCharCode(e)}return d}function z(a,b){return a?ya(A,a,b):""} +function za(a,b,c,d){if(!(0=g){var l=a.charCodeAt(++f);g=65536+((g&1023)<<10)|l&1023}if(127>=g){if(c>=d)break;b[c++]=g}else{if(2047>=g){if(c+1>=d)break;b[c++]=192|g>>6}else{if(65535>=g){if(c+2>=d)break;b[c++]=224|g>>12}else{if(c+3>=d)break;b[c++]=240|g>>18;b[c++]=128|g>>12&63}b[c++]=128|g>>6&63}b[c++]=128|g&63}}b[c]=0;return c-e} +function Aa(a){for(var b=0,c=0;c=d&&(d=65536+((d&1023)<<10)|a.charCodeAt(++c)&1023);127>=d?++b:b=2047>=d?b+2:65535>=d?b+3:b+4}return b}var Ba="undefined"!==typeof TextDecoder?new TextDecoder("utf-16le"):void 0;function Ca(a,b){var c=a>>1;for(var d=c+b/2;!(c>=d)&&Da[c];)++c;c<<=1;if(32=b/2);++d){var e=Ea[a+2*d>>1];if(0==e)break;c+=String.fromCharCode(e)}return c} +function Fa(a,b,c){void 0===c&&(c=2147483647);if(2>c)return 0;c-=2;var d=b;c=c<2*a.length?c/2:a.length;for(var e=0;e>1]=a.charCodeAt(e),b+=2;Ea[b>>1]=0;return b-d}function Ga(a){return 2*a.length}function Ha(a,b){for(var c=0,d="";!(c>=b/4);){var e=C[a+4*c>>2];if(0==e)break;++c;65536<=e?(e-=65536,d+=String.fromCharCode(55296|e>>10,56320|e&1023)):d+=String.fromCharCode(e)}return d} +function Ia(a,b,c){void 0===c&&(c=2147483647);if(4>c)return 0;var d=b;c=d+c-4;for(var e=0;e=f){var g=a.charCodeAt(++e);f=65536+((f&1023)<<10)|g&1023}C[b>>2]=f;b+=4;if(b+4>c)break}C[b>>2]=0;return b-d}function Ja(a){for(var b=0,c=0;c=d&&++c;b+=4}return b}function Ka(a){var b=Aa(a)+1,c=La(b);c&&za(a,E,c,b);return c}var Ma,E,A,Ea,Da,C,F,Na,Oa; +function Pa(){var a=va.buffer;Ma=a;h.HEAP8=E=new Int8Array(a);h.HEAP16=Ea=new Int16Array(a);h.HEAP32=C=new Int32Array(a);h.HEAPU8=A=new Uint8Array(a);h.HEAPU16=Da=new Uint16Array(a);h.HEAPU32=F=new Uint32Array(a);h.HEAPF32=Na=new Float32Array(a);h.HEAPF64=Oa=new Float64Array(a)}var G,Qa=[],Ra=[],Sa=[],pa=0;function Ta(){var a=h.preRun.shift();Qa.unshift(a)}var Ua=0,Va=null,Wa=null;h.preloadedImages={};h.preloadedAudios={}; +function r(a){if(h.onAbort)h.onAbort(a);y(a);wa=!0;throw new WebAssembly.RuntimeError("abort("+a+"). Build with -s ASSERTIONS=1 for more info.");}function Xa(){return H.startsWith("data:application/octet-stream;base64,")}var H;H="dbr-8.6.0.node.wasm";if(!Xa()){var Ya=H;H=h.locateFile?h.locateFile(Ya,q):q+Ya}function Za(){var a=H;try{if(a==H&&ua)return new Uint8Array(ua);if(la)return la(a);throw"both async and sync fetching of the wasm failed";}catch(b){r(b)}} +function $a(){if(!ua&&(fa||ha)){if("function"===typeof fetch&&!H.startsWith("file://"))return fetch(H,{credentials:"same-origin"}).then(function(a){if(!a.ok)throw"failed to load wasm binary file at '"+H+"'";return a.arrayBuffer()}).catch(function(){return Za()});if(ka)return new Promise(function(a,b){ka(H,function(c){a(new Uint8Array(c))},b)})}return Promise.resolve().then(function(){return Za()})}var I,J; +function ab(a){for(;0>2]=b};this.ec=function(b){C[this.Oa+8>>2]=b};this.fc=function(){C[this.Oa>>2]=0};this.dc=function(){E[this.Oa+12>>0]=0};this.hc=function(){E[this.Oa+13>>0]=0};this.Vb=function(b,c){this.ic(b);this.ec(c);this.fc();this.dc();this.hc()}}var cb=0,db; +function eb(){function a(g){return(g=g.toTimeString().match(/\(([A-Za-z ]+)\)$/))?g[1]:"GMT"}if(!fb){fb=!0;var b=(new Date).getFullYear(),c=new Date(b,0,1),d=new Date(b,6,1);b=c.getTimezoneOffset();var e=d.getTimezoneOffset(),f=Math.max(b,e);C[gb()>>2]=60*f;C[hb()>>2]=Number(b!=e);c=a(c);d=a(d);c=Ka(c);d=Ka(d);e>2]=c,C[ib()+4>>2]=d):(C[ib()>>2]=d,C[ib()+4>>2]=c)}}var fb; +function jb(a,b){for(var c=0,d=a.length-1;0<=d;d--){var e=a[d];"."===e?a.splice(d,1):".."===e?(a.splice(d,1),c++):c&&(a.splice(d,1),c--)}if(b)for(;c;c--)a.unshift("..");return a}function kb(a){var b="/"===a.charAt(0),c="/"===a.substr(-1);(a=jb(a.split("/").filter(function(d){return!!d}),!b).join("/"))||b||(a=".");a&&c&&(a+="/");return(b?"/":"")+a} +function lb(a){var b=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(a).slice(1);a=b[0];b=b[1];if(!a&&!b)return".";b&&(b=b.substr(0,b.length-1));return a+b}function mb(a){if("/"===a)return"/";a=kb(a);a=a.replace(/\/$/,"");var b=a.lastIndexOf("/");return-1===b?a:a.substr(b+1)} +function nb(){if("object"===typeof crypto&&"function"===typeof crypto.getRandomValues){var a=new Uint8Array(1);return function(){crypto.getRandomValues(a);return a[0]}}if(ia)try{var b=require("crypto");return function(){return b.randomBytes(1)[0]}}catch(c){}return function(){r("randomDevice")}} +function ob(){for(var a="",b=!1,c=arguments.length-1;-1<=c&&!b;c--){b=0<=c?arguments[c]:"/";if("string"!==typeof b)throw new TypeError("Arguments to path.resolve must be strings");if(!b)return"";a=b+"/"+a;b="/"===b.charAt(0)}a=jb(a.split("/").filter(function(d){return!!d}),!b).join("/");return(b?"/":"")+a||"."}var pb=[];function qb(a,b){pb[a]={input:[],output:[],nb:b};rb(a,sb)} +var sb={open:function(a){var b=pb[a.node.rdev];if(!b)throw new K(43);a.tty=b;a.seekable=!1},close:function(a){a.tty.nb.flush(a.tty)},flush:function(a){a.tty.nb.flush(a.tty)},read:function(a,b,c,d){if(!a.tty||!a.tty.nb.Jb)throw new K(60);for(var e=0,f=0;f=b||(b=Math.max(b,c*(1048576>c?2:1.125)>>>0),0!=c&&(b=Math.max(b,256)),c=a.Na,a.Na=new Uint8Array(b),0=a.node.Sa)return 0;a=Math.min(a.node.Sa-e,d);if(8b)throw new K(28);return b},Eb:function(a,b,c){L.Hb(a.node,b+c);a.node.Sa=Math.max(a.node.Sa,b+c)},Kb:function(a,b,c,d,e,f){if(0!==b)throw new K(28);if(32768!==(a.node.mode&61440))throw new K(43);a=a.node.Na;if(f&2||a.buffer!==Ma){if(0>>0)%Eb.length}function Jb(a){var b=Ib(a.parent.id,a.name);if(Eb[b]===a)Eb[b]=a.mb;else for(b=Eb[b];b;){if(b.mb===a){b.mb=a.mb;break}b=b.mb}} +function zb(a,b){var c;if(c=(c=Kb(a,"x"))?c:a.Ma.lookup?0:2)throw new K(c,a);for(c=Eb[Ib(a.id,b)];c;c=c.mb){var d=c.name;if(c.parent.id===a.id&&d===b)return c}return a.Ma.lookup(a,b)}function xb(a,b,c,d){a=new Lb(a,b,c,d);b=Ib(a.parent.id,a.name);a.mb=Eb[b];return Eb[b]=a}function M(a){return 16384===(a&61440)}var Mb={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090};function Nb(a){var b=["r","w","rw"][a&3];a&512&&(b+="w");return b} +function Kb(a,b){if(Fb)return 0;if(!b.includes("r")||a.mode&292){if(b.includes("w")&&!(a.mode&146)||b.includes("x")&&!(a.mode&73))return 2}else return 2;return 0}function Ob(a,b){try{return zb(a,b),20}catch(c){}return Kb(a,"wx")}function Pb(a,b,c){try{var d=zb(a,b)}catch(e){return e.Ta}if(a=Kb(a,"wx"))return a;if(c){if(!M(d.mode))return 54;if(d===d.parent||"/"===Hb(d))return 10}else if(M(d.mode))return 31;return 0}function Qb(a){var b=4096;for(a=a||0;a<=b;a++)if(!Cb[a])return a;throw new K(33);} +function Rb(a,b){Sb||(Sb=function(){},Sb.prototype={});var c=new Sb,d;for(d in a)c[d]=a[d];a=c;b=Qb(b);a.fd=b;return Cb[b]=a}var wb={open:function(a){a.Qa=Bb[a.node.rdev].Qa;a.Qa.open&&a.Qa.open(a)},hb:function(){throw new K(70);}};function rb(a,b){Bb[a]={Qa:b}} +function Tb(a,b){var c="/"===b,d=!b;if(c&&Ab)throw new K(10);if(!c&&!d){var e=O(b,{Ib:!1});b=e.path;e=e.node;if(e.lb)throw new K(10);if(!M(e.mode))throw new K(54);}b={type:a,tc:{},Lb:b,Xb:[]};a=a.bb(b);a.bb=b;b.root=a;c?Ab=a:e&&(e.lb=b,e.bb&&e.bb.Xb.push(b))}function Ub(a,b,c){var d=O(a,{parent:!0}).node;a=mb(a);if(!a||"."===a||".."===a)throw new K(28);var e=Ob(d,a);if(e)throw new K(e);if(!d.Ma.ub)throw new K(63);return d.Ma.ub(d,a,b,c)} +function P(a,b){return Ub(a,(void 0!==b?b:511)&1023|16384,0)}function Vb(a,b,c){"undefined"===typeof c&&(c=b,b=438);Ub(a,b|8192,c)}function Wb(a,b){if(!ob(a))throw new K(44);var c=O(b,{parent:!0}).node;if(!c)throw new K(44);b=mb(b);var d=Ob(c,b);if(d)throw new K(d);if(!c.Ma.symlink)throw new K(63);c.Ma.symlink(c,b,a)}function Gb(a){a=O(a).node;if(!a)throw new K(44);if(!a.Ma.readlink)throw new K(28);return ob(Hb(a.parent),a.Ma.readlink(a))} +function Xb(a,b,c,d){if(""===a)throw new K(44);if("string"===typeof b){var e=Mb[b];if("undefined"===typeof e)throw Error("Unknown file open mode: "+b);b=e}c=b&64?("undefined"===typeof c?438:c)&4095|32768:0;if("object"===typeof a)var f=a;else{a=kb(a);try{f=O(a,{zb:!(b&131072)}).node}catch(g){}}e=!1;if(b&64)if(f){if(b&128)throw new K(20);}else f=Ub(a,c,0),e=!0;if(!f)throw new K(44);8192===(f.mode&61440)&&(b&=-513);if(b&65536&&!M(f.mode))throw new K(54);if(!e&&(c=f?40960===(f.mode&61440)?32:M(f.mode)&& +("r"!==Nb(b)||b&512)?31:Kb(f,Nb(b)):44))throw new K(c);if(b&512){c=f;c="string"===typeof c?O(c,{zb:!0}).node:c;if(!c.Ma.$a)throw new K(63);if(M(c.mode))throw new K(31);if(32768!==(c.mode&61440))throw new K(28);if(e=Kb(c,"w"))throw new K(e);c.Ma.$a(c,{size:0,timestamp:Date.now()})}b&=-131713;d=Rb({node:f,path:Hb(f),flags:b,seekable:!0,position:0,Qa:f.Qa,oc:[],error:!1},d);d.Qa.open&&d.Qa.open(d);!h.logReadFiles||b&1||(Yb||(Yb={}),a in Yb||(Yb[a]=1,y("FS.trackingDelegate error on read file: "+a))); +try{N.onOpenFile&&(f=0,1!==(b&2097155)&&(f|=1),0!==(b&2097155)&&(f|=2),N.onOpenFile(a,f))}catch(g){y("FS.trackingDelegate['onOpenFile']('"+a+"', flags) threw an exception: "+g.message)}return d}function Zb(a,b,c){if(null===a.fd)throw new K(8);if(!a.seekable||!a.Qa.hb)throw new K(70);if(0!=c&&1!=c&&2!=c)throw new K(28);a.position=a.Qa.hb(a,b,c);a.oc=[];return a.position} +function $b(){K||(K=function(a,b){this.node=b;this.cc=function(c){this.Ta=c};this.cc(a);this.message="FS error"},K.prototype=Error(),K.prototype.constructor=K,[44].forEach(function(a){yb[a]=new K(a);yb[a].stack=""}))}var ac;function bc(a,b){var c=0;a&&(c|=365);b&&(c|=146);return c} +function cc(a,b,c){a=kb("/dev/"+a);var d=bc(!!b,!!c);dc||(dc=64);var e=dc++<<8|0;rb(e,{open:function(f){f.seekable=!1},close:function(){c&&c.buffer&&c.buffer.length&&c(10)},read:function(f,g,l,p){for(var m=0,n=0;n>2]}function gc(a){a=Cb[a];if(!a)throw new K(8);return a}function hc(a){switch(a){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+a);}}var ic=void 0;function R(a){for(var b="";A[a];)b+=ic[A[a++]];return b}var jc={},kc={},lc={};function mc(a){if(void 0===a)return"_unknown";a=a.replace(/[^a-zA-Z0-9_]/g,"$");var b=a.charCodeAt(0);return 48<=b&&57>=b?"_"+a:a} +function nc(a,b){a=mc(a);return(new Function("body","return function "+a+'() {\n "use strict"; return body.apply(this, arguments);\n};\n'))(b)}function oc(a){var b=Error,c=nc(a,function(d){this.name=a;this.message=d;d=Error(d).stack;void 0!==d&&(this.stack=this.toString()+"\n"+d.replace(/^Error(:[^\n]*)?\n/,""))});c.prototype=Object.create(b.prototype);c.prototype.constructor=c;c.prototype.toString=function(){return void 0===this.message?this.name:this.name+": "+this.message};return c} +var pc=void 0;function S(a){throw new pc(a);}var qc=void 0;function rc(a){throw new qc(a);}function T(a,b,c){function d(l){l=c(l);l.length!==a.length&&rc("Mismatched type converter count");for(var p=0;p>2])}function Nc(a,b,c){if(b===c)return a;if(void 0===c.Ya)return null;a=Nc(a,b,c.Ya);return null===a?null:c.Rb(a)} +var Oc={};function Pc(a,b){for(void 0===b&&S("ptr should not be undefined");a.Ya;)b=a.rb(b),a=a.Ya;return Oc[b]}function Qc(a,b){b.Ra&&b.Oa||rc("makeClassHandle requires ptr and ptrType");!!b.Xa!==!!b.Wa&&rc("Both smartPtrType and smartPtr must be specified");b.count={value:1};return xc(Object.create(a,{La:{value:b}}))} +function Rc(a,b,c,d){this.name=a;this.Pa=b;this.Ab=c;this.sb=d;this.tb=!1;this.ib=this.ac=this.$b=this.Nb=this.jc=this.Yb=void 0;void 0!==b.Ya?this.toWireType=Jc:(this.toWireType=d?Hc:Lc,this.ab=null)}function Sc(a,b){h.hasOwnProperty(a)||rc("Replacing nonexistant public symbol");h[a]=b;h[a].jb=void 0} +function Tc(a,b){var c=[];return function(){c.length=arguments.length;for(var d=0;df&&S("argTypes array size mismatch! Must at least get return value and 'this' types!");var g=null!==b[1]&&null!==c,l=!1;for(c=1;c>2)+d]);return c} +function dd(a,b,c){a instanceof Object||S(c+' with invalid "this": '+a);a instanceof b.Pa.constructor||S(c+' incompatible with "this" of type '+a.constructor.name);a.La.Oa||S("cannot call emscripten binding method "+c+" on deleted object");return Gc(a.La.Oa,a.La.Ra.Pa,b.Pa)}var ed=[],V=[{},{value:void 0},{value:null},{value:!0},{value:!1}];function fd(a){4>2])};case 3:return function(c){return this.fromWireType(Oa[c>>3])};default:throw new TypeError("Unknown float type: "+a);}} +function hd(a,b,c){switch(b){case 0:return c?function(d){return E[d]}:function(d){return A[d]};case 1:return c?function(d){return Ea[d>>1]}:function(d){return Da[d>>1]};case 2:return c?function(d){return C[d>>2]}:function(d){return F[d>>2]};default:throw new TypeError("Unknown integer type: "+a);}}function jd(){void 0===jd.start&&(jd.start=Date.now());return 1E3*(Date.now()-jd.start)|0}var kd;kd=ia?function(){var a=process.hrtime();return 1E3*a[0]+a[1]/1E6}:function(){return performance.now()}; +function ld(a,b){if(0>=a)return a;var c=32>=b?Math.abs(1<=c&&(32>=b||a>c)&&(a=-2*c+a);return a}function md(a,b){return 0<=a?a:32>=b?2*Math.abs(1<>3],d+=8):"i64"==D?(D=[C[d>>2],C[d+4>>2]],d+=8):(D=C[d>>2],d+=4);return D}for(var d=b,e=[],f,g;;){var l=a;f=E[a>>0];if(0===f)break;g=E[a+1>>0];if(37==f){var p=!1,m=b=!1,n=!1,v=!1;a:for(;;){switch(g){case 43:p=!0;break;case 45:b=!0;break;case 35:m=!0;break;case 48:if(n)break a;else{n=!0;break}case 32:v=!0;break;default:break a}a++;g=E[a+1>>0]}var w=0;if(42==g)w=c("i32"),a++,g=E[a+1>>0];else for(;48<= +g&&57>=g;)w=10*w+(g-48),a++,g=E[a+1>>0];var k=!1,t=-1;if(46==g){t=0;k=!0;a++;g=E[a+1>>0];if(42==g)t=c("i32"),a++;else for(;;){g=E[a+1>>0];if(48>g||57>0]}0>t&&(t=6,k=!1);switch(String.fromCharCode(g)){case "h":g=E[a+2>>0];if(104==g){a++;var x=1}else x=2;break;case "l":g=E[a+2>>0];108==g?(a++,x=8):x=4;break;case "L":case "q":case "j":x=8;break;case "z":case "t":case "I":x=4;break;default:x=null}x&&a++;g=E[a+1>>0];switch(String.fromCharCode(g)){case "d":case "i":case "u":case "o":case "x":case "X":case "p":l= +100==g||105==g;x=x||4;f=c("i"+8*x);8==x&&(f=117==g?(f[0]>>>0)+4294967296*(f[1]>>>0):(f[0]>>>0)+4294967296*f[1]);4>=x&&(f=(l?ld:md)(f&Math.pow(256,x)-1,8*x));var B=Math.abs(f);l="";if(100==g||105==g)var u=ld(f,8*x,1).toString(10);else if(117==g)u=md(f,8*x,1).toString(10),f=Math.abs(f);else if(111==g)u=(m?"0":"")+B.toString(8);else if(120==g||88==g){l=m&&0!=f?"0x":"";if(0>f){f=-f;u=(B-1).toString(16);B=[];for(m=0;mx&&-4<=x?(g=(103==g?"f":"F").charCodeAt(0),t-=x+1):(g=(103==g?"e":"E").charCodeAt(0),t--),x=Math.min(t,20);if(101==g||69==g)u=f.toExponential(x),/[eE][-+]\d$/.test(u)&&(u=u.slice(0,-1)+"0"+u.slice(-1));else if(102==g||70==g)u=f.toFixed(x),0===f&&(0>f||0===f&&-Infinity===1/f)&&(u="-"+u);l=u.split("e");if(k&&!m)for(;1x++;)l[0]+="0";u=l[0]+(1f?"-":"")+"inf",n=!1;for(;u.lengthg&&(u=u.toUpperCase());u.split("").forEach(function(D){e.push(D.charCodeAt(0))});break;case "s":n=(p=c("i8*"))?od(p):6;k&&(n=Math.min(n,t));if(!b)for(;n>0]);else e=e.concat(tb("(null)".substr(0,n), +!0));if(b)for(;n>2]=e.length;break;case "%":e.push(f);break;default:for(m=l;m>0])}a+=2}else e.push(f),a+=1}return e} +function pd(a){if(!a||!a.callee||!a.callee.name)return[null,"",""];var b=a.callee.name,c="(",d=!0,e;for(e in a){var f=a[e];d||(c+=", ");d=!1;c="number"===typeof f||"string"===typeof f?c+f:c+("("+typeof f+")")}c+=")";a=(a=a.callee.caller)?a.arguments:[];d&&(c="");return[a,b,c]} +function qd(a){a:{var b=Error();if(!b.stack){try{throw Error();}catch(t){b=t}if(!b.stack){b="(no stack trace available)";break a}}b=b.stack.toString()}b=b.slice(b.indexOf("\n",Math.max(b.lastIndexOf("_emscripten_log"),b.lastIndexOf("_emscripten_get_callstack")))+1);a&32&&ra("EM_LOG_DEMANGLE is deprecated; ignoring");a&8&&"undefined"===typeof emscripten_source_map&&(ra('Source map information is not available, emscripten_log with EM_LOG_C_STACK will be ignored. Build with "--pre-js $EMSCRIPTEN/src/emscripten-source-map.min.js" linker flag to add source map loading to code.'), +a=a^8|16);var c=null;if(a&128)for(c=pd(arguments);c[1].includes("_emscripten_");)c=pd(c[0]);var d=b.split("\n");b="";var e=/\s*(.*?)@(.*?):([0-9]+):([0-9]+)/,f=/\s*(.*?)@(.*):(.*)(:(.*))?/,g=/\s*at (.*?) \((.*):(.*):(.*)\)/,l;for(l in d){var p=d[l],m;if((m=g.exec(p))&&5==m.length){p=m[1];var n=m[2];var v=m[3];m=m[4]}else if((m=e.exec(p))||(m=f.exec(p)),m&&4<=m.length)p=m[1],n=m[2],v=m[3],m=m[4]|0;else{b+=p+"\n";continue}var w=!1;if(a&8){var k=emscripten_source_map.uc({line:v,Pb:m});if(w=k&&k.source)a& +64&&(k.source=k.source.substring(k.source.replace(/\\/g,"/").lastIndexOf("/")+1)),b+=" at "+p+" ("+k.source+":"+k.line+":"+k.Pb+")\n"}if(a&16||!w)a&64&&(n=n.substring(n.replace(/\\/g,"/").lastIndexOf("/")+1)),b+=(w?" = "+p:" at "+p)+" ("+n+":"+v+":"+m+")\n";a&128&&c[0]&&(c[1]==p&&0u?-1:0=g(x,k)?0>=g(t,k)?k.getFullYear()+1:k.getFullYear():k.getFullYear()-1}var m=C[d+40>>2];d={mc:C[d>>2],lc:C[d+4>>2],vb:C[d+8>>2],qb:C[d+12>>2],ob:C[d+16>>2],Va:C[d+20>>2],wb:C[d+24>>2],xb:C[d+28>>2],vc:C[d+32>>2],kc:C[d+ +36>>2],nc:m?z(m):""};c=z(c);m={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var n in m)c=c.replace(new RegExp(n,"g"),m[n]);var v="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "), +w="January February March April May June July August September October November December".split(" ");m={"%a":function(k){return v[k.wb].substring(0,3)},"%A":function(k){return v[k.wb]},"%b":function(k){return w[k.ob].substring(0,3)},"%B":function(k){return w[k.ob]},"%C":function(k){return f((k.Va+1900)/100|0,2)},"%d":function(k){return f(k.qb,2)},"%e":function(k){return e(k.qb,2," ")},"%g":function(k){return p(k).toString().substring(2)},"%G":function(k){return p(k)},"%H":function(k){return f(k.vb, +2)},"%I":function(k){k=k.vb;0==k?k=12:12k.vb?"AM":"PM"},"%S":function(k){return f(k.mc,2)},"%t":function(){return"\t"},"%u":function(k){return k.wb||7},"%U":function(k){var t=new Date(k.Va+1900,0,1),x=0===t.getDay()?t:yd(t,7-t.getDay());k=new Date(k.Va+1900,k.ob,k.qb);return 0> +g(x,k)?f(Math.ceil((31-x.getDate()+(vd(ud(k.getFullYear())?wd:xd,k.getMonth()-1)-31)+k.getDate())/7),2):0===g(x,t)?"01":"00"},"%V":function(k){var t=new Date(k.Va+1901,0,4),x=l(new Date(k.Va+1900,0,4));t=l(t);var B=yd(new Date(k.Va+1900,0,1),k.xb);return 0>g(B,x)?"53":0>=g(t,B)?"01":f(Math.ceil((x.getFullYear()g(x,k)?f(Math.ceil((31-x.getDate()+(vd(ud(k.getFullYear())?wd:xd,k.getMonth()-1)-31)+k.getDate())/7),2):0===g(x,t)?"01":"00"},"%y":function(k){return(k.Va+1900).toString().substring(2)},"%Y":function(k){return k.Va+1900},"%z":function(k){k=k.kc;var t=0<=k;k=Math.abs(k)/60;return(t?"+":"-")+String("0000"+(k/60*100+k%60)).slice(-4)},"%Z":function(k){return k.nc},"%%":function(){return"%"}};for(n in m)c.includes(n)&&(c=c.replace(new RegExp(n,"g"),m[n](d)));n=tb(c, +!1);if(n.length>b)return 0;E.set(n,a);return n.length-1}function Lb(a,b,c,d){a||(a=this);this.parent=a;this.bb=a.bb;this.lb=null;this.id=Db++;this.name=b;this.mode=c;this.Ma={};this.Qa={};this.rdev=d}Object.defineProperties(Lb.prototype,{read:{get:function(){return 365===(this.mode&365)},set:function(a){a?this.mode|=365:this.mode&=-366}},write:{get:function(){return 146===(this.mode&146)},set:function(a){a?this.mode|=146:this.mode&=-147}}});$b();Eb=Array(4096);Tb(L,"/");P("/tmp");P("/home");P("/home/web_user"); +(function(){P("/dev");rb(259,{read:function(){return 0},write:function(b,c,d,e){return e}});Vb("/dev/null",259);qb(1280,ub);qb(1536,vb);Vb("/dev/tty",1280);Vb("/dev/tty1",1536);var a=nb();cc("random",a);cc("urandom",a);P("/dev/shm");P("/dev/shm/tmp")})(); +(function(){P("/proc");var a=P("/proc/self");P("/proc/self/fd");Tb({bb:function(){var b=xb(a,"fd",16895,73);b.Ma={lookup:function(c,d){var e=Cb[+d];if(!e)throw new K(8);c={parent:null,bb:{Lb:"fake"},Ma:{readlink:function(){return e.path}}};return c.parent=c}};return b}},"/proc/self/fd")})();for(var Ad=Array(256),Bd=0;256>Bd;++Bd)Ad[Bd]=String.fromCharCode(Bd);ic=Ad;pc=h.BindingError=oc("BindingError");qc=h.InternalError=oc("InternalError"); +Bc.prototype.isAliasOf=function(a){if(!(this instanceof Bc&&a instanceof Bc))return!1;var b=this.La.Ra.Pa,c=this.La.Oa,d=a.La.Ra.Pa;for(a=a.La.Oa;b.Ya;)c=b.rb(c),b=b.Ya;for(;d.Ya;)a=d.rb(a),d=d.Ya;return b===d&&c===a}; +Bc.prototype.clone=function(){this.La.Oa||tc(this);if(this.La.pb)return this.La.count.value+=1,this;var a=xc,b=Object,c=b.create,d=Object.getPrototypeOf(this),e=this.La;a=a(c.call(b,d,{La:{value:{count:e.count,kb:e.kb,pb:e.pb,Oa:e.Oa,Ra:e.Ra,Wa:e.Wa,Xa:e.Xa}}}));a.La.count.value+=1;a.La.kb=!1;return a};Bc.prototype["delete"]=function(){this.La.Oa||tc(this);this.La.kb&&!this.La.pb&&S("Object already scheduled for deletion");vc(this);wc(this.La);this.La.pb||(this.La.Wa=void 0,this.La.Oa=void 0)}; +Bc.prototype.isDeleted=function(){return!this.La.Oa};Bc.prototype.deleteLater=function(){this.La.Oa||tc(this);this.La.kb&&!this.La.pb&&S("Object already scheduled for deletion");zc.push(this);1===zc.length&&yc&&yc(Ac);this.La.kb=!0;return this};Rc.prototype.Tb=function(a){this.Nb&&(a=this.Nb(a));return a};Rc.prototype.Gb=function(a){this.ib&&this.ib(a)};Rc.prototype.argPackAdvance=8;Rc.prototype.readValueFromPointer=Mc;Rc.prototype.deleteObject=function(a){if(null!==a)a["delete"]()}; +Rc.prototype.fromWireType=function(a){function b(){return this.tb?Qc(this.Pa.eb,{Ra:this.Yb,Oa:c,Xa:this,Wa:a}):Qc(this.Pa.eb,{Ra:this,Oa:a})}var c=this.Tb(a);if(!c)return this.Gb(a),null;var d=Pc(this.Pa,c);if(void 0!==d){if(0===d.La.count.value)return d.La.Oa=c,d.La.Wa=a,d.clone();d=d.clone();this.Gb(a);return d}d=this.Pa.Sb(c);d=Cc[d];if(!d)return b.call(this);d=this.sb?d.Qb:d.pointerType;var e=Nc(c,this.Pa,d.Pa);return null===e?b.call(this):this.tb?Qc(d.Pa.eb,{Ra:d,Oa:e,Xa:this,Wa:a}):Qc(d.Pa.eb, +{Ra:d,Oa:e})};h.getInheritedInstanceCount=function(){return Object.keys(Oc).length};h.getLiveInheritedInstances=function(){var a=[],b;for(b in Oc)Oc.hasOwnProperty(b)&&a.push(Oc[b]);return a};h.flushPendingDeletes=Ac;h.setDelayFunction=function(a){yc=a;zc.length&&yc&&yc(Ac)};Vc=h.UnboundTypeError=oc("UnboundTypeError");h.count_emval_handles=function(){for(var a=0,b=5;b>2]);C[b>>2]=a.getUTCSeconds();C[b+4>>2]=a.getUTCMinutes();C[b+8>>2]=a.getUTCHours();C[b+12>>2]=a.getUTCDate();C[b+16>>2]=a.getUTCMonth();C[b+20>>2]=a.getUTCFullYear()-1900;C[b+24>>2]=a.getUTCDay();C[b+36>>2]=0;C[b+32>>2]=0;C[b+28>>2]=(a.getTime()-Date.UTC(a.getUTCFullYear(),0,1,0,0,0,0))/864E5|0;db||(db=Ka("GMT"));C[b+40>>2]=db;return b},V:function(a,b){eb();a=new Date(1E3* +C[a>>2]);C[b>>2]=a.getSeconds();C[b+4>>2]=a.getMinutes();C[b+8>>2]=a.getHours();C[b+12>>2]=a.getDate();C[b+16>>2]=a.getMonth();C[b+20>>2]=a.getFullYear()-1900;C[b+24>>2]=a.getDay();var c=new Date(a.getFullYear(),0,1);C[b+28>>2]=(a.getTime()-c.getTime())/864E5|0;C[b+36>>2]=-(60*a.getTimezoneOffset());var d=(new Date(a.getFullYear(),6,1)).getTimezoneOffset();c=c.getTimezoneOffset();a=(d!=c&&a.getTimezoneOffset()==Math.min(c,d))|0;C[b+32>>2]=a;a=C[ib()+(a?4:0)>>2];C[b+40>>2]=a;return b},E:function(a, +b,c){ec=c;try{var d=gc(a);switch(b){case 0:var e=fc();return 0>e?-28:Xb(d.path,d.flags,0,e).fd;case 1:case 2:return 0;case 3:return d.flags;case 4:return e=fc(),d.flags|=e,0;case 12:return e=fc(),Ea[e+0>>1]=2,0;case 13:case 14:return 0;case 16:case 8:return-28;case 9:return C[Cd()>>2]=28,-1;default:return-28}}catch(f){return"undefined"!==typeof Q&&f instanceof K||r(f),-f.Ta}},ca:function(a,b,c){try{var d=gc(a);if(!d.gb){var e=O(d.path,{zb:!0}).node;if(!e.Ma.readdir)throw new K(54);var f=e.Ma.readdir(e); +d.gb=f}a=0;for(var g=Zb(d,0,1),l=Math.floor(g/280);l>>0,(I=m,1<=+Math.abs(I)?0>>0:~~+Math.ceil((I-+(~~I>>>0))/4294967296)>>>0:0)];C[b+a>>2]=J[0];C[b+a+4>>2]=J[1];J=[280*(l+1)>>>0,(I=280*(l+1),1<=+Math.abs(I)?0>>0:~~+Math.ceil((I- ++(~~I>>>0))/4294967296)>>>0:0)];C[b+a+8>>2]=J[0];C[b+a+12>>2]=J[1];Ea[b+a+16>>1]=280;E[b+a+18>>0]=n;za(p,A,b+a+19,256);a+=280;l+=1}Zb(d,280*l,0);return a}catch(w){return"undefined"!==typeof Q&&w instanceof K||r(w),-w.Ta}},_:function(a,b,c){ec=c;try{var d=gc(a);switch(b){case 21509:case 21505:return d.tty?0:-59;case 21510:case 21511:case 21512:case 21506:case 21507:case 21508:return d.tty?0:-59;case 21519:if(!d.tty)return-59;var e=fc();return C[e>>2]=0;case 21520:return d.tty?-28:-59;case 21531:a= +e=fc();if(!d.Qa.Wb)throw new K(59);return d.Qa.Wb(d,b,a);case 21523:return d.tty?0:-59;case 21524:return d.tty?0:-59;default:r("bad ioctl syscall "+b)}}catch(f){return"undefined"!==typeof Q&&f instanceof K||r(f),-f.Ta}},X:function(a,b){try{return a=z(a),a=kb(a),"/"===a[a.length-1]&&(a=a.substr(0,a.length-1)),P(a,b),0}catch(c){return"undefined"!==typeof Q&&c instanceof K||r(c),-c.Ta}},F:function(a,b,c){ec=c;try{var d=z(a),e=c?fc():0;return Xb(d,b,e).fd}catch(f){return"undefined"!==typeof Q&&f instanceof +K||r(f),-f.Ta}},Y:function(a,b,c){try{a=z(a);if(0>=c)var d=-28;else{var e=Gb(a),f=Math.min(c,Aa(e)),g=E[b+f];za(e,A,b,c+1);E[b+f]=g;d=f}return d}catch(l){return"undefined"!==typeof Q&&l instanceof K||r(l),-l.Ta}},$:function(a){try{a=z(a);var b=O(a,{parent:!0}).node,c=mb(a),d=zb(b,c),e=Pb(b,c,!0);if(e)throw new K(e);if(!b.Ma.rmdir)throw new K(63);if(d.lb)throw new K(10);try{N.willDeletePath&&N.willDeletePath(a)}catch(f){y("FS.trackingDelegate['willDeletePath']('"+a+"') threw an exception: "+f.message)}b.Ma.rmdir(b, +c);Jb(d);try{if(N.onDeletePath)N.onDeletePath(a)}catch(f){y("FS.trackingDelegate['onDeletePath']('"+a+"') threw an exception: "+f.message)}return 0}catch(f){return"undefined"!==typeof Q&&f instanceof K||r(f),-f.Ta}},aa:function(a){try{a=z(a);var b=O(a,{parent:!0}).node,c=mb(a),d=zb(b,c),e=Pb(b,c,!1);if(e)throw new K(e);if(!b.Ma.unlink)throw new K(63);if(d.lb)throw new K(10);try{N.willDeletePath&&N.willDeletePath(a)}catch(f){y("FS.trackingDelegate['willDeletePath']('"+a+"') threw an exception: "+f.message)}b.Ma.unlink(b, +c);Jb(d);try{if(N.onDeletePath)N.onDeletePath(a)}catch(f){y("FS.trackingDelegate['onDeletePath']('"+a+"') threw an exception: "+f.message)}return 0}catch(f){return"undefined"!==typeof Q&&f instanceof K||r(f),-f.Ta}},L:function(){},fa:function(a,b,c,d,e){var f=hc(c);b=R(b);sc(a,{name:b,fromWireType:function(g){return!!g},toWireType:function(g,l){return l?d:e},argPackAdvance:8,readValueFromPointer:function(g){if(1===c)var l=E;else if(2===c)l=Ea;else if(4===c)l=C;else throw new TypeError("Unknown boolean type size: "+ +b);return this.fromWireType(l[g>>f])},ab:null})},J:function(a,b,c,d,e,f,g,l,p,m,n,v,w){n=R(n);f=Uc(e,f);l&&(l=Uc(g,l));m&&(m=Uc(p,m));w=Uc(v,w);var k=mc(n);Ec(k,function(){Zc("Cannot construct "+n+" due to unbound types",[d])});T([a,b,c],d?[d]:[],function(t){t=t[0];if(d){var x=t.Pa;var B=x.eb}else B=Bc.prototype;t=nc(k,function(){if(Object.getPrototypeOf(this)!==u)throw new pc("Use 'new' to construct "+n);if(void 0===D.fb)throw new pc(n+" has no accessible constructor");var Wc=D.fb[arguments.length]; +if(void 0===Wc)throw new pc("Tried to invoke ctor of "+n+" with invalid number of parameters ("+arguments.length+") - expected ("+Object.keys(D.fb).toString()+") parameters instead!");return Wc.apply(this,arguments)});var u=Object.create(B,{constructor:{value:t}});t.prototype=u;var D=new Fc(n,t,u,w,x,f,l,m);x=new Rc(n,D,!0,!1);B=new Rc(n+"*",D,!1,!1);var da=new Rc(n+" const*",D,!1,!0);Cc[a]={pointerType:B,Qb:da};Sc(k,t);return[x,B,da]})},q:function(a,b,c,d,e,f,g){var l=cd(c,d);b=R(b);f=Uc(e,f);T([], +[a],function(p){function m(){Zc("Cannot call "+n+" due to unbound types",l)}p=p[0];var n=p.name+"."+b;b.startsWith("@@")&&(b=Symbol[b.substring(2)]);var v=p.Pa.constructor;void 0===v[b]?(m.jb=c-1,v[b]=m):(Dc(v,b,n),v[b].Ua[c-1]=m);T([],l,function(w){w=[w[0],null].concat(w.slice(1));w=bd(n,w,null,f,g);void 0===v[b].Ua?(w.jb=c-1,v[b]=w):v[b].Ua[c-1]=w;return[]});return[]})},ka:function(a,b,c,d,e,f){0>>l}}var p=b.includes("unsigned");sc(a,{name:b,fromWireType:f,toWireType:function(m,n){if("number"!==typeof n&& +"boolean"!==typeof n)throw new TypeError('Cannot convert "'+Ic(n)+'" to '+this.name);if(ne)throw new TypeError('Passing a number "'+Ic(n)+'" from JS side to C/C++ side to an argument of type "'+b+'", which is outside the valid range ['+d+", "+e+"]!");return p?n>>>0:n|0},argPackAdvance:8,readValueFromPointer:hd(b,g,0!==d),ab:null})},j:function(a,b,c){function d(f){f>>=2;var g=F;return new e(Ma,g[f+1],g[f])}var e=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array, +Float64Array][b];c=R(c);sc(a,{name:c,fromWireType:d,argPackAdvance:8,readValueFromPointer:d},{Ub:!0})},H:function(a,b){b=R(b);var c="std::string"===b;sc(a,{name:b,fromWireType:function(d){var e=F[d>>2];if(c)for(var f=d+4,g=0;g<=e;++g){var l=d+4+g;if(g==e||0==A[l]){f=z(f,l-f);if(void 0===p)var p=f;else p+=String.fromCharCode(0),p+=f;f=l+1}}else{p=Array(e);for(g=0;g>2]=g;if(c&&f)za(e,A,l+4,g+1);else if(f)for(f=0;f>2],n=g(),v,w=p+4,k=0;k<=m;++k){var t=p+4+k*b;if(k==m||0==n[t>>l])w=d(w,t-w),void 0===v?v=w:(v+=String.fromCharCode(0),v+=w),w=t+b}U(p);return v},toWireType:function(p,m){"string"!==typeof m&&S("Cannot pass non-string to C++ string type "+c);var n=f(m),v=La(4+n+b);F[v>>2]= +n>>l;e(m,v+4,n+b);null!==p&&p.push(U,v);return v},argPackAdvance:8,readValueFromPointer:Mc,ab:function(p){U(p)}})},ga:function(a,b){b=R(b);sc(a,{sc:!0,name:b,argPackAdvance:0,fromWireType:function(){},toWireType:function(){}})},P:function(){throw"longjmp";},la:fd,I:function(a){4>2]=28,-1;C[b>>2]=a/1E3|0;C[b+4>>2]=a%1E3*1E6|0;return 0},ja:function(){r("To use dlopen, you need to use Emscripten's linking support, see https://github.com/emscripten-core/emscripten/wiki/Linking")},d:function(a,b,c){b=nd(b,c);b=ya(b,0);a&24&&(b=b.replace(/\s+$/,""),b+=(0>>=0;if(2147483648=c;c*=2){var d=b*(1+.2/c);d=Math.min(d,a+100663296);d=Math.max(a,d);0>>16);Pa();var e=1;break a}catch(f){}e=void 0}if(e)return!0}return!1},x:function(a){eval(z(a))},da:function(a){return eval(z(a))|0},A:W,T:function(a,b){try{var c=0;sd().forEach(function(d,e){var f=b+c;e=C[a+4*e>>2]=f;for(f=0;f>0]=d.charCodeAt(f);E[e>>0]=0;c+=d.length+1}); +return 0}catch(d){return"undefined"!==typeof Q&&d instanceof K||r(d),d.Ta}},U:function(a,b){try{var c=sd();C[a>>2]=c.length;var d=0;c.forEach(function(e){d+=e.length+1});C[b>>2]=d;return 0}catch(e){return"undefined"!==typeof Q&&e instanceof K||r(e),e.Ta}},ia:function(a){if(!(noExitRuntime||0>2],l=e,p=C[b+8*f>>2],m=g,n=void 0,v=E;if(0>m||0>n)throw new K(28);if(null===l.fd)throw new K(8);if(1===(l.flags&2097155))throw new K(8);if(M(l.node.mode))throw new K(31);if(!l.Qa.read)throw new K(28);var w="undefined"!==typeof n;if(!w)n=l.position;else if(!l.seekable)throw new K(70);var k=l.Qa.read(l,v,p,m,n);w||(l.position+=k);var t=k;if(0>t){var x= +-1;break a}a+=t;if(t>2]=x;return 0}catch(B){return"undefined"!==typeof Q&&B instanceof K||r(B),B.Ta}},K:function(a,b,c,d,e){try{var f=gc(a);a=4294967296*c+(b>>>0);if(-9007199254740992>=a||9007199254740992<=a)return-61;Zb(f,a,d);J=[f.position>>>0,(I=f.position,1<=+Math.abs(I)?0>>0:~~+Math.ceil((I-+(~~I>>>0))/4294967296)>>>0:0)];C[e>>2]=J[0];C[e+4>>2]=J[1];f.gb&&0===a&&0===d&&(f.gb=null);return 0}catch(g){return"undefined"!==typeof Q&& +g instanceof K||r(g),g.Ta}},ba:function(a,b,c,d){try{a:{for(var e=gc(a),f=a=0;f>2],p=C[b+(8*f+4)>>2],m=void 0,n=E;if(0>p||0>m)throw new K(28);if(null===g.fd)throw new K(8);if(0===(g.flags&2097155))throw new K(8);if(M(g.node.mode))throw new K(31);if(!g.Qa.write)throw new K(28);g.seekable&&g.flags&1024&&Zb(g,0,2);var v="undefined"!==typeof m;if(!v)m=g.position;else if(!g.seekable)throw new K(70);var w=g.Qa.write(g,n,l,p,m,void 0);v||(g.position+=w);try{if(g.path&&N.onWriteToFile)N.onWriteToFile(g.path)}catch(x){y("FS.trackingDelegate['onWriteToFile']('"+ +g.path+"') threw an exception: "+x.message)}var k=w;if(0>k){var t=-1;break a}a+=k}t=a}C[d>>2]=t;return 0}catch(x){return"undefined"!==typeof Q&&x instanceof K||r(x),x.Ta}},a:function(){return ta},C:Dd,h:Ed,o:Fd,m:Gd,D:Hd,s:Id,k:Jd,e:Kd,i:Ld,y:Md,M:Nd,N:Od,r:Pd,u:function(a){eb();var b=new Date(C[a+20>>2]+1900,C[a+16>>2],C[a+12>>2],C[a+8>>2],C[a+4>>2],C[a>>2],0),c=C[a+32>>2],d=b.getTimezoneOffset(),e=new Date(b.getFullYear(),0,1),f=(new Date(b.getFullYear(),6,1)).getTimezoneOffset(),g=e.getTimezoneOffset(), +l=Math.min(g,f);0>c?C[a+32>>2]=Number(f!=g&&l==d):0>2]=b.getDay();C[a+28>>2]=(b.getTime()-e.getTime())/864E5|0;C[a>>2]=b.getSeconds();C[a+4>>2]=b.getMinutes();C[a+8>>2]=b.getHours();C[a+12>>2]=b.getDate();C[a+16>>2]=b.getMonth();return b.getTime()/1E3|0},b:function(a){ta=a},ha:zd,S:function(a,b,c,d){return zd(a,b,c,d)},p:function(a){var b=Date.now()/1E3|0;a&&(C[a>>2]=b);return b}}; +(function(){function a(e){h.asm=e.exports;va=h.asm.ma;Pa();G=h.asm.Aa;Ra.unshift(h.asm.na);Ua--;h.monitorRunDependencies&&h.monitorRunDependencies(Ua);0==Ua&&(null!==Va&&(clearInterval(Va),Va=null),Wa&&(e=Wa,Wa=null,e()))}function b(e){a(e.instance)}function c(e){return $a().then(function(f){return WebAssembly.instantiate(f,d)}).then(e,function(f){y("failed to asynchronously prepare wasm: "+f);r(f)})}var d={a:Qd};Ua++;h.monitorRunDependencies&&h.monitorRunDependencies(Ua);if(h.instantiateWasm)try{return h.instantiateWasm(d, +a)}catch(e){return y("Module.instantiateWasm callback failed with error: "+e),!1}(function(){return ua||"function"!==typeof WebAssembly.instantiateStreaming||Xa()||H.startsWith("file://")||"function"!==typeof fetch?c(b):fetch(H,{credentials:"same-origin"}).then(function(e){return WebAssembly.instantiateStreaming(e,d).then(b,function(f){y("wasm streaming compile failed: "+f);y("falling back to ArrayBuffer instantiation");return c(b)})})})();return{}})(); +h.___wasm_call_ctors=function(){return(h.___wasm_call_ctors=h.asm.na).apply(null,arguments)};var od=h._strlen=function(){return(od=h._strlen=h.asm.oa).apply(null,arguments)},La=h._malloc=function(){return(La=h._malloc=h.asm.pa).apply(null,arguments)},Cd=h.___errno_location=function(){return(Cd=h.___errno_location=h.asm.qa).apply(null,arguments)},U=h._free=function(){return(U=h._free=h.asm.ra).apply(null,arguments)},Yc=h.___getTypeName=function(){return(Yc=h.___getTypeName=h.asm.sa).apply(null,arguments)}; +h.___embind_register_native_and_builtin_types=function(){return(h.___embind_register_native_and_builtin_types=h.asm.ta).apply(null,arguments)}; +var ib=h.__get_tzname=function(){return(ib=h.__get_tzname=h.asm.ua).apply(null,arguments)},hb=h.__get_daylight=function(){return(hb=h.__get_daylight=h.asm.va).apply(null,arguments)},gb=h.__get_timezone=function(){return(gb=h.__get_timezone=h.asm.wa).apply(null,arguments)},X=h.stackSave=function(){return(X=h.stackSave=h.asm.xa).apply(null,arguments)},Y=h.stackRestore=function(){return(Y=h.stackRestore=h.asm.ya).apply(null,arguments)},Z=h._setThrew=function(){return(Z=h._setThrew=h.asm.za).apply(null, +arguments)};h.dynCall_ji=function(){return(h.dynCall_ji=h.asm.Ba).apply(null,arguments)};h.dynCall_jiji=function(){return(h.dynCall_jiji=h.asm.Ca).apply(null,arguments)};h.dynCall_viij=function(){return(h.dynCall_viij=h.asm.Da).apply(null,arguments)};h.dynCall_viiiiiiji=function(){return(h.dynCall_viiiiiiji=h.asm.Ea).apply(null,arguments)};h.dynCall_viiijj=function(){return(h.dynCall_viiijj=h.asm.Fa).apply(null,arguments)}; +h.dynCall_viiiiiijjii=function(){return(h.dynCall_viiiiiijjii=h.asm.Ga).apply(null,arguments)};h.dynCall_iiiiij=function(){return(h.dynCall_iiiiij=h.asm.Ha).apply(null,arguments)};h.dynCall_iiiiijj=function(){return(h.dynCall_iiiiijj=h.asm.Ia).apply(null,arguments)};h.dynCall_iiiiiijj=function(){return(h.dynCall_iiiiiijj=h.asm.Ja).apply(null,arguments)};h.dynCall_viijii=function(){return(h.dynCall_viijii=h.asm.Ka).apply(null,arguments)}; +function Ed(a,b){var c=X();try{return G.get(a)(b)}catch(d){Y(c);if(d!==d+0&&"longjmp"!==d)throw d;Z(1,0)}}function Gd(a,b,c,d){var e=X();try{return G.get(a)(b,c,d)}catch(f){Y(e);if(f!==f+0&&"longjmp"!==f)throw f;Z(1,0)}}function Jd(a,b){var c=X();try{G.get(a)(b)}catch(d){Y(c);if(d!==d+0&&"longjmp"!==d)throw d;Z(1,0)}}function Ld(a,b,c,d){var e=X();try{G.get(a)(b,c,d)}catch(f){Y(e);if(f!==f+0&&"longjmp"!==f)throw f;Z(1,0)}} +function Kd(a,b,c){var d=X();try{G.get(a)(b,c)}catch(e){Y(d);if(e!==e+0&&"longjmp"!==e)throw e;Z(1,0)}}function Fd(a,b,c){var d=X();try{return G.get(a)(b,c)}catch(e){Y(d);if(e!==e+0&&"longjmp"!==e)throw e;Z(1,0)}}function Id(a,b,c,d,e,f,g,l){var p=X();try{return G.get(a)(b,c,d,e,f,g,l)}catch(m){Y(p);if(m!==m+0&&"longjmp"!==m)throw m;Z(1,0)}}function Md(a,b,c,d,e){var f=X();try{G.get(a)(b,c,d,e)}catch(g){Y(f);if(g!==g+0&&"longjmp"!==g)throw g;Z(1,0)}} +function Hd(a,b,c,d,e){var f=X();try{return G.get(a)(b,c,d,e)}catch(g){Y(f);if(g!==g+0&&"longjmp"!==g)throw g;Z(1,0)}}function Dd(a){var b=X();try{return G.get(a)()}catch(c){Y(b);if(c!==c+0&&"longjmp"!==c)throw c;Z(1,0)}}function Od(a,b,c,d,e,f,g){var l=X();try{G.get(a)(b,c,d,e,f,g)}catch(p){Y(l);if(p!==p+0&&"longjmp"!==p)throw p;Z(1,0)}}function Nd(a,b,c,d,e,f){var g=X();try{G.get(a)(b,c,d,e,f)}catch(l){Y(g);if(l!==l+0&&"longjmp"!==l)throw l;Z(1,0)}} +function Pd(a,b,c,d,e,f,g,l,p,m){var n=X();try{G.get(a)(b,c,d,e,f,g,l,p,m)}catch(v){Y(n);if(v!==v+0&&"longjmp"!==v)throw v;Z(1,0)}}var Rd;function oa(a){this.name="ExitStatus";this.message="Program terminated with exit("+a+")";this.status=a}Wa=function Sd(){Rd||Td();Rd||(Wa=Sd)}; +function Td(){function a(){if(!Rd&&(Rd=!0,h.calledRun=!0,!wa)){h.noFSInit||ac||(ac=!0,$b(),h.stdin=h.stdin,h.stdout=h.stdout,h.stderr=h.stderr,h.stdin?cc("stdin",h.stdin):Wb("/dev/tty","/dev/stdin"),h.stdout?cc("stdout",null,h.stdout):Wb("/dev/tty","/dev/stdout"),h.stderr?cc("stderr",null,h.stderr):Wb("/dev/tty1","/dev/stderr"),Xb("/dev/stdin",0),Xb("/dev/stdout",1),Xb("/dev/stderr",1));Fb=!1;ab(Ra);if(h.onRuntimeInitialized)h.onRuntimeInitialized();if(h.postRun)for("function"==typeof h.postRun&& +(h.postRun=[h.postRun]);h.postRun.length;){var b=h.postRun.shift();Sa.unshift(b)}ab(Sa)}}if(!(0=d);)++c;if(16e?d+=String.fromCharCode(e):(e-=65536,d+=String.fromCharCode(55296|e>>10,56320|e&1023))}}else d+=String.fromCharCode(e)}return d}function z(a,b){return a?ta(A,a,b):""} +function ua(a,b,c,d){if(!(0=g){var l=a.charCodeAt(++f);g=65536+((g&1023)<<10)|l&1023}if(127>=g){if(c>=d)break;b[c++]=g}else{if(2047>=g){if(c+1>=d)break;b[c++]=192|g>>6}else{if(65535>=g){if(c+2>=d)break;b[c++]=224|g>>12}else{if(c+3>=d)break;b[c++]=240|g>>18;b[c++]=128|g>>12&63}b[c++]=128|g>>6&63}b[c++]=128|g&63}}b[c]=0;return c-e} +function va(a){for(var b=0,c=0;c=d&&(d=65536+((d&1023)<<10)|a.charCodeAt(++c)&1023);127>=d?++b:b=2047>=d?b+2:65535>=d?b+3:b+4}return b}var wa="undefined"!==typeof TextDecoder?new TextDecoder("utf-16le"):void 0;function xa(a,b){var c=a>>1;for(var d=c+b/2;!(c>=d)&&ya[c];)++c;c<<=1;if(32=b/2);++d){var e=za[a+2*d>>1];if(0==e)break;c+=String.fromCharCode(e)}return c} +function Aa(a,b,c){void 0===c&&(c=2147483647);if(2>c)return 0;c-=2;var d=b;c=c<2*a.length?c/2:a.length;for(var e=0;e>1]=a.charCodeAt(e),b+=2;za[b>>1]=0;return b-d}function Ba(a){return 2*a.length}function Ca(a,b){for(var c=0,d="";!(c>=b/4);){var e=C[a+4*c>>2];if(0==e)break;++c;65536<=e?(e-=65536,d+=String.fromCharCode(55296|e>>10,56320|e&1023)):d+=String.fromCharCode(e)}return d} +function Da(a,b,c){void 0===c&&(c=2147483647);if(4>c)return 0;var d=b;c=d+c-4;for(var e=0;e=f){var g=a.charCodeAt(++e);f=65536+((f&1023)<<10)|g&1023}C[b>>2]=f;b+=4;if(b+4>c)break}C[b>>2]=0;return b-d}function Ea(a){for(var b=0,c=0;c=d&&++c;b+=4}return b}function Fa(a){var b=va(a)+1,c=Ga(b);c&&ua(a,E,c,b);return c}var Ha,E,A,za,ya,C,F,Ia,Ja; +function Ka(){var a=qa.buffer;Ha=a;k.HEAP8=E=new Int8Array(a);k.HEAP16=za=new Int16Array(a);k.HEAP32=C=new Int32Array(a);k.HEAPU8=A=new Uint8Array(a);k.HEAPU16=ya=new Uint16Array(a);k.HEAPU32=F=new Uint32Array(a);k.HEAPF32=Ia=new Float32Array(a);k.HEAPF64=Ja=new Float64Array(a)}var La,Ma=[],Na=[],Oa=[];function Pa(){var a=k.preRun.shift();Ma.unshift(a)}var Qa=0,Ra=null,Sa=null;k.preloadedImages={};k.preloadedAudios={}; +function r(a){if(k.onAbort)k.onAbort(a);y(a);ra=!0;throw new WebAssembly.RuntimeError("abort("+a+"). Build with -s ASSERTIONS=1 for more info.");}function Ta(){return G.startsWith("data:application/octet-stream;base64,")}var G;G="libDynamsoftBarcodeReader.wasm";if(!Ta()){var Ua=G;G=k.locateFile?k.locateFile(Ua,p):p+Ua}function Va(){var a=G;try{if(a==G&&pa)return new Uint8Array(pa);if(ja)return ja(a);throw"both async and sync fetching of the wasm failed";}catch(b){r(b)}} +function Wa(){if(!pa&&(da||ea)){if("function"===typeof fetch&&!G.startsWith("file://"))return fetch(G,{credentials:"same-origin"}).then(function(a){if(!a.ok)throw"failed to load wasm binary file at '"+G+"'";return a.arrayBuffer()}).catch(function(){return Va()});if(ia)return new Promise(function(a,b){ia(G,function(c){a(new Uint8Array(c))},b)})}return Promise.resolve().then(function(){return Va()})}var H,I; +function Xa(a){for(;0>2]=b};this.Kb=function(b){C[this.ta+8>>2]=b};this.Lb=function(){C[this.ta>>2]=0};this.Jb=function(){E[this.ta+12>>0]=0};this.Mb=function(){E[this.ta+13>>0]=0};this.Ab=function(b,c){this.Nb(b);this.Kb(c);this.Lb();this.Jb();this.Mb()}}var Za=0,$a; +function ab(){function a(g){return(g=g.toTimeString().match(/\(([A-Za-z ]+)\)$/))?g[1]:"GMT"}if(!bb){bb=!0;var b=(new Date).getFullYear(),c=new Date(b,0,1),d=new Date(b,6,1);b=c.getTimezoneOffset();var e=d.getTimezoneOffset(),f=Math.max(b,e);C[cb()>>2]=60*f;C[db()>>2]=Number(b!=e);c=a(c);d=a(d);c=Fa(c);d=Fa(d);e>2]=c,C[eb()+4>>2]=d):(C[eb()>>2]=d,C[eb()+4>>2]=c)}}var bb; +function fb(a,b){for(var c=0,d=a.length-1;0<=d;d--){var e=a[d];"."===e?a.splice(d,1):".."===e?(a.splice(d,1),c++):c&&(a.splice(d,1),c--)}if(b)for(;c;c--)a.unshift("..");return a}function gb(a){var b="/"===a.charAt(0),c="/"===a.substr(-1);(a=fb(a.split("/").filter(function(d){return!!d}),!b).join("/"))||b||(a=".");a&&c&&(a+="/");return(b?"/":"")+a} +function hb(a){var b=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(a).slice(1);a=b[0];b=b[1];if(!a&&!b)return".";b&&(b=b.substr(0,b.length-1));return a+b}function ib(a){if("/"===a)return"/";a=gb(a);a=a.replace(/\/$/,"");var b=a.lastIndexOf("/");return-1===b?a:a.substr(b+1)} +function jb(){if("object"===typeof crypto&&"function"===typeof crypto.getRandomValues){var a=new Uint8Array(1);return function(){crypto.getRandomValues(a);return a[0]}}if(fa)try{var b=require("crypto");return function(){return b.randomBytes(1)[0]}}catch(c){}return function(){r("randomDevice")}} +function kb(){for(var a="",b=!1,c=arguments.length-1;-1<=c&&!b;c--){b=0<=c?arguments[c]:"/";if("string"!==typeof b)throw new TypeError("Arguments to path.resolve must be strings");if(!b)return"";a=b+"/"+a;b="/"===b.charAt(0)}a=fb(a.split("/").filter(function(d){return!!d}),!b).join("/");return(b?"/":"")+a||"."}var lb=[];function mb(a,b){lb[a]={input:[],output:[],Sa:b};nb(a,ob)} +var ob={open:function(a){var b=lb[a.node.rdev];if(!b)throw new J(43);a.tty=b;a.seekable=!1},close:function(a){a.tty.Sa.flush(a.tty)},flush:function(a){a.tty.Sa.flush(a.tty)},read:function(a,b,c,d){if(!a.tty||!a.tty.Sa.ob)throw new J(60);for(var e=0,f=0;f=b||(b=Math.max(b,c*(1048576>c?2:1.125)>>>0),0!=c&&(b=Math.max(b,256)),c=a.sa,a.sa=new Uint8Array(b),0=a.node.xa)return 0;a=Math.min(a.node.xa-e,d);if(8b)throw new J(28);return b},jb:function(a,b,c){K.mb(a.node,b+c);a.node.xa=Math.max(a.node.xa,b+c)},pb:function(a,b,c,d,e,f){if(0!==b)throw new J(28);if(32768!==(a.node.mode&61440))throw new J(43);a=a.node.sa;if(f&2||a.buffer!==Ha){if(0>>0)%Ab.length}function Fb(a){var b=Eb(a.parent.id,a.name);if(Ab[b]===a)Ab[b]=a.Ra;else for(b=Ab[b];b;){if(b.Ra===a){b.Ra=a.Ra;break}b=b.Ra}} +function vb(a,b){var c;if(c=(c=Gb(a,"x"))?c:a.ra.lookup?0:2)throw new J(c,a);for(c=Ab[Eb(a.id,b)];c;c=c.Ra){var d=c.name;if(c.parent.id===a.id&&d===b)return c}return a.ra.lookup(a,b)}function tb(a,b,c,d){a=new Hb(a,b,c,d);b=Eb(a.parent.id,a.name);a.Ra=Ab[b];return Ab[b]=a}function L(a){return 16384===(a&61440)}var Ib={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090};function Jb(a){var b=["r","w","rw"][a&3];a&512&&(b+="w");return b} +function Gb(a,b){if(Bb)return 0;if(!b.includes("r")||a.mode&292){if(b.includes("w")&&!(a.mode&146)||b.includes("x")&&!(a.mode&73))return 2}else return 2;return 0}function Kb(a,b){try{return vb(a,b),20}catch(c){}return Gb(a,"wx")}function Lb(a,b,c){try{var d=vb(a,b)}catch(e){return e.ya}if(a=Gb(a,"wx"))return a;if(c){if(!L(d.mode))return 54;if(d===d.parent||"/"===Db(d))return 10}else if(L(d.mode))return 31;return 0}function Mb(a){var b=4096;for(a=a||0;a<=b;a++)if(!yb[a])return a;throw new J(33);} +function Nb(a,b){Ob||(Ob=function(){},Ob.prototype={});var c=new Ob,d;for(d in a)c[d]=a[d];a=c;b=Mb(b);a.fd=b;return yb[b]=a}var sb={open:function(a){a.va=xb[a.node.rdev].va;a.va.open&&a.va.open(a)},Ma:function(){throw new J(70);}};function nb(a,b){xb[a]={va:b}} +function Pb(a,b){var c="/"===b,d=!b;if(c&&wb)throw new J(10);if(!c&&!d){var e=N(b,{nb:!1});b=e.path;e=e.node;if(e.Qa)throw new J(10);if(!L(e.mode))throw new J(54);}b={type:a,Yb:{},qb:b,Cb:[]};a=a.Ha(b);a.Ha=b;b.root=a;c?wb=a:e&&(e.Qa=b,e.Ha&&e.Ha.Cb.push(b))}function Qb(a,b,c){var d=N(a,{parent:!0}).node;a=ib(a);if(!a||"."===a||".."===a)throw new J(28);var e=Kb(d,a);if(e)throw new J(e);if(!d.ra.Za)throw new J(63);return d.ra.Za(d,a,b,c)} +function O(a,b){return Qb(a,(void 0!==b?b:511)&1023|16384,0)}function Rb(a,b,c){"undefined"===typeof c&&(c=b,b=438);Qb(a,b|8192,c)}function Sb(a,b){if(!kb(a))throw new J(44);var c=N(b,{parent:!0}).node;if(!c)throw new J(44);b=ib(b);var d=Kb(c,b);if(d)throw new J(d);if(!c.ra.symlink)throw new J(63);c.ra.symlink(c,b,a)}function Cb(a){a=N(a).node;if(!a)throw new J(44);if(!a.ra.readlink)throw new J(28);return kb(Db(a.parent),a.ra.readlink(a))} +function Tb(a,b,c,d){if(""===a)throw new J(44);if("string"===typeof b){var e=Ib[b];if("undefined"===typeof e)throw Error("Unknown file open mode: "+b);b=e}c=b&64?("undefined"===typeof c?438:c)&4095|32768:0;if("object"===typeof a)var f=a;else{a=gb(a);try{f=N(a,{eb:!(b&131072)}).node}catch(g){}}e=!1;if(b&64)if(f){if(b&128)throw new J(20);}else f=Qb(a,c,0),e=!0;if(!f)throw new J(44);8192===(f.mode&61440)&&(b&=-513);if(b&65536&&!L(f.mode))throw new J(54);if(!e&&(c=f?40960===(f.mode&61440)?32:L(f.mode)&& +("r"!==Jb(b)||b&512)?31:Gb(f,Jb(b)):44))throw new J(c);if(b&512){c=f;c="string"===typeof c?N(c,{eb:!0}).node:c;if(!c.ra.Fa)throw new J(63);if(L(c.mode))throw new J(31);if(32768!==(c.mode&61440))throw new J(28);if(e=Gb(c,"w"))throw new J(e);c.ra.Fa(c,{size:0,timestamp:Date.now()})}b&=-131713;d=Nb({node:f,path:Db(f),flags:b,seekable:!0,position:0,va:f.va,Tb:[],error:!1},d);d.va.open&&d.va.open(d);!k.logReadFiles||b&1||(Ub||(Ub={}),a in Ub||(Ub[a]=1,y("FS.trackingDelegate error on read file: "+a))); +try{M.onOpenFile&&(f=0,1!==(b&2097155)&&(f|=1),0!==(b&2097155)&&(f|=2),M.onOpenFile(a,f))}catch(g){y("FS.trackingDelegate['onOpenFile']('"+a+"', flags) threw an exception: "+g.message)}return d}function Vb(a,b,c){if(null===a.fd)throw new J(8);if(!a.seekable||!a.va.Ma)throw new J(70);if(0!=c&&1!=c&&2!=c)throw new J(28);a.position=a.va.Ma(a,b,c);a.Tb=[];return a.position} +function Wb(){J||(J=function(a,b){this.node=b;this.Ib=function(c){this.ya=c};this.Ib(a);this.message="FS error"},J.prototype=Error(),J.prototype.constructor=J,[44].forEach(function(a){ub[a]=new J(a);ub[a].stack=""}))}var Xb;function Yb(a,b){var c=0;a&&(c|=365);b&&(c|=146);return c} +function Zb(a,b,c){a=gb("/dev/"+a);var d=Yb(!!b,!!c);$b||($b=64);var e=$b++<<8|0;nb(e,{open:function(f){f.seekable=!1},close:function(){c&&c.buffer&&c.buffer.length&&c(10)},read:function(f,g,l,q){for(var m=0,n=0;n>2]}function cc(a){a=yb[a];if(!a)throw new J(8);return a}function dc(a){switch(a){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+a);}}var ec=void 0;function Q(a){for(var b="";A[a];)b+=ec[A[a++]];return b}var fc={},gc={},hc={};function ic(a){if(void 0===a)return"_unknown";a=a.replace(/[^a-zA-Z0-9_]/g,"$");var b=a.charCodeAt(0);return 48<=b&&57>=b?"_"+a:a} +function jc(a,b){a=ic(a);return(new Function("body","return function "+a+'() {\n "use strict"; return body.apply(this, arguments);\n};\n'))(b)}function kc(a){var b=Error,c=jc(a,function(d){this.name=a;this.message=d;d=Error(d).stack;void 0!==d&&(this.stack=this.toString()+"\n"+d.replace(/^Error(:[^\n]*)?\n/,""))});c.prototype=Object.create(b.prototype);c.prototype.constructor=c;c.prototype.toString=function(){return void 0===this.message?this.name:this.name+": "+this.message};return c} +var lc=void 0;function R(a){throw new lc(a);}var mc=void 0;function nc(a){throw new mc(a);}function S(a,b,c){function d(l){l=c(l);l.length!==a.length&&nc("Mismatched type converter count");for(var q=0;q>2])}function Ic(a,b,c){if(b===c)return a;if(void 0===c.Da)return null;a=Ic(a,b,c.Da);return null===a?null:c.wb(a)} +var Jc={};function Kc(a,b){for(void 0===b&&R("ptr should not be undefined");a.Da;)b=a.Wa(b),a=a.Da;return Jc[b]}function Lc(a,b){b.wa&&b.ta||nc("makeClassHandle requires ptr and ptrType");!!b.Ca!==!!b.Ba&&nc("Both smartPtrType and smartPtr must be specified");b.count={value:1};return sc(Object.create(a,{qa:{value:b}}))} +function U(a,b,c,d){this.name=a;this.ua=b;this.fb=c;this.Xa=d;this.Ya=!1;this.Na=this.Gb=this.Fb=this.sb=this.Ob=this.Db=void 0;void 0!==b.Da?this.toWireType=Ec:(this.toWireType=d?Cc:Gc,this.Ga=null)}function Mc(a,b){k.hasOwnProperty(a)||nc("Replacing nonexistant public symbol");k[a]=b;k[a].Oa=void 0} +function Nc(a,b){var c=[];return function(){c.length=arguments.length;for(var d=0;df&&R("argTypes array size mismatch! Must at least get return value and 'this' types!");var g=null!==b[1]&&null!==c,l=!1;for(c=1;c>2)+d]);return c} +function Xc(a,b,c){a instanceof Object||R(c+' with invalid "this": '+a);a instanceof b.ua.constructor||R(c+' incompatible with "this" of type '+a.constructor.name);a.qa.ta||R("cannot call emscripten binding method "+c+" on deleted object");return Bc(a.qa.ta,a.qa.wa.ua,b.ua)}var Yc=[],X=[{},{value:void 0},{value:null},{value:!0},{value:!1}];function Zc(a){4>2])};case 3:return function(c){return this.fromWireType(Ja[c>>3])};default:throw new TypeError("Unknown float type: "+a);}} +function ad(a,b,c){switch(b){case 0:return c?function(d){return E[d]}:function(d){return A[d]};case 1:return c?function(d){return za[d>>1]}:function(d){return ya[d>>1]};case 2:return c?function(d){return C[d>>2]}:function(d){return F[d>>2]};default:throw new TypeError("Unknown integer type: "+a);}}function bd(){void 0===bd.start&&(bd.start=Date.now());return 1E3*(Date.now()-bd.start)|0}var cd;cd=fa?function(){var a=process.hrtime();return 1E3*a[0]+a[1]/1E6}:function(){return performance.now()}; +function dd(a,b){if(0>=a)return a;var c=32>=b?Math.abs(1<=c&&(32>=b||a>c)&&(a=-2*c+a);return a}function ed(a,b){return 0<=a?a:32>=b?2*Math.abs(1<>3],d+=8):"i64"==D?(D=[C[d>>2],C[d+4>>2]],d+=8):(D=C[d>>2],d+=4);return D}for(var d=b,e=[],f,g;;){var l=a;f=E[a>>0];if(0===f)break;g=E[a+1>>0];if(37==f){var q=!1,m=b=!1,n=!1,x=!1;a:for(;;){switch(g){case 43:q=!0;break;case 45:b=!0;break;case 35:m=!0;break;case 48:if(n)break a;else{n=!0;break}case 32:x=!0;break;default:break a}a++;g=E[a+1>>0]}var v=0;if(42==g)v=c("i32"),a++,g=E[a+1>>0];else for(;48<= +g&&57>=g;)v=10*v+(g-48),a++,g=E[a+1>>0];var h=!1,t=-1;if(46==g){t=0;h=!0;a++;g=E[a+1>>0];if(42==g)t=c("i32"),a++;else for(;;){g=E[a+1>>0];if(48>g||57>0]}0>t&&(t=6,h=!1);switch(String.fromCharCode(g)){case "h":g=E[a+2>>0];if(104==g){a++;var w=1}else w=2;break;case "l":g=E[a+2>>0];108==g?(a++,w=8):w=4;break;case "L":case "q":case "j":w=8;break;case "z":case "t":case "I":w=4;break;default:w=null}w&&a++;g=E[a+1>>0];switch(String.fromCharCode(g)){case "d":case "i":case "u":case "o":case "x":case "X":case "p":l= +100==g||105==g;w=w||4;f=c("i"+8*w);8==w&&(f=117==g?(f[0]>>>0)+4294967296*(f[1]>>>0):(f[0]>>>0)+4294967296*f[1]);4>=w&&(f=(l?dd:ed)(f&Math.pow(256,w)-1,8*w));var B=Math.abs(f);l="";if(100==g||105==g)var u=dd(f,8*w,1).toString(10);else if(117==g)u=ed(f,8*w,1).toString(10),f=Math.abs(f);else if(111==g)u=(m?"0":"")+B.toString(8);else if(120==g||88==g){l=m&&0!=f?"0x":"";if(0>f){f=-f;u=(B-1).toString(16);B=[];for(m=0;mw&&-4<=w?(g=(103==g?"f":"F").charCodeAt(0),t-=w+1):(g=(103==g?"e":"E").charCodeAt(0),t--),w=Math.min(t,20);if(101==g||69==g)u=f.toExponential(w),/[eE][-+]\d$/.test(u)&&(u=u.slice(0,-1)+"0"+u.slice(-1));else if(102==g||70==g)u=f.toFixed(w),0===f&&(0>f||0===f&&-Infinity===1/f)&&(u="-"+u);l=u.split("e");if(h&&!m)for(;1w++;)l[0]+="0";u=l[0]+(1f?"-":"")+"inf",n=!1;for(;u.lengthg&&(u=u.toUpperCase());u.split("").forEach(function(D){e.push(D.charCodeAt(0))});break;case "s":n=(q=c("i8*"))?gd(q):6;h&&(n=Math.min(n,t));if(!b)for(;n>0]);else e=e.concat(pb("(null)".substr(0,n), +!0));if(b)for(;n>2]=e.length;break;case "%":e.push(f);break;default:for(m=l;m>0])}a+=2}else e.push(f),a+=1}return e} +function hd(a){if(!a||!a.callee||!a.callee.name)return[null,"",""];var b=a.callee.name,c="(",d=!0,e;for(e in a){var f=a[e];d||(c+=", ");d=!1;c="number"===typeof f||"string"===typeof f?c+f:c+("("+typeof f+")")}c+=")";a=(a=a.callee.caller)?a.arguments:[];d&&(c="");return[a,b,c]} +function jd(a){a:{var b=Error();if(!b.stack){try{throw Error();}catch(t){b=t}if(!b.stack){b="(no stack trace available)";break a}}b=b.stack.toString()}b=b.slice(b.indexOf("\n",Math.max(b.lastIndexOf("_emscripten_log"),b.lastIndexOf("_emscripten_get_callstack")))+1);a&32&&na("EM_LOG_DEMANGLE is deprecated; ignoring");a&8&&"undefined"===typeof emscripten_source_map&&(na('Source map information is not available, emscripten_log with EM_LOG_C_STACK will be ignored. Build with "--pre-js $EMSCRIPTEN/src/emscripten-source-map.min.js" linker flag to add source map loading to code.'), +a=a^8|16);var c=null;if(a&128)for(c=hd(arguments);c[1].includes("_emscripten_");)c=hd(c[0]);var d=b.split("\n");b="";var e=/\s*(.*?)@(.*?):([0-9]+):([0-9]+)/,f=/\s*(.*?)@(.*):(.*)(:(.*))?/,g=/\s*at (.*?) \((.*):(.*):(.*)\)/,l;for(l in d){var q=d[l],m;if((m=g.exec(q))&&5==m.length){q=m[1];var n=m[2];var x=m[3];m=m[4]}else if((m=e.exec(q))||(m=f.exec(q)),m&&4<=m.length)q=m[1],n=m[2],x=m[3],m=m[4]|0;else{b+=q+"\n";continue}var v=!1;if(a&8){var h=emscripten_source_map.Zb({line:x,ub:m});if(v=h&&h.source)a& +64&&(h.source=h.source.substring(h.source.replace(/\\/g,"/").lastIndexOf("/")+1)),b+=" at "+q+" ("+h.source+":"+h.line+":"+h.ub+")\n"}if(a&16||!v)a&64&&(n=n.substring(n.replace(/\\/g,"/").lastIndexOf("/")+1)),b+=(v?" = "+q:" at "+q)+" ("+n+":"+x+":"+m+")\n";a&128&&c[0]&&(c[1]==q&&0u?-1:0=g(w,h)?0>=g(t,h)?h.getFullYear()+1:h.getFullYear():h.getFullYear()-1}var m=C[d+40>>2];d={Rb:C[d>>2],Qb:C[d+4>>2],$a:C[d+8>>2],Va:C[d+12>>2],Ta:C[d+16>>2],Aa:C[d+20>>2],ab:C[d+24>>2],bb:C[d+28>>2],$b:C[d+32>>2],Pb:C[d+ +36>>2],Sb:m?z(m):""};c=z(c);m={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var n in m)c=c.replace(new RegExp(n,"g"),m[n]);var x="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "), +v="January February March April May June July August September October November December".split(" ");m={"%a":function(h){return x[h.ab].substring(0,3)},"%A":function(h){return x[h.ab]},"%b":function(h){return v[h.Ta].substring(0,3)},"%B":function(h){return v[h.Ta]},"%C":function(h){return f((h.Aa+1900)/100|0,2)},"%d":function(h){return f(h.Va,2)},"%e":function(h){return e(h.Va,2," ")},"%g":function(h){return q(h).toString().substring(2)},"%G":function(h){return q(h)},"%H":function(h){return f(h.$a, +2)},"%I":function(h){h=h.$a;0==h?h=12:12h.$a?"AM":"PM"},"%S":function(h){return f(h.Rb,2)},"%t":function(){return"\t"},"%u":function(h){return h.ab||7},"%U":function(h){var t=new Date(h.Aa+1900,0,1),w=0===t.getDay()?t:rd(t,7-t.getDay());h=new Date(h.Aa+1900,h.Ta,h.Va);return 0> +g(w,h)?f(Math.ceil((31-w.getDate()+(od(nd(h.getFullYear())?pd:qd,h.getMonth()-1)-31)+h.getDate())/7),2):0===g(w,t)?"01":"00"},"%V":function(h){var t=new Date(h.Aa+1901,0,4),w=l(new Date(h.Aa+1900,0,4));t=l(t);var B=rd(new Date(h.Aa+1900,0,1),h.bb);return 0>g(B,w)?"53":0>=g(t,B)?"01":f(Math.ceil((w.getFullYear()g(w,h)?f(Math.ceil((31-w.getDate()+(od(nd(h.getFullYear())?pd:qd,h.getMonth()-1)-31)+h.getDate())/7),2):0===g(w,t)?"01":"00"},"%y":function(h){return(h.Aa+1900).toString().substring(2)},"%Y":function(h){return h.Aa+1900},"%z":function(h){h=h.Pb;var t=0<=h;h=Math.abs(h)/60;return(t?"+":"-")+String("0000"+(h/60*100+h%60)).slice(-4)},"%Z":function(h){return h.Sb},"%%":function(){return"%"}};for(n in m)c.includes(n)&&(c=c.replace(new RegExp(n,"g"),m[n](d)));n=pb(c, +!1);if(n.length>b)return 0;E.set(n,a);return n.length-1}function Hb(a,b,c,d){a||(a=this);this.parent=a;this.Ha=a.Ha;this.Qa=null;this.id=zb++;this.name=b;this.mode=c;this.ra={};this.va={};this.rdev=d}Object.defineProperties(Hb.prototype,{read:{get:function(){return 365===(this.mode&365)},set:function(a){a?this.mode|=365:this.mode&=-366}},write:{get:function(){return 146===(this.mode&146)},set:function(a){a?this.mode|=146:this.mode&=-147}}});Wb();Ab=Array(4096);Pb(K,"/");O("/tmp");O("/home");O("/home/web_user"); +(function(){O("/dev");nb(259,{read:function(){return 0},write:function(b,c,d,e){return e}});Rb("/dev/null",259);mb(1280,qb);mb(1536,rb);Rb("/dev/tty",1280);Rb("/dev/tty1",1536);var a=jb();Zb("random",a);Zb("urandom",a);O("/dev/shm");O("/dev/shm/tmp")})(); +(function(){O("/proc");var a=O("/proc/self");O("/proc/self/fd");Pb({Ha:function(){var b=tb(a,"fd",16895,73);b.ra={lookup:function(c,d){var e=yb[+d];if(!e)throw new J(8);c={parent:null,Ha:{qb:"fake"},ra:{readlink:function(){return e.path}}};return c.parent=c}};return b}},"/proc/self/fd")})();for(var td=Array(256),ud=0;256>ud;++ud)td[ud]=String.fromCharCode(ud);ec=td;lc=k.BindingError=kc("BindingError");mc=k.InternalError=kc("InternalError"); +wc.prototype.isAliasOf=function(a){if(!(this instanceof wc&&a instanceof wc))return!1;var b=this.qa.wa.ua,c=this.qa.ta,d=a.qa.wa.ua;for(a=a.qa.ta;b.Da;)c=b.Wa(c),b=b.Da;for(;d.Da;)a=d.Wa(a),d=d.Da;return b===d&&c===a}; +wc.prototype.clone=function(){this.qa.ta||oc(this);if(this.qa.Ua)return this.qa.count.value+=1,this;var a=sc,b=Object,c=b.create,d=Object.getPrototypeOf(this),e=this.qa;a=a(c.call(b,d,{qa:{value:{count:e.count,Pa:e.Pa,Ua:e.Ua,ta:e.ta,wa:e.wa,Ba:e.Ba,Ca:e.Ca}}}));a.qa.count.value+=1;a.qa.Pa=!1;return a};wc.prototype["delete"]=function(){this.qa.ta||oc(this);this.qa.Pa&&!this.qa.Ua&&R("Object already scheduled for deletion");qc(this);rc(this.qa);this.qa.Ua||(this.qa.Ba=void 0,this.qa.ta=void 0)}; +wc.prototype.isDeleted=function(){return!this.qa.ta};wc.prototype.deleteLater=function(){this.qa.ta||oc(this);this.qa.Pa&&!this.qa.Ua&&R("Object already scheduled for deletion");uc.push(this);1===uc.length&&tc&&tc(vc);this.qa.Pa=!0;return this};U.prototype.yb=function(a){this.sb&&(a=this.sb(a));return a};U.prototype.lb=function(a){this.Na&&this.Na(a)};U.prototype.argPackAdvance=8;U.prototype.readValueFromPointer=Hc;U.prototype.deleteObject=function(a){if(null!==a)a["delete"]()}; +U.prototype.fromWireType=function(a){function b(){return this.Ya?Lc(this.ua.Ja,{wa:this.Db,ta:c,Ca:this,Ba:a}):Lc(this.ua.Ja,{wa:this,ta:a})}var c=this.yb(a);if(!c)return this.lb(a),null;var d=Kc(this.ua,c);if(void 0!==d){if(0===d.qa.count.value)return d.qa.ta=c,d.qa.Ba=a,d.clone();d=d.clone();this.lb(a);return d}d=this.ua.xb(c);d=xc[d];if(!d)return b.call(this);d=this.Xa?d.vb:d.pointerType;var e=Ic(c,this.ua,d.ua);return null===e?b.call(this):this.Ya?Lc(d.ua.Ja,{wa:d,ta:e,Ca:this,Ba:a}):Lc(d.ua.Ja, +{wa:d,ta:e})};k.getInheritedInstanceCount=function(){return Object.keys(Jc).length};k.getLiveInheritedInstances=function(){var a=[],b;for(b in Jc)Jc.hasOwnProperty(b)&&a.push(Jc[b]);return a};k.flushPendingDeletes=vc;k.setDelayFunction=function(a){tc=a;uc.length&&tc&&tc(vc)};Oc=k.UnboundTypeError=kc("UnboundTypeError");k.count_emval_handles=function(){for(var a=0,b=5;b>2]);C[b>>2]=a.getUTCSeconds();C[b+4>>2]=a.getUTCMinutes();C[b+8>>2]=a.getUTCHours();C[b+12>>2]=a.getUTCDate();C[b+16>>2]=a.getUTCMonth();C[b+20>>2]=a.getUTCFullYear()-1900;C[b+24>>2]=a.getUTCDay();C[b+36>>2]=0;C[b+32>>2]=0;C[b+28>>2]=(a.getTime()-Date.UTC(a.getUTCFullYear(),0,1,0,0,0,0))/864E5|0;$a||($a=Fa("GMT"));C[b+40>>2]=$a;return b},G:function(a,b){ab();a=new Date(1E3* +C[a>>2]);C[b>>2]=a.getSeconds();C[b+4>>2]=a.getMinutes();C[b+8>>2]=a.getHours();C[b+12>>2]=a.getDate();C[b+16>>2]=a.getMonth();C[b+20>>2]=a.getFullYear()-1900;C[b+24>>2]=a.getDay();var c=new Date(a.getFullYear(),0,1);C[b+28>>2]=(a.getTime()-c.getTime())/864E5|0;C[b+36>>2]=-(60*a.getTimezoneOffset());var d=(new Date(a.getFullYear(),6,1)).getTimezoneOffset();c=c.getTimezoneOffset();a=(d!=c&&a.getTimezoneOffset()==Math.min(c,d))|0;C[b+32>>2]=a;a=C[eb()+(a?4:0)>>2];C[b+40>>2]=a;return b},r:function(a, +b,c){ac=c;try{var d=cc(a);switch(b){case 0:var e=bc();return 0>e?-28:Tb(d.path,d.flags,0,e).fd;case 1:case 2:return 0;case 3:return d.flags;case 4:return e=bc(),d.flags|=e,0;case 12:return e=bc(),za[e+0>>1]=2,0;case 13:case 14:return 0;case 16:case 8:return-28;case 9:return C[vd()>>2]=28,-1;default:return-28}}catch(f){return"undefined"!==typeof P&&f instanceof J||r(f),-f.ya}},Q:function(a,b,c){try{var d=cc(a);if(!d.La){var e=N(d.path,{eb:!0}).node;if(!e.ra.readdir)throw new J(54);var f=e.ra.readdir(e); +d.La=f}a=0;for(var g=Vb(d,0,1),l=Math.floor(g/280);l>>0,(H=m,1<=+Math.abs(H)?0>>0:~~+Math.ceil((H-+(~~H>>>0))/4294967296)>>>0:0)];C[b+a>>2]=I[0];C[b+a+4>>2]=I[1];I=[280*(l+1)>>>0,(H=280*(l+1),1<=+Math.abs(H)?0>>0:~~+Math.ceil((H- ++(~~H>>>0))/4294967296)>>>0:0)];C[b+a+8>>2]=I[0];C[b+a+12>>2]=I[1];za[b+a+16>>1]=280;E[b+a+18>>0]=n;ua(q,A,b+a+19,256);a+=280;l+=1}Vb(d,280*l,0);return a}catch(v){return"undefined"!==typeof P&&v instanceof J||r(v),-v.ya}},M:function(a,b,c){ac=c;try{var d=cc(a);switch(b){case 21509:case 21505:return d.tty?0:-59;case 21510:case 21511:case 21512:case 21506:case 21507:case 21508:return d.tty?0:-59;case 21519:if(!d.tty)return-59;var e=bc();return C[e>>2]=0;case 21520:return d.tty?-28:-59;case 21531:a= +e=bc();if(!d.va.Bb)throw new J(59);return d.va.Bb(d,b,a);case 21523:return d.tty?0:-59;case 21524:return d.tty?0:-59;default:r("bad ioctl syscall "+b)}}catch(f){return"undefined"!==typeof P&&f instanceof J||r(f),-f.ya}},I:function(a,b){try{return a=z(a),a=gb(a),"/"===a[a.length-1]&&(a=a.substr(0,a.length-1)),O(a,b),0}catch(c){return"undefined"!==typeof P&&c instanceof J||r(c),-c.ya}},s:function(a,b,c){ac=c;try{var d=z(a),e=c?bc():0;return Tb(d,b,e).fd}catch(f){return"undefined"!==typeof P&&f instanceof +J||r(f),-f.ya}},J:function(a,b,c){try{a=z(a);if(0>=c)var d=-28;else{var e=Cb(a),f=Math.min(c,va(e)),g=E[b+f];ua(e,A,b,c+1);E[b+f]=g;d=f}return d}catch(l){return"undefined"!==typeof P&&l instanceof J||r(l),-l.ya}},N:function(a){try{a=z(a);var b=N(a,{parent:!0}).node,c=ib(a),d=vb(b,c),e=Lb(b,c,!0);if(e)throw new J(e);if(!b.ra.rmdir)throw new J(63);if(d.Qa)throw new J(10);try{M.willDeletePath&&M.willDeletePath(a)}catch(f){y("FS.trackingDelegate['willDeletePath']('"+a+"') threw an exception: "+f.message)}b.ra.rmdir(b, +c);Fb(d);try{if(M.onDeletePath)M.onDeletePath(a)}catch(f){y("FS.trackingDelegate['onDeletePath']('"+a+"') threw an exception: "+f.message)}return 0}catch(f){return"undefined"!==typeof P&&f instanceof J||r(f),-f.ya}},P:function(a){try{a=z(a);var b=N(a,{parent:!0}).node,c=ib(a),d=vb(b,c),e=Lb(b,c,!1);if(e)throw new J(e);if(!b.ra.unlink)throw new J(63);if(d.Qa)throw new J(10);try{M.willDeletePath&&M.willDeletePath(a)}catch(f){y("FS.trackingDelegate['willDeletePath']('"+a+"') threw an exception: "+f.message)}b.ra.unlink(b, +c);Fb(d);try{if(M.onDeletePath)M.onDeletePath(a)}catch(f){y("FS.trackingDelegate['onDeletePath']('"+a+"') threw an exception: "+f.message)}return 0}catch(f){return"undefined"!==typeof P&&f instanceof J||r(f),-f.ya}},z:function(){},S:function(a,b,c,d,e){var f=dc(c);b=Q(b);T(a,{name:b,fromWireType:function(g){return!!g},toWireType:function(g,l){return l?d:e},argPackAdvance:8,readValueFromPointer:function(g){if(1===c)var l=E;else if(2===c)l=za;else if(4===c)l=C;else throw new TypeError("Unknown boolean type size: "+ +b);return this.fromWireType(l[g>>f])},Ga:null})},w:function(a,b,c,d,e,f,g,l,q,m,n,x,v){n=Q(n);f=V(e,f);l&&(l=V(g,l));m&&(m=V(q,m));v=V(x,v);var h=ic(n);zc(h,function(){Sc("Cannot construct "+n+" due to unbound types",[d])});S([a,b,c],d?[d]:[],function(t){t=t[0];if(d){var w=t.ua;var B=w.Ja}else B=wc.prototype;t=jc(h,function(){if(Object.getPrototypeOf(this)!==u)throw new lc("Use 'new' to construct "+n);if(void 0===D.Ka)throw new lc(n+" has no accessible constructor");var Pc=D.Ka[arguments.length]; +if(void 0===Pc)throw new lc("Tried to invoke ctor of "+n+" with invalid number of parameters ("+arguments.length+") - expected ("+Object.keys(D.Ka).toString()+") parameters instead!");return Pc.apply(this,arguments)});var u=Object.create(B,{constructor:{value:t}});t.prototype=u;var D=new Ac(n,t,u,v,w,f,l,m);w=new U(n,D,!0,!1);B=new U(n+"*",D,!1,!1);var Z=new U(n+" const*",D,!1,!0);xc[a]={pointerType:B,vb:Z};Mc(h,t);return[w,B,Z]})},i:function(a,b,c,d,e,f,g){var l=Wc(c,d);b=Q(b);f=V(e,f);S([],[a], +function(q){function m(){Sc("Cannot call "+n+" due to unbound types",l)}q=q[0];var n=q.name+"."+b;b.startsWith("@@")&&(b=Symbol[b.substring(2)]);var x=q.ua.constructor;void 0===x[b]?(m.Oa=c-1,x[b]=m):(yc(x,b,n),x[b].za[c-1]=m);S([],l,function(v){v=[v[0],null].concat(v.slice(1));v=Vc(n,v,null,f,g);void 0===x[b].za?(v.Oa=c-1,x[b]=v):x[b].za[c-1]=v;return[]});return[]})},W:function(a,b,c,d,e,f){0>>l}}var q=b.includes("unsigned");T(a,{name:b,fromWireType:f,toWireType:function(m,n){if("number"!==typeof n&& +"boolean"!==typeof n)throw new TypeError('Cannot convert "'+Dc(n)+'" to '+this.name);if(ne)throw new TypeError('Passing a number "'+Dc(n)+'" from JS side to C/C++ side to an argument of type "'+b+'", which is outside the valid range ['+d+", "+e+"]!");return q?n>>>0:n|0},argPackAdvance:8,readValueFromPointer:ad(b,g,0!==d),Ga:null})},e:function(a,b,c){function d(f){f>>=2;var g=F;return new e(Ha,g[f+1],g[f])}var e=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array, +Float64Array][b];c=Q(c);T(a,{name:c,fromWireType:d,argPackAdvance:8,readValueFromPointer:d},{zb:!0})},u:function(a,b){b=Q(b);var c="std::string"===b;T(a,{name:b,fromWireType:function(d){var e=F[d>>2];if(c)for(var f=d+4,g=0;g<=e;++g){var l=d+4+g;if(g==e||0==A[l]){f=z(f,l-f);if(void 0===q)var q=f;else q+=String.fromCharCode(0),q+=f;f=l+1}}else{q=Array(e);for(g=0;g>2]=g;if(c&&f)ua(e,A,l+4,g+1);else if(f)for(f=0;f>2],n=g(),x,v=q+4,h=0;h<=m;++h){var t=q+4+h*b;if(h==m||0==n[t>>l])v=d(v,t-v),void 0===x?x=v:(x+=String.fromCharCode(0),x+=v),v=t+b}W(q);return x},toWireType:function(q,m){"string"!==typeof m&&R("Cannot pass non-string to C++ string type "+c);var n=f(m),x=Ga(4+n+b);F[x>>2]= +n>>l;e(m,x+4,n+b);null!==q&&q.push(W,x);return x},argPackAdvance:8,readValueFromPointer:Hc,Ga:function(q){W(q)}})},T:function(a,b){b=Q(b);T(a,{Xb:!0,name:b,argPackAdvance:0,fromWireType:function(){},toWireType:function(){}})},X:Zc,v:function(a){4> +2]=28,-1;C[b>>2]=a/1E3|0;C[b+4>>2]=a%1E3*1E6|0;return 0},V:function(){r("To use dlopen, you need to use Emscripten's linking support, see https://github.com/emscripten-core/emscripten/wiki/Linking")},b:function(a,b,c){b=fd(b,c);b=ta(b,0);a&24&&(b=b.replace(/\s+$/,""),b+=(0>>=0;if(2147483648< +a)return!1;for(var c=1;4>=c;c*=2){var d=b*(1+.2/c);d=Math.min(d,a+100663296);d=Math.max(a,d);0>>16);Ka();var e=1;break a}catch(f){}e=void 0}if(e)return!0}return!1},m:function(a){eval(z(a))},O:function(a){return eval(z(a))|0},p:Y,E:function(a,b){try{var c=0;ld().forEach(function(d,e){var f=b+c;e=C[a+4*e>>2]=f;for(f=0;f>0]=d.charCodeAt(f);E[e>>0]=0;c+=d.length+1});return 0}catch(d){return"undefined"!== +typeof P&&d instanceof J||r(d),d.ya}},F:function(a,b){try{var c=ld();C[a>>2]=c.length;var d=0;c.forEach(function(e){d+=e.length+1});C[b>>2]=d;return 0}catch(e){return"undefined"!==typeof P&&e instanceof J||r(e),e.ya}},j:function(a){try{var b=cc(a);if(null===b.fd)throw new J(8);b.La&&(b.La=null);try{b.va.close&&b.va.close(b)}catch(c){throw c;}finally{yb[b.fd]=null}b.fd=null;return 0}catch(c){return"undefined"!==typeof P&&c instanceof J||r(c),c.ya}},L:function(a,b,c,d){try{a:{for(var e=cc(a),f=a=0;f< +c;f++){var g=C[b+(8*f+4)>>2],l=e,q=C[b+8*f>>2],m=g,n=void 0,x=E;if(0>m||0>n)throw new J(28);if(null===l.fd)throw new J(8);if(1===(l.flags&2097155))throw new J(8);if(L(l.node.mode))throw new J(31);if(!l.va.read)throw new J(28);var v="undefined"!==typeof n;if(!v)n=l.position;else if(!l.seekable)throw new J(70);var h=l.va.read(l,x,q,m,n);v||(l.position+=h);var t=h;if(0>t){var w=-1;break a}a+=t;if(t>2]=w;return 0}catch(B){return"undefined"!==typeof P&&B instanceof J||r(B),B.ya}},y:function(a, +b,c,d,e){try{var f=cc(a);a=4294967296*c+(b>>>0);if(-9007199254740992>=a||9007199254740992<=a)return-61;Vb(f,a,d);I=[f.position>>>0,(H=f.position,1<=+Math.abs(H)?0>>0:~~+Math.ceil((H-+(~~H>>>0))/4294967296)>>>0:0)];C[e>>2]=I[0];C[e+4>>2]=I[1];f.La&&0===a&&0===d&&(f.La=null);return 0}catch(g){return"undefined"!==typeof P&&g instanceof J||r(g),g.ya}},K:function(a,b,c,d){try{a:{for(var e=cc(a),f=a=0;f>2],q=C[b+(8*f+4)>>2], +m=void 0,n=E;if(0>q||0>m)throw new J(28);if(null===g.fd)throw new J(8);if(0===(g.flags&2097155))throw new J(8);if(L(g.node.mode))throw new J(31);if(!g.va.write)throw new J(28);g.seekable&&g.flags&1024&&Vb(g,0,2);var x="undefined"!==typeof m;if(!x)m=g.position;else if(!g.seekable)throw new J(70);var v=g.va.write(g,n,l,q,m,void 0);x||(g.position+=v);try{if(g.path&&M.onWriteToFile)M.onWriteToFile(g.path)}catch(w){y("FS.trackingDelegate['onWriteToFile']('"+g.path+"') threw an exception: "+w.message)}var h= +v;if(0>h){var t=-1;break a}a+=h}t=a}C[d>>2]=t;return 0}catch(w){return"undefined"!==typeof P&&w instanceof J||r(w),w.ya}},k:function(a){ab();var b=new Date(C[a+20>>2]+1900,C[a+16>>2],C[a+12>>2],C[a+8>>2],C[a+4>>2],C[a>>2],0),c=C[a+32>>2],d=b.getTimezoneOffset(),e=new Date(b.getFullYear(),0,1),f=(new Date(b.getFullYear(),6,1)).getTimezoneOffset(),g=e.getTimezoneOffset(),l=Math.min(g,f);0>c?C[a+32>>2]=Number(f!=g&&l==d):0> +2]=b.getDay();C[a+28>>2]=(b.getTime()-e.getTime())/864E5|0;C[a>>2]=b.getSeconds();C[a+4>>2]=b.getMinutes();C[a+8>>2]=b.getHours();C[a+12>>2]=b.getDate();C[a+16>>2]=b.getMonth();return b.getTime()/1E3|0},A:function(){},U:sd,D:function(a,b,c,d){return sd(a,b,c,d)},h:function(a){var b=Date.now()/1E3|0;a&&(C[a>>2]=b);return b}}; +(function(){function a(e){k.asm=e.exports;qa=k.asm.Y;Ka();La=k.asm.ha;Na.unshift(k.asm.Z);Qa--;k.monitorRunDependencies&&k.monitorRunDependencies(Qa);0==Qa&&(null!==Ra&&(clearInterval(Ra),Ra=null),Sa&&(e=Sa,Sa=null,e()))}function b(e){a(e.instance)}function c(e){return Wa().then(function(f){return WebAssembly.instantiate(f,d)}).then(e,function(f){y("failed to asynchronously prepare wasm: "+f);r(f)})}var d={a:wd};Qa++;k.monitorRunDependencies&&k.monitorRunDependencies(Qa);if(k.instantiateWasm)try{return k.instantiateWasm(d, +a)}catch(e){return y("Module.instantiateWasm callback failed with error: "+e),!1}(function(){return pa||"function"!==typeof WebAssembly.instantiateStreaming||Ta()||G.startsWith("file://")||"function"!==typeof fetch?c(b):fetch(G,{credentials:"same-origin"}).then(function(e){return WebAssembly.instantiateStreaming(e,d).then(b,function(f){y("wasm streaming compile failed: "+f);y("falling back to ArrayBuffer instantiation");return c(b)})})})();return{}})(); +k.___wasm_call_ctors=function(){return(k.___wasm_call_ctors=k.asm.Z).apply(null,arguments)};var gd=k._strlen=function(){return(gd=k._strlen=k.asm._).apply(null,arguments)},Ga=k._malloc=function(){return(Ga=k._malloc=k.asm.$).apply(null,arguments)},vd=k.___errno_location=function(){return(vd=k.___errno_location=k.asm.aa).apply(null,arguments)},W=k._free=function(){return(W=k._free=k.asm.ba).apply(null,arguments)},Rc=k.___getTypeName=function(){return(Rc=k.___getTypeName=k.asm.ca).apply(null,arguments)}; +k.___embind_register_native_and_builtin_types=function(){return(k.___embind_register_native_and_builtin_types=k.asm.da).apply(null,arguments)};var eb=k.__get_tzname=function(){return(eb=k.__get_tzname=k.asm.ea).apply(null,arguments)},db=k.__get_daylight=function(){return(db=k.__get_daylight=k.asm.fa).apply(null,arguments)},cb=k.__get_timezone=function(){return(cb=k.__get_timezone=k.asm.ga).apply(null,arguments)};k.dynCall_jiji=function(){return(k.dynCall_jiji=k.asm.ia).apply(null,arguments)}; +k.dynCall_viiiiiiji=function(){return(k.dynCall_viiiiiiji=k.asm.ja).apply(null,arguments)};k.dynCall_viiijj=function(){return(k.dynCall_viiijj=k.asm.ka).apply(null,arguments)};k.dynCall_viiiiiijjii=function(){return(k.dynCall_viiiiiijjii=k.asm.la).apply(null,arguments)};k.dynCall_iiiiij=function(){return(k.dynCall_iiiiij=k.asm.ma).apply(null,arguments)};k.dynCall_iiiiijj=function(){return(k.dynCall_iiiiijj=k.asm.na).apply(null,arguments)}; +k.dynCall_iiiiiijj=function(){return(k.dynCall_iiiiiijj=k.asm.oa).apply(null,arguments)};k.dynCall_viijii=function(){return(k.dynCall_viijii=k.asm.pa).apply(null,arguments)};var xd;Sa=function yd(){xd||zd();xd||(Sa=yd)}; +function zd(){function a(){if(!xd&&(xd=!0,k.calledRun=!0,!ra)){k.noFSInit||Xb||(Xb=!0,Wb(),k.stdin=k.stdin,k.stdout=k.stdout,k.stderr=k.stderr,k.stdin?Zb("stdin",k.stdin):Sb("/dev/tty","/dev/stdin"),k.stdout?Zb("stdout",null,k.stdout):Sb("/dev/tty","/dev/stdout"),k.stderr?Zb("stderr",null,k.stderr):Sb("/dev/tty1","/dev/stderr"),Tb("/dev/stdin",0),Tb("/dev/stdout",1),Tb("/dev/stderr",1));Bb=!1;Xa(Na);if(k.onRuntimeInitialized)k.onRuntimeInitialized();if(k.postRun)for("function"==typeof k.postRun&& +(k.postRun=[k.postRun]);k.postRun.length;){var b=k.postRun.shift();Oa.unshift(b)}Xa(Oa)}}if(!(0f&&(f=Math.max(f+x,0));f{const a=!!("object"==typeof global&&global.process&&global.process.release&&global.process.release.name);a&&(global.self=global);var b;a&&(b=require("worker_threads"));let f=a?b.parentPort:self,z,x,D,P=!1,Y,Z,V,ca,I,Q=0,R=0;const Aa=(a,b)=>{b>Q&&(R&&Module._free(R),R=Module._malloc(b),Q=b);Module.HEAPU8.set(a.subarray(0,b),R)};let sa,Ba=new Promise(a=>{sa=a}),ta=!1,Ca=()=>$jscomp.asyncExecutePromiseGeneratorFunction(function*(){if(ta)throw"can't load wasm twice";ta=!0;J("wasm loading...");Y= +Date.now();yield new Promise(b=>{self.KModule=self.Module={locateFile:function(b){return"libDynamsoftBarcodeReader.wasm"==b?a?x+"dbr-"+D+".node.wasm":x+"dbr-"+D+(P?".full":"")+".wasm":x+b},print:a=>{J(a)},printErr:a=>{console.error(a);J(a)},onRuntimeInitialized:function(){return $jscomp.asyncExecutePromiseGeneratorFunction(function*(){J("wasm initialized, cost "+(Date.now()-Y)+" ms");a||(Module=KModule);sa();b()})}};if(a){let a=Module;Module=require("./dbr-"+D+".node.wasm.js");for(let b in a)Module[b]= +a[b]}else importScripts(x+"dbr-"+D+(P?".full":"")+".wasm.js")})}),W=a=>$jscomp.asyncExecutePromiseGeneratorFunction(function*(){yield Ba;V=a.trial;ca=a.msg;Module.BarcodeReaderWasm.init(JSON.stringify(a))}),Da=()=>Module.BarcodeReaderWasm.getMinExpireTime(),Xa=()=>Module.BarcodeReaderWasm.getMaxExpireTime(),y=new Map,Ya=0;b=function(b){return $jscomp.asyncExecutePromiseGeneratorFunction(function*(){const n=b.data?b.data:b;var p=n.id,l=n.instanceID,q=n.body;!Z||"decodeBuffer"!=n.type&&"decodeFileInMemory"!= +n.type||(yield I.c());switch(n.type){case "loadWasm":try{z=n.bd;x=n.engineResourcePath;P=n.bUseFullFeature;D=n.version;let a=n.dm,b=n.pk;Z=n.brtk;let q=n.bptk;Ca();let l;p=()=>$jscomp.asyncExecutePromiseGeneratorFunction(function*(){try{I=(a=>{const b=!!("object"==typeof global&&global.process&&global.process.release&&global.process.release.name);let e=a.dwt?Dynamsoft.Lib.Promise:self.Promise,f=a.btoa||(b?global.btoa||(a=>Buffer.from(a,"binary").toString("base64")):self.btoa),h=a.atob||(b?global.atob|| +(a=>Buffer.from(a,"base64").toString("binary")):self.atob),p,q=a.product,z,l,n,y,x,C,A,G,D,ka,H=["https://mlts.dynamsoft.com/","https://slts.dynamsoft.com/"],I,F,J,E,P,L,R=!1,Y=e.resolve(),M=a.lf,ha,K,S,aa,Z=a.log||(()=>{}),N=a.dwt?u=>{try{a.debugLog&&a.debugLog(u)}catch(m){}}:a.debugLog||(()=>{}),ia=a.fol,Q,la,V,ca=a.sutlcb;Date.prototype.kUtilFormat=function(a){var u={"M+":this.getUTCMonth()+1,"d+":this.getUTCDate(),"H+":this.getUTCHours(),"h+":this.getUTCHours()%12||12,"m+":this.getUTCMinutes(), +"s+":this.getUTCSeconds(),"q+":Math.floor((this.getUTCMonth()+3)/3),"S+":this.getUTCMilliseconds()};/(y+)/.test(a)&&(a=a.replace(RegExp.$1,(this.getUTCFullYear()+"").substr(4-RegExp.$1.length)));for(var b in u)(new RegExp("("+b+")")).test(a)&&(a=a.replace(RegExp.$1,1==RegExp.$1.length?u[b]:("000"+u[b]).substr(("000"+u[b]).length-RegExp.$1.length)));return a};let ea,v=a=>a.join("");var ra=[80,88,27,82,145,164,199,211],sa=[187,87,89,128,150,44,190,213],X=[89,51,74,53,99,72,82,118],ta=[99,181,118,158, +215,103,76,117],ba=[99,51,86,105,100,71,120,108],Ea=[97,87,49,119,98,51,74,48,83,50,86,53],Fa=[81,85,86,84,76,85,100,68,84,81,32,32],W=[90,87,53,106,99,110,108,119,100,65,32,32],fa=[90,71,86,106,99,110,108,119,100,65,32,32],Na=[97,88,89,32],Aa=[29,83,122,137,5,180,157,114],Oa=[100,71,70,110,84,71,86,117,90,51,82,111];let Pa=()=>self[v(X)][v(ba)][v(Ea)]("raw",new Uint8Array(ra.concat(sa,ta,Aa)),v(Fa),!0,[v(W),v(fa)]),Qa=a.fdaa||(a=>$jscomp.asyncExecutePromiseGeneratorFunction(function*(){if(self[v(X)]&& +self[v(X)][v(ba)]&&self[v(X)][v(ba)][v(Ea)]){var b=h(a),u=new Uint8Array(b.length);for(let a=0;a$jscomp.asyncExecutePromiseGeneratorFunction(function*(){if(self[v(X)]&&self[v(X)][v(ba)]&&self[v(X)][v(ba)][v(Ea)]){var b=new Uint8Array(a.length);for(var u= +0;uh(h(a.replace(/\n/g,"+").replace(/\s/g,"=")).substring(1)),Ha=a=>f(String.fromCharCode(97+25*Math.random())+f(a)).replace(/\+/g,"\n").replace(/=/g," "),O,Sa=()=>{if(O)return O;if(self.crypto){let a= +new Uint8Array(36);self.crypto.getRandomValues(a);let b="";for(let u=0;36>u;++u){let e=a[u]%36;b=10>e?b+e:b+String.fromCharCode(e+87)}return b}return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var b=16*Math.random()|0;return("x"==a?b:b&3|8).toString(16)})},Ba=()=>{M||self.localforage||(b?(global.localforage=require("node-localstorage").LocalStorage,global.localforage.prototype.keys=function(){let a=[];for(let b=0;b=c.oldVersion&&d.createObjectStore(S)}catch(U){if("ConstraintError"!==U.name)throw U;console.warn('The database "'+a.name+'" has been upgraded from version '+ +c.oldVersion+" to version "+c.newVersion+', but the storage "'+a.storeName+'" already exists.')}});k.onerror=function(a){a.preventDefault();b(k.error)};k.onsuccess=function(){c(k.result);z(a)}})}function A(a,d){if(!a.db)return!0;var c=!a.db.objectStoreNames.contains(a.storeName),b=a.version>a.db.version;return(a.versiona.version&&(a.version=d)),!0):!1}function D(a){return new t(function(c,g){var d=new FileReader;d.onerror=g;d.onloadend=function(d){d=f(d.target.result||"");c({__local_forage_encoded_blob:!0,data:d,type:a.type})};d.readAsBinaryString(a)})}function ka(a){for(var c=h(a.data),g=c.length,b=new ArrayBuffer(g),B=new Uint8Array(b),k=0;k>4;k[w++]=(15&pa)<<4|U>>2;k[w++]=(3&U)<<6|63&f}return B}function H(a){var c=new Uint8Array(a),b="";for(a=0;a>2],b+=ja[(3&c[a])<<4|c[a+1]>>4],b+=ja[(15&c[a+1])<<2|c[a+2]>>6],b+=ja[63&c[a+2]];return 2==c.length%3?b=b.substring(0,b.length-1)+"=":1==c.length%3&&(b=b.substring(0,b.length-2)+"=="),b}function K(a,b,g,w){a.executeSql("CREATE TABLE IF NOT EXISTS "+ +b.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],g,w)}function F(a,b,g,w,B,k){a.executeSql(g,w,B,function(a,c){c.code===c.SYNTAX_ERR?a.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[b.storeName],function(a,d){d.rows.length?k(a,c):K(a,b,function(){a.executeSql(g,w,B,k)},k)},k):k(a,c)},k)}function L(a,b,g,w){var c=this;a=n(a);var d=new t(function(d,k){c.ready().then(function(){void 0===b&&(b=null);var e=b,B=c._dbInfo;B.serializer.serialize(b,function(b,U){U? +k(U):B.db.transaction(function(c){F(c,B,"INSERT OR REPLACE INTO "+B.storeName+" (key, value) VALUES (?, ?)",[a,b],function(){d(e)},function(a,c){k(c)})},function(b){if(b.code===b.QUOTA_ERR){if(0 '__WebKitDatabaseInfoTable__'",[],function(b,d){b=[];for(var g=0;ga)return void b(null);c.ready().then(function(){da(c._dbInfo,"readonly",function(g,e){if(g)return d(g);try{var k=!1,w=e.objectStore(c._dbInfo.storeName).openCursor(); +w.onsuccess=function(){var c=w.result;if(!c)return void b(null);0===a?b(c.key):k?b(c.key):(k=!0,c.advance(a))};w.onerror=function(){d(w.error)}}catch(Ja){d(Ja)}})}).catch(d)});return r(d,b),d},keys:function(a){var b=this,c=new t(function(a,c){b.ready().then(function(){da(b._dbInfo,"readonly",function(d,g){if(d)return c(d);try{var e=g.objectStore(b._dbInfo.storeName).openCursor(),k=[];e.onsuccess=function(){var b=e.result;if(!b)return void a(k);k.push(b.key);b.continue()};e.onerror=function(){c(e.error)}}catch(qa){c(qa)}})}).catch(c)}); +return r(c,a),c},dropInstance:function(a,b){b=l.apply(this,arguments);var c=this.config();a="function"!=typeof a&&a||{};a.name||(a.name=a.name||c.name,a.storeName=a.storeName||c.storeName);a.name?(c=a.name===c.name&&this._dbInfo.db?t.resolve(this._dbInfo.db):C(a,!1).then(function(b){var c=T[a.name],d=c.forages;c.db=b;for(c=0;c$jscomp.asyncExecutePromiseGeneratorFunction(function*(){Ba(); +b&&(global.fetch=global.fetch||require("node-fetch"),global.crypto=global.crypto||require("crypto").webcrypto);v=a=>h(String.fromCharCode.apply(null,a).replace(/\n/g,"+").replace(/\s/g,"="));try{yield(yield M.createInstance({name:q+"jshello"})).setItem(q+"jshello","available")}catch(u){throw u;}K=yield M.createInstance({name:"dynamltsinfo"});S=O?null:f(f("v2")+String.fromCharCode(A.charCodeAt(A.length/2)+1)+f(A));aa=f(String.fromCharCode((n||y).charCodeAt(0)+10)+f(q)+f(n||y)+l+f(C));if(!O){try{let a= +yield K.getItem(S);a&&([G,E]=JSON.parse(yield Ga(a)))}catch(u){}try{null==G&&(G=Sa())}catch(u){}}ha=yield M.createInstance({name:"dynamltsuns"+f(String.fromCharCode((n||y).charCodeAt(0)+10)+f(q)+f(n||y)+l+f(C))});try{x=yield K.getItem(aa)}catch(u){}}),va,wa=u=>$jscomp.asyncExecutePromiseGeneratorFunction(function*(){va||(va=(()=>$jscomp.asyncExecutePromiseGeneratorFunction(function*(){try{let a={hs:n,og:y,pd:q,vm:l,dt:C||(b?"server":"browser"),ed:"javascript",cu:G,ad:A,os:JSON.stringify(D),fn:ka}, +h={};if(E&&!O){let a=yield K.getItem(S);a&&([G,E]=JSON.parse(yield Ga(a)));h["lts-time"]=E}I&&(a.sp=I);F&&(a.lm=F);J&&(a.cw=J);x=yield e.race([(()=>$jscomp.asyncExecutePromiseGeneratorFunction(function*(){let b=(new Date).kUtilFormat("yyyy-MM-ddTHH:mm:ss.SSSZ");E&&!O&&(K.setItem(S,yield Ha(JSON.stringify([G,b]))),E=b);let m;var r="auth/?ext="+encodeURIComponent(f(JSON.stringify(a)));let p=!1,q=!1,l,v=a=>$jscomp.asyncExecutePromiseGeneratorFunction(function*(){if(a&&!a.ok)try{let b=yield a.text(); +if(b){let a=JSON.parse(b);a.errorCode&&(l=a,100a.errorCode&&(x=null,q=p=!0))}}catch(ab){}});try{m=yield e.race([fetch(H[0]+r,{headers:h,cache:u?"reload":"default",mode:"cors",timeout:1E4}),new e((a,b)=>{setTimeout(b,1E4)})]),yield v(m)}catch(Ia){}if(!(E||m&&m.ok||p))try{m=yield fetch(H[1]+r,{headers:h,mode:"cors",timeout:3E4}),yield v(m)}catch(Ia){}if(!(E||m&&m.ok||p))try{m=yield fetch(H[0]+r,{headers:h,mode:"cors",timeout:3E4}),yield v(m)}catch(Ia){}l&&151==l.errorCode&&(O||K.removeItem(S), +K.removeItem(aa),G=Sa(),a.cu=G,E=void 0,r=encodeURIComponent(f(JSON.stringify(a))),m=yield fetch(H[0]+"auth/?ext="+r,{headers:h,mode:"cors",timeout:3E4}),yield v(m));(()=>{if(!m||!m.ok){q&&K.setItem(aa,"");if(l)if(111==l.errorCode)var a=l.message;else a=l.message.trim(),a.endsWith(".")||(a+="."),a=n||y?`An error occurred during authorization: ${a} Contact the site administrator for more information.`:`An error occurred during authorization: ${a} [Contact Dynamsoft](https://www.dynamsoft.com/company/contact/) for more information.`; +else a=n||y?"Failed to connect to the License Tracking Server: network connection error. Check your Internet connection or contact the site administrator for more information.":"Failed to connect to the License Tracking Server: network connection error. Check your Internet connection or [contact Dynamsoft](https://www.dynamsoft.com/company/contact/) for more information.";a=Error(a);l&&l.errorCode&&(a.ltsErrorCode=l.errorCode);throw a;}})();r=yield m.text();try{E||O||(K.setItem(S,yield Ha(JSON.stringify([G, +b]))),E=b),K.setItem(aa,r)}catch(Ia){}return r}))(),new e((a,b)=>{let e;e=n||y?"Failed to connect to the License Tracking Server: network timed out. Check your Internet connection or contact the site administrator for more information.":"Failed to connect to the License Tracking Server: network timed out. Check your Internet connection or [contact Dynamsoft](https://www.dynamsoft.com/company/contact/) for more information.";setTimeout(()=>b(Error(e)),x?3E3:15E3)})])}catch(m){p&&(a.dwt?self.console.error(m): +console.error(m)),L=m}P=(new Date).kUtilFormat("yyyy-MM-ddTHH:mm:ss.SSSZ");va=null}))(),fetch(H[0]+"verify",{mode:"cors",method:"POST",body:"[]",headers:{"Content-Type":"application/json","lts-time":"options"},timeout:3E4}));yield va}),xa,ya=()=>$jscomp.asyncExecutePromiseGeneratorFunction(function*(){xa||(xa=(()=>$jscomp.asyncExecutePromiseGeneratorFunction(function*(){N(G);if(x){L&&ia&&(ia(L),ia=null);var b={dm:A};p&&(b.bd=!0);b.brtk=!0;b.ls=H[0];n&&(b.hs=n);y&&(b.og=y);b.cu=G;ka&&(b.fn=ka);q&& +(b.product=q);C&&(b.dt=C);J&&(b.cw=J);D&&(b.os=JSON.stringify(D));N(x);try{if(a.dwt)b.ar=x;else{let a=JSON.parse(yield Qa(x));a.ba&&(b.ba=a.ba);a.usu&&(b.usu=a.usu);a.trial&&(b.trial=a.trial);a.its&&(b.its=a.its);1==b.trial&&a.msg?b.msg=a.msg:L?b.msg=L.message||L:a.msg&&(b.msg=a.msg);b.ar=a.in}b.bafc=!!L}catch(m){}N(b);try{yield Q(b)}catch(m){}yield Va();R||(R=!0);xa=null}else if(!R)throw Z(L.message),L;}))());yield xa}),Va=()=>$jscomp.asyncExecutePromiseGeneratorFunction(function*(){let a=(new Date).kUtilFormat("yyyy-MM-ddTHH:mm:ss.SSSZ"), +b=yield V();N(b);if(b&&b{Wa=a}),Ma=null,za=(a,b)=>$jscomp.asyncExecutePromiseGeneratorFunction(function*(){Y= +Y.then(()=>$jscomp.asyncExecutePromiseGeneratorFunction(function*(){let f=!1;try{let u=yield ha.keys();b||(La?a&&(u=u.filter(b=>b{const f=new XMLHttpRequest;f.responseType="json";f.timeout=3E4;f.onload=()=>{b({ok:!0,json:()=>f.response})};f.onerror=f.timeout=f.onabort=()=>{b({ok:!1,status:f.status})};f.upload.onloadend=()=>{Wa()};f.open("POST",H[0]+"verify",!0);for(let b in a)f.setRequestHeader(b,a[b]);f.send(JSON.stringify(m))}):yield fetch(H[0]+"verify",{mode:"cors",method:"POST",body:JSON.stringify(m),headers:a,timeout:3E4});if(u.ok){E= +l;for(h=0;hP&&(yield wa(!0),yield ya())}else throw Error("verify failed. Status Code: "+u.status);}catch(Ta){throw ia&&(ia(Ta),ia=null),Ta;}}ca&&ca()}}catch(ma){}}));return yield Y});return{i:a=>$jscomp.asyncExecutePromiseGeneratorFunction(function*(){p=a.bd;z=a.version;l=z.split(".")[0];a.dt&&(C=a.dt);A=a.dm;n=a.pk;y=a.og;D=a.browserInfo;ka=a.deviceFriendlyName;a.ls&&a.ls.length&&(H=a.ls,1==H.length&&H.push(H[0]));I=a.sp; +F=a.lm;J=a.cw;a.lf&&(M=a.lf);a.lsu&&(G=O=a.lsu);a.fdaa&&(Qa=a.fdaa);a.feab&&(Ra=a.feab);Q=a.updateLicense;la=a.getMinExpireTime;V=a.getMaxExpireTime;a.sutlcb&&(ca=a.sutlcb);yield Ca();yield wa();yield ya();L||za(null,!0);return{ar:x,cu:G}}),c:()=>$jscomp.asyncExecutePromiseGeneratorFunction(function*(){var a=new Date,b=a.kUtilFormat("yyyy-MM-ddTHH:mm:ss.SSSZ");let e=yield la(),f=yield V();f&&fya()))}),s:(b,e,f,h)=>$jscomp.asyncExecutePromiseGeneratorFunction(function*(){if(a.dwt&&!e)yield za(f);else{try{let a=e.startsWith("{")&&e.endsWith("}")?yield Ra(e):e;a?yield ha.setItem(f,a):N("ept ecpt")}catch(ma){}h&&(yield za(f));Ma&&clearTimeout(Ma);Ma=setTimeout(()=>$jscomp.asyncExecutePromiseGeneratorFunction(function*(){yield za()}),36E4)}}),caret:Va,pdsf:Da}})({product:"dbr",log:J,debugLog:fa}),self.scsd=I.s,n.updateLicense=W,n.getMinExpireTime=Da,n.getMaxExpireTime=Xa, +yield I.i(n)}catch(F){if(q)Z=!1,yield y(),l=F.ltsErrorCode,ca=F.message||F;else throw F;}});let y=()=>$jscomp.asyncExecutePromiseGeneratorFunction(function*(){let e={pk:b,dm:a};z&&(e.bd=!0);yield W(e)});Z?yield p():yield y();f.postMessage({type:"load",success:!0,version:Module.BarcodeReaderWasm.getVersion(),trial:V,ltsErrorCode:l,message:ca})}catch(e){f.postMessage({type:"load",success:!1,ltsErrorCode:e&&e.ltsErrorCode,message:e&&e.message,trial:V,stack:z&&e?e.stack:null})}break;case "createInstance":l= +Ya++;try{var C=new Module.BarcodeReaderWasm(n.bScanner,l);y.set(l,C);let b=JSON.parse(C.getRuntimeSettings());n.bScanner?(b.localizationModes=[2,0,0,0,0,0,0,0],b.deblurLevel=0):(b.expectedBarcodesCount=512,b.scaleDownThreshold=1E5,b.timeout=1E5);a||P||(b.barcodeFormatIds=235931647);C.updateRuntimeSettings(JSON.stringify(b))}catch(e){A(e,p);break}f.postMessage({type:"task",id:p,body:{success:!0,instanceID:l}});break;case "destroy":try{y.get(l).delete(),y.delete(l)}catch(e){A(e,p);break}f.postMessage({type:"task", +id:p,body:{success:!0}});break;case "decodeBuffer":{C=Date.now();let a,b,n,x;try{a=z?Date.now():0,Aa(q.buffer,q.stride*q.height),b=z?Date.now():0,x=JSON.parse(y.get(l).decodeBufferPtr(R,q.width,q.height,q.stride,q.format)),n=Date.now()}catch(ra){A(ra,p);break}I&&I.pdsf&&(yield Promise.race([I.pdsf,new Promise(a=>{setTimeout(()=>{a();I.pdsf=null},500)})]));f.postMessage({type:"task",id:p,body:{success:!0,decodeReturn:x,buffer:q.buffer,duration:n-C}},[q.buffer.buffer]);fa(["timeWorkerGetMsg: "+C,"timeBeforeSendBufferToWasm: "+ +a+" "+(a-C),"timeBeforeDecode: "+b+" "+(b-a),"timefinishDecode: "+n+" "+(n-b)].join("\n"));break}case "decodeFileInMemory":{let a,b,n;try{b=z?Date.now():0,a=JSON.parse(y.get(l).decodeFileInMemory(q.bytes)),n=z?Date.now():0}catch(la){A(la,p);break}f.postMessage({type:"task",id:p,body:{success:!0,decodeReturn:a,duration:n-b}});break}case "clearMapDecodeRecord":try{y.get(l).clearMapDecodeRecord()}catch(e){A(e,p);break}f.postMessage({type:"task",id:p,body:{success:!0}});break;case "getRuntimeSettings":{let a; +try{a=y.get(l).getRuntimeSettings()}catch(h){A(h,p);break}f.postMessage({type:"task",id:p,body:{success:!0,results:a}});break}case "updateRuntimeSettings":{let a;try{a=JSON.parse(y.get(l).updateRuntimeSettings(q.settings))}catch(h){A(h,p);break}f.postMessage({type:"task",id:p,body:{success:!0,updateReturn:a}});break}case "resetRuntimeSettings":try{let a=y.get(l);a.resetRuntimeSettings();let b=JSON.parse(a.getRuntimeSettings());a.bScanner?(b.localizationModes=[2,0,0,0,0,0,0,0],b.deblurLevel=0,b.barcodeZoneMinDistanceToImageBorders= +9):(b.expectedBarcodesCount=512,b.scaleDownThreshold=1E5,b.timeout=1E5);P||(b.barcodeFormatIds=235931647);a.updateRuntimeSettings(JSON.stringify(b))}catch(e){A(b,p);break}f.postMessage({type:"task",id:p,body:{success:!0}});break;case "outputSettingsToString":{let a;try{a=y.get(l).outputSettingsToString()}catch(h){A(h,p);break}f.postMessage({type:"task",id:p,body:{success:!0,results:a}});break}case "initRuntimeSettingsWithString":{let a;try{a=JSON.parse(y.get(l).initRuntimeSettingsWithString(q.settings))}catch(h){A(h, +p);break}f.postMessage({type:"task",id:p,body:{success:!0,initReturn:a}});break}case "getIntermediateResults":{let a=[];try{var Y=y.get(l).getIntermediateResults(),Q=JSON.parse(Y,(b,e)=>"bytes"===b&&"ptr"in e&&"length"in e?(b=Module.BarcodeReaderWasm.getBytes(e.ptr,e.length),b=b.slice(0),a.push(b.buffer),b):e)}catch(h){A(h,p);break}f.postMessage({type:"task",id:p,body:{success:!0,results:Q}},a);y.get(l).freeIntermediateResults();break}case "setModeArgument":{let a;try{a=JSON.parse(y.get(l).setModeArgument(q.modeName, +q.index,q.argumentName,q.argumentValue))}catch(h){A(h,p);break}f.postMessage({type:"task",id:p,body:{success:!0,setReturn:a}});break}case "getModeArgument":{let a;try{a=JSON.parse(y.get(l).getModeArgument(q.modeName,q.index,q.argumentName))}catch(h){A(h,p);break}f.postMessage({type:"task",id:p,body:{success:!0,getReturn:a}});break}case "updateScanSettings":try{let a=y.get(l),b=q.settings;a.duplicateForgetTime=b.duplicateForgetTime;a.oneDRememberFrameCount=b.oneDRememberFrameCount;a.oneDTrustFrameCount= +b.oneDTrustFrameCount;b.frameFilter?a.setFrameFilter(JSON.stringify(b.frameFilter)):a.setFrameFilter("")}catch(e){A(e,p);break}f.postMessage({type:"task",id:p,body:{success:!0}});break;case "getScanSettings":q={};try{let a=y.get(l);q.duplicateForgetTime=a.duplicateForgetTime;q.oneDRememberFrameCount=a.oneDRememberFrameCount;q.oneDTrustFrameCount=a.oneDTrustFrameCount;let b=a.getFrameFilter();b&&(q.frameFilter=JSON.parse(b))}catch(e){A(e,p);break}f.postMessage({type:"task",id:p,body:{success:!0,results:q}}); +break;default:console.warn("Unmatched task: ",b)}})};if(a)f.on("message",b);else f.onmessage=b;let J=a=>{f.postMessage({type:"log",message:a})},fa=a=>{z&&J(a)},A=(a,b)=>{f.postMessage({type:"task",id:b,body:{success:!1,message:a.message,stack:a.stack}});setTimeout(()=>{throw a;},0)}})(); diff --git a/dist/dbr.browser.mjs b/dist/dbr.browser.mjs new file mode 100644 index 00000000..3ec9f878 --- /dev/null +++ b/dist/dbr.browser.mjs @@ -0,0 +1,11 @@ +/** +* Dynamsoft JavaScript Library +* @product Dynamsoft Barcode Reader JS Edition +* @website http://www.dynamsoft.com +* @preserve Copyright 2021, Dynamsoft Corporation +* @author Dynamsoft +* @version 8.6.0 (js 20210628) +* @fileoverview Dynamsoft JavaScript Library for Barcode Reader +* More info on DBR JS: https://www.dynamsoft.com/Products/barcode-recognition-javascript.aspx +*/ +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):"object"==typeof exports?exports.dbr=t():e.dbr=t(e.worker_threads,e.https,e.http,e.fs,e.os)}(("object"==typeof window?window:global),(function(e,t,i,r,n){return function(e){var t={};function i(r){if(t[r])return t[r].exports;var n=t[r]={i:r,l:!1,exports:{}};return e[r].call(n.exports,n,n.exports,i),n.l=!0,n.exports}return i.m=e,i.c=t,i.d=function(e,t,r){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(i.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)i.d(r,n,function(t){return e[t]}.bind(null,n));return r},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=5)}([function(t,i){t.exports=e},function(e,i){e.exports=t},function(e,t){e.exports=i},function(e,t){e.exports=r},function(e,t){e.exports=n},function(e,t,i){"use strict";var r,n,o,s;i.r(t),i.d(t,"DBR",(function(){return W})),i.d(t,"BarcodeReader",(function(){return c})),i.d(t,"BarcodeScanner",(function(){return g})),i.d(t,"EnumBarcodeColourMode",(function(){return E})),i.d(t,"EnumBarcodeComplementMode",(function(){return R})),i.d(t,"EnumBarcodeFormat",(function(){return s})),i.d(t,"EnumBarcodeFormat_2",(function(){return m})),i.d(t,"EnumBinarizationMode",(function(){return f})),i.d(t,"EnumClarityCalculationMethod",(function(){return I})),i.d(t,"EnumClarityFilterMode",(function(){return A})),i.d(t,"EnumColourClusteringMode",(function(){return S})),i.d(t,"EnumColourConversionMode",(function(){return D})),i.d(t,"EnumConflictMode",(function(){return T})),i.d(t,"EnumDeblurMode",(function(){return v})),i.d(t,"EnumDeformationResistingMode",(function(){return p})),i.d(t,"EnumDPMCodeReadingMode",(function(){return M})),i.d(t,"EnumErrorCode",(function(){return n})),i.d(t,"EnumGrayscaleTransformationMode",(function(){return y})),i.d(t,"EnumImagePixelFormat",(function(){return r})),i.d(t,"EnumImagePreprocessingMode",(function(){return C})),i.d(t,"EnumIMResultDataType",(function(){return o})),i.d(t,"EnumIntermediateResultSavingMode",(function(){return L})),i.d(t,"EnumIntermediateResultType",(function(){return O})),i.d(t,"EnumLocalizationMode",(function(){return b})),i.d(t,"EnumPDFReadingMode",(function(){return B})),i.d(t,"EnumQRCodeErrorCorrectionLevel",(function(){return N})),i.d(t,"EnumRegionPredetectionMode",(function(){return F})),i.d(t,"EnumResultCoordinateType",(function(){return P})),i.d(t,"EnumResultType",(function(){return w})),i.d(t,"EnumScaleUpMode",(function(){return U})),i.d(t,"EnumTerminatePhase",(function(){return G})),i.d(t,"EnumTextFilterMode",(function(){return V})),i.d(t,"EnumTextResultOrderMode",(function(){return k})),i.d(t,"EnumTextureDetectionMode",(function(){return x})),function(e){e[e.IPF_Binary=0]="IPF_Binary",e[e.IPF_BinaryInverted=1]="IPF_BinaryInverted",e[e.IPF_GrayScaled=2]="IPF_GrayScaled",e[e.IPF_NV21=3]="IPF_NV21",e[e.IPF_RGB_565=4]="IPF_RGB_565",e[e.IPF_RGB_555=5]="IPF_RGB_555",e[e.IPF_RGB_888=6]="IPF_RGB_888",e[e.IPF_ARGB_8888=7]="IPF_ARGB_8888",e[e.IPF_RGB_161616=8]="IPF_RGB_161616",e[e.IPF_ARGB_16161616=9]="IPF_ARGB_16161616",e[e.IPF_ABGR_8888=10]="IPF_ABGR_8888",e[e.IPF_ABGR_16161616=11]="IPF_ABGR_16161616",e[e.IPF_BGR_888=12]="IPF_BGR_888"}(r||(r={})),function(e){e[e.DBR_SYSTEM_EXCEPTION=1]="DBR_SYSTEM_EXCEPTION",e[e.DBR_SUCCESS=0]="DBR_SUCCESS",e[e.DBR_UNKNOWN=-1e4]="DBR_UNKNOWN",e[e.DBR_NO_MEMORY=-10001]="DBR_NO_MEMORY",e[e.DBR_NULL_REFERENCE=-10002]="DBR_NULL_REFERENCE",e[e.DBR_LICENSE_INVALID=-10003]="DBR_LICENSE_INVALID",e[e.DBR_LICENSE_EXPIRED=-10004]="DBR_LICENSE_EXPIRED",e[e.DBR_FILE_NOT_FOUND=-10005]="DBR_FILE_NOT_FOUND",e[e.DBR_FILETYPE_NOT_SUPPORTED=-10006]="DBR_FILETYPE_NOT_SUPPORTED",e[e.DBR_BPP_NOT_SUPPORTED=-10007]="DBR_BPP_NOT_SUPPORTED",e[e.DBR_INDEX_INVALID=-10008]="DBR_INDEX_INVALID",e[e.DBR_BARCODE_FORMAT_INVALID=-10009]="DBR_BARCODE_FORMAT_INVALID",e[e.DBR_CUSTOM_REGION_INVALID=-10010]="DBR_CUSTOM_REGION_INVALID",e[e.DBR_MAX_BARCODE_NUMBER_INVALID=-10011]="DBR_MAX_BARCODE_NUMBER_INVALID",e[e.DBR_IMAGE_READ_FAILED=-10012]="DBR_IMAGE_READ_FAILED",e[e.DBR_TIFF_READ_FAILED=-10013]="DBR_TIFF_READ_FAILED",e[e.DBR_QR_LICENSE_INVALID=-10016]="DBR_QR_LICENSE_INVALID",e[e.DBR_1D_LICENSE_INVALID=-10017]="DBR_1D_LICENSE_INVALID",e[e.DBR_DIB_BUFFER_INVALID=-10018]="DBR_DIB_BUFFER_INVALID",e[e.DBR_PDF417_LICENSE_INVALID=-10019]="DBR_PDF417_LICENSE_INVALID",e[e.DBR_DATAMATRIX_LICENSE_INVALID=-10020]="DBR_DATAMATRIX_LICENSE_INVALID",e[e.DBR_PDF_READ_FAILED=-10021]="DBR_PDF_READ_FAILED",e[e.DBR_PDF_DLL_MISSING=-10022]="DBR_PDF_DLL_MISSING",e[e.DBR_PAGE_NUMBER_INVALID=-10023]="DBR_PAGE_NUMBER_INVALID",e[e.DBR_CUSTOM_SIZE_INVALID=-10024]="DBR_CUSTOM_SIZE_INVALID",e[e.DBR_CUSTOM_MODULESIZE_INVALID=-10025]="DBR_CUSTOM_MODULESIZE_INVALID",e[e.DBR_RECOGNITION_TIMEOUT=-10026]="DBR_RECOGNITION_TIMEOUT",e[e.DBR_JSON_PARSE_FAILED=-10030]="DBR_JSON_PARSE_FAILED",e[e.DBR_JSON_TYPE_INVALID=-10031]="DBR_JSON_TYPE_INVALID",e[e.DBR_JSON_KEY_INVALID=-10032]="DBR_JSON_KEY_INVALID",e[e.DBR_JSON_VALUE_INVALID=-10033]="DBR_JSON_VALUE_INVALID",e[e.DBR_JSON_NAME_KEY_MISSING=-10034]="DBR_JSON_NAME_KEY_MISSING",e[e.DBR_JSON_NAME_VALUE_DUPLICATED=-10035]="DBR_JSON_NAME_VALUE_DUPLICATED",e[e.DBR_TEMPLATE_NAME_INVALID=-10036]="DBR_TEMPLATE_NAME_INVALID",e[e.DBR_JSON_NAME_REFERENCE_INVALID=-10037]="DBR_JSON_NAME_REFERENCE_INVALID",e[e.DBR_PARAMETER_VALUE_INVALID=-10038]="DBR_PARAMETER_VALUE_INVALID",e[e.DBR_DOMAIN_NOT_MATCHED=-10039]="DBR_DOMAIN_NOT_MATCHED",e[e.DBR_RESERVEDINFO_NOT_MATCHED=-10040]="DBR_RESERVEDINFO_NOT_MATCHED",e[e.DBR_AZTEC_LICENSE_INVALID=-10041]="DBR_AZTEC_LICENSE_INVALID",e[e.DBR_LICENSE_DLL_MISSING=-10042]="DBR_LICENSE_DLL_MISSING",e[e.DBR_LICENSEKEY_NOT_MATCHED=-10043]="DBR_LICENSEKEY_NOT_MATCHED",e[e.DBR_REQUESTED_FAILED=-10044]="DBR_REQUESTED_FAILED",e[e.DBR_LICENSE_INIT_FAILED=-10045]="DBR_LICENSE_INIT_FAILED",e[e.DBR_PATCHCODE_LICENSE_INVALID=-10046]="DBR_PATCHCODE_LICENSE_INVALID",e[e.DBR_POSTALCODE_LICENSE_INVALID=-10047]="DBR_POSTALCODE_LICENSE_INVALID",e[e.DBR_DPM_LICENSE_INVALID=-10048]="DBR_DPM_LICENSE_INVALID",e[e.DBR_FRAME_DECODING_THREAD_EXISTS=-10049]="DBR_FRAME_DECODING_THREAD_EXISTS",e[e.DBR_STOP_DECODING_THREAD_FAILED=-10050]="DBR_STOP_DECODING_THREAD_FAILED",e[e.DBR_SET_MODE_ARGUMENT_ERROR=-10051]="DBR_SET_MODE_ARGUMENT_ERROR",e[e.DBR_LICENSE_CONTENT_INVALID=-10052]="DBR_LICENSE_CONTENT_INVALID",e[e.DBR_LICENSE_KEY_INVALID=-10053]="DBR_LICENSE_KEY_INVALID",e[e.DBR_LICENSE_DEVICE_RUNS_OUT=-10054]="DBR_LICENSE_DEVICE_RUNS_OUT",e[e.DBR_GET_MODE_ARGUMENT_ERROR=-10055]="DBR_GET_MODE_ARGUMENT_ERROR",e[e.DBR_IRT_LICENSE_INVALID=-10056]="DBR_IRT_LICENSE_INVALID",e[e.DBR_MAXICODE_LICENSE_INVALID=-10057]="DBR_MAXICODE_LICENSE_INVALID",e[e.DBR_GS1_DATABAR_LICENSE_INVALID=-10058]="DBR_GS1_DATABAR_LICENSE_INVALID",e[e.DBR_GS1_COMPOSITE_LICENSE_INVALID=-10059]="DBR_GS1_COMPOSITE_LICENSE_INVALID",e[e.DBR_DOTCODE_LICENSE_INVALID=-10061]="DBR_DOTCODE_LICENSE_INVALID",e[e.DMERR_NO_LICENSE=-2e4]="DMERR_NO_LICENSE",e[e.DMERR_LICENSE_SYNC_FAILED=-20003]="DMERR_LICENSE_SYNC_FAILED",e[e.DMERR_TRIAL_LICENSE=-20010]="DMERR_TRIAL_LICENSE",e[e.DMERR_FAILED_TO_REACH_LTS=-20200]="DMERR_FAILED_TO_REACH_LTS"}(n||(n={})),function(e){e[e.IMRDT_IMAGE=1]="IMRDT_IMAGE",e[e.IMRDT_CONTOUR=2]="IMRDT_CONTOUR",e[e.IMRDT_LINESEGMENT=4]="IMRDT_LINESEGMENT",e[e.IMRDT_LOCALIZATIONRESULT=8]="IMRDT_LOCALIZATIONRESULT",e[e.IMRDT_REGIONOFINTEREST=16]="IMRDT_REGIONOFINTEREST",e[e.IMRDT_QUADRILATERAL=32]="IMRDT_QUADRILATERAL"}(o||(o={})),function(e){e[e.BF_ALL=-31457281]="BF_ALL",e[e.BF_ONED=1050623]="BF_ONED",e[e.BF_GS1_DATABAR=260096]="BF_GS1_DATABAR",e[e.BF_CODE_39=1]="BF_CODE_39",e[e.BF_CODE_128=2]="BF_CODE_128",e[e.BF_CODE_93=4]="BF_CODE_93",e[e.BF_CODABAR=8]="BF_CODABAR",e[e.BF_ITF=16]="BF_ITF",e[e.BF_EAN_13=32]="BF_EAN_13",e[e.BF_EAN_8=64]="BF_EAN_8",e[e.BF_UPC_A=128]="BF_UPC_A",e[e.BF_UPC_E=256]="BF_UPC_E",e[e.BF_INDUSTRIAL_25=512]="BF_INDUSTRIAL_25",e[e.BF_CODE_39_EXTENDED=1024]="BF_CODE_39_EXTENDED",e[e.BF_GS1_DATABAR_OMNIDIRECTIONAL=2048]="BF_GS1_DATABAR_OMNIDIRECTIONAL",e[e.BF_GS1_DATABAR_TRUNCATED=4096]="BF_GS1_DATABAR_TRUNCATED",e[e.BF_GS1_DATABAR_STACKED=8192]="BF_GS1_DATABAR_STACKED",e[e.BF_GS1_DATABAR_STACKED_OMNIDIRECTIONAL=16384]="BF_GS1_DATABAR_STACKED_OMNIDIRECTIONAL",e[e.BF_GS1_DATABAR_EXPANDED=32768]="BF_GS1_DATABAR_EXPANDED",e[e.BF_GS1_DATABAR_EXPANDED_STACKED=65536]="BF_GS1_DATABAR_EXPANDED_STACKED",e[e.BF_GS1_DATABAR_LIMITED=131072]="BF_GS1_DATABAR_LIMITED",e[e.BF_PATCHCODE=262144]="BF_PATCHCODE",e[e.BF_PDF417=33554432]="BF_PDF417",e[e.BF_QR_CODE=67108864]="BF_QR_CODE",e[e.BF_DATAMATRIX=134217728]="BF_DATAMATRIX",e[e.BF_AZTEC=268435456]="BF_AZTEC",e[e.BF_MAXICODE=536870912]="BF_MAXICODE",e[e.BF_MICRO_QR=1073741824]="BF_MICRO_QR",e[e.BF_MICRO_PDF417=524288]="BF_MICRO_PDF417",e[e.BF_GS1_COMPOSITE=-2147483648]="BF_GS1_COMPOSITE",e[e.BF_MSI_CODE=1048576]="BF_MSI_CODE",e[e.BF_NULL=0]="BF_NULL"}(s||(s={}));var a=function(e,t,i,r){return new(i||(i=Promise))((function(n,o){function s(e){try{d(r.next(e))}catch(e){o(e)}}function a(e){try{d(r.throw(e))}catch(e){o(e)}}function d(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(s,a)}d((r=r.apply(e,t||[])).next())}))};const d=!1,_=!d&&"undefined"==typeof self,l=d?global:_?{}:self;class c{constructor(){this._canvasMaxWH="iPhone"==c.browserInfo.OS||"Android"==c.browserInfo.OS?2048:4096,this._instanceID=void 0,this.bSaveOriCanvas=!1,this.oriCanvas=null,this._1dMinConfidence=30,this.maxVideoCvsLength=3,this.videoCvses=[],this.videoGlCvs=null,this.videoGl=null,this.glImgData=null,this.bFilterRegionInJs=!0,this._region=null,this._timeStartDecode=null,this._timeEnterInnerDBR=null,this._timeGetMessage=null,this._bUseWebgl=!0,this.decodeRecords={},this.bDestroyed=!1,this._setWarnnedEx=new Set,this._lastErrorCode=0,this._lastErrorString="",this._lastInnerDecodeDuration=0}static get version(){return this._version}static get productKeys(){return this._productKeys}static set productKeys(e){if("unload"!=this._loadWasmStatus)throw new Error("`productKeys` is not allowed to change after loadWasm is called.");c._productKeys=e}static get handshakeCode(){return this._productKeys}static set handshakeCode(e){if("unload"!=this._loadWasmStatus)throw new Error("`handshakeCode` is not allowed to change after loadWasm is called.");c._productKeys=e}static get organizationID(){return this._organizationID}static set organizationID(e){if("unload"!=this._loadWasmStatus)throw new Error("`organizationID` is not allowed to change after loadWasm is called.");"number"==typeof e&&(e=e.toString()),c._organizationID=e}static set sessionPassword(e){if("unload"!=this._loadWasmStatus)throw new Error("`sessionPassword` is not allowed to change after loadWasm is called.");c._sessionPassword=e}static get sessionPassword(){return this._sessionPassword}static detectEnvironment(){return a(this,void 0,void 0,(function*(){let e={wasm:"undefined"!=typeof WebAssembly&&("undefined"==typeof navigator||!(/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&/\(.+\s11_2_([2-6]).*\)/.test(navigator.userAgent))),worker:!!(d?process.version>="v12":"undefined"!=typeof Worker),getUserMedia:!("undefined"==typeof navigator||!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia),camera:!1,browser:this.browserInfo.browser,version:this.browserInfo.version,OS:this.browserInfo.OS};if(e.getUserMedia)try{(yield navigator.mediaDevices.getUserMedia({video:!0})).getTracks().forEach(e=>{e.stop()}),e.camera=!0}catch(e){}return e}))}static get engineResourcePath(){return this._engineResourcePath}static set engineResourcePath(e){if("unload"!=this._loadWasmStatus)throw new Error("`engineResourcePath` is not allowed to change after loadWasm is called.");if(null==e&&(e="./"),d||_)c._engineResourcePath=e;else{let t=document.createElement("a");t.href=e,c._engineResourcePath=t.href}this._engineResourcePath.endsWith("/")||(c._engineResourcePath+="/")}static get licenseServer(){return this._licenseServer}static set licenseServer(e){if("unload"!=this._loadWasmStatus)throw new Error("`licenseServer` is not allowed to change after loadWasm is called.");if(null==e)c._licenseServer=[];else{e instanceof Array||(e=[e]);for(let t=0;t= v12.");let e,t=this.productKeys,r=(0==t.length||t.startsWith("P")||t.startsWith("L"))&&0==this.organizationID.length,o=r||t.length>=8&&!t.startsWith("t")&&!t.startsWith("f")&&!t.startsWith("P")&&!t.startsWith("L")||0==t.length&&0!=this.organizationID.length;if(o&&(d?process.version<"v15"&&(e="To use handshake requires nodejs version >= v15."):(l.crypto||(e="Please upgrade your browser to support handshake code."),l.crypto.subtle||(e="Require https to use handshake code in this browser."))),e){if(!r)throw new Error(e);r=!1,o=!1,console.warn(e),this._lastErrorCode=n.DMERR_FAILED_TO_REACH_LTS,this._lastErrorString=e}return r&&(t="",console.warn("Automatically apply for a public trial license.")),yield new Promise((e,n)=>a(this,void 0,void 0,(function*(){switch(this._loadWasmStatus){case"unload":{c._loadWasmStatus="loading";let e=this.engineResourcePath+this._workerName;if(d||this.engineResourcePath.startsWith(location.origin)||(e=yield fetch(e).then(e=>e.blob()).then(e=>URL.createObjectURL(e))),d){const t=i(0);c._dbrWorker=new t.Worker(e)}else c._dbrWorker=new Worker(e);this._dbrWorker.onerror=e=>{c._loadWasmStatus="loadFail";let t=new Error(e.message);this._loadWasmErr=t;for(let e of this._loadWasmCallbackArr)e(t);this._loadWasmCallbackArr=[]},this._dbrWorker.onmessage=e=>a(this,void 0,void 0,(function*(){let t=e.data?e.data:e;switch(t.type){case"log":this._onLog&&this._onLog(t.message);break;case"load":{t.message&&(t.message=t.message.replace("(https://www.dynamsoft.com/purchase-center/)","(https://www.dynamsoft.com/store/dynamsoft-barcode-reader/#javascript)"));let e=!1;if(r&&(e=!0),t.success){c._loadWasmStatus="loadSuccess",c._version=t.version+"(JS "+this._jsVersion+"."+this._jsEditVersion+")",this._onLog&&this._onLog("load dbr worker success");for(let e of this._loadWasmCallbackArr)e();this._loadWasmCallbackArr=[],this._dbrWorker.onerror=null,t.message&&console.warn(t.message)}else{let i=new Error(t.message);i.stack=t.stack+"\n"+i.stack,c._loadWasmStatus="loadFail",this._loadWasmErr=i;for(let e of this._loadWasmCallbackArr)e(i);this._loadWasmCallbackArr=[],e||111==t.ltsErrorCode&&-1!=t.message.toLowerCase().indexOf("trial license")&&(e=!0)}e&&this.showDialog(t.success?"warn":"error",t.message);break}case"task":{let e=t.id,i=t.body;try{this._taskCallbackMap.get(e)(i),this._taskCallbackMap.delete(e)}catch(t){throw this._taskCallbackMap.delete(e),t}break}default:this._onLog&&this._onLog(e)}})),d&&this._dbrWorker.on("message",this._dbrWorker.onmessage),this._dbrWorker.postMessage({type:"loadWasm",bd:this._bWasmDebug,engineResourcePath:this.engineResourcePath,version:this._jsVersion,brtk:o,bptk:r,pk:t,og:this.organizationID,dm:!d&&location.origin.startsWith("http")?location.origin:"https://localhost",bUseFullFeature:this._bUseFullFeature,browserInfo:this.browserInfo,deviceFriendlyName:this.deviceFriendlyName,ls:this.licenseServer,sp:this._sessionPassword,lm:this._limitModules,cw:this._chargeWay})}case"loading":this._loadWasmCallbackArr.push(t=>{t?n(t):e()});break;case"loadSuccess":e();break;case"loadFail":n(this._loadWasmErr)}})))}))}static showDialog(e,t){return a(this,void 0,void 0,(function*(){if(!d&&!this._bNeverShowDialog)try{let i=yield fetch(c.engineResourcePath+"dls.license.dialog.html");if(!i.ok)throw Error("Get license dialog fail. Network Error: "+i.statusText);let r=yield i.text();if(!r.trim().startsWith("<"))throw Error("Get license dialog fail. Can't get valid HTMLElement.");let n=document.createElement("div");n.innerHTML=r;let o=[];for(let e=0;e{if(i==e.target){s.remove();for(let e of o)e.remove()}});else if(!d&&i.classList.contains("dls-license-icon-close"))d=i,i.addEventListener("click",()=>{s.remove();for(let e of o)e.remove()});else if(!_&&i.classList.contains("dls-license-icon-error"))_=i,"error"!=e&&i.remove();else if(!l&&i.classList.contains("dls-license-icon-warn"))l=i,"warn"!=e&&i.remove();else if(!h&&i.classList.contains("dls-license-msg-content")){h=i;let e=t;for(;e;){let t=e.indexOf("["),r=e.indexOf("]",t),n=e.indexOf("(",r),o=e.indexOf(")",n);if(-1==t||-1==r||-1==n||-1==o){i.appendChild(new Text(e));break}t>0&&i.appendChild(new Text(e.substring(0,t)));let s=document.createElement("a"),a=e.substring(t+1,r);s.innerText=a;let d=e.substring(n+1,o);s.setAttribute("href",d),s.setAttribute("target","_blank"),i.appendChild(s),e=e.substring(o+1)}}document.body.appendChild(s)}catch(e){c._onLog&&c._onLog(e.message||e)}}))}static createInstanceInWorker(e=!1){return a(this,void 0,void 0,(function*(){return yield this.loadWasm(),yield new Promise((t,i)=>{let r=c._nextTaskID++;this._taskCallbackMap.set(r,e=>{if(e.success)return t(e.instanceID);{let t=new Error(e.message);return t.stack=e.stack+"\n"+t.stack,i(t)}}),this._dbrWorker.postMessage({type:"createInstance",id:r,productKeys:"",bScanner:e})})}))}static createInstance(){return a(this,void 0,void 0,(function*(){let e=new c;return e._instanceID=yield this.createInstanceInWorker(),e}))}decode(e){return a(this,void 0,void 0,(function*(){if(c._onLog&&c._onLog("decode(source: any)"),c._onLog&&(this._timeStartDecode=Date.now()),d)return e instanceof Buffer?yield this._decodeFileInMemory_Uint8Array(new Uint8Array(e)):e instanceof Uint8Array?yield this._decodeFileInMemory_Uint8Array(e):"string"==typeof e||e instanceof String?"data:image/"==e.substring(0,11)?yield this._decode_Base64(e):"http"==e.substring(0,4)?yield this._decode_Url(e):yield this._decode_FilePath(e):yield Promise.reject(TypeError("'_decode(source, config)': Type of 'source' should be 'Buffer', 'Uint8Array', 'String(base64 with image mime)' or 'String(url)'."));{let t={};return!this.region||this.region instanceof Array||(t.region=JSON.parse(JSON.stringify(this.region))),e instanceof Blob?yield this._decode_Blob(e,t):e instanceof ArrayBuffer?yield this._decode_ArrayBuffer(e,t):e instanceof Uint8Array||e instanceof Uint8ClampedArray?yield this._decode_Uint8Array(e,t):e instanceof HTMLImageElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap?yield this._decode_Image(e,t):e instanceof HTMLCanvasElement||"undefined"!=typeof OffscreenCanvas&&e instanceof OffscreenCanvas?yield this._decode_Canvas(e,t):e instanceof HTMLVideoElement?yield this._decode_Video(e,t):"string"==typeof e||e instanceof String?"data:image/"==e.substring(0,11)?yield this._decode_Base64(e,t):yield this._decode_Url(e,t):yield Promise.reject(TypeError("'_decode(source, config)': Type of 'source' should be 'Blob', 'ArrayBuffer', 'Uint8Array', 'HTMLImageElement', 'HTMLCanvasElement', 'HTMLVideoElement', 'String(base64 with image mime)' or 'String(url)'."))}}))}decodeBase64String(e){return a(this,void 0,void 0,(function*(){let t={};return!this.region||this.region instanceof Array||(t.region=JSON.parse(JSON.stringify(this.region))),this._decode_Base64(e,t)}))}decodeUrl(e){return a(this,void 0,void 0,(function*(){let t={};return!this.region||this.region instanceof Array||(t.region=JSON.parse(JSON.stringify(this.region))),this._decode_Url(e,t)}))}_decodeBuffer_Uint8Array(e,t,i,r,n,o){return a(this,void 0,void 0,(function*(){return yield new Promise((a,d)=>{let _=c._nextTaskID++;c._taskCallbackMap.set(_,e=>{if(e.success){let t,i=c._onLog?Date.now():0;c._onLog&&c._onLog("worker return result: "+i),this._lastInnerDecodeDuration=e.duration;try{t=this._handleRetJsonString(e.decodeReturn);for(let e=0;e{let r=new FileReader;r.readAsArrayBuffer(e),r.onload=()=>{t(r.result)},r.onerror=()=>{i(r.error)}}).then(e=>this._decodeBuffer_Uint8Array(new Uint8Array(e),t,i,r,n,o))}))}decodeBuffer(e,t,i,r,n,o){return a(this,void 0,void 0,(function*(){let s;return c._onLog&&c._onLog("decodeBuffer(buffer,width,height,stride,format)"),c._onLog&&(this._timeStartDecode=Date.now()),d?e instanceof Uint8Array?s=yield this._decodeBuffer_Uint8Array(e,t,i,r,n,o):e instanceof Buffer&&(s=yield this._decodeBuffer_Uint8Array(new Uint8Array(e),t,i,r,n,o)):e instanceof Uint8Array||e instanceof Uint8ClampedArray?s=yield this._decodeBuffer_Uint8Array(e,t,i,r,n,o):e instanceof ArrayBuffer?s=yield this._decodeBuffer_Uint8Array(new Uint8Array(e),t,i,r,n,o):e instanceof Blob&&(s=yield this._decodeBuffer_Blob(e,t,i,r,n,o)),s}))}_decodeFileInMemory_Uint8Array(e){return a(this,void 0,void 0,(function*(){return yield new Promise((t,i)=>{let r=c._nextTaskID++;c._taskCallbackMap.set(r,e=>{if(e.success){let r;this._lastInnerDecodeDuration=e.duration;try{r=this._handleRetJsonString(e.decodeReturn)}catch(e){return i(e)}return t(r)}{let t=new Error(e.message);return t.stack=e.stack+"\n"+t.stack,i(t)}}),c._dbrWorker.postMessage({type:"decodeFileInMemory",id:r,instanceID:this._instanceID,body:{bytes:e}})})}))}getRuntimeSettings(){return a(this,void 0,void 0,(function*(){return yield new Promise((e,t)=>{let i=c._nextTaskID++;c._taskCallbackMap.set(i,i=>{if(i.success){let t=JSON.parse(i.results);return null!=this.userDefinedRegion&&(t.region=JSON.parse(JSON.stringify(this.userDefinedRegion))),e(t)}{let e=new Error(i.message);return e.stack=i.stack+"\n"+e.stack,t(e)}}),c._dbrWorker.postMessage({type:"getRuntimeSettings",id:i,instanceID:this._instanceID})})}))}updateRuntimeSettings(e){return a(this,void 0,void 0,(function*(){let t;if("string"==typeof e||e instanceof String)if("speed"==e){let e=yield this.getRuntimeSettings();yield this.resetRuntimeSettings(),t=yield this.getRuntimeSettings(),t.barcodeFormatIds=e.barcodeFormatIds,t.barcodeFormatIds_2=e.barcodeFormatIds_2,t.region=e.region,t.deblurLevel=3,t.expectedBarcodesCount=0,t.localizationModes=[2,0,0,0,0,0,0,0]}else if("balance"==e){let e=yield this.getRuntimeSettings();yield this.resetRuntimeSettings(),t=yield this.getRuntimeSettings(),t.barcodeFormatIds=e.barcodeFormatIds,t.barcodeFormatIds_2=e.barcodeFormatIds_2,t.region=e.region,t.deblurLevel=5,t.expectedBarcodesCount=512,t.localizationModes=[2,16,0,0,0,0,0,0]}else if("coverage"==e){let e=yield this.getRuntimeSettings();yield this.resetRuntimeSettings(),t=yield this.getRuntimeSettings(),t.barcodeFormatIds=e.barcodeFormatIds,t.barcodeFormatIds_2=e.barcodeFormatIds_2,t.region=e.region}else t=JSON.parse(e);else{if("object"!=typeof e)throw TypeError("'UpdateRuntimeSettings(settings)': Type of 'settings' should be 'String' or 'PlainObject'.");if(t=JSON.parse(JSON.stringify(e)),t.region instanceof Array){let e=t.region;[e.regionLeft,e.regionTop,e.regionLeft,e.regionBottom,e.regionMeasuredByPercentage].some(e=>void 0!==e)&&(t.region={regionLeft:e.regionLeft||0,regionTop:e.regionTop||0,regionRight:e.regionRight||0,regionBottom:e.regionBottom||0,regionMeasuredByPercentage:e.regionMeasuredByPercentage||0})}}if(!c._bUseFullFeature){if(0!=(t.barcodeFormatIds&~(s.BF_ONED|s.BF_QR_CODE|s.BF_PDF417|s.BF_DATAMATRIX))||0!=t.barcodeFormatIds_2)throw Error("Some of the specified barcode formats are not supported in the compact version. Please try the full-featured version.");if(0!=t.intermediateResultTypes)throw Error("Intermediate results is not supported in the compact version. Please try the full-featured version.")}if(!d)if(this.bFilterRegionInJs){let e=t.region;if(e instanceof Array)throw Error("The `region` of type `Array` is only allowed in `BarcodeScanner`.");this.userDefinedRegion=JSON.parse(JSON.stringify(e)),(e.regionLeft||e.regionTop||e.regionRight||e.regionBottom||e.regionMeasuredByPercentage)&&(e.regionLeft||e.regionTop||100!=e.regionRight||100!=e.regionBottom||!e.regionMeasuredByPercentage)?this.region=e:this.region=null,t.region={regionLeft:0,regionTop:0,regionRight:0,regionBottom:0,regionMeasuredByPercentage:0}}else this.userDefinedRegion=null,this.region=null;return yield new Promise((e,i)=>{let r=c._nextTaskID++;c._taskCallbackMap.set(r,t=>{if(t.success){try{this._handleRetJsonString(t.updateReturn)}catch(e){i(e)}return e()}{let e=new Error(t.message);return e.stack=t.stack+"\n"+e.stack,i(e)}}),c._dbrWorker.postMessage({type:"updateRuntimeSettings",id:r,instanceID:this._instanceID,body:{settings:JSON.stringify(t)}})})}))}resetRuntimeSettings(){return a(this,void 0,void 0,(function*(){return this.userDefinedRegion=null,this.region=null,yield new Promise((e,t)=>{let i=c._nextTaskID++;c._taskCallbackMap.set(i,i=>{if(i.success)return e();{let e=new Error(i.message);return e.stack=i.stack+"\n"+e.stack,t(e)}}),c._dbrWorker.postMessage({type:"resetRuntimeSettings",id:i,instanceID:this._instanceID})})}))}outputSettingsToString(){return a(this,void 0,void 0,(function*(){if(!c._bUseFullFeature)throw Error("outputSettingsToString() is not supported in the compact version. Please try the full-featured version.");return yield new Promise((e,t)=>{let i=c._nextTaskID++;c._taskCallbackMap.set(i,i=>{if(i.success)return e(i.results);{let e=new Error(i.message);return e.stack=i.stack+"\n"+e.stack,t(e)}}),c._dbrWorker.postMessage({type:"outputSettingsToString",id:i,instanceID:this._instanceID})})}))}initRuntimeSettingsWithString(e){return a(this,void 0,void 0,(function*(){if(!c._bUseFullFeature)throw Error("initRuntimeSettingsWithString() is not supported in the compact version. Please try the full-featured version.");if("string"==typeof e||e instanceof String)e=e;else{if("object"!=typeof e)throw TypeError("'initRuntimeSettingstWithString(settings)': Type of 'settings' should be 'String' or 'PlainObject'.");e=JSON.stringify(e)}return yield new Promise((t,i)=>{let r=c._nextTaskID++;c._taskCallbackMap.set(r,e=>{if(e.success){try{this._handleRetJsonString(e.initReturn)}catch(e){i(e)}return t()}{let t=new Error(e.message);return t.stack=e.stack+"\n"+t.stack,i(t)}}),c._dbrWorker.postMessage({type:"initRuntimeSettingsWithString",id:r,instanceID:this._instanceID,body:{settings:e}})})}))}_decode_Blob(e,t){return a(this,void 0,void 0,(function*(){c._onLog&&c._onLog("_decode_Blob(blob: Blob)");let i=null,r=null;if("undefined"!=typeof createImageBitmap)try{i=yield createImageBitmap(e)}catch(e){}i||(r=yield function(e){return new Promise((t,i)=>{let r=URL.createObjectURL(e),n=new Image;n.dbrObjUrl=r,n.src=r,n.onload=()=>{t(n)},n.onerror=e=>{i(new Error("Can't convert blob to image : "+(e instanceof Event?e.type:e)))}})}(e));let n=yield this._decode_Image(i||r,t);return i&&i.close(),n}))}_decode_ArrayBuffer(e,t){return a(this,void 0,void 0,(function*(){return yield this._decode_Blob(new Blob([e]),t)}))}_decode_Uint8Array(e,t){return a(this,void 0,void 0,(function*(){return yield this._decode_Blob(new Blob([e]),t)}))}_decode_Image(e,t){return a(this,void 0,void 0,(function*(){c._onLog&&c._onLog("_decode_Image(image: HTMLImageElement|ImageBitmap)"),t=t||{};let i,r,n=e instanceof HTMLImageElement?e.naturalWidth:e.width,o=e instanceof HTMLImageElement?e.naturalHeight:e.height,s=Math.max(n,o);if(s>this._canvasMaxWH){let e=this._canvasMaxWH/s;i=Math.round(n*e),r=Math.round(o*e)}else i=n,r=o;let a,d=0,_=0,h=n,u=o,g=i,E=r,R=t.region;if(R){let e,t,s,a;R.regionMeasuredByPercentage?(e=R.regionLeft*i/100,t=R.regionTop*r/100,s=R.regionRight*i/100,a=R.regionBottom*r/100):(e=R.regionLeft,t=R.regionTop,s=R.regionRight,a=R.regionBottom),g=s-e,h=Math.round(g/i*n),E=a-t,u=Math.round(E/r*o),d=Math.round(e/i*n),_=Math.round(t/r*o)}!this.bSaveOriCanvas&&l.OffscreenCanvas?a=new OffscreenCanvas(g,E):(a=document.createElement("canvas"),a.width=g,a.height=E);let m,f=a.getContext("2d");0==d&&0==_&&n==h&&o==u&&n==g&&o==E?f.drawImage(e,0,0):f.drawImage(e,d,_,h,u,0,0,g,E),e.dbrObjUrl&&URL.revokeObjectURL(e.dbrObjUrl),R?(m=JSON.parse(JSON.stringify(t)),delete m.region):m=t;let I=yield this._decode_Canvas(a,m);return c.fixResultLocationWhenFilterRegionInJs(R,I,d,_,h,u,g,E),I}))}_decode_Canvas(e,t){return a(this,void 0,void 0,(function*(){if(c._onLog&&c._onLog("_decode_Canvas(canvas:HTMLCanvasElement)"),e.crossOrigin&&"anonymous"!=e.crossOrigin)throw"cors";(this.bSaveOriCanvas||this.singleFrameMode)&&(this.oriCanvas=e);let i=(e.dbrCtx2d||e.getContext("2d")).getImageData(0,0,e.width,e.height).data;return yield this._decodeBuffer_Uint8Array(i,e.width,e.height,4*e.width,r.IPF_ABGR_8888,t)}))}handleVideoFrame(e,t){if(c._onLog&&c._onLog("handleVideoFrame(video)"),!(e instanceof HTMLVideoElement))throw TypeError("'handleVideoFrame(video [, config] )': Type of 'video' should be 'HTMLVideoElement'.");if(e.crossOrigin&&"anonymous"!=e.crossOrigin)throw"cors";t=t||{};const i=e.videoWidth,r=e.videoHeight,n=Math.max(i,r);let o,s;if(n>this._canvasMaxWH){let e=this._canvasMaxWH/n;o=Math.round(i*e),s=Math.round(r*e)}else o=i,s=r;let a=0,d=0,_=i,h=r,u=i,g=r,E=t.region;if(E){let e,t,n,l;E.regionMeasuredByPercentage?(e=E.regionLeft*o/100,t=E.regionTop*s/100,n=E.regionRight*o/100,l=E.regionBottom*s/100):(e=E.regionLeft,t=E.regionTop,n=E.regionRight,l=E.regionBottom),u=n-e,_=Math.round(u/o*i),g=l-t,h=Math.round(g/s*r),a=Math.round(e/o*i),d=Math.round(t/s*r)}let R=0==a&&0==d&&i==_&&r==h&&i==u&&r==g;if(!this.bSaveOriCanvas&&this._bUseWebgl&&R){this.videoGlCvs||(this.videoGlCvs=l.OffscreenCanvas?new OffscreenCanvas(u,g):document.createElement("canvas"));const t=this.videoGlCvs;t.width==u&&t.height==g||(t.height=g,t.width=u,this.videoGl&&this.videoGl.viewport(0,0,u,g));const i=this.videoGl||t.getContext("webgl",{alpha:!1,antialias:!1,depth:!1,stencil:!1,preserveDrawingBuffer:!0})||t.getContext("experimental-webgl",{alpha:!1,antialias:!1,depth:!1,stencil:!1,preserveDrawingBuffer:!0});if(!this.videoGl){this.videoGl=i;const e=i.createShader(i.VERTEX_SHADER);i.shaderSource(e,"\nattribute vec4 a_position;\nattribute vec2 a_uv;\n\nvarying vec2 v_uv;\n\nvoid main() {\n gl_Position = a_position;\n v_uv = a_uv;\n}\n"),i.compileShader(e),i.getShaderParameter(e,i.COMPILE_STATUS)||console.error("An error occurred compiling the shaders: "+i.getShaderInfoLog(e));const t=i.createShader(i.FRAGMENT_SHADER);i.shaderSource(t,"\nprecision lowp float;\n\nvarying vec2 v_uv;\n\nuniform sampler2D u_texture;\n\nvoid main() {\n vec4 sample = texture2D(u_texture, v_uv);\n float grey = 0.299 * sample.r + 0.587 * sample.g + 0.114 * sample.b;\n gl_FragColor = vec4(grey, 0.0, 0.0, 1.0);\n}\n"),i.compileShader(t),i.getShaderParameter(t,i.COMPILE_STATUS)||console.error("An error occurred compiling the shaders: "+i.getShaderInfoLog(t));const r=i.createProgram();i.attachShader(r,e),i.attachShader(r,t),i.linkProgram(r),i.getProgramParameter(r,i.LINK_STATUS)||console.error("Unable to initialize the shader program: "+i.getProgramInfoLog(r)),i.useProgram(r),i.bindBuffer(i.ARRAY_BUFFER,i.createBuffer()),i.bufferData(i.ARRAY_BUFFER,new Float32Array([-1,1,0,1,1,1,1,1,-1,-1,0,0,1,-1,1,0]),i.STATIC_DRAW);const n=i.getAttribLocation(r,"a_position");i.enableVertexAttribArray(n),i.vertexAttribPointer(n,2,i.FLOAT,!1,16,0);const o=i.getAttribLocation(r,"a_uv");i.enableVertexAttribArray(o),i.vertexAttribPointer(o,2,i.FLOAT,!1,16,8),i.activeTexture(i.TEXTURE0),i.bindTexture(i.TEXTURE_2D,i.createTexture()),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.NEAREST),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.NEAREST),i.uniform1i(i.getUniformLocation(r,"u_texture"),0)}(!this.glImgData||this.glImgData.length=this.maxVideoCvsLength&&(this.videoCvses=this.videoCvses.slice(1)),this.videoCvses.push(i))}const r=i.dbrCtx2d;let n;R?r.drawImage(e,0,0):r.drawImage(e,a,d,_,h,0,0,u,g),E?(n=JSON.parse(JSON.stringify(t)),delete n.region):n=t;let o=i.dbrCtx2d||i.getContext("2d");return 0===i.width||0===i.height?null:{bUseWebGL:!1,data:o.getImageData(0,0,i.width,i.height).data,cvs:i,config:n,region:E,sx:a,sy:d,sWidth:_,sHeight:h,dWidth:u,dHeight:g}}}_decode_Video(e,t){return a(this,void 0,void 0,(function*(){if(c._onLog&&c._onLog("_decode_Video(video)"),!(e instanceof HTMLVideoElement))throw TypeError("'_decode_Video(video [, config] )': Type of 'video' should be 'HTMLVideoElement'.");if(e.crossOrigin&&"anonymous"!=e.crossOrigin)throw"cors";let i=this.handleVideoFrame(e,t);if(i&&i.bUseWebGL){let{u8Gray:e,dWidth:t,dHeight:n}=i;return yield this._decodeBuffer_Uint8Array(e,t,n,t,r.IPF_GrayScaled)}if(i&&!1===i.bUseWebGL){let{data:e,cvs:t,config:n,region:o,sx:s,sy:a,sWidth:d,sHeight:_,dWidth:l,dHeight:h}=i;(this.bSaveOriCanvas||this.singleFrameMode)&&(this.oriCanvas=t);let u=yield this._decodeBuffer_Uint8Array(e,t.width,t.height,4*t.width,r.IPF_ABGR_8888,n);return c.fixResultLocationWhenFilterRegionInJs(o,u,s,a,d,_,l,h),u}}))}_decode_Base64(e,t){return a(this,void 0,void 0,(function*(){if(c._onLog&&c._onLog("_decode_Base64(base64Str)"),!("string"==typeof e||e instanceof String))return Promise.reject("'_decode_Base64(base64Str, config)': Type of 'base64Str' should be 'String'.");if("data:image/"==e.substring(0,11)&&(e=e.substring(e.indexOf(",")+1)),d){let t=Buffer.from(e,"base64");return yield this._decodeFileInMemory_Uint8Array(new Uint8Array(t))}{let i=atob(e),r=i.length,n=new Uint8Array(r);for(;r--;)n[r]=i.charCodeAt(r);return yield this._decode_Blob(new Blob([n]),t)}}))}_decode_Url(e,t){return a(this,void 0,void 0,(function*(){if(c._onLog&&c._onLog("_decode_Url(url)"),!("string"==typeof e||e instanceof String))throw TypeError("'_decode_Url(url, config)': Type of 'url' should be 'String'.");if(e=e,d){let t=yield new Promise((t,r)=>{(e.startsWith("https")?i(1):i(2)).get(e,e=>{if(200==e.statusCode){let i=[];e.on("data",e=>{i.push(e)}).on("end",()=>{t(new Uint8Array(Buffer.concat(i)))})}else r("http get fail, statusCode: "+e.statusCode)})});return yield this._decodeFileInMemory_Uint8Array(t)}{let i=yield new Promise((t,i)=>{let r=new XMLHttpRequest;r.open("GET",e,!0),r.responseType="blob",r.send(),r.onloadend=()=>a(this,void 0,void 0,(function*(){t(r.response)})),r.onerror=()=>{i(new Error("Network Error: "+r.statusText))}});return yield this._decode_Blob(i,t)}}))}_decode_FilePath(e,t){return a(this,void 0,void 0,(function*(){if(c._onLog&&c._onLog("_decode_FilePath(path)"),!d)throw Error("'_decode_FilePath(path, config)': The method is only supported in node environment.");if(!("string"==typeof e||e instanceof String))throw TypeError("'_decode_FilePath(path, config)': Type of 'path' should be 'String'.");const t=i(3);let r=yield new Promise((i,r)=>{t.readFile(e,(e,t)=>{e?r(e):i(new Uint8Array(t))})});return yield this._decodeFileInMemory_Uint8Array(r)}))}static fixResultLocationWhenFilterRegionInJs(e,t,i,r,n,o,s,a){if(e&&t.length>0)for(let e of t){let t=e.localizationResult;2==t.resultCoordinateType&&(t.x1*=.01*s,t.x2*=.01*s,t.x3*=.01*s,t.x4*=.01*s,t.y1*=.01*a,t.y2*=.01*a,t.y3*=.01*a,t.y4*=.01*a);let d=s/n,_=a/o;t.x1=t.x1/d+i,t.x2=t.x2/d+i,t.x3=t.x3/d+i,t.x4=t.x4/d+i,t.y1=t.y1/_+r,t.y2=t.y2/_+r,t.y3=t.y3/_+r,t.y4=t.y4/_+r,2==t.resultCoordinateType&&(t.x1*=100/n,t.x2*=100/n,t.x3*=100/n,t.x4*=100/n,t.y1*=100/o,t.y2*=100/o,t.y3*=100/o,t.y4*=100/o)}}static BarcodeReaderException(e,t){let i,r=n.DBR_UNKNOWN;return"number"==typeof e?(r=e,i=new Error(t)):i=new Error(e),i.code=r,i}_handleRetJsonString(e){let t=n;if(e.textResults){for(let t=0;t{let i=t.indexOf(":");e[t.substring(0,i)]=t.substring(i+1)}),i.exception=e}}return e.decodeRecords?this.decodeRecords=e.decodeRecords:this.decodeRecords={},this._lastErrorCode=e.exception,this._lastErrorString=e.description,e.textResults}if(e.exception==t.DBR_SUCCESS)return e.data;throw c.BarcodeReaderException(e.exception,e.description)}setModeArgument(e,t,i,r){return a(this,void 0,void 0,(function*(){return yield new Promise((n,o)=>{let s=c._nextTaskID++;c._taskCallbackMap.set(s,e=>{if(e.success){try{this._handleRetJsonString(e.setReturn)}catch(e){return o(e)}return n()}{let t=new Error(e.message);return t.stack=e.stack+"\n"+t.stack,o(t)}}),c._dbrWorker.postMessage({type:"setModeArgument",id:s,instanceID:this._instanceID,body:{modeName:e,index:t,argumentName:i,argumentValue:r}})})}))}getModeArgument(e,t,i){return a(this,void 0,void 0,(function*(){return yield new Promise((r,n)=>{let o=c._nextTaskID++;c._taskCallbackMap.set(o,e=>{if(e.success){let t;try{t=this._handleRetJsonString(e.getReturn)}catch(e){return n(e)}return r(t)}{let t=new Error(e.message);return t.stack=e.stack+"\n"+t.stack,n(t)}}),c._dbrWorker.postMessage({type:"getModeArgument",id:o,instanceID:this._instanceID,body:{modeName:e,index:t,argumentName:i}})})}))}getIntermediateResults(){return a(this,void 0,void 0,(function*(){return yield new Promise((e,t)=>{let i=c._nextTaskID++;c._taskCallbackMap.set(i,i=>{if(i.success)return e(i.results);{let e=new Error(i.message);return e.stack=i.stack+"\n"+e.stack,t(e)}}),c._dbrWorker.postMessage({type:"getIntermediateResults",id:i,instanceID:this._instanceID})})}))}getIntermediateCanvas(){return a(this,void 0,void 0,(function*(){let e=yield this.getIntermediateResults(),t=[];for(let i of e)if(i.dataType==o.IMRDT_IMAGE)for(let e of i.results){const i=e.bytes;let n;switch(c._onLog&&c._onLog(" "+i.length+" "+i.byteLength+" "+e.width+" "+e.height+" "+e.stride+" "+e.format),e.format){case r.IPF_ABGR_8888:n=new Uint8ClampedArray(i);break;case r.IPF_RGB_888:{const e=i.length/3;n=new Uint8ClampedArray(4*e);for(let t=0;t{let i=c._nextTaskID++;c._taskCallbackMap.set(i,i=>{if(i.success)return e();{let e=new Error(i.message);return e.stack=i.stack+"\n"+e.stack,t(e)}}),c._dbrWorker.postMessage({type:"destroy",id:i,instanceID:this._instanceID})})}}c._jsVersion="8.6.0",c._jsEditVersion="20210628",c._version="loading...(JS "+c._jsVersion+"."+c._jsEditVersion+")",c._productKeys=d||_||!document.currentScript?"":document.currentScript.getAttribute("data-productKeys")||document.currentScript.getAttribute("data-licenseKey")||document.currentScript.getAttribute("data-handshakeCode")||"",c._organizationID=d||_||!document.currentScript?"":document.currentScript.getAttribute("data-organizationID")||"",c._sessionPassword=d||_||!document.currentScript?"":document.currentScript.getAttribute("data-sessionPassword")||"",c.browserInfo=function(){if(!d&&!_){var e={init:function(){this.browser=this.searchString(this.dataBrowser)||"unknownBrowser",this.version=this.searchVersion(navigator.userAgent)||this.searchVersion(navigator.appVersion)||"unknownVersion",this.OS=this.searchString(this.dataOS)||"unknownOS","Linux"==this.OS&&-1!=navigator.userAgent.indexOf("Windows NT")&&(this.OS="HarmonyOS")},searchString:function(e){for(var t=0;t{if(d)return __dirname+"/";if(!_&&document.currentScript){let e=document.currentScript.src,t=e.indexOf("?");if(-1!=t)e=e.substring(0,t);else{let t=e.indexOf("#");-1!=t&&(e=e.substring(0,t))}return e.substring(0,e.lastIndexOf("/")+1)}return"./"})(),c._licenseServer=[],c._deviceFriendlyName="",c._isShowRelDecodeTimeInResults=!1,c._bWasmDebug=!1,c._bNeverShowDialog=!1,c.__bUseFullFeature=!0,c._nextTaskID=0,c._taskCallbackMap=new Map,c._loadWasmStatus="unload",c._loadWasmCallbackArr=[],c._lastErrorCode=0,c._lastErrorString="",c._loadWasmErr=null;var h=function(e,t,i,r){return new(i||(i=Promise))((function(n,o){function s(e){try{d(r.next(e))}catch(e){o(e)}}function a(e){try{d(r.throw(e))}catch(e){o(e)}}function d(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(s,a)}d((r=r.apply(e,t||[])).next())}))};const u=!!("object"==typeof global&&global.process&&global.process.release&&global.process.release.name&&"undefined"==typeof HTMLCanvasElement);class g extends c{constructor(){super(),this.styleEls=[],this.videoSettings={video:{width:{ideal:1280},height:{ideal:720},facingMode:{ideal:"environment"}}},this._singleFrameMode=!(navigator&&navigator.mediaDevices&&navigator.mediaDevices.getUserMedia),this._singleFrameModeIpt=(()=>{let e=document.createElement("input");return e.setAttribute("type","file"),e.setAttribute("accept","image/*"),e.setAttribute("capture",""),e.addEventListener("change",()=>h(this,void 0,void 0,(function*(){let t=e.files[0];e.value="";let i=yield this.decode(t);for(let e of i)delete e.bUnduplicated;if(this._drawRegionsults(i),this.onFrameRead&&this._isOpen&&!this._bPauseScan&&this.onFrameRead(i),this.onUnduplicatedRead&&this._isOpen&&!this._bPauseScan)for(let e of i)this.onUnduplicatedRead(e.barcodeText,e);yield this.clearMapDecodeRecord()}))),e})(),this._clickIptSingleFrameMode=()=>{this._singleFrameModeIpt.click()},this.intervalTime=0,this._isOpen=!1,this._bWorkerDecodeBuffer=!1,this._intervalGetVideoFrame=0,this._getVideoFrameMode=4,this.loopGetFrameTimes=1,this._countLoopGetFrame=0,this.queue_handledFrame=[],this.array_getFrameTimeCost=[],this.array_decodeFrameTimeCost=[],this._indexCurrentDecodingFrame=0,this._timeEndGettingFrame=null,this._bPauseScan=!1,this._lastDeviceId=void 0,this._intervalDetectVideoPause=1e3,this._vc_bPlayingVideoBeforeHide=!1,this._ev_documentHideEvent=()=>{"visible"===document.visibilityState?this._vc_bPlayingVideoBeforeHide&&("Firefox"==c.browserInfo.browser?this.play():this._video.play(),this._vc_bPlayingVideoBeforeHide=!1):this._video&&!this._video.paused&&(this._vc_bPlayingVideoBeforeHide=!0,this._video.pause())},this._video=null,this._cvsDrawArea=null,this._divScanArea=null,this._divScanLight=null,this._bgLoading=null,this._bgCamera=null,this._selCam=null,this._selRsl=null,this._optGotRsl=null,this._btnClose=null,this._soundOnSuccessfullRead=new Audio("data:audio/mpeg;base64,SUQzBAAAAAAAI1RTU0UAAAAPAAADTGF2ZjU4LjI5LjEwMAAAAAAAAAAAAAAA/+M4wAAAAAAAAAAAAEluZm8AAAAPAAAABQAAAkAAgICAgICAgICAgICAgICAgICAgKCgoKCgoKCgoKCgoKCgoKCgoKCgwMDAwMDAwMDAwMDAwMDAwMDAwMDg4ODg4ODg4ODg4ODg4ODg4ODg4P//////////////////////////AAAAAExhdmM1OC41NAAAAAAAAAAAAAAAACQEUQAAAAAAAAJAk0uXRQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/+MYxAANQAbGeUEQAAHZYZ3fASqD4P5TKBgocg+Bw/8+CAYBA4XB9/4EBAEP4nB9+UOf/6gfUCAIKyjgQ/Kf//wfswAAAwQA/+MYxAYOqrbdkZGQAMA7DJLCsQxNOij///////////+tv///3RWiZGBEhsf/FO/+LoCSFs1dFVS/g8f/4Mhv0nhqAieHleLy/+MYxAYOOrbMAY2gABf/////////////////usPJ66R0wI4boY9/8jQYg//g2SPx1M0N3Z0kVJLIs///Uw4aMyvHJJYmPBYG/+MYxAgPMALBucAQAoGgaBoFQVBUFQWDv6gZBUFQVBUGgaBr5YSgqCoKhIGg7+IQVBUFQVBoGga//SsFSoKnf/iVTEFNRTMu/+MYxAYAAANIAAAAADEwMFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV"),this.bPlaySoundOnSuccessfulRead=!1,this.bVibrateOnSuccessfulRead=!1,this.vibrateDuration=300,this._allCameras=[],this._currentCamera=null,this._videoTrack=null,this.regionMaskFillStyle="rgba(0,0,0,0.5)",this.regionMaskStrokeStyle="rgb(254,142,20)",this.regionMaskLineWidth=2,this.barcodeFillStyle="rgba(254,180,32,0.3)",this.barcodeStrokeStyle="rgba(254,180,32,0.9)",this.barcodeLineWidth=1,this.beingLazyDrawRegionsults=!1,this._indexVideoRegion=0,this._onCameraSelChange=()=>{this.play(this._selCam.value).then(()=>{this._isOpen||this.stop()})},this._onResolutionSelChange=()=>{let e,t;if(this._selRsl&&-1!=this._selRsl.selectedIndex){let i=this._selRsl.options[this._selRsl.selectedIndex];e=i.getAttribute("data-width"),t=i.getAttribute("data-height")}this.play(void 0,e,t).then(()=>{this._isOpen||this.stop()})},this._onCloseBtnClick=()=>{this.hide()},this.iPlayRound=0,this.promisePlay=null}static get defaultUIElementURL(){var e;return null===(e=this._defaultUIElementURL)||void 0===e?void 0:e.replace("@engineResourcePath/",c.engineResourcePath)}static set defaultUIElementURL(e){this._defaultUIElementURL=e}getUIElement(){return this.UIElement}setUIElement(e){return h(this,void 0,void 0,(function*(){if("string"==typeof e||e instanceof String){if(!e.trim().startsWith("<")){let t=yield fetch(e);if(!t.ok)throw Error("setUIElement(elementOrUrl): Network Error: "+t.statusText);e=yield t.text()}if(!e.trim().startsWith("<"))throw Error("setUIElement(elementOrUrl): Can't get valid HTMLElement.");let t=document.createElement("div");t.innerHTML=e;for(let e=0;e{h(this,void 0,void 0,(function*(){let e=yield this.getScanSettings();e.oneDTrustFrameCount=1,yield this.updateScanSettings(e)}))})()}_assertOpen(){if(!this._isOpen)throw Error("The scanner is not open.")}get soundOnSuccessfullRead(){return this._soundOnSuccessfullRead}set soundOnSuccessfullRead(e){e instanceof HTMLAudioElement?this._soundOnSuccessfullRead=e:this._soundOnSuccessfullRead=new Audio(e)}get whenToPlaySoundforSuccessfulRead(){return!0===this.bPlaySoundOnSuccessfulRead?"frame":this.bPlaySoundOnSuccessfulRead?this.bPlaySoundOnSuccessfulRead:"never"}set whenToPlaySoundforSuccessfulRead(e){this.bPlaySoundOnSuccessfulRead="never"!==e&&e}get whenToVibrateforSuccessfulRead(){return!0===this.bVibrateOnSuccessfulRead?"frame":this.bVibrateOnSuccessfulRead?this.bVibrateOnSuccessfulRead:"never"}set whenToVibrateforSuccessfulRead(e){this.bVibrateOnSuccessfulRead="never"!==e&&e}set region(e){this._region=e,this.singleFrameMode||(this.beingLazyDrawRegionsults=!0,setTimeout(()=>{this.beingLazyDrawRegionsults&&this._drawRegionsults()},500))}get region(){return this._region}static createInstance(e){return h(this,void 0,void 0,(function*(){if(u)throw new Error("`BarcodeScanner` is not supported in Node.js.");let t=new g;t._instanceID=yield g.createInstanceInWorker(!0),("string"==typeof e||e instanceof String)&&(e=JSON.parse(e));for(let i in e)t[i]=e[i];return yield t.setUIElement(this.defaultUIElementURL),t.singleFrameMode&&console.warn("The `navigator.mediaDevices.getUserMedia` is unavailable. automatically change to `singleFrameMode`."),t.singleFrameMode||(yield t.updateRuntimeSettings("single")),document.addEventListener("visibilitychange",t._ev_documentHideEvent),t}))}decode(e){return super.decode(e)}decodeBase64String(e){return super.decodeBase64String(e)}decodeUrl(e){return super.decodeUrl(e)}decodeBuffer(e,t,i,r,n,o){return super.decodeBuffer(e,t,i,r,n,o)}decodeCurrentFrame(e){return h(this,void 0,void 0,(function*(){return this._assertOpen(),this._decode_Video(this._video,e)}))}clearMapDecodeRecord(){return h(this,void 0,void 0,(function*(){return yield new Promise((e,t)=>{let i=c._nextTaskID++;c._taskCallbackMap.set(i,i=>{if(i.success)return e();{let e=new Error(i.message);return e.stack=i.stack+"\n"+e.stack,t(e)}}),c._dbrWorker.postMessage({type:"clearMapDecodeRecord",id:i,instanceID:this._instanceID})})}))}static isRegionSinglePreset(e){return JSON.stringify(e)==JSON.stringify(this.singlePresetRegion)}static isRegionNormalPreset(e){return 0==e.regionLeft&&0==e.regionTop&&0==e.regionRight&&0==e.regionBottom&&0==e.regionMeasuredByPercentage}updateRuntimeSettings(e){return h(this,void 0,void 0,(function*(){let t;if("string"==typeof e||e instanceof String)if("speed"==e){let e=yield this.getRuntimeSettings();yield this.resetRuntimeSettings(),t=yield this.getRuntimeSettings(),t.barcodeFormatIds=e.barcodeFormatIds,t.barcodeFormatIds_2=e.barcodeFormatIds_2,g.isRegionSinglePreset(e.region)||(t.region=e.region)}else if("balance"==e){let e=yield this.getRuntimeSettings();yield this.resetRuntimeSettings(),t=yield this.getRuntimeSettings(),t.barcodeFormatIds=e.barcodeFormatIds,t.barcodeFormatIds_2=e.barcodeFormatIds_2,g.isRegionSinglePreset(e.region)||(t.region=e.region),t.deblurLevel=3,t.expectedBarcodesCount=512,t.localizationModes=[2,16,0,0,0,0,0,0],t.timeout=1e5}else if("coverage"==e){let e=yield this.getRuntimeSettings();yield this.resetRuntimeSettings(),t=yield this.getRuntimeSettings(),t.barcodeFormatIds=e.barcodeFormatIds,t.barcodeFormatIds_2=e.barcodeFormatIds_2,g.isRegionSinglePreset(e.region)||(t.region=e.region),t.deblurLevel=5,t.expectedBarcodesCount=512,t.scaleDownThreshold=1e5,t.localizationModes=[2,16,4,8,0,0,0,0],t.timeout=1e5}else if("single"==e){let e=yield this.getRuntimeSettings();yield this.resetRuntimeSettings(),t=yield this.getRuntimeSettings(),t.barcodeFormatIds=e.barcodeFormatIds,t.barcodeFormatIds_2=e.barcodeFormatIds_2,g.isRegionNormalPreset(e.region)?t.region=JSON.parse(JSON.stringify(g.singlePresetRegion)):t.region=e.region,t.expectedBarcodesCount=1,t.localizationModes=[16,2,0,0,0,0,0,0],t.barcodeZoneMinDistanceToImageBorders=0}else t=JSON.parse(e);else{if("object"!=typeof e)throw TypeError("'UpdateRuntimeSettings(settings)': Type of 'settings' should be 'String' or 'PlainObject'.");if(t=JSON.parse(JSON.stringify(e)),t.region instanceof Array){let i=e.region;[i.regionLeft,i.regionTop,i.regionLeft,i.regionBottom,i.regionMeasuredByPercentage].some(e=>void 0!==e)&&(t.region={regionLeft:i.regionLeft||0,regionTop:i.regionTop||0,regionRight:i.regionRight||0,regionBottom:i.regionBottom||0,regionMeasuredByPercentage:i.regionMeasuredByPercentage||0})}}if(!c._bUseFullFeature){if(0!=(t.barcodeFormatIds&~(s.BF_ONED|s.BF_QR_CODE|s.BF_PDF417|s.BF_DATAMATRIX))||0!=t.barcodeFormatIds_2)throw Error("Some of the specified barcode formats are not supported in the compact version. Please try the full-featured version.");if(0!=t.intermediateResultTypes)throw Error("Intermediate results is not supported in the compact version. Please try the full-featured version.")}{let e=t.region;if(this.bFilterRegionInJs?this.userDefinedRegion=JSON.parse(JSON.stringify(e)):this.userDefinedRegion=null,e instanceof Array)if(e.length){for(let t=0;t{let r=c._nextTaskID++;c._taskCallbackMap.set(r,t=>{if(t.success){try{this._handleRetJsonString(t.updateReturn)}catch(e){i(e)}return e()}{let e=new Error(t.message);return e.stack=t.stack+"\n"+e.stack,i(e)}}),c._dbrWorker.postMessage({type:"updateRuntimeSettings",id:r,instanceID:this._instanceID,body:{settings:JSON.stringify(t)}})}),"single"==e&&(yield this.setModeArgument("BinarizationModes",0,"EnableFillBinaryVacancy","0"),yield this.setModeArgument("LocalizationModes",0,"ScanDirection","2"),yield this.setModeArgument("BinarizationModes",0,"BlockSizeX","71"),yield this.setModeArgument("BinarizationModes",0,"BlockSizeY","71"))}))}_bindUI(){if(!this.UIElement)throw new Error("Need to define `UIElement` before opening.");let e=[this.UIElement],t=this.UIElement.children;for(let i of t)e.push(i);for(let t=0;t','','',''].join(""),this._optGotRsl=this._optGotRsl||this._selRsl.options[0])):!this._optGotRsl&&t.classList.contains("dbrScanner-opt-gotResolution")?this._optGotRsl=t:!this._btnClose&&t.classList.contains("dbrScanner-btn-close")?this._btnClose=t:!this._video&&t.classList.contains("dbrScanner-existingVideo")?(this._video=t,this._video.setAttribute("playsinline","true"),this.singleFrameMode=!1):!i&&t.tagName&&"video"==t.tagName.toLowerCase()&&(i=t);if(!this._video&&i&&(this._video=i),this.singleFrameMode?(this._video&&(this._video.addEventListener("click",this._clickIptSingleFrameMode),this._video.style.cursor="pointer",this._video.setAttribute("title","Take a photo")),this._cvsDrawArea&&(this._cvsDrawArea.addEventListener("click",this._clickIptSingleFrameMode),this._cvsDrawArea.style.cursor="pointer",this._cvsDrawArea.setAttribute("title","Take a photo")),this._divScanArea&&(this._divScanArea.addEventListener("click",this._clickIptSingleFrameMode),this._divScanArea.style.cursor="pointer",this._divScanArea.setAttribute("title","Take a photo")),this._bgCamera&&(this._bgCamera.style.display="")):this._bgLoading&&(this._bgLoading.style.display=""),this._selCam&&this._selCam.addEventListener("change",this._onCameraSelChange),this._selRsl&&this._selRsl.addEventListener("change",this._onResolutionSelChange),this._btnClose&&this._btnClose.addEventListener("click",this._onCloseBtnClick),!this._video)throw this._unbindUI(),Error("Can not find HTMLVideoElement with class `dbrScanner-video`.");this._isOpen=!0}_unbindUI(){this._clearRegionsults(),this.singleFrameMode?(this._video&&(this._video.removeEventListener("click",this._clickIptSingleFrameMode),this._video.style.cursor="",this._video.removeAttribute("title")),this._cvsDrawArea&&(this._cvsDrawArea.removeEventListener("click",this._clickIptSingleFrameMode),this._cvsDrawArea.style.cursor="",this._cvsDrawArea.removeAttribute("title")),this._divScanArea&&(this._divScanArea.removeEventListener("click",this._clickIptSingleFrameMode),this._divScanArea.style.cursor="",this._divScanArea.removeAttribute("title")),this._bgCamera&&(this._bgCamera.style.display="none")):this._bgLoading&&(this._bgLoading.style.display="none"),this._selCam&&this._selCam.removeEventListener("change",this._onCameraSelChange),this._selRsl&&this._selRsl.removeEventListener("change",this._onResolutionSelChange),this._btnClose&&this._btnClose.removeEventListener("click",this._onCloseBtnClick),this._video=null,this._cvsDrawArea=null,this._divScanArea=null,this._divScanLight=null,this._selCam=null,this._selRsl=null,this._optGotRsl=null,this._btnClose=null,this._isOpen=!1}_renderSelCameraInfo(){if(this._selCam&&(this._selCam.innerHTML=""),this._selCam){let e;for(let t of this._allCameras){let i=document.createElement("option");i.value=t.deviceId,i.innerText=t.label,this._selCam.append(i),t.deviceId&&this._currentCamera&&this._currentCamera.deviceId==t.deviceId&&(e=i)}this._selCam.value=e?e.value:""}}getAllCameras(){return h(this,void 0,void 0,(function*(){const e=yield navigator.mediaDevices.enumerateDevices(),t=[],i=[];if(this._allCameras)for(let e of this._allCameras)e._checked&&i.push(e);for(let r=0;r{let i=c._nextTaskID++;c._taskCallbackMap.set(i,i=>{if(i.success){let t=i.results;return t.intervalTime=this.intervalTime,e(t)}{let e=new Error(i.message);return e.stack+="\n"+i.stack,t(e)}}),c._dbrWorker.postMessage({type:"getScanSettings",id:i,instanceID:this._instanceID})})}))}updateScanSettings(e){return h(this,void 0,void 0,(function*(){return this.intervalTime=e.intervalTime,yield new Promise((t,i)=>{let r=c._nextTaskID++;c._taskCallbackMap.set(r,e=>{if(e.success)return t();{let t=new Error(e.message);return t.stack+="\n"+e.stack,i(t)}}),g._dbrWorker.postMessage({type:"updateScanSettings",id:r,instanceID:this._instanceID,body:{settings:e}})})}))}getVideoSettings(){return JSON.parse(JSON.stringify(this.videoSettings))}updateVideoSettings(e){return this.videoSettings=JSON.parse(JSON.stringify(e)),this._lastDeviceId=null,this._isOpen?this.play():Promise.resolve()}isOpen(){return this._isOpen}_show(){this.UIElement.parentNode||(this.UIElement.style.position="fixed",this.UIElement.style.left="0",this.UIElement.style.top="0",document.body.append(this.UIElement)),"none"==this.UIElement.style.display&&(this.UIElement.style.display="")}stop(){this._video&&this._video.srcObject&&(c._onLog&&c._onLog("======stop video========"),this._video.srcObject.getTracks().forEach(e=>{e.stop()}),this._video.srcObject=null,this._videoTrack=null,this._currentCamera=null),this._video&&this._video.classList.contains("dbrScanner-existingVideo")&&(c._onLog&&c._onLog("======stop existing video========"),this._video.pause(),this._video.currentTime=0),this._bgLoading&&(this._bgLoading.style.animationPlayState=""),this._divScanLight&&(this._divScanLight.style.display="none"),this._drawRegionsults(),this.queue_handledFrame.length=0,this.array_decodeFrameTimeCost.length=0,this.array_getFrameTimeCost.length=0,this._intervalGetVideoFrame=0}pause(){this._video&&this._video.pause(),this._divScanLight&&(this._divScanLight.style.display="none")}play(e,t,i){return h(this,void 0,void 0,(function*(){if(this._assertOpen(),this._video&&this.videoSrc){yield new Promise((e,t)=>{this._video.onloadedmetadata=()=>h(this,void 0,void 0,(function*(){this._video.onloadedmetadata=null,yield this._video.play(),e()})),"string"==typeof this.videoSrc||this.videoSrc instanceof String?this._video.src=this.videoSrc:this._video.srcObject=this.videoSrc,setTimeout(()=>t(new Error("Failed to play video. Timeout.")),4e3)});let e={width:this._video.videoWidth,height:this._video.videoHeight};return this.onPlayed&&setTimeout(()=>{this.onPlayed(e)},0),e}if(this.singleFrameMode)return this._clickIptSingleFrameMode(),{width:0,height:0};const r=++this.iPlayRound;return this.promisePlay&&(yield this.promisePlay,rh(this,void 0,void 0,(function*(){var r;try{this._video&&this._video.srcObject&&this.stop(),c._onLog&&c._onLog("======before video========"),yield this.getAllCameras();let n=()=>{if(this.bDestroyed)throw d&&d.getTracks().forEach(e=>{e.stop()}),this._video.srcObject=null,this._videoTrack=null,this._currentCamera=null,new Error("The BarcodeScanner instance has been destroyed.")};const o=JSON.parse(JSON.stringify(this.videoSettings));let s;"boolean"==typeof o.video&&(o.video={}),t&&(o.video.width={ideal:t}),i&&(o.video.height={ideal:i});const a=["rear","back","rück","arrière","trasera","trás","traseira","posteriore","后面","後面","背面","后置","後置","背置","задней","الخلفية","후","arka","achterzijde","หลัง","baksidan","bagside","sau","bak","tylny","takakamera","belakang","אחורית","πίσω","spate","hátsó","zadní","darrere","zadná","задня","stražnja","belakang","बैक"];let d,_=()=>{for(let e of this._allCameras){let t=e.label.toLowerCase();if(t&&a.some(e=>-1!=t.indexOf(e))&&/\b0(\b)?/.test(t)){delete o.video.facingMode,o.video.deviceId={ideal:e.deviceId};break}}o.video.deviceId||-1==["Android","HarmonyOS"].indexOf(c.browserInfo.OS)||(delete o.video.facingMode,o.video.deviceId={ideal:this._allCameras[this._allCameras.length-1].deviceId})};if(e)delete o.video.facingMode,o.video.deviceId={exact:e},this._lastDeviceId=e;else if(o.video.deviceId);else if(this._lastDeviceId)delete o.video.facingMode,o.video.deviceId={exact:this._lastDeviceId};else if(o.video.facingMode){let e=o.video.facingMode;e instanceof Array&&e.length&&(e=e[0]),e=e.exact||e.ideal||e,"environment"===e&&(s=!!o.video.facingMode,_())}c._onLog&&c._onLog("======try getUserMedia========");let l,u=[0,500],g=null,E=null,R=e=>h(this,void 0,void 0,(function*(){for(let t of u){n(),t&&(yield new Promise(e=>setTimeout(e,t))),n();{const t=e.video.deviceId;E=t?t.exact||t.ideal||t:null}try{c._onLog&&c._onLog("ask "+JSON.stringify(e)),d=yield navigator.mediaDevices.getUserMedia(e);break}catch(e){g=e,c._onLog&&c._onLog(e.message||e)}}}));if(yield R(o),!d){if(c._onLog&&c._onLog("======try getUserMedia again========"),l=JSON.parse(JSON.stringify(o)),"object"==typeof l.video){"iPhone"==c.browserInfo.OS?(t>=1280||i>=1280?l.video.width=1280:t>=640||i>=640?l.video.width=640:(t<640||i<640)&&(l.video.width=320),delete l.video.height):s&&!o.video.deviceId?(delete l.video.facingMode,this._allCameras.length&&(l.video.deviceId={ideal:this._allCameras[this._allCameras.length-1].deviceId})):l.video=!0}c._onLog&&c._onLog(l),yield R(l)}if(d||(u=[1e3,2e3],yield R(o)),d||(yield R(l)),!d)throw g;const m=()=>{const e=d.getVideoTracks();let t;e.length&&(t=this._videoTrack=e[0]);let i=void 0;if(this._video&&t){if(t.label)for(let e of this._allCameras)if(t.label==e.label){e._checked=!0,i=e,this._lastDeviceId=e.deviceId;break}if(!i&&E)for(let e of this._allCameras)if(E==e.deviceId){t.label&&(e._checked=!0,e.label=t.label),i=e,this._lastDeviceId=e.deviceId;break}}this._currentCamera=i};if(yield this.getAllCameras(),n(),s){m(),_();let e=o.video.deviceId;e&&(e=e.exact||e.ideal||e);let t=null===(r=this._currentCamera)||void 0===r?void 0:r.deviceId;!e||t&&e==t||(d.getTracks().forEach(e=>{e.stop()}),u=[0,500,1e3,2e3],yield R(o))}n();const f=()=>h(this,void 0,void 0,(function*(){c._onLog&&c._onLog("======play video========"),yield new Promise((e,t)=>{this._video.onloadedmetadata=()=>h(this,void 0,void 0,(function*(){this._video.onloadedmetadata=null,yield this._video.play(),e()})),this._video.srcObject=d,setTimeout(()=>t(new Error("Failed to play video. Timeout.")),4e3)})}));yield f(),c._onLog&&c._onLog("======played video========"),this._bgLoading&&(this._bgLoading.style.animationPlayState="paused");const I="got "+this._video.videoWidth+"x"+this._video.videoHeight;this._optGotRsl&&(this._optGotRsl.setAttribute("data-width",this._video.videoWidth),this._optGotRsl.setAttribute("data-height",this._video.videoHeight),this._optGotRsl.innerText=I,this._selRsl&&this._optGotRsl.parentNode==this._selRsl&&(this._selRsl.value="got")),c._onLog&&c._onLog(I),m(),n(),this._renderSelCameraInfo();let A={width:this._video.videoWidth,height:this._video.videoHeight};return this.onPlayed&&setTimeout(()=>{this.onPlayed(A)},0),this.promisePlay=null,A}catch(e){throw this.promisePlay=null,e}})))(),yield this.promisePlay)}))}pauseScan(){this._assertOpen(),this._bPauseScan=!0,this._divScanLight&&(this._divScanLight.style.display="none")}resumeScan(){this._assertOpen(),this._bPauseScan=!1}getCapabilities(){return this._assertOpen(),this._videoTrack.getCapabilities?this._videoTrack.getCapabilities():{}}getCameraSettings(){return this._assertOpen(),this._videoTrack.getSettings()}getConstraints(){return this._assertOpen(),this._videoTrack.getConstraints()}applyConstraints(e){return h(this,void 0,void 0,(function*(){if(this._assertOpen(),!this._videoTrack.applyConstraints)throw Error("Not supported.");return yield this._videoTrack.applyConstraints(e)}))}turnOnTorch(){return h(this,void 0,void 0,(function*(){if(this._assertOpen(),this.getCapabilities().torch)return yield this._videoTrack.applyConstraints({advanced:[{torch:!0}]});throw Error("Not supported.")}))}turnOffTorch(){return h(this,void 0,void 0,(function*(){if(this._assertOpen(),this.getCapabilities().torch)return yield this._videoTrack.applyConstraints({advanced:[{torch:!1}]});throw Error("Not supported.")}))}setColorTemperature(e){return h(this,void 0,void 0,(function*(){this._assertOpen();let t=this.getCapabilities().colorTemperature;if(!t)throw Error("Not supported.");return et.max&&(e=t.max),yield this._videoTrack.applyConstraints({advanced:[{colorTemperature:e}]})}))}setExposureCompensation(e){return h(this,void 0,void 0,(function*(){this._assertOpen();let t=this.getCapabilities().exposureCompensation;if(!t)throw Error("Not supported.");return et.max&&(e=t.max),yield this._videoTrack.applyConstraints({advanced:[{exposureCompensation:e}]})}))}setZoom(e){return h(this,void 0,void 0,(function*(){this._assertOpen();let t=this.getCapabilities().zoom;if(!t)throw Error("Not supported.");return et.max&&(e=t.max),yield this._videoTrack.applyConstraints({advanced:[{zoom:e}]})}))}setFrameRate(e){return h(this,void 0,void 0,(function*(){this._assertOpen();let t=this.getCapabilities().frameRate;if(!t)throw Error("Not supported.");return et.max&&(e=t.max),yield this._videoTrack.applyConstraints({width:{ideal:Math.max(this._video.videoWidth,this._video.videoHeight)},frameRate:e})}))}_cloneDecodeResults(e){if(e instanceof Array){let t=[];for(let i of e)t.push(this._cloneDecodeResults(i));return t}{let t=e;return JSON.parse(JSON.stringify(t,(e,t)=>"oriVideoCanvas"==e||"searchRegionCanvas"==e?void 0:t))}}_loopReadVideo(){return h(this,void 0,void 0,(function*(){if(this.bDestroyed)return;if(!this._isOpen)return void(yield this.clearMapDecodeRecord());if(this._video.paused||this._bPauseScan)return c._onLog&&c._onLog("Video or scan is paused. Ask in 1s."),yield this.clearMapDecodeRecord(),void setTimeout(()=>{this._loopReadVideo()},this._intervalDetectVideoPause);this._divScanLight&&"none"==this._divScanLight.style.display&&(this._divScanLight.style.display=""),c._onLog&&c._onLog("======= once read ======="),c._onLog&&(this._timeStartDecode=Date.now());let e=this.queue_handledFrame;this._countLoopGetFrame=0,0===e.length?this.loopGetVideoFrame(!0):(this._idGetFrameTimeout&&clearTimeout(this._idGetFrameTimeout),this._idGetFrameTimeout=setTimeout(()=>{this._countLoopGetFrame++,this.loopGetVideoFrame(!0)},this._intervalGetVideoFrame)),this._indexCurrentDecodingFrame=this._indexVideoRegion,this.region&&this.region instanceof Array&&++this._indexVideoRegion>=this.region.length&&(this._indexVideoRegion=0),(()=>h(this,void 0,void 0,(function*(){if(e[0]&&e[0].bUseWebGL){let{u8Gray:t,dWidth:i,dHeight:n}=e.pop();this._bWorkerDecodeBuffer=!0;let o={bUseWebGL:!0};return!this._timeEndGettingFrame||(o._timeEndGettingFrame=this._timeEndGettingFrame),yield this._decodeBuffer_Uint8Array(t,i,n,i,r.IPF_GrayScaled,o)}if(e[0]&&!1===e[0].bUseWebGL){let{data:t,cvs:i,config:n,region:o,sx:s,sy:a,sWidth:d,sHeight:_,dWidth:l,dHeight:h}=e.pop();this._bWorkerDecodeBuffer=!0,n.bUseWebGL=!1,!this._timeEndGettingFrame||(n._timeEndGettingFrame=this._timeEndGettingFrame),(this.bSaveOriCanvas||this.singleFrameMode)&&(this.oriCanvas=i);let u=yield this._decodeBuffer_Uint8Array(t,i.width,i.height,4*i.width,r.IPF_ABGR_8888,n);return c.fixResultLocationWhenFilterRegionInJs(o,u,s,a,d,_,l,h),u}{let e=new Error("queue_handledFrame is empty.");return new Promise(t=>t(e))}})))().then(e=>{c._onLog&&c._onLog(e);Date.now();if(this._bWorkerDecodeBuffer=!1,this._idGetFrameTimeout2&&clearTimeout(this._idGetFrameTimeout2),4===this._getVideoFrameMode){let e=this.array_decodeFrameTimeCost,t=this.array_getFrameTimeCost,i=this._indexCurrentDecodingFrame;if(this.region instanceof Array?(e[i]?e[i].length>=5&&e[i].shift():e[i]=[],e[i].push(this._lastInnerDecodeDuration)):(e.length>=5&&e.shift(),e.push(this._lastInnerDecodeDuration)),this.region instanceof Array){let r=0,n=0;r=i+1>=this.region.length?0:i+1,n=r+1>=this.region.length?0:r+1,e[r]&&e[r].length&&t[n]&&t[n].length?this._intervalGetVideoFrame=Math.min(...e[r])-Math.max(...t[n]):this._intervalGetVideoFrame=0}else t&&t.length?this._intervalGetVideoFrame=Math.min(...e)-Math.max(...t):this._intervalGetVideoFrame=0;this._intervalGetVideoFrame=this._intervalGetVideoFrame>0?this._intervalGetVideoFrame:0}if(this._isOpen&&!this._video.paused&&!this._bPauseScan){if(this.bPlaySoundOnSuccessfulRead&&e.length){let t=!1;if(!0===this.bPlaySoundOnSuccessfulRead||"frame"===this.bPlaySoundOnSuccessfulRead)t=!0;else if("unduplicated"===this.bPlaySoundOnSuccessfulRead)for(let i of e)if(i.bUnduplicated){t=!0;break}t&&(this.soundOnSuccessfullRead.currentTime=0,this.soundOnSuccessfullRead.play().catch(e=>{console.warn("Autoplay not allowed. User interaction required: "+(e.message||e))}))}if(navigator.vibrate&&this.bVibrateOnSuccessfulRead&&e.length){let t=!1;if(!0===this.bVibrateOnSuccessfulRead||"frame"===this.bVibrateOnSuccessfulRead)t=!0;else if("unduplicated"===this.bVibrateOnSuccessfulRead)for(let i of e)if(i.bUnduplicated){t=!0;break}if(t)try{navigator.vibrate(this.vibrateDuration)}catch(e){console.warn("Vibration not allowed. User interaction required: "+(e.message||e))}}if(this.onFrameRead){let t=this._cloneDecodeResults(e);for(let e of t)delete e.bUnduplicated;this.onFrameRead(t)}if(this.onUnduplicatedRead)for(let t of e)t.bUnduplicated&&this.onUnduplicatedRead(t.barcodeText,this._cloneDecodeResults(t));this._drawRegionsults(e)}setTimeout(()=>{this._loopReadVideo()},this.intervalTime)}).catch(e=>{this._bWorkerDecodeBuffer=!1,c._onLog&&c._onLog(e.message||e),setTimeout(()=>{this._loopReadVideo()},Math.max(this.intervalTime,1e3)),"platform error"==e.message||console.warn(e.message)})}))}loopGetVideoFrame(e){if(this.bDestroyed)return;if(!this._isOpen)return void this.clearMapDecodeRecord();if(this._video.paused||this._bPauseScan)return c._onLog&&c._onLog("Video or scan is paused. Ask in 1s."),void this.clearMapDecodeRecord();let t=Date.now();c._onLog&&c._onLog("start getting a frame: "+t);let i=this.queue_handledFrame,r={};if(this.region)if(this.region instanceof Array){let e=this.region[this._indexVideoRegion];e&&(r.region=JSON.parse(JSON.stringify(e)))}else r.region=JSON.parse(JSON.stringify(this.region));if(0===this._getVideoFrameMode){let e=this.handleVideoFrame(this._video,r);e&&(i[0]=e)}else if(1===this._getVideoFrameMode){let t=this.handleVideoFrame(this._video,r);t&&(i[0]=t),this._idGetFrameTimeout&&clearTimeout(this._idGetFrameTimeout),e&&(this._idGetFrameTimeout=setTimeout(()=>{this._bWorkerDecodeBuffer&&this._countLoopGetFrame{this._bWorkerDecodeBuffer&&this.loopGetVideoFrame(!0)},this._intervalGetVideoFrame)}else if(4===this._getVideoFrameMode){let t=this.handleVideoFrame(this._video,r);t&&(i[0]=t),this._idGetFrameTimeout&&clearTimeout(this._idGetFrameTimeout),e&&(this._idGetFrameTimeout=setTimeout(()=>{this._bWorkerDecodeBuffer&&this._countLoopGetFrame{0!=this.queue_handledFrame.length&&(c._onLog&&c._onLog("second timeout is executed: "+Date.now()),this.loopGetVideoFrame(!1))},200);let n=Date.now(),o=n-t;if(4===this._getVideoFrameMode){let e=this.array_getFrameTimeCost;if(this.region instanceof Array){let t=this._indexVideoRegion;e[t]?e[t].length>=5&&e[t].shift():e[t]=[],e[t].push(o)}else e.length>=5&&e.shift(),e.push(o)}this._timeEndGettingFrame=n,c._onLog&&c._onLog("end getting a frame: "+n),c._onLog&&c._onLog("get frame cost: "+o)}_drawRegionsults(e){let t,i,r;if(this.beingLazyDrawRegionsults=!1,this.singleFrameMode){if(!this.oriCanvas)return;t="contain",i=this.oriCanvas.width,r=this.oriCanvas.height}else{if(!this._video)return;t=this._video.style.objectFit||"contain",i=this._video.videoWidth,r=this._video.videoHeight}let n=this.region;if(n&&(!n.regionLeft&&!n.regionRight&&!n.regionTop&&!n.regionBottom&&!n.regionMeasuredByPercentage||n instanceof Array?n=null:n.regionMeasuredByPercentage?n=n.regionLeft||n.regionRight||100!==n.regionTop||100!==n.regionBottom?{regionLeft:Math.round(n.regionLeft/100*i),regionTop:Math.round(n.regionTop/100*r),regionRight:Math.round(n.regionRight/100*i),regionBottom:Math.round(n.regionBottom/100*r)}:null:(n=JSON.parse(JSON.stringify(n)),delete n.regionMeasuredByPercentage)),this._cvsDrawArea){this._cvsDrawArea.style.objectFit=t;let o=this._cvsDrawArea;o.width=i,o.height=r;let s=o.getContext("2d");if(n){s.fillStyle=this.regionMaskFillStyle,s.fillRect(0,0,o.width,o.height),s.globalCompositeOperation="destination-out",s.fillStyle="#000";let e=Math.round(this.regionMaskLineWidth/2);s.fillRect(n.regionLeft-e,n.regionTop-e,n.regionRight-n.regionLeft+2*e,n.regionBottom-n.regionTop+2*e),s.globalCompositeOperation="source-over",s.strokeStyle=this.regionMaskStrokeStyle,s.lineWidth=this.regionMaskLineWidth,s.rect(n.regionLeft,n.regionTop,n.regionRight-n.regionLeft,n.regionBottom-n.regionTop),s.stroke()}if(e){s.globalCompositeOperation="destination-over",s.fillStyle=this.barcodeFillStyle,s.strokeStyle=this.barcodeStrokeStyle,s.lineWidth=this.barcodeLineWidth,e=e||[];for(let t of e){let e=t.localizationResult;s.beginPath(),s.moveTo(e.x1,e.y1),s.lineTo(e.x2,e.y2),s.lineTo(e.x3,e.y3),s.lineTo(e.x4,e.y4),s.fill(),s.beginPath(),s.moveTo(e.x1,e.y1),s.lineTo(e.x2,e.y2),s.lineTo(e.x3,e.y3),s.lineTo(e.x4,e.y4),s.closePath(),s.stroke()}}this.singleFrameMode&&(s.globalCompositeOperation="destination-over",s.drawImage(this.oriCanvas,0,0))}if(this._divScanArea){let e=this._video.offsetWidth,t=this._video.offsetHeight,o=1;e/tsuper.destroy}});return h(this,void 0,void 0,(function*(){document.removeEventListener("visibilitychange",this._ev_documentHideEvent),yield this.close();for(let e of this.styleEls)e.remove();this.styleEls.splice(0,this.styleEls.length),this.bDestroyed||(yield e.destroy.call(this))}))}}var E,R,m,f,I,A,S,D,T,v,p,M,y,C,L,O,b,B,N,F,P,w,U,G,V,k,x;g._defaultUIElementURL="@engineResourcePath/dbr.scanner.html",g.singlePresetRegion=[null,{regionLeft:0,regionTop:30,regionRight:100,regionBottom:70,regionMeasuredByPercentage:1},{regionLeft:25,regionTop:25,regionRight:75,regionBottom:75,regionMeasuredByPercentage:1},{regionLeft:25,regionTop:25,regionRight:75,regionBottom:75,regionMeasuredByPercentage:1}],function(e){e[e.BICM_DARK_ON_LIGHT=1]="BICM_DARK_ON_LIGHT",e[e.BICM_LIGHT_ON_DARK=2]="BICM_LIGHT_ON_DARK",e[e.BICM_DARK_ON_DARK=4]="BICM_DARK_ON_DARK",e[e.BICM_LIGHT_ON_LIGHT=8]="BICM_LIGHT_ON_LIGHT",e[e.BICM_DARK_LIGHT_MIXED=16]="BICM_DARK_LIGHT_MIXED",e[e.BICM_DARK_ON_LIGHT_DARK_SURROUNDING=32]="BICM_DARK_ON_LIGHT_DARK_SURROUNDING",e[e.BICM_SKIP=0]="BICM_SKIP",e[e.BICM_REV=2147483648]="BICM_REV"}(E||(E={})),function(e){e[e.BCM_AUTO=1]="BCM_AUTO",e[e.BCM_GENERAL=2]="BCM_GENERAL",e[e.BCM_SKIP=0]="BCM_SKIP",e[e.BCM_REV=2147483648]="BCM_REV"}(R||(R={})),function(e){e[e.BF2_NULL=0]="BF2_NULL",e[e.BF2_POSTALCODE=32505856]="BF2_POSTALCODE",e[e.BF2_NONSTANDARD_BARCODE=1]="BF2_NONSTANDARD_BARCODE",e[e.BF2_USPSINTELLIGENTMAIL=1048576]="BF2_USPSINTELLIGENTMAIL",e[e.BF2_POSTNET=2097152]="BF2_POSTNET",e[e.BF2_PLANET=4194304]="BF2_PLANET",e[e.BF2_AUSTRALIANPOST=8388608]="BF2_AUSTRALIANPOST",e[e.BF2_RM4SCC=16777216]="BF2_RM4SCC",e[e.BF2_DOTCODE=2]="BF2_DOTCODE"}(m||(m={})),function(e){e[e.BM_AUTO=1]="BM_AUTO",e[e.BM_LOCAL_BLOCK=2]="BM_LOCAL_BLOCK",e[e.BM_SKIP=0]="BM_SKIP",e[e.BM_THRESHOLD=4]="BM_THRESHOLD",e[e.BM_REV=2147483648]="BM_REV"}(f||(f={})),function(e){e[e.ECCM_CONTRAST=1]="ECCM_CONTRAST"}(I||(I={})),function(e){e[e.CFM_GENERAL=1]="CFM_GENERAL"}(A||(A={})),function(e){e[e.CCM_AUTO=1]="CCM_AUTO",e[e.CCM_GENERAL_HSV=2]="CCM_GENERAL_HSV",e[e.CCM_SKIP=0]="CCM_SKIP",e[e.CCM_REV=2147483648]="CCM_REV"}(S||(S={})),function(e){e[e.CICM_GENERAL=1]="CICM_GENERAL",e[e.CICM_SKIP=0]="CICM_SKIP",e[e.CICM_REV=2147483648]="CICM_REV"}(D||(D={})),function(e){e[e.CM_IGNORE=1]="CM_IGNORE",e[e.CM_OVERWRITE=2]="CM_OVERWRITE"}(T||(T={})),function(e){e[e.DM_SKIP=0]="DM_SKIP",e[e.DM_DIRECT_BINARIZATION=1]="DM_DIRECT_BINARIZATION",e[e.DM_THRESHOLD_BINARIZATION=2]="DM_THRESHOLD_BINARIZATION",e[e.DM_GRAY_EQUALIZATION=4]="DM_GRAY_EQUALIZATION",e[e.DM_SMOOTHING=8]="DM_SMOOTHING",e[e.DM_MORPHING=16]="DM_MORPHING",e[e.DM_DEEP_ANALYSIS=32]="DM_DEEP_ANALYSIS",e[e.DM_SHARPENING=64]="DM_SHARPENING",e[e.DM_BASED_ON_LOC_BIN=128]="DM_BASED_ON_LOC_BIN",e[e.DM_SHARPENING_SMOOTHING=256]="DM_SHARPENING_SMOOTHING"}(v||(v={})),function(e){e[e.DRM_AUTO=1]="DRM_AUTO",e[e.DRM_GENERAL=2]="DRM_GENERAL",e[e.DRM_SKIP=0]="DRM_SKIP",e[e.DRM_REV=2147483648]="DRM_REV"}(p||(p={})),function(e){e[e.DPMCRM_AUTO=1]="DPMCRM_AUTO",e[e.DPMCRM_GENERAL=2]="DPMCRM_GENERAL",e[e.DPMCRM_SKIP=0]="DPMCRM_SKIP",e[e.DPMCRM_REV=2147483648]="DPMCRM_REV"}(M||(M={})),function(e){e[e.GTM_INVERTED=1]="GTM_INVERTED",e[e.GTM_ORIGINAL=2]="GTM_ORIGINAL",e[e.GTM_SKIP=0]="GTM_SKIP",e[e.GTM_REV=2147483648]="GTM_REV"}(y||(y={})),function(e){e[e.IPM_AUTO=1]="IPM_AUTO",e[e.IPM_GENERAL=2]="IPM_GENERAL",e[e.IPM_GRAY_EQUALIZE=4]="IPM_GRAY_EQUALIZE",e[e.IPM_GRAY_SMOOTH=8]="IPM_GRAY_SMOOTH",e[e.IPM_SHARPEN_SMOOTH=16]="IPM_SHARPEN_SMOOTH",e[e.IPM_MORPHOLOGY=32]="IPM_MORPHOLOGY",e[e.IPM_SKIP=0]="IPM_SKIP",e[e.IPM_REV=2147483648]="IPM_REV"}(C||(C={})),function(e){e[e.IRSM_MEMORY=1]="IRSM_MEMORY",e[e.IRSM_FILESYSTEM=2]="IRSM_FILESYSTEM",e[e.IRSM_BOTH=4]="IRSM_BOTH"}(L||(L={})),function(e){e[e.IRT_NO_RESULT=0]="IRT_NO_RESULT",e[e.IRT_ORIGINAL_IMAGE=1]="IRT_ORIGINAL_IMAGE",e[e.IRT_COLOUR_CLUSTERED_IMAGE=2]="IRT_COLOUR_CLUSTERED_IMAGE",e[e.IRT_COLOUR_CONVERTED_GRAYSCALE_IMAGE=4]="IRT_COLOUR_CONVERTED_GRAYSCALE_IMAGE",e[e.IRT_TRANSFORMED_GRAYSCALE_IMAGE=8]="IRT_TRANSFORMED_GRAYSCALE_IMAGE",e[e.IRT_PREDETECTED_REGION=16]="IRT_PREDETECTED_REGION",e[e.IRT_PREPROCESSED_IMAGE=32]="IRT_PREPROCESSED_IMAGE",e[e.IRT_BINARIZED_IMAGE=64]="IRT_BINARIZED_IMAGE",e[e.IRT_TEXT_ZONE=128]="IRT_TEXT_ZONE",e[e.IRT_CONTOUR=256]="IRT_CONTOUR",e[e.IRT_LINE_SEGMENT=512]="IRT_LINE_SEGMENT",e[e.IRT_FORM=1024]="IRT_FORM",e[e.IRT_SEGMENTATION_BLOCK=2048]="IRT_SEGMENTATION_BLOCK",e[e.IRT_TYPED_BARCODE_ZONE=4096]="IRT_TYPED_BARCODE_ZONE",e[e.IRT_PREDETECTED_QUADRILATERAL=8192]="IRT_PREDETECTED_QUADRILATERAL"}(O||(O={})),function(e){e[e.LM_SKIP=0]="LM_SKIP",e[e.LM_AUTO=1]="LM_AUTO",e[e.LM_CONNECTED_BLOCKS=2]="LM_CONNECTED_BLOCKS",e[e.LM_LINES=8]="LM_LINES",e[e.LM_STATISTICS=4]="LM_STATISTICS",e[e.LM_SCAN_DIRECTLY=16]="LM_SCAN_DIRECTLY",e[e.LM_STATISTICS_MARKS=32]="LM_STATISTICS_MARKS",e[e.LM_STATISTICS_POSTAL_CODE=64]="LM_STATISTICS_POSTAL_CODE",e[e.LM_CENTRE=128]="LM_CENTRE",e[e.LM_REV=2147483648]="LM_REV"}(b||(b={})),function(e){e[e.PDFRM_RASTER=1]="PDFRM_RASTER",e[e.PDFRM_AUTO=2]="PDFRM_AUTO",e[e.PDFRM_VECTOR=4]="PDFRM_VECTOR",e[e.PDFRM_REV=2147483648]="PDFRM_REV"}(B||(B={})),function(e){e[e.QRECL_ERROR_CORRECTION_H=0]="QRECL_ERROR_CORRECTION_H",e[e.QRECL_ERROR_CORRECTION_L=1]="QRECL_ERROR_CORRECTION_L",e[e.QRECL_ERROR_CORRECTION_M=2]="QRECL_ERROR_CORRECTION_M",e[e.QRECL_ERROR_CORRECTION_Q=3]="QRECL_ERROR_CORRECTION_Q"}(N||(N={})),function(e){e[e.RPM_AUTO=1]="RPM_AUTO",e[e.RPM_GENERAL=2]="RPM_GENERAL",e[e.RPM_GENERAL_RGB_CONTRAST=4]="RPM_GENERAL_RGB_CONTRAST",e[e.RPM_GENERAL_GRAY_CONTRAST=8]="RPM_GENERAL_GRAY_CONTRAST",e[e.RPM_GENERAL_HSV_CONTRAST=16]="RPM_GENERAL_HSV_CONTRAST",e[e.RPM_SKIP=0]="RPM_SKIP",e[e.RPM_REV=2147483648]="RPM_REV"}(F||(F={})),function(e){e[e.RCT_PIXEL=1]="RCT_PIXEL",e[e.RCT_PERCENTAGE=2]="RCT_PERCENTAGE"}(P||(P={})),function(e){e[e.RT_STANDARD_TEXT=0]="RT_STANDARD_TEXT",e[e.RT_RAW_TEXT=1]="RT_RAW_TEXT",e[e.RT_CANDIDATE_TEXT=2]="RT_CANDIDATE_TEXT",e[e.RT_PARTIAL_TEXT=3]="RT_PARTIAL_TEXT"}(w||(w={})),function(e){e[e.SUM_AUTO=1]="SUM_AUTO",e[e.SUM_LINEAR_INTERPOLATION=2]="SUM_LINEAR_INTERPOLATION",e[e.SUM_NEAREST_NEIGHBOUR_INTERPOLATION=4]="SUM_NEAREST_NEIGHBOUR_INTERPOLATION",e[e.SUM_SKIP=0]="SUM_SKIP",e[e.SUM_REV=2147483648]="SUM_REV"}(U||(U={})),function(e){e[e.TP_REGION_PREDETECTED=1]="TP_REGION_PREDETECTED",e[e.TP_IMAGE_PREPROCESSED=2]="TP_IMAGE_PREPROCESSED",e[e.TP_IMAGE_BINARIZED=4]="TP_IMAGE_BINARIZED",e[e.TP_BARCODE_LOCALIZED=8]="TP_BARCODE_LOCALIZED",e[e.TP_BARCODE_TYPE_DETERMINED=16]="TP_BARCODE_TYPE_DETERMINED",e[e.TP_BARCODE_RECOGNIZED=32]="TP_BARCODE_RECOGNIZED"}(G||(G={})),function(e){e[e.TFM_AUTO=1]="TFM_AUTO",e[e.TFM_GENERAL_CONTOUR=2]="TFM_GENERAL_CONTOUR",e[e.TFM_SKIP=0]="TFM_SKIP",e[e.TFM_REV=2147483648]="TFM_REV"}(V||(V={})),function(e){e[e.TROM_CONFIDENCE=1]="TROM_CONFIDENCE",e[e.TROM_POSITION=2]="TROM_POSITION",e[e.TROM_FORMAT=4]="TROM_FORMAT",e[e.TROM_SKIP=0]="TROM_SKIP",e[e.TROM_REV=2147483648]="TROM_REV"}(k||(k={})),function(e){e[e.TDM_AUTO=1]="TDM_AUTO",e[e.TDM_GENERAL_WIDTH_CONCENTRATION=2]="TDM_GENERAL_WIDTH_CONCENTRATION",e[e.TDM_SKIP=0]="TDM_SKIP",e[e.TDM_REV=2147483648]="TDM_REV"}(x||(x={}));class W{static get version(){return c.version}static get productKeys(){return c.productKeys}static set productKeys(e){c.productKeys=e}static get handshakeCode(){return c.handshakeCode}static set handshakeCode(e){c.handshakeCode=e}static get organizationID(){return c.organizationID}static set organizationID(e){c.organizationID=e}static get sessionPassword(){return c.sessionPassword}static set sessionPassword(e){c.sessionPassword=e}static get browserInfo(){return c.browserInfo}static detectEnvironment(){return c.detectEnvironment()}static get _workerName(){return c._workerName}static set _workerName(e){c._workerName=e}static get engineResourcePath(){return c.engineResourcePath}static set engineResourcePath(e){c.engineResourcePath=e}static get licenseServer(){return c.licenseServer}static set licenseServer(e){c.licenseServer=e}static get deviceFriendlyName(){return c.deviceFriendlyName}static set deviceFriendlyName(e){c.deviceFriendlyName=e}static get _onLog(){return c._onLog}static set _onLog(e){c._onLog=e}static get _bWasmDebug(){return c._bWasmDebug}static set _bWasmDebug(e){c._bWasmDebug=e}static get _bUseFullFeature(){return c._bUseFullFeature}static set _bUseFullFeature(e){c._bUseFullFeature=e}static get _dbrWorker(){return c._dbrWorker}static isLoaded(){return c.isLoaded()}static isWasmLoaded(){return c.isLoaded()}static loadWasm(){return c.loadWasm()}}W.BarcodeReader=c,W.BarcodeScanner=g,W.EnumBarcodeColourMode=E,W.EnumBarcodeComplementMode=R,W.EnumBarcodeFormat=s,W.EnumBarcodeFormat_2=m,W.EnumBinarizationMode=f,W.EnumClarityCalculationMethod=I,W.EnumClarityFilterMode=A,W.EnumColourClusteringMode=S,W.EnumColourConversionMode=D,W.EnumConflictMode=T,W.EnumDeblurMode=v,W.EnumDeformationResistingMode=p,W.EnumDPMCodeReadingMode=M,W.EnumErrorCode=n,W.EnumGrayscaleTransformationMode=y,W.EnumImagePixelFormat=r,W.EnumImagePreprocessingMode=C,W.EnumIMResultDataType=o,W.EnumIntermediateResultSavingMode=L,W.EnumIntermediateResultType=O,W.EnumLocalizationMode=b,W.EnumPDFReadingMode=B,W.EnumQRCodeErrorCorrectionLevel=N,W.EnumRegionPredetectionMode=F,W.EnumResultCoordinateType=P,W.EnumResultType=w,W.EnumScaleUpMode=U,W.EnumTerminatePhase=G,W.EnumTextFilterMode=V,W.EnumTextResultOrderMode=k,W.EnumTextureDetectionMode=x;t.default=W}])}));let _dbr;{if(typeof dbr=="object"){_dbr=dbr.DBR;}else if(typeof module=="object"&&module.exports&&module.exports.default){_dbr=module.exports.default;}else if(typeof exports=="object"&&exports.dbr){_dbr=exports.dbr.DBR;}}export default _dbr;export const DBR=_dbr.DBR;export const BarcodeReader=_dbr.BarcodeReader;export const BarcodeScanner=_dbr.BarcodeScanner;export const EnumBarcodeColourMode=_dbr.EnumBarcodeColourMode;export const EnumBarcodeComplementMode=_dbr.EnumBarcodeComplementMode;export const EnumBarcodeFormat=_dbr.EnumBarcodeFormat;export const EnumBarcodeFormat_2=_dbr.EnumBarcodeFormat_2;export const EnumBinarizationMode=_dbr.EnumBinarizationMode;export const EnumClarityCalculationMethod=_dbr.EnumClarityCalculationMethod;export const EnumClarityFilterMode=_dbr.EnumClarityFilterMode;export const EnumColourClusteringMode=_dbr.EnumColourClusteringMode;export const EnumColourConversionMode=_dbr.EnumColourConversionMode;export const EnumConflictMode=_dbr.EnumConflictMode;export const EnumDeblurMode=_dbr.EnumDeblurMode;export const EnumDeformationResistingMode=_dbr.EnumDeformationResistingMode;export const EnumDPMCodeReadingMode=_dbr.EnumDPMCodeReadingMode;export const EnumErrorCode=_dbr.EnumErrorCode;export const EnumGrayscaleTransformationMode=_dbr.EnumGrayscaleTransformationMode;export const EnumImagePixelFormat=_dbr.EnumImagePixelFormat;export const EnumImagePreprocessingMode=_dbr.EnumImagePreprocessingMode;export const EnumIMResultDataType=_dbr.EnumIMResultDataType;export const EnumIntermediateResultSavingMode=_dbr.EnumIntermediateResultSavingMode;export const EnumIntermediateResultType=_dbr.EnumIntermediateResultType;export const EnumLocalizationMode=_dbr.EnumLocalizationMode;export const EnumPDFReadingMode=_dbr.EnumPDFReadingMode;export const EnumQRCodeErrorCorrectionLevel=_dbr.EnumQRCodeErrorCorrectionLevel;export const EnumRegionPredetectionMode=_dbr.EnumRegionPredetectionMode;export const EnumResultCoordinateType=_dbr.EnumResultCoordinateType;export const EnumResultType=_dbr.EnumResultType;export const EnumScaleUpMode=_dbr.EnumScaleUpMode;export const EnumTerminatePhase=_dbr.EnumTerminatePhase;export const EnumTextFilterMode=_dbr.EnumTextFilterMode;export const EnumTextResultOrderMode=_dbr.EnumTextResultOrderMode;export const EnumTextureDetectionMode=_dbr.EnumTextureDetectionMode; \ No newline at end of file diff --git a/dist/dbr.d.ts b/dist/dbr.d.ts new file mode 100644 index 00000000..c56d4c1c --- /dev/null +++ b/dist/dbr.d.ts @@ -0,0 +1,1971 @@ +/** +* Dynamsoft JavaScript Library +* @product Dynamsoft Barcode Reader JS Edition +* @website http://www.dynamsoft.com +* @preserve Copyright 2021, Dynamsoft Corporation +* @author Dynamsoft +* @version 8.6.0 (js 20210628) +* @fileoverview Dynamsoft JavaScript Library for Barcode Reader +* More info on DBR JS: https://www.dynamsoft.com/Products/barcode-recognition-javascript.aspx +*/ +// Generated by dts-bundle-generator v4.3.0 + +/// + +export interface LocalizationResult { + /** + * The angle of a barcode. Values range from 0 to 360. + */ + angle: number; + /** + * The X coordinate of the left-most point. + */ + x1: number; + /** + * The X coordinate of the second point in a clockwise direction. + */ + x2: number; + /** + * The X coordinate of the third point in a clockwise direction. + */ + x3: number; + /** + * The X coordinate of the fourth point in a clockwise direction. + */ + x4: number; + /** + * The Y coordinate of the left-most point. + */ + y1: number; + /** + * The Y coordinate of the second point in a clockwise direction. + */ + y2: number; + /** + * The Y coordinate of the third point in a clockwise direction. + */ + y3: number; + /** + * The Y coordinate of the fourth point in a clockwise direction. + */ + y4: number; +} +export declare enum EnumBarcodeFormat { + BF_ALL = -31457281, + BF_ONED = 1050623, + BF_GS1_DATABAR = 260096, + BF_CODE_39 = 1, + BF_CODE_128 = 2, + BF_CODE_93 = 4, + BF_CODABAR = 8, + BF_ITF = 16, + BF_EAN_13 = 32, + BF_EAN_8 = 64, + BF_UPC_A = 128, + BF_UPC_E = 256, + BF_INDUSTRIAL_25 = 512, + BF_CODE_39_EXTENDED = 1024, + BF_GS1_DATABAR_OMNIDIRECTIONAL = 2048, + BF_GS1_DATABAR_TRUNCATED = 4096, + BF_GS1_DATABAR_STACKED = 8192, + BF_GS1_DATABAR_STACKED_OMNIDIRECTIONAL = 16384, + BF_GS1_DATABAR_EXPANDED = 32768, + BF_GS1_DATABAR_EXPANDED_STACKED = 65536, + BF_GS1_DATABAR_LIMITED = 131072, + BF_PATCHCODE = 262144, + BF_PDF417 = 33554432, + BF_QR_CODE = 67108864, + BF_DATAMATRIX = 134217728, + BF_AZTEC = 268435456, + BF_MAXICODE = 536870912, + BF_MICRO_QR = 1073741824, + BF_MICRO_PDF417 = 524288, + BF_GS1_COMPOSITE = -2147483648, + BF_MSI_CODE = 1048576, + BF_NULL = 0 +} +/** + * @see [C++ TextResult](https://www.dynamsoft.com/barcode-reader/programming/c-cplusplus/struct/TextResult.html?src=cpp&&ver=latest) +*/ +export interface TextResult { + /** + * The barcode text. + */ + barcodeText: string; + /** + * The barcode format. + */ + barcodeFormat: number | EnumBarcodeFormat; + /** + * Barcode type in string. + */ + barcodeFormatString: string; + /** + * The barcode content in a byte array. + */ + barcodeBytes: number[]; + /** + * The corresponding localization result. + */ + localizationResult: LocalizationResult; +} +export interface RegionDefinition { + regionBottom: number; + regionRight: number; + regionLeft: number; + regionTop: number; + regionMeasuredByPercentage: number | boolean; +} +export declare enum EnumIntermediateResultType { + IRT_NO_RESULT = 0, + IRT_ORIGINAL_IMAGE = 1, + IRT_COLOUR_CLUSTERED_IMAGE = 2, + IRT_COLOUR_CONVERTED_GRAYSCALE_IMAGE = 4, + IRT_TRANSFORMED_GRAYSCALE_IMAGE = 8, + IRT_PREDETECTED_REGION = 16, + IRT_PREPROCESSED_IMAGE = 32, + IRT_BINARIZED_IMAGE = 64, + IRT_TEXT_ZONE = 128, + IRT_CONTOUR = 256, + IRT_LINE_SEGMENT = 512, + IRT_FORM = 1024, + IRT_SEGMENTATION_BLOCK = 2048, + IRT_TYPED_BARCODE_ZONE = 4096, + IRT_PREDETECTED_QUADRILATERAL = 8192 +} +export declare enum EnumTerminatePhase { + TP_REGION_PREDETECTED = 1, + TP_IMAGE_PREPROCESSED = 2, + TP_IMAGE_BINARIZED = 4, + TP_BARCODE_LOCALIZED = 8, + TP_BARCODE_TYPE_DETERMINED = 16, + TP_BARCODE_RECOGNIZED = 32 +} +export declare enum EnumTextResultOrderMode { + TROM_CONFIDENCE = 1, + TROM_POSITION = 2, + TROM_FORMAT = 4, + TROM_SKIP = 0, + TROM_REV = 2147483648 +} +export declare enum EnumBinarizationMode { + BM_AUTO = 1, + BM_LOCAL_BLOCK = 2, + BM_SKIP = 0, + BM_THRESHOLD = 4, + BM_REV = 2147483648 +} +export declare enum EnumPDFReadingMode { + PDFRM_RASTER = 1, + PDFRM_AUTO = 2, + PDFRM_VECTOR = 4, + PDFRM_REV = 2147483648 +} +export declare enum EnumScaleUpMode { + SUM_AUTO = 1, + SUM_LINEAR_INTERPOLATION = 2, + SUM_NEAREST_NEIGHBOUR_INTERPOLATION = 4, + SUM_SKIP = 0, + SUM_REV = 2147483648 +} +export declare enum EnumLocalizationMode { + LM_SKIP = 0, + LM_AUTO = 1, + LM_CONNECTED_BLOCKS = 2, + LM_LINES = 8, + LM_STATISTICS = 4, + LM_SCAN_DIRECTLY = 16, + LM_STATISTICS_MARKS = 32, + LM_STATISTICS_POSTAL_CODE = 64, + LM_CENTRE = 128, + LM_REV = 2147483648 +} +export declare enum EnumBarcodeFormat_2 { + BF2_NULL = 0, + BF2_POSTALCODE = 32505856, + BF2_NONSTANDARD_BARCODE = 1, + BF2_USPSINTELLIGENTMAIL = 1048576, + BF2_POSTNET = 2097152, + BF2_PLANET = 4194304, + BF2_AUSTRALIANPOST = 8388608, + BF2_RM4SCC = 16777216, + BF2_DOTCODE = 2 +} +export declare enum EnumResultCoordinateType { + RCT_PIXEL = 1, + RCT_PERCENTAGE = 2 +} +/** + * @see [C++ RuntimeSettings](https://www.dynamsoft.com/barcode-reader/programming/c-cplusplus/struct/PublicRuntimeSettings.html?src=cpp&&ver=latest) + */ +export interface RuntimeSettings { + /** + * Sets the formats of the barcode in BarcodeFormat group 1 to be read. Barcode formats in BarcodeFormat group 1 can be combined. + * ```js + * let runtimeSettings = await reader.getRuntimeSettings(); + * runtimeSettings.barcodeFormatIds = Dynamsoft.DBR.EnumBarcodeFormat.BF_ONED | Dynamsoft.DBR.EnumBarcodeFormat.BF_QR_CODE; + * await reader.updateRuntimeSettings(runtimeSettings); + * ``` + */ + barcodeFormatIds: number | EnumBarcodeFormat; + /** + * Sets the formats of the barcode in BarcodeFormat group 2 to be read. Barcode formats in BarcodeFormat group 1 can be combined. + */ + barcodeFormatIds_2: number | EnumBarcodeFormat_2; + /** + * Sets the mode and priority for binarization. + */ + binarizationModes: EnumBinarizationMode[]; + /** + * Sets the degree of blurriness of the barcode. + */ + deblurLevel: number; + /** + * Sets the number of barcodes expected to be detected for each image. + */ + expectedBarcodesCount: number; + /** + * Sets the further modes. + */ + furtherModes: any; + /** + * Sets which types of intermediate result to be kept for further reference. Intermediate result types can be combined. + */ + intermediateResultTypes: EnumIntermediateResultType; + /** + * Sets the mode and priority for localization algorithms. + */ + localizationModes: number[] | EnumLocalizationMode[]; + /** + * Sets the range of barcode text length for barcodes search + */ + minBarcodeTextLength: number; + /** + * The minimum confidence of the result + */ + minResultConfidence: number; + /** + * Not available in JS. Sets the way to detect barcodes from a PDF file when using the DecodeFile method. + */ + PDFReadingMode: EnumPDFReadingMode; + /** + * Sets the region definition including the regionTop, regionLeft, regionRight, regionBottom and regionMeasuredByPercentage. + * + * Experimental feature: + * + * In [BarcodeScanner](../BarcodeScanner.md), `region` can be an array. For example `region = [r0, r1, r2]`, 0th frame use `r0`, 1st use `r1`, 2nd use `r2`, 3rd use `r0`, and then loop like this. + */ + region: RegionDefinition; + /** + * Specifies the format for the coordinates returned + */ + resultCoordinateType: number | EnumResultCoordinateType; + /** + * Sets whether or not to return the clarity of the barcode zone. + */ + returnBarcodeZoneClarity: number; + /** + * Sets the threshold for the image shrinking + */ + scaleDownThreshold: number; + /** + * Sets the mode and priority to control the sampling methods of scale-up for linear barcode with small module sizes. + */ + scaleUpModes: EnumScaleUpMode[]; + /** + * Sets the phase where the algorithm stops. + */ + terminatePhase: EnumTerminatePhase; + /** + * Sets the mode and priority for the order of the text results returned. + */ + textResultOrderModes: EnumTextResultOrderMode[]; + /** + * Sets the maximum amount of time (in milliseconds) that should be spent searching for a barcode per page. + * It does not include the time taken to load/decode an image (Tiff, PNG, etc) from disk into memory. + */ + timeout: number; +} +export declare enum EnumImagePixelFormat { + IPF_Binary = 0, + IPF_BinaryInverted = 1, + IPF_GrayScaled = 2, + IPF_NV21 = 3, + IPF_RGB_565 = 4, + IPF_RGB_555 = 5, + IPF_RGB_888 = 6, + IPF_ARGB_8888 = 7, + IPF_RGB_161616 = 8, + IPF_ARGB_16161616 = 9, + IPF_ABGR_8888 = 10, + IPF_ABGR_16161616 = 11, + IPF_BGR_888 = 12 +} +export declare enum EnumErrorCode { + DBR_SYSTEM_EXCEPTION = 1, + DBR_SUCCESS = 0, + DBR_UNKNOWN = -10000, + DBR_NO_MEMORY = -10001, + DBR_NULL_REFERENCE = -10002, + DBR_LICENSE_INVALID = -10003, + DBR_LICENSE_EXPIRED = -10004, + DBR_FILE_NOT_FOUND = -10005, + DBR_FILETYPE_NOT_SUPPORTED = -10006, + DBR_BPP_NOT_SUPPORTED = -10007, + DBR_INDEX_INVALID = -10008, + DBR_BARCODE_FORMAT_INVALID = -10009, + DBR_CUSTOM_REGION_INVALID = -10010, + DBR_MAX_BARCODE_NUMBER_INVALID = -10011, + DBR_IMAGE_READ_FAILED = -10012, + DBR_TIFF_READ_FAILED = -10013, + DBR_QR_LICENSE_INVALID = -10016, + DBR_1D_LICENSE_INVALID = -10017, + DBR_DIB_BUFFER_INVALID = -10018, + DBR_PDF417_LICENSE_INVALID = -10019, + DBR_DATAMATRIX_LICENSE_INVALID = -10020, + DBR_PDF_READ_FAILED = -10021, + DBR_PDF_DLL_MISSING = -10022, + DBR_PAGE_NUMBER_INVALID = -10023, + DBR_CUSTOM_SIZE_INVALID = -10024, + DBR_CUSTOM_MODULESIZE_INVALID = -10025, + DBR_RECOGNITION_TIMEOUT = -10026, + DBR_JSON_PARSE_FAILED = -10030, + DBR_JSON_TYPE_INVALID = -10031, + DBR_JSON_KEY_INVALID = -10032, + DBR_JSON_VALUE_INVALID = -10033, + DBR_JSON_NAME_KEY_MISSING = -10034, + DBR_JSON_NAME_VALUE_DUPLICATED = -10035, + DBR_TEMPLATE_NAME_INVALID = -10036, + DBR_JSON_NAME_REFERENCE_INVALID = -10037, + DBR_PARAMETER_VALUE_INVALID = -10038, + DBR_DOMAIN_NOT_MATCHED = -10039, + DBR_RESERVEDINFO_NOT_MATCHED = -10040, + DBR_AZTEC_LICENSE_INVALID = -10041, + DBR_LICENSE_DLL_MISSING = -10042, + DBR_LICENSEKEY_NOT_MATCHED = -10043, + DBR_REQUESTED_FAILED = -10044, + DBR_LICENSE_INIT_FAILED = -10045, + DBR_PATCHCODE_LICENSE_INVALID = -10046, + DBR_POSTALCODE_LICENSE_INVALID = -10047, + DBR_DPM_LICENSE_INVALID = -10048, + DBR_FRAME_DECODING_THREAD_EXISTS = -10049, + DBR_STOP_DECODING_THREAD_FAILED = -10050, + DBR_SET_MODE_ARGUMENT_ERROR = -10051, + DBR_LICENSE_CONTENT_INVALID = -10052, + DBR_LICENSE_KEY_INVALID = -10053, + DBR_LICENSE_DEVICE_RUNS_OUT = -10054, + DBR_GET_MODE_ARGUMENT_ERROR = -10055, + DBR_IRT_LICENSE_INVALID = -10056, + DBR_MAXICODE_LICENSE_INVALID = -10057, + DBR_GS1_DATABAR_LICENSE_INVALID = -10058, + DBR_GS1_COMPOSITE_LICENSE_INVALID = -10059, + DBR_DOTCODE_LICENSE_INVALID = -10061, + DMERR_NO_LICENSE = -20000, + DMERR_LICENSE_SYNC_FAILED = -20003, + DMERR_TRIAL_LICENSE = -20010, + DMERR_FAILED_TO_REACH_LTS = -20200 +} +export interface BarcodeReaderException extends Error { + code?: EnumErrorCode; +} +/** + * The `BarcodeReader` class is used for image decoding + * Comparing to `BarcodeScanner`, the default decoding settings are more accurate but slower. + * ```js + * let pReader = null; + * (async()=>{ + * let reader = await (pReader = pReader || Dynamsoft.DBR.BarcodeReader.createInstance()); + * let results = await reader.decode(imageSource); + * for(let result of results){ + * console.log(result.barcodeText); + * } + * })(); + * ``` + */ +export declare class BarcodeReader { + private static _jsVersion; + private static _jsEditVersion; + protected static _version: string; + /** + * Get the current version. + */ + static get version(): string; + protected static _productKeys: string; + static get productKeys(): string; + /** + * Get or set the Dynamsoft Barcode Reader SDK product keys. + * ```js + * Dynamsoft.DBR.BarcodeReader.productKeys = "PRODUCT-KEYS"; + * ``` + * For convenience, you can set `productKeys` in `script` tag instead. + * ```html + * + * ``` + */ + static set productKeys(keys: string); + static get handshakeCode(): string; + /** + * Get or set the Dynamsoft Barcode Reader SDK handshake code. The `handshakeCode` is an alias of `productKeys`. Specifically refers to the key that requires **network** authentication. + * ```js + * Dynamsoft.DBR.BarcodeReader.handshakeCode = "123****-mytest"; + * ``` + * For convenience, you can set `handshakeCode` in `script` tag instead. + * ```html + * + * ``` + */ + static set handshakeCode(keys: string); + protected static _organizationID: string; + static get organizationID(): string; + /** + * Use organization ID to get authentication from network. Keep handshakeCode empty if you want to use default `handshake` of the organization. + * ```js + * Dynamsoft.DBR.BarcodeReader.organizationID = "123****"; + * ``` + * For convenience, you can set `organizationID` in `script` tag instead. + * ```html + * + * ``` + * @see [[handshakeCode]] + */ + static set organizationID(value: string); + /** @ignore */ + static _sessionPassword: string; + /** + * Specify a password to protect the `Handshake Code` from abuse. + * ```js + * Dynamsoft.DBR.BarcodeReader.handshakeCode = "123****-mytest"; + * Dynamsoft.DBR.BarcodeReader.sessionPassword = "@#$%****"; + * ``` + * Since js in the browser is plaintext, it is not safe to set a password. It is recommended that you bind the `domain` as `Validation field` in the [handshake settings in dynamsoft website](https://www.dynamsoft.com/lts/index.html#/handshakeCodes) or your self-hosted license server. + * + * In nodejs, password is meaningful. + * @see [[handshakeCode]] + */ + static set sessionPassword(value: string); + static get sessionPassword(): string; + /** @ignore */ + static _limitModules?: string[]; + /** @ignore */ + static _chargeWay?: string; + /** + * modify from https://gist.github.com/2107/5529665 + * @ignore + */ + static browserInfo: any; + /** + * Detect environment and get a report. + * ```js + * console.log(Dynamsoft.DBR.BarcodeReader.detectEnvironment()); + * // {"wasm":true, "worker":true, "getUserMedia":true, "camera":true, "browser":"Chrome", "version":90, "OS":"Windows"} + * ``` + */ + static detectEnvironment(): Promise; + /** @ignore */ + static _workerName: string; + protected static _engineResourcePath?: string; + static get engineResourcePath(): string; + /** + * Specify the Barcode Reader SDK engine (WASM) url. The SDK tries to automatically explore the engine location. + * If the auto-explored engine location is incorrect, you can manually specify the engine location. + * The property needs to be set before [[loadWasm]]. + * ```js + * Dynamsoft.DBR.BarcodeReader.engineResourcePath = "https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@8.6.0/dist/"; + * await Dynamsoft.DBR.BarcodeReader.loadWasm(); + * ``` + */ + static set engineResourcePath(value: string); + /** @ignore */ + protected static _licenseServer?: string[]; + static get licenseServer(): string[] | string; + /** + * Specify the license server URL. + */ + static set licenseServer(value: string[] | string); + private static _deviceFriendlyName; + /** + * @ignore + */ + static get deviceFriendlyName(): string; + /** @ignore */ + static set deviceFriendlyName(value: string); + /** + * @ignore + */ + static _isShowRelDecodeTimeInResults: boolean; + /** + * @ignore + */ + _canvasMaxWH: number; + /** + * @ignore + */ + static _onLog: (message: any) => void; + /** + * @ignore + */ + static _bWasmDebug: boolean; + /** + * @ignore + */ + static _bNeverShowDialog: boolean; + /** + * Whether to use full feature wasm. The api may change in later version. + * For web, `_bUseFullFeature` is false as default. + * For Node.js, `_bUseFullFeature` will not work, and BarcodeReader will always work on full feature. + * The property needs to be set before `loadWasm`. + *
+	 * Compact wasm:
+	 * oned + qr + pdf417 + datamatrix.
+	 * ===
+	 * Full wasm:
+	 * all supported barcode format +
+	 * high level deblur available (lv8, 9) +
+	 * DPM +
+	 * template API +
+	 * intermediate results API
+	 * ===
+	 * e.g.:
+	 * Use compact in video deocode (small, download and initialization fast).
+	 * Use full in file decode (need high level deblur).
+	 * 
+ * + * ```js + * DBR.BarcodeReader._bUseFullFeature = true; + * await DBR.BarcodeReader.loadWasm(); + * ``` + */ + protected static __bUseFullFeature: boolean; + static get _bUseFullFeature(): boolean; + static set _bUseFullFeature(value: boolean); + /** @ignore */ + static _dbrWorker: Worker; + protected static _nextTaskID: number; + protected static _taskCallbackMap: Map void>; + private static _loadWasmStatus; + private static _loadWasmCallbackArr; + /** @ignore */ + _instanceID: number; + /** @ignore */ + bSaveOriCanvas: boolean; + /** + * Whether to save the original image into canvas. + * ```js + * reader.ifSaveOriginalImageInACanvas = true; + * let results = await reader.decode(source); + * document.body.append(reader.getOriginalImageInACanvas()); + * ``` + */ + get ifSaveOriginalImageInACanvas(): boolean; + set ifSaveOriginalImageInACanvas(value: boolean); + /** @ignore */ + oriCanvas?: HTMLCanvasElement | OffscreenCanvas; + /** + * The original canvas. + * ```js + * reader.ifSaveOriginalImageInACanvas = true; + * let results = await reader.decode(source); + * document.body.append(reader.getOriginalImageInACanvas()); + * ``` + */ + getOriginalImageInACanvas(): HTMLCanvasElement | OffscreenCanvas; + /** @ignore */ + _1dMinConfidence: number; + /** @ignore */ + maxVideoCvsLength: number; + protected videoCvses?: (HTMLCanvasElement | OffscreenCanvas)[]; + protected videoGlCvs?: HTMLCanvasElement | OffscreenCanvas; + protected videoGl?: WebGLRenderingContext | WebGL2RenderingContext; + protected glImgData?: Uint8Array; + protected bFilterRegionInJs: boolean; + protected userDefinedRegion: any; + protected _region?: RegionDefinition | RegionDefinition[]; + protected set region(value: null | RegionDefinition | RegionDefinition[]); + protected get region(): null | RegionDefinition | RegionDefinition[]; + /** @ignore */ + _timeStartDecode: any; + /** @ignore */ + _timeEnterInnerDBR: any; + /** @ignore */ + _timeGetMessage: any; + /** @ignore */ + _bUseWebgl: boolean; + /** @ignore */ + decodeRecords: any; + /** + * @ignore A callback when wasm download success in browser environment. + */ + static _onWasmDownloaded: () => void; + /** + * Check if the decoding module is loaded. + * @category Initialize and Destroy + */ + static isLoaded(): boolean; + /** + * Indicates whether the instance has been destroyed. + */ + bDestroyed: boolean; + isContextDestroyed(): boolean; + /** @ignore */ + protected static _lastErrorCode: number; + /** @ignore */ + static get lastErrorCode(): number; + /** @ignore */ + protected static _lastErrorString: string; + /** @ignore */ + static get lastErrorString(): string; + /** @ignore */ + protected _setWarnnedEx: Set; + /** @ignore */ + protected _lastErrorCode: number; + /** @ignore */ + get lastErrorCode(): number; + /** @ignore */ + protected _lastErrorString: string; + /** @ignore */ + get lastErrorString(): string; + /** @ignore */ + _lastInnerDecodeDuration: number; + private static _loadWasmErr; + /** + * Before most operations, `loadWasm` needs to be excuted firstly. + * Most time, you do not need excute `loadWasm` manually. Because when you excute [[createInstance]], `loadWasm` will be excuted implicitly. + * Some properties can't be changed after `loadWasm`. + * Calling `loadWasm` in advance can avoid the long wait when `createInstance`. + * ```js + * window.addEventListener('DOMContentLoaded', (event) => { + * DBR.BarcodeReader.loadWasm(); + * }); + * ``` + * @category Initialize and Destroy + */ + static loadWasm(): Promise; + /** + * @param type "warn" or "error" + * @param content + * @returns + */ + protected static showDialog(type: string, content: string): Promise; + protected static createInstanceInWorker(bScanner?: boolean): Promise; + /** + * Create a `BarcodeReader` instance. + * ``` + * let pReader = null; + * (async()=>{ + * let reader = await (pReader = pReader || Dynamsoft.DBR.BarcodeReader.createInstance()); + * })(); + * ``` + * @category Initialize and Destroy + */ + static createInstance(): Promise; + /** + * Decode barcodes from a image. + * + * The main decoding method can accept a variety of data types, including binary data, images, base64 (with mime), urls, etc. + * + * The image format can be `png`, `jpeg`, `bmp`, `gif` and a few other (some browsers support `webp`, `tif`). + * + * ```js + * let results = await reader.decode(blob); + * for(let result of results){ + * console.log(result.barcodeText); + * } + * + * let results2 = await reader.decode(htmlImageElement); + * let results2 = await reader.decode(url); + * + * // like `data:image/png;base64,iV************` + * let results3 = await reader.decode(base64WithMime); + * ``` + * + * And you can get a frame to decode from the `HTMLVideoElement`. + * + * ```js + * // The frame currently played will be decode. + * let results; + * try{ + * results = await reader.decode(htmlVideoElement); + * }catch(ex){ + * // If no frame in the video, will throw an exception. + * } + * ``` + * If you need to continuously decode a video, you can use [BarcodeScanner](../BarcodeScanner/index.md) instead. + * @param source + * @category Decode + */ + decode(source: Blob | Buffer | ArrayBuffer | Uint8Array | Uint8ClampedArray | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | string): Promise; + /** + * The decoding method can accept base64 with or without mime. + * e.g. `data:image/jpg;base64,Xfjshekk....` or `Xfjshekk...`. + * ```js + * let results = await reader.decodeBase64String(strBase64); + * for(let result of results){ + * console.log(result.barcodeText); + * } + * ``` + * @param base64 + * @category Decode + */ + decodeBase64String(base64: string): Promise; + /** + * The decoding method can accept url. The url source need to be in the same domain or allowed cors. + * ```js + * let results = await reader.decodeUrl("./1.png"); + * for(let result of results){ + * console.log(result.barcodeText); + * } + * ``` + * @param url + * @category Decode + */ + decodeUrl(url: string): Promise; + /** + * Decodes barcodes from the memory buffer containing image pixels in defined format. + * @ignore + */ + _decodeBuffer_Uint8Array(buffer: Uint8Array | Uint8ClampedArray, width: number, height: number, stride: number, format: EnumImagePixelFormat, config?: any): Promise; + /** + * + * @param buffer + * @param width + * @param height + * @param stride + * @param format + * @param config + * @ignore + */ + _decodeBuffer_Blob(buffer: Blob, width: number, height: number, stride: number, format: EnumImagePixelFormat, config?: any): Promise; + /** + * Decode barcodes from raw image data. + * @param buffer + * @param width + * @param height + * @param stride + * @param format + * @param config + * @category Decode + */ + decodeBuffer(buffer: Uint8Array | Uint8ClampedArray | ArrayBuffer | Blob | Buffer, width: number, height: number, stride: number, format: EnumImagePixelFormat, config?: any): Promise; + /** @ignore */ + _decodeFileInMemory_Uint8Array(bytes: Uint8Array): Promise; + /** + * Gets current runtime settings. + * ```js + * let settings = await reader.getRuntimeSettings(); + * settings.deblurLevel = 5; + * await reader.updateRuntimeSettings(settings); + * ``` + * @see [RuntimeSettings](https://www.dynamsoft.com/barcode-reader/programming/c-cplusplus/struct/PublicRuntimeSettings.html?ver=latest&utm_source=github&package=js) + * @category Runtime Settings + */ + getRuntimeSettings(): Promise; + /** + * Update runtime settings with a given struct, or a string of `speed`, `balance` or `coverage` to use preset settings for BarcodeReader. + * The default settings for BarcodeReader is `coverage`. + * ```js + * await reader.updateRuntimeSettings('balance'); + * let settings = await reader.getRuntimeSettings(); + * settings.barcodeFormatIds = Dynamsoft.DBR.EnumBarcodeFormat.BF_ONED; + * await reader.updateRuntimeSettings(settings); + * ``` + * @see [RuntimeSettings](https://www.dynamsoft.com/barcode-reader/programming/c-cplusplus/struct/PublicRuntimeSettings.html?ver=latest&utm_source=github&package=js) + * @category Runtime Settings + */ + updateRuntimeSettings(settings: RuntimeSettings | string): Promise; + /** + * Resets all parameters to default values. + * ```js + * await reader.resetRuntimeSettings(); + * ``` + * @category Runtime Settings + */ + resetRuntimeSettings(): Promise; + /** + * Outputs the license content as an encrypted string from the license server to be used for offline license verification. + * ```js + * let strSettings = await reader.outputSettingsToString(); + * ``` + * The method is only supported in the full feature edition. + * @ignore + * @category Runtime Settings + */ + outputSettingsToString(): Promise; + /** + * Initialize runtime settings with the settings in given JSON string. + * ```js + * await reader.initRuntimeSettingsWithString("{\"Version\":\"3.0\", \"ImageParameter\":{\"Name\":\"IP1\", \"BarcodeFormatIds\":[\"BF_QR_CODE\"], \"ExpectedBarcodesCount\":10}}"); + * ``` + * The method is only supported in the full feature edition. + * @ignore + * @category Runtime Settings + */ + initRuntimeSettingsWithString(settings: any): Promise; + private _decode_Blob; + /** + * + * @param arrayBuffer + * @param config + * @ignore + */ + private _decode_ArrayBuffer; + /** + * + * @param uint8Array + * @param config + * @ignore + */ + private _decode_Uint8Array; + /** + * + * @param image + * @param config + * @ignore + */ + private _decode_Image; + private _decode_Canvas; + /** + * + * @param video + * @param config + * @ignore + */ + protected handleVideoFrame(video: HTMLVideoElement, config?: any): Object; + /** + * decode video is not multi call safe in an instance, we reuse many thing for speed, so make sure wait util one finish then call next + * @param video + * @param config + * @ignore + */ + _decode_Video(video: HTMLVideoElement, config?: any): Promise; + private _decode_Base64; + private _decode_Url; + private _decode_FilePath; + /** @ignore */ + static fixResultLocationWhenFilterRegionInJs(region: any, results: TextResult[], sx: number, sy: number, sWidth: number, sHeight: number, dWidth: number, dHeight: number): void; + /** @ignore */ + static BarcodeReaderException(ag0: any, ag1: any): BarcodeReaderException; + protected _handleRetJsonString(objRet: any): any; + /** + * Set argument value for the specified mode parameter. + * ```js + * await reader.setModeArgument("BinarizationModes", 0, "EnableFillBinaryVacancy", "1"); + * ``` + * @param modeName + * @param index + * @param argumentName + * @param argumentValue + * @category Runtime Settings + */ + setModeArgument(modeName: string, index: number, argumentName: string, argumentValue: string): Promise; + /** + * Get argument value for the specified mode parameter. + * ```js + * let argumentValue = await reader.getModeArgument("BinarizationModes", 0, "EnableFillBinaryVacancy"); + * ``` + * @param modeName + * @param index + * @param argumentName + * @category Runtime Settings + */ + getModeArgument(modeName: string, index: number, argumentName: string): Promise; + /** + * The method is only supported in the full feature edition. + * Returns intermediate results containing the original image, the colour clustered image, the binarized Image, contours, Lines, TextBlocks, etc. + * ```js + * let imResults = await reader.getIntermediateResults(); + * ``` + * @ignore + */ + getIntermediateResults(): Promise; + /** @ignore */ + getIntermediateCanvas(): Promise; + /** + * Destroy the `BarcodeReader` instance. If your page needs to create new instances from time to time, don't forget to destroy unused old instances, otherwise it will cause memory leaks. + * @category Initialize and Destroy + */ + destroy(): Promise; +} +export interface FrameFilter { + /** + * The region definition of the frame to calculate the internal indicator. + * Default Value: { regionLeft = 0, regionRight = 100, regionTop = 0, regionBottom = 100, regionMeasuredByPercentage = true } + */ + region?: RegionDefinition | any; + /** + * The threshold used for filtering frames. + * Value range: [0, 1]. + * Default value: 0.1. + * The SDK will calculate an inner indicator for each frame from AppendFrame(), if the change rate of the indicators between the current frame and the history frames is larger than the given threshold, the current frame will not be added to the inner frame queue waiting for decoding. + */ + threshold?: number; +} +/** + * let scanSettings = await scanner.getScanSettings(); + * scanSettings.intervalTime = 100; // 100ms + * scanSettings.duplicateForgetTime = 3000; // 3s + * await scanner.updateScanSettings(scanSettings); + */ +export interface ScanSettings { + intervalTime?: number; + duplicateForgetTime?: number; + /** + * Filter frame during focusing. + * `region` define the detecting area. + * `threshold` is (0,1). + * ```js + * scanSettings.frameFilter = { + * region: { + * regionLeft: 0, + * regionTop: 47, + * regionRight: 100, + * regionBottom: 53, + * regionMeasuredByPercentage: true + * }, + * threshold: 0.01 + * }; + * ``` + */ + frameFilter?: FrameFilter; +} +export interface VideoDeviceInfo { + deviceId: string; + label: string; + /** @ignore */ + _checked: boolean; +} +export interface ScannerPlayCallbackInfo { + height: number; + width: number; +} +/** + * The `BarcodeScanner` class is used for video decoding. + * ```js + * let pScanner = null; + * (async()=>{ + * let scanner = await (pScanner = pScanner || Dynamsoft.DBR.BarcodeScanner.createInstance()); + * scanner.onUnduplicatedRead = txt => console.log(txt); + * await scanner.show(); + * })(); + * ``` + */ +export declare class BarcodeScanner extends BarcodeReader { + private static _defaultUIElementURL; + static get defaultUIElementURL(): string; + /** + * The url of the default scanner UI. + * Can only be changed before `createInstance`. + * ```js + * Dynamsoft.DBR.BarcodeScanner.defaultUIElementURL = "https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@8.6.0/dist/dbr.scanner.html"; + * let pScanner = null; + * (async()=>{ + * let scanner = await (pScanner = pScanner || Dynamsoft.DBR.BarcodeScanner.createInstance()); + * await scanner.show(); + * })(); + * ``` + */ + static set defaultUIElementURL(value: string); + /** @ignore */ + /** @ignore */ + UIElement: HTMLElement; + /** + * Get HTML element containing the `BarcodeScanner` instance. + * @category UI + */ + getUIElement(): HTMLElement; + /** + * Set html element containing the `BarcodeScanner` instance. + * ```html + * + * + * ``` + * @param element + * @category UI + */ + setUIElement(elementOrUrl: HTMLElement | string): Promise; + /** @ignore */ + private styleEls; + /** @ignore */ + videoSettings: MediaStreamConstraints; + /** Set a existing video source for decoding. */ + videoSrc: string | MediaStream | MediaSource | Blob; + private _singleFrameMode; + /** + * A mode not use video, get a frame from OS camera instead. + * ```js + * let pScanner = null; + * (async()=>{ + * let scanner = await (pScanner = pScanner || Dynamsoft.DBR.BarcodeScanner.createInstance()); + * if(scanner.singleFrameMode){ + * // the browser does not provide webrtc API, dbrjs automatically use singleFrameMode instead + * scanner.show(); + * } + * })(); + * ``` + */ + get singleFrameMode(): boolean; + /** + * A mode not use video, get a frame from OS camera instead. + * ```js + * let pScanner = null; + * (async()=>{ + * let scanner = await (pScanner = pScanner || Dynamsoft.DBR.BarcodeScanner.createInstance()); + * scanner.singleFrameMode = true; // use singleFrameMode anyway + * scanner.show(); + * })(); + * ``` + */ + set singleFrameMode(value: boolean); + private _singleFrameModeIpt; + private _clickIptSingleFrameMode; + /** @ignore */ + intervalTime: number; + private _isOpen; + private _assertOpen; + /** @ignore */ + private _bWorkerDecodeBuffer; + /** @ignore */ + private _idGetFrameTimeout; + /** @ignore */ + private _idGetFrameTimeout2; + /** @ignore */ + private _intervalGetVideoFrame; + /** + * 0: get frame after worker finished decoding(original version). + * 1: get frame and push them to queue when worker is decoding and the queue is empty, which can help next loop skip the getting frame process. + * 2: continously get frame and push it to queue, which can help next loop skip the getting frame process. + * 4: get frame and push them to queue when worker is decoding and the queue is empty, which can help next loop skip the getting frame process. Different from mode 1, there is a interval time before getting frame. + * @ignore + */ + private _getVideoFrameMode; + /** + * @ignore + * the times of loop get frame + */ + private loopGetFrameTimes; + /** @ignore */ + private _countLoopGetFrame; + /** @ignore */ + private queue_handledFrame; + /** @ignore */ + private array_getFrameTimeCost; + /** @ignore */ + private array_decodeFrameTimeCost; + /** @ignore */ + private _indexCurrentDecodingFrame; + /** @ignore */ + _timeEndGettingFrame: any; + private _bPauseScan; + /** @ignore */ + _lastDeviceId: string; + private _intervalDetectVideoPause; + private _vc_bPlayingVideoBeforeHide; + private _ev_documentHideEvent; + /** @ignore */ + _video: HTMLVideoElement; + /** @ignore */ + _cvsDrawArea: HTMLCanvasElement; + /** @ignore */ + _divScanArea: any; + /** @ignore */ + _divScanLight: any; + /** @ignore */ + _bgLoading: any; + /** @ignore */ + _bgCamera: any; + /** @ignore */ + _selCam: any; + /** @ignore */ + _selRsl: any; + /** @ignore */ + _optGotRsl: any; + /** @ignore */ + _btnClose: any; + /** @ignore */ + private _soundOnSuccessfullRead; + /** + * The sound to play when the scanner get successfull read. + */ + get soundOnSuccessfullRead(): HTMLAudioElement; + /** + * The sound to play when the scanner get successfull read. + * ```js + * scanner.soundOnSuccessfullRead = new Audio("./pi.mp3"); + * ``` + */ + set soundOnSuccessfullRead(value: HTMLAudioElement); + /** + * Whether to play sound when the scanner reads a barcode successfully. + * Default value is `false`, which does not play sound. + * Use `frame` or `true` to play a sound when any barcode is found within a frame. + * Use `unduplicated` to play a sound only when any unique/unduplicated barcode is found within a frame. + * ```js + * // A user gesture required. https://developers.google.com/web/updates/2017/09/autoplay-policy-changes#chrome_enterprise_policies + * startPlayButton.addEventListener('click', function() { + * scanner.bPlaySoundOnSuccessfulRead = true; + * }); + * ``` + * refer: `favicon bug` https://bugs.chromium.org/p/chromium/issues/detail?id=1069731&q=favicon&can=2 + * @ignore + */ + bPlaySoundOnSuccessfulRead: (boolean | string); + get whenToPlaySoundforSuccessfulRead(): string; + /** + * Whether to play sound when the scanner reads a barcode successfully. + * Default value is `never`, which does not play sound. + * Use `frame` to play a sound when any barcode is found within a frame. + * Use `unduplicated` to play a sound only when any unique/unduplicated barcode is found within a frame. + * ```js + * // A user gesture required. https://developers.google.com/web/updates/2017/09/autoplay-policy-changes#chrome_enterprise_policies + * startPlayButton.addEventListener('click', function() { + * scanner.whenToPlaySoundforSuccessfulRead = 'frame'; + * }); + * ``` + * refer: `favicon bug` https://bugs.chromium.org/p/chromium/issues/detail?id=1069731&q=favicon&can=2 + */ + set whenToPlaySoundforSuccessfulRead(value: string); + /** + * Whether to vibrate when the scanner reads a barcode successfully. + * Default value is `false`, which does not vibrate. + * Use `frame` or `true` to vibrate when any barcode is found within a frame. + * Use `unduplicated` to vibrate only when any unique/unduplicated barcode is found within a frame. + * ```js + * // Can I use? https://caniuse.com/?search=vibrate + * // A user gesture required. https://developers.google.com/web/updates/2017/09/autoplay-policy-changes#chrome_enterprise_policies + * startVibrateButton.addEventListener('click', function() { + * scanner.bVibrateOnSuccessfulRead = true; + * }); + * ``` + * @ignore + */ + bVibrateOnSuccessfulRead: (boolean | string); + /** + * Get or set how long (ms) the vibration lasts. + * @see [[bVibrateOnSuccessfulRead]],[[whenToVibrateforSuccessfulRead]] + */ + vibrateDuration: number; + get whenToVibrateforSuccessfulRead(): string; + /** + * Whether to vibrate when the scanner reads a barcode successfully. + * Default value is `never`, which does not vibrate. + * Use `frame` to vibrate when any barcode is found within a frame. + * Use `unduplicated` to vibrate only when any unique/unduplicated barcode is found within a frame. + * ```js + * // Can I use? https://caniuse.com/?search=vibrate + * // A user gesture required. https://developers.google.com/web/updates/2017/09/autoplay-policy-changes#chrome_enterprise_policies + * startPlayButton.addEventListener('click', function() { + * scanner.whenToVibrateforSuccessfulRead = 'frame'; + * }); + * ``` + */ + set whenToVibrateforSuccessfulRead(value: string); + /** @ignore */ + _allCameras: VideoDeviceInfo[]; + /** @ignore */ + _currentCamera?: VideoDeviceInfo; + /** @ignore */ + _videoTrack: MediaStreamTrack; + /** + * Set the style used when filling the mask beyond the region. + * @category UI + */ + regionMaskFillStyle: string; + /** + * Set the style of the region border. + * @category UI + */ + regionMaskStrokeStyle: string; + /** + * Set the width of the region border. + * @category UI + */ + regionMaskLineWidth: number; + /** + * Set the style used when filling in located barcode. + * @category UI + */ + barcodeFillStyle: string; + /** + * Set the style of the located barcode border. + * @category UI + */ + barcodeStrokeStyle: string; + /** + * Set the width of the located barcode border. + * @category UI + */ + barcodeLineWidth: number; + protected beingLazyDrawRegionsults: boolean; + protected set region(value: null | RegionDefinition | RegionDefinition[]); + protected get region(): null | RegionDefinition | RegionDefinition[]; + protected _indexVideoRegion: number; + /** @ignore */ + constructor(); + /** + * Create a `BarcodeScanner` object. + * ``` + * let pScanner = null; + * (async()=>{ + * let scanner = await (pScanner = pScanner || Dynamsoft.DBR.BarcodeScanner.createInstance()); + * })(); + * ``` + * @param config + * @category Initialize and Destroy + */ + static createInstance(config?: any): Promise; + /** @ignore */ + decode(source: Blob | ArrayBuffer | Uint8Array | Uint8ClampedArray | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | string): Promise; + /** @ignore */ + decodeBase64String(source: string): Promise; + /** @ignore */ + decodeUrl(source: string): Promise; + /** @ignore */ + decodeBuffer(buffer: Uint8Array | Uint8ClampedArray | ArrayBuffer | Blob, width: number, height: number, stride: number, format: EnumImagePixelFormat, config?: any): Promise; + /** + * Decode barcodes from the current frame of the video. + * ```js + * await scanner.showVideo(); + * console.log(await scanner.decodeCurrentFrame()); + * ``` + * @category Decode + */ + decodeCurrentFrame(config?: any): Promise; + private clearMapDecodeRecord; + private static readonly singlePresetRegion; + private static isRegionSinglePreset; + private static isRegionNormalPreset; + /** + * Update runtime settings with a given struct, or a string of `speed`, `balance`, `coverage` and `single` to use preset settings for BarcodeScanner. + * We recommend using the speed-optimized `single` preset if scanning only one barcode at a time. The `single` is only available in `BarcodeScanner`. + * The default settings for BarcodeScanner is `single`. + * ```js + * await scanner.updateRuntimeSettings('balance'); + * let settings = await scanner.getRuntimeSettings(); + * settings.barcodeFormatIds = Dynamsoft.DBR.EnumBarcodeFormat.BF_ONED; + * await scanner.updateRuntimeSettings(settings); + * ``` + * @see [RuntimeSettings](https://www.dynamsoft.com/barcode-reader/programming/c-cplusplus/struct/PublicRuntimeSettings.html?ver=latest&utm_source=github&package=js) + * @category Runtime Settings + */ + updateRuntimeSettings(settings: RuntimeSettings | string): Promise; + /** @ignore */ + _onCameraSelChange: () => void; + /** @ignore */ + _onResolutionSelChange: () => void; + /** @ignore */ + _onCloseBtnClick: () => void; + /** @ignore */ + _bindUI(): void; + /** @ignore */ + _unbindUI(): void; + /** + * Triggered when the camera video stream is played. + * ```js + * scanner.onplayed = rsl=>{ console.log(rsl.width+'x'+rsl.height) }; + * await scanner.show(); // or open, play, setCurrentCamera, like these. + * ``` + */ + onPlayed?: (info: ScannerPlayCallbackInfo) => void; + /** + * The event is triggered after a frame has been scanned. + * The results object contains all the barcode results in this frame. + * ```js + * scanner.onFrameRead = results => { + * for(let result of results){ + * console.log(result.barcodeText); + * } + * }; + * ``` + */ + onFrameRead?: (results: TextResult[]) => void; + /** + * This event is triggered when a new, unduplicated barcode is found. + * `txt` holds the barcode text result. `result` contains more info. + * Old barcodes will be remembered for `duplicateForgetTime`. + * ```js + * scanner.onUnduplicatedRead = (txt, result) => { + * alert(txt); + * console.log(result); + * }; + * ``` + */ + onUnduplicatedRead?: (txt: string, result: TextResult) => void; + /** @ignore */ + private _renderSelCameraInfo; + /** + * Get infomation of all available cameras on the device. + * ```js + * let cameras = await scanner.getAllCameras(); + * if(cameras.length){ + * await scanner.setCurrentCamera(cameras[0]); + * } + * ``` + * @category Camera Settings + */ + getAllCameras(): Promise; + /** + * Get information about the currently used camera. + * ```js + * let camera = await scanner.getCurrentCamera(); + * ``` + * @category Camera Settings + */ + getCurrentCamera(): Promise; + /** + * Choose the camera and play it by its information or devide id. + * ```js + * let cameras = await scanner.getAllCameras(); + * if(cameras.length){ + * await scanner.setCurrentCamera(cameras[0]); + * } + * ``` + * @param cameraInfoOrDeviceId + * @event [[onPlayed]] + * @category Camera Settings + */ + setCurrentCamera(cameraInfoOrDeviceId: any): Promise; + /** + * Get current camera resolution. + * ```js + * let rsl = await scanner.getResolution(); + * console.log(rsl.width + " x " + rsl.height); + * ``` + * @category Camera Settings + */ + getResolution(): number[]; + /** + * Set current camera resolution. + * ```js + * await scanner.setResolution(width, height); + * ``` + * @param width + * @param height + * @event [[onPlayed]] + * @category Camera Settings + */ + setResolution(width: number | number[], height: number): Promise; + /** + * Get current scan settings. + * ```js + * let scanSettings = await scanner.getScanSettings(); + * scanSettings.intervalTime = 50; + * scanSettings.duplicateForgetTime = 1000; + * await scanner.updateScanSettings(scanSettings); + * ``` + */ + getScanSettings(): Promise; + /** + * Modify and update scan settings. + * ```js + * let scanSettings = await scanner.getScanSettings(); + * scanSettings.intervalTime = 50; + * scanSettings.duplicateForgetTime = 1000; + * await scanner.updateScanSettings(scanSettings); + * ``` + * @param settings + */ + updateScanSettings(settings: ScanSettings): Promise; + /** + * Get current video settings. + * @category Camera Settings + */ + getVideoSettings(): MediaStreamConstraints; + /** + * Modify and update video settings. + * ```js + * await scanner.updateVideoSettings({ video: {width: {ideal: 1280}, height: {ideal: 720}, facingMode: {ideal: 'environment'}} }); + * ``` + * @param MediaStreamConstraints + * @category Camera Settings + */ + updateVideoSettings(MediaStreamConstraints: any): Promise; + /** + * Check if the scanner is open. + * ```js + * await scanner.show(); // or open(), showVideo(), openVideo(); + * console.assert(scanner.isOpen(), "scanner should be opened."); + * await scanner.hide(); // or close(); + * console.assert(!scanner.isOpen(), "scanner should be closed."); + * ``` + * @category Open and Close + */ + isOpen(): boolean; + /** @ignore */ + _show(): void; + /** + * Stop the video, and release the camera. + * ```js + * scanner.stop() + * \\*** a lot of work *** + * await scanner.play(); + * ``` + * @category Play and Pause + */ + stop(): void; + /** + * Pause the video. Do not release the camera. + * ```js + * scanner.pause(); + * \\*** a lot of work *** + * await scanner.play(); + * ``` + * @category Play and Pause + */ + pause(): void; + private iPlayRound; + private promisePlay; + /** + * Continue the video. + * ```js + * scanner.pause(); // or scanner.stop() + * \\*** a lot of work *** + * await scanner.play(); + * ``` + * @event [[onPlayed]] + * @category Play and Pause + */ + play(deviceId?: string, width?: number, height?: number): Promise; + /** + * Pause the decoding process. + * ```js + * pauseScan(); + * \\*** a lot of work *** + * resumeScan(); + * ``` + * @category Play and Pause + */ + pauseScan(): void; + /** + * Resume the decoding process. + * ```js + * pauseScan(); + * \\*** a lot of work *** + * resumeScan(); + * ``` + * @category Play and Pause + */ + resumeScan(): void; + /** + * Get the camera capabilities. Chrome only. + * Only available when the scanner is open. + * ```console + * > scanner.getCapabilities() + * < { + * "aspectRatio":{"max":3840,"min":0.000462962962962963}, + * "colorTemperature":{max: 7000, min: 2850, step: 50}, + * "deviceId":"1e...3af7", + * "exposureCompensation": {max: 2.0000040531158447, min: -2.0000040531158447, step: 0.16666699945926666}, + * "exposureMode":["continuous","manual"], + * "facingMode":["environment"], + * "focusMode":["continuous","single-shot","manual"], + * "frameRate":{"max":30,"min":0}, + * "groupId":"71...a935", + * "height":{"max":2160,"min":1}, + * "resizeMode":["none","crop-and-scale"], + * "torch":true, + * "whiteBalanceMode":["continuous","manual"], + * "width":{"max":3840,"min":1}, + * "zoom":{max: 606, min: 100, step: 2} + * } + * ``` + * @see [[turnOnTorch]],[[turnOffTorch]],[[setExposureCompensation]],[[setZoom]] + * @category Camera Settings + */ + getCapabilities(): MediaTrackCapabilities; + /** @ignore */ + getCameraSettings(): MediaTrackSettings; + /** @ignore */ + getConstraints(): MediaTrackConstraints; + /** + * @ignore + * Set the camera capabilities. Chrome only. + * Only available when the scanner is open. + * It's a low-level API, usually you can use the wrapped APIs instead. + * ```js + * await scanner.applyConstraints({ frameRate: { ideal:5 } }); + * ``` + */ + applyConstraints(constraints: MediaTrackConstraints): Promise; + /** + * Turn on the torch/flashlight. Chrome only. + * Only available when the scanner is open. + * Will reject if not support. + * ```js + * await scanner.turnOnTorch(); + * ``` + * @see [[turnOffTorch]],[[getCapabilities]] + * @category Camera Settings + */ + turnOnTorch(): Promise; + /** + * Turn off the torch. Chrome only. + * Only available when the scanner is open. + * Will reject if not support. + * ```js + * await scanner.turnOffTorch(); + * ``` + * @see [[turnOnTorch]],[[getCapabilities]] + * @category Camera Settings + */ + turnOffTorch(): Promise; + /** + * Adjusts the color temperature. Chrome only. + * Only available when the scanner is open. + * Will reject if not support. + * ```js + * await scanner.setColorTemperature(5000); + * ``` + * @see [[getCapabilities]] + * @category Camera Settings + */ + setColorTemperature(value: number): Promise; + /** + * Adjusts the exposure level. Chrome only. + * Only available when the scanner is open. + * Will reject if not support. + * ```js + * await scanner.setExposureCompensation(-0.7); + * ``` + * @see [[getCapabilities]] + * @category Camera Settings + */ + setExposureCompensation(value: number): Promise; + /** + * Adjusts the zoom ratio. Chrome only. + * Only available when the scanner is open. + * Will reject if not support. + * ```js + * await scanner.setZoom(400); + * ``` + * @see [[getCapabilities]] + * @category Camera Settings + */ + setZoom(value: number): Promise; + /** + * Adjusts the frame rate. Chrome only. + * Only available when the scanner is open. + * Will reject if not support. + * ```js + * await scanner.setFrameRate(10); + * ``` + * @see [[getCapabilities]] + * @category Camera Settings + */ + setFrameRate(value: number): Promise; + /** @ignore */ + _cloneDecodeResults(results: any): any; + /** + * process of getting frame and decoding the frame + * + * <------------- + * | ↑ + * | | + * <-------- | + * ↙ ↖ | + * | get frame | | + * ↘ ↗ | + * --------> | + * | | + * ↓ | + * decode ---------> + * + * @ignore + * */ + private _loopReadVideo; + /** @ignore */ + private loopGetVideoFrame; + /** @ignore */ + _drawRegionsults(results?: TextResult[]): void; + /** @ignore */ + _clearRegionsults(): void; + /** + * Bind UI, open the camera, start decoding. + * ```js + * await scanner.setUIElement(document.getElementById("my-barcode-scanner")); + * scanner.onUnduplicatedRead = (txt, result) => { alert(txt); console.log(result); }; + * await scanner.open(); + * // await scanner.close(); + * ``` + * @event [[onPlayed]],[[onUnduplicatedRead]],[[onFrameRead]] + * @category Open and Close + */ + open(): Promise; + /** + * Bind UI, open the camera, but not decode. + * ```js + * await scanner.setUIElement(document.getElementById("my-barcode-scanner")); + * await scanner.openVideo(); + * console.log(await scanner.decodeCurrentFrame()); + * // await scanner.close(); + * ``` + * @event [[onPlayed]],[[onUnduplicatedRead]],[[onFrameRead]] + * @category Open and Close + */ + openVideo(): Promise; + /** + * Stop decoding, release camera, unbind UI. + * ```js + * await scanner.open(); + * await scanner.close(); + * ``` + * ```js + * await scanner.openVideo(); + * await scanner.close(); + * ``` + * @category Open and Close + */ + close(): Promise; + /** + * Bind UI, open the camera, start decoding, and remove the UIElement `display` style if the original style is `display:none;`. + * ```js + * await scanner.setUIElement("https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@8.6.0/dist/dbr.scanner.html"); + * scanner.onUnduplicatedRead = (txt, result) => { alert(txt); console.log(result); }; + * await scanner.show(); + * // await scanner.hide(); + * ``` + * @event [[onPlayed]],[[onUnduplicatedRead]],[[onFrameRead]] + * @category Open and Close + */ + show(): Promise; + /** + * Bind UI, open the camera, but not decode, and remove the UIElement `display` style if the original style is `display:none;`. + * ```js + * await scanner.showVideo() + * console.log(await scanner.decodeCurrentFrame()); + * // await scanner.hide(); + * ``` + * @event [[onPlayed]],[[onUnduplicatedRead]],[[onFrameRead]] + * @category Open and Close + */ + showVideo(): Promise; + /** + * Stop decoding, release camera, unbind UI, and set the Element as `display:none;`. + * ```js + * await scanner.show(); + * await scanner.hide(); + * ``` + * ```js + * await scanner.showVideo(); + * await scanner.hide(); + * ``` + * @category Open and Close + */ + hide(): Promise; + /** + * Destroy the `BarcodeScanner` instance. If your page needs to create new instances from time to time, don't forget to destroy unused old instances, otherwise it will cause memory leaks. + * @category Initialize and Destroy + */ + destroy(): Promise; +} +export declare enum EnumBarcodeColourMode { + BICM_DARK_ON_LIGHT = 1, + BICM_LIGHT_ON_DARK = 2, + BICM_DARK_ON_DARK = 4, + BICM_LIGHT_ON_LIGHT = 8, + BICM_DARK_LIGHT_MIXED = 16, + BICM_DARK_ON_LIGHT_DARK_SURROUNDING = 32, + BICM_SKIP = 0, + BICM_REV = 2147483648 +} +export declare enum EnumBarcodeComplementMode { + BCM_AUTO = 1, + BCM_GENERAL = 2, + BCM_SKIP = 0, + BCM_REV = 2147483648 +} +export declare enum EnumClarityCalculationMethod { + ECCM_CONTRAST = 1 +} +export declare enum EnumClarityFilterMode { + CFM_GENERAL = 1 +} +export declare enum EnumColourClusteringMode { + CCM_AUTO = 1, + CCM_GENERAL_HSV = 2, + CCM_SKIP = 0, + CCM_REV = 2147483648 +} +export declare enum EnumColourConversionMode { + CICM_GENERAL = 1, + CICM_SKIP = 0, + CICM_REV = 2147483648 +} +export declare enum EnumConflictMode { + CM_IGNORE = 1, + CM_OVERWRITE = 2 +} +export declare enum EnumDeblurMode { + DM_SKIP = 0, + DM_DIRECT_BINARIZATION = 1, + DM_THRESHOLD_BINARIZATION = 2, + DM_GRAY_EQUALIZATION = 4, + DM_SMOOTHING = 8, + DM_MORPHING = 16, + DM_DEEP_ANALYSIS = 32, + DM_SHARPENING = 64, + DM_BASED_ON_LOC_BIN = 128, + DM_SHARPENING_SMOOTHING = 256 +} +export declare enum EnumDeformationResistingMode { + DRM_AUTO = 1, + DRM_GENERAL = 2, + DRM_SKIP = 0, + DRM_REV = 2147483648 +} +export declare enum EnumDPMCodeReadingMode { + DPMCRM_AUTO = 1, + DPMCRM_GENERAL = 2, + DPMCRM_SKIP = 0, + DPMCRM_REV = 2147483648 +} +export declare enum EnumGrayscaleTransformationMode { + GTM_INVERTED = 1, + GTM_ORIGINAL = 2, + GTM_SKIP = 0, + GTM_REV = 2147483648 +} +export declare enum EnumImagePreprocessingMode { + IPM_AUTO = 1, + IPM_GENERAL = 2, + IPM_GRAY_EQUALIZE = 4, + IPM_GRAY_SMOOTH = 8, + IPM_SHARPEN_SMOOTH = 16, + IPM_MORPHOLOGY = 32, + IPM_SKIP = 0, + IPM_REV = 2147483648 +} +export declare enum EnumIMResultDataType { + IMRDT_IMAGE = 1, + IMRDT_CONTOUR = 2, + IMRDT_LINESEGMENT = 4, + IMRDT_LOCALIZATIONRESULT = 8, + IMRDT_REGIONOFINTEREST = 16, + IMRDT_QUADRILATERAL = 32 +} +export declare enum EnumIntermediateResultSavingMode { + IRSM_MEMORY = 1, + IRSM_FILESYSTEM = 2, + IRSM_BOTH = 4 +} +export declare enum EnumQRCodeErrorCorrectionLevel { + QRECL_ERROR_CORRECTION_H = 0, + QRECL_ERROR_CORRECTION_L = 1, + QRECL_ERROR_CORRECTION_M = 2, + QRECL_ERROR_CORRECTION_Q = 3 +} +export declare enum EnumRegionPredetectionMode { + RPM_AUTO = 1, + RPM_GENERAL = 2, + RPM_GENERAL_RGB_CONTRAST = 4, + RPM_GENERAL_GRAY_CONTRAST = 8, + RPM_GENERAL_HSV_CONTRAST = 16, + RPM_SKIP = 0, + RPM_REV = 2147483648 +} +export declare enum EnumResultType { + RT_STANDARD_TEXT = 0, + RT_RAW_TEXT = 1, + RT_CANDIDATE_TEXT = 2, + RT_PARTIAL_TEXT = 3 +} +export declare enum EnumTextFilterMode { + TFM_AUTO = 1, + TFM_GENERAL_CONTOUR = 2, + TFM_SKIP = 0, + TFM_REV = 2147483648 +} +export declare enum EnumTextureDetectionMode { + TDM_AUTO = 1, + TDM_GENERAL_WIDTH_CONCENTRATION = 2, + TDM_SKIP = 0, + TDM_REV = 2147483648 +} +export declare class DBR { + /** + * The `BarcodeReader` class is used for image decoding + * Comparing to `BarcodeScanner`, the default decoding settings are more accurate but slower. + * ```js + * let pReader = null; + * (async()=>{ + * let reader = await (pReader = pReader || Dynamsoft.DBR.BarcodeReader.createInstance()); + * let results = await reader.decode(imageSource); + * for(let result of results){ + * console.log(result.barcodeText); + * } + * })(); + * ``` + */ + static BarcodeReader: typeof BarcodeReader; + /** + * The `BarcodeScanner` class is used for video decoding. + * ```js + * let pScanner = null; + * (async()=>{ + * let scanner = await (pScanner = pScanner || Dynamsoft.DBR.BarcodeScanner.createInstance()); + * scanner.onUnduplicatedRead = txt => console.log(txt); + * await scanner.show(); + * })(); + * ``` + */ + static BarcodeScanner: typeof BarcodeScanner; + static EnumBarcodeColourMode: typeof EnumBarcodeColourMode; + static EnumBarcodeComplementMode: typeof EnumBarcodeComplementMode; + static EnumBarcodeFormat: typeof EnumBarcodeFormat; + static EnumBarcodeFormat_2: typeof EnumBarcodeFormat_2; + static EnumBinarizationMode: typeof EnumBinarizationMode; + static EnumClarityCalculationMethod: typeof EnumClarityCalculationMethod; + static EnumClarityFilterMode: typeof EnumClarityFilterMode; + static EnumColourClusteringMode: typeof EnumColourClusteringMode; + static EnumColourConversionMode: typeof EnumColourConversionMode; + static EnumConflictMode: typeof EnumConflictMode; + static EnumDeblurMode: typeof EnumDeblurMode; + static EnumDeformationResistingMode: typeof EnumDeformationResistingMode; + static EnumDPMCodeReadingMode: typeof EnumDPMCodeReadingMode; + static EnumErrorCode: typeof EnumErrorCode; + static EnumGrayscaleTransformationMode: typeof EnumGrayscaleTransformationMode; + static EnumImagePixelFormat: typeof EnumImagePixelFormat; + static EnumImagePreprocessingMode: typeof EnumImagePreprocessingMode; + static EnumIMResultDataType: typeof EnumIMResultDataType; + static EnumIntermediateResultSavingMode: typeof EnumIntermediateResultSavingMode; + static EnumIntermediateResultType: typeof EnumIntermediateResultType; + static EnumLocalizationMode: typeof EnumLocalizationMode; + static EnumPDFReadingMode: typeof EnumPDFReadingMode; + static EnumQRCodeErrorCorrectionLevel: typeof EnumQRCodeErrorCorrectionLevel; + static EnumRegionPredetectionMode: typeof EnumRegionPredetectionMode; + static EnumResultCoordinateType: typeof EnumResultCoordinateType; + static EnumResultType: typeof EnumResultType; + static EnumScaleUpMode: typeof EnumScaleUpMode; + static EnumTerminatePhase: typeof EnumTerminatePhase; + static EnumTextFilterMode: typeof EnumTextFilterMode; + static EnumTextResultOrderMode: typeof EnumTextResultOrderMode; + static EnumTextureDetectionMode: typeof EnumTextureDetectionMode; + /** + * Get the current version. + */ + static get version(): string; + static get productKeys(): string; + /** + * Get or set the Dynamsoft Barcode Reader SDK product keys. + * ```js + * Dynamsoft.DBR.productKeys = "PRODUCT-KEYS"; + * ``` + * For convenience, you can set `productKeys` in `script` tag instead. + * ```html + * + * ``` + */ + static set productKeys(keys: string); + static get handshakeCode(): string; + /** + * Get or set the Dynamsoft Barcode Reader SDK handshake code. The `handshakeCode` is an alias of `productKeys`. Specifically refers to the key that requires **network** authentication. + * ```js + * Dynamsoft.DBR.handshakeCode = "123****-mytest"; + * ``` + * For convenience, you can set `handshakeCode` in `script` tag instead. + * ```html + * + * ``` + */ + static set handshakeCode(keys: string); + static get organizationID(): string; + /** + * Use organization ID to get authentication from network. Keep handshakeCode empty if you want to use default `handshake` of the organization. + * ```js + * Dynamsoft.DBR.organizationID = "123****"; + * ``` + * For convenience, you can set `organizationID` in `script` tag instead. + * ```html + * + * ``` + * @see [[handshakeCode]] + */ + static set organizationID(keys: string); + static get sessionPassword(): string; + /** + * Specify a password to protect the `Handshake Code` from abuse. + * ```js + * Dynamsoft.DBR.handshakeCode = "123****-mytest"; + * Dynamsoft.DBR.sessionPassword = "@#$%****"; + * ``` + * Since js in the browser is plaintext, it is not safe to set a password. It is recommended that you bind the `domain` as `Validation field` in the [handshake settings in dynamsoft website](https://www.dynamsoft.com/lts/index.html#/handshakeCodes) or your self-hosted license server. + * + * In nodejs, password is meaningful. + * @see [[handshakeCode]] + */ + static set sessionPassword(keys: string); + /** @ignore */ + static get browserInfo(): any; + /** + * Detect environment and get a report. + * ```js + * console.log(Dynamsoft.DBR.detectEnvironment()); + * // {"wasm":true, "worker":true, "getUserMedia":true, "camera":true, "browser":"Chrome", "version":90, "OS":"Windows"} + * ``` + */ + static detectEnvironment(): Promise; + /** @ignore */ + static get _workerName(): string; + /** @ignore */ + static set _workerName(name: string); + static get engineResourcePath(): string; + /** + * Specify the Barcode Reader SDK engine (WASM) url. The SDK tries to automatically explore the engine location. + * If the auto-explored engine location is incorrect, you can manually specify the engine location. + * The property needs to be set before [[loadWasm]]. + * ```js + * Dynamsoft.DBR.engineResourcePath = "https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@8.6.0/dist/"; + * await Dynamsoft.DBR.loadWasm(); + * ``` + */ + static set engineResourcePath(value: string); + static get licenseServer(): string[] | string; + /** + * Specify the license server URL. + */ + static set licenseServer(value: string[] | string); + /** @ignore */ + static get deviceFriendlyName(): string; + /** @ignore */ + static set deviceFriendlyName(value: string); + /** @ignore */ + static get _onLog(): (message: any) => void; + /** @ignore */ + static set _onLog(value: (message: any) => void); + /** @ignore */ + static get _bWasmDebug(): boolean; + /** @ignore */ + static set _bWasmDebug(value: boolean); + /** @ignore */ + static get _bUseFullFeature(): boolean; + /** @ignore */ + static set _bUseFullFeature(value: boolean); + /** @ignore */ + static get _dbrWorker(): Worker; + /** @ignore */ + static isLoaded(): boolean; + /** + * Check if the decoding module is loaded. + */ + static isWasmLoaded(): boolean; + /** + * Before most operations, `loadWasm` needs to be excuted firstly. + * Most time, you do not need excute `loadWasm` manually. Because when you excute [[createInstance]], `loadWasm` will be excuted implicitly. + * Some properties can't be changed after `loadWasm`. + * Calling `loadWasm` in advance can avoid the long wait when `createInstance`. + * ```js + * window.addEventListener('DOMContentLoaded', (event) => { + * DBR.loadWasm(); + * }); + * ``` + */ + static loadWasm(): Promise; +} +export default DBR; + + diff --git a/dist/dbr.js b/dist/dbr.js new file mode 100644 index 00000000..39f1ed61 --- /dev/null +++ b/dist/dbr.js @@ -0,0 +1,11 @@ +/** +* Dynamsoft JavaScript Library +* @product Dynamsoft Barcode Reader JS Edition +* @website http://www.dynamsoft.com +* @preserve Copyright 2021, Dynamsoft Corporation +* @author Dynamsoft +* @version 8.6.0 (js 20210628) +* @fileoverview Dynamsoft JavaScript Library for Barcode Reader +* More info on DBR JS: https://www.dynamsoft.com/Products/barcode-recognition-javascript.aspx +*/ +!function(e,t){let bNode=!!(typeof global=="object"&&global.process&&global.process.release&&global.process.release.name&&typeof HTMLCanvasElement=="undefined");"object"==typeof exports&&"object"==typeof module?module.exports=!bNode?t():t(require("worker_threads"),require("https"),require("http"),require("fs"),require("os")):"function"==typeof define&&define.amd?define(t):"object"==typeof exports?exports.dbr=!bNode?t():t(require("worker_threads"),require("https"),require("http"),require("fs"),require("os")):e.dbr=t(e.worker_threads,e.https,e.http,e.fs,e.os)}(("object"==typeof window?window:global),(function(e,t,i,r,n){return function(e){var t={};function i(r){if(t[r])return t[r].exports;var n=t[r]={i:r,l:!1,exports:{}};return e[r].call(n.exports,n,n.exports,i),n.l=!0,n.exports}return i.m=e,i.c=t,i.d=function(e,t,r){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(i.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)i.d(r,n,function(t){return e[t]}.bind(null,n));return r},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=5)}([function(t,i){t.exports=e},function(e,i){e.exports=t},function(e,t){e.exports=i},function(e,t){e.exports=r},function(e,t){e.exports=n},function(e,t,i){"use strict";var r,n,o,s;i.r(t),i.d(t,"DBR",(function(){return W})),i.d(t,"BarcodeReader",(function(){return c})),i.d(t,"BarcodeScanner",(function(){return g})),i.d(t,"EnumBarcodeColourMode",(function(){return E})),i.d(t,"EnumBarcodeComplementMode",(function(){return R})),i.d(t,"EnumBarcodeFormat",(function(){return s})),i.d(t,"EnumBarcodeFormat_2",(function(){return m})),i.d(t,"EnumBinarizationMode",(function(){return f})),i.d(t,"EnumClarityCalculationMethod",(function(){return I})),i.d(t,"EnumClarityFilterMode",(function(){return A})),i.d(t,"EnumColourClusteringMode",(function(){return S})),i.d(t,"EnumColourConversionMode",(function(){return D})),i.d(t,"EnumConflictMode",(function(){return T})),i.d(t,"EnumDeblurMode",(function(){return v})),i.d(t,"EnumDeformationResistingMode",(function(){return p})),i.d(t,"EnumDPMCodeReadingMode",(function(){return M})),i.d(t,"EnumErrorCode",(function(){return n})),i.d(t,"EnumGrayscaleTransformationMode",(function(){return y})),i.d(t,"EnumImagePixelFormat",(function(){return r})),i.d(t,"EnumImagePreprocessingMode",(function(){return C})),i.d(t,"EnumIMResultDataType",(function(){return o})),i.d(t,"EnumIntermediateResultSavingMode",(function(){return L})),i.d(t,"EnumIntermediateResultType",(function(){return O})),i.d(t,"EnumLocalizationMode",(function(){return b})),i.d(t,"EnumPDFReadingMode",(function(){return B})),i.d(t,"EnumQRCodeErrorCorrectionLevel",(function(){return N})),i.d(t,"EnumRegionPredetectionMode",(function(){return F})),i.d(t,"EnumResultCoordinateType",(function(){return P})),i.d(t,"EnumResultType",(function(){return w})),i.d(t,"EnumScaleUpMode",(function(){return U})),i.d(t,"EnumTerminatePhase",(function(){return G})),i.d(t,"EnumTextFilterMode",(function(){return V})),i.d(t,"EnumTextResultOrderMode",(function(){return k})),i.d(t,"EnumTextureDetectionMode",(function(){return x})),function(e){e[e.IPF_Binary=0]="IPF_Binary",e[e.IPF_BinaryInverted=1]="IPF_BinaryInverted",e[e.IPF_GrayScaled=2]="IPF_GrayScaled",e[e.IPF_NV21=3]="IPF_NV21",e[e.IPF_RGB_565=4]="IPF_RGB_565",e[e.IPF_RGB_555=5]="IPF_RGB_555",e[e.IPF_RGB_888=6]="IPF_RGB_888",e[e.IPF_ARGB_8888=7]="IPF_ARGB_8888",e[e.IPF_RGB_161616=8]="IPF_RGB_161616",e[e.IPF_ARGB_16161616=9]="IPF_ARGB_16161616",e[e.IPF_ABGR_8888=10]="IPF_ABGR_8888",e[e.IPF_ABGR_16161616=11]="IPF_ABGR_16161616",e[e.IPF_BGR_888=12]="IPF_BGR_888"}(r||(r={})),function(e){e[e.DBR_SYSTEM_EXCEPTION=1]="DBR_SYSTEM_EXCEPTION",e[e.DBR_SUCCESS=0]="DBR_SUCCESS",e[e.DBR_UNKNOWN=-1e4]="DBR_UNKNOWN",e[e.DBR_NO_MEMORY=-10001]="DBR_NO_MEMORY",e[e.DBR_NULL_REFERENCE=-10002]="DBR_NULL_REFERENCE",e[e.DBR_LICENSE_INVALID=-10003]="DBR_LICENSE_INVALID",e[e.DBR_LICENSE_EXPIRED=-10004]="DBR_LICENSE_EXPIRED",e[e.DBR_FILE_NOT_FOUND=-10005]="DBR_FILE_NOT_FOUND",e[e.DBR_FILETYPE_NOT_SUPPORTED=-10006]="DBR_FILETYPE_NOT_SUPPORTED",e[e.DBR_BPP_NOT_SUPPORTED=-10007]="DBR_BPP_NOT_SUPPORTED",e[e.DBR_INDEX_INVALID=-10008]="DBR_INDEX_INVALID",e[e.DBR_BARCODE_FORMAT_INVALID=-10009]="DBR_BARCODE_FORMAT_INVALID",e[e.DBR_CUSTOM_REGION_INVALID=-10010]="DBR_CUSTOM_REGION_INVALID",e[e.DBR_MAX_BARCODE_NUMBER_INVALID=-10011]="DBR_MAX_BARCODE_NUMBER_INVALID",e[e.DBR_IMAGE_READ_FAILED=-10012]="DBR_IMAGE_READ_FAILED",e[e.DBR_TIFF_READ_FAILED=-10013]="DBR_TIFF_READ_FAILED",e[e.DBR_QR_LICENSE_INVALID=-10016]="DBR_QR_LICENSE_INVALID",e[e.DBR_1D_LICENSE_INVALID=-10017]="DBR_1D_LICENSE_INVALID",e[e.DBR_DIB_BUFFER_INVALID=-10018]="DBR_DIB_BUFFER_INVALID",e[e.DBR_PDF417_LICENSE_INVALID=-10019]="DBR_PDF417_LICENSE_INVALID",e[e.DBR_DATAMATRIX_LICENSE_INVALID=-10020]="DBR_DATAMATRIX_LICENSE_INVALID",e[e.DBR_PDF_READ_FAILED=-10021]="DBR_PDF_READ_FAILED",e[e.DBR_PDF_DLL_MISSING=-10022]="DBR_PDF_DLL_MISSING",e[e.DBR_PAGE_NUMBER_INVALID=-10023]="DBR_PAGE_NUMBER_INVALID",e[e.DBR_CUSTOM_SIZE_INVALID=-10024]="DBR_CUSTOM_SIZE_INVALID",e[e.DBR_CUSTOM_MODULESIZE_INVALID=-10025]="DBR_CUSTOM_MODULESIZE_INVALID",e[e.DBR_RECOGNITION_TIMEOUT=-10026]="DBR_RECOGNITION_TIMEOUT",e[e.DBR_JSON_PARSE_FAILED=-10030]="DBR_JSON_PARSE_FAILED",e[e.DBR_JSON_TYPE_INVALID=-10031]="DBR_JSON_TYPE_INVALID",e[e.DBR_JSON_KEY_INVALID=-10032]="DBR_JSON_KEY_INVALID",e[e.DBR_JSON_VALUE_INVALID=-10033]="DBR_JSON_VALUE_INVALID",e[e.DBR_JSON_NAME_KEY_MISSING=-10034]="DBR_JSON_NAME_KEY_MISSING",e[e.DBR_JSON_NAME_VALUE_DUPLICATED=-10035]="DBR_JSON_NAME_VALUE_DUPLICATED",e[e.DBR_TEMPLATE_NAME_INVALID=-10036]="DBR_TEMPLATE_NAME_INVALID",e[e.DBR_JSON_NAME_REFERENCE_INVALID=-10037]="DBR_JSON_NAME_REFERENCE_INVALID",e[e.DBR_PARAMETER_VALUE_INVALID=-10038]="DBR_PARAMETER_VALUE_INVALID",e[e.DBR_DOMAIN_NOT_MATCHED=-10039]="DBR_DOMAIN_NOT_MATCHED",e[e.DBR_RESERVEDINFO_NOT_MATCHED=-10040]="DBR_RESERVEDINFO_NOT_MATCHED",e[e.DBR_AZTEC_LICENSE_INVALID=-10041]="DBR_AZTEC_LICENSE_INVALID",e[e.DBR_LICENSE_DLL_MISSING=-10042]="DBR_LICENSE_DLL_MISSING",e[e.DBR_LICENSEKEY_NOT_MATCHED=-10043]="DBR_LICENSEKEY_NOT_MATCHED",e[e.DBR_REQUESTED_FAILED=-10044]="DBR_REQUESTED_FAILED",e[e.DBR_LICENSE_INIT_FAILED=-10045]="DBR_LICENSE_INIT_FAILED",e[e.DBR_PATCHCODE_LICENSE_INVALID=-10046]="DBR_PATCHCODE_LICENSE_INVALID",e[e.DBR_POSTALCODE_LICENSE_INVALID=-10047]="DBR_POSTALCODE_LICENSE_INVALID",e[e.DBR_DPM_LICENSE_INVALID=-10048]="DBR_DPM_LICENSE_INVALID",e[e.DBR_FRAME_DECODING_THREAD_EXISTS=-10049]="DBR_FRAME_DECODING_THREAD_EXISTS",e[e.DBR_STOP_DECODING_THREAD_FAILED=-10050]="DBR_STOP_DECODING_THREAD_FAILED",e[e.DBR_SET_MODE_ARGUMENT_ERROR=-10051]="DBR_SET_MODE_ARGUMENT_ERROR",e[e.DBR_LICENSE_CONTENT_INVALID=-10052]="DBR_LICENSE_CONTENT_INVALID",e[e.DBR_LICENSE_KEY_INVALID=-10053]="DBR_LICENSE_KEY_INVALID",e[e.DBR_LICENSE_DEVICE_RUNS_OUT=-10054]="DBR_LICENSE_DEVICE_RUNS_OUT",e[e.DBR_GET_MODE_ARGUMENT_ERROR=-10055]="DBR_GET_MODE_ARGUMENT_ERROR",e[e.DBR_IRT_LICENSE_INVALID=-10056]="DBR_IRT_LICENSE_INVALID",e[e.DBR_MAXICODE_LICENSE_INVALID=-10057]="DBR_MAXICODE_LICENSE_INVALID",e[e.DBR_GS1_DATABAR_LICENSE_INVALID=-10058]="DBR_GS1_DATABAR_LICENSE_INVALID",e[e.DBR_GS1_COMPOSITE_LICENSE_INVALID=-10059]="DBR_GS1_COMPOSITE_LICENSE_INVALID",e[e.DBR_DOTCODE_LICENSE_INVALID=-10061]="DBR_DOTCODE_LICENSE_INVALID",e[e.DMERR_NO_LICENSE=-2e4]="DMERR_NO_LICENSE",e[e.DMERR_LICENSE_SYNC_FAILED=-20003]="DMERR_LICENSE_SYNC_FAILED",e[e.DMERR_TRIAL_LICENSE=-20010]="DMERR_TRIAL_LICENSE",e[e.DMERR_FAILED_TO_REACH_LTS=-20200]="DMERR_FAILED_TO_REACH_LTS"}(n||(n={})),function(e){e[e.IMRDT_IMAGE=1]="IMRDT_IMAGE",e[e.IMRDT_CONTOUR=2]="IMRDT_CONTOUR",e[e.IMRDT_LINESEGMENT=4]="IMRDT_LINESEGMENT",e[e.IMRDT_LOCALIZATIONRESULT=8]="IMRDT_LOCALIZATIONRESULT",e[e.IMRDT_REGIONOFINTEREST=16]="IMRDT_REGIONOFINTEREST",e[e.IMRDT_QUADRILATERAL=32]="IMRDT_QUADRILATERAL"}(o||(o={})),function(e){e[e.BF_ALL=-31457281]="BF_ALL",e[e.BF_ONED=1050623]="BF_ONED",e[e.BF_GS1_DATABAR=260096]="BF_GS1_DATABAR",e[e.BF_CODE_39=1]="BF_CODE_39",e[e.BF_CODE_128=2]="BF_CODE_128",e[e.BF_CODE_93=4]="BF_CODE_93",e[e.BF_CODABAR=8]="BF_CODABAR",e[e.BF_ITF=16]="BF_ITF",e[e.BF_EAN_13=32]="BF_EAN_13",e[e.BF_EAN_8=64]="BF_EAN_8",e[e.BF_UPC_A=128]="BF_UPC_A",e[e.BF_UPC_E=256]="BF_UPC_E",e[e.BF_INDUSTRIAL_25=512]="BF_INDUSTRIAL_25",e[e.BF_CODE_39_EXTENDED=1024]="BF_CODE_39_EXTENDED",e[e.BF_GS1_DATABAR_OMNIDIRECTIONAL=2048]="BF_GS1_DATABAR_OMNIDIRECTIONAL",e[e.BF_GS1_DATABAR_TRUNCATED=4096]="BF_GS1_DATABAR_TRUNCATED",e[e.BF_GS1_DATABAR_STACKED=8192]="BF_GS1_DATABAR_STACKED",e[e.BF_GS1_DATABAR_STACKED_OMNIDIRECTIONAL=16384]="BF_GS1_DATABAR_STACKED_OMNIDIRECTIONAL",e[e.BF_GS1_DATABAR_EXPANDED=32768]="BF_GS1_DATABAR_EXPANDED",e[e.BF_GS1_DATABAR_EXPANDED_STACKED=65536]="BF_GS1_DATABAR_EXPANDED_STACKED",e[e.BF_GS1_DATABAR_LIMITED=131072]="BF_GS1_DATABAR_LIMITED",e[e.BF_PATCHCODE=262144]="BF_PATCHCODE",e[e.BF_PDF417=33554432]="BF_PDF417",e[e.BF_QR_CODE=67108864]="BF_QR_CODE",e[e.BF_DATAMATRIX=134217728]="BF_DATAMATRIX",e[e.BF_AZTEC=268435456]="BF_AZTEC",e[e.BF_MAXICODE=536870912]="BF_MAXICODE",e[e.BF_MICRO_QR=1073741824]="BF_MICRO_QR",e[e.BF_MICRO_PDF417=524288]="BF_MICRO_PDF417",e[e.BF_GS1_COMPOSITE=-2147483648]="BF_GS1_COMPOSITE",e[e.BF_MSI_CODE=1048576]="BF_MSI_CODE",e[e.BF_NULL=0]="BF_NULL"}(s||(s={}));var a=function(e,t,i,r){return new(i||(i=Promise))((function(n,o){function s(e){try{d(r.next(e))}catch(e){o(e)}}function a(e){try{d(r.throw(e))}catch(e){o(e)}}function d(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(s,a)}d((r=r.apply(e,t||[])).next())}))};const d=!!("object"==typeof global&&global.process&&global.process.release&&global.process.release.name&&"undefined"==typeof HTMLCanvasElement),_=!d&&"undefined"==typeof self,l=d?global:_?{}:self;class c{constructor(){this._canvasMaxWH="iPhone"==c.browserInfo.OS||"Android"==c.browserInfo.OS?2048:4096,this._instanceID=void 0,this.bSaveOriCanvas=!1,this.oriCanvas=null,this._1dMinConfidence=30,this.maxVideoCvsLength=3,this.videoCvses=[],this.videoGlCvs=null,this.videoGl=null,this.glImgData=null,this.bFilterRegionInJs=!0,this._region=null,this._timeStartDecode=null,this._timeEnterInnerDBR=null,this._timeGetMessage=null,this._bUseWebgl=!0,this.decodeRecords={},this.bDestroyed=!1,this._setWarnnedEx=new Set,this._lastErrorCode=0,this._lastErrorString="",this._lastInnerDecodeDuration=0}static get version(){return this._version}static get productKeys(){return this._productKeys}static set productKeys(e){if("unload"!=this._loadWasmStatus)throw new Error("`productKeys` is not allowed to change after loadWasm is called.");c._productKeys=e}static get handshakeCode(){return this._productKeys}static set handshakeCode(e){if("unload"!=this._loadWasmStatus)throw new Error("`handshakeCode` is not allowed to change after loadWasm is called.");c._productKeys=e}static get organizationID(){return this._organizationID}static set organizationID(e){if("unload"!=this._loadWasmStatus)throw new Error("`organizationID` is not allowed to change after loadWasm is called.");"number"==typeof e&&(e=e.toString()),c._organizationID=e}static set sessionPassword(e){if("unload"!=this._loadWasmStatus)throw new Error("`sessionPassword` is not allowed to change after loadWasm is called.");c._sessionPassword=e}static get sessionPassword(){return this._sessionPassword}static detectEnvironment(){return a(this,void 0,void 0,(function*(){let e={wasm:"undefined"!=typeof WebAssembly&&("undefined"==typeof navigator||!(/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&/\(.+\s11_2_([2-6]).*\)/.test(navigator.userAgent))),worker:!!(d?process.version>="v12":"undefined"!=typeof Worker),getUserMedia:!("undefined"==typeof navigator||!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia),camera:!1,browser:this.browserInfo.browser,version:this.browserInfo.version,OS:this.browserInfo.OS};if(e.getUserMedia)try{(yield navigator.mediaDevices.getUserMedia({video:!0})).getTracks().forEach(e=>{e.stop()}),e.camera=!0}catch(e){}return e}))}static get engineResourcePath(){return this._engineResourcePath}static set engineResourcePath(e){if("unload"!=this._loadWasmStatus)throw new Error("`engineResourcePath` is not allowed to change after loadWasm is called.");if(null==e&&(e="./"),d||_)c._engineResourcePath=e;else{let t=document.createElement("a");t.href=e,c._engineResourcePath=t.href}this._engineResourcePath.endsWith("/")||(c._engineResourcePath+="/")}static get licenseServer(){return this._licenseServer}static set licenseServer(e){if("unload"!=this._loadWasmStatus)throw new Error("`licenseServer` is not allowed to change after loadWasm is called.");if(null==e)c._licenseServer=[];else{e instanceof Array||(e=[e]);for(let t=0;t= v12.");let e,t=this.productKeys,r=(0==t.length||t.startsWith("P")||t.startsWith("L"))&&0==this.organizationID.length,o=r||t.length>=8&&!t.startsWith("t")&&!t.startsWith("f")&&!t.startsWith("P")&&!t.startsWith("L")||0==t.length&&0!=this.organizationID.length;if(o&&(d?process.version<"v15"&&(e="To use handshake requires nodejs version >= v15."):(l.crypto||(e="Please upgrade your browser to support handshake code."),l.crypto.subtle||(e="Require https to use handshake code in this browser."))),e){if(!r)throw new Error(e);r=!1,o=!1,console.warn(e),this._lastErrorCode=n.DMERR_FAILED_TO_REACH_LTS,this._lastErrorString=e}return r&&(t="",console.warn("Automatically apply for a public trial license.")),yield new Promise((e,n)=>a(this,void 0,void 0,(function*(){switch(this._loadWasmStatus){case"unload":{c._loadWasmStatus="loading";let e=this.engineResourcePath+this._workerName;if(d||this.engineResourcePath.startsWith(location.origin)||(e=yield fetch(e).then(e=>e.blob()).then(e=>URL.createObjectURL(e))),d){const t=i(0);c._dbrWorker=new t.Worker(e)}else c._dbrWorker=new Worker(e);this._dbrWorker.onerror=e=>{c._loadWasmStatus="loadFail";let t=new Error(e.message);this._loadWasmErr=t;for(let e of this._loadWasmCallbackArr)e(t);this._loadWasmCallbackArr=[]},this._dbrWorker.onmessage=e=>a(this,void 0,void 0,(function*(){let t=e.data?e.data:e;switch(t.type){case"log":this._onLog&&this._onLog(t.message);break;case"load":{t.message&&(t.message=t.message.replace("(https://www.dynamsoft.com/purchase-center/)","(https://www.dynamsoft.com/store/dynamsoft-barcode-reader/#javascript)"));let e=!1;if(r&&(e=!0),t.success){c._loadWasmStatus="loadSuccess",c._version=t.version+"(JS "+this._jsVersion+"."+this._jsEditVersion+")",this._onLog&&this._onLog("load dbr worker success");for(let e of this._loadWasmCallbackArr)e();this._loadWasmCallbackArr=[],this._dbrWorker.onerror=null,t.message&&console.warn(t.message)}else{let i=new Error(t.message);i.stack=t.stack+"\n"+i.stack,c._loadWasmStatus="loadFail",this._loadWasmErr=i;for(let e of this._loadWasmCallbackArr)e(i);this._loadWasmCallbackArr=[],e||111==t.ltsErrorCode&&-1!=t.message.toLowerCase().indexOf("trial license")&&(e=!0)}e&&this.showDialog(t.success?"warn":"error",t.message);break}case"task":{let e=t.id,i=t.body;try{this._taskCallbackMap.get(e)(i),this._taskCallbackMap.delete(e)}catch(t){throw this._taskCallbackMap.delete(e),t}break}default:this._onLog&&this._onLog(e)}})),d&&this._dbrWorker.on("message",this._dbrWorker.onmessage),this._dbrWorker.postMessage({type:"loadWasm",bd:this._bWasmDebug,engineResourcePath:this.engineResourcePath,version:this._jsVersion,brtk:o,bptk:r,pk:t,og:this.organizationID,dm:!d&&location.origin.startsWith("http")?location.origin:"https://localhost",bUseFullFeature:this._bUseFullFeature,browserInfo:this.browserInfo,deviceFriendlyName:this.deviceFriendlyName,ls:this.licenseServer,sp:this._sessionPassword,lm:this._limitModules,cw:this._chargeWay})}case"loading":this._loadWasmCallbackArr.push(t=>{t?n(t):e()});break;case"loadSuccess":e();break;case"loadFail":n(this._loadWasmErr)}})))}))}static showDialog(e,t){return a(this,void 0,void 0,(function*(){if(!d&&!this._bNeverShowDialog)try{let i=yield fetch(c.engineResourcePath+"dls.license.dialog.html");if(!i.ok)throw Error("Get license dialog fail. Network Error: "+i.statusText);let r=yield i.text();if(!r.trim().startsWith("<"))throw Error("Get license dialog fail. Can't get valid HTMLElement.");let n=document.createElement("div");n.innerHTML=r;let o=[];for(let e=0;e{if(i==e.target){s.remove();for(let e of o)e.remove()}});else if(!d&&i.classList.contains("dls-license-icon-close"))d=i,i.addEventListener("click",()=>{s.remove();for(let e of o)e.remove()});else if(!_&&i.classList.contains("dls-license-icon-error"))_=i,"error"!=e&&i.remove();else if(!l&&i.classList.contains("dls-license-icon-warn"))l=i,"warn"!=e&&i.remove();else if(!h&&i.classList.contains("dls-license-msg-content")){h=i;let e=t;for(;e;){let t=e.indexOf("["),r=e.indexOf("]",t),n=e.indexOf("(",r),o=e.indexOf(")",n);if(-1==t||-1==r||-1==n||-1==o){i.appendChild(new Text(e));break}t>0&&i.appendChild(new Text(e.substring(0,t)));let s=document.createElement("a"),a=e.substring(t+1,r);s.innerText=a;let d=e.substring(n+1,o);s.setAttribute("href",d),s.setAttribute("target","_blank"),i.appendChild(s),e=e.substring(o+1)}}document.body.appendChild(s)}catch(e){c._onLog&&c._onLog(e.message||e)}}))}static createInstanceInWorker(e=!1){return a(this,void 0,void 0,(function*(){return yield this.loadWasm(),yield new Promise((t,i)=>{let r=c._nextTaskID++;this._taskCallbackMap.set(r,e=>{if(e.success)return t(e.instanceID);{let t=new Error(e.message);return t.stack=e.stack+"\n"+t.stack,i(t)}}),this._dbrWorker.postMessage({type:"createInstance",id:r,productKeys:"",bScanner:e})})}))}static createInstance(){return a(this,void 0,void 0,(function*(){let e=new c;return e._instanceID=yield this.createInstanceInWorker(),e}))}decode(e){return a(this,void 0,void 0,(function*(){if(c._onLog&&c._onLog("decode(source: any)"),c._onLog&&(this._timeStartDecode=Date.now()),d)return e instanceof Buffer?yield this._decodeFileInMemory_Uint8Array(new Uint8Array(e)):e instanceof Uint8Array?yield this._decodeFileInMemory_Uint8Array(e):"string"==typeof e||e instanceof String?"data:image/"==e.substring(0,11)?yield this._decode_Base64(e):"http"==e.substring(0,4)?yield this._decode_Url(e):yield this._decode_FilePath(e):yield Promise.reject(TypeError("'_decode(source, config)': Type of 'source' should be 'Buffer', 'Uint8Array', 'String(base64 with image mime)' or 'String(url)'."));{let t={};return!this.region||this.region instanceof Array||(t.region=JSON.parse(JSON.stringify(this.region))),e instanceof Blob?yield this._decode_Blob(e,t):e instanceof ArrayBuffer?yield this._decode_ArrayBuffer(e,t):e instanceof Uint8Array||e instanceof Uint8ClampedArray?yield this._decode_Uint8Array(e,t):e instanceof HTMLImageElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap?yield this._decode_Image(e,t):e instanceof HTMLCanvasElement||"undefined"!=typeof OffscreenCanvas&&e instanceof OffscreenCanvas?yield this._decode_Canvas(e,t):e instanceof HTMLVideoElement?yield this._decode_Video(e,t):"string"==typeof e||e instanceof String?"data:image/"==e.substring(0,11)?yield this._decode_Base64(e,t):yield this._decode_Url(e,t):yield Promise.reject(TypeError("'_decode(source, config)': Type of 'source' should be 'Blob', 'ArrayBuffer', 'Uint8Array', 'HTMLImageElement', 'HTMLCanvasElement', 'HTMLVideoElement', 'String(base64 with image mime)' or 'String(url)'."))}}))}decodeBase64String(e){return a(this,void 0,void 0,(function*(){let t={};return!this.region||this.region instanceof Array||(t.region=JSON.parse(JSON.stringify(this.region))),this._decode_Base64(e,t)}))}decodeUrl(e){return a(this,void 0,void 0,(function*(){let t={};return!this.region||this.region instanceof Array||(t.region=JSON.parse(JSON.stringify(this.region))),this._decode_Url(e,t)}))}_decodeBuffer_Uint8Array(e,t,i,r,n,o){return a(this,void 0,void 0,(function*(){return yield new Promise((a,d)=>{let _=c._nextTaskID++;c._taskCallbackMap.set(_,e=>{if(e.success){let t,i=c._onLog?Date.now():0;c._onLog&&c._onLog("worker return result: "+i),this._lastInnerDecodeDuration=e.duration;try{t=this._handleRetJsonString(e.decodeReturn);for(let e=0;e{let r=new FileReader;r.readAsArrayBuffer(e),r.onload=()=>{t(r.result)},r.onerror=()=>{i(r.error)}}).then(e=>this._decodeBuffer_Uint8Array(new Uint8Array(e),t,i,r,n,o))}))}decodeBuffer(e,t,i,r,n,o){return a(this,void 0,void 0,(function*(){let s;return c._onLog&&c._onLog("decodeBuffer(buffer,width,height,stride,format)"),c._onLog&&(this._timeStartDecode=Date.now()),d?e instanceof Uint8Array?s=yield this._decodeBuffer_Uint8Array(e,t,i,r,n,o):e instanceof Buffer&&(s=yield this._decodeBuffer_Uint8Array(new Uint8Array(e),t,i,r,n,o)):e instanceof Uint8Array||e instanceof Uint8ClampedArray?s=yield this._decodeBuffer_Uint8Array(e,t,i,r,n,o):e instanceof ArrayBuffer?s=yield this._decodeBuffer_Uint8Array(new Uint8Array(e),t,i,r,n,o):e instanceof Blob&&(s=yield this._decodeBuffer_Blob(e,t,i,r,n,o)),s}))}_decodeFileInMemory_Uint8Array(e){return a(this,void 0,void 0,(function*(){return yield new Promise((t,i)=>{let r=c._nextTaskID++;c._taskCallbackMap.set(r,e=>{if(e.success){let r;this._lastInnerDecodeDuration=e.duration;try{r=this._handleRetJsonString(e.decodeReturn)}catch(e){return i(e)}return t(r)}{let t=new Error(e.message);return t.stack=e.stack+"\n"+t.stack,i(t)}}),c._dbrWorker.postMessage({type:"decodeFileInMemory",id:r,instanceID:this._instanceID,body:{bytes:e}})})}))}getRuntimeSettings(){return a(this,void 0,void 0,(function*(){return yield new Promise((e,t)=>{let i=c._nextTaskID++;c._taskCallbackMap.set(i,i=>{if(i.success){let t=JSON.parse(i.results);return null!=this.userDefinedRegion&&(t.region=JSON.parse(JSON.stringify(this.userDefinedRegion))),e(t)}{let e=new Error(i.message);return e.stack=i.stack+"\n"+e.stack,t(e)}}),c._dbrWorker.postMessage({type:"getRuntimeSettings",id:i,instanceID:this._instanceID})})}))}updateRuntimeSettings(e){return a(this,void 0,void 0,(function*(){let t;if("string"==typeof e||e instanceof String)if("speed"==e){let e=yield this.getRuntimeSettings();yield this.resetRuntimeSettings(),t=yield this.getRuntimeSettings(),t.barcodeFormatIds=e.barcodeFormatIds,t.barcodeFormatIds_2=e.barcodeFormatIds_2,t.region=e.region,t.deblurLevel=3,t.expectedBarcodesCount=0,t.localizationModes=[2,0,0,0,0,0,0,0]}else if("balance"==e){let e=yield this.getRuntimeSettings();yield this.resetRuntimeSettings(),t=yield this.getRuntimeSettings(),t.barcodeFormatIds=e.barcodeFormatIds,t.barcodeFormatIds_2=e.barcodeFormatIds_2,t.region=e.region,t.deblurLevel=5,t.expectedBarcodesCount=512,t.localizationModes=[2,16,0,0,0,0,0,0]}else if("coverage"==e){let e=yield this.getRuntimeSettings();yield this.resetRuntimeSettings(),t=yield this.getRuntimeSettings(),t.barcodeFormatIds=e.barcodeFormatIds,t.barcodeFormatIds_2=e.barcodeFormatIds_2,t.region=e.region}else t=JSON.parse(e);else{if("object"!=typeof e)throw TypeError("'UpdateRuntimeSettings(settings)': Type of 'settings' should be 'String' or 'PlainObject'.");if(t=JSON.parse(JSON.stringify(e)),t.region instanceof Array){let e=t.region;[e.regionLeft,e.regionTop,e.regionLeft,e.regionBottom,e.regionMeasuredByPercentage].some(e=>void 0!==e)&&(t.region={regionLeft:e.regionLeft||0,regionTop:e.regionTop||0,regionRight:e.regionRight||0,regionBottom:e.regionBottom||0,regionMeasuredByPercentage:e.regionMeasuredByPercentage||0})}}if(!c._bUseFullFeature){if(0!=(t.barcodeFormatIds&~(s.BF_ONED|s.BF_QR_CODE|s.BF_PDF417|s.BF_DATAMATRIX))||0!=t.barcodeFormatIds_2)throw Error("Some of the specified barcode formats are not supported in the compact version. Please try the full-featured version.");if(0!=t.intermediateResultTypes)throw Error("Intermediate results is not supported in the compact version. Please try the full-featured version.")}if(!d)if(this.bFilterRegionInJs){let e=t.region;if(e instanceof Array)throw Error("The `region` of type `Array` is only allowed in `BarcodeScanner`.");this.userDefinedRegion=JSON.parse(JSON.stringify(e)),(e.regionLeft||e.regionTop||e.regionRight||e.regionBottom||e.regionMeasuredByPercentage)&&(e.regionLeft||e.regionTop||100!=e.regionRight||100!=e.regionBottom||!e.regionMeasuredByPercentage)?this.region=e:this.region=null,t.region={regionLeft:0,regionTop:0,regionRight:0,regionBottom:0,regionMeasuredByPercentage:0}}else this.userDefinedRegion=null,this.region=null;return yield new Promise((e,i)=>{let r=c._nextTaskID++;c._taskCallbackMap.set(r,t=>{if(t.success){try{this._handleRetJsonString(t.updateReturn)}catch(e){i(e)}return e()}{let e=new Error(t.message);return e.stack=t.stack+"\n"+e.stack,i(e)}}),c._dbrWorker.postMessage({type:"updateRuntimeSettings",id:r,instanceID:this._instanceID,body:{settings:JSON.stringify(t)}})})}))}resetRuntimeSettings(){return a(this,void 0,void 0,(function*(){return this.userDefinedRegion=null,this.region=null,yield new Promise((e,t)=>{let i=c._nextTaskID++;c._taskCallbackMap.set(i,i=>{if(i.success)return e();{let e=new Error(i.message);return e.stack=i.stack+"\n"+e.stack,t(e)}}),c._dbrWorker.postMessage({type:"resetRuntimeSettings",id:i,instanceID:this._instanceID})})}))}outputSettingsToString(){return a(this,void 0,void 0,(function*(){if(!c._bUseFullFeature)throw Error("outputSettingsToString() is not supported in the compact version. Please try the full-featured version.");return yield new Promise((e,t)=>{let i=c._nextTaskID++;c._taskCallbackMap.set(i,i=>{if(i.success)return e(i.results);{let e=new Error(i.message);return e.stack=i.stack+"\n"+e.stack,t(e)}}),c._dbrWorker.postMessage({type:"outputSettingsToString",id:i,instanceID:this._instanceID})})}))}initRuntimeSettingsWithString(e){return a(this,void 0,void 0,(function*(){if(!c._bUseFullFeature)throw Error("initRuntimeSettingsWithString() is not supported in the compact version. Please try the full-featured version.");if("string"==typeof e||e instanceof String)e=e;else{if("object"!=typeof e)throw TypeError("'initRuntimeSettingstWithString(settings)': Type of 'settings' should be 'String' or 'PlainObject'.");e=JSON.stringify(e)}return yield new Promise((t,i)=>{let r=c._nextTaskID++;c._taskCallbackMap.set(r,e=>{if(e.success){try{this._handleRetJsonString(e.initReturn)}catch(e){i(e)}return t()}{let t=new Error(e.message);return t.stack=e.stack+"\n"+t.stack,i(t)}}),c._dbrWorker.postMessage({type:"initRuntimeSettingsWithString",id:r,instanceID:this._instanceID,body:{settings:e}})})}))}_decode_Blob(e,t){return a(this,void 0,void 0,(function*(){c._onLog&&c._onLog("_decode_Blob(blob: Blob)");let i=null,r=null;if("undefined"!=typeof createImageBitmap)try{i=yield createImageBitmap(e)}catch(e){}i||(r=yield function(e){return new Promise((t,i)=>{let r=URL.createObjectURL(e),n=new Image;n.dbrObjUrl=r,n.src=r,n.onload=()=>{t(n)},n.onerror=e=>{i(new Error("Can't convert blob to image : "+(e instanceof Event?e.type:e)))}})}(e));let n=yield this._decode_Image(i||r,t);return i&&i.close(),n}))}_decode_ArrayBuffer(e,t){return a(this,void 0,void 0,(function*(){return yield this._decode_Blob(new Blob([e]),t)}))}_decode_Uint8Array(e,t){return a(this,void 0,void 0,(function*(){return yield this._decode_Blob(new Blob([e]),t)}))}_decode_Image(e,t){return a(this,void 0,void 0,(function*(){c._onLog&&c._onLog("_decode_Image(image: HTMLImageElement|ImageBitmap)"),t=t||{};let i,r,n=e instanceof HTMLImageElement?e.naturalWidth:e.width,o=e instanceof HTMLImageElement?e.naturalHeight:e.height,s=Math.max(n,o);if(s>this._canvasMaxWH){let e=this._canvasMaxWH/s;i=Math.round(n*e),r=Math.round(o*e)}else i=n,r=o;let a,d=0,_=0,h=n,u=o,g=i,E=r,R=t.region;if(R){let e,t,s,a;R.regionMeasuredByPercentage?(e=R.regionLeft*i/100,t=R.regionTop*r/100,s=R.regionRight*i/100,a=R.regionBottom*r/100):(e=R.regionLeft,t=R.regionTop,s=R.regionRight,a=R.regionBottom),g=s-e,h=Math.round(g/i*n),E=a-t,u=Math.round(E/r*o),d=Math.round(e/i*n),_=Math.round(t/r*o)}!this.bSaveOriCanvas&&l.OffscreenCanvas?a=new OffscreenCanvas(g,E):(a=document.createElement("canvas"),a.width=g,a.height=E);let m,f=a.getContext("2d");0==d&&0==_&&n==h&&o==u&&n==g&&o==E?f.drawImage(e,0,0):f.drawImage(e,d,_,h,u,0,0,g,E),e.dbrObjUrl&&URL.revokeObjectURL(e.dbrObjUrl),R?(m=JSON.parse(JSON.stringify(t)),delete m.region):m=t;let I=yield this._decode_Canvas(a,m);return c.fixResultLocationWhenFilterRegionInJs(R,I,d,_,h,u,g,E),I}))}_decode_Canvas(e,t){return a(this,void 0,void 0,(function*(){if(c._onLog&&c._onLog("_decode_Canvas(canvas:HTMLCanvasElement)"),e.crossOrigin&&"anonymous"!=e.crossOrigin)throw"cors";(this.bSaveOriCanvas||this.singleFrameMode)&&(this.oriCanvas=e);let i=(e.dbrCtx2d||e.getContext("2d")).getImageData(0,0,e.width,e.height).data;return yield this._decodeBuffer_Uint8Array(i,e.width,e.height,4*e.width,r.IPF_ABGR_8888,t)}))}handleVideoFrame(e,t){if(c._onLog&&c._onLog("handleVideoFrame(video)"),!(e instanceof HTMLVideoElement))throw TypeError("'handleVideoFrame(video [, config] )': Type of 'video' should be 'HTMLVideoElement'.");if(e.crossOrigin&&"anonymous"!=e.crossOrigin)throw"cors";t=t||{};const i=e.videoWidth,r=e.videoHeight,n=Math.max(i,r);let o,s;if(n>this._canvasMaxWH){let e=this._canvasMaxWH/n;o=Math.round(i*e),s=Math.round(r*e)}else o=i,s=r;let a=0,d=0,_=i,h=r,u=i,g=r,E=t.region;if(E){let e,t,n,l;E.regionMeasuredByPercentage?(e=E.regionLeft*o/100,t=E.regionTop*s/100,n=E.regionRight*o/100,l=E.regionBottom*s/100):(e=E.regionLeft,t=E.regionTop,n=E.regionRight,l=E.regionBottom),u=n-e,_=Math.round(u/o*i),g=l-t,h=Math.round(g/s*r),a=Math.round(e/o*i),d=Math.round(t/s*r)}let R=0==a&&0==d&&i==_&&r==h&&i==u&&r==g;if(!this.bSaveOriCanvas&&this._bUseWebgl&&R){this.videoGlCvs||(this.videoGlCvs=l.OffscreenCanvas?new OffscreenCanvas(u,g):document.createElement("canvas"));const t=this.videoGlCvs;t.width==u&&t.height==g||(t.height=g,t.width=u,this.videoGl&&this.videoGl.viewport(0,0,u,g));const i=this.videoGl||t.getContext("webgl",{alpha:!1,antialias:!1,depth:!1,stencil:!1,preserveDrawingBuffer:!0})||t.getContext("experimental-webgl",{alpha:!1,antialias:!1,depth:!1,stencil:!1,preserveDrawingBuffer:!0});if(!this.videoGl){this.videoGl=i;const e=i.createShader(i.VERTEX_SHADER);i.shaderSource(e,"\nattribute vec4 a_position;\nattribute vec2 a_uv;\n\nvarying vec2 v_uv;\n\nvoid main() {\n gl_Position = a_position;\n v_uv = a_uv;\n}\n"),i.compileShader(e),i.getShaderParameter(e,i.COMPILE_STATUS)||console.error("An error occurred compiling the shaders: "+i.getShaderInfoLog(e));const t=i.createShader(i.FRAGMENT_SHADER);i.shaderSource(t,"\nprecision lowp float;\n\nvarying vec2 v_uv;\n\nuniform sampler2D u_texture;\n\nvoid main() {\n vec4 sample = texture2D(u_texture, v_uv);\n float grey = 0.299 * sample.r + 0.587 * sample.g + 0.114 * sample.b;\n gl_FragColor = vec4(grey, 0.0, 0.0, 1.0);\n}\n"),i.compileShader(t),i.getShaderParameter(t,i.COMPILE_STATUS)||console.error("An error occurred compiling the shaders: "+i.getShaderInfoLog(t));const r=i.createProgram();i.attachShader(r,e),i.attachShader(r,t),i.linkProgram(r),i.getProgramParameter(r,i.LINK_STATUS)||console.error("Unable to initialize the shader program: "+i.getProgramInfoLog(r)),i.useProgram(r),i.bindBuffer(i.ARRAY_BUFFER,i.createBuffer()),i.bufferData(i.ARRAY_BUFFER,new Float32Array([-1,1,0,1,1,1,1,1,-1,-1,0,0,1,-1,1,0]),i.STATIC_DRAW);const n=i.getAttribLocation(r,"a_position");i.enableVertexAttribArray(n),i.vertexAttribPointer(n,2,i.FLOAT,!1,16,0);const o=i.getAttribLocation(r,"a_uv");i.enableVertexAttribArray(o),i.vertexAttribPointer(o,2,i.FLOAT,!1,16,8),i.activeTexture(i.TEXTURE0),i.bindTexture(i.TEXTURE_2D,i.createTexture()),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.NEAREST),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.NEAREST),i.uniform1i(i.getUniformLocation(r,"u_texture"),0)}(!this.glImgData||this.glImgData.length=this.maxVideoCvsLength&&(this.videoCvses=this.videoCvses.slice(1)),this.videoCvses.push(i))}const r=i.dbrCtx2d;let n;R?r.drawImage(e,0,0):r.drawImage(e,a,d,_,h,0,0,u,g),E?(n=JSON.parse(JSON.stringify(t)),delete n.region):n=t;let o=i.dbrCtx2d||i.getContext("2d");return 0===i.width||0===i.height?null:{bUseWebGL:!1,data:o.getImageData(0,0,i.width,i.height).data,cvs:i,config:n,region:E,sx:a,sy:d,sWidth:_,sHeight:h,dWidth:u,dHeight:g}}}_decode_Video(e,t){return a(this,void 0,void 0,(function*(){if(c._onLog&&c._onLog("_decode_Video(video)"),!(e instanceof HTMLVideoElement))throw TypeError("'_decode_Video(video [, config] )': Type of 'video' should be 'HTMLVideoElement'.");if(e.crossOrigin&&"anonymous"!=e.crossOrigin)throw"cors";let i=this.handleVideoFrame(e,t);if(i&&i.bUseWebGL){let{u8Gray:e,dWidth:t,dHeight:n}=i;return yield this._decodeBuffer_Uint8Array(e,t,n,t,r.IPF_GrayScaled)}if(i&&!1===i.bUseWebGL){let{data:e,cvs:t,config:n,region:o,sx:s,sy:a,sWidth:d,sHeight:_,dWidth:l,dHeight:h}=i;(this.bSaveOriCanvas||this.singleFrameMode)&&(this.oriCanvas=t);let u=yield this._decodeBuffer_Uint8Array(e,t.width,t.height,4*t.width,r.IPF_ABGR_8888,n);return c.fixResultLocationWhenFilterRegionInJs(o,u,s,a,d,_,l,h),u}}))}_decode_Base64(e,t){return a(this,void 0,void 0,(function*(){if(c._onLog&&c._onLog("_decode_Base64(base64Str)"),!("string"==typeof e||e instanceof String))return Promise.reject("'_decode_Base64(base64Str, config)': Type of 'base64Str' should be 'String'.");if("data:image/"==e.substring(0,11)&&(e=e.substring(e.indexOf(",")+1)),d){let t=Buffer.from(e,"base64");return yield this._decodeFileInMemory_Uint8Array(new Uint8Array(t))}{let i=atob(e),r=i.length,n=new Uint8Array(r);for(;r--;)n[r]=i.charCodeAt(r);return yield this._decode_Blob(new Blob([n]),t)}}))}_decode_Url(e,t){return a(this,void 0,void 0,(function*(){if(c._onLog&&c._onLog("_decode_Url(url)"),!("string"==typeof e||e instanceof String))throw TypeError("'_decode_Url(url, config)': Type of 'url' should be 'String'.");if(e=e,d){let t=yield new Promise((t,r)=>{(e.startsWith("https")?i(1):i(2)).get(e,e=>{if(200==e.statusCode){let i=[];e.on("data",e=>{i.push(e)}).on("end",()=>{t(new Uint8Array(Buffer.concat(i)))})}else r("http get fail, statusCode: "+e.statusCode)})});return yield this._decodeFileInMemory_Uint8Array(t)}{let i=yield new Promise((t,i)=>{let r=new XMLHttpRequest;r.open("GET",e,!0),r.responseType="blob",r.send(),r.onloadend=()=>a(this,void 0,void 0,(function*(){t(r.response)})),r.onerror=()=>{i(new Error("Network Error: "+r.statusText))}});return yield this._decode_Blob(i,t)}}))}_decode_FilePath(e,t){return a(this,void 0,void 0,(function*(){if(c._onLog&&c._onLog("_decode_FilePath(path)"),!d)throw Error("'_decode_FilePath(path, config)': The method is only supported in node environment.");if(!("string"==typeof e||e instanceof String))throw TypeError("'_decode_FilePath(path, config)': Type of 'path' should be 'String'.");const t=i(3);let r=yield new Promise((i,r)=>{t.readFile(e,(e,t)=>{e?r(e):i(new Uint8Array(t))})});return yield this._decodeFileInMemory_Uint8Array(r)}))}static fixResultLocationWhenFilterRegionInJs(e,t,i,r,n,o,s,a){if(e&&t.length>0)for(let e of t){let t=e.localizationResult;2==t.resultCoordinateType&&(t.x1*=.01*s,t.x2*=.01*s,t.x3*=.01*s,t.x4*=.01*s,t.y1*=.01*a,t.y2*=.01*a,t.y3*=.01*a,t.y4*=.01*a);let d=s/n,_=a/o;t.x1=t.x1/d+i,t.x2=t.x2/d+i,t.x3=t.x3/d+i,t.x4=t.x4/d+i,t.y1=t.y1/_+r,t.y2=t.y2/_+r,t.y3=t.y3/_+r,t.y4=t.y4/_+r,2==t.resultCoordinateType&&(t.x1*=100/n,t.x2*=100/n,t.x3*=100/n,t.x4*=100/n,t.y1*=100/o,t.y2*=100/o,t.y3*=100/o,t.y4*=100/o)}}static BarcodeReaderException(e,t){let i,r=n.DBR_UNKNOWN;return"number"==typeof e?(r=e,i=new Error(t)):i=new Error(e),i.code=r,i}_handleRetJsonString(e){let t=n;if(e.textResults){for(let t=0;t{let i=t.indexOf(":");e[t.substring(0,i)]=t.substring(i+1)}),i.exception=e}}return e.decodeRecords?this.decodeRecords=e.decodeRecords:this.decodeRecords={},this._lastErrorCode=e.exception,this._lastErrorString=e.description,e.textResults}if(e.exception==t.DBR_SUCCESS)return e.data;throw c.BarcodeReaderException(e.exception,e.description)}setModeArgument(e,t,i,r){return a(this,void 0,void 0,(function*(){return yield new Promise((n,o)=>{let s=c._nextTaskID++;c._taskCallbackMap.set(s,e=>{if(e.success){try{this._handleRetJsonString(e.setReturn)}catch(e){return o(e)}return n()}{let t=new Error(e.message);return t.stack=e.stack+"\n"+t.stack,o(t)}}),c._dbrWorker.postMessage({type:"setModeArgument",id:s,instanceID:this._instanceID,body:{modeName:e,index:t,argumentName:i,argumentValue:r}})})}))}getModeArgument(e,t,i){return a(this,void 0,void 0,(function*(){return yield new Promise((r,n)=>{let o=c._nextTaskID++;c._taskCallbackMap.set(o,e=>{if(e.success){let t;try{t=this._handleRetJsonString(e.getReturn)}catch(e){return n(e)}return r(t)}{let t=new Error(e.message);return t.stack=e.stack+"\n"+t.stack,n(t)}}),c._dbrWorker.postMessage({type:"getModeArgument",id:o,instanceID:this._instanceID,body:{modeName:e,index:t,argumentName:i}})})}))}getIntermediateResults(){return a(this,void 0,void 0,(function*(){return yield new Promise((e,t)=>{let i=c._nextTaskID++;c._taskCallbackMap.set(i,i=>{if(i.success)return e(i.results);{let e=new Error(i.message);return e.stack=i.stack+"\n"+e.stack,t(e)}}),c._dbrWorker.postMessage({type:"getIntermediateResults",id:i,instanceID:this._instanceID})})}))}getIntermediateCanvas(){return a(this,void 0,void 0,(function*(){let e=yield this.getIntermediateResults(),t=[];for(let i of e)if(i.dataType==o.IMRDT_IMAGE)for(let e of i.results){const i=e.bytes;let n;switch(c._onLog&&c._onLog(" "+i.length+" "+i.byteLength+" "+e.width+" "+e.height+" "+e.stride+" "+e.format),e.format){case r.IPF_ABGR_8888:n=new Uint8ClampedArray(i);break;case r.IPF_RGB_888:{const e=i.length/3;n=new Uint8ClampedArray(4*e);for(let t=0;t{let i=c._nextTaskID++;c._taskCallbackMap.set(i,i=>{if(i.success)return e();{let e=new Error(i.message);return e.stack=i.stack+"\n"+e.stack,t(e)}}),c._dbrWorker.postMessage({type:"destroy",id:i,instanceID:this._instanceID})})}}c._jsVersion="8.6.0",c._jsEditVersion="20210628",c._version="loading...(JS "+c._jsVersion+"."+c._jsEditVersion+")",c._productKeys=d||_||!document.currentScript?"":document.currentScript.getAttribute("data-productKeys")||document.currentScript.getAttribute("data-licenseKey")||document.currentScript.getAttribute("data-handshakeCode")||"",c._organizationID=d||_||!document.currentScript?"":document.currentScript.getAttribute("data-organizationID")||"",c._sessionPassword=d||_||!document.currentScript?"":document.currentScript.getAttribute("data-sessionPassword")||"",c.browserInfo=function(){if(!d&&!_){var e={init:function(){this.browser=this.searchString(this.dataBrowser)||"unknownBrowser",this.version=this.searchVersion(navigator.userAgent)||this.searchVersion(navigator.appVersion)||"unknownVersion",this.OS=this.searchString(this.dataOS)||"unknownOS","Linux"==this.OS&&-1!=navigator.userAgent.indexOf("Windows NT")&&(this.OS="HarmonyOS")},searchString:function(e){for(var t=0;t{if(d)return __dirname+"/";if(!_&&document.currentScript){let e=document.currentScript.src,t=e.indexOf("?");if(-1!=t)e=e.substring(0,t);else{let t=e.indexOf("#");-1!=t&&(e=e.substring(0,t))}return e.substring(0,e.lastIndexOf("/")+1)}return"./"})(),c._licenseServer=[],c._deviceFriendlyName="",c._isShowRelDecodeTimeInResults=!1,c._bWasmDebug=!1,c._bNeverShowDialog=!1,c.__bUseFullFeature=!0,c._nextTaskID=0,c._taskCallbackMap=new Map,c._loadWasmStatus="unload",c._loadWasmCallbackArr=[],c._lastErrorCode=0,c._lastErrorString="",c._loadWasmErr=null;var h=function(e,t,i,r){return new(i||(i=Promise))((function(n,o){function s(e){try{d(r.next(e))}catch(e){o(e)}}function a(e){try{d(r.throw(e))}catch(e){o(e)}}function d(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(s,a)}d((r=r.apply(e,t||[])).next())}))};const u=!!("object"==typeof global&&global.process&&global.process.release&&global.process.release.name&&"undefined"==typeof HTMLCanvasElement);class g extends c{constructor(){super(),this.styleEls=[],this.videoSettings={video:{width:{ideal:1280},height:{ideal:720},facingMode:{ideal:"environment"}}},this._singleFrameMode=!(navigator&&navigator.mediaDevices&&navigator.mediaDevices.getUserMedia),this._singleFrameModeIpt=(()=>{let e=document.createElement("input");return e.setAttribute("type","file"),e.setAttribute("accept","image/*"),e.setAttribute("capture",""),e.addEventListener("change",()=>h(this,void 0,void 0,(function*(){let t=e.files[0];e.value="";let i=yield this.decode(t);for(let e of i)delete e.bUnduplicated;if(this._drawRegionsults(i),this.onFrameRead&&this._isOpen&&!this._bPauseScan&&this.onFrameRead(i),this.onUnduplicatedRead&&this._isOpen&&!this._bPauseScan)for(let e of i)this.onUnduplicatedRead(e.barcodeText,e);yield this.clearMapDecodeRecord()}))),e})(),this._clickIptSingleFrameMode=()=>{this._singleFrameModeIpt.click()},this.intervalTime=0,this._isOpen=!1,this._bWorkerDecodeBuffer=!1,this._intervalGetVideoFrame=0,this._getVideoFrameMode=4,this.loopGetFrameTimes=1,this._countLoopGetFrame=0,this.queue_handledFrame=[],this.array_getFrameTimeCost=[],this.array_decodeFrameTimeCost=[],this._indexCurrentDecodingFrame=0,this._timeEndGettingFrame=null,this._bPauseScan=!1,this._lastDeviceId=void 0,this._intervalDetectVideoPause=1e3,this._vc_bPlayingVideoBeforeHide=!1,this._ev_documentHideEvent=()=>{"visible"===document.visibilityState?this._vc_bPlayingVideoBeforeHide&&("Firefox"==c.browserInfo.browser?this.play():this._video.play(),this._vc_bPlayingVideoBeforeHide=!1):this._video&&!this._video.paused&&(this._vc_bPlayingVideoBeforeHide=!0,this._video.pause())},this._video=null,this._cvsDrawArea=null,this._divScanArea=null,this._divScanLight=null,this._bgLoading=null,this._bgCamera=null,this._selCam=null,this._selRsl=null,this._optGotRsl=null,this._btnClose=null,this._soundOnSuccessfullRead=new Audio("data:audio/mpeg;base64,SUQzBAAAAAAAI1RTU0UAAAAPAAADTGF2ZjU4LjI5LjEwMAAAAAAAAAAAAAAA/+M4wAAAAAAAAAAAAEluZm8AAAAPAAAABQAAAkAAgICAgICAgICAgICAgICAgICAgKCgoKCgoKCgoKCgoKCgoKCgoKCgwMDAwMDAwMDAwMDAwMDAwMDAwMDg4ODg4ODg4ODg4ODg4ODg4ODg4P//////////////////////////AAAAAExhdmM1OC41NAAAAAAAAAAAAAAAACQEUQAAAAAAAAJAk0uXRQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/+MYxAANQAbGeUEQAAHZYZ3fASqD4P5TKBgocg+Bw/8+CAYBA4XB9/4EBAEP4nB9+UOf/6gfUCAIKyjgQ/Kf//wfswAAAwQA/+MYxAYOqrbdkZGQAMA7DJLCsQxNOij///////////+tv///3RWiZGBEhsf/FO/+LoCSFs1dFVS/g8f/4Mhv0nhqAieHleLy/+MYxAYOOrbMAY2gABf/////////////////usPJ66R0wI4boY9/8jQYg//g2SPx1M0N3Z0kVJLIs///Uw4aMyvHJJYmPBYG/+MYxAgPMALBucAQAoGgaBoFQVBUFQWDv6gZBUFQVBUGgaBr5YSgqCoKhIGg7+IQVBUFQVBoGga//SsFSoKnf/iVTEFNRTMu/+MYxAYAAANIAAAAADEwMFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV"),this.bPlaySoundOnSuccessfulRead=!1,this.bVibrateOnSuccessfulRead=!1,this.vibrateDuration=300,this._allCameras=[],this._currentCamera=null,this._videoTrack=null,this.regionMaskFillStyle="rgba(0,0,0,0.5)",this.regionMaskStrokeStyle="rgb(254,142,20)",this.regionMaskLineWidth=2,this.barcodeFillStyle="rgba(254,180,32,0.3)",this.barcodeStrokeStyle="rgba(254,180,32,0.9)",this.barcodeLineWidth=1,this.beingLazyDrawRegionsults=!1,this._indexVideoRegion=0,this._onCameraSelChange=()=>{this.play(this._selCam.value).then(()=>{this._isOpen||this.stop()})},this._onResolutionSelChange=()=>{let e,t;if(this._selRsl&&-1!=this._selRsl.selectedIndex){let i=this._selRsl.options[this._selRsl.selectedIndex];e=i.getAttribute("data-width"),t=i.getAttribute("data-height")}this.play(void 0,e,t).then(()=>{this._isOpen||this.stop()})},this._onCloseBtnClick=()=>{this.hide()},this.iPlayRound=0,this.promisePlay=null}static get defaultUIElementURL(){var e;return null===(e=this._defaultUIElementURL)||void 0===e?void 0:e.replace("@engineResourcePath/",c.engineResourcePath)}static set defaultUIElementURL(e){this._defaultUIElementURL=e}getUIElement(){return this.UIElement}setUIElement(e){return h(this,void 0,void 0,(function*(){if("string"==typeof e||e instanceof String){if(!e.trim().startsWith("<")){let t=yield fetch(e);if(!t.ok)throw Error("setUIElement(elementOrUrl): Network Error: "+t.statusText);e=yield t.text()}if(!e.trim().startsWith("<"))throw Error("setUIElement(elementOrUrl): Can't get valid HTMLElement.");let t=document.createElement("div");t.innerHTML=e;for(let e=0;e{h(this,void 0,void 0,(function*(){let e=yield this.getScanSettings();e.oneDTrustFrameCount=1,yield this.updateScanSettings(e)}))})()}_assertOpen(){if(!this._isOpen)throw Error("The scanner is not open.")}get soundOnSuccessfullRead(){return this._soundOnSuccessfullRead}set soundOnSuccessfullRead(e){e instanceof HTMLAudioElement?this._soundOnSuccessfullRead=e:this._soundOnSuccessfullRead=new Audio(e)}get whenToPlaySoundforSuccessfulRead(){return!0===this.bPlaySoundOnSuccessfulRead?"frame":this.bPlaySoundOnSuccessfulRead?this.bPlaySoundOnSuccessfulRead:"never"}set whenToPlaySoundforSuccessfulRead(e){this.bPlaySoundOnSuccessfulRead="never"!==e&&e}get whenToVibrateforSuccessfulRead(){return!0===this.bVibrateOnSuccessfulRead?"frame":this.bVibrateOnSuccessfulRead?this.bVibrateOnSuccessfulRead:"never"}set whenToVibrateforSuccessfulRead(e){this.bVibrateOnSuccessfulRead="never"!==e&&e}set region(e){this._region=e,this.singleFrameMode||(this.beingLazyDrawRegionsults=!0,setTimeout(()=>{this.beingLazyDrawRegionsults&&this._drawRegionsults()},500))}get region(){return this._region}static createInstance(e){return h(this,void 0,void 0,(function*(){if(u)throw new Error("`BarcodeScanner` is not supported in Node.js.");let t=new g;t._instanceID=yield g.createInstanceInWorker(!0),("string"==typeof e||e instanceof String)&&(e=JSON.parse(e));for(let i in e)t[i]=e[i];return yield t.setUIElement(this.defaultUIElementURL),t.singleFrameMode&&console.warn("The `navigator.mediaDevices.getUserMedia` is unavailable. automatically change to `singleFrameMode`."),t.singleFrameMode||(yield t.updateRuntimeSettings("single")),document.addEventListener("visibilitychange",t._ev_documentHideEvent),t}))}decode(e){return super.decode(e)}decodeBase64String(e){return super.decodeBase64String(e)}decodeUrl(e){return super.decodeUrl(e)}decodeBuffer(e,t,i,r,n,o){return super.decodeBuffer(e,t,i,r,n,o)}decodeCurrentFrame(e){return h(this,void 0,void 0,(function*(){return this._assertOpen(),this._decode_Video(this._video,e)}))}clearMapDecodeRecord(){return h(this,void 0,void 0,(function*(){return yield new Promise((e,t)=>{let i=c._nextTaskID++;c._taskCallbackMap.set(i,i=>{if(i.success)return e();{let e=new Error(i.message);return e.stack=i.stack+"\n"+e.stack,t(e)}}),c._dbrWorker.postMessage({type:"clearMapDecodeRecord",id:i,instanceID:this._instanceID})})}))}static isRegionSinglePreset(e){return JSON.stringify(e)==JSON.stringify(this.singlePresetRegion)}static isRegionNormalPreset(e){return 0==e.regionLeft&&0==e.regionTop&&0==e.regionRight&&0==e.regionBottom&&0==e.regionMeasuredByPercentage}updateRuntimeSettings(e){return h(this,void 0,void 0,(function*(){let t;if("string"==typeof e||e instanceof String)if("speed"==e){let e=yield this.getRuntimeSettings();yield this.resetRuntimeSettings(),t=yield this.getRuntimeSettings(),t.barcodeFormatIds=e.barcodeFormatIds,t.barcodeFormatIds_2=e.barcodeFormatIds_2,g.isRegionSinglePreset(e.region)||(t.region=e.region)}else if("balance"==e){let e=yield this.getRuntimeSettings();yield this.resetRuntimeSettings(),t=yield this.getRuntimeSettings(),t.barcodeFormatIds=e.barcodeFormatIds,t.barcodeFormatIds_2=e.barcodeFormatIds_2,g.isRegionSinglePreset(e.region)||(t.region=e.region),t.deblurLevel=3,t.expectedBarcodesCount=512,t.localizationModes=[2,16,0,0,0,0,0,0],t.timeout=1e5}else if("coverage"==e){let e=yield this.getRuntimeSettings();yield this.resetRuntimeSettings(),t=yield this.getRuntimeSettings(),t.barcodeFormatIds=e.barcodeFormatIds,t.barcodeFormatIds_2=e.barcodeFormatIds_2,g.isRegionSinglePreset(e.region)||(t.region=e.region),t.deblurLevel=5,t.expectedBarcodesCount=512,t.scaleDownThreshold=1e5,t.localizationModes=[2,16,4,8,0,0,0,0],t.timeout=1e5}else if("single"==e){let e=yield this.getRuntimeSettings();yield this.resetRuntimeSettings(),t=yield this.getRuntimeSettings(),t.barcodeFormatIds=e.barcodeFormatIds,t.barcodeFormatIds_2=e.barcodeFormatIds_2,g.isRegionNormalPreset(e.region)?t.region=JSON.parse(JSON.stringify(g.singlePresetRegion)):t.region=e.region,t.expectedBarcodesCount=1,t.localizationModes=[16,2,0,0,0,0,0,0],t.barcodeZoneMinDistanceToImageBorders=0}else t=JSON.parse(e);else{if("object"!=typeof e)throw TypeError("'UpdateRuntimeSettings(settings)': Type of 'settings' should be 'String' or 'PlainObject'.");if(t=JSON.parse(JSON.stringify(e)),t.region instanceof Array){let i=e.region;[i.regionLeft,i.regionTop,i.regionLeft,i.regionBottom,i.regionMeasuredByPercentage].some(e=>void 0!==e)&&(t.region={regionLeft:i.regionLeft||0,regionTop:i.regionTop||0,regionRight:i.regionRight||0,regionBottom:i.regionBottom||0,regionMeasuredByPercentage:i.regionMeasuredByPercentage||0})}}if(!c._bUseFullFeature){if(0!=(t.barcodeFormatIds&~(s.BF_ONED|s.BF_QR_CODE|s.BF_PDF417|s.BF_DATAMATRIX))||0!=t.barcodeFormatIds_2)throw Error("Some of the specified barcode formats are not supported in the compact version. Please try the full-featured version.");if(0!=t.intermediateResultTypes)throw Error("Intermediate results is not supported in the compact version. Please try the full-featured version.")}{let e=t.region;if(this.bFilterRegionInJs?this.userDefinedRegion=JSON.parse(JSON.stringify(e)):this.userDefinedRegion=null,e instanceof Array)if(e.length){for(let t=0;t{let r=c._nextTaskID++;c._taskCallbackMap.set(r,t=>{if(t.success){try{this._handleRetJsonString(t.updateReturn)}catch(e){i(e)}return e()}{let e=new Error(t.message);return e.stack=t.stack+"\n"+e.stack,i(e)}}),c._dbrWorker.postMessage({type:"updateRuntimeSettings",id:r,instanceID:this._instanceID,body:{settings:JSON.stringify(t)}})}),"single"==e&&(yield this.setModeArgument("BinarizationModes",0,"EnableFillBinaryVacancy","0"),yield this.setModeArgument("LocalizationModes",0,"ScanDirection","2"),yield this.setModeArgument("BinarizationModes",0,"BlockSizeX","71"),yield this.setModeArgument("BinarizationModes",0,"BlockSizeY","71"))}))}_bindUI(){if(!this.UIElement)throw new Error("Need to define `UIElement` before opening.");let e=[this.UIElement],t=this.UIElement.children;for(let i of t)e.push(i);for(let t=0;t','','',''].join(""),this._optGotRsl=this._optGotRsl||this._selRsl.options[0])):!this._optGotRsl&&t.classList.contains("dbrScanner-opt-gotResolution")?this._optGotRsl=t:!this._btnClose&&t.classList.contains("dbrScanner-btn-close")?this._btnClose=t:!this._video&&t.classList.contains("dbrScanner-existingVideo")?(this._video=t,this._video.setAttribute("playsinline","true"),this.singleFrameMode=!1):!i&&t.tagName&&"video"==t.tagName.toLowerCase()&&(i=t);if(!this._video&&i&&(this._video=i),this.singleFrameMode?(this._video&&(this._video.addEventListener("click",this._clickIptSingleFrameMode),this._video.style.cursor="pointer",this._video.setAttribute("title","Take a photo")),this._cvsDrawArea&&(this._cvsDrawArea.addEventListener("click",this._clickIptSingleFrameMode),this._cvsDrawArea.style.cursor="pointer",this._cvsDrawArea.setAttribute("title","Take a photo")),this._divScanArea&&(this._divScanArea.addEventListener("click",this._clickIptSingleFrameMode),this._divScanArea.style.cursor="pointer",this._divScanArea.setAttribute("title","Take a photo")),this._bgCamera&&(this._bgCamera.style.display="")):this._bgLoading&&(this._bgLoading.style.display=""),this._selCam&&this._selCam.addEventListener("change",this._onCameraSelChange),this._selRsl&&this._selRsl.addEventListener("change",this._onResolutionSelChange),this._btnClose&&this._btnClose.addEventListener("click",this._onCloseBtnClick),!this._video)throw this._unbindUI(),Error("Can not find HTMLVideoElement with class `dbrScanner-video`.");this._isOpen=!0}_unbindUI(){this._clearRegionsults(),this.singleFrameMode?(this._video&&(this._video.removeEventListener("click",this._clickIptSingleFrameMode),this._video.style.cursor="",this._video.removeAttribute("title")),this._cvsDrawArea&&(this._cvsDrawArea.removeEventListener("click",this._clickIptSingleFrameMode),this._cvsDrawArea.style.cursor="",this._cvsDrawArea.removeAttribute("title")),this._divScanArea&&(this._divScanArea.removeEventListener("click",this._clickIptSingleFrameMode),this._divScanArea.style.cursor="",this._divScanArea.removeAttribute("title")),this._bgCamera&&(this._bgCamera.style.display="none")):this._bgLoading&&(this._bgLoading.style.display="none"),this._selCam&&this._selCam.removeEventListener("change",this._onCameraSelChange),this._selRsl&&this._selRsl.removeEventListener("change",this._onResolutionSelChange),this._btnClose&&this._btnClose.removeEventListener("click",this._onCloseBtnClick),this._video=null,this._cvsDrawArea=null,this._divScanArea=null,this._divScanLight=null,this._selCam=null,this._selRsl=null,this._optGotRsl=null,this._btnClose=null,this._isOpen=!1}_renderSelCameraInfo(){if(this._selCam&&(this._selCam.innerHTML=""),this._selCam){let e;for(let t of this._allCameras){let i=document.createElement("option");i.value=t.deviceId,i.innerText=t.label,this._selCam.append(i),t.deviceId&&this._currentCamera&&this._currentCamera.deviceId==t.deviceId&&(e=i)}this._selCam.value=e?e.value:""}}getAllCameras(){return h(this,void 0,void 0,(function*(){const e=yield navigator.mediaDevices.enumerateDevices(),t=[],i=[];if(this._allCameras)for(let e of this._allCameras)e._checked&&i.push(e);for(let r=0;r{let i=c._nextTaskID++;c._taskCallbackMap.set(i,i=>{if(i.success){let t=i.results;return t.intervalTime=this.intervalTime,e(t)}{let e=new Error(i.message);return e.stack+="\n"+i.stack,t(e)}}),c._dbrWorker.postMessage({type:"getScanSettings",id:i,instanceID:this._instanceID})})}))}updateScanSettings(e){return h(this,void 0,void 0,(function*(){return this.intervalTime=e.intervalTime,yield new Promise((t,i)=>{let r=c._nextTaskID++;c._taskCallbackMap.set(r,e=>{if(e.success)return t();{let t=new Error(e.message);return t.stack+="\n"+e.stack,i(t)}}),g._dbrWorker.postMessage({type:"updateScanSettings",id:r,instanceID:this._instanceID,body:{settings:e}})})}))}getVideoSettings(){return JSON.parse(JSON.stringify(this.videoSettings))}updateVideoSettings(e){return this.videoSettings=JSON.parse(JSON.stringify(e)),this._lastDeviceId=null,this._isOpen?this.play():Promise.resolve()}isOpen(){return this._isOpen}_show(){this.UIElement.parentNode||(this.UIElement.style.position="fixed",this.UIElement.style.left="0",this.UIElement.style.top="0",document.body.append(this.UIElement)),"none"==this.UIElement.style.display&&(this.UIElement.style.display="")}stop(){this._video&&this._video.srcObject&&(c._onLog&&c._onLog("======stop video========"),this._video.srcObject.getTracks().forEach(e=>{e.stop()}),this._video.srcObject=null,this._videoTrack=null,this._currentCamera=null),this._video&&this._video.classList.contains("dbrScanner-existingVideo")&&(c._onLog&&c._onLog("======stop existing video========"),this._video.pause(),this._video.currentTime=0),this._bgLoading&&(this._bgLoading.style.animationPlayState=""),this._divScanLight&&(this._divScanLight.style.display="none"),this._drawRegionsults(),this.queue_handledFrame.length=0,this.array_decodeFrameTimeCost.length=0,this.array_getFrameTimeCost.length=0,this._intervalGetVideoFrame=0}pause(){this._video&&this._video.pause(),this._divScanLight&&(this._divScanLight.style.display="none")}play(e,t,i){return h(this,void 0,void 0,(function*(){if(this._assertOpen(),this._video&&this.videoSrc){yield new Promise((e,t)=>{this._video.onloadedmetadata=()=>h(this,void 0,void 0,(function*(){this._video.onloadedmetadata=null,yield this._video.play(),e()})),"string"==typeof this.videoSrc||this.videoSrc instanceof String?this._video.src=this.videoSrc:this._video.srcObject=this.videoSrc,setTimeout(()=>t(new Error("Failed to play video. Timeout.")),4e3)});let e={width:this._video.videoWidth,height:this._video.videoHeight};return this.onPlayed&&setTimeout(()=>{this.onPlayed(e)},0),e}if(this.singleFrameMode)return this._clickIptSingleFrameMode(),{width:0,height:0};const r=++this.iPlayRound;return this.promisePlay&&(yield this.promisePlay,rh(this,void 0,void 0,(function*(){var r;try{this._video&&this._video.srcObject&&this.stop(),c._onLog&&c._onLog("======before video========"),yield this.getAllCameras();let n=()=>{if(this.bDestroyed)throw d&&d.getTracks().forEach(e=>{e.stop()}),this._video.srcObject=null,this._videoTrack=null,this._currentCamera=null,new Error("The BarcodeScanner instance has been destroyed.")};const o=JSON.parse(JSON.stringify(this.videoSettings));let s;"boolean"==typeof o.video&&(o.video={}),t&&(o.video.width={ideal:t}),i&&(o.video.height={ideal:i});const a=["rear","back","rück","arrière","trasera","trás","traseira","posteriore","后面","後面","背面","后置","後置","背置","задней","الخلفية","후","arka","achterzijde","หลัง","baksidan","bagside","sau","bak","tylny","takakamera","belakang","אחורית","πίσω","spate","hátsó","zadní","darrere","zadná","задня","stražnja","belakang","बैक"];let d,_=()=>{for(let e of this._allCameras){let t=e.label.toLowerCase();if(t&&a.some(e=>-1!=t.indexOf(e))&&/\b0(\b)?/.test(t)){delete o.video.facingMode,o.video.deviceId={ideal:e.deviceId};break}}o.video.deviceId||-1==["Android","HarmonyOS"].indexOf(c.browserInfo.OS)||(delete o.video.facingMode,o.video.deviceId={ideal:this._allCameras[this._allCameras.length-1].deviceId})};if(e)delete o.video.facingMode,o.video.deviceId={exact:e},this._lastDeviceId=e;else if(o.video.deviceId);else if(this._lastDeviceId)delete o.video.facingMode,o.video.deviceId={exact:this._lastDeviceId};else if(o.video.facingMode){let e=o.video.facingMode;e instanceof Array&&e.length&&(e=e[0]),e=e.exact||e.ideal||e,"environment"===e&&(s=!!o.video.facingMode,_())}c._onLog&&c._onLog("======try getUserMedia========");let l,u=[0,500],g=null,E=null,R=e=>h(this,void 0,void 0,(function*(){for(let t of u){n(),t&&(yield new Promise(e=>setTimeout(e,t))),n();{const t=e.video.deviceId;E=t?t.exact||t.ideal||t:null}try{c._onLog&&c._onLog("ask "+JSON.stringify(e)),d=yield navigator.mediaDevices.getUserMedia(e);break}catch(e){g=e,c._onLog&&c._onLog(e.message||e)}}}));if(yield R(o),!d){if(c._onLog&&c._onLog("======try getUserMedia again========"),l=JSON.parse(JSON.stringify(o)),"object"==typeof l.video){"iPhone"==c.browserInfo.OS?(t>=1280||i>=1280?l.video.width=1280:t>=640||i>=640?l.video.width=640:(t<640||i<640)&&(l.video.width=320),delete l.video.height):s&&!o.video.deviceId?(delete l.video.facingMode,this._allCameras.length&&(l.video.deviceId={ideal:this._allCameras[this._allCameras.length-1].deviceId})):l.video=!0}c._onLog&&c._onLog(l),yield R(l)}if(d||(u=[1e3,2e3],yield R(o)),d||(yield R(l)),!d)throw g;const m=()=>{const e=d.getVideoTracks();let t;e.length&&(t=this._videoTrack=e[0]);let i=void 0;if(this._video&&t){if(t.label)for(let e of this._allCameras)if(t.label==e.label){e._checked=!0,i=e,this._lastDeviceId=e.deviceId;break}if(!i&&E)for(let e of this._allCameras)if(E==e.deviceId){t.label&&(e._checked=!0,e.label=t.label),i=e,this._lastDeviceId=e.deviceId;break}}this._currentCamera=i};if(yield this.getAllCameras(),n(),s){m(),_();let e=o.video.deviceId;e&&(e=e.exact||e.ideal||e);let t=null===(r=this._currentCamera)||void 0===r?void 0:r.deviceId;!e||t&&e==t||(d.getTracks().forEach(e=>{e.stop()}),u=[0,500,1e3,2e3],yield R(o))}n();const f=()=>h(this,void 0,void 0,(function*(){c._onLog&&c._onLog("======play video========"),yield new Promise((e,t)=>{this._video.onloadedmetadata=()=>h(this,void 0,void 0,(function*(){this._video.onloadedmetadata=null,yield this._video.play(),e()})),this._video.srcObject=d,setTimeout(()=>t(new Error("Failed to play video. Timeout.")),4e3)})}));yield f(),c._onLog&&c._onLog("======played video========"),this._bgLoading&&(this._bgLoading.style.animationPlayState="paused");const I="got "+this._video.videoWidth+"x"+this._video.videoHeight;this._optGotRsl&&(this._optGotRsl.setAttribute("data-width",this._video.videoWidth),this._optGotRsl.setAttribute("data-height",this._video.videoHeight),this._optGotRsl.innerText=I,this._selRsl&&this._optGotRsl.parentNode==this._selRsl&&(this._selRsl.value="got")),c._onLog&&c._onLog(I),m(),n(),this._renderSelCameraInfo();let A={width:this._video.videoWidth,height:this._video.videoHeight};return this.onPlayed&&setTimeout(()=>{this.onPlayed(A)},0),this.promisePlay=null,A}catch(e){throw this.promisePlay=null,e}})))(),yield this.promisePlay)}))}pauseScan(){this._assertOpen(),this._bPauseScan=!0,this._divScanLight&&(this._divScanLight.style.display="none")}resumeScan(){this._assertOpen(),this._bPauseScan=!1}getCapabilities(){return this._assertOpen(),this._videoTrack.getCapabilities?this._videoTrack.getCapabilities():{}}getCameraSettings(){return this._assertOpen(),this._videoTrack.getSettings()}getConstraints(){return this._assertOpen(),this._videoTrack.getConstraints()}applyConstraints(e){return h(this,void 0,void 0,(function*(){if(this._assertOpen(),!this._videoTrack.applyConstraints)throw Error("Not supported.");return yield this._videoTrack.applyConstraints(e)}))}turnOnTorch(){return h(this,void 0,void 0,(function*(){if(this._assertOpen(),this.getCapabilities().torch)return yield this._videoTrack.applyConstraints({advanced:[{torch:!0}]});throw Error("Not supported.")}))}turnOffTorch(){return h(this,void 0,void 0,(function*(){if(this._assertOpen(),this.getCapabilities().torch)return yield this._videoTrack.applyConstraints({advanced:[{torch:!1}]});throw Error("Not supported.")}))}setColorTemperature(e){return h(this,void 0,void 0,(function*(){this._assertOpen();let t=this.getCapabilities().colorTemperature;if(!t)throw Error("Not supported.");return et.max&&(e=t.max),yield this._videoTrack.applyConstraints({advanced:[{colorTemperature:e}]})}))}setExposureCompensation(e){return h(this,void 0,void 0,(function*(){this._assertOpen();let t=this.getCapabilities().exposureCompensation;if(!t)throw Error("Not supported.");return et.max&&(e=t.max),yield this._videoTrack.applyConstraints({advanced:[{exposureCompensation:e}]})}))}setZoom(e){return h(this,void 0,void 0,(function*(){this._assertOpen();let t=this.getCapabilities().zoom;if(!t)throw Error("Not supported.");return et.max&&(e=t.max),yield this._videoTrack.applyConstraints({advanced:[{zoom:e}]})}))}setFrameRate(e){return h(this,void 0,void 0,(function*(){this._assertOpen();let t=this.getCapabilities().frameRate;if(!t)throw Error("Not supported.");return et.max&&(e=t.max),yield this._videoTrack.applyConstraints({width:{ideal:Math.max(this._video.videoWidth,this._video.videoHeight)},frameRate:e})}))}_cloneDecodeResults(e){if(e instanceof Array){let t=[];for(let i of e)t.push(this._cloneDecodeResults(i));return t}{let t=e;return JSON.parse(JSON.stringify(t,(e,t)=>"oriVideoCanvas"==e||"searchRegionCanvas"==e?void 0:t))}}_loopReadVideo(){return h(this,void 0,void 0,(function*(){if(this.bDestroyed)return;if(!this._isOpen)return void(yield this.clearMapDecodeRecord());if(this._video.paused||this._bPauseScan)return c._onLog&&c._onLog("Video or scan is paused. Ask in 1s."),yield this.clearMapDecodeRecord(),void setTimeout(()=>{this._loopReadVideo()},this._intervalDetectVideoPause);this._divScanLight&&"none"==this._divScanLight.style.display&&(this._divScanLight.style.display=""),c._onLog&&c._onLog("======= once read ======="),c._onLog&&(this._timeStartDecode=Date.now());let e=this.queue_handledFrame;this._countLoopGetFrame=0,0===e.length?this.loopGetVideoFrame(!0):(this._idGetFrameTimeout&&clearTimeout(this._idGetFrameTimeout),this._idGetFrameTimeout=setTimeout(()=>{this._countLoopGetFrame++,this.loopGetVideoFrame(!0)},this._intervalGetVideoFrame)),this._indexCurrentDecodingFrame=this._indexVideoRegion,this.region&&this.region instanceof Array&&++this._indexVideoRegion>=this.region.length&&(this._indexVideoRegion=0),(()=>h(this,void 0,void 0,(function*(){if(e[0]&&e[0].bUseWebGL){let{u8Gray:t,dWidth:i,dHeight:n}=e.pop();this._bWorkerDecodeBuffer=!0;let o={bUseWebGL:!0};return!this._timeEndGettingFrame||(o._timeEndGettingFrame=this._timeEndGettingFrame),yield this._decodeBuffer_Uint8Array(t,i,n,i,r.IPF_GrayScaled,o)}if(e[0]&&!1===e[0].bUseWebGL){let{data:t,cvs:i,config:n,region:o,sx:s,sy:a,sWidth:d,sHeight:_,dWidth:l,dHeight:h}=e.pop();this._bWorkerDecodeBuffer=!0,n.bUseWebGL=!1,!this._timeEndGettingFrame||(n._timeEndGettingFrame=this._timeEndGettingFrame),(this.bSaveOriCanvas||this.singleFrameMode)&&(this.oriCanvas=i);let u=yield this._decodeBuffer_Uint8Array(t,i.width,i.height,4*i.width,r.IPF_ABGR_8888,n);return c.fixResultLocationWhenFilterRegionInJs(o,u,s,a,d,_,l,h),u}{let e=new Error("queue_handledFrame is empty.");return new Promise(t=>t(e))}})))().then(e=>{c._onLog&&c._onLog(e);Date.now();if(this._bWorkerDecodeBuffer=!1,this._idGetFrameTimeout2&&clearTimeout(this._idGetFrameTimeout2),4===this._getVideoFrameMode){let e=this.array_decodeFrameTimeCost,t=this.array_getFrameTimeCost,i=this._indexCurrentDecodingFrame;if(this.region instanceof Array?(e[i]?e[i].length>=5&&e[i].shift():e[i]=[],e[i].push(this._lastInnerDecodeDuration)):(e.length>=5&&e.shift(),e.push(this._lastInnerDecodeDuration)),this.region instanceof Array){let r=0,n=0;r=i+1>=this.region.length?0:i+1,n=r+1>=this.region.length?0:r+1,e[r]&&e[r].length&&t[n]&&t[n].length?this._intervalGetVideoFrame=Math.min(...e[r])-Math.max(...t[n]):this._intervalGetVideoFrame=0}else t&&t.length?this._intervalGetVideoFrame=Math.min(...e)-Math.max(...t):this._intervalGetVideoFrame=0;this._intervalGetVideoFrame=this._intervalGetVideoFrame>0?this._intervalGetVideoFrame:0}if(this._isOpen&&!this._video.paused&&!this._bPauseScan){if(this.bPlaySoundOnSuccessfulRead&&e.length){let t=!1;if(!0===this.bPlaySoundOnSuccessfulRead||"frame"===this.bPlaySoundOnSuccessfulRead)t=!0;else if("unduplicated"===this.bPlaySoundOnSuccessfulRead)for(let i of e)if(i.bUnduplicated){t=!0;break}t&&(this.soundOnSuccessfullRead.currentTime=0,this.soundOnSuccessfullRead.play().catch(e=>{console.warn("Autoplay not allowed. User interaction required: "+(e.message||e))}))}if(navigator.vibrate&&this.bVibrateOnSuccessfulRead&&e.length){let t=!1;if(!0===this.bVibrateOnSuccessfulRead||"frame"===this.bVibrateOnSuccessfulRead)t=!0;else if("unduplicated"===this.bVibrateOnSuccessfulRead)for(let i of e)if(i.bUnduplicated){t=!0;break}if(t)try{navigator.vibrate(this.vibrateDuration)}catch(e){console.warn("Vibration not allowed. User interaction required: "+(e.message||e))}}if(this.onFrameRead){let t=this._cloneDecodeResults(e);for(let e of t)delete e.bUnduplicated;this.onFrameRead(t)}if(this.onUnduplicatedRead)for(let t of e)t.bUnduplicated&&this.onUnduplicatedRead(t.barcodeText,this._cloneDecodeResults(t));this._drawRegionsults(e)}setTimeout(()=>{this._loopReadVideo()},this.intervalTime)}).catch(e=>{this._bWorkerDecodeBuffer=!1,c._onLog&&c._onLog(e.message||e),setTimeout(()=>{this._loopReadVideo()},Math.max(this.intervalTime,1e3)),"platform error"==e.message||console.warn(e.message)})}))}loopGetVideoFrame(e){if(this.bDestroyed)return;if(!this._isOpen)return void this.clearMapDecodeRecord();if(this._video.paused||this._bPauseScan)return c._onLog&&c._onLog("Video or scan is paused. Ask in 1s."),void this.clearMapDecodeRecord();let t=Date.now();c._onLog&&c._onLog("start getting a frame: "+t);let i=this.queue_handledFrame,r={};if(this.region)if(this.region instanceof Array){let e=this.region[this._indexVideoRegion];e&&(r.region=JSON.parse(JSON.stringify(e)))}else r.region=JSON.parse(JSON.stringify(this.region));if(0===this._getVideoFrameMode){let e=this.handleVideoFrame(this._video,r);e&&(i[0]=e)}else if(1===this._getVideoFrameMode){let t=this.handleVideoFrame(this._video,r);t&&(i[0]=t),this._idGetFrameTimeout&&clearTimeout(this._idGetFrameTimeout),e&&(this._idGetFrameTimeout=setTimeout(()=>{this._bWorkerDecodeBuffer&&this._countLoopGetFrame{this._bWorkerDecodeBuffer&&this.loopGetVideoFrame(!0)},this._intervalGetVideoFrame)}else if(4===this._getVideoFrameMode){let t=this.handleVideoFrame(this._video,r);t&&(i[0]=t),this._idGetFrameTimeout&&clearTimeout(this._idGetFrameTimeout),e&&(this._idGetFrameTimeout=setTimeout(()=>{this._bWorkerDecodeBuffer&&this._countLoopGetFrame{0!=this.queue_handledFrame.length&&(c._onLog&&c._onLog("second timeout is executed: "+Date.now()),this.loopGetVideoFrame(!1))},200);let n=Date.now(),o=n-t;if(4===this._getVideoFrameMode){let e=this.array_getFrameTimeCost;if(this.region instanceof Array){let t=this._indexVideoRegion;e[t]?e[t].length>=5&&e[t].shift():e[t]=[],e[t].push(o)}else e.length>=5&&e.shift(),e.push(o)}this._timeEndGettingFrame=n,c._onLog&&c._onLog("end getting a frame: "+n),c._onLog&&c._onLog("get frame cost: "+o)}_drawRegionsults(e){let t,i,r;if(this.beingLazyDrawRegionsults=!1,this.singleFrameMode){if(!this.oriCanvas)return;t="contain",i=this.oriCanvas.width,r=this.oriCanvas.height}else{if(!this._video)return;t=this._video.style.objectFit||"contain",i=this._video.videoWidth,r=this._video.videoHeight}let n=this.region;if(n&&(!n.regionLeft&&!n.regionRight&&!n.regionTop&&!n.regionBottom&&!n.regionMeasuredByPercentage||n instanceof Array?n=null:n.regionMeasuredByPercentage?n=n.regionLeft||n.regionRight||100!==n.regionTop||100!==n.regionBottom?{regionLeft:Math.round(n.regionLeft/100*i),regionTop:Math.round(n.regionTop/100*r),regionRight:Math.round(n.regionRight/100*i),regionBottom:Math.round(n.regionBottom/100*r)}:null:(n=JSON.parse(JSON.stringify(n)),delete n.regionMeasuredByPercentage)),this._cvsDrawArea){this._cvsDrawArea.style.objectFit=t;let o=this._cvsDrawArea;o.width=i,o.height=r;let s=o.getContext("2d");if(n){s.fillStyle=this.regionMaskFillStyle,s.fillRect(0,0,o.width,o.height),s.globalCompositeOperation="destination-out",s.fillStyle="#000";let e=Math.round(this.regionMaskLineWidth/2);s.fillRect(n.regionLeft-e,n.regionTop-e,n.regionRight-n.regionLeft+2*e,n.regionBottom-n.regionTop+2*e),s.globalCompositeOperation="source-over",s.strokeStyle=this.regionMaskStrokeStyle,s.lineWidth=this.regionMaskLineWidth,s.rect(n.regionLeft,n.regionTop,n.regionRight-n.regionLeft,n.regionBottom-n.regionTop),s.stroke()}if(e){s.globalCompositeOperation="destination-over",s.fillStyle=this.barcodeFillStyle,s.strokeStyle=this.barcodeStrokeStyle,s.lineWidth=this.barcodeLineWidth,e=e||[];for(let t of e){let e=t.localizationResult;s.beginPath(),s.moveTo(e.x1,e.y1),s.lineTo(e.x2,e.y2),s.lineTo(e.x3,e.y3),s.lineTo(e.x4,e.y4),s.fill(),s.beginPath(),s.moveTo(e.x1,e.y1),s.lineTo(e.x2,e.y2),s.lineTo(e.x3,e.y3),s.lineTo(e.x4,e.y4),s.closePath(),s.stroke()}}this.singleFrameMode&&(s.globalCompositeOperation="destination-over",s.drawImage(this.oriCanvas,0,0))}if(this._divScanArea){let e=this._video.offsetWidth,t=this._video.offsetHeight,o=1;e/tsuper.destroy}});return h(this,void 0,void 0,(function*(){document.removeEventListener("visibilitychange",this._ev_documentHideEvent),yield this.close();for(let e of this.styleEls)e.remove();this.styleEls.splice(0,this.styleEls.length),this.bDestroyed||(yield e.destroy.call(this))}))}}var E,R,m,f,I,A,S,D,T,v,p,M,y,C,L,O,b,B,N,F,P,w,U,G,V,k,x;g._defaultUIElementURL="@engineResourcePath/dbr.scanner.html",g.singlePresetRegion=[null,{regionLeft:0,regionTop:30,regionRight:100,regionBottom:70,regionMeasuredByPercentage:1},{regionLeft:25,regionTop:25,regionRight:75,regionBottom:75,regionMeasuredByPercentage:1},{regionLeft:25,regionTop:25,regionRight:75,regionBottom:75,regionMeasuredByPercentage:1}],function(e){e[e.BICM_DARK_ON_LIGHT=1]="BICM_DARK_ON_LIGHT",e[e.BICM_LIGHT_ON_DARK=2]="BICM_LIGHT_ON_DARK",e[e.BICM_DARK_ON_DARK=4]="BICM_DARK_ON_DARK",e[e.BICM_LIGHT_ON_LIGHT=8]="BICM_LIGHT_ON_LIGHT",e[e.BICM_DARK_LIGHT_MIXED=16]="BICM_DARK_LIGHT_MIXED",e[e.BICM_DARK_ON_LIGHT_DARK_SURROUNDING=32]="BICM_DARK_ON_LIGHT_DARK_SURROUNDING",e[e.BICM_SKIP=0]="BICM_SKIP",e[e.BICM_REV=2147483648]="BICM_REV"}(E||(E={})),function(e){e[e.BCM_AUTO=1]="BCM_AUTO",e[e.BCM_GENERAL=2]="BCM_GENERAL",e[e.BCM_SKIP=0]="BCM_SKIP",e[e.BCM_REV=2147483648]="BCM_REV"}(R||(R={})),function(e){e[e.BF2_NULL=0]="BF2_NULL",e[e.BF2_POSTALCODE=32505856]="BF2_POSTALCODE",e[e.BF2_NONSTANDARD_BARCODE=1]="BF2_NONSTANDARD_BARCODE",e[e.BF2_USPSINTELLIGENTMAIL=1048576]="BF2_USPSINTELLIGENTMAIL",e[e.BF2_POSTNET=2097152]="BF2_POSTNET",e[e.BF2_PLANET=4194304]="BF2_PLANET",e[e.BF2_AUSTRALIANPOST=8388608]="BF2_AUSTRALIANPOST",e[e.BF2_RM4SCC=16777216]="BF2_RM4SCC",e[e.BF2_DOTCODE=2]="BF2_DOTCODE"}(m||(m={})),function(e){e[e.BM_AUTO=1]="BM_AUTO",e[e.BM_LOCAL_BLOCK=2]="BM_LOCAL_BLOCK",e[e.BM_SKIP=0]="BM_SKIP",e[e.BM_THRESHOLD=4]="BM_THRESHOLD",e[e.BM_REV=2147483648]="BM_REV"}(f||(f={})),function(e){e[e.ECCM_CONTRAST=1]="ECCM_CONTRAST"}(I||(I={})),function(e){e[e.CFM_GENERAL=1]="CFM_GENERAL"}(A||(A={})),function(e){e[e.CCM_AUTO=1]="CCM_AUTO",e[e.CCM_GENERAL_HSV=2]="CCM_GENERAL_HSV",e[e.CCM_SKIP=0]="CCM_SKIP",e[e.CCM_REV=2147483648]="CCM_REV"}(S||(S={})),function(e){e[e.CICM_GENERAL=1]="CICM_GENERAL",e[e.CICM_SKIP=0]="CICM_SKIP",e[e.CICM_REV=2147483648]="CICM_REV"}(D||(D={})),function(e){e[e.CM_IGNORE=1]="CM_IGNORE",e[e.CM_OVERWRITE=2]="CM_OVERWRITE"}(T||(T={})),function(e){e[e.DM_SKIP=0]="DM_SKIP",e[e.DM_DIRECT_BINARIZATION=1]="DM_DIRECT_BINARIZATION",e[e.DM_THRESHOLD_BINARIZATION=2]="DM_THRESHOLD_BINARIZATION",e[e.DM_GRAY_EQUALIZATION=4]="DM_GRAY_EQUALIZATION",e[e.DM_SMOOTHING=8]="DM_SMOOTHING",e[e.DM_MORPHING=16]="DM_MORPHING",e[e.DM_DEEP_ANALYSIS=32]="DM_DEEP_ANALYSIS",e[e.DM_SHARPENING=64]="DM_SHARPENING",e[e.DM_BASED_ON_LOC_BIN=128]="DM_BASED_ON_LOC_BIN",e[e.DM_SHARPENING_SMOOTHING=256]="DM_SHARPENING_SMOOTHING"}(v||(v={})),function(e){e[e.DRM_AUTO=1]="DRM_AUTO",e[e.DRM_GENERAL=2]="DRM_GENERAL",e[e.DRM_SKIP=0]="DRM_SKIP",e[e.DRM_REV=2147483648]="DRM_REV"}(p||(p={})),function(e){e[e.DPMCRM_AUTO=1]="DPMCRM_AUTO",e[e.DPMCRM_GENERAL=2]="DPMCRM_GENERAL",e[e.DPMCRM_SKIP=0]="DPMCRM_SKIP",e[e.DPMCRM_REV=2147483648]="DPMCRM_REV"}(M||(M={})),function(e){e[e.GTM_INVERTED=1]="GTM_INVERTED",e[e.GTM_ORIGINAL=2]="GTM_ORIGINAL",e[e.GTM_SKIP=0]="GTM_SKIP",e[e.GTM_REV=2147483648]="GTM_REV"}(y||(y={})),function(e){e[e.IPM_AUTO=1]="IPM_AUTO",e[e.IPM_GENERAL=2]="IPM_GENERAL",e[e.IPM_GRAY_EQUALIZE=4]="IPM_GRAY_EQUALIZE",e[e.IPM_GRAY_SMOOTH=8]="IPM_GRAY_SMOOTH",e[e.IPM_SHARPEN_SMOOTH=16]="IPM_SHARPEN_SMOOTH",e[e.IPM_MORPHOLOGY=32]="IPM_MORPHOLOGY",e[e.IPM_SKIP=0]="IPM_SKIP",e[e.IPM_REV=2147483648]="IPM_REV"}(C||(C={})),function(e){e[e.IRSM_MEMORY=1]="IRSM_MEMORY",e[e.IRSM_FILESYSTEM=2]="IRSM_FILESYSTEM",e[e.IRSM_BOTH=4]="IRSM_BOTH"}(L||(L={})),function(e){e[e.IRT_NO_RESULT=0]="IRT_NO_RESULT",e[e.IRT_ORIGINAL_IMAGE=1]="IRT_ORIGINAL_IMAGE",e[e.IRT_COLOUR_CLUSTERED_IMAGE=2]="IRT_COLOUR_CLUSTERED_IMAGE",e[e.IRT_COLOUR_CONVERTED_GRAYSCALE_IMAGE=4]="IRT_COLOUR_CONVERTED_GRAYSCALE_IMAGE",e[e.IRT_TRANSFORMED_GRAYSCALE_IMAGE=8]="IRT_TRANSFORMED_GRAYSCALE_IMAGE",e[e.IRT_PREDETECTED_REGION=16]="IRT_PREDETECTED_REGION",e[e.IRT_PREPROCESSED_IMAGE=32]="IRT_PREPROCESSED_IMAGE",e[e.IRT_BINARIZED_IMAGE=64]="IRT_BINARIZED_IMAGE",e[e.IRT_TEXT_ZONE=128]="IRT_TEXT_ZONE",e[e.IRT_CONTOUR=256]="IRT_CONTOUR",e[e.IRT_LINE_SEGMENT=512]="IRT_LINE_SEGMENT",e[e.IRT_FORM=1024]="IRT_FORM",e[e.IRT_SEGMENTATION_BLOCK=2048]="IRT_SEGMENTATION_BLOCK",e[e.IRT_TYPED_BARCODE_ZONE=4096]="IRT_TYPED_BARCODE_ZONE",e[e.IRT_PREDETECTED_QUADRILATERAL=8192]="IRT_PREDETECTED_QUADRILATERAL"}(O||(O={})),function(e){e[e.LM_SKIP=0]="LM_SKIP",e[e.LM_AUTO=1]="LM_AUTO",e[e.LM_CONNECTED_BLOCKS=2]="LM_CONNECTED_BLOCKS",e[e.LM_LINES=8]="LM_LINES",e[e.LM_STATISTICS=4]="LM_STATISTICS",e[e.LM_SCAN_DIRECTLY=16]="LM_SCAN_DIRECTLY",e[e.LM_STATISTICS_MARKS=32]="LM_STATISTICS_MARKS",e[e.LM_STATISTICS_POSTAL_CODE=64]="LM_STATISTICS_POSTAL_CODE",e[e.LM_CENTRE=128]="LM_CENTRE",e[e.LM_REV=2147483648]="LM_REV"}(b||(b={})),function(e){e[e.PDFRM_RASTER=1]="PDFRM_RASTER",e[e.PDFRM_AUTO=2]="PDFRM_AUTO",e[e.PDFRM_VECTOR=4]="PDFRM_VECTOR",e[e.PDFRM_REV=2147483648]="PDFRM_REV"}(B||(B={})),function(e){e[e.QRECL_ERROR_CORRECTION_H=0]="QRECL_ERROR_CORRECTION_H",e[e.QRECL_ERROR_CORRECTION_L=1]="QRECL_ERROR_CORRECTION_L",e[e.QRECL_ERROR_CORRECTION_M=2]="QRECL_ERROR_CORRECTION_M",e[e.QRECL_ERROR_CORRECTION_Q=3]="QRECL_ERROR_CORRECTION_Q"}(N||(N={})),function(e){e[e.RPM_AUTO=1]="RPM_AUTO",e[e.RPM_GENERAL=2]="RPM_GENERAL",e[e.RPM_GENERAL_RGB_CONTRAST=4]="RPM_GENERAL_RGB_CONTRAST",e[e.RPM_GENERAL_GRAY_CONTRAST=8]="RPM_GENERAL_GRAY_CONTRAST",e[e.RPM_GENERAL_HSV_CONTRAST=16]="RPM_GENERAL_HSV_CONTRAST",e[e.RPM_SKIP=0]="RPM_SKIP",e[e.RPM_REV=2147483648]="RPM_REV"}(F||(F={})),function(e){e[e.RCT_PIXEL=1]="RCT_PIXEL",e[e.RCT_PERCENTAGE=2]="RCT_PERCENTAGE"}(P||(P={})),function(e){e[e.RT_STANDARD_TEXT=0]="RT_STANDARD_TEXT",e[e.RT_RAW_TEXT=1]="RT_RAW_TEXT",e[e.RT_CANDIDATE_TEXT=2]="RT_CANDIDATE_TEXT",e[e.RT_PARTIAL_TEXT=3]="RT_PARTIAL_TEXT"}(w||(w={})),function(e){e[e.SUM_AUTO=1]="SUM_AUTO",e[e.SUM_LINEAR_INTERPOLATION=2]="SUM_LINEAR_INTERPOLATION",e[e.SUM_NEAREST_NEIGHBOUR_INTERPOLATION=4]="SUM_NEAREST_NEIGHBOUR_INTERPOLATION",e[e.SUM_SKIP=0]="SUM_SKIP",e[e.SUM_REV=2147483648]="SUM_REV"}(U||(U={})),function(e){e[e.TP_REGION_PREDETECTED=1]="TP_REGION_PREDETECTED",e[e.TP_IMAGE_PREPROCESSED=2]="TP_IMAGE_PREPROCESSED",e[e.TP_IMAGE_BINARIZED=4]="TP_IMAGE_BINARIZED",e[e.TP_BARCODE_LOCALIZED=8]="TP_BARCODE_LOCALIZED",e[e.TP_BARCODE_TYPE_DETERMINED=16]="TP_BARCODE_TYPE_DETERMINED",e[e.TP_BARCODE_RECOGNIZED=32]="TP_BARCODE_RECOGNIZED"}(G||(G={})),function(e){e[e.TFM_AUTO=1]="TFM_AUTO",e[e.TFM_GENERAL_CONTOUR=2]="TFM_GENERAL_CONTOUR",e[e.TFM_SKIP=0]="TFM_SKIP",e[e.TFM_REV=2147483648]="TFM_REV"}(V||(V={})),function(e){e[e.TROM_CONFIDENCE=1]="TROM_CONFIDENCE",e[e.TROM_POSITION=2]="TROM_POSITION",e[e.TROM_FORMAT=4]="TROM_FORMAT",e[e.TROM_SKIP=0]="TROM_SKIP",e[e.TROM_REV=2147483648]="TROM_REV"}(k||(k={})),function(e){e[e.TDM_AUTO=1]="TDM_AUTO",e[e.TDM_GENERAL_WIDTH_CONCENTRATION=2]="TDM_GENERAL_WIDTH_CONCENTRATION",e[e.TDM_SKIP=0]="TDM_SKIP",e[e.TDM_REV=2147483648]="TDM_REV"}(x||(x={}));class W{static get version(){return c.version}static get productKeys(){return c.productKeys}static set productKeys(e){c.productKeys=e}static get handshakeCode(){return c.handshakeCode}static set handshakeCode(e){c.handshakeCode=e}static get organizationID(){return c.organizationID}static set organizationID(e){c.organizationID=e}static get sessionPassword(){return c.sessionPassword}static set sessionPassword(e){c.sessionPassword=e}static get browserInfo(){return c.browserInfo}static detectEnvironment(){return c.detectEnvironment()}static get _workerName(){return c._workerName}static set _workerName(e){c._workerName=e}static get engineResourcePath(){return c.engineResourcePath}static set engineResourcePath(e){c.engineResourcePath=e}static get licenseServer(){return c.licenseServer}static set licenseServer(e){c.licenseServer=e}static get deviceFriendlyName(){return c.deviceFriendlyName}static set deviceFriendlyName(e){c.deviceFriendlyName=e}static get _onLog(){return c._onLog}static set _onLog(e){c._onLog=e}static get _bWasmDebug(){return c._bWasmDebug}static set _bWasmDebug(e){c._bWasmDebug=e}static get _bUseFullFeature(){return c._bUseFullFeature}static set _bUseFullFeature(e){c._bUseFullFeature=e}static get _dbrWorker(){return c._dbrWorker}static isLoaded(){return c.isLoaded()}static isWasmLoaded(){return c.isLoaded()}static loadWasm(){return c.loadWasm()}}W.BarcodeReader=c,W.BarcodeScanner=g,W.EnumBarcodeColourMode=E,W.EnumBarcodeComplementMode=R,W.EnumBarcodeFormat=s,W.EnumBarcodeFormat_2=m,W.EnumBinarizationMode=f,W.EnumClarityCalculationMethod=I,W.EnumClarityFilterMode=A,W.EnumColourClusteringMode=S,W.EnumColourConversionMode=D,W.EnumConflictMode=T,W.EnumDeblurMode=v,W.EnumDeformationResistingMode=p,W.EnumDPMCodeReadingMode=M,W.EnumErrorCode=n,W.EnumGrayscaleTransformationMode=y,W.EnumImagePixelFormat=r,W.EnumImagePreprocessingMode=C,W.EnumIMResultDataType=o,W.EnumIntermediateResultSavingMode=L,W.EnumIntermediateResultType=O,W.EnumLocalizationMode=b,W.EnumPDFReadingMode=B,W.EnumQRCodeErrorCorrectionLevel=N,W.EnumRegionPredetectionMode=F,W.EnumResultCoordinateType=P,W.EnumResultType=w,W.EnumScaleUpMode=U,W.EnumTerminatePhase=G,W.EnumTextFilterMode=V,W.EnumTextResultOrderMode=k,W.EnumTextureDetectionMode=x;t.default=W}])}));if(typeof dbr!="undefined"){if(dbr.DBR)dbr=dbr.DBR;if(typeof Dynamsoft=="undefined"){Dynamsoft={};}if(typeof Dynamsoft.DBR=="undefined"){Dynamsoft.DBR=dbr;}else{let _dbr = Dynamsoft.DBR;Dynamsoft.DBR=dbr;for(let key in _dbr){Dynamsoft.DBR[key]=Dynamsoft.DBR[key]||_dbr[key];}}} \ No newline at end of file diff --git a/dist/dbr.mjs b/dist/dbr.mjs new file mode 100644 index 00000000..647f6100 --- /dev/null +++ b/dist/dbr.mjs @@ -0,0 +1,11 @@ +/** +* Dynamsoft JavaScript Library +* @product Dynamsoft Barcode Reader JS Edition +* @website http://www.dynamsoft.com +* @preserve Copyright 2021, Dynamsoft Corporation +* @author Dynamsoft +* @version 8.6.0 (js 20210628) +* @fileoverview Dynamsoft JavaScript Library for Barcode Reader +* More info on DBR JS: https://www.dynamsoft.com/Products/barcode-recognition-javascript.aspx +*/ +import worker_threads from "worker_threads";import https from "https";import http from "http";import fs from "fs";import os from "os";import url from "url";!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(worker_threads,https,http,fs,os):"function"==typeof define&&define.amd?define(t):"object"==typeof exports?exports.dbr=t(worker_threads,https,http,fs,os):e.dbr=t(e.worker_threads,e.https,e.http,e.fs,e.os)}(("object"==typeof window?window:global),(function(e,t,i,r,n){return function(e){var t={};function i(r){if(t[r])return t[r].exports;var n=t[r]={i:r,l:!1,exports:{}};return e[r].call(n.exports,n,n.exports,i),n.l=!0,n.exports}return i.m=e,i.c=t,i.d=function(e,t,r){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(i.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)i.d(r,n,function(t){return e[t]}.bind(null,n));return r},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=5)}([function(t,i){t.exports=e},function(e,i){e.exports=t},function(e,t){e.exports=i},function(e,t){e.exports=r},function(e,t){e.exports=n},function(e,t,i){"use strict";var r,n,o,s;i.r(t),i.d(t,"DBR",(function(){return W})),i.d(t,"BarcodeReader",(function(){return c})),i.d(t,"BarcodeScanner",(function(){return g})),i.d(t,"EnumBarcodeColourMode",(function(){return E})),i.d(t,"EnumBarcodeComplementMode",(function(){return R})),i.d(t,"EnumBarcodeFormat",(function(){return s})),i.d(t,"EnumBarcodeFormat_2",(function(){return m})),i.d(t,"EnumBinarizationMode",(function(){return f})),i.d(t,"EnumClarityCalculationMethod",(function(){return I})),i.d(t,"EnumClarityFilterMode",(function(){return A})),i.d(t,"EnumColourClusteringMode",(function(){return S})),i.d(t,"EnumColourConversionMode",(function(){return D})),i.d(t,"EnumConflictMode",(function(){return T})),i.d(t,"EnumDeblurMode",(function(){return v})),i.d(t,"EnumDeformationResistingMode",(function(){return p})),i.d(t,"EnumDPMCodeReadingMode",(function(){return M})),i.d(t,"EnumErrorCode",(function(){return n})),i.d(t,"EnumGrayscaleTransformationMode",(function(){return y})),i.d(t,"EnumImagePixelFormat",(function(){return r})),i.d(t,"EnumImagePreprocessingMode",(function(){return C})),i.d(t,"EnumIMResultDataType",(function(){return o})),i.d(t,"EnumIntermediateResultSavingMode",(function(){return L})),i.d(t,"EnumIntermediateResultType",(function(){return O})),i.d(t,"EnumLocalizationMode",(function(){return b})),i.d(t,"EnumPDFReadingMode",(function(){return B})),i.d(t,"EnumQRCodeErrorCorrectionLevel",(function(){return N})),i.d(t,"EnumRegionPredetectionMode",(function(){return F})),i.d(t,"EnumResultCoordinateType",(function(){return P})),i.d(t,"EnumResultType",(function(){return w})),i.d(t,"EnumScaleUpMode",(function(){return U})),i.d(t,"EnumTerminatePhase",(function(){return G})),i.d(t,"EnumTextFilterMode",(function(){return V})),i.d(t,"EnumTextResultOrderMode",(function(){return k})),i.d(t,"EnumTextureDetectionMode",(function(){return x})),function(e){e[e.IPF_Binary=0]="IPF_Binary",e[e.IPF_BinaryInverted=1]="IPF_BinaryInverted",e[e.IPF_GrayScaled=2]="IPF_GrayScaled",e[e.IPF_NV21=3]="IPF_NV21",e[e.IPF_RGB_565=4]="IPF_RGB_565",e[e.IPF_RGB_555=5]="IPF_RGB_555",e[e.IPF_RGB_888=6]="IPF_RGB_888",e[e.IPF_ARGB_8888=7]="IPF_ARGB_8888",e[e.IPF_RGB_161616=8]="IPF_RGB_161616",e[e.IPF_ARGB_16161616=9]="IPF_ARGB_16161616",e[e.IPF_ABGR_8888=10]="IPF_ABGR_8888",e[e.IPF_ABGR_16161616=11]="IPF_ABGR_16161616",e[e.IPF_BGR_888=12]="IPF_BGR_888"}(r||(r={})),function(e){e[e.DBR_SYSTEM_EXCEPTION=1]="DBR_SYSTEM_EXCEPTION",e[e.DBR_SUCCESS=0]="DBR_SUCCESS",e[e.DBR_UNKNOWN=-1e4]="DBR_UNKNOWN",e[e.DBR_NO_MEMORY=-10001]="DBR_NO_MEMORY",e[e.DBR_NULL_REFERENCE=-10002]="DBR_NULL_REFERENCE",e[e.DBR_LICENSE_INVALID=-10003]="DBR_LICENSE_INVALID",e[e.DBR_LICENSE_EXPIRED=-10004]="DBR_LICENSE_EXPIRED",e[e.DBR_FILE_NOT_FOUND=-10005]="DBR_FILE_NOT_FOUND",e[e.DBR_FILETYPE_NOT_SUPPORTED=-10006]="DBR_FILETYPE_NOT_SUPPORTED",e[e.DBR_BPP_NOT_SUPPORTED=-10007]="DBR_BPP_NOT_SUPPORTED",e[e.DBR_INDEX_INVALID=-10008]="DBR_INDEX_INVALID",e[e.DBR_BARCODE_FORMAT_INVALID=-10009]="DBR_BARCODE_FORMAT_INVALID",e[e.DBR_CUSTOM_REGION_INVALID=-10010]="DBR_CUSTOM_REGION_INVALID",e[e.DBR_MAX_BARCODE_NUMBER_INVALID=-10011]="DBR_MAX_BARCODE_NUMBER_INVALID",e[e.DBR_IMAGE_READ_FAILED=-10012]="DBR_IMAGE_READ_FAILED",e[e.DBR_TIFF_READ_FAILED=-10013]="DBR_TIFF_READ_FAILED",e[e.DBR_QR_LICENSE_INVALID=-10016]="DBR_QR_LICENSE_INVALID",e[e.DBR_1D_LICENSE_INVALID=-10017]="DBR_1D_LICENSE_INVALID",e[e.DBR_DIB_BUFFER_INVALID=-10018]="DBR_DIB_BUFFER_INVALID",e[e.DBR_PDF417_LICENSE_INVALID=-10019]="DBR_PDF417_LICENSE_INVALID",e[e.DBR_DATAMATRIX_LICENSE_INVALID=-10020]="DBR_DATAMATRIX_LICENSE_INVALID",e[e.DBR_PDF_READ_FAILED=-10021]="DBR_PDF_READ_FAILED",e[e.DBR_PDF_DLL_MISSING=-10022]="DBR_PDF_DLL_MISSING",e[e.DBR_PAGE_NUMBER_INVALID=-10023]="DBR_PAGE_NUMBER_INVALID",e[e.DBR_CUSTOM_SIZE_INVALID=-10024]="DBR_CUSTOM_SIZE_INVALID",e[e.DBR_CUSTOM_MODULESIZE_INVALID=-10025]="DBR_CUSTOM_MODULESIZE_INVALID",e[e.DBR_RECOGNITION_TIMEOUT=-10026]="DBR_RECOGNITION_TIMEOUT",e[e.DBR_JSON_PARSE_FAILED=-10030]="DBR_JSON_PARSE_FAILED",e[e.DBR_JSON_TYPE_INVALID=-10031]="DBR_JSON_TYPE_INVALID",e[e.DBR_JSON_KEY_INVALID=-10032]="DBR_JSON_KEY_INVALID",e[e.DBR_JSON_VALUE_INVALID=-10033]="DBR_JSON_VALUE_INVALID",e[e.DBR_JSON_NAME_KEY_MISSING=-10034]="DBR_JSON_NAME_KEY_MISSING",e[e.DBR_JSON_NAME_VALUE_DUPLICATED=-10035]="DBR_JSON_NAME_VALUE_DUPLICATED",e[e.DBR_TEMPLATE_NAME_INVALID=-10036]="DBR_TEMPLATE_NAME_INVALID",e[e.DBR_JSON_NAME_REFERENCE_INVALID=-10037]="DBR_JSON_NAME_REFERENCE_INVALID",e[e.DBR_PARAMETER_VALUE_INVALID=-10038]="DBR_PARAMETER_VALUE_INVALID",e[e.DBR_DOMAIN_NOT_MATCHED=-10039]="DBR_DOMAIN_NOT_MATCHED",e[e.DBR_RESERVEDINFO_NOT_MATCHED=-10040]="DBR_RESERVEDINFO_NOT_MATCHED",e[e.DBR_AZTEC_LICENSE_INVALID=-10041]="DBR_AZTEC_LICENSE_INVALID",e[e.DBR_LICENSE_DLL_MISSING=-10042]="DBR_LICENSE_DLL_MISSING",e[e.DBR_LICENSEKEY_NOT_MATCHED=-10043]="DBR_LICENSEKEY_NOT_MATCHED",e[e.DBR_REQUESTED_FAILED=-10044]="DBR_REQUESTED_FAILED",e[e.DBR_LICENSE_INIT_FAILED=-10045]="DBR_LICENSE_INIT_FAILED",e[e.DBR_PATCHCODE_LICENSE_INVALID=-10046]="DBR_PATCHCODE_LICENSE_INVALID",e[e.DBR_POSTALCODE_LICENSE_INVALID=-10047]="DBR_POSTALCODE_LICENSE_INVALID",e[e.DBR_DPM_LICENSE_INVALID=-10048]="DBR_DPM_LICENSE_INVALID",e[e.DBR_FRAME_DECODING_THREAD_EXISTS=-10049]="DBR_FRAME_DECODING_THREAD_EXISTS",e[e.DBR_STOP_DECODING_THREAD_FAILED=-10050]="DBR_STOP_DECODING_THREAD_FAILED",e[e.DBR_SET_MODE_ARGUMENT_ERROR=-10051]="DBR_SET_MODE_ARGUMENT_ERROR",e[e.DBR_LICENSE_CONTENT_INVALID=-10052]="DBR_LICENSE_CONTENT_INVALID",e[e.DBR_LICENSE_KEY_INVALID=-10053]="DBR_LICENSE_KEY_INVALID",e[e.DBR_LICENSE_DEVICE_RUNS_OUT=-10054]="DBR_LICENSE_DEVICE_RUNS_OUT",e[e.DBR_GET_MODE_ARGUMENT_ERROR=-10055]="DBR_GET_MODE_ARGUMENT_ERROR",e[e.DBR_IRT_LICENSE_INVALID=-10056]="DBR_IRT_LICENSE_INVALID",e[e.DBR_MAXICODE_LICENSE_INVALID=-10057]="DBR_MAXICODE_LICENSE_INVALID",e[e.DBR_GS1_DATABAR_LICENSE_INVALID=-10058]="DBR_GS1_DATABAR_LICENSE_INVALID",e[e.DBR_GS1_COMPOSITE_LICENSE_INVALID=-10059]="DBR_GS1_COMPOSITE_LICENSE_INVALID",e[e.DBR_DOTCODE_LICENSE_INVALID=-10061]="DBR_DOTCODE_LICENSE_INVALID",e[e.DMERR_NO_LICENSE=-2e4]="DMERR_NO_LICENSE",e[e.DMERR_LICENSE_SYNC_FAILED=-20003]="DMERR_LICENSE_SYNC_FAILED",e[e.DMERR_TRIAL_LICENSE=-20010]="DMERR_TRIAL_LICENSE",e[e.DMERR_FAILED_TO_REACH_LTS=-20200]="DMERR_FAILED_TO_REACH_LTS"}(n||(n={})),function(e){e[e.IMRDT_IMAGE=1]="IMRDT_IMAGE",e[e.IMRDT_CONTOUR=2]="IMRDT_CONTOUR",e[e.IMRDT_LINESEGMENT=4]="IMRDT_LINESEGMENT",e[e.IMRDT_LOCALIZATIONRESULT=8]="IMRDT_LOCALIZATIONRESULT",e[e.IMRDT_REGIONOFINTEREST=16]="IMRDT_REGIONOFINTEREST",e[e.IMRDT_QUADRILATERAL=32]="IMRDT_QUADRILATERAL"}(o||(o={})),function(e){e[e.BF_ALL=-31457281]="BF_ALL",e[e.BF_ONED=1050623]="BF_ONED",e[e.BF_GS1_DATABAR=260096]="BF_GS1_DATABAR",e[e.BF_CODE_39=1]="BF_CODE_39",e[e.BF_CODE_128=2]="BF_CODE_128",e[e.BF_CODE_93=4]="BF_CODE_93",e[e.BF_CODABAR=8]="BF_CODABAR",e[e.BF_ITF=16]="BF_ITF",e[e.BF_EAN_13=32]="BF_EAN_13",e[e.BF_EAN_8=64]="BF_EAN_8",e[e.BF_UPC_A=128]="BF_UPC_A",e[e.BF_UPC_E=256]="BF_UPC_E",e[e.BF_INDUSTRIAL_25=512]="BF_INDUSTRIAL_25",e[e.BF_CODE_39_EXTENDED=1024]="BF_CODE_39_EXTENDED",e[e.BF_GS1_DATABAR_OMNIDIRECTIONAL=2048]="BF_GS1_DATABAR_OMNIDIRECTIONAL",e[e.BF_GS1_DATABAR_TRUNCATED=4096]="BF_GS1_DATABAR_TRUNCATED",e[e.BF_GS1_DATABAR_STACKED=8192]="BF_GS1_DATABAR_STACKED",e[e.BF_GS1_DATABAR_STACKED_OMNIDIRECTIONAL=16384]="BF_GS1_DATABAR_STACKED_OMNIDIRECTIONAL",e[e.BF_GS1_DATABAR_EXPANDED=32768]="BF_GS1_DATABAR_EXPANDED",e[e.BF_GS1_DATABAR_EXPANDED_STACKED=65536]="BF_GS1_DATABAR_EXPANDED_STACKED",e[e.BF_GS1_DATABAR_LIMITED=131072]="BF_GS1_DATABAR_LIMITED",e[e.BF_PATCHCODE=262144]="BF_PATCHCODE",e[e.BF_PDF417=33554432]="BF_PDF417",e[e.BF_QR_CODE=67108864]="BF_QR_CODE",e[e.BF_DATAMATRIX=134217728]="BF_DATAMATRIX",e[e.BF_AZTEC=268435456]="BF_AZTEC",e[e.BF_MAXICODE=536870912]="BF_MAXICODE",e[e.BF_MICRO_QR=1073741824]="BF_MICRO_QR",e[e.BF_MICRO_PDF417=524288]="BF_MICRO_PDF417",e[e.BF_GS1_COMPOSITE=-2147483648]="BF_GS1_COMPOSITE",e[e.BF_MSI_CODE=1048576]="BF_MSI_CODE",e[e.BF_NULL=0]="BF_NULL"}(s||(s={}));var a=function(e,t,i,r){return new(i||(i=Promise))((function(n,o){function s(e){try{d(r.next(e))}catch(e){o(e)}}function a(e){try{d(r.throw(e))}catch(e){o(e)}}function d(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(s,a)}d((r=r.apply(e,t||[])).next())}))};const d=!0,_=!d&&"undefined"==typeof self,l=d?global:_?{}:self;class c{constructor(){this._canvasMaxWH="iPhone"==c.browserInfo.OS||"Android"==c.browserInfo.OS?2048:4096,this._instanceID=void 0,this.bSaveOriCanvas=!1,this.oriCanvas=null,this._1dMinConfidence=30,this.maxVideoCvsLength=3,this.videoCvses=[],this.videoGlCvs=null,this.videoGl=null,this.glImgData=null,this.bFilterRegionInJs=!0,this._region=null,this._timeStartDecode=null,this._timeEnterInnerDBR=null,this._timeGetMessage=null,this._bUseWebgl=!0,this.decodeRecords={},this.bDestroyed=!1,this._setWarnnedEx=new Set,this._lastErrorCode=0,this._lastErrorString="",this._lastInnerDecodeDuration=0}static get version(){return this._version}static get productKeys(){return this._productKeys}static set productKeys(e){if("unload"!=this._loadWasmStatus)throw new Error("`productKeys` is not allowed to change after loadWasm is called.");c._productKeys=e}static get handshakeCode(){return this._productKeys}static set handshakeCode(e){if("unload"!=this._loadWasmStatus)throw new Error("`handshakeCode` is not allowed to change after loadWasm is called.");c._productKeys=e}static get organizationID(){return this._organizationID}static set organizationID(e){if("unload"!=this._loadWasmStatus)throw new Error("`organizationID` is not allowed to change after loadWasm is called.");"number"==typeof e&&(e=e.toString()),c._organizationID=e}static set sessionPassword(e){if("unload"!=this._loadWasmStatus)throw new Error("`sessionPassword` is not allowed to change after loadWasm is called.");c._sessionPassword=e}static get sessionPassword(){return this._sessionPassword}static detectEnvironment(){return a(this,void 0,void 0,(function*(){let e={wasm:"undefined"!=typeof WebAssembly&&("undefined"==typeof navigator||!(/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&/\(.+\s11_2_([2-6]).*\)/.test(navigator.userAgent))),worker:!!(d?process.version>="v12":"undefined"!=typeof Worker),getUserMedia:!("undefined"==typeof navigator||!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia),camera:!1,browser:this.browserInfo.browser,version:this.browserInfo.version,OS:this.browserInfo.OS};if(e.getUserMedia)try{(yield navigator.mediaDevices.getUserMedia({video:!0})).getTracks().forEach(e=>{e.stop()}),e.camera=!0}catch(e){}return e}))}static get engineResourcePath(){return this._engineResourcePath}static set engineResourcePath(e){if("unload"!=this._loadWasmStatus)throw new Error("`engineResourcePath` is not allowed to change after loadWasm is called.");if(null==e&&(e="./"),d||_)c._engineResourcePath=e;else{let t=document.createElement("a");t.href=e,c._engineResourcePath=t.href}this._engineResourcePath.endsWith("/")||(c._engineResourcePath+="/")}static get licenseServer(){return this._licenseServer}static set licenseServer(e){if("unload"!=this._loadWasmStatus)throw new Error("`licenseServer` is not allowed to change after loadWasm is called.");if(null==e)c._licenseServer=[];else{e instanceof Array||(e=[e]);for(let t=0;t= v12.");let e,t=this.productKeys,r=(0==t.length||t.startsWith("P")||t.startsWith("L"))&&0==this.organizationID.length,o=r||t.length>=8&&!t.startsWith("t")&&!t.startsWith("f")&&!t.startsWith("P")&&!t.startsWith("L")||0==t.length&&0!=this.organizationID.length;if(o&&(d?process.version<"v15"&&(e="To use handshake requires nodejs version >= v15."):(l.crypto||(e="Please upgrade your browser to support handshake code."),l.crypto.subtle||(e="Require https to use handshake code in this browser."))),e){if(!r)throw new Error(e);r=!1,o=!1,console.warn(e),this._lastErrorCode=n.DMERR_FAILED_TO_REACH_LTS,this._lastErrorString=e}return r&&(t="",console.warn("Automatically apply for a public trial license.")),yield new Promise((e,n)=>a(this,void 0,void 0,(function*(){switch(this._loadWasmStatus){case"unload":{c._loadWasmStatus="loading";let e=this.engineResourcePath+this._workerName;if(d||this.engineResourcePath.startsWith(location.origin)||(e=yield fetch(e).then(e=>e.blob()).then(e=>URL.createObjectURL(e))),d){const t=i(0);c._dbrWorker=new t.Worker(e)}else c._dbrWorker=new Worker(e);this._dbrWorker.onerror=e=>{c._loadWasmStatus="loadFail";let t=new Error(e.message);this._loadWasmErr=t;for(let e of this._loadWasmCallbackArr)e(t);this._loadWasmCallbackArr=[]},this._dbrWorker.onmessage=e=>a(this,void 0,void 0,(function*(){let t=e.data?e.data:e;switch(t.type){case"log":this._onLog&&this._onLog(t.message);break;case"load":{t.message&&(t.message=t.message.replace("(https://www.dynamsoft.com/purchase-center/)","(https://www.dynamsoft.com/store/dynamsoft-barcode-reader/#javascript)"));let e=!1;if(r&&(e=!0),t.success){c._loadWasmStatus="loadSuccess",c._version=t.version+"(JS "+this._jsVersion+"."+this._jsEditVersion+")",this._onLog&&this._onLog("load dbr worker success");for(let e of this._loadWasmCallbackArr)e();this._loadWasmCallbackArr=[],this._dbrWorker.onerror=null,t.message&&console.warn(t.message)}else{let i=new Error(t.message);i.stack=t.stack+"\n"+i.stack,c._loadWasmStatus="loadFail",this._loadWasmErr=i;for(let e of this._loadWasmCallbackArr)e(i);this._loadWasmCallbackArr=[],e||111==t.ltsErrorCode&&-1!=t.message.toLowerCase().indexOf("trial license")&&(e=!0)}e&&this.showDialog(t.success?"warn":"error",t.message);break}case"task":{let e=t.id,i=t.body;try{this._taskCallbackMap.get(e)(i),this._taskCallbackMap.delete(e)}catch(t){throw this._taskCallbackMap.delete(e),t}break}default:this._onLog&&this._onLog(e)}})),d&&this._dbrWorker.on("message",this._dbrWorker.onmessage),this._dbrWorker.postMessage({type:"loadWasm",bd:this._bWasmDebug,engineResourcePath:this.engineResourcePath,version:this._jsVersion,brtk:o,bptk:r,pk:t,og:this.organizationID,dm:!d&&location.origin.startsWith("http")?location.origin:"https://localhost",bUseFullFeature:this._bUseFullFeature,browserInfo:this.browserInfo,deviceFriendlyName:this.deviceFriendlyName,ls:this.licenseServer,sp:this._sessionPassword,lm:this._limitModules,cw:this._chargeWay})}case"loading":this._loadWasmCallbackArr.push(t=>{t?n(t):e()});break;case"loadSuccess":e();break;case"loadFail":n(this._loadWasmErr)}})))}))}static showDialog(e,t){return a(this,void 0,void 0,(function*(){if(!d&&!this._bNeverShowDialog)try{let i=yield fetch(c.engineResourcePath+"dls.license.dialog.html");if(!i.ok)throw Error("Get license dialog fail. Network Error: "+i.statusText);let r=yield i.text();if(!r.trim().startsWith("<"))throw Error("Get license dialog fail. Can't get valid HTMLElement.");let n=document.createElement("div");n.innerHTML=r;let o=[];for(let e=0;e{if(i==e.target){s.remove();for(let e of o)e.remove()}});else if(!d&&i.classList.contains("dls-license-icon-close"))d=i,i.addEventListener("click",()=>{s.remove();for(let e of o)e.remove()});else if(!_&&i.classList.contains("dls-license-icon-error"))_=i,"error"!=e&&i.remove();else if(!l&&i.classList.contains("dls-license-icon-warn"))l=i,"warn"!=e&&i.remove();else if(!h&&i.classList.contains("dls-license-msg-content")){h=i;let e=t;for(;e;){let t=e.indexOf("["),r=e.indexOf("]",t),n=e.indexOf("(",r),o=e.indexOf(")",n);if(-1==t||-1==r||-1==n||-1==o){i.appendChild(new Text(e));break}t>0&&i.appendChild(new Text(e.substring(0,t)));let s=document.createElement("a"),a=e.substring(t+1,r);s.innerText=a;let d=e.substring(n+1,o);s.setAttribute("href",d),s.setAttribute("target","_blank"),i.appendChild(s),e=e.substring(o+1)}}document.body.appendChild(s)}catch(e){c._onLog&&c._onLog(e.message||e)}}))}static createInstanceInWorker(e=!1){return a(this,void 0,void 0,(function*(){return yield this.loadWasm(),yield new Promise((t,i)=>{let r=c._nextTaskID++;this._taskCallbackMap.set(r,e=>{if(e.success)return t(e.instanceID);{let t=new Error(e.message);return t.stack=e.stack+"\n"+t.stack,i(t)}}),this._dbrWorker.postMessage({type:"createInstance",id:r,productKeys:"",bScanner:e})})}))}static createInstance(){return a(this,void 0,void 0,(function*(){let e=new c;return e._instanceID=yield this.createInstanceInWorker(),e}))}decode(e){return a(this,void 0,void 0,(function*(){if(c._onLog&&c._onLog("decode(source: any)"),c._onLog&&(this._timeStartDecode=Date.now()),d)return e instanceof Buffer?yield this._decodeFileInMemory_Uint8Array(new Uint8Array(e)):e instanceof Uint8Array?yield this._decodeFileInMemory_Uint8Array(e):"string"==typeof e||e instanceof String?"data:image/"==e.substring(0,11)?yield this._decode_Base64(e):"http"==e.substring(0,4)?yield this._decode_Url(e):yield this._decode_FilePath(e):yield Promise.reject(TypeError("'_decode(source, config)': Type of 'source' should be 'Buffer', 'Uint8Array', 'String(base64 with image mime)' or 'String(url)'."));{let t={};return!this.region||this.region instanceof Array||(t.region=JSON.parse(JSON.stringify(this.region))),e instanceof Blob?yield this._decode_Blob(e,t):e instanceof ArrayBuffer?yield this._decode_ArrayBuffer(e,t):e instanceof Uint8Array||e instanceof Uint8ClampedArray?yield this._decode_Uint8Array(e,t):e instanceof HTMLImageElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap?yield this._decode_Image(e,t):e instanceof HTMLCanvasElement||"undefined"!=typeof OffscreenCanvas&&e instanceof OffscreenCanvas?yield this._decode_Canvas(e,t):e instanceof HTMLVideoElement?yield this._decode_Video(e,t):"string"==typeof e||e instanceof String?"data:image/"==e.substring(0,11)?yield this._decode_Base64(e,t):yield this._decode_Url(e,t):yield Promise.reject(TypeError("'_decode(source, config)': Type of 'source' should be 'Blob', 'ArrayBuffer', 'Uint8Array', 'HTMLImageElement', 'HTMLCanvasElement', 'HTMLVideoElement', 'String(base64 with image mime)' or 'String(url)'."))}}))}decodeBase64String(e){return a(this,void 0,void 0,(function*(){let t={};return!this.region||this.region instanceof Array||(t.region=JSON.parse(JSON.stringify(this.region))),this._decode_Base64(e,t)}))}decodeUrl(e){return a(this,void 0,void 0,(function*(){let t={};return!this.region||this.region instanceof Array||(t.region=JSON.parse(JSON.stringify(this.region))),this._decode_Url(e,t)}))}_decodeBuffer_Uint8Array(e,t,i,r,n,o){return a(this,void 0,void 0,(function*(){return yield new Promise((a,d)=>{let _=c._nextTaskID++;c._taskCallbackMap.set(_,e=>{if(e.success){let t,i=c._onLog?Date.now():0;c._onLog&&c._onLog("worker return result: "+i),this._lastInnerDecodeDuration=e.duration;try{t=this._handleRetJsonString(e.decodeReturn);for(let e=0;e{let r=new FileReader;r.readAsArrayBuffer(e),r.onload=()=>{t(r.result)},r.onerror=()=>{i(r.error)}}).then(e=>this._decodeBuffer_Uint8Array(new Uint8Array(e),t,i,r,n,o))}))}decodeBuffer(e,t,i,r,n,o){return a(this,void 0,void 0,(function*(){let s;return c._onLog&&c._onLog("decodeBuffer(buffer,width,height,stride,format)"),c._onLog&&(this._timeStartDecode=Date.now()),d?e instanceof Uint8Array?s=yield this._decodeBuffer_Uint8Array(e,t,i,r,n,o):e instanceof Buffer&&(s=yield this._decodeBuffer_Uint8Array(new Uint8Array(e),t,i,r,n,o)):e instanceof Uint8Array||e instanceof Uint8ClampedArray?s=yield this._decodeBuffer_Uint8Array(e,t,i,r,n,o):e instanceof ArrayBuffer?s=yield this._decodeBuffer_Uint8Array(new Uint8Array(e),t,i,r,n,o):e instanceof Blob&&(s=yield this._decodeBuffer_Blob(e,t,i,r,n,o)),s}))}_decodeFileInMemory_Uint8Array(e){return a(this,void 0,void 0,(function*(){return yield new Promise((t,i)=>{let r=c._nextTaskID++;c._taskCallbackMap.set(r,e=>{if(e.success){let r;this._lastInnerDecodeDuration=e.duration;try{r=this._handleRetJsonString(e.decodeReturn)}catch(e){return i(e)}return t(r)}{let t=new Error(e.message);return t.stack=e.stack+"\n"+t.stack,i(t)}}),c._dbrWorker.postMessage({type:"decodeFileInMemory",id:r,instanceID:this._instanceID,body:{bytes:e}})})}))}getRuntimeSettings(){return a(this,void 0,void 0,(function*(){return yield new Promise((e,t)=>{let i=c._nextTaskID++;c._taskCallbackMap.set(i,i=>{if(i.success){let t=JSON.parse(i.results);return null!=this.userDefinedRegion&&(t.region=JSON.parse(JSON.stringify(this.userDefinedRegion))),e(t)}{let e=new Error(i.message);return e.stack=i.stack+"\n"+e.stack,t(e)}}),c._dbrWorker.postMessage({type:"getRuntimeSettings",id:i,instanceID:this._instanceID})})}))}updateRuntimeSettings(e){return a(this,void 0,void 0,(function*(){let t;if("string"==typeof e||e instanceof String)if("speed"==e){let e=yield this.getRuntimeSettings();yield this.resetRuntimeSettings(),t=yield this.getRuntimeSettings(),t.barcodeFormatIds=e.barcodeFormatIds,t.barcodeFormatIds_2=e.barcodeFormatIds_2,t.region=e.region,t.deblurLevel=3,t.expectedBarcodesCount=0,t.localizationModes=[2,0,0,0,0,0,0,0]}else if("balance"==e){let e=yield this.getRuntimeSettings();yield this.resetRuntimeSettings(),t=yield this.getRuntimeSettings(),t.barcodeFormatIds=e.barcodeFormatIds,t.barcodeFormatIds_2=e.barcodeFormatIds_2,t.region=e.region,t.deblurLevel=5,t.expectedBarcodesCount=512,t.localizationModes=[2,16,0,0,0,0,0,0]}else if("coverage"==e){let e=yield this.getRuntimeSettings();yield this.resetRuntimeSettings(),t=yield this.getRuntimeSettings(),t.barcodeFormatIds=e.barcodeFormatIds,t.barcodeFormatIds_2=e.barcodeFormatIds_2,t.region=e.region}else t=JSON.parse(e);else{if("object"!=typeof e)throw TypeError("'UpdateRuntimeSettings(settings)': Type of 'settings' should be 'String' or 'PlainObject'.");if(t=JSON.parse(JSON.stringify(e)),t.region instanceof Array){let e=t.region;[e.regionLeft,e.regionTop,e.regionLeft,e.regionBottom,e.regionMeasuredByPercentage].some(e=>void 0!==e)&&(t.region={regionLeft:e.regionLeft||0,regionTop:e.regionTop||0,regionRight:e.regionRight||0,regionBottom:e.regionBottom||0,regionMeasuredByPercentage:e.regionMeasuredByPercentage||0})}}if(!c._bUseFullFeature){if(0!=(t.barcodeFormatIds&~(s.BF_ONED|s.BF_QR_CODE|s.BF_PDF417|s.BF_DATAMATRIX))||0!=t.barcodeFormatIds_2)throw Error("Some of the specified barcode formats are not supported in the compact version. Please try the full-featured version.");if(0!=t.intermediateResultTypes)throw Error("Intermediate results is not supported in the compact version. Please try the full-featured version.")}if(!d)if(this.bFilterRegionInJs){let e=t.region;if(e instanceof Array)throw Error("The `region` of type `Array` is only allowed in `BarcodeScanner`.");this.userDefinedRegion=JSON.parse(JSON.stringify(e)),(e.regionLeft||e.regionTop||e.regionRight||e.regionBottom||e.regionMeasuredByPercentage)&&(e.regionLeft||e.regionTop||100!=e.regionRight||100!=e.regionBottom||!e.regionMeasuredByPercentage)?this.region=e:this.region=null,t.region={regionLeft:0,regionTop:0,regionRight:0,regionBottom:0,regionMeasuredByPercentage:0}}else this.userDefinedRegion=null,this.region=null;return yield new Promise((e,i)=>{let r=c._nextTaskID++;c._taskCallbackMap.set(r,t=>{if(t.success){try{this._handleRetJsonString(t.updateReturn)}catch(e){i(e)}return e()}{let e=new Error(t.message);return e.stack=t.stack+"\n"+e.stack,i(e)}}),c._dbrWorker.postMessage({type:"updateRuntimeSettings",id:r,instanceID:this._instanceID,body:{settings:JSON.stringify(t)}})})}))}resetRuntimeSettings(){return a(this,void 0,void 0,(function*(){return this.userDefinedRegion=null,this.region=null,yield new Promise((e,t)=>{let i=c._nextTaskID++;c._taskCallbackMap.set(i,i=>{if(i.success)return e();{let e=new Error(i.message);return e.stack=i.stack+"\n"+e.stack,t(e)}}),c._dbrWorker.postMessage({type:"resetRuntimeSettings",id:i,instanceID:this._instanceID})})}))}outputSettingsToString(){return a(this,void 0,void 0,(function*(){if(!c._bUseFullFeature)throw Error("outputSettingsToString() is not supported in the compact version. Please try the full-featured version.");return yield new Promise((e,t)=>{let i=c._nextTaskID++;c._taskCallbackMap.set(i,i=>{if(i.success)return e(i.results);{let e=new Error(i.message);return e.stack=i.stack+"\n"+e.stack,t(e)}}),c._dbrWorker.postMessage({type:"outputSettingsToString",id:i,instanceID:this._instanceID})})}))}initRuntimeSettingsWithString(e){return a(this,void 0,void 0,(function*(){if(!c._bUseFullFeature)throw Error("initRuntimeSettingsWithString() is not supported in the compact version. Please try the full-featured version.");if("string"==typeof e||e instanceof String)e=e;else{if("object"!=typeof e)throw TypeError("'initRuntimeSettingstWithString(settings)': Type of 'settings' should be 'String' or 'PlainObject'.");e=JSON.stringify(e)}return yield new Promise((t,i)=>{let r=c._nextTaskID++;c._taskCallbackMap.set(r,e=>{if(e.success){try{this._handleRetJsonString(e.initReturn)}catch(e){i(e)}return t()}{let t=new Error(e.message);return t.stack=e.stack+"\n"+t.stack,i(t)}}),c._dbrWorker.postMessage({type:"initRuntimeSettingsWithString",id:r,instanceID:this._instanceID,body:{settings:e}})})}))}_decode_Blob(e,t){return a(this,void 0,void 0,(function*(){c._onLog&&c._onLog("_decode_Blob(blob: Blob)");let i=null,r=null;if("undefined"!=typeof createImageBitmap)try{i=yield createImageBitmap(e)}catch(e){}i||(r=yield function(e){return new Promise((t,i)=>{let r=URL.createObjectURL(e),n=new Image;n.dbrObjUrl=r,n.src=r,n.onload=()=>{t(n)},n.onerror=e=>{i(new Error("Can't convert blob to image : "+(e instanceof Event?e.type:e)))}})}(e));let n=yield this._decode_Image(i||r,t);return i&&i.close(),n}))}_decode_ArrayBuffer(e,t){return a(this,void 0,void 0,(function*(){return yield this._decode_Blob(new Blob([e]),t)}))}_decode_Uint8Array(e,t){return a(this,void 0,void 0,(function*(){return yield this._decode_Blob(new Blob([e]),t)}))}_decode_Image(e,t){return a(this,void 0,void 0,(function*(){c._onLog&&c._onLog("_decode_Image(image: HTMLImageElement|ImageBitmap)"),t=t||{};let i,r,n=e instanceof HTMLImageElement?e.naturalWidth:e.width,o=e instanceof HTMLImageElement?e.naturalHeight:e.height,s=Math.max(n,o);if(s>this._canvasMaxWH){let e=this._canvasMaxWH/s;i=Math.round(n*e),r=Math.round(o*e)}else i=n,r=o;let a,d=0,_=0,h=n,u=o,g=i,E=r,R=t.region;if(R){let e,t,s,a;R.regionMeasuredByPercentage?(e=R.regionLeft*i/100,t=R.regionTop*r/100,s=R.regionRight*i/100,a=R.regionBottom*r/100):(e=R.regionLeft,t=R.regionTop,s=R.regionRight,a=R.regionBottom),g=s-e,h=Math.round(g/i*n),E=a-t,u=Math.round(E/r*o),d=Math.round(e/i*n),_=Math.round(t/r*o)}!this.bSaveOriCanvas&&l.OffscreenCanvas?a=new OffscreenCanvas(g,E):(a=document.createElement("canvas"),a.width=g,a.height=E);let m,f=a.getContext("2d");0==d&&0==_&&n==h&&o==u&&n==g&&o==E?f.drawImage(e,0,0):f.drawImage(e,d,_,h,u,0,0,g,E),e.dbrObjUrl&&URL.revokeObjectURL(e.dbrObjUrl),R?(m=JSON.parse(JSON.stringify(t)),delete m.region):m=t;let I=yield this._decode_Canvas(a,m);return c.fixResultLocationWhenFilterRegionInJs(R,I,d,_,h,u,g,E),I}))}_decode_Canvas(e,t){return a(this,void 0,void 0,(function*(){if(c._onLog&&c._onLog("_decode_Canvas(canvas:HTMLCanvasElement)"),e.crossOrigin&&"anonymous"!=e.crossOrigin)throw"cors";(this.bSaveOriCanvas||this.singleFrameMode)&&(this.oriCanvas=e);let i=(e.dbrCtx2d||e.getContext("2d")).getImageData(0,0,e.width,e.height).data;return yield this._decodeBuffer_Uint8Array(i,e.width,e.height,4*e.width,r.IPF_ABGR_8888,t)}))}handleVideoFrame(e,t){if(c._onLog&&c._onLog("handleVideoFrame(video)"),!(e instanceof HTMLVideoElement))throw TypeError("'handleVideoFrame(video [, config] )': Type of 'video' should be 'HTMLVideoElement'.");if(e.crossOrigin&&"anonymous"!=e.crossOrigin)throw"cors";t=t||{};const i=e.videoWidth,r=e.videoHeight,n=Math.max(i,r);let o,s;if(n>this._canvasMaxWH){let e=this._canvasMaxWH/n;o=Math.round(i*e),s=Math.round(r*e)}else o=i,s=r;let a=0,d=0,_=i,h=r,u=i,g=r,E=t.region;if(E){let e,t,n,l;E.regionMeasuredByPercentage?(e=E.regionLeft*o/100,t=E.regionTop*s/100,n=E.regionRight*o/100,l=E.regionBottom*s/100):(e=E.regionLeft,t=E.regionTop,n=E.regionRight,l=E.regionBottom),u=n-e,_=Math.round(u/o*i),g=l-t,h=Math.round(g/s*r),a=Math.round(e/o*i),d=Math.round(t/s*r)}let R=0==a&&0==d&&i==_&&r==h&&i==u&&r==g;if(!this.bSaveOriCanvas&&this._bUseWebgl&&R){this.videoGlCvs||(this.videoGlCvs=l.OffscreenCanvas?new OffscreenCanvas(u,g):document.createElement("canvas"));const t=this.videoGlCvs;t.width==u&&t.height==g||(t.height=g,t.width=u,this.videoGl&&this.videoGl.viewport(0,0,u,g));const i=this.videoGl||t.getContext("webgl",{alpha:!1,antialias:!1,depth:!1,stencil:!1,preserveDrawingBuffer:!0})||t.getContext("experimental-webgl",{alpha:!1,antialias:!1,depth:!1,stencil:!1,preserveDrawingBuffer:!0});if(!this.videoGl){this.videoGl=i;const e=i.createShader(i.VERTEX_SHADER);i.shaderSource(e,"\nattribute vec4 a_position;\nattribute vec2 a_uv;\n\nvarying vec2 v_uv;\n\nvoid main() {\n gl_Position = a_position;\n v_uv = a_uv;\n}\n"),i.compileShader(e),i.getShaderParameter(e,i.COMPILE_STATUS)||console.error("An error occurred compiling the shaders: "+i.getShaderInfoLog(e));const t=i.createShader(i.FRAGMENT_SHADER);i.shaderSource(t,"\nprecision lowp float;\n\nvarying vec2 v_uv;\n\nuniform sampler2D u_texture;\n\nvoid main() {\n vec4 sample = texture2D(u_texture, v_uv);\n float grey = 0.299 * sample.r + 0.587 * sample.g + 0.114 * sample.b;\n gl_FragColor = vec4(grey, 0.0, 0.0, 1.0);\n}\n"),i.compileShader(t),i.getShaderParameter(t,i.COMPILE_STATUS)||console.error("An error occurred compiling the shaders: "+i.getShaderInfoLog(t));const r=i.createProgram();i.attachShader(r,e),i.attachShader(r,t),i.linkProgram(r),i.getProgramParameter(r,i.LINK_STATUS)||console.error("Unable to initialize the shader program: "+i.getProgramInfoLog(r)),i.useProgram(r),i.bindBuffer(i.ARRAY_BUFFER,i.createBuffer()),i.bufferData(i.ARRAY_BUFFER,new Float32Array([-1,1,0,1,1,1,1,1,-1,-1,0,0,1,-1,1,0]),i.STATIC_DRAW);const n=i.getAttribLocation(r,"a_position");i.enableVertexAttribArray(n),i.vertexAttribPointer(n,2,i.FLOAT,!1,16,0);const o=i.getAttribLocation(r,"a_uv");i.enableVertexAttribArray(o),i.vertexAttribPointer(o,2,i.FLOAT,!1,16,8),i.activeTexture(i.TEXTURE0),i.bindTexture(i.TEXTURE_2D,i.createTexture()),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.NEAREST),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.NEAREST),i.uniform1i(i.getUniformLocation(r,"u_texture"),0)}(!this.glImgData||this.glImgData.length=this.maxVideoCvsLength&&(this.videoCvses=this.videoCvses.slice(1)),this.videoCvses.push(i))}const r=i.dbrCtx2d;let n;R?r.drawImage(e,0,0):r.drawImage(e,a,d,_,h,0,0,u,g),E?(n=JSON.parse(JSON.stringify(t)),delete n.region):n=t;let o=i.dbrCtx2d||i.getContext("2d");return 0===i.width||0===i.height?null:{bUseWebGL:!1,data:o.getImageData(0,0,i.width,i.height).data,cvs:i,config:n,region:E,sx:a,sy:d,sWidth:_,sHeight:h,dWidth:u,dHeight:g}}}_decode_Video(e,t){return a(this,void 0,void 0,(function*(){if(c._onLog&&c._onLog("_decode_Video(video)"),!(e instanceof HTMLVideoElement))throw TypeError("'_decode_Video(video [, config] )': Type of 'video' should be 'HTMLVideoElement'.");if(e.crossOrigin&&"anonymous"!=e.crossOrigin)throw"cors";let i=this.handleVideoFrame(e,t);if(i&&i.bUseWebGL){let{u8Gray:e,dWidth:t,dHeight:n}=i;return yield this._decodeBuffer_Uint8Array(e,t,n,t,r.IPF_GrayScaled)}if(i&&!1===i.bUseWebGL){let{data:e,cvs:t,config:n,region:o,sx:s,sy:a,sWidth:d,sHeight:_,dWidth:l,dHeight:h}=i;(this.bSaveOriCanvas||this.singleFrameMode)&&(this.oriCanvas=t);let u=yield this._decodeBuffer_Uint8Array(e,t.width,t.height,4*t.width,r.IPF_ABGR_8888,n);return c.fixResultLocationWhenFilterRegionInJs(o,u,s,a,d,_,l,h),u}}))}_decode_Base64(e,t){return a(this,void 0,void 0,(function*(){if(c._onLog&&c._onLog("_decode_Base64(base64Str)"),!("string"==typeof e||e instanceof String))return Promise.reject("'_decode_Base64(base64Str, config)': Type of 'base64Str' should be 'String'.");if("data:image/"==e.substring(0,11)&&(e=e.substring(e.indexOf(",")+1)),d){let t=Buffer.from(e,"base64");return yield this._decodeFileInMemory_Uint8Array(new Uint8Array(t))}{let i=atob(e),r=i.length,n=new Uint8Array(r);for(;r--;)n[r]=i.charCodeAt(r);return yield this._decode_Blob(new Blob([n]),t)}}))}_decode_Url(e,t){return a(this,void 0,void 0,(function*(){if(c._onLog&&c._onLog("_decode_Url(url)"),!("string"==typeof e||e instanceof String))throw TypeError("'_decode_Url(url, config)': Type of 'url' should be 'String'.");if(e=e,d){let t=yield new Promise((t,r)=>{(e.startsWith("https")?i(1):i(2)).get(e,e=>{if(200==e.statusCode){let i=[];e.on("data",e=>{i.push(e)}).on("end",()=>{t(new Uint8Array(Buffer.concat(i)))})}else r("http get fail, statusCode: "+e.statusCode)})});return yield this._decodeFileInMemory_Uint8Array(t)}{let i=yield new Promise((t,i)=>{let r=new XMLHttpRequest;r.open("GET",e,!0),r.responseType="blob",r.send(),r.onloadend=()=>a(this,void 0,void 0,(function*(){t(r.response)})),r.onerror=()=>{i(new Error("Network Error: "+r.statusText))}});return yield this._decode_Blob(i,t)}}))}_decode_FilePath(e,t){return a(this,void 0,void 0,(function*(){if(c._onLog&&c._onLog("_decode_FilePath(path)"),!d)throw Error("'_decode_FilePath(path, config)': The method is only supported in node environment.");if(!("string"==typeof e||e instanceof String))throw TypeError("'_decode_FilePath(path, config)': Type of 'path' should be 'String'.");const t=i(3);let r=yield new Promise((i,r)=>{t.readFile(e,(e,t)=>{e?r(e):i(new Uint8Array(t))})});return yield this._decodeFileInMemory_Uint8Array(r)}))}static fixResultLocationWhenFilterRegionInJs(e,t,i,r,n,o,s,a){if(e&&t.length>0)for(let e of t){let t=e.localizationResult;2==t.resultCoordinateType&&(t.x1*=.01*s,t.x2*=.01*s,t.x3*=.01*s,t.x4*=.01*s,t.y1*=.01*a,t.y2*=.01*a,t.y3*=.01*a,t.y4*=.01*a);let d=s/n,_=a/o;t.x1=t.x1/d+i,t.x2=t.x2/d+i,t.x3=t.x3/d+i,t.x4=t.x4/d+i,t.y1=t.y1/_+r,t.y2=t.y2/_+r,t.y3=t.y3/_+r,t.y4=t.y4/_+r,2==t.resultCoordinateType&&(t.x1*=100/n,t.x2*=100/n,t.x3*=100/n,t.x4*=100/n,t.y1*=100/o,t.y2*=100/o,t.y3*=100/o,t.y4*=100/o)}}static BarcodeReaderException(e,t){let i,r=n.DBR_UNKNOWN;return"number"==typeof e?(r=e,i=new Error(t)):i=new Error(e),i.code=r,i}_handleRetJsonString(e){let t=n;if(e.textResults){for(let t=0;t{let i=t.indexOf(":");e[t.substring(0,i)]=t.substring(i+1)}),i.exception=e}}return e.decodeRecords?this.decodeRecords=e.decodeRecords:this.decodeRecords={},this._lastErrorCode=e.exception,this._lastErrorString=e.description,e.textResults}if(e.exception==t.DBR_SUCCESS)return e.data;throw c.BarcodeReaderException(e.exception,e.description)}setModeArgument(e,t,i,r){return a(this,void 0,void 0,(function*(){return yield new Promise((n,o)=>{let s=c._nextTaskID++;c._taskCallbackMap.set(s,e=>{if(e.success){try{this._handleRetJsonString(e.setReturn)}catch(e){return o(e)}return n()}{let t=new Error(e.message);return t.stack=e.stack+"\n"+t.stack,o(t)}}),c._dbrWorker.postMessage({type:"setModeArgument",id:s,instanceID:this._instanceID,body:{modeName:e,index:t,argumentName:i,argumentValue:r}})})}))}getModeArgument(e,t,i){return a(this,void 0,void 0,(function*(){return yield new Promise((r,n)=>{let o=c._nextTaskID++;c._taskCallbackMap.set(o,e=>{if(e.success){let t;try{t=this._handleRetJsonString(e.getReturn)}catch(e){return n(e)}return r(t)}{let t=new Error(e.message);return t.stack=e.stack+"\n"+t.stack,n(t)}}),c._dbrWorker.postMessage({type:"getModeArgument",id:o,instanceID:this._instanceID,body:{modeName:e,index:t,argumentName:i}})})}))}getIntermediateResults(){return a(this,void 0,void 0,(function*(){return yield new Promise((e,t)=>{let i=c._nextTaskID++;c._taskCallbackMap.set(i,i=>{if(i.success)return e(i.results);{let e=new Error(i.message);return e.stack=i.stack+"\n"+e.stack,t(e)}}),c._dbrWorker.postMessage({type:"getIntermediateResults",id:i,instanceID:this._instanceID})})}))}getIntermediateCanvas(){return a(this,void 0,void 0,(function*(){let e=yield this.getIntermediateResults(),t=[];for(let i of e)if(i.dataType==o.IMRDT_IMAGE)for(let e of i.results){const i=e.bytes;let n;switch(c._onLog&&c._onLog(" "+i.length+" "+i.byteLength+" "+e.width+" "+e.height+" "+e.stride+" "+e.format),e.format){case r.IPF_ABGR_8888:n=new Uint8ClampedArray(i);break;case r.IPF_RGB_888:{const e=i.length/3;n=new Uint8ClampedArray(4*e);for(let t=0;t{let i=c._nextTaskID++;c._taskCallbackMap.set(i,i=>{if(i.success)return e();{let e=new Error(i.message);return e.stack=i.stack+"\n"+e.stack,t(e)}}),c._dbrWorker.postMessage({type:"destroy",id:i,instanceID:this._instanceID})})}}c._jsVersion="8.6.0",c._jsEditVersion="20210628",c._version="loading...(JS "+c._jsVersion+"."+c._jsEditVersion+")",c._productKeys=d||_||!document.currentScript?"":document.currentScript.getAttribute("data-productKeys")||document.currentScript.getAttribute("data-licenseKey")||document.currentScript.getAttribute("data-handshakeCode")||"",c._organizationID=d||_||!document.currentScript?"":document.currentScript.getAttribute("data-organizationID")||"",c._sessionPassword=d||_||!document.currentScript?"":document.currentScript.getAttribute("data-sessionPassword")||"",c.browserInfo=function(){if(!d&&!_){var e={init:function(){this.browser=this.searchString(this.dataBrowser)||"unknownBrowser",this.version=this.searchVersion(navigator.userAgent)||this.searchVersion(navigator.appVersion)||"unknownVersion",this.OS=this.searchString(this.dataOS)||"unknownOS","Linux"==this.OS&&-1!=navigator.userAgent.indexOf("Windows NT")&&(this.OS="HarmonyOS")},searchString:function(e){for(var t=0;t{if(d)return url.fileURLToPath(import.meta.url.substring(0,import.meta.url.lastIndexOf("/")))+"/";if(!_&&document.currentScript){let e=document.currentScript.src,t=e.indexOf("?");if(-1!=t)e=e.substring(0,t);else{let t=e.indexOf("#");-1!=t&&(e=e.substring(0,t))}return e.substring(0,e.lastIndexOf("/")+1)}return"./"})(),c._licenseServer=[],c._deviceFriendlyName="",c._isShowRelDecodeTimeInResults=!1,c._bWasmDebug=!1,c._bNeverShowDialog=!1,c.__bUseFullFeature=!0,c._nextTaskID=0,c._taskCallbackMap=new Map,c._loadWasmStatus="unload",c._loadWasmCallbackArr=[],c._lastErrorCode=0,c._lastErrorString="",c._loadWasmErr=null;var h=function(e,t,i,r){return new(i||(i=Promise))((function(n,o){function s(e){try{d(r.next(e))}catch(e){o(e)}}function a(e){try{d(r.throw(e))}catch(e){o(e)}}function d(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(s,a)}d((r=r.apply(e,t||[])).next())}))};const u=!!("object"==typeof global&&global.process&&global.process.release&&global.process.release.name&&"undefined"==typeof HTMLCanvasElement);class g extends c{constructor(){super(),this.styleEls=[],this.videoSettings={video:{width:{ideal:1280},height:{ideal:720},facingMode:{ideal:"environment"}}},this._singleFrameMode=!(navigator&&navigator.mediaDevices&&navigator.mediaDevices.getUserMedia),this._singleFrameModeIpt=(()=>{let e=document.createElement("input");return e.setAttribute("type","file"),e.setAttribute("accept","image/*"),e.setAttribute("capture",""),e.addEventListener("change",()=>h(this,void 0,void 0,(function*(){let t=e.files[0];e.value="";let i=yield this.decode(t);for(let e of i)delete e.bUnduplicated;if(this._drawRegionsults(i),this.onFrameRead&&this._isOpen&&!this._bPauseScan&&this.onFrameRead(i),this.onUnduplicatedRead&&this._isOpen&&!this._bPauseScan)for(let e of i)this.onUnduplicatedRead(e.barcodeText,e);yield this.clearMapDecodeRecord()}))),e})(),this._clickIptSingleFrameMode=()=>{this._singleFrameModeIpt.click()},this.intervalTime=0,this._isOpen=!1,this._bWorkerDecodeBuffer=!1,this._intervalGetVideoFrame=0,this._getVideoFrameMode=4,this.loopGetFrameTimes=1,this._countLoopGetFrame=0,this.queue_handledFrame=[],this.array_getFrameTimeCost=[],this.array_decodeFrameTimeCost=[],this._indexCurrentDecodingFrame=0,this._timeEndGettingFrame=null,this._bPauseScan=!1,this._lastDeviceId=void 0,this._intervalDetectVideoPause=1e3,this._vc_bPlayingVideoBeforeHide=!1,this._ev_documentHideEvent=()=>{"visible"===document.visibilityState?this._vc_bPlayingVideoBeforeHide&&("Firefox"==c.browserInfo.browser?this.play():this._video.play(),this._vc_bPlayingVideoBeforeHide=!1):this._video&&!this._video.paused&&(this._vc_bPlayingVideoBeforeHide=!0,this._video.pause())},this._video=null,this._cvsDrawArea=null,this._divScanArea=null,this._divScanLight=null,this._bgLoading=null,this._bgCamera=null,this._selCam=null,this._selRsl=null,this._optGotRsl=null,this._btnClose=null,this._soundOnSuccessfullRead=new Audio("data:audio/mpeg;base64,SUQzBAAAAAAAI1RTU0UAAAAPAAADTGF2ZjU4LjI5LjEwMAAAAAAAAAAAAAAA/+M4wAAAAAAAAAAAAEluZm8AAAAPAAAABQAAAkAAgICAgICAgICAgICAgICAgICAgKCgoKCgoKCgoKCgoKCgoKCgoKCgwMDAwMDAwMDAwMDAwMDAwMDAwMDg4ODg4ODg4ODg4ODg4ODg4ODg4P//////////////////////////AAAAAExhdmM1OC41NAAAAAAAAAAAAAAAACQEUQAAAAAAAAJAk0uXRQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/+MYxAANQAbGeUEQAAHZYZ3fASqD4P5TKBgocg+Bw/8+CAYBA4XB9/4EBAEP4nB9+UOf/6gfUCAIKyjgQ/Kf//wfswAAAwQA/+MYxAYOqrbdkZGQAMA7DJLCsQxNOij///////////+tv///3RWiZGBEhsf/FO/+LoCSFs1dFVS/g8f/4Mhv0nhqAieHleLy/+MYxAYOOrbMAY2gABf/////////////////usPJ66R0wI4boY9/8jQYg//g2SPx1M0N3Z0kVJLIs///Uw4aMyvHJJYmPBYG/+MYxAgPMALBucAQAoGgaBoFQVBUFQWDv6gZBUFQVBUGgaBr5YSgqCoKhIGg7+IQVBUFQVBoGga//SsFSoKnf/iVTEFNRTMu/+MYxAYAAANIAAAAADEwMFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV"),this.bPlaySoundOnSuccessfulRead=!1,this.bVibrateOnSuccessfulRead=!1,this.vibrateDuration=300,this._allCameras=[],this._currentCamera=null,this._videoTrack=null,this.regionMaskFillStyle="rgba(0,0,0,0.5)",this.regionMaskStrokeStyle="rgb(254,142,20)",this.regionMaskLineWidth=2,this.barcodeFillStyle="rgba(254,180,32,0.3)",this.barcodeStrokeStyle="rgba(254,180,32,0.9)",this.barcodeLineWidth=1,this.beingLazyDrawRegionsults=!1,this._indexVideoRegion=0,this._onCameraSelChange=()=>{this.play(this._selCam.value).then(()=>{this._isOpen||this.stop()})},this._onResolutionSelChange=()=>{let e,t;if(this._selRsl&&-1!=this._selRsl.selectedIndex){let i=this._selRsl.options[this._selRsl.selectedIndex];e=i.getAttribute("data-width"),t=i.getAttribute("data-height")}this.play(void 0,e,t).then(()=>{this._isOpen||this.stop()})},this._onCloseBtnClick=()=>{this.hide()},this.iPlayRound=0,this.promisePlay=null}static get defaultUIElementURL(){var e;return null===(e=this._defaultUIElementURL)||void 0===e?void 0:e.replace("@engineResourcePath/",c.engineResourcePath)}static set defaultUIElementURL(e){this._defaultUIElementURL=e}getUIElement(){return this.UIElement}setUIElement(e){return h(this,void 0,void 0,(function*(){if("string"==typeof e||e instanceof String){if(!e.trim().startsWith("<")){let t=yield fetch(e);if(!t.ok)throw Error("setUIElement(elementOrUrl): Network Error: "+t.statusText);e=yield t.text()}if(!e.trim().startsWith("<"))throw Error("setUIElement(elementOrUrl): Can't get valid HTMLElement.");let t=document.createElement("div");t.innerHTML=e;for(let e=0;e{h(this,void 0,void 0,(function*(){let e=yield this.getScanSettings();e.oneDTrustFrameCount=1,yield this.updateScanSettings(e)}))})()}_assertOpen(){if(!this._isOpen)throw Error("The scanner is not open.")}get soundOnSuccessfullRead(){return this._soundOnSuccessfullRead}set soundOnSuccessfullRead(e){e instanceof HTMLAudioElement?this._soundOnSuccessfullRead=e:this._soundOnSuccessfullRead=new Audio(e)}get whenToPlaySoundforSuccessfulRead(){return!0===this.bPlaySoundOnSuccessfulRead?"frame":this.bPlaySoundOnSuccessfulRead?this.bPlaySoundOnSuccessfulRead:"never"}set whenToPlaySoundforSuccessfulRead(e){this.bPlaySoundOnSuccessfulRead="never"!==e&&e}get whenToVibrateforSuccessfulRead(){return!0===this.bVibrateOnSuccessfulRead?"frame":this.bVibrateOnSuccessfulRead?this.bVibrateOnSuccessfulRead:"never"}set whenToVibrateforSuccessfulRead(e){this.bVibrateOnSuccessfulRead="never"!==e&&e}set region(e){this._region=e,this.singleFrameMode||(this.beingLazyDrawRegionsults=!0,setTimeout(()=>{this.beingLazyDrawRegionsults&&this._drawRegionsults()},500))}get region(){return this._region}static createInstance(e){return h(this,void 0,void 0,(function*(){if(u)throw new Error("`BarcodeScanner` is not supported in Node.js.");let t=new g;t._instanceID=yield g.createInstanceInWorker(!0),("string"==typeof e||e instanceof String)&&(e=JSON.parse(e));for(let i in e)t[i]=e[i];return yield t.setUIElement(this.defaultUIElementURL),t.singleFrameMode&&console.warn("The `navigator.mediaDevices.getUserMedia` is unavailable. automatically change to `singleFrameMode`."),t.singleFrameMode||(yield t.updateRuntimeSettings("single")),document.addEventListener("visibilitychange",t._ev_documentHideEvent),t}))}decode(e){return super.decode(e)}decodeBase64String(e){return super.decodeBase64String(e)}decodeUrl(e){return super.decodeUrl(e)}decodeBuffer(e,t,i,r,n,o){return super.decodeBuffer(e,t,i,r,n,o)}decodeCurrentFrame(e){return h(this,void 0,void 0,(function*(){return this._assertOpen(),this._decode_Video(this._video,e)}))}clearMapDecodeRecord(){return h(this,void 0,void 0,(function*(){return yield new Promise((e,t)=>{let i=c._nextTaskID++;c._taskCallbackMap.set(i,i=>{if(i.success)return e();{let e=new Error(i.message);return e.stack=i.stack+"\n"+e.stack,t(e)}}),c._dbrWorker.postMessage({type:"clearMapDecodeRecord",id:i,instanceID:this._instanceID})})}))}static isRegionSinglePreset(e){return JSON.stringify(e)==JSON.stringify(this.singlePresetRegion)}static isRegionNormalPreset(e){return 0==e.regionLeft&&0==e.regionTop&&0==e.regionRight&&0==e.regionBottom&&0==e.regionMeasuredByPercentage}updateRuntimeSettings(e){return h(this,void 0,void 0,(function*(){let t;if("string"==typeof e||e instanceof String)if("speed"==e){let e=yield this.getRuntimeSettings();yield this.resetRuntimeSettings(),t=yield this.getRuntimeSettings(),t.barcodeFormatIds=e.barcodeFormatIds,t.barcodeFormatIds_2=e.barcodeFormatIds_2,g.isRegionSinglePreset(e.region)||(t.region=e.region)}else if("balance"==e){let e=yield this.getRuntimeSettings();yield this.resetRuntimeSettings(),t=yield this.getRuntimeSettings(),t.barcodeFormatIds=e.barcodeFormatIds,t.barcodeFormatIds_2=e.barcodeFormatIds_2,g.isRegionSinglePreset(e.region)||(t.region=e.region),t.deblurLevel=3,t.expectedBarcodesCount=512,t.localizationModes=[2,16,0,0,0,0,0,0],t.timeout=1e5}else if("coverage"==e){let e=yield this.getRuntimeSettings();yield this.resetRuntimeSettings(),t=yield this.getRuntimeSettings(),t.barcodeFormatIds=e.barcodeFormatIds,t.barcodeFormatIds_2=e.barcodeFormatIds_2,g.isRegionSinglePreset(e.region)||(t.region=e.region),t.deblurLevel=5,t.expectedBarcodesCount=512,t.scaleDownThreshold=1e5,t.localizationModes=[2,16,4,8,0,0,0,0],t.timeout=1e5}else if("single"==e){let e=yield this.getRuntimeSettings();yield this.resetRuntimeSettings(),t=yield this.getRuntimeSettings(),t.barcodeFormatIds=e.barcodeFormatIds,t.barcodeFormatIds_2=e.barcodeFormatIds_2,g.isRegionNormalPreset(e.region)?t.region=JSON.parse(JSON.stringify(g.singlePresetRegion)):t.region=e.region,t.expectedBarcodesCount=1,t.localizationModes=[16,2,0,0,0,0,0,0],t.barcodeZoneMinDistanceToImageBorders=0}else t=JSON.parse(e);else{if("object"!=typeof e)throw TypeError("'UpdateRuntimeSettings(settings)': Type of 'settings' should be 'String' or 'PlainObject'.");if(t=JSON.parse(JSON.stringify(e)),t.region instanceof Array){let i=e.region;[i.regionLeft,i.regionTop,i.regionLeft,i.regionBottom,i.regionMeasuredByPercentage].some(e=>void 0!==e)&&(t.region={regionLeft:i.regionLeft||0,regionTop:i.regionTop||0,regionRight:i.regionRight||0,regionBottom:i.regionBottom||0,regionMeasuredByPercentage:i.regionMeasuredByPercentage||0})}}if(!c._bUseFullFeature){if(0!=(t.barcodeFormatIds&~(s.BF_ONED|s.BF_QR_CODE|s.BF_PDF417|s.BF_DATAMATRIX))||0!=t.barcodeFormatIds_2)throw Error("Some of the specified barcode formats are not supported in the compact version. Please try the full-featured version.");if(0!=t.intermediateResultTypes)throw Error("Intermediate results is not supported in the compact version. Please try the full-featured version.")}{let e=t.region;if(this.bFilterRegionInJs?this.userDefinedRegion=JSON.parse(JSON.stringify(e)):this.userDefinedRegion=null,e instanceof Array)if(e.length){for(let t=0;t{let r=c._nextTaskID++;c._taskCallbackMap.set(r,t=>{if(t.success){try{this._handleRetJsonString(t.updateReturn)}catch(e){i(e)}return e()}{let e=new Error(t.message);return e.stack=t.stack+"\n"+e.stack,i(e)}}),c._dbrWorker.postMessage({type:"updateRuntimeSettings",id:r,instanceID:this._instanceID,body:{settings:JSON.stringify(t)}})}),"single"==e&&(yield this.setModeArgument("BinarizationModes",0,"EnableFillBinaryVacancy","0"),yield this.setModeArgument("LocalizationModes",0,"ScanDirection","2"),yield this.setModeArgument("BinarizationModes",0,"BlockSizeX","71"),yield this.setModeArgument("BinarizationModes",0,"BlockSizeY","71"))}))}_bindUI(){if(!this.UIElement)throw new Error("Need to define `UIElement` before opening.");let e=[this.UIElement],t=this.UIElement.children;for(let i of t)e.push(i);for(let t=0;t','','',''].join(""),this._optGotRsl=this._optGotRsl||this._selRsl.options[0])):!this._optGotRsl&&t.classList.contains("dbrScanner-opt-gotResolution")?this._optGotRsl=t:!this._btnClose&&t.classList.contains("dbrScanner-btn-close")?this._btnClose=t:!this._video&&t.classList.contains("dbrScanner-existingVideo")?(this._video=t,this._video.setAttribute("playsinline","true"),this.singleFrameMode=!1):!i&&t.tagName&&"video"==t.tagName.toLowerCase()&&(i=t);if(!this._video&&i&&(this._video=i),this.singleFrameMode?(this._video&&(this._video.addEventListener("click",this._clickIptSingleFrameMode),this._video.style.cursor="pointer",this._video.setAttribute("title","Take a photo")),this._cvsDrawArea&&(this._cvsDrawArea.addEventListener("click",this._clickIptSingleFrameMode),this._cvsDrawArea.style.cursor="pointer",this._cvsDrawArea.setAttribute("title","Take a photo")),this._divScanArea&&(this._divScanArea.addEventListener("click",this._clickIptSingleFrameMode),this._divScanArea.style.cursor="pointer",this._divScanArea.setAttribute("title","Take a photo")),this._bgCamera&&(this._bgCamera.style.display="")):this._bgLoading&&(this._bgLoading.style.display=""),this._selCam&&this._selCam.addEventListener("change",this._onCameraSelChange),this._selRsl&&this._selRsl.addEventListener("change",this._onResolutionSelChange),this._btnClose&&this._btnClose.addEventListener("click",this._onCloseBtnClick),!this._video)throw this._unbindUI(),Error("Can not find HTMLVideoElement with class `dbrScanner-video`.");this._isOpen=!0}_unbindUI(){this._clearRegionsults(),this.singleFrameMode?(this._video&&(this._video.removeEventListener("click",this._clickIptSingleFrameMode),this._video.style.cursor="",this._video.removeAttribute("title")),this._cvsDrawArea&&(this._cvsDrawArea.removeEventListener("click",this._clickIptSingleFrameMode),this._cvsDrawArea.style.cursor="",this._cvsDrawArea.removeAttribute("title")),this._divScanArea&&(this._divScanArea.removeEventListener("click",this._clickIptSingleFrameMode),this._divScanArea.style.cursor="",this._divScanArea.removeAttribute("title")),this._bgCamera&&(this._bgCamera.style.display="none")):this._bgLoading&&(this._bgLoading.style.display="none"),this._selCam&&this._selCam.removeEventListener("change",this._onCameraSelChange),this._selRsl&&this._selRsl.removeEventListener("change",this._onResolutionSelChange),this._btnClose&&this._btnClose.removeEventListener("click",this._onCloseBtnClick),this._video=null,this._cvsDrawArea=null,this._divScanArea=null,this._divScanLight=null,this._selCam=null,this._selRsl=null,this._optGotRsl=null,this._btnClose=null,this._isOpen=!1}_renderSelCameraInfo(){if(this._selCam&&(this._selCam.innerHTML=""),this._selCam){let e;for(let t of this._allCameras){let i=document.createElement("option");i.value=t.deviceId,i.innerText=t.label,this._selCam.append(i),t.deviceId&&this._currentCamera&&this._currentCamera.deviceId==t.deviceId&&(e=i)}this._selCam.value=e?e.value:""}}getAllCameras(){return h(this,void 0,void 0,(function*(){const e=yield navigator.mediaDevices.enumerateDevices(),t=[],i=[];if(this._allCameras)for(let e of this._allCameras)e._checked&&i.push(e);for(let r=0;r{let i=c._nextTaskID++;c._taskCallbackMap.set(i,i=>{if(i.success){let t=i.results;return t.intervalTime=this.intervalTime,e(t)}{let e=new Error(i.message);return e.stack+="\n"+i.stack,t(e)}}),c._dbrWorker.postMessage({type:"getScanSettings",id:i,instanceID:this._instanceID})})}))}updateScanSettings(e){return h(this,void 0,void 0,(function*(){return this.intervalTime=e.intervalTime,yield new Promise((t,i)=>{let r=c._nextTaskID++;c._taskCallbackMap.set(r,e=>{if(e.success)return t();{let t=new Error(e.message);return t.stack+="\n"+e.stack,i(t)}}),g._dbrWorker.postMessage({type:"updateScanSettings",id:r,instanceID:this._instanceID,body:{settings:e}})})}))}getVideoSettings(){return JSON.parse(JSON.stringify(this.videoSettings))}updateVideoSettings(e){return this.videoSettings=JSON.parse(JSON.stringify(e)),this._lastDeviceId=null,this._isOpen?this.play():Promise.resolve()}isOpen(){return this._isOpen}_show(){this.UIElement.parentNode||(this.UIElement.style.position="fixed",this.UIElement.style.left="0",this.UIElement.style.top="0",document.body.append(this.UIElement)),"none"==this.UIElement.style.display&&(this.UIElement.style.display="")}stop(){this._video&&this._video.srcObject&&(c._onLog&&c._onLog("======stop video========"),this._video.srcObject.getTracks().forEach(e=>{e.stop()}),this._video.srcObject=null,this._videoTrack=null,this._currentCamera=null),this._video&&this._video.classList.contains("dbrScanner-existingVideo")&&(c._onLog&&c._onLog("======stop existing video========"),this._video.pause(),this._video.currentTime=0),this._bgLoading&&(this._bgLoading.style.animationPlayState=""),this._divScanLight&&(this._divScanLight.style.display="none"),this._drawRegionsults(),this.queue_handledFrame.length=0,this.array_decodeFrameTimeCost.length=0,this.array_getFrameTimeCost.length=0,this._intervalGetVideoFrame=0}pause(){this._video&&this._video.pause(),this._divScanLight&&(this._divScanLight.style.display="none")}play(e,t,i){return h(this,void 0,void 0,(function*(){if(this._assertOpen(),this._video&&this.videoSrc){yield new Promise((e,t)=>{this._video.onloadedmetadata=()=>h(this,void 0,void 0,(function*(){this._video.onloadedmetadata=null,yield this._video.play(),e()})),"string"==typeof this.videoSrc||this.videoSrc instanceof String?this._video.src=this.videoSrc:this._video.srcObject=this.videoSrc,setTimeout(()=>t(new Error("Failed to play video. Timeout.")),4e3)});let e={width:this._video.videoWidth,height:this._video.videoHeight};return this.onPlayed&&setTimeout(()=>{this.onPlayed(e)},0),e}if(this.singleFrameMode)return this._clickIptSingleFrameMode(),{width:0,height:0};const r=++this.iPlayRound;return this.promisePlay&&(yield this.promisePlay,rh(this,void 0,void 0,(function*(){var r;try{this._video&&this._video.srcObject&&this.stop(),c._onLog&&c._onLog("======before video========"),yield this.getAllCameras();let n=()=>{if(this.bDestroyed)throw d&&d.getTracks().forEach(e=>{e.stop()}),this._video.srcObject=null,this._videoTrack=null,this._currentCamera=null,new Error("The BarcodeScanner instance has been destroyed.")};const o=JSON.parse(JSON.stringify(this.videoSettings));let s;"boolean"==typeof o.video&&(o.video={}),t&&(o.video.width={ideal:t}),i&&(o.video.height={ideal:i});const a=["rear","back","rück","arrière","trasera","trás","traseira","posteriore","后面","後面","背面","后置","後置","背置","задней","الخلفية","후","arka","achterzijde","หลัง","baksidan","bagside","sau","bak","tylny","takakamera","belakang","אחורית","πίσω","spate","hátsó","zadní","darrere","zadná","задня","stražnja","belakang","बैक"];let d,_=()=>{for(let e of this._allCameras){let t=e.label.toLowerCase();if(t&&a.some(e=>-1!=t.indexOf(e))&&/\b0(\b)?/.test(t)){delete o.video.facingMode,o.video.deviceId={ideal:e.deviceId};break}}o.video.deviceId||-1==["Android","HarmonyOS"].indexOf(c.browserInfo.OS)||(delete o.video.facingMode,o.video.deviceId={ideal:this._allCameras[this._allCameras.length-1].deviceId})};if(e)delete o.video.facingMode,o.video.deviceId={exact:e},this._lastDeviceId=e;else if(o.video.deviceId);else if(this._lastDeviceId)delete o.video.facingMode,o.video.deviceId={exact:this._lastDeviceId};else if(o.video.facingMode){let e=o.video.facingMode;e instanceof Array&&e.length&&(e=e[0]),e=e.exact||e.ideal||e,"environment"===e&&(s=!!o.video.facingMode,_())}c._onLog&&c._onLog("======try getUserMedia========");let l,u=[0,500],g=null,E=null,R=e=>h(this,void 0,void 0,(function*(){for(let t of u){n(),t&&(yield new Promise(e=>setTimeout(e,t))),n();{const t=e.video.deviceId;E=t?t.exact||t.ideal||t:null}try{c._onLog&&c._onLog("ask "+JSON.stringify(e)),d=yield navigator.mediaDevices.getUserMedia(e);break}catch(e){g=e,c._onLog&&c._onLog(e.message||e)}}}));if(yield R(o),!d){if(c._onLog&&c._onLog("======try getUserMedia again========"),l=JSON.parse(JSON.stringify(o)),"object"==typeof l.video){"iPhone"==c.browserInfo.OS?(t>=1280||i>=1280?l.video.width=1280:t>=640||i>=640?l.video.width=640:(t<640||i<640)&&(l.video.width=320),delete l.video.height):s&&!o.video.deviceId?(delete l.video.facingMode,this._allCameras.length&&(l.video.deviceId={ideal:this._allCameras[this._allCameras.length-1].deviceId})):l.video=!0}c._onLog&&c._onLog(l),yield R(l)}if(d||(u=[1e3,2e3],yield R(o)),d||(yield R(l)),!d)throw g;const m=()=>{const e=d.getVideoTracks();let t;e.length&&(t=this._videoTrack=e[0]);let i=void 0;if(this._video&&t){if(t.label)for(let e of this._allCameras)if(t.label==e.label){e._checked=!0,i=e,this._lastDeviceId=e.deviceId;break}if(!i&&E)for(let e of this._allCameras)if(E==e.deviceId){t.label&&(e._checked=!0,e.label=t.label),i=e,this._lastDeviceId=e.deviceId;break}}this._currentCamera=i};if(yield this.getAllCameras(),n(),s){m(),_();let e=o.video.deviceId;e&&(e=e.exact||e.ideal||e);let t=null===(r=this._currentCamera)||void 0===r?void 0:r.deviceId;!e||t&&e==t||(d.getTracks().forEach(e=>{e.stop()}),u=[0,500,1e3,2e3],yield R(o))}n();const f=()=>h(this,void 0,void 0,(function*(){c._onLog&&c._onLog("======play video========"),yield new Promise((e,t)=>{this._video.onloadedmetadata=()=>h(this,void 0,void 0,(function*(){this._video.onloadedmetadata=null,yield this._video.play(),e()})),this._video.srcObject=d,setTimeout(()=>t(new Error("Failed to play video. Timeout.")),4e3)})}));yield f(),c._onLog&&c._onLog("======played video========"),this._bgLoading&&(this._bgLoading.style.animationPlayState="paused");const I="got "+this._video.videoWidth+"x"+this._video.videoHeight;this._optGotRsl&&(this._optGotRsl.setAttribute("data-width",this._video.videoWidth),this._optGotRsl.setAttribute("data-height",this._video.videoHeight),this._optGotRsl.innerText=I,this._selRsl&&this._optGotRsl.parentNode==this._selRsl&&(this._selRsl.value="got")),c._onLog&&c._onLog(I),m(),n(),this._renderSelCameraInfo();let A={width:this._video.videoWidth,height:this._video.videoHeight};return this.onPlayed&&setTimeout(()=>{this.onPlayed(A)},0),this.promisePlay=null,A}catch(e){throw this.promisePlay=null,e}})))(),yield this.promisePlay)}))}pauseScan(){this._assertOpen(),this._bPauseScan=!0,this._divScanLight&&(this._divScanLight.style.display="none")}resumeScan(){this._assertOpen(),this._bPauseScan=!1}getCapabilities(){return this._assertOpen(),this._videoTrack.getCapabilities?this._videoTrack.getCapabilities():{}}getCameraSettings(){return this._assertOpen(),this._videoTrack.getSettings()}getConstraints(){return this._assertOpen(),this._videoTrack.getConstraints()}applyConstraints(e){return h(this,void 0,void 0,(function*(){if(this._assertOpen(),!this._videoTrack.applyConstraints)throw Error("Not supported.");return yield this._videoTrack.applyConstraints(e)}))}turnOnTorch(){return h(this,void 0,void 0,(function*(){if(this._assertOpen(),this.getCapabilities().torch)return yield this._videoTrack.applyConstraints({advanced:[{torch:!0}]});throw Error("Not supported.")}))}turnOffTorch(){return h(this,void 0,void 0,(function*(){if(this._assertOpen(),this.getCapabilities().torch)return yield this._videoTrack.applyConstraints({advanced:[{torch:!1}]});throw Error("Not supported.")}))}setColorTemperature(e){return h(this,void 0,void 0,(function*(){this._assertOpen();let t=this.getCapabilities().colorTemperature;if(!t)throw Error("Not supported.");return et.max&&(e=t.max),yield this._videoTrack.applyConstraints({advanced:[{colorTemperature:e}]})}))}setExposureCompensation(e){return h(this,void 0,void 0,(function*(){this._assertOpen();let t=this.getCapabilities().exposureCompensation;if(!t)throw Error("Not supported.");return et.max&&(e=t.max),yield this._videoTrack.applyConstraints({advanced:[{exposureCompensation:e}]})}))}setZoom(e){return h(this,void 0,void 0,(function*(){this._assertOpen();let t=this.getCapabilities().zoom;if(!t)throw Error("Not supported.");return et.max&&(e=t.max),yield this._videoTrack.applyConstraints({advanced:[{zoom:e}]})}))}setFrameRate(e){return h(this,void 0,void 0,(function*(){this._assertOpen();let t=this.getCapabilities().frameRate;if(!t)throw Error("Not supported.");return et.max&&(e=t.max),yield this._videoTrack.applyConstraints({width:{ideal:Math.max(this._video.videoWidth,this._video.videoHeight)},frameRate:e})}))}_cloneDecodeResults(e){if(e instanceof Array){let t=[];for(let i of e)t.push(this._cloneDecodeResults(i));return t}{let t=e;return JSON.parse(JSON.stringify(t,(e,t)=>"oriVideoCanvas"==e||"searchRegionCanvas"==e?void 0:t))}}_loopReadVideo(){return h(this,void 0,void 0,(function*(){if(this.bDestroyed)return;if(!this._isOpen)return void(yield this.clearMapDecodeRecord());if(this._video.paused||this._bPauseScan)return c._onLog&&c._onLog("Video or scan is paused. Ask in 1s."),yield this.clearMapDecodeRecord(),void setTimeout(()=>{this._loopReadVideo()},this._intervalDetectVideoPause);this._divScanLight&&"none"==this._divScanLight.style.display&&(this._divScanLight.style.display=""),c._onLog&&c._onLog("======= once read ======="),c._onLog&&(this._timeStartDecode=Date.now());let e=this.queue_handledFrame;this._countLoopGetFrame=0,0===e.length?this.loopGetVideoFrame(!0):(this._idGetFrameTimeout&&clearTimeout(this._idGetFrameTimeout),this._idGetFrameTimeout=setTimeout(()=>{this._countLoopGetFrame++,this.loopGetVideoFrame(!0)},this._intervalGetVideoFrame)),this._indexCurrentDecodingFrame=this._indexVideoRegion,this.region&&this.region instanceof Array&&++this._indexVideoRegion>=this.region.length&&(this._indexVideoRegion=0),(()=>h(this,void 0,void 0,(function*(){if(e[0]&&e[0].bUseWebGL){let{u8Gray:t,dWidth:i,dHeight:n}=e.pop();this._bWorkerDecodeBuffer=!0;let o={bUseWebGL:!0};return!this._timeEndGettingFrame||(o._timeEndGettingFrame=this._timeEndGettingFrame),yield this._decodeBuffer_Uint8Array(t,i,n,i,r.IPF_GrayScaled,o)}if(e[0]&&!1===e[0].bUseWebGL){let{data:t,cvs:i,config:n,region:o,sx:s,sy:a,sWidth:d,sHeight:_,dWidth:l,dHeight:h}=e.pop();this._bWorkerDecodeBuffer=!0,n.bUseWebGL=!1,!this._timeEndGettingFrame||(n._timeEndGettingFrame=this._timeEndGettingFrame),(this.bSaveOriCanvas||this.singleFrameMode)&&(this.oriCanvas=i);let u=yield this._decodeBuffer_Uint8Array(t,i.width,i.height,4*i.width,r.IPF_ABGR_8888,n);return c.fixResultLocationWhenFilterRegionInJs(o,u,s,a,d,_,l,h),u}{let e=new Error("queue_handledFrame is empty.");return new Promise(t=>t(e))}})))().then(e=>{c._onLog&&c._onLog(e);Date.now();if(this._bWorkerDecodeBuffer=!1,this._idGetFrameTimeout2&&clearTimeout(this._idGetFrameTimeout2),4===this._getVideoFrameMode){let e=this.array_decodeFrameTimeCost,t=this.array_getFrameTimeCost,i=this._indexCurrentDecodingFrame;if(this.region instanceof Array?(e[i]?e[i].length>=5&&e[i].shift():e[i]=[],e[i].push(this._lastInnerDecodeDuration)):(e.length>=5&&e.shift(),e.push(this._lastInnerDecodeDuration)),this.region instanceof Array){let r=0,n=0;r=i+1>=this.region.length?0:i+1,n=r+1>=this.region.length?0:r+1,e[r]&&e[r].length&&t[n]&&t[n].length?this._intervalGetVideoFrame=Math.min(...e[r])-Math.max(...t[n]):this._intervalGetVideoFrame=0}else t&&t.length?this._intervalGetVideoFrame=Math.min(...e)-Math.max(...t):this._intervalGetVideoFrame=0;this._intervalGetVideoFrame=this._intervalGetVideoFrame>0?this._intervalGetVideoFrame:0}if(this._isOpen&&!this._video.paused&&!this._bPauseScan){if(this.bPlaySoundOnSuccessfulRead&&e.length){let t=!1;if(!0===this.bPlaySoundOnSuccessfulRead||"frame"===this.bPlaySoundOnSuccessfulRead)t=!0;else if("unduplicated"===this.bPlaySoundOnSuccessfulRead)for(let i of e)if(i.bUnduplicated){t=!0;break}t&&(this.soundOnSuccessfullRead.currentTime=0,this.soundOnSuccessfullRead.play().catch(e=>{console.warn("Autoplay not allowed. User interaction required: "+(e.message||e))}))}if(navigator.vibrate&&this.bVibrateOnSuccessfulRead&&e.length){let t=!1;if(!0===this.bVibrateOnSuccessfulRead||"frame"===this.bVibrateOnSuccessfulRead)t=!0;else if("unduplicated"===this.bVibrateOnSuccessfulRead)for(let i of e)if(i.bUnduplicated){t=!0;break}if(t)try{navigator.vibrate(this.vibrateDuration)}catch(e){console.warn("Vibration not allowed. User interaction required: "+(e.message||e))}}if(this.onFrameRead){let t=this._cloneDecodeResults(e);for(let e of t)delete e.bUnduplicated;this.onFrameRead(t)}if(this.onUnduplicatedRead)for(let t of e)t.bUnduplicated&&this.onUnduplicatedRead(t.barcodeText,this._cloneDecodeResults(t));this._drawRegionsults(e)}setTimeout(()=>{this._loopReadVideo()},this.intervalTime)}).catch(e=>{this._bWorkerDecodeBuffer=!1,c._onLog&&c._onLog(e.message||e),setTimeout(()=>{this._loopReadVideo()},Math.max(this.intervalTime,1e3)),"platform error"==e.message||console.warn(e.message)})}))}loopGetVideoFrame(e){if(this.bDestroyed)return;if(!this._isOpen)return void this.clearMapDecodeRecord();if(this._video.paused||this._bPauseScan)return c._onLog&&c._onLog("Video or scan is paused. Ask in 1s."),void this.clearMapDecodeRecord();let t=Date.now();c._onLog&&c._onLog("start getting a frame: "+t);let i=this.queue_handledFrame,r={};if(this.region)if(this.region instanceof Array){let e=this.region[this._indexVideoRegion];e&&(r.region=JSON.parse(JSON.stringify(e)))}else r.region=JSON.parse(JSON.stringify(this.region));if(0===this._getVideoFrameMode){let e=this.handleVideoFrame(this._video,r);e&&(i[0]=e)}else if(1===this._getVideoFrameMode){let t=this.handleVideoFrame(this._video,r);t&&(i[0]=t),this._idGetFrameTimeout&&clearTimeout(this._idGetFrameTimeout),e&&(this._idGetFrameTimeout=setTimeout(()=>{this._bWorkerDecodeBuffer&&this._countLoopGetFrame{this._bWorkerDecodeBuffer&&this.loopGetVideoFrame(!0)},this._intervalGetVideoFrame)}else if(4===this._getVideoFrameMode){let t=this.handleVideoFrame(this._video,r);t&&(i[0]=t),this._idGetFrameTimeout&&clearTimeout(this._idGetFrameTimeout),e&&(this._idGetFrameTimeout=setTimeout(()=>{this._bWorkerDecodeBuffer&&this._countLoopGetFrame{0!=this.queue_handledFrame.length&&(c._onLog&&c._onLog("second timeout is executed: "+Date.now()),this.loopGetVideoFrame(!1))},200);let n=Date.now(),o=n-t;if(4===this._getVideoFrameMode){let e=this.array_getFrameTimeCost;if(this.region instanceof Array){let t=this._indexVideoRegion;e[t]?e[t].length>=5&&e[t].shift():e[t]=[],e[t].push(o)}else e.length>=5&&e.shift(),e.push(o)}this._timeEndGettingFrame=n,c._onLog&&c._onLog("end getting a frame: "+n),c._onLog&&c._onLog("get frame cost: "+o)}_drawRegionsults(e){let t,i,r;if(this.beingLazyDrawRegionsults=!1,this.singleFrameMode){if(!this.oriCanvas)return;t="contain",i=this.oriCanvas.width,r=this.oriCanvas.height}else{if(!this._video)return;t=this._video.style.objectFit||"contain",i=this._video.videoWidth,r=this._video.videoHeight}let n=this.region;if(n&&(!n.regionLeft&&!n.regionRight&&!n.regionTop&&!n.regionBottom&&!n.regionMeasuredByPercentage||n instanceof Array?n=null:n.regionMeasuredByPercentage?n=n.regionLeft||n.regionRight||100!==n.regionTop||100!==n.regionBottom?{regionLeft:Math.round(n.regionLeft/100*i),regionTop:Math.round(n.regionTop/100*r),regionRight:Math.round(n.regionRight/100*i),regionBottom:Math.round(n.regionBottom/100*r)}:null:(n=JSON.parse(JSON.stringify(n)),delete n.regionMeasuredByPercentage)),this._cvsDrawArea){this._cvsDrawArea.style.objectFit=t;let o=this._cvsDrawArea;o.width=i,o.height=r;let s=o.getContext("2d");if(n){s.fillStyle=this.regionMaskFillStyle,s.fillRect(0,0,o.width,o.height),s.globalCompositeOperation="destination-out",s.fillStyle="#000";let e=Math.round(this.regionMaskLineWidth/2);s.fillRect(n.regionLeft-e,n.regionTop-e,n.regionRight-n.regionLeft+2*e,n.regionBottom-n.regionTop+2*e),s.globalCompositeOperation="source-over",s.strokeStyle=this.regionMaskStrokeStyle,s.lineWidth=this.regionMaskLineWidth,s.rect(n.regionLeft,n.regionTop,n.regionRight-n.regionLeft,n.regionBottom-n.regionTop),s.stroke()}if(e){s.globalCompositeOperation="destination-over",s.fillStyle=this.barcodeFillStyle,s.strokeStyle=this.barcodeStrokeStyle,s.lineWidth=this.barcodeLineWidth,e=e||[];for(let t of e){let e=t.localizationResult;s.beginPath(),s.moveTo(e.x1,e.y1),s.lineTo(e.x2,e.y2),s.lineTo(e.x3,e.y3),s.lineTo(e.x4,e.y4),s.fill(),s.beginPath(),s.moveTo(e.x1,e.y1),s.lineTo(e.x2,e.y2),s.lineTo(e.x3,e.y3),s.lineTo(e.x4,e.y4),s.closePath(),s.stroke()}}this.singleFrameMode&&(s.globalCompositeOperation="destination-over",s.drawImage(this.oriCanvas,0,0))}if(this._divScanArea){let e=this._video.offsetWidth,t=this._video.offsetHeight,o=1;e/tsuper.destroy}});return h(this,void 0,void 0,(function*(){document.removeEventListener("visibilitychange",this._ev_documentHideEvent),yield this.close();for(let e of this.styleEls)e.remove();this.styleEls.splice(0,this.styleEls.length),this.bDestroyed||(yield e.destroy.call(this))}))}}var E,R,m,f,I,A,S,D,T,v,p,M,y,C,L,O,b,B,N,F,P,w,U,G,V,k,x;g._defaultUIElementURL="@engineResourcePath/dbr.scanner.html",g.singlePresetRegion=[null,{regionLeft:0,regionTop:30,regionRight:100,regionBottom:70,regionMeasuredByPercentage:1},{regionLeft:25,regionTop:25,regionRight:75,regionBottom:75,regionMeasuredByPercentage:1},{regionLeft:25,regionTop:25,regionRight:75,regionBottom:75,regionMeasuredByPercentage:1}],function(e){e[e.BICM_DARK_ON_LIGHT=1]="BICM_DARK_ON_LIGHT",e[e.BICM_LIGHT_ON_DARK=2]="BICM_LIGHT_ON_DARK",e[e.BICM_DARK_ON_DARK=4]="BICM_DARK_ON_DARK",e[e.BICM_LIGHT_ON_LIGHT=8]="BICM_LIGHT_ON_LIGHT",e[e.BICM_DARK_LIGHT_MIXED=16]="BICM_DARK_LIGHT_MIXED",e[e.BICM_DARK_ON_LIGHT_DARK_SURROUNDING=32]="BICM_DARK_ON_LIGHT_DARK_SURROUNDING",e[e.BICM_SKIP=0]="BICM_SKIP",e[e.BICM_REV=2147483648]="BICM_REV"}(E||(E={})),function(e){e[e.BCM_AUTO=1]="BCM_AUTO",e[e.BCM_GENERAL=2]="BCM_GENERAL",e[e.BCM_SKIP=0]="BCM_SKIP",e[e.BCM_REV=2147483648]="BCM_REV"}(R||(R={})),function(e){e[e.BF2_NULL=0]="BF2_NULL",e[e.BF2_POSTALCODE=32505856]="BF2_POSTALCODE",e[e.BF2_NONSTANDARD_BARCODE=1]="BF2_NONSTANDARD_BARCODE",e[e.BF2_USPSINTELLIGENTMAIL=1048576]="BF2_USPSINTELLIGENTMAIL",e[e.BF2_POSTNET=2097152]="BF2_POSTNET",e[e.BF2_PLANET=4194304]="BF2_PLANET",e[e.BF2_AUSTRALIANPOST=8388608]="BF2_AUSTRALIANPOST",e[e.BF2_RM4SCC=16777216]="BF2_RM4SCC",e[e.BF2_DOTCODE=2]="BF2_DOTCODE"}(m||(m={})),function(e){e[e.BM_AUTO=1]="BM_AUTO",e[e.BM_LOCAL_BLOCK=2]="BM_LOCAL_BLOCK",e[e.BM_SKIP=0]="BM_SKIP",e[e.BM_THRESHOLD=4]="BM_THRESHOLD",e[e.BM_REV=2147483648]="BM_REV"}(f||(f={})),function(e){e[e.ECCM_CONTRAST=1]="ECCM_CONTRAST"}(I||(I={})),function(e){e[e.CFM_GENERAL=1]="CFM_GENERAL"}(A||(A={})),function(e){e[e.CCM_AUTO=1]="CCM_AUTO",e[e.CCM_GENERAL_HSV=2]="CCM_GENERAL_HSV",e[e.CCM_SKIP=0]="CCM_SKIP",e[e.CCM_REV=2147483648]="CCM_REV"}(S||(S={})),function(e){e[e.CICM_GENERAL=1]="CICM_GENERAL",e[e.CICM_SKIP=0]="CICM_SKIP",e[e.CICM_REV=2147483648]="CICM_REV"}(D||(D={})),function(e){e[e.CM_IGNORE=1]="CM_IGNORE",e[e.CM_OVERWRITE=2]="CM_OVERWRITE"}(T||(T={})),function(e){e[e.DM_SKIP=0]="DM_SKIP",e[e.DM_DIRECT_BINARIZATION=1]="DM_DIRECT_BINARIZATION",e[e.DM_THRESHOLD_BINARIZATION=2]="DM_THRESHOLD_BINARIZATION",e[e.DM_GRAY_EQUALIZATION=4]="DM_GRAY_EQUALIZATION",e[e.DM_SMOOTHING=8]="DM_SMOOTHING",e[e.DM_MORPHING=16]="DM_MORPHING",e[e.DM_DEEP_ANALYSIS=32]="DM_DEEP_ANALYSIS",e[e.DM_SHARPENING=64]="DM_SHARPENING",e[e.DM_BASED_ON_LOC_BIN=128]="DM_BASED_ON_LOC_BIN",e[e.DM_SHARPENING_SMOOTHING=256]="DM_SHARPENING_SMOOTHING"}(v||(v={})),function(e){e[e.DRM_AUTO=1]="DRM_AUTO",e[e.DRM_GENERAL=2]="DRM_GENERAL",e[e.DRM_SKIP=0]="DRM_SKIP",e[e.DRM_REV=2147483648]="DRM_REV"}(p||(p={})),function(e){e[e.DPMCRM_AUTO=1]="DPMCRM_AUTO",e[e.DPMCRM_GENERAL=2]="DPMCRM_GENERAL",e[e.DPMCRM_SKIP=0]="DPMCRM_SKIP",e[e.DPMCRM_REV=2147483648]="DPMCRM_REV"}(M||(M={})),function(e){e[e.GTM_INVERTED=1]="GTM_INVERTED",e[e.GTM_ORIGINAL=2]="GTM_ORIGINAL",e[e.GTM_SKIP=0]="GTM_SKIP",e[e.GTM_REV=2147483648]="GTM_REV"}(y||(y={})),function(e){e[e.IPM_AUTO=1]="IPM_AUTO",e[e.IPM_GENERAL=2]="IPM_GENERAL",e[e.IPM_GRAY_EQUALIZE=4]="IPM_GRAY_EQUALIZE",e[e.IPM_GRAY_SMOOTH=8]="IPM_GRAY_SMOOTH",e[e.IPM_SHARPEN_SMOOTH=16]="IPM_SHARPEN_SMOOTH",e[e.IPM_MORPHOLOGY=32]="IPM_MORPHOLOGY",e[e.IPM_SKIP=0]="IPM_SKIP",e[e.IPM_REV=2147483648]="IPM_REV"}(C||(C={})),function(e){e[e.IRSM_MEMORY=1]="IRSM_MEMORY",e[e.IRSM_FILESYSTEM=2]="IRSM_FILESYSTEM",e[e.IRSM_BOTH=4]="IRSM_BOTH"}(L||(L={})),function(e){e[e.IRT_NO_RESULT=0]="IRT_NO_RESULT",e[e.IRT_ORIGINAL_IMAGE=1]="IRT_ORIGINAL_IMAGE",e[e.IRT_COLOUR_CLUSTERED_IMAGE=2]="IRT_COLOUR_CLUSTERED_IMAGE",e[e.IRT_COLOUR_CONVERTED_GRAYSCALE_IMAGE=4]="IRT_COLOUR_CONVERTED_GRAYSCALE_IMAGE",e[e.IRT_TRANSFORMED_GRAYSCALE_IMAGE=8]="IRT_TRANSFORMED_GRAYSCALE_IMAGE",e[e.IRT_PREDETECTED_REGION=16]="IRT_PREDETECTED_REGION",e[e.IRT_PREPROCESSED_IMAGE=32]="IRT_PREPROCESSED_IMAGE",e[e.IRT_BINARIZED_IMAGE=64]="IRT_BINARIZED_IMAGE",e[e.IRT_TEXT_ZONE=128]="IRT_TEXT_ZONE",e[e.IRT_CONTOUR=256]="IRT_CONTOUR",e[e.IRT_LINE_SEGMENT=512]="IRT_LINE_SEGMENT",e[e.IRT_FORM=1024]="IRT_FORM",e[e.IRT_SEGMENTATION_BLOCK=2048]="IRT_SEGMENTATION_BLOCK",e[e.IRT_TYPED_BARCODE_ZONE=4096]="IRT_TYPED_BARCODE_ZONE",e[e.IRT_PREDETECTED_QUADRILATERAL=8192]="IRT_PREDETECTED_QUADRILATERAL"}(O||(O={})),function(e){e[e.LM_SKIP=0]="LM_SKIP",e[e.LM_AUTO=1]="LM_AUTO",e[e.LM_CONNECTED_BLOCKS=2]="LM_CONNECTED_BLOCKS",e[e.LM_LINES=8]="LM_LINES",e[e.LM_STATISTICS=4]="LM_STATISTICS",e[e.LM_SCAN_DIRECTLY=16]="LM_SCAN_DIRECTLY",e[e.LM_STATISTICS_MARKS=32]="LM_STATISTICS_MARKS",e[e.LM_STATISTICS_POSTAL_CODE=64]="LM_STATISTICS_POSTAL_CODE",e[e.LM_CENTRE=128]="LM_CENTRE",e[e.LM_REV=2147483648]="LM_REV"}(b||(b={})),function(e){e[e.PDFRM_RASTER=1]="PDFRM_RASTER",e[e.PDFRM_AUTO=2]="PDFRM_AUTO",e[e.PDFRM_VECTOR=4]="PDFRM_VECTOR",e[e.PDFRM_REV=2147483648]="PDFRM_REV"}(B||(B={})),function(e){e[e.QRECL_ERROR_CORRECTION_H=0]="QRECL_ERROR_CORRECTION_H",e[e.QRECL_ERROR_CORRECTION_L=1]="QRECL_ERROR_CORRECTION_L",e[e.QRECL_ERROR_CORRECTION_M=2]="QRECL_ERROR_CORRECTION_M",e[e.QRECL_ERROR_CORRECTION_Q=3]="QRECL_ERROR_CORRECTION_Q"}(N||(N={})),function(e){e[e.RPM_AUTO=1]="RPM_AUTO",e[e.RPM_GENERAL=2]="RPM_GENERAL",e[e.RPM_GENERAL_RGB_CONTRAST=4]="RPM_GENERAL_RGB_CONTRAST",e[e.RPM_GENERAL_GRAY_CONTRAST=8]="RPM_GENERAL_GRAY_CONTRAST",e[e.RPM_GENERAL_HSV_CONTRAST=16]="RPM_GENERAL_HSV_CONTRAST",e[e.RPM_SKIP=0]="RPM_SKIP",e[e.RPM_REV=2147483648]="RPM_REV"}(F||(F={})),function(e){e[e.RCT_PIXEL=1]="RCT_PIXEL",e[e.RCT_PERCENTAGE=2]="RCT_PERCENTAGE"}(P||(P={})),function(e){e[e.RT_STANDARD_TEXT=0]="RT_STANDARD_TEXT",e[e.RT_RAW_TEXT=1]="RT_RAW_TEXT",e[e.RT_CANDIDATE_TEXT=2]="RT_CANDIDATE_TEXT",e[e.RT_PARTIAL_TEXT=3]="RT_PARTIAL_TEXT"}(w||(w={})),function(e){e[e.SUM_AUTO=1]="SUM_AUTO",e[e.SUM_LINEAR_INTERPOLATION=2]="SUM_LINEAR_INTERPOLATION",e[e.SUM_NEAREST_NEIGHBOUR_INTERPOLATION=4]="SUM_NEAREST_NEIGHBOUR_INTERPOLATION",e[e.SUM_SKIP=0]="SUM_SKIP",e[e.SUM_REV=2147483648]="SUM_REV"}(U||(U={})),function(e){e[e.TP_REGION_PREDETECTED=1]="TP_REGION_PREDETECTED",e[e.TP_IMAGE_PREPROCESSED=2]="TP_IMAGE_PREPROCESSED",e[e.TP_IMAGE_BINARIZED=4]="TP_IMAGE_BINARIZED",e[e.TP_BARCODE_LOCALIZED=8]="TP_BARCODE_LOCALIZED",e[e.TP_BARCODE_TYPE_DETERMINED=16]="TP_BARCODE_TYPE_DETERMINED",e[e.TP_BARCODE_RECOGNIZED=32]="TP_BARCODE_RECOGNIZED"}(G||(G={})),function(e){e[e.TFM_AUTO=1]="TFM_AUTO",e[e.TFM_GENERAL_CONTOUR=2]="TFM_GENERAL_CONTOUR",e[e.TFM_SKIP=0]="TFM_SKIP",e[e.TFM_REV=2147483648]="TFM_REV"}(V||(V={})),function(e){e[e.TROM_CONFIDENCE=1]="TROM_CONFIDENCE",e[e.TROM_POSITION=2]="TROM_POSITION",e[e.TROM_FORMAT=4]="TROM_FORMAT",e[e.TROM_SKIP=0]="TROM_SKIP",e[e.TROM_REV=2147483648]="TROM_REV"}(k||(k={})),function(e){e[e.TDM_AUTO=1]="TDM_AUTO",e[e.TDM_GENERAL_WIDTH_CONCENTRATION=2]="TDM_GENERAL_WIDTH_CONCENTRATION",e[e.TDM_SKIP=0]="TDM_SKIP",e[e.TDM_REV=2147483648]="TDM_REV"}(x||(x={}));class W{static get version(){return c.version}static get productKeys(){return c.productKeys}static set productKeys(e){c.productKeys=e}static get handshakeCode(){return c.handshakeCode}static set handshakeCode(e){c.handshakeCode=e}static get organizationID(){return c.organizationID}static set organizationID(e){c.organizationID=e}static get sessionPassword(){return c.sessionPassword}static set sessionPassword(e){c.sessionPassword=e}static get browserInfo(){return c.browserInfo}static detectEnvironment(){return c.detectEnvironment()}static get _workerName(){return c._workerName}static set _workerName(e){c._workerName=e}static get engineResourcePath(){return c.engineResourcePath}static set engineResourcePath(e){c.engineResourcePath=e}static get licenseServer(){return c.licenseServer}static set licenseServer(e){c.licenseServer=e}static get deviceFriendlyName(){return c.deviceFriendlyName}static set deviceFriendlyName(e){c.deviceFriendlyName=e}static get _onLog(){return c._onLog}static set _onLog(e){c._onLog=e}static get _bWasmDebug(){return c._bWasmDebug}static set _bWasmDebug(e){c._bWasmDebug=e}static get _bUseFullFeature(){return c._bUseFullFeature}static set _bUseFullFeature(e){c._bUseFullFeature=e}static get _dbrWorker(){return c._dbrWorker}static isLoaded(){return c.isLoaded()}static isWasmLoaded(){return c.isLoaded()}static loadWasm(){return c.loadWasm()}}W.BarcodeReader=c,W.BarcodeScanner=g,W.EnumBarcodeColourMode=E,W.EnumBarcodeComplementMode=R,W.EnumBarcodeFormat=s,W.EnumBarcodeFormat_2=m,W.EnumBinarizationMode=f,W.EnumClarityCalculationMethod=I,W.EnumClarityFilterMode=A,W.EnumColourClusteringMode=S,W.EnumColourConversionMode=D,W.EnumConflictMode=T,W.EnumDeblurMode=v,W.EnumDeformationResistingMode=p,W.EnumDPMCodeReadingMode=M,W.EnumErrorCode=n,W.EnumGrayscaleTransformationMode=y,W.EnumImagePixelFormat=r,W.EnumImagePreprocessingMode=C,W.EnumIMResultDataType=o,W.EnumIntermediateResultSavingMode=L,W.EnumIntermediateResultType=O,W.EnumLocalizationMode=b,W.EnumPDFReadingMode=B,W.EnumQRCodeErrorCorrectionLevel=N,W.EnumRegionPredetectionMode=F,W.EnumResultCoordinateType=P,W.EnumResultType=w,W.EnumScaleUpMode=U,W.EnumTerminatePhase=G,W.EnumTextFilterMode=V,W.EnumTextResultOrderMode=k,W.EnumTextureDetectionMode=x;t.default=W}])}));let _dbr;{if(typeof dbr=="object"){_dbr=dbr.DBR;}else if(typeof module=="object"&&module.exports&&module.exports.default){_dbr=module.exports.default;}else if(typeof exports=="object"&&exports.dbr){_dbr=exports.dbr.DBR;}}export default _dbr;export const DBR=_dbr.DBR;export const BarcodeReader=_dbr.BarcodeReader;export const BarcodeScanner=_dbr.BarcodeScanner;export const EnumBarcodeColourMode=_dbr.EnumBarcodeColourMode;export const EnumBarcodeComplementMode=_dbr.EnumBarcodeComplementMode;export const EnumBarcodeFormat=_dbr.EnumBarcodeFormat;export const EnumBarcodeFormat_2=_dbr.EnumBarcodeFormat_2;export const EnumBinarizationMode=_dbr.EnumBinarizationMode;export const EnumClarityCalculationMethod=_dbr.EnumClarityCalculationMethod;export const EnumClarityFilterMode=_dbr.EnumClarityFilterMode;export const EnumColourClusteringMode=_dbr.EnumColourClusteringMode;export const EnumColourConversionMode=_dbr.EnumColourConversionMode;export const EnumConflictMode=_dbr.EnumConflictMode;export const EnumDeblurMode=_dbr.EnumDeblurMode;export const EnumDeformationResistingMode=_dbr.EnumDeformationResistingMode;export const EnumDPMCodeReadingMode=_dbr.EnumDPMCodeReadingMode;export const EnumErrorCode=_dbr.EnumErrorCode;export const EnumGrayscaleTransformationMode=_dbr.EnumGrayscaleTransformationMode;export const EnumImagePixelFormat=_dbr.EnumImagePixelFormat;export const EnumImagePreprocessingMode=_dbr.EnumImagePreprocessingMode;export const EnumIMResultDataType=_dbr.EnumIMResultDataType;export const EnumIntermediateResultSavingMode=_dbr.EnumIntermediateResultSavingMode;export const EnumIntermediateResultType=_dbr.EnumIntermediateResultType;export const EnumLocalizationMode=_dbr.EnumLocalizationMode;export const EnumPDFReadingMode=_dbr.EnumPDFReadingMode;export const EnumQRCodeErrorCorrectionLevel=_dbr.EnumQRCodeErrorCorrectionLevel;export const EnumRegionPredetectionMode=_dbr.EnumRegionPredetectionMode;export const EnumResultCoordinateType=_dbr.EnumResultCoordinateType;export const EnumResultType=_dbr.EnumResultType;export const EnumScaleUpMode=_dbr.EnumScaleUpMode;export const EnumTerminatePhase=_dbr.EnumTerminatePhase;export const EnumTextFilterMode=_dbr.EnumTextFilterMode;export const EnumTextResultOrderMode=_dbr.EnumTextResultOrderMode;export const EnumTextureDetectionMode=_dbr.EnumTextureDetectionMode; \ No newline at end of file diff --git a/dist/dbr.reference.d.ts b/dist/dbr.reference.d.ts new file mode 100644 index 00000000..1effda89 --- /dev/null +++ b/dist/dbr.reference.d.ts @@ -0,0 +1,1975 @@ +/** +* Dynamsoft JavaScript Library +* @product Dynamsoft Barcode Reader JS Edition +* @website http://www.dynamsoft.com +* @preserve Copyright 2021, Dynamsoft Corporation +* @author Dynamsoft +* @version 8.6.0 (js 20210628) +* @fileoverview Dynamsoft JavaScript Library for Barcode Reader +* More info on DBR JS: https://www.dynamsoft.com/Products/barcode-recognition-javascript.aspx +*/ +// Generated by dts-bundle-generator v4.3.0 + +/// + +interface LocalizationResult { + /** + * The angle of a barcode. Values range from 0 to 360. + */ + angle: number; + /** + * The X coordinate of the left-most point. + */ + x1: number; + /** + * The X coordinate of the second point in a clockwise direction. + */ + x2: number; + /** + * The X coordinate of the third point in a clockwise direction. + */ + x3: number; + /** + * The X coordinate of the fourth point in a clockwise direction. + */ + x4: number; + /** + * The Y coordinate of the left-most point. + */ + y1: number; + /** + * The Y coordinate of the second point in a clockwise direction. + */ + y2: number; + /** + * The Y coordinate of the third point in a clockwise direction. + */ + y3: number; + /** + * The Y coordinate of the fourth point in a clockwise direction. + */ + y4: number; +} +declare enum EnumBarcodeFormat { + BF_ALL = -31457281, + BF_ONED = 1050623, + BF_GS1_DATABAR = 260096, + BF_CODE_39 = 1, + BF_CODE_128 = 2, + BF_CODE_93 = 4, + BF_CODABAR = 8, + BF_ITF = 16, + BF_EAN_13 = 32, + BF_EAN_8 = 64, + BF_UPC_A = 128, + BF_UPC_E = 256, + BF_INDUSTRIAL_25 = 512, + BF_CODE_39_EXTENDED = 1024, + BF_GS1_DATABAR_OMNIDIRECTIONAL = 2048, + BF_GS1_DATABAR_TRUNCATED = 4096, + BF_GS1_DATABAR_STACKED = 8192, + BF_GS1_DATABAR_STACKED_OMNIDIRECTIONAL = 16384, + BF_GS1_DATABAR_EXPANDED = 32768, + BF_GS1_DATABAR_EXPANDED_STACKED = 65536, + BF_GS1_DATABAR_LIMITED = 131072, + BF_PATCHCODE = 262144, + BF_PDF417 = 33554432, + BF_QR_CODE = 67108864, + BF_DATAMATRIX = 134217728, + BF_AZTEC = 268435456, + BF_MAXICODE = 536870912, + BF_MICRO_QR = 1073741824, + BF_MICRO_PDF417 = 524288, + BF_GS1_COMPOSITE = -2147483648, + BF_MSI_CODE = 1048576, + BF_NULL = 0 +} +/** + * @see [C++ TextResult](https://www.dynamsoft.com/barcode-reader/programming/c-cplusplus/struct/TextResult.html?src=cpp&&ver=latest) +*/ +interface TextResult { + /** + * The barcode text. + */ + barcodeText: string; + /** + * The barcode format. + */ + barcodeFormat: number | EnumBarcodeFormat; + /** + * Barcode type in string. + */ + barcodeFormatString: string; + /** + * The barcode content in a byte array. + */ + barcodeBytes: number[]; + /** + * The corresponding localization result. + */ + localizationResult: LocalizationResult; +} +interface RegionDefinition { + regionBottom: number; + regionRight: number; + regionLeft: number; + regionTop: number; + regionMeasuredByPercentage: number | boolean; +} +declare enum EnumIntermediateResultType { + IRT_NO_RESULT = 0, + IRT_ORIGINAL_IMAGE = 1, + IRT_COLOUR_CLUSTERED_IMAGE = 2, + IRT_COLOUR_CONVERTED_GRAYSCALE_IMAGE = 4, + IRT_TRANSFORMED_GRAYSCALE_IMAGE = 8, + IRT_PREDETECTED_REGION = 16, + IRT_PREPROCESSED_IMAGE = 32, + IRT_BINARIZED_IMAGE = 64, + IRT_TEXT_ZONE = 128, + IRT_CONTOUR = 256, + IRT_LINE_SEGMENT = 512, + IRT_FORM = 1024, + IRT_SEGMENTATION_BLOCK = 2048, + IRT_TYPED_BARCODE_ZONE = 4096, + IRT_PREDETECTED_QUADRILATERAL = 8192 +} +declare enum EnumTerminatePhase { + TP_REGION_PREDETECTED = 1, + TP_IMAGE_PREPROCESSED = 2, + TP_IMAGE_BINARIZED = 4, + TP_BARCODE_LOCALIZED = 8, + TP_BARCODE_TYPE_DETERMINED = 16, + TP_BARCODE_RECOGNIZED = 32 +} +declare enum EnumTextResultOrderMode { + TROM_CONFIDENCE = 1, + TROM_POSITION = 2, + TROM_FORMAT = 4, + TROM_SKIP = 0, + TROM_REV = 2147483648 +} +declare enum EnumBinarizationMode { + BM_AUTO = 1, + BM_LOCAL_BLOCK = 2, + BM_SKIP = 0, + BM_THRESHOLD = 4, + BM_REV = 2147483648 +} +declare enum EnumPDFReadingMode { + PDFRM_RASTER = 1, + PDFRM_AUTO = 2, + PDFRM_VECTOR = 4, + PDFRM_REV = 2147483648 +} +declare enum EnumScaleUpMode { + SUM_AUTO = 1, + SUM_LINEAR_INTERPOLATION = 2, + SUM_NEAREST_NEIGHBOUR_INTERPOLATION = 4, + SUM_SKIP = 0, + SUM_REV = 2147483648 +} +declare enum EnumLocalizationMode { + LM_SKIP = 0, + LM_AUTO = 1, + LM_CONNECTED_BLOCKS = 2, + LM_LINES = 8, + LM_STATISTICS = 4, + LM_SCAN_DIRECTLY = 16, + LM_STATISTICS_MARKS = 32, + LM_STATISTICS_POSTAL_CODE = 64, + LM_CENTRE = 128, + LM_REV = 2147483648 +} +declare enum EnumBarcodeFormat_2 { + BF2_NULL = 0, + BF2_POSTALCODE = 32505856, + BF2_NONSTANDARD_BARCODE = 1, + BF2_USPSINTELLIGENTMAIL = 1048576, + BF2_POSTNET = 2097152, + BF2_PLANET = 4194304, + BF2_AUSTRALIANPOST = 8388608, + BF2_RM4SCC = 16777216, + BF2_DOTCODE = 2 +} +declare enum EnumResultCoordinateType { + RCT_PIXEL = 1, + RCT_PERCENTAGE = 2 +} +/** + * @see [C++ RuntimeSettings](https://www.dynamsoft.com/barcode-reader/programming/c-cplusplus/struct/PublicRuntimeSettings.html?src=cpp&&ver=latest) + */ +interface RuntimeSettings { + /** + * Sets the formats of the barcode in BarcodeFormat group 1 to be read. Barcode formats in BarcodeFormat group 1 can be combined. + * ```js + * let runtimeSettings = await reader.getRuntimeSettings(); + * runtimeSettings.barcodeFormatIds = Dynamsoft.DBR.EnumBarcodeFormat.BF_ONED | Dynamsoft.DBR.EnumBarcodeFormat.BF_QR_CODE; + * await reader.updateRuntimeSettings(runtimeSettings); + * ``` + */ + barcodeFormatIds: number | EnumBarcodeFormat; + /** + * Sets the formats of the barcode in BarcodeFormat group 2 to be read. Barcode formats in BarcodeFormat group 1 can be combined. + */ + barcodeFormatIds_2: number | EnumBarcodeFormat_2; + /** + * Sets the mode and priority for binarization. + */ + binarizationModes: EnumBinarizationMode[]; + /** + * Sets the degree of blurriness of the barcode. + */ + deblurLevel: number; + /** + * Sets the number of barcodes expected to be detected for each image. + */ + expectedBarcodesCount: number; + /** + * Sets the further modes. + */ + furtherModes: any; + /** + * Sets which types of intermediate result to be kept for further reference. Intermediate result types can be combined. + */ + intermediateResultTypes: EnumIntermediateResultType; + /** + * Sets the mode and priority for localization algorithms. + */ + localizationModes: number[] | EnumLocalizationMode[]; + /** + * Sets the range of barcode text length for barcodes search + */ + minBarcodeTextLength: number; + /** + * The minimum confidence of the result + */ + minResultConfidence: number; + /** + * Not available in JS. Sets the way to detect barcodes from a PDF file when using the DecodeFile method. + */ + PDFReadingMode: EnumPDFReadingMode; + /** + * Sets the region definition including the regionTop, regionLeft, regionRight, regionBottom and regionMeasuredByPercentage. + * + * Experimental feature: + * + * In [BarcodeScanner](../BarcodeScanner.md), `region` can be an array. For example `region = [r0, r1, r2]`, 0th frame use `r0`, 1st use `r1`, 2nd use `r2`, 3rd use `r0`, and then loop like this. + */ + region: RegionDefinition; + /** + * Specifies the format for the coordinates returned + */ + resultCoordinateType: number | EnumResultCoordinateType; + /** + * Sets whether or not to return the clarity of the barcode zone. + */ + returnBarcodeZoneClarity: number; + /** + * Sets the threshold for the image shrinking + */ + scaleDownThreshold: number; + /** + * Sets the mode and priority to control the sampling methods of scale-up for linear barcode with small module sizes. + */ + scaleUpModes: EnumScaleUpMode[]; + /** + * Sets the phase where the algorithm stops. + */ + terminatePhase: EnumTerminatePhase; + /** + * Sets the mode and priority for the order of the text results returned. + */ + textResultOrderModes: EnumTextResultOrderMode[]; + /** + * Sets the maximum amount of time (in milliseconds) that should be spent searching for a barcode per page. + * It does not include the time taken to load/decode an image (Tiff, PNG, etc) from disk into memory. + */ + timeout: number; +} +declare enum EnumImagePixelFormat { + IPF_Binary = 0, + IPF_BinaryInverted = 1, + IPF_GrayScaled = 2, + IPF_NV21 = 3, + IPF_RGB_565 = 4, + IPF_RGB_555 = 5, + IPF_RGB_888 = 6, + IPF_ARGB_8888 = 7, + IPF_RGB_161616 = 8, + IPF_ARGB_16161616 = 9, + IPF_ABGR_8888 = 10, + IPF_ABGR_16161616 = 11, + IPF_BGR_888 = 12 +} +declare enum EnumErrorCode { + DBR_SYSTEM_EXCEPTION = 1, + DBR_SUCCESS = 0, + DBR_UNKNOWN = -10000, + DBR_NO_MEMORY = -10001, + DBR_NULL_REFERENCE = -10002, + DBR_LICENSE_INVALID = -10003, + DBR_LICENSE_EXPIRED = -10004, + DBR_FILE_NOT_FOUND = -10005, + DBR_FILETYPE_NOT_SUPPORTED = -10006, + DBR_BPP_NOT_SUPPORTED = -10007, + DBR_INDEX_INVALID = -10008, + DBR_BARCODE_FORMAT_INVALID = -10009, + DBR_CUSTOM_REGION_INVALID = -10010, + DBR_MAX_BARCODE_NUMBER_INVALID = -10011, + DBR_IMAGE_READ_FAILED = -10012, + DBR_TIFF_READ_FAILED = -10013, + DBR_QR_LICENSE_INVALID = -10016, + DBR_1D_LICENSE_INVALID = -10017, + DBR_DIB_BUFFER_INVALID = -10018, + DBR_PDF417_LICENSE_INVALID = -10019, + DBR_DATAMATRIX_LICENSE_INVALID = -10020, + DBR_PDF_READ_FAILED = -10021, + DBR_PDF_DLL_MISSING = -10022, + DBR_PAGE_NUMBER_INVALID = -10023, + DBR_CUSTOM_SIZE_INVALID = -10024, + DBR_CUSTOM_MODULESIZE_INVALID = -10025, + DBR_RECOGNITION_TIMEOUT = -10026, + DBR_JSON_PARSE_FAILED = -10030, + DBR_JSON_TYPE_INVALID = -10031, + DBR_JSON_KEY_INVALID = -10032, + DBR_JSON_VALUE_INVALID = -10033, + DBR_JSON_NAME_KEY_MISSING = -10034, + DBR_JSON_NAME_VALUE_DUPLICATED = -10035, + DBR_TEMPLATE_NAME_INVALID = -10036, + DBR_JSON_NAME_REFERENCE_INVALID = -10037, + DBR_PARAMETER_VALUE_INVALID = -10038, + DBR_DOMAIN_NOT_MATCHED = -10039, + DBR_RESERVEDINFO_NOT_MATCHED = -10040, + DBR_AZTEC_LICENSE_INVALID = -10041, + DBR_LICENSE_DLL_MISSING = -10042, + DBR_LICENSEKEY_NOT_MATCHED = -10043, + DBR_REQUESTED_FAILED = -10044, + DBR_LICENSE_INIT_FAILED = -10045, + DBR_PATCHCODE_LICENSE_INVALID = -10046, + DBR_POSTALCODE_LICENSE_INVALID = -10047, + DBR_DPM_LICENSE_INVALID = -10048, + DBR_FRAME_DECODING_THREAD_EXISTS = -10049, + DBR_STOP_DECODING_THREAD_FAILED = -10050, + DBR_SET_MODE_ARGUMENT_ERROR = -10051, + DBR_LICENSE_CONTENT_INVALID = -10052, + DBR_LICENSE_KEY_INVALID = -10053, + DBR_LICENSE_DEVICE_RUNS_OUT = -10054, + DBR_GET_MODE_ARGUMENT_ERROR = -10055, + DBR_IRT_LICENSE_INVALID = -10056, + DBR_MAXICODE_LICENSE_INVALID = -10057, + DBR_GS1_DATABAR_LICENSE_INVALID = -10058, + DBR_GS1_COMPOSITE_LICENSE_INVALID = -10059, + DBR_DOTCODE_LICENSE_INVALID = -10061, + DMERR_NO_LICENSE = -20000, + DMERR_LICENSE_SYNC_FAILED = -20003, + DMERR_TRIAL_LICENSE = -20010, + DMERR_FAILED_TO_REACH_LTS = -20200 +} +interface BarcodeReaderException extends Error { + code?: EnumErrorCode; +} +/** + * The `BarcodeReader` class is used for image decoding + * Comparing to `BarcodeScanner`, the default decoding settings are more accurate but slower. + * ```js + * let pReader = null; + * (async()=>{ + * let reader = await (pReader = pReader || Dynamsoft.DBR.BarcodeReader.createInstance()); + * let results = await reader.decode(imageSource); + * for(let result of results){ + * console.log(result.barcodeText); + * } + * })(); + * ``` + */ +declare class BarcodeReader { + private static _jsVersion; + private static _jsEditVersion; + protected static _version: string; + /** + * Get the current version. + */ + static get version(): string; + protected static _productKeys: string; + static get productKeys(): string; + /** + * Get or set the Dynamsoft Barcode Reader SDK product keys. + * ```js + * Dynamsoft.DBR.BarcodeReader.productKeys = "PRODUCT-KEYS"; + * ``` + * For convenience, you can set `productKeys` in `script` tag instead. + * ```html + * + * ``` + */ + static set productKeys(keys: string); + static get handshakeCode(): string; + /** + * Get or set the Dynamsoft Barcode Reader SDK handshake code. The `handshakeCode` is an alias of `productKeys`. Specifically refers to the key that requires **network** authentication. + * ```js + * Dynamsoft.DBR.BarcodeReader.handshakeCode = "123****-mytest"; + * ``` + * For convenience, you can set `handshakeCode` in `script` tag instead. + * ```html + * + * ``` + */ + static set handshakeCode(keys: string); + protected static _organizationID: string; + static get organizationID(): string; + /** + * Use organization ID to get authentication from network. Keep handshakeCode empty if you want to use default `handshake` of the organization. + * ```js + * Dynamsoft.DBR.BarcodeReader.organizationID = "123****"; + * ``` + * For convenience, you can set `organizationID` in `script` tag instead. + * ```html + * + * ``` + * @see [[handshakeCode]] + */ + static set organizationID(value: string); + /** @ignore */ + static _sessionPassword: string; + /** + * Specify a password to protect the `Handshake Code` from abuse. + * ```js + * Dynamsoft.DBR.BarcodeReader.handshakeCode = "123****-mytest"; + * Dynamsoft.DBR.BarcodeReader.sessionPassword = "@#$%****"; + * ``` + * Since js in the browser is plaintext, it is not safe to set a password. It is recommended that you bind the `domain` as `Validation field` in the [handshake settings in dynamsoft website](https://www.dynamsoft.com/lts/index.html#/handshakeCodes) or your self-hosted license server. + * + * In nodejs, password is meaningful. + * @see [[handshakeCode]] + */ + static set sessionPassword(value: string); + static get sessionPassword(): string; + /** @ignore */ + static _limitModules?: string[]; + /** @ignore */ + static _chargeWay?: string; + /** + * modify from https://gist.github.com/2107/5529665 + * @ignore + */ + static browserInfo: any; + /** + * Detect environment and get a report. + * ```js + * console.log(Dynamsoft.DBR.BarcodeReader.detectEnvironment()); + * // {"wasm":true, "worker":true, "getUserMedia":true, "camera":true, "browser":"Chrome", "version":90, "OS":"Windows"} + * ``` + */ + static detectEnvironment(): Promise; + /** @ignore */ + static _workerName: string; + protected static _engineResourcePath?: string; + static get engineResourcePath(): string; + /** + * Specify the Barcode Reader SDK engine (WASM) url. The SDK tries to automatically explore the engine location. + * If the auto-explored engine location is incorrect, you can manually specify the engine location. + * The property needs to be set before [[loadWasm]]. + * ```js + * Dynamsoft.DBR.BarcodeReader.engineResourcePath = "https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@8.6.0/dist/"; + * await Dynamsoft.DBR.BarcodeReader.loadWasm(); + * ``` + */ + static set engineResourcePath(value: string); + /** @ignore */ + protected static _licenseServer?: string[]; + static get licenseServer(): string[] | string; + /** + * Specify the license server URL. + */ + static set licenseServer(value: string[] | string); + private static _deviceFriendlyName; + /** + * @ignore + */ + static get deviceFriendlyName(): string; + /** @ignore */ + static set deviceFriendlyName(value: string); + /** + * @ignore + */ + static _isShowRelDecodeTimeInResults: boolean; + /** + * @ignore + */ + _canvasMaxWH: number; + /** + * @ignore + */ + static _onLog: (message: any) => void; + /** + * @ignore + */ + static _bWasmDebug: boolean; + /** + * @ignore + */ + static _bNeverShowDialog: boolean; + /** + * Whether to use full feature wasm. The api may change in later version. + * For web, `_bUseFullFeature` is false as default. + * For Node.js, `_bUseFullFeature` will not work, and BarcodeReader will always work on full feature. + * The property needs to be set before `loadWasm`. + *
+	 * Compact wasm:
+	 * oned + qr + pdf417 + datamatrix.
+	 * ===
+	 * Full wasm:
+	 * all supported barcode format +
+	 * high level deblur available (lv8, 9) +
+	 * DPM +
+	 * template API +
+	 * intermediate results API
+	 * ===
+	 * e.g.:
+	 * Use compact in video deocode (small, download and initialization fast).
+	 * Use full in file decode (need high level deblur).
+	 * 
+ * + * ```js + * DBR.BarcodeReader._bUseFullFeature = true; + * await DBR.BarcodeReader.loadWasm(); + * ``` + */ + protected static __bUseFullFeature: boolean; + static get _bUseFullFeature(): boolean; + static set _bUseFullFeature(value: boolean); + /** @ignore */ + static _dbrWorker: Worker; + protected static _nextTaskID: number; + protected static _taskCallbackMap: Map void>; + private static _loadWasmStatus; + private static _loadWasmCallbackArr; + /** @ignore */ + _instanceID: number; + /** @ignore */ + bSaveOriCanvas: boolean; + /** + * Whether to save the original image into canvas. + * ```js + * reader.ifSaveOriginalImageInACanvas = true; + * let results = await reader.decode(source); + * document.body.append(reader.getOriginalImageInACanvas()); + * ``` + */ + get ifSaveOriginalImageInACanvas(): boolean; + set ifSaveOriginalImageInACanvas(value: boolean); + /** @ignore */ + oriCanvas?: HTMLCanvasElement | OffscreenCanvas; + /** + * The original canvas. + * ```js + * reader.ifSaveOriginalImageInACanvas = true; + * let results = await reader.decode(source); + * document.body.append(reader.getOriginalImageInACanvas()); + * ``` + */ + getOriginalImageInACanvas(): HTMLCanvasElement | OffscreenCanvas; + /** @ignore */ + _1dMinConfidence: number; + /** @ignore */ + maxVideoCvsLength: number; + protected videoCvses?: (HTMLCanvasElement | OffscreenCanvas)[]; + protected videoGlCvs?: HTMLCanvasElement | OffscreenCanvas; + protected videoGl?: WebGLRenderingContext | WebGL2RenderingContext; + protected glImgData?: Uint8Array; + protected bFilterRegionInJs: boolean; + protected userDefinedRegion: any; + protected _region?: RegionDefinition | RegionDefinition[]; + protected set region(value: null | RegionDefinition | RegionDefinition[]); + protected get region(): null | RegionDefinition | RegionDefinition[]; + /** @ignore */ + _timeStartDecode: any; + /** @ignore */ + _timeEnterInnerDBR: any; + /** @ignore */ + _timeGetMessage: any; + /** @ignore */ + _bUseWebgl: boolean; + /** @ignore */ + decodeRecords: any; + /** + * @ignore A callback when wasm download success in browser environment. + */ + static _onWasmDownloaded: () => void; + /** + * Check if the decoding module is loaded. + * @category Initialize and Destroy + */ + static isLoaded(): boolean; + /** + * Indicates whether the instance has been destroyed. + */ + bDestroyed: boolean; + isContextDestroyed(): boolean; + /** @ignore */ + protected static _lastErrorCode: number; + /** @ignore */ + static get lastErrorCode(): number; + /** @ignore */ + protected static _lastErrorString: string; + /** @ignore */ + static get lastErrorString(): string; + /** @ignore */ + protected _setWarnnedEx: Set; + /** @ignore */ + protected _lastErrorCode: number; + /** @ignore */ + get lastErrorCode(): number; + /** @ignore */ + protected _lastErrorString: string; + /** @ignore */ + get lastErrorString(): string; + /** @ignore */ + _lastInnerDecodeDuration: number; + private static _loadWasmErr; + /** + * Before most operations, `loadWasm` needs to be excuted firstly. + * Most time, you do not need excute `loadWasm` manually. Because when you excute [[createInstance]], `loadWasm` will be excuted implicitly. + * Some properties can't be changed after `loadWasm`. + * Calling `loadWasm` in advance can avoid the long wait when `createInstance`. + * ```js + * window.addEventListener('DOMContentLoaded', (event) => { + * DBR.BarcodeReader.loadWasm(); + * }); + * ``` + * @category Initialize and Destroy + */ + static loadWasm(): Promise; + /** + * @param type "warn" or "error" + * @param content + * @returns + */ + protected static showDialog(type: string, content: string): Promise; + protected static createInstanceInWorker(bScanner?: boolean): Promise; + /** + * Create a `BarcodeReader` instance. + * ``` + * let pReader = null; + * (async()=>{ + * let reader = await (pReader = pReader || Dynamsoft.DBR.BarcodeReader.createInstance()); + * })(); + * ``` + * @category Initialize and Destroy + */ + static createInstance(): Promise; + /** + * Decode barcodes from a image. + * + * The main decoding method can accept a variety of data types, including binary data, images, base64 (with mime), urls, etc. + * + * The image format can be `png`, `jpeg`, `bmp`, `gif` and a few other (some browsers support `webp`, `tif`). + * + * ```js + * let results = await reader.decode(blob); + * for(let result of results){ + * console.log(result.barcodeText); + * } + * + * let results2 = await reader.decode(htmlImageElement); + * let results2 = await reader.decode(url); + * + * // like `data:image/png;base64,iV************` + * let results3 = await reader.decode(base64WithMime); + * ``` + * + * And you can get a frame to decode from the `HTMLVideoElement`. + * + * ```js + * // The frame currently played will be decode. + * let results; + * try{ + * results = await reader.decode(htmlVideoElement); + * }catch(ex){ + * // If no frame in the video, will throw an exception. + * } + * ``` + * If you need to continuously decode a video, you can use [BarcodeScanner](../BarcodeScanner/index.md) instead. + * @param source + * @category Decode + */ + decode(source: Blob | Buffer | ArrayBuffer | Uint8Array | Uint8ClampedArray | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | string): Promise; + /** + * The decoding method can accept base64 with or without mime. + * e.g. `data:image/jpg;base64,Xfjshekk....` or `Xfjshekk...`. + * ```js + * let results = await reader.decodeBase64String(strBase64); + * for(let result of results){ + * console.log(result.barcodeText); + * } + * ``` + * @param base64 + * @category Decode + */ + decodeBase64String(base64: string): Promise; + /** + * The decoding method can accept url. The url source need to be in the same domain or allowed cors. + * ```js + * let results = await reader.decodeUrl("./1.png"); + * for(let result of results){ + * console.log(result.barcodeText); + * } + * ``` + * @param url + * @category Decode + */ + decodeUrl(url: string): Promise; + /** + * Decodes barcodes from the memory buffer containing image pixels in defined format. + * @ignore + */ + _decodeBuffer_Uint8Array(buffer: Uint8Array | Uint8ClampedArray, width: number, height: number, stride: number, format: EnumImagePixelFormat, config?: any): Promise; + /** + * + * @param buffer + * @param width + * @param height + * @param stride + * @param format + * @param config + * @ignore + */ + _decodeBuffer_Blob(buffer: Blob, width: number, height: number, stride: number, format: EnumImagePixelFormat, config?: any): Promise; + /** + * Decode barcodes from raw image data. + * @param buffer + * @param width + * @param height + * @param stride + * @param format + * @param config + * @category Decode + */ + decodeBuffer(buffer: Uint8Array | Uint8ClampedArray | ArrayBuffer | Blob | Buffer, width: number, height: number, stride: number, format: EnumImagePixelFormat, config?: any): Promise; + /** @ignore */ + _decodeFileInMemory_Uint8Array(bytes: Uint8Array): Promise; + /** + * Gets current runtime settings. + * ```js + * let settings = await reader.getRuntimeSettings(); + * settings.deblurLevel = 5; + * await reader.updateRuntimeSettings(settings); + * ``` + * @see [RuntimeSettings](https://www.dynamsoft.com/barcode-reader/programming/c-cplusplus/struct/PublicRuntimeSettings.html?ver=latest&utm_source=github&package=js) + * @category Runtime Settings + */ + getRuntimeSettings(): Promise; + /** + * Update runtime settings with a given struct, or a string of `speed`, `balance` or `coverage` to use preset settings for BarcodeReader. + * The default settings for BarcodeReader is `coverage`. + * ```js + * await reader.updateRuntimeSettings('balance'); + * let settings = await reader.getRuntimeSettings(); + * settings.barcodeFormatIds = Dynamsoft.DBR.EnumBarcodeFormat.BF_ONED; + * await reader.updateRuntimeSettings(settings); + * ``` + * @see [RuntimeSettings](https://www.dynamsoft.com/barcode-reader/programming/c-cplusplus/struct/PublicRuntimeSettings.html?ver=latest&utm_source=github&package=js) + * @category Runtime Settings + */ + updateRuntimeSettings(settings: RuntimeSettings | string): Promise; + /** + * Resets all parameters to default values. + * ```js + * await reader.resetRuntimeSettings(); + * ``` + * @category Runtime Settings + */ + resetRuntimeSettings(): Promise; + /** + * Outputs the license content as an encrypted string from the license server to be used for offline license verification. + * ```js + * let strSettings = await reader.outputSettingsToString(); + * ``` + * The method is only supported in the full feature edition. + * @ignore + * @category Runtime Settings + */ + outputSettingsToString(): Promise; + /** + * Initialize runtime settings with the settings in given JSON string. + * ```js + * await reader.initRuntimeSettingsWithString("{\"Version\":\"3.0\", \"ImageParameter\":{\"Name\":\"IP1\", \"BarcodeFormatIds\":[\"BF_QR_CODE\"], \"ExpectedBarcodesCount\":10}}"); + * ``` + * The method is only supported in the full feature edition. + * @ignore + * @category Runtime Settings + */ + initRuntimeSettingsWithString(settings: any): Promise; + private _decode_Blob; + /** + * + * @param arrayBuffer + * @param config + * @ignore + */ + private _decode_ArrayBuffer; + /** + * + * @param uint8Array + * @param config + * @ignore + */ + private _decode_Uint8Array; + /** + * + * @param image + * @param config + * @ignore + */ + private _decode_Image; + private _decode_Canvas; + /** + * + * @param video + * @param config + * @ignore + */ + protected handleVideoFrame(video: HTMLVideoElement, config?: any): Object; + /** + * decode video is not multi call safe in an instance, we reuse many thing for speed, so make sure wait util one finish then call next + * @param video + * @param config + * @ignore + */ + _decode_Video(video: HTMLVideoElement, config?: any): Promise; + private _decode_Base64; + private _decode_Url; + private _decode_FilePath; + /** @ignore */ + static fixResultLocationWhenFilterRegionInJs(region: any, results: TextResult[], sx: number, sy: number, sWidth: number, sHeight: number, dWidth: number, dHeight: number): void; + /** @ignore */ + static BarcodeReaderException(ag0: any, ag1: any): BarcodeReaderException; + protected _handleRetJsonString(objRet: any): any; + /** + * Set argument value for the specified mode parameter. + * ```js + * await reader.setModeArgument("BinarizationModes", 0, "EnableFillBinaryVacancy", "1"); + * ``` + * @param modeName + * @param index + * @param argumentName + * @param argumentValue + * @category Runtime Settings + */ + setModeArgument(modeName: string, index: number, argumentName: string, argumentValue: string): Promise; + /** + * Get argument value for the specified mode parameter. + * ```js + * let argumentValue = await reader.getModeArgument("BinarizationModes", 0, "EnableFillBinaryVacancy"); + * ``` + * @param modeName + * @param index + * @param argumentName + * @category Runtime Settings + */ + getModeArgument(modeName: string, index: number, argumentName: string): Promise; + /** + * The method is only supported in the full feature edition. + * Returns intermediate results containing the original image, the colour clustered image, the binarized Image, contours, Lines, TextBlocks, etc. + * ```js + * let imResults = await reader.getIntermediateResults(); + * ``` + * @ignore + */ + getIntermediateResults(): Promise; + /** @ignore */ + getIntermediateCanvas(): Promise; + /** + * Destroy the `BarcodeReader` instance. If your page needs to create new instances from time to time, don't forget to destroy unused old instances, otherwise it will cause memory leaks. + * @category Initialize and Destroy + */ + destroy(): Promise; +} +interface FrameFilter { + /** + * The region definition of the frame to calculate the internal indicator. + * Default Value: { regionLeft = 0, regionRight = 100, regionTop = 0, regionBottom = 100, regionMeasuredByPercentage = true } + */ + region?: RegionDefinition | any; + /** + * The threshold used for filtering frames. + * Value range: [0, 1]. + * Default value: 0.1. + * The SDK will calculate an inner indicator for each frame from AppendFrame(), if the change rate of the indicators between the current frame and the history frames is larger than the given threshold, the current frame will not be added to the inner frame queue waiting for decoding. + */ + threshold?: number; +} +/** + * let scanSettings = await scanner.getScanSettings(); + * scanSettings.intervalTime = 100; // 100ms + * scanSettings.duplicateForgetTime = 3000; // 3s + * await scanner.updateScanSettings(scanSettings); + */ +interface ScanSettings { + intervalTime?: number; + duplicateForgetTime?: number; + /** + * Filter frame during focusing. + * `region` define the detecting area. + * `threshold` is (0,1). + * ```js + * scanSettings.frameFilter = { + * region: { + * regionLeft: 0, + * regionTop: 47, + * regionRight: 100, + * regionBottom: 53, + * regionMeasuredByPercentage: true + * }, + * threshold: 0.01 + * }; + * ``` + */ + frameFilter?: FrameFilter; +} +interface VideoDeviceInfo { + deviceId: string; + label: string; + /** @ignore */ + _checked: boolean; +} +interface ScannerPlayCallbackInfo { + height: number; + width: number; +} +/** + * The `BarcodeScanner` class is used for video decoding. + * ```js + * let pScanner = null; + * (async()=>{ + * let scanner = await (pScanner = pScanner || Dynamsoft.DBR.BarcodeScanner.createInstance()); + * scanner.onUnduplicatedRead = txt => console.log(txt); + * await scanner.show(); + * })(); + * ``` + */ +declare class BarcodeScanner extends BarcodeReader { + private static _defaultUIElementURL; + static get defaultUIElementURL(): string; + /** + * The url of the default scanner UI. + * Can only be changed before `createInstance`. + * ```js + * Dynamsoft.DBR.BarcodeScanner.defaultUIElementURL = "https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@8.6.0/dist/dbr.scanner.html"; + * let pScanner = null; + * (async()=>{ + * let scanner = await (pScanner = pScanner || Dynamsoft.DBR.BarcodeScanner.createInstance()); + * await scanner.show(); + * })(); + * ``` + */ + static set defaultUIElementURL(value: string); + /** @ignore */ + /** @ignore */ + UIElement: HTMLElement; + /** + * Get HTML element containing the `BarcodeScanner` instance. + * @category UI + */ + getUIElement(): HTMLElement; + /** + * Set html element containing the `BarcodeScanner` instance. + * ```html + * + * + * ``` + * @param element + * @category UI + */ + setUIElement(elementOrUrl: HTMLElement | string): Promise; + /** @ignore */ + private styleEls; + /** @ignore */ + videoSettings: MediaStreamConstraints; + /** Set a existing video source for decoding. */ + videoSrc: string | MediaStream | MediaSource | Blob; + private _singleFrameMode; + /** + * A mode not use video, get a frame from OS camera instead. + * ```js + * let pScanner = null; + * (async()=>{ + * let scanner = await (pScanner = pScanner || Dynamsoft.DBR.BarcodeScanner.createInstance()); + * if(scanner.singleFrameMode){ + * // the browser does not provide webrtc API, dbrjs automatically use singleFrameMode instead + * scanner.show(); + * } + * })(); + * ``` + */ + get singleFrameMode(): boolean; + /** + * A mode not use video, get a frame from OS camera instead. + * ```js + * let pScanner = null; + * (async()=>{ + * let scanner = await (pScanner = pScanner || Dynamsoft.DBR.BarcodeScanner.createInstance()); + * scanner.singleFrameMode = true; // use singleFrameMode anyway + * scanner.show(); + * })(); + * ``` + */ + set singleFrameMode(value: boolean); + private _singleFrameModeIpt; + private _clickIptSingleFrameMode; + /** @ignore */ + intervalTime: number; + private _isOpen; + private _assertOpen; + /** @ignore */ + private _bWorkerDecodeBuffer; + /** @ignore */ + private _idGetFrameTimeout; + /** @ignore */ + private _idGetFrameTimeout2; + /** @ignore */ + private _intervalGetVideoFrame; + /** + * 0: get frame after worker finished decoding(original version). + * 1: get frame and push them to queue when worker is decoding and the queue is empty, which can help next loop skip the getting frame process. + * 2: continously get frame and push it to queue, which can help next loop skip the getting frame process. + * 4: get frame and push them to queue when worker is decoding and the queue is empty, which can help next loop skip the getting frame process. Different from mode 1, there is a interval time before getting frame. + * @ignore + */ + private _getVideoFrameMode; + /** + * @ignore + * the times of loop get frame + */ + private loopGetFrameTimes; + /** @ignore */ + private _countLoopGetFrame; + /** @ignore */ + private queue_handledFrame; + /** @ignore */ + private array_getFrameTimeCost; + /** @ignore */ + private array_decodeFrameTimeCost; + /** @ignore */ + private _indexCurrentDecodingFrame; + /** @ignore */ + _timeEndGettingFrame: any; + private _bPauseScan; + /** @ignore */ + _lastDeviceId: string; + private _intervalDetectVideoPause; + private _vc_bPlayingVideoBeforeHide; + private _ev_documentHideEvent; + /** @ignore */ + _video: HTMLVideoElement; + /** @ignore */ + _cvsDrawArea: HTMLCanvasElement; + /** @ignore */ + _divScanArea: any; + /** @ignore */ + _divScanLight: any; + /** @ignore */ + _bgLoading: any; + /** @ignore */ + _bgCamera: any; + /** @ignore */ + _selCam: any; + /** @ignore */ + _selRsl: any; + /** @ignore */ + _optGotRsl: any; + /** @ignore */ + _btnClose: any; + /** @ignore */ + private _soundOnSuccessfullRead; + /** + * The sound to play when the scanner get successfull read. + */ + get soundOnSuccessfullRead(): HTMLAudioElement; + /** + * The sound to play when the scanner get successfull read. + * ```js + * scanner.soundOnSuccessfullRead = new Audio("./pi.mp3"); + * ``` + */ + set soundOnSuccessfullRead(value: HTMLAudioElement); + /** + * Whether to play sound when the scanner reads a barcode successfully. + * Default value is `false`, which does not play sound. + * Use `frame` or `true` to play a sound when any barcode is found within a frame. + * Use `unduplicated` to play a sound only when any unique/unduplicated barcode is found within a frame. + * ```js + * // A user gesture required. https://developers.google.com/web/updates/2017/09/autoplay-policy-changes#chrome_enterprise_policies + * startPlayButton.addEventListener('click', function() { + * scanner.bPlaySoundOnSuccessfulRead = true; + * }); + * ``` + * refer: `favicon bug` https://bugs.chromium.org/p/chromium/issues/detail?id=1069731&q=favicon&can=2 + * @ignore + */ + bPlaySoundOnSuccessfulRead: (boolean | string); + get whenToPlaySoundforSuccessfulRead(): string; + /** + * Whether to play sound when the scanner reads a barcode successfully. + * Default value is `never`, which does not play sound. + * Use `frame` to play a sound when any barcode is found within a frame. + * Use `unduplicated` to play a sound only when any unique/unduplicated barcode is found within a frame. + * ```js + * // A user gesture required. https://developers.google.com/web/updates/2017/09/autoplay-policy-changes#chrome_enterprise_policies + * startPlayButton.addEventListener('click', function() { + * scanner.whenToPlaySoundforSuccessfulRead = 'frame'; + * }); + * ``` + * refer: `favicon bug` https://bugs.chromium.org/p/chromium/issues/detail?id=1069731&q=favicon&can=2 + */ + set whenToPlaySoundforSuccessfulRead(value: string); + /** + * Whether to vibrate when the scanner reads a barcode successfully. + * Default value is `false`, which does not vibrate. + * Use `frame` or `true` to vibrate when any barcode is found within a frame. + * Use `unduplicated` to vibrate only when any unique/unduplicated barcode is found within a frame. + * ```js + * // Can I use? https://caniuse.com/?search=vibrate + * // A user gesture required. https://developers.google.com/web/updates/2017/09/autoplay-policy-changes#chrome_enterprise_policies + * startVibrateButton.addEventListener('click', function() { + * scanner.bVibrateOnSuccessfulRead = true; + * }); + * ``` + * @ignore + */ + bVibrateOnSuccessfulRead: (boolean | string); + /** + * Get or set how long (ms) the vibration lasts. + * @see [[bVibrateOnSuccessfulRead]],[[whenToVibrateforSuccessfulRead]] + */ + vibrateDuration: number; + get whenToVibrateforSuccessfulRead(): string; + /** + * Whether to vibrate when the scanner reads a barcode successfully. + * Default value is `never`, which does not vibrate. + * Use `frame` to vibrate when any barcode is found within a frame. + * Use `unduplicated` to vibrate only when any unique/unduplicated barcode is found within a frame. + * ```js + * // Can I use? https://caniuse.com/?search=vibrate + * // A user gesture required. https://developers.google.com/web/updates/2017/09/autoplay-policy-changes#chrome_enterprise_policies + * startPlayButton.addEventListener('click', function() { + * scanner.whenToVibrateforSuccessfulRead = 'frame'; + * }); + * ``` + */ + set whenToVibrateforSuccessfulRead(value: string); + /** @ignore */ + _allCameras: VideoDeviceInfo[]; + /** @ignore */ + _currentCamera?: VideoDeviceInfo; + /** @ignore */ + _videoTrack: MediaStreamTrack; + /** + * Set the style used when filling the mask beyond the region. + * @category UI + */ + regionMaskFillStyle: string; + /** + * Set the style of the region border. + * @category UI + */ + regionMaskStrokeStyle: string; + /** + * Set the width of the region border. + * @category UI + */ + regionMaskLineWidth: number; + /** + * Set the style used when filling in located barcode. + * @category UI + */ + barcodeFillStyle: string; + /** + * Set the style of the located barcode border. + * @category UI + */ + barcodeStrokeStyle: string; + /** + * Set the width of the located barcode border. + * @category UI + */ + barcodeLineWidth: number; + protected beingLazyDrawRegionsults: boolean; + protected set region(value: null | RegionDefinition | RegionDefinition[]); + protected get region(): null | RegionDefinition | RegionDefinition[]; + protected _indexVideoRegion: number; + /** @ignore */ + constructor(); + /** + * Create a `BarcodeScanner` object. + * ``` + * let pScanner = null; + * (async()=>{ + * let scanner = await (pScanner = pScanner || Dynamsoft.DBR.BarcodeScanner.createInstance()); + * })(); + * ``` + * @param config + * @category Initialize and Destroy + */ + static createInstance(config?: any): Promise; + /** @ignore */ + decode(source: Blob | ArrayBuffer | Uint8Array | Uint8ClampedArray | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | string): Promise; + /** @ignore */ + decodeBase64String(source: string): Promise; + /** @ignore */ + decodeUrl(source: string): Promise; + /** @ignore */ + decodeBuffer(buffer: Uint8Array | Uint8ClampedArray | ArrayBuffer | Blob, width: number, height: number, stride: number, format: EnumImagePixelFormat, config?: any): Promise; + /** + * Decode barcodes from the current frame of the video. + * ```js + * await scanner.showVideo(); + * console.log(await scanner.decodeCurrentFrame()); + * ``` + * @category Decode + */ + decodeCurrentFrame(config?: any): Promise; + private clearMapDecodeRecord; + private static readonly singlePresetRegion; + private static isRegionSinglePreset; + private static isRegionNormalPreset; + /** + * Update runtime settings with a given struct, or a string of `speed`, `balance`, `coverage` and `single` to use preset settings for BarcodeScanner. + * We recommend using the speed-optimized `single` preset if scanning only one barcode at a time. The `single` is only available in `BarcodeScanner`. + * The default settings for BarcodeScanner is `single`. + * ```js + * await scanner.updateRuntimeSettings('balance'); + * let settings = await scanner.getRuntimeSettings(); + * settings.barcodeFormatIds = Dynamsoft.DBR.EnumBarcodeFormat.BF_ONED; + * await scanner.updateRuntimeSettings(settings); + * ``` + * @see [RuntimeSettings](https://www.dynamsoft.com/barcode-reader/programming/c-cplusplus/struct/PublicRuntimeSettings.html?ver=latest&utm_source=github&package=js) + * @category Runtime Settings + */ + updateRuntimeSettings(settings: RuntimeSettings | string): Promise; + /** @ignore */ + _onCameraSelChange: () => void; + /** @ignore */ + _onResolutionSelChange: () => void; + /** @ignore */ + _onCloseBtnClick: () => void; + /** @ignore */ + _bindUI(): void; + /** @ignore */ + _unbindUI(): void; + /** + * Triggered when the camera video stream is played. + * ```js + * scanner.onplayed = rsl=>{ console.log(rsl.width+'x'+rsl.height) }; + * await scanner.show(); // or open, play, setCurrentCamera, like these. + * ``` + */ + onPlayed?: (info: ScannerPlayCallbackInfo) => void; + /** + * The event is triggered after a frame has been scanned. + * The results object contains all the barcode results in this frame. + * ```js + * scanner.onFrameRead = results => { + * for(let result of results){ + * console.log(result.barcodeText); + * } + * }; + * ``` + */ + onFrameRead?: (results: TextResult[]) => void; + /** + * This event is triggered when a new, unduplicated barcode is found. + * `txt` holds the barcode text result. `result` contains more info. + * Old barcodes will be remembered for `duplicateForgetTime`. + * ```js + * scanner.onUnduplicatedRead = (txt, result) => { + * alert(txt); + * console.log(result); + * }; + * ``` + */ + onUnduplicatedRead?: (txt: string, result: TextResult) => void; + /** @ignore */ + private _renderSelCameraInfo; + /** + * Get infomation of all available cameras on the device. + * ```js + * let cameras = await scanner.getAllCameras(); + * if(cameras.length){ + * await scanner.setCurrentCamera(cameras[0]); + * } + * ``` + * @category Camera Settings + */ + getAllCameras(): Promise; + /** + * Get information about the currently used camera. + * ```js + * let camera = await scanner.getCurrentCamera(); + * ``` + * @category Camera Settings + */ + getCurrentCamera(): Promise; + /** + * Choose the camera and play it by its information or devide id. + * ```js + * let cameras = await scanner.getAllCameras(); + * if(cameras.length){ + * await scanner.setCurrentCamera(cameras[0]); + * } + * ``` + * @param cameraInfoOrDeviceId + * @event [[onPlayed]] + * @category Camera Settings + */ + setCurrentCamera(cameraInfoOrDeviceId: any): Promise; + /** + * Get current camera resolution. + * ```js + * let rsl = await scanner.getResolution(); + * console.log(rsl.width + " x " + rsl.height); + * ``` + * @category Camera Settings + */ + getResolution(): number[]; + /** + * Set current camera resolution. + * ```js + * await scanner.setResolution(width, height); + * ``` + * @param width + * @param height + * @event [[onPlayed]] + * @category Camera Settings + */ + setResolution(width: number | number[], height: number): Promise; + /** + * Get current scan settings. + * ```js + * let scanSettings = await scanner.getScanSettings(); + * scanSettings.intervalTime = 50; + * scanSettings.duplicateForgetTime = 1000; + * await scanner.updateScanSettings(scanSettings); + * ``` + */ + getScanSettings(): Promise; + /** + * Modify and update scan settings. + * ```js + * let scanSettings = await scanner.getScanSettings(); + * scanSettings.intervalTime = 50; + * scanSettings.duplicateForgetTime = 1000; + * await scanner.updateScanSettings(scanSettings); + * ``` + * @param settings + */ + updateScanSettings(settings: ScanSettings): Promise; + /** + * Get current video settings. + * @category Camera Settings + */ + getVideoSettings(): MediaStreamConstraints; + /** + * Modify and update video settings. + * ```js + * await scanner.updateVideoSettings({ video: {width: {ideal: 1280}, height: {ideal: 720}, facingMode: {ideal: 'environment'}} }); + * ``` + * @param MediaStreamConstraints + * @category Camera Settings + */ + updateVideoSettings(MediaStreamConstraints: any): Promise; + /** + * Check if the scanner is open. + * ```js + * await scanner.show(); // or open(), showVideo(), openVideo(); + * console.assert(scanner.isOpen(), "scanner should be opened."); + * await scanner.hide(); // or close(); + * console.assert(!scanner.isOpen(), "scanner should be closed."); + * ``` + * @category Open and Close + */ + isOpen(): boolean; + /** @ignore */ + _show(): void; + /** + * Stop the video, and release the camera. + * ```js + * scanner.stop() + * \\*** a lot of work *** + * await scanner.play(); + * ``` + * @category Play and Pause + */ + stop(): void; + /** + * Pause the video. Do not release the camera. + * ```js + * scanner.pause(); + * \\*** a lot of work *** + * await scanner.play(); + * ``` + * @category Play and Pause + */ + pause(): void; + private iPlayRound; + private promisePlay; + /** + * Continue the video. + * ```js + * scanner.pause(); // or scanner.stop() + * \\*** a lot of work *** + * await scanner.play(); + * ``` + * @event [[onPlayed]] + * @category Play and Pause + */ + play(deviceId?: string, width?: number, height?: number): Promise; + /** + * Pause the decoding process. + * ```js + * pauseScan(); + * \\*** a lot of work *** + * resumeScan(); + * ``` + * @category Play and Pause + */ + pauseScan(): void; + /** + * Resume the decoding process. + * ```js + * pauseScan(); + * \\*** a lot of work *** + * resumeScan(); + * ``` + * @category Play and Pause + */ + resumeScan(): void; + /** + * Get the camera capabilities. Chrome only. + * Only available when the scanner is open. + * ```console + * > scanner.getCapabilities() + * < { + * "aspectRatio":{"max":3840,"min":0.000462962962962963}, + * "colorTemperature":{max: 7000, min: 2850, step: 50}, + * "deviceId":"1e...3af7", + * "exposureCompensation": {max: 2.0000040531158447, min: -2.0000040531158447, step: 0.16666699945926666}, + * "exposureMode":["continuous","manual"], + * "facingMode":["environment"], + * "focusMode":["continuous","single-shot","manual"], + * "frameRate":{"max":30,"min":0}, + * "groupId":"71...a935", + * "height":{"max":2160,"min":1}, + * "resizeMode":["none","crop-and-scale"], + * "torch":true, + * "whiteBalanceMode":["continuous","manual"], + * "width":{"max":3840,"min":1}, + * "zoom":{max: 606, min: 100, step: 2} + * } + * ``` + * @see [[turnOnTorch]],[[turnOffTorch]],[[setExposureCompensation]],[[setZoom]] + * @category Camera Settings + */ + getCapabilities(): MediaTrackCapabilities; + /** @ignore */ + getCameraSettings(): MediaTrackSettings; + /** @ignore */ + getConstraints(): MediaTrackConstraints; + /** + * @ignore + * Set the camera capabilities. Chrome only. + * Only available when the scanner is open. + * It's a low-level API, usually you can use the wrapped APIs instead. + * ```js + * await scanner.applyConstraints({ frameRate: { ideal:5 } }); + * ``` + */ + applyConstraints(constraints: MediaTrackConstraints): Promise; + /** + * Turn on the torch/flashlight. Chrome only. + * Only available when the scanner is open. + * Will reject if not support. + * ```js + * await scanner.turnOnTorch(); + * ``` + * @see [[turnOffTorch]],[[getCapabilities]] + * @category Camera Settings + */ + turnOnTorch(): Promise; + /** + * Turn off the torch. Chrome only. + * Only available when the scanner is open. + * Will reject if not support. + * ```js + * await scanner.turnOffTorch(); + * ``` + * @see [[turnOnTorch]],[[getCapabilities]] + * @category Camera Settings + */ + turnOffTorch(): Promise; + /** + * Adjusts the color temperature. Chrome only. + * Only available when the scanner is open. + * Will reject if not support. + * ```js + * await scanner.setColorTemperature(5000); + * ``` + * @see [[getCapabilities]] + * @category Camera Settings + */ + setColorTemperature(value: number): Promise; + /** + * Adjusts the exposure level. Chrome only. + * Only available when the scanner is open. + * Will reject if not support. + * ```js + * await scanner.setExposureCompensation(-0.7); + * ``` + * @see [[getCapabilities]] + * @category Camera Settings + */ + setExposureCompensation(value: number): Promise; + /** + * Adjusts the zoom ratio. Chrome only. + * Only available when the scanner is open. + * Will reject if not support. + * ```js + * await scanner.setZoom(400); + * ``` + * @see [[getCapabilities]] + * @category Camera Settings + */ + setZoom(value: number): Promise; + /** + * Adjusts the frame rate. Chrome only. + * Only available when the scanner is open. + * Will reject if not support. + * ```js + * await scanner.setFrameRate(10); + * ``` + * @see [[getCapabilities]] + * @category Camera Settings + */ + setFrameRate(value: number): Promise; + /** @ignore */ + _cloneDecodeResults(results: any): any; + /** + * process of getting frame and decoding the frame + * + * <------------- + * | ↑ + * | | + * <-------- | + * ↙ ↖ | + * | get frame | | + * ↘ ↗ | + * --------> | + * | | + * ↓ | + * decode ---------> + * + * @ignore + * */ + private _loopReadVideo; + /** @ignore */ + private loopGetVideoFrame; + /** @ignore */ + _drawRegionsults(results?: TextResult[]): void; + /** @ignore */ + _clearRegionsults(): void; + /** + * Bind UI, open the camera, start decoding. + * ```js + * await scanner.setUIElement(document.getElementById("my-barcode-scanner")); + * scanner.onUnduplicatedRead = (txt, result) => { alert(txt); console.log(result); }; + * await scanner.open(); + * // await scanner.close(); + * ``` + * @event [[onPlayed]],[[onUnduplicatedRead]],[[onFrameRead]] + * @category Open and Close + */ + open(): Promise; + /** + * Bind UI, open the camera, but not decode. + * ```js + * await scanner.setUIElement(document.getElementById("my-barcode-scanner")); + * await scanner.openVideo(); + * console.log(await scanner.decodeCurrentFrame()); + * // await scanner.close(); + * ``` + * @event [[onPlayed]],[[onUnduplicatedRead]],[[onFrameRead]] + * @category Open and Close + */ + openVideo(): Promise; + /** + * Stop decoding, release camera, unbind UI. + * ```js + * await scanner.open(); + * await scanner.close(); + * ``` + * ```js + * await scanner.openVideo(); + * await scanner.close(); + * ``` + * @category Open and Close + */ + close(): Promise; + /** + * Bind UI, open the camera, start decoding, and remove the UIElement `display` style if the original style is `display:none;`. + * ```js + * await scanner.setUIElement("https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@8.6.0/dist/dbr.scanner.html"); + * scanner.onUnduplicatedRead = (txt, result) => { alert(txt); console.log(result); }; + * await scanner.show(); + * // await scanner.hide(); + * ``` + * @event [[onPlayed]],[[onUnduplicatedRead]],[[onFrameRead]] + * @category Open and Close + */ + show(): Promise; + /** + * Bind UI, open the camera, but not decode, and remove the UIElement `display` style if the original style is `display:none;`. + * ```js + * await scanner.showVideo() + * console.log(await scanner.decodeCurrentFrame()); + * // await scanner.hide(); + * ``` + * @event [[onPlayed]],[[onUnduplicatedRead]],[[onFrameRead]] + * @category Open and Close + */ + showVideo(): Promise; + /** + * Stop decoding, release camera, unbind UI, and set the Element as `display:none;`. + * ```js + * await scanner.show(); + * await scanner.hide(); + * ``` + * ```js + * await scanner.showVideo(); + * await scanner.hide(); + * ``` + * @category Open and Close + */ + hide(): Promise; + /** + * Destroy the `BarcodeScanner` instance. If your page needs to create new instances from time to time, don't forget to destroy unused old instances, otherwise it will cause memory leaks. + * @category Initialize and Destroy + */ + destroy(): Promise; +} +declare enum EnumBarcodeColourMode { + BICM_DARK_ON_LIGHT = 1, + BICM_LIGHT_ON_DARK = 2, + BICM_DARK_ON_DARK = 4, + BICM_LIGHT_ON_LIGHT = 8, + BICM_DARK_LIGHT_MIXED = 16, + BICM_DARK_ON_LIGHT_DARK_SURROUNDING = 32, + BICM_SKIP = 0, + BICM_REV = 2147483648 +} +declare enum EnumBarcodeComplementMode { + BCM_AUTO = 1, + BCM_GENERAL = 2, + BCM_SKIP = 0, + BCM_REV = 2147483648 +} +declare enum EnumClarityCalculationMethod { + ECCM_CONTRAST = 1 +} +declare enum EnumClarityFilterMode { + CFM_GENERAL = 1 +} +declare enum EnumColourClusteringMode { + CCM_AUTO = 1, + CCM_GENERAL_HSV = 2, + CCM_SKIP = 0, + CCM_REV = 2147483648 +} +declare enum EnumColourConversionMode { + CICM_GENERAL = 1, + CICM_SKIP = 0, + CICM_REV = 2147483648 +} +declare enum EnumConflictMode { + CM_IGNORE = 1, + CM_OVERWRITE = 2 +} +declare enum EnumDeblurMode { + DM_SKIP = 0, + DM_DIRECT_BINARIZATION = 1, + DM_THRESHOLD_BINARIZATION = 2, + DM_GRAY_EQUALIZATION = 4, + DM_SMOOTHING = 8, + DM_MORPHING = 16, + DM_DEEP_ANALYSIS = 32, + DM_SHARPENING = 64, + DM_BASED_ON_LOC_BIN = 128, + DM_SHARPENING_SMOOTHING = 256 +} +declare enum EnumDeformationResistingMode { + DRM_AUTO = 1, + DRM_GENERAL = 2, + DRM_SKIP = 0, + DRM_REV = 2147483648 +} +declare enum EnumDPMCodeReadingMode { + DPMCRM_AUTO = 1, + DPMCRM_GENERAL = 2, + DPMCRM_SKIP = 0, + DPMCRM_REV = 2147483648 +} +declare enum EnumGrayscaleTransformationMode { + GTM_INVERTED = 1, + GTM_ORIGINAL = 2, + GTM_SKIP = 0, + GTM_REV = 2147483648 +} +declare enum EnumImagePreprocessingMode { + IPM_AUTO = 1, + IPM_GENERAL = 2, + IPM_GRAY_EQUALIZE = 4, + IPM_GRAY_SMOOTH = 8, + IPM_SHARPEN_SMOOTH = 16, + IPM_MORPHOLOGY = 32, + IPM_SKIP = 0, + IPM_REV = 2147483648 +} +declare enum EnumIMResultDataType { + IMRDT_IMAGE = 1, + IMRDT_CONTOUR = 2, + IMRDT_LINESEGMENT = 4, + IMRDT_LOCALIZATIONRESULT = 8, + IMRDT_REGIONOFINTEREST = 16, + IMRDT_QUADRILATERAL = 32 +} +declare enum EnumIntermediateResultSavingMode { + IRSM_MEMORY = 1, + IRSM_FILESYSTEM = 2, + IRSM_BOTH = 4 +} +declare enum EnumQRCodeErrorCorrectionLevel { + QRECL_ERROR_CORRECTION_H = 0, + QRECL_ERROR_CORRECTION_L = 1, + QRECL_ERROR_CORRECTION_M = 2, + QRECL_ERROR_CORRECTION_Q = 3 +} +declare enum EnumRegionPredetectionMode { + RPM_AUTO = 1, + RPM_GENERAL = 2, + RPM_GENERAL_RGB_CONTRAST = 4, + RPM_GENERAL_GRAY_CONTRAST = 8, + RPM_GENERAL_HSV_CONTRAST = 16, + RPM_SKIP = 0, + RPM_REV = 2147483648 +} +declare enum EnumResultType { + RT_STANDARD_TEXT = 0, + RT_RAW_TEXT = 1, + RT_CANDIDATE_TEXT = 2, + RT_PARTIAL_TEXT = 3 +} +declare enum EnumTextFilterMode { + TFM_AUTO = 1, + TFM_GENERAL_CONTOUR = 2, + TFM_SKIP = 0, + TFM_REV = 2147483648 +} +declare enum EnumTextureDetectionMode { + TDM_AUTO = 1, + TDM_GENERAL_WIDTH_CONCENTRATION = 2, + TDM_SKIP = 0, + TDM_REV = 2147483648 +} +declare class DBR { + /** + * The `BarcodeReader` class is used for image decoding + * Comparing to `BarcodeScanner`, the default decoding settings are more accurate but slower. + * ```js + * let pReader = null; + * (async()=>{ + * let reader = await (pReader = pReader || Dynamsoft.DBR.BarcodeReader.createInstance()); + * let results = await reader.decode(imageSource); + * for(let result of results){ + * console.log(result.barcodeText); + * } + * })(); + * ``` + */ + static BarcodeReader: typeof BarcodeReader; + /** + * The `BarcodeScanner` class is used for video decoding. + * ```js + * let pScanner = null; + * (async()=>{ + * let scanner = await (pScanner = pScanner || Dynamsoft.DBR.BarcodeScanner.createInstance()); + * scanner.onUnduplicatedRead = txt => console.log(txt); + * await scanner.show(); + * })(); + * ``` + */ + static BarcodeScanner: typeof BarcodeScanner; + static EnumBarcodeColourMode: typeof EnumBarcodeColourMode; + static EnumBarcodeComplementMode: typeof EnumBarcodeComplementMode; + static EnumBarcodeFormat: typeof EnumBarcodeFormat; + static EnumBarcodeFormat_2: typeof EnumBarcodeFormat_2; + static EnumBinarizationMode: typeof EnumBinarizationMode; + static EnumClarityCalculationMethod: typeof EnumClarityCalculationMethod; + static EnumClarityFilterMode: typeof EnumClarityFilterMode; + static EnumColourClusteringMode: typeof EnumColourClusteringMode; + static EnumColourConversionMode: typeof EnumColourConversionMode; + static EnumConflictMode: typeof EnumConflictMode; + static EnumDeblurMode: typeof EnumDeblurMode; + static EnumDeformationResistingMode: typeof EnumDeformationResistingMode; + static EnumDPMCodeReadingMode: typeof EnumDPMCodeReadingMode; + static EnumErrorCode: typeof EnumErrorCode; + static EnumGrayscaleTransformationMode: typeof EnumGrayscaleTransformationMode; + static EnumImagePixelFormat: typeof EnumImagePixelFormat; + static EnumImagePreprocessingMode: typeof EnumImagePreprocessingMode; + static EnumIMResultDataType: typeof EnumIMResultDataType; + static EnumIntermediateResultSavingMode: typeof EnumIntermediateResultSavingMode; + static EnumIntermediateResultType: typeof EnumIntermediateResultType; + static EnumLocalizationMode: typeof EnumLocalizationMode; + static EnumPDFReadingMode: typeof EnumPDFReadingMode; + static EnumQRCodeErrorCorrectionLevel: typeof EnumQRCodeErrorCorrectionLevel; + static EnumRegionPredetectionMode: typeof EnumRegionPredetectionMode; + static EnumResultCoordinateType: typeof EnumResultCoordinateType; + static EnumResultType: typeof EnumResultType; + static EnumScaleUpMode: typeof EnumScaleUpMode; + static EnumTerminatePhase: typeof EnumTerminatePhase; + static EnumTextFilterMode: typeof EnumTextFilterMode; + static EnumTextResultOrderMode: typeof EnumTextResultOrderMode; + static EnumTextureDetectionMode: typeof EnumTextureDetectionMode; + /** + * Get the current version. + */ + static get version(): string; + static get productKeys(): string; + /** + * Get or set the Dynamsoft Barcode Reader SDK product keys. + * ```js + * Dynamsoft.DBR.productKeys = "PRODUCT-KEYS"; + * ``` + * For convenience, you can set `productKeys` in `script` tag instead. + * ```html + * + * ``` + */ + static set productKeys(keys: string); + static get handshakeCode(): string; + /** + * Get or set the Dynamsoft Barcode Reader SDK handshake code. The `handshakeCode` is an alias of `productKeys`. Specifically refers to the key that requires **network** authentication. + * ```js + * Dynamsoft.DBR.handshakeCode = "123****-mytest"; + * ``` + * For convenience, you can set `handshakeCode` in `script` tag instead. + * ```html + * + * ``` + */ + static set handshakeCode(keys: string); + static get organizationID(): string; + /** + * Use organization ID to get authentication from network. Keep handshakeCode empty if you want to use default `handshake` of the organization. + * ```js + * Dynamsoft.DBR.organizationID = "123****"; + * ``` + * For convenience, you can set `organizationID` in `script` tag instead. + * ```html + * + * ``` + * @see [[handshakeCode]] + */ + static set organizationID(keys: string); + static get sessionPassword(): string; + /** + * Specify a password to protect the `Handshake Code` from abuse. + * ```js + * Dynamsoft.DBR.handshakeCode = "123****-mytest"; + * Dynamsoft.DBR.sessionPassword = "@#$%****"; + * ``` + * Since js in the browser is plaintext, it is not safe to set a password. It is recommended that you bind the `domain` as `Validation field` in the [handshake settings in dynamsoft website](https://www.dynamsoft.com/lts/index.html#/handshakeCodes) or your self-hosted license server. + * + * In nodejs, password is meaningful. + * @see [[handshakeCode]] + */ + static set sessionPassword(keys: string); + /** @ignore */ + static get browserInfo(): any; + /** + * Detect environment and get a report. + * ```js + * console.log(Dynamsoft.DBR.detectEnvironment()); + * // {"wasm":true, "worker":true, "getUserMedia":true, "camera":true, "browser":"Chrome", "version":90, "OS":"Windows"} + * ``` + */ + static detectEnvironment(): Promise; + /** @ignore */ + static get _workerName(): string; + /** @ignore */ + static set _workerName(name: string); + static get engineResourcePath(): string; + /** + * Specify the Barcode Reader SDK engine (WASM) url. The SDK tries to automatically explore the engine location. + * If the auto-explored engine location is incorrect, you can manually specify the engine location. + * The property needs to be set before [[loadWasm]]. + * ```js + * Dynamsoft.DBR.engineResourcePath = "https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@8.6.0/dist/"; + * await Dynamsoft.DBR.loadWasm(); + * ``` + */ + static set engineResourcePath(value: string); + static get licenseServer(): string[] | string; + /** + * Specify the license server URL. + */ + static set licenseServer(value: string[] | string); + /** @ignore */ + static get deviceFriendlyName(): string; + /** @ignore */ + static set deviceFriendlyName(value: string); + /** @ignore */ + static get _onLog(): (message: any) => void; + /** @ignore */ + static set _onLog(value: (message: any) => void); + /** @ignore */ + static get _bWasmDebug(): boolean; + /** @ignore */ + static set _bWasmDebug(value: boolean); + /** @ignore */ + static get _bUseFullFeature(): boolean; + /** @ignore */ + static set _bUseFullFeature(value: boolean); + /** @ignore */ + static get _dbrWorker(): Worker; + /** @ignore */ + static isLoaded(): boolean; + /** + * Check if the decoding module is loaded. + */ + static isWasmLoaded(): boolean; + /** + * Before most operations, `loadWasm` needs to be excuted firstly. + * Most time, you do not need excute `loadWasm` manually. Because when you excute [[createInstance]], `loadWasm` will be excuted implicitly. + * Some properties can't be changed after `loadWasm`. + * Calling `loadWasm` in advance can avoid the long wait when `createInstance`. + * ```js + * window.addEventListener('DOMContentLoaded', (event) => { + * DBR.loadWasm(); + * }); + * ``` + */ + static loadWasm(): Promise; +} + + + + +declare var Dynamsoft:{ + DBR: typeof DBR; +} diff --git a/dist/dbr.scanner.html b/dist/dbr.scanner.html new file mode 100644 index 00000000..18366868 --- /dev/null +++ b/dist/dbr.scanner.html @@ -0,0 +1,114 @@ +
+ + + + +
+ +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + +
+
+ \ No newline at end of file diff --git a/dist/dls.license.dialog.html b/dist/dls.license.dialog.html new file mode 100644 index 00000000..740dba1a --- /dev/null +++ b/dist/dls.license.dialog.html @@ -0,0 +1,20 @@ + +
+
+
+ + + x +
+
+
+
+ \ No newline at end of file diff --git a/doc/Api Reference.url b/doc/Api Reference.url new file mode 100644 index 00000000..c790c25c --- /dev/null +++ b/doc/Api Reference.url @@ -0,0 +1,2 @@ +[InternetShortcut] +URL=https://www.dynamsoft.com/help/Barcode-Reader-WASM/ \ No newline at end of file diff --git a/doc/License Agreement.url b/doc/License Agreement.url new file mode 100644 index 00000000..baed566c --- /dev/null +++ b/doc/License Agreement.url @@ -0,0 +1,2 @@ +[InternetShortcut] +URL=https://www.dynamsoft.com/Products/barcode-reader-license-agreement.aspx#javascript \ No newline at end of file diff --git a/doc/api reference/assets/css/main.css b/doc/api reference/assets/css/main.css new file mode 100644 index 00000000..959edd73 --- /dev/null +++ b/doc/api reference/assets/css/main.css @@ -0,0 +1,2679 @@ +/*! normalize.css v1.1.3 | MIT License | git.io/normalize */ +/* ========================================================================== + * * HTML5 display definitions + * * ========================================================================== */ +/** + * * Correct `block` display not defined in IE 6/7/8/9 and Firefox 3. */ +article, aside, details, figcaption, figure, footer, header, hgroup, main, nav, section, summary { + display: block; +} + +/** + * * Correct `inline-block` display not defined in IE 6/7/8/9 and Firefox 3. */ +audio, canvas, video { + display: inline-block; + *display: inline; + *zoom: 1; +} + +/** + * * Prevent modern browsers from displaying `audio` without controls. + * * Remove excess height in iOS 5 devices. */ +audio:not([controls]) { + display: none; + height: 0; +} + +/** + * * Address styling not present in IE 7/8/9, Firefox 3, and Safari 4. + * * Known issue: no IE 6 support. */ +[hidden] { + display: none; +} + +/* ========================================================================== + * * Base + * * ========================================================================== */ +/** + * * 1. Correct text resizing oddly in IE 6/7 when body `font-size` is set using + * * `em` units. + * * 2. Prevent iOS text size adjust after orientation change, without disabling + * * user zoom. */ +html { + font-size: 100%; + /* 1 */ + -ms-text-size-adjust: 100%; + /* 2 */ + -webkit-text-size-adjust: 100%; + /* 2 */ + font-family: sans-serif; +} + +/** + * * Address `font-family` inconsistency between `textarea` and other form + * * elements. */ +button, input, select, textarea { + font-family: sans-serif; +} + +/** + * * Address margins handled incorrectly in IE 6/7. */ +body { + margin: 0; +} + +/* ========================================================================== + * * Links + * * ========================================================================== */ +/** + * * Address `outline` inconsistency between Chrome and other browsers. */ +a:focus { + outline: thin dotted; +} +a:active, a:hover { + outline: 0; +} + +/** + * * Improve readability when focused and also mouse hovered in all browsers. */ +/* ========================================================================== + * * Typography + * * ========================================================================== */ +/** + * * Address font sizes and margins set differently in IE 6/7. + * * Address font sizes within `section` and `article` in Firefox 4+, Safari 5, + * * and Chrome. */ +h1 { + font-size: 2em; + margin: 0.67em 0; +} + +h2 { + font-size: 1.5em; + margin: 0.83em 0; +} + +h3 { + font-size: 1.17em; + margin: 1em 0; +} + +h4, .tsd-index-panel h3 { + font-size: 1em; + margin: 1.33em 0; +} + +h5 { + font-size: 0.83em; + margin: 1.67em 0; +} + +h6 { + font-size: 0.67em; + margin: 2.33em 0; +} + +/** + * * Address styling not present in IE 7/8/9, Safari 5, and Chrome. */ +abbr[title] { + border-bottom: 1px dotted; +} + +/** + * * Address style set to `bolder` in Firefox 3+, Safari 4/5, and Chrome. */ +b, strong { + font-weight: bold; +} + +blockquote { + margin: 1em 40px; +} + +/** + * * Address styling not present in Safari 5 and Chrome. */ +dfn { + font-style: italic; +} + +/** + * * Address differences between Firefox and other browsers. + * * Known issue: no IE 6/7 normalization. */ +hr { + box-sizing: content-box; + height: 0; +} + +/** + * * Address styling not present in IE 6/7/8/9. */ +mark { + background: #ff0; + color: #000; +} + +/** + * * Address margins set differently in IE 6/7. */ +p, pre { + margin: 1em 0; +} + +/** + * * Correct font family set oddly in IE 6, Safari 4/5, and Chrome. */ +code, kbd, pre, samp { + font-family: monospace, serif; + _font-family: "courier new", monospace; + font-size: 1em; +} + +/** + * * Improve readability of pre-formatted text in all browsers. */ +pre { + white-space: pre; + white-space: pre-wrap; + word-wrap: break-word; +} + +/** + * * Address CSS quotes not supported in IE 6/7. */ +q { + quotes: none; +} +q:before, q:after { + content: ""; + content: none; +} + +/** + * * Address `quotes` property not supported in Safari 4. */ +/** + * * Address inconsistent and variable font size in all browsers. */ +small { + font-size: 80%; +} + +/** + * * Prevent `sub` and `sup` affecting `line-height` in all browsers. */ +sub { + font-size: 75%; + line-height: 0; + position: relative; + vertical-align: baseline; +} + +sup { + font-size: 75%; + line-height: 0; + position: relative; + vertical-align: baseline; + top: -0.5em; +} + +sub { + bottom: -0.25em; +} + +/* ========================================================================== + * * Lists + * * ========================================================================== */ +/** + * * Address margins set differently in IE 6/7. */ +dl, menu, ol, ul { + margin: 1em 0; +} + +dd { + margin: 0 0 0 40px; +} + +/** + * * Address paddings set differently in IE 6/7. */ +menu, ol, ul { + padding: 0 0 0 40px; +} + +/** + * * Correct list images handled incorrectly in IE 7. */ +nav ul, nav ol { + list-style: none; + list-style-image: none; +} + +/* ========================================================================== + * * Embedded content + * * ========================================================================== */ +/** + * * 1. Remove border when inside `a` element in IE 6/7/8/9 and Firefox 3. + * * 2. Improve image quality when scaled in IE 7. */ +img { + border: 0; + /* 1 */ + -ms-interpolation-mode: bicubic; +} + +/* 2 */ +/** + * * Correct overflow displayed oddly in IE 9. */ +svg:not(:root) { + overflow: hidden; +} + +/* ========================================================================== + * * Figures + * * ========================================================================== */ +/** + * * Address margin not present in IE 6/7/8/9, Safari 5, and Opera 11. */ +figure, form { + margin: 0; +} + +/* ========================================================================== + * * Forms + * * ========================================================================== */ +/** + * * Correct margin displayed oddly in IE 6/7. */ +/** + * * Define consistent border, margin, and padding. */ +fieldset { + border: 1px solid #c0c0c0; + margin: 0 2px; + padding: 0.35em 0.625em 0.75em; +} + +/** + * * 1. Correct color not being inherited in IE 6/7/8/9. + * * 2. Correct text not wrapping in Firefox 3. + * * 3. Correct alignment displayed oddly in IE 6/7. */ +legend { + border: 0; + /* 1 */ + padding: 0; + white-space: normal; + /* 2 */ + *margin-left: -7px; +} + +/* 3 */ +/** + * * 1. Correct font size not being inherited in all browsers. + * * 2. Address margins set differently in IE 6/7, Firefox 3+, Safari 5, + * * and Chrome. + * * 3. Improve appearance and consistency in all browsers. */ +button, input, select, textarea { + font-size: 100%; + /* 1 */ + margin: 0; + /* 2 */ + vertical-align: baseline; + /* 3 */ + *vertical-align: middle; +} + +/* 3 */ +/** + * * Address Firefox 3+ setting `line-height` on `input` using `!important` in + * * the UA stylesheet. */ +button, input { + line-height: normal; +} + +/** + * * Address inconsistent `text-transform` inheritance for `button` and `select`. + * * All other form control elements do not inherit `text-transform` values. + * * Correct `button` style inheritance in Chrome, Safari 5+, and IE 6+. + * * Correct `select` style inheritance in Firefox 4+ and Opera. */ +button, select { + text-transform: none; +} + +/** + * * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio` + * * and `video` controls. + * * 2. Correct inability to style clickable `input` types in iOS. + * * 3. Improve usability and consistency of cursor style between image-type + * * `input` and others. + * * 4. Remove inner spacing in IE 7 without affecting normal text inputs. + * * Known issue: inner spacing remains in IE 6. */ +button, html input[type=button] { + -webkit-appearance: button; + /* 2 */ + cursor: pointer; + /* 3 */ + *overflow: visible; +} + +/* 4 */ +input[type=reset], input[type=submit] { + -webkit-appearance: button; + /* 2 */ + cursor: pointer; + /* 3 */ + *overflow: visible; +} + +/* 4 */ +/** + * * Re-set default cursor for disabled elements. */ +button[disabled], html input[disabled] { + cursor: default; +} + +/** + * * 1. Address box sizing set to content-box in IE 8/9. + * * 2. Remove excess padding in IE 8/9. + * * 3. Remove excess padding in IE 7. + * * Known issue: excess padding remains in IE 6. */ +input { + /* 3 */ +} +input[type=checkbox], input[type=radio] { + box-sizing: border-box; + /* 1 */ + padding: 0; + /* 2 */ + *height: 13px; + /* 3 */ + *width: 13px; +} +input[type=search] { + -webkit-appearance: textfield; + /* 1 */ + /* 2 */ + box-sizing: content-box; +} +input[type=search]::-webkit-search-cancel-button, input[type=search]::-webkit-search-decoration { + -webkit-appearance: none; +} + +/** + * * 1. Address `appearance` set to `searchfield` in Safari 5 and Chrome. + * * 2. Address `box-sizing` set to `border-box` in Safari 5 and Chrome + * * (include `-moz` to future-proof). */ +/** + * * Remove inner padding and search cancel button in Safari 5 and Chrome + * * on OS X. */ +/** + * * Remove inner padding and border in Firefox 3+. */ +button::-moz-focus-inner, input::-moz-focus-inner { + border: 0; + padding: 0; +} + +/** + * * 1. Remove default vertical scrollbar in IE 6/7/8/9. + * * 2. Improve readability and alignment in all browsers. */ +textarea { + overflow: auto; + /* 1 */ + vertical-align: top; +} + +/* 2 */ +/* ========================================================================== + * * Tables + * * ========================================================================== */ +/** + * * Remove most spacing between table cells. */ +table { + border-collapse: collapse; + border-spacing: 0; +} + +/* * + * *Visual Studio-like style based on original C# coloring by Jason Diamond */ +.hljs { + display: inline-block; + padding: 0.5em; + background: white; + color: black; +} + +.hljs-comment, .hljs-annotation, .hljs-template_comment, .diff .hljs-header, .hljs-chunk, .apache .hljs-cbracket { + color: #008000; +} + +.hljs-keyword, .hljs-id, .hljs-built_in, .css .smalltalk .hljs-class, .hljs-winutils, .bash .hljs-variable, .tex .hljs-command, .hljs-request, .hljs-status, .nginx .hljs-title { + color: #00f; +} + +.xml .hljs-tag { + color: #00f; +} +.xml .hljs-tag .hljs-value { + color: #00f; +} + +.hljs-string, .hljs-title, .hljs-parent, .hljs-tag .hljs-value, .hljs-rules .hljs-value { + color: #a31515; +} + +.ruby .hljs-symbol { + color: #a31515; +} +.ruby .hljs-symbol .hljs-string { + color: #a31515; +} + +.hljs-template_tag, .django .hljs-variable, .hljs-addition, .hljs-flow, .hljs-stream, .apache .hljs-tag, .hljs-date, .tex .hljs-formula, .coffeescript .hljs-attribute { + color: #a31515; +} + +.ruby .hljs-string, .hljs-decorator, .hljs-filter .hljs-argument, .hljs-localvars, .hljs-array, .hljs-attr_selector, .hljs-pseudo, .hljs-pi, .hljs-doctype, .hljs-deletion, .hljs-envvar, .hljs-shebang, .hljs-preprocessor, .hljs-pragma, .userType, .apache .hljs-sqbracket, .nginx .hljs-built_in, .tex .hljs-special, .hljs-prompt { + color: #2b91af; +} + +.hljs-phpdoc, .hljs-javadoc, .hljs-xmlDocTag { + color: #808080; +} + +.vhdl .hljs-typename { + font-weight: bold; +} +.vhdl .hljs-string { + color: #666666; +} +.vhdl .hljs-literal { + color: #a31515; +} +.vhdl .hljs-attribute { + color: #00b0e8; +} + +.xml .hljs-attribute { + color: #f00; +} + +ul.tsd-descriptions > li > :first-child, .tsd-panel > :first-child, .col > :first-child, .col-11 > :first-child, .col-10 > :first-child, .col-9 > :first-child, .col-8 > :first-child, .col-7 > :first-child, .col-6 > :first-child, .col-5 > :first-child, .col-4 > :first-child, .col-3 > :first-child, .col-2 > :first-child, .col-1 > :first-child, +ul.tsd-descriptions > li > :first-child > :first-child, +.tsd-panel > :first-child > :first-child, +.col > :first-child > :first-child, +.col-11 > :first-child > :first-child, +.col-10 > :first-child > :first-child, +.col-9 > :first-child > :first-child, +.col-8 > :first-child > :first-child, +.col-7 > :first-child > :first-child, +.col-6 > :first-child > :first-child, +.col-5 > :first-child > :first-child, +.col-4 > :first-child > :first-child, +.col-3 > :first-child > :first-child, +.col-2 > :first-child > :first-child, +.col-1 > :first-child > :first-child, +ul.tsd-descriptions > li > :first-child > :first-child > :first-child, +.tsd-panel > :first-child > :first-child > :first-child, +.col > :first-child > :first-child > :first-child, +.col-11 > :first-child > :first-child > :first-child, +.col-10 > :first-child > :first-child > :first-child, +.col-9 > :first-child > :first-child > :first-child, +.col-8 > :first-child > :first-child > :first-child, +.col-7 > :first-child > :first-child > :first-child, +.col-6 > :first-child > :first-child > :first-child, +.col-5 > :first-child > :first-child > :first-child, +.col-4 > :first-child > :first-child > :first-child, +.col-3 > :first-child > :first-child > :first-child, +.col-2 > :first-child > :first-child > :first-child, +.col-1 > :first-child > :first-child > :first-child { + margin-top: 0; +} +ul.tsd-descriptions > li > :last-child, .tsd-panel > :last-child, .col > :last-child, .col-11 > :last-child, .col-10 > :last-child, .col-9 > :last-child, .col-8 > :last-child, .col-7 > :last-child, .col-6 > :last-child, .col-5 > :last-child, .col-4 > :last-child, .col-3 > :last-child, .col-2 > :last-child, .col-1 > :last-child, +ul.tsd-descriptions > li > :last-child > :last-child, +.tsd-panel > :last-child > :last-child, +.col > :last-child > :last-child, +.col-11 > :last-child > :last-child, +.col-10 > :last-child > :last-child, +.col-9 > :last-child > :last-child, +.col-8 > :last-child > :last-child, +.col-7 > :last-child > :last-child, +.col-6 > :last-child > :last-child, +.col-5 > :last-child > :last-child, +.col-4 > :last-child > :last-child, +.col-3 > :last-child > :last-child, +.col-2 > :last-child > :last-child, +.col-1 > :last-child > :last-child, +ul.tsd-descriptions > li > :last-child > :last-child > :last-child, +.tsd-panel > :last-child > :last-child > :last-child, +.col > :last-child > :last-child > :last-child, +.col-11 > :last-child > :last-child > :last-child, +.col-10 > :last-child > :last-child > :last-child, +.col-9 > :last-child > :last-child > :last-child, +.col-8 > :last-child > :last-child > :last-child, +.col-7 > :last-child > :last-child > :last-child, +.col-6 > :last-child > :last-child > :last-child, +.col-5 > :last-child > :last-child > :last-child, +.col-4 > :last-child > :last-child > :last-child, +.col-3 > :last-child > :last-child > :last-child, +.col-2 > :last-child > :last-child > :last-child, +.col-1 > :last-child > :last-child > :last-child { + margin-bottom: 0; +} + +.container { + max-width: 1200px; + margin: 0 auto; + padding: 0 40px; +} +@media (max-width: 640px) { + .container { + padding: 0 20px; + } +} + +.container-main { + padding-bottom: 200px; +} + +.row { + display: -ms-flexbox; + display: flex; + position: relative; + margin: 0 -10px; +} +.row:after { + visibility: hidden; + display: block; + content: ""; + clear: both; + height: 0; +} + +.col, .col-11, .col-10, .col-9, .col-8, .col-7, .col-6, .col-5, .col-4, .col-3, .col-2, .col-1 { + box-sizing: border-box; + float: left; + padding: 0 10px; +} + +.col-1 { + width: 8.3333333333%; +} + +.offset-1 { + margin-left: 8.3333333333%; +} + +.col-2 { + width: 16.6666666667%; +} + +.offset-2 { + margin-left: 16.6666666667%; +} + +.col-3 { + width: 25%; +} + +.offset-3 { + margin-left: 25%; +} + +.col-4 { + width: 33.3333333333%; +} + +.offset-4 { + margin-left: 33.3333333333%; +} + +.col-5 { + width: 41.6666666667%; +} + +.offset-5 { + margin-left: 41.6666666667%; +} + +.col-6 { + width: 50%; +} + +.offset-6 { + margin-left: 50%; +} + +.col-7 { + width: 58.3333333333%; +} + +.offset-7 { + margin-left: 58.3333333333%; +} + +.col-8 { + width: 66.6666666667%; +} + +.offset-8 { + margin-left: 66.6666666667%; +} + +.col-9 { + width: 75%; +} + +.offset-9 { + margin-left: 75%; +} + +.col-10 { + width: 83.3333333333%; +} + +.offset-10 { + margin-left: 83.3333333333%; +} + +.col-11 { + width: 91.6666666667%; +} + +.offset-11 { + margin-left: 91.6666666667%; +} + +.tsd-kind-icon { + display: block; + position: relative; + padding-left: 20px; + text-indent: -20px; +} +.tsd-kind-icon:before { + content: ""; + display: inline-block; + vertical-align: middle; + width: 17px; + height: 17px; + margin: 0 3px 2px 0; + background-image: url(../images/icons.png); +} +@media (-webkit-min-device-pixel-ratio: 1.5), (min-resolution: 144dpi) { + .tsd-kind-icon:before { + background-image: url(../images/icons@2x.png); + background-size: 238px 204px; + } +} + +.tsd-signature.tsd-kind-icon:before { + background-position: 0 -153px; +} + +.tsd-kind-object-literal > .tsd-kind-icon:before { + background-position: 0px -17px; +} +.tsd-kind-object-literal.tsd-is-protected > .tsd-kind-icon:before { + background-position: -17px -17px; +} +.tsd-kind-object-literal.tsd-is-private > .tsd-kind-icon:before { + background-position: -34px -17px; +} + +.tsd-kind-class > .tsd-kind-icon:before { + background-position: 0px -34px; +} +.tsd-kind-class.tsd-is-protected > .tsd-kind-icon:before { + background-position: -17px -34px; +} +.tsd-kind-class.tsd-is-private > .tsd-kind-icon:before { + background-position: -34px -34px; +} + +.tsd-kind-class.tsd-has-type-parameter > .tsd-kind-icon:before { + background-position: 0px -51px; +} +.tsd-kind-class.tsd-has-type-parameter.tsd-is-protected > .tsd-kind-icon:before { + background-position: -17px -51px; +} +.tsd-kind-class.tsd-has-type-parameter.tsd-is-private > .tsd-kind-icon:before { + background-position: -34px -51px; +} + +.tsd-kind-interface > .tsd-kind-icon:before { + background-position: 0px -68px; +} +.tsd-kind-interface.tsd-is-protected > .tsd-kind-icon:before { + background-position: -17px -68px; +} +.tsd-kind-interface.tsd-is-private > .tsd-kind-icon:before { + background-position: -34px -68px; +} + +.tsd-kind-interface.tsd-has-type-parameter > .tsd-kind-icon:before { + background-position: 0px -85px; +} +.tsd-kind-interface.tsd-has-type-parameter.tsd-is-protected > .tsd-kind-icon:before { + background-position: -17px -85px; +} +.tsd-kind-interface.tsd-has-type-parameter.tsd-is-private > .tsd-kind-icon:before { + background-position: -34px -85px; +} + +.tsd-kind-namespace > .tsd-kind-icon:before { + background-position: 0px -102px; +} +.tsd-kind-namespace.tsd-is-protected > .tsd-kind-icon:before { + background-position: -17px -102px; +} +.tsd-kind-namespace.tsd-is-private > .tsd-kind-icon:before { + background-position: -34px -102px; +} + +.tsd-kind-module > .tsd-kind-icon:before { + background-position: 0px -102px; +} +.tsd-kind-module.tsd-is-protected > .tsd-kind-icon:before { + background-position: -17px -102px; +} +.tsd-kind-module.tsd-is-private > .tsd-kind-icon:before { + background-position: -34px -102px; +} + +.tsd-kind-enum > .tsd-kind-icon:before { + background-position: 0px -119px; +} +.tsd-kind-enum.tsd-is-protected > .tsd-kind-icon:before { + background-position: -17px -119px; +} +.tsd-kind-enum.tsd-is-private > .tsd-kind-icon:before { + background-position: -34px -119px; +} + +.tsd-kind-enum-member > .tsd-kind-icon:before { + background-position: 0px -136px; +} +.tsd-kind-enum-member.tsd-is-protected > .tsd-kind-icon:before { + background-position: -17px -136px; +} +.tsd-kind-enum-member.tsd-is-private > .tsd-kind-icon:before { + background-position: -34px -136px; +} + +.tsd-kind-signature > .tsd-kind-icon:before { + background-position: 0px -153px; +} +.tsd-kind-signature.tsd-is-protected > .tsd-kind-icon:before { + background-position: -17px -153px; +} +.tsd-kind-signature.tsd-is-private > .tsd-kind-icon:before { + background-position: -34px -153px; +} + +.tsd-kind-type-alias > .tsd-kind-icon:before { + background-position: 0px -170px; +} +.tsd-kind-type-alias.tsd-is-protected > .tsd-kind-icon:before { + background-position: -17px -170px; +} +.tsd-kind-type-alias.tsd-is-private > .tsd-kind-icon:before { + background-position: -34px -170px; +} + +.tsd-kind-type-alias.tsd-has-type-parameter > .tsd-kind-icon:before { + background-position: 0px -187px; +} +.tsd-kind-type-alias.tsd-has-type-parameter.tsd-is-protected > .tsd-kind-icon:before { + background-position: -17px -187px; +} +.tsd-kind-type-alias.tsd-has-type-parameter.tsd-is-private > .tsd-kind-icon:before { + background-position: -34px -187px; +} + +.tsd-kind-variable > .tsd-kind-icon:before { + background-position: -136px -0px; +} +.tsd-kind-variable.tsd-is-protected > .tsd-kind-icon:before { + background-position: -153px -0px; +} +.tsd-kind-variable.tsd-is-private > .tsd-kind-icon:before { + background-position: -119px -0px; +} +.tsd-kind-variable.tsd-parent-kind-class > .tsd-kind-icon:before { + background-position: -51px -0px; +} +.tsd-kind-variable.tsd-parent-kind-class.tsd-is-inherited > .tsd-kind-icon:before { + background-position: -68px -0px; +} +.tsd-kind-variable.tsd-parent-kind-class.tsd-is-protected > .tsd-kind-icon:before { + background-position: -85px -0px; +} +.tsd-kind-variable.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited > .tsd-kind-icon:before { + background-position: -102px -0px; +} +.tsd-kind-variable.tsd-parent-kind-class.tsd-is-private > .tsd-kind-icon:before { + background-position: -119px -0px; +} +.tsd-kind-variable.tsd-parent-kind-enum > .tsd-kind-icon:before { + background-position: -170px -0px; +} +.tsd-kind-variable.tsd-parent-kind-enum.tsd-is-protected > .tsd-kind-icon:before { + background-position: -187px -0px; +} +.tsd-kind-variable.tsd-parent-kind-enum.tsd-is-private > .tsd-kind-icon:before { + background-position: -119px -0px; +} +.tsd-kind-variable.tsd-parent-kind-interface > .tsd-kind-icon:before { + background-position: -204px -0px; +} +.tsd-kind-variable.tsd-parent-kind-interface.tsd-is-inherited > .tsd-kind-icon:before { + background-position: -221px -0px; +} + +.tsd-kind-property > .tsd-kind-icon:before { + background-position: -136px -0px; +} +.tsd-kind-property.tsd-is-protected > .tsd-kind-icon:before { + background-position: -153px -0px; +} +.tsd-kind-property.tsd-is-private > .tsd-kind-icon:before { + background-position: -119px -0px; +} +.tsd-kind-property.tsd-parent-kind-class > .tsd-kind-icon:before { + background-position: -51px -0px; +} +.tsd-kind-property.tsd-parent-kind-class.tsd-is-inherited > .tsd-kind-icon:before { + background-position: -68px -0px; +} +.tsd-kind-property.tsd-parent-kind-class.tsd-is-protected > .tsd-kind-icon:before { + background-position: -85px -0px; +} +.tsd-kind-property.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited > .tsd-kind-icon:before { + background-position: -102px -0px; +} +.tsd-kind-property.tsd-parent-kind-class.tsd-is-private > .tsd-kind-icon:before { + background-position: -119px -0px; +} +.tsd-kind-property.tsd-parent-kind-enum > .tsd-kind-icon:before { + background-position: -170px -0px; +} +.tsd-kind-property.tsd-parent-kind-enum.tsd-is-protected > .tsd-kind-icon:before { + background-position: -187px -0px; +} +.tsd-kind-property.tsd-parent-kind-enum.tsd-is-private > .tsd-kind-icon:before { + background-position: -119px -0px; +} +.tsd-kind-property.tsd-parent-kind-interface > .tsd-kind-icon:before { + background-position: -204px -0px; +} +.tsd-kind-property.tsd-parent-kind-interface.tsd-is-inherited > .tsd-kind-icon:before { + background-position: -221px -0px; +} + +.tsd-kind-get-signature > .tsd-kind-icon:before { + background-position: -136px -17px; +} +.tsd-kind-get-signature.tsd-is-protected > .tsd-kind-icon:before { + background-position: -153px -17px; +} +.tsd-kind-get-signature.tsd-is-private > .tsd-kind-icon:before { + background-position: -119px -17px; +} +.tsd-kind-get-signature.tsd-parent-kind-class > .tsd-kind-icon:before { + background-position: -51px -17px; +} +.tsd-kind-get-signature.tsd-parent-kind-class.tsd-is-inherited > .tsd-kind-icon:before { + background-position: -68px -17px; +} +.tsd-kind-get-signature.tsd-parent-kind-class.tsd-is-protected > .tsd-kind-icon:before { + background-position: -85px -17px; +} +.tsd-kind-get-signature.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited > .tsd-kind-icon:before { + background-position: -102px -17px; +} +.tsd-kind-get-signature.tsd-parent-kind-class.tsd-is-private > .tsd-kind-icon:before { + background-position: -119px -17px; +} +.tsd-kind-get-signature.tsd-parent-kind-enum > .tsd-kind-icon:before { + background-position: -170px -17px; +} +.tsd-kind-get-signature.tsd-parent-kind-enum.tsd-is-protected > .tsd-kind-icon:before { + background-position: -187px -17px; +} +.tsd-kind-get-signature.tsd-parent-kind-enum.tsd-is-private > .tsd-kind-icon:before { + background-position: -119px -17px; +} +.tsd-kind-get-signature.tsd-parent-kind-interface > .tsd-kind-icon:before { + background-position: -204px -17px; +} +.tsd-kind-get-signature.tsd-parent-kind-interface.tsd-is-inherited > .tsd-kind-icon:before { + background-position: -221px -17px; +} + +.tsd-kind-set-signature > .tsd-kind-icon:before { + background-position: -136px -34px; +} +.tsd-kind-set-signature.tsd-is-protected > .tsd-kind-icon:before { + background-position: -153px -34px; +} +.tsd-kind-set-signature.tsd-is-private > .tsd-kind-icon:before { + background-position: -119px -34px; +} +.tsd-kind-set-signature.tsd-parent-kind-class > .tsd-kind-icon:before { + background-position: -51px -34px; +} +.tsd-kind-set-signature.tsd-parent-kind-class.tsd-is-inherited > .tsd-kind-icon:before { + background-position: -68px -34px; +} +.tsd-kind-set-signature.tsd-parent-kind-class.tsd-is-protected > .tsd-kind-icon:before { + background-position: -85px -34px; +} +.tsd-kind-set-signature.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited > .tsd-kind-icon:before { + background-position: -102px -34px; +} +.tsd-kind-set-signature.tsd-parent-kind-class.tsd-is-private > .tsd-kind-icon:before { + background-position: -119px -34px; +} +.tsd-kind-set-signature.tsd-parent-kind-enum > .tsd-kind-icon:before { + background-position: -170px -34px; +} +.tsd-kind-set-signature.tsd-parent-kind-enum.tsd-is-protected > .tsd-kind-icon:before { + background-position: -187px -34px; +} +.tsd-kind-set-signature.tsd-parent-kind-enum.tsd-is-private > .tsd-kind-icon:before { + background-position: -119px -34px; +} +.tsd-kind-set-signature.tsd-parent-kind-interface > .tsd-kind-icon:before { + background-position: -204px -34px; +} +.tsd-kind-set-signature.tsd-parent-kind-interface.tsd-is-inherited > .tsd-kind-icon:before { + background-position: -221px -34px; +} + +.tsd-kind-accessor > .tsd-kind-icon:before { + background-position: -136px -51px; +} +.tsd-kind-accessor.tsd-is-protected > .tsd-kind-icon:before { + background-position: -153px -51px; +} +.tsd-kind-accessor.tsd-is-private > .tsd-kind-icon:before { + background-position: -119px -51px; +} +.tsd-kind-accessor.tsd-parent-kind-class > .tsd-kind-icon:before { + background-position: -51px -51px; +} +.tsd-kind-accessor.tsd-parent-kind-class.tsd-is-inherited > .tsd-kind-icon:before { + background-position: -68px -51px; +} +.tsd-kind-accessor.tsd-parent-kind-class.tsd-is-protected > .tsd-kind-icon:before { + background-position: -85px -51px; +} +.tsd-kind-accessor.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited > .tsd-kind-icon:before { + background-position: -102px -51px; +} +.tsd-kind-accessor.tsd-parent-kind-class.tsd-is-private > .tsd-kind-icon:before { + background-position: -119px -51px; +} +.tsd-kind-accessor.tsd-parent-kind-enum > .tsd-kind-icon:before { + background-position: -170px -51px; +} +.tsd-kind-accessor.tsd-parent-kind-enum.tsd-is-protected > .tsd-kind-icon:before { + background-position: -187px -51px; +} +.tsd-kind-accessor.tsd-parent-kind-enum.tsd-is-private > .tsd-kind-icon:before { + background-position: -119px -51px; +} +.tsd-kind-accessor.tsd-parent-kind-interface > .tsd-kind-icon:before { + background-position: -204px -51px; +} +.tsd-kind-accessor.tsd-parent-kind-interface.tsd-is-inherited > .tsd-kind-icon:before { + background-position: -221px -51px; +} + +.tsd-kind-function > .tsd-kind-icon:before { + background-position: -136px -68px; +} +.tsd-kind-function.tsd-is-protected > .tsd-kind-icon:before { + background-position: -153px -68px; +} +.tsd-kind-function.tsd-is-private > .tsd-kind-icon:before { + background-position: -119px -68px; +} +.tsd-kind-function.tsd-parent-kind-class > .tsd-kind-icon:before { + background-position: -51px -68px; +} +.tsd-kind-function.tsd-parent-kind-class.tsd-is-inherited > .tsd-kind-icon:before { + background-position: -68px -68px; +} +.tsd-kind-function.tsd-parent-kind-class.tsd-is-protected > .tsd-kind-icon:before { + background-position: -85px -68px; +} +.tsd-kind-function.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited > .tsd-kind-icon:before { + background-position: -102px -68px; +} +.tsd-kind-function.tsd-parent-kind-class.tsd-is-private > .tsd-kind-icon:before { + background-position: -119px -68px; +} +.tsd-kind-function.tsd-parent-kind-enum > .tsd-kind-icon:before { + background-position: -170px -68px; +} +.tsd-kind-function.tsd-parent-kind-enum.tsd-is-protected > .tsd-kind-icon:before { + background-position: -187px -68px; +} +.tsd-kind-function.tsd-parent-kind-enum.tsd-is-private > .tsd-kind-icon:before { + background-position: -119px -68px; +} +.tsd-kind-function.tsd-parent-kind-interface > .tsd-kind-icon:before { + background-position: -204px -68px; +} +.tsd-kind-function.tsd-parent-kind-interface.tsd-is-inherited > .tsd-kind-icon:before { + background-position: -221px -68px; +} + +.tsd-kind-method > .tsd-kind-icon:before { + background-position: -136px -68px; +} +.tsd-kind-method.tsd-is-protected > .tsd-kind-icon:before { + background-position: -153px -68px; +} +.tsd-kind-method.tsd-is-private > .tsd-kind-icon:before { + background-position: -119px -68px; +} +.tsd-kind-method.tsd-parent-kind-class > .tsd-kind-icon:before { + background-position: -51px -68px; +} +.tsd-kind-method.tsd-parent-kind-class.tsd-is-inherited > .tsd-kind-icon:before { + background-position: -68px -68px; +} +.tsd-kind-method.tsd-parent-kind-class.tsd-is-protected > .tsd-kind-icon:before { + background-position: -85px -68px; +} +.tsd-kind-method.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited > .tsd-kind-icon:before { + background-position: -102px -68px; +} +.tsd-kind-method.tsd-parent-kind-class.tsd-is-private > .tsd-kind-icon:before { + background-position: -119px -68px; +} +.tsd-kind-method.tsd-parent-kind-enum > .tsd-kind-icon:before { + background-position: -170px -68px; +} +.tsd-kind-method.tsd-parent-kind-enum.tsd-is-protected > .tsd-kind-icon:before { + background-position: -187px -68px; +} +.tsd-kind-method.tsd-parent-kind-enum.tsd-is-private > .tsd-kind-icon:before { + background-position: -119px -68px; +} +.tsd-kind-method.tsd-parent-kind-interface > .tsd-kind-icon:before { + background-position: -204px -68px; +} +.tsd-kind-method.tsd-parent-kind-interface.tsd-is-inherited > .tsd-kind-icon:before { + background-position: -221px -68px; +} + +.tsd-kind-call-signature > .tsd-kind-icon:before { + background-position: -136px -68px; +} +.tsd-kind-call-signature.tsd-is-protected > .tsd-kind-icon:before { + background-position: -153px -68px; +} +.tsd-kind-call-signature.tsd-is-private > .tsd-kind-icon:before { + background-position: -119px -68px; +} +.tsd-kind-call-signature.tsd-parent-kind-class > .tsd-kind-icon:before { + background-position: -51px -68px; +} +.tsd-kind-call-signature.tsd-parent-kind-class.tsd-is-inherited > .tsd-kind-icon:before { + background-position: -68px -68px; +} +.tsd-kind-call-signature.tsd-parent-kind-class.tsd-is-protected > .tsd-kind-icon:before { + background-position: -85px -68px; +} +.tsd-kind-call-signature.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited > .tsd-kind-icon:before { + background-position: -102px -68px; +} +.tsd-kind-call-signature.tsd-parent-kind-class.tsd-is-private > .tsd-kind-icon:before { + background-position: -119px -68px; +} +.tsd-kind-call-signature.tsd-parent-kind-enum > .tsd-kind-icon:before { + background-position: -170px -68px; +} +.tsd-kind-call-signature.tsd-parent-kind-enum.tsd-is-protected > .tsd-kind-icon:before { + background-position: -187px -68px; +} +.tsd-kind-call-signature.tsd-parent-kind-enum.tsd-is-private > .tsd-kind-icon:before { + background-position: -119px -68px; +} +.tsd-kind-call-signature.tsd-parent-kind-interface > .tsd-kind-icon:before { + background-position: -204px -68px; +} +.tsd-kind-call-signature.tsd-parent-kind-interface.tsd-is-inherited > .tsd-kind-icon:before { + background-position: -221px -68px; +} + +.tsd-kind-function.tsd-has-type-parameter > .tsd-kind-icon:before { + background-position: -136px -85px; +} +.tsd-kind-function.tsd-has-type-parameter.tsd-is-protected > .tsd-kind-icon:before { + background-position: -153px -85px; +} +.tsd-kind-function.tsd-has-type-parameter.tsd-is-private > .tsd-kind-icon:before { + background-position: -119px -85px; +} +.tsd-kind-function.tsd-has-type-parameter.tsd-parent-kind-class > .tsd-kind-icon:before { + background-position: -51px -85px; +} +.tsd-kind-function.tsd-has-type-parameter.tsd-parent-kind-class.tsd-is-inherited > .tsd-kind-icon:before { + background-position: -68px -85px; +} +.tsd-kind-function.tsd-has-type-parameter.tsd-parent-kind-class.tsd-is-protected > .tsd-kind-icon:before { + background-position: -85px -85px; +} +.tsd-kind-function.tsd-has-type-parameter.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited > .tsd-kind-icon:before { + background-position: -102px -85px; +} +.tsd-kind-function.tsd-has-type-parameter.tsd-parent-kind-class.tsd-is-private > .tsd-kind-icon:before { + background-position: -119px -85px; +} +.tsd-kind-function.tsd-has-type-parameter.tsd-parent-kind-enum > .tsd-kind-icon:before { + background-position: -170px -85px; +} +.tsd-kind-function.tsd-has-type-parameter.tsd-parent-kind-enum.tsd-is-protected > .tsd-kind-icon:before { + background-position: -187px -85px; +} +.tsd-kind-function.tsd-has-type-parameter.tsd-parent-kind-enum.tsd-is-private > .tsd-kind-icon:before { + background-position: -119px -85px; +} +.tsd-kind-function.tsd-has-type-parameter.tsd-parent-kind-interface > .tsd-kind-icon:before { + background-position: -204px -85px; +} +.tsd-kind-function.tsd-has-type-parameter.tsd-parent-kind-interface.tsd-is-inherited > .tsd-kind-icon:before { + background-position: -221px -85px; +} + +.tsd-kind-method.tsd-has-type-parameter > .tsd-kind-icon:before { + background-position: -136px -85px; +} +.tsd-kind-method.tsd-has-type-parameter.tsd-is-protected > .tsd-kind-icon:before { + background-position: -153px -85px; +} +.tsd-kind-method.tsd-has-type-parameter.tsd-is-private > .tsd-kind-icon:before { + background-position: -119px -85px; +} +.tsd-kind-method.tsd-has-type-parameter.tsd-parent-kind-class > .tsd-kind-icon:before { + background-position: -51px -85px; +} +.tsd-kind-method.tsd-has-type-parameter.tsd-parent-kind-class.tsd-is-inherited > .tsd-kind-icon:before { + background-position: -68px -85px; +} +.tsd-kind-method.tsd-has-type-parameter.tsd-parent-kind-class.tsd-is-protected > .tsd-kind-icon:before { + background-position: -85px -85px; +} +.tsd-kind-method.tsd-has-type-parameter.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited > .tsd-kind-icon:before { + background-position: -102px -85px; +} +.tsd-kind-method.tsd-has-type-parameter.tsd-parent-kind-class.tsd-is-private > .tsd-kind-icon:before { + background-position: -119px -85px; +} +.tsd-kind-method.tsd-has-type-parameter.tsd-parent-kind-enum > .tsd-kind-icon:before { + background-position: -170px -85px; +} +.tsd-kind-method.tsd-has-type-parameter.tsd-parent-kind-enum.tsd-is-protected > .tsd-kind-icon:before { + background-position: -187px -85px; +} +.tsd-kind-method.tsd-has-type-parameter.tsd-parent-kind-enum.tsd-is-private > .tsd-kind-icon:before { + background-position: -119px -85px; +} +.tsd-kind-method.tsd-has-type-parameter.tsd-parent-kind-interface > .tsd-kind-icon:before { + background-position: -204px -85px; +} +.tsd-kind-method.tsd-has-type-parameter.tsd-parent-kind-interface.tsd-is-inherited > .tsd-kind-icon:before { + background-position: -221px -85px; +} + +.tsd-kind-constructor > .tsd-kind-icon:before { + background-position: -136px -102px; +} +.tsd-kind-constructor.tsd-is-protected > .tsd-kind-icon:before { + background-position: -153px -102px; +} +.tsd-kind-constructor.tsd-is-private > .tsd-kind-icon:before { + background-position: -119px -102px; +} +.tsd-kind-constructor.tsd-parent-kind-class > .tsd-kind-icon:before { + background-position: -51px -102px; +} +.tsd-kind-constructor.tsd-parent-kind-class.tsd-is-inherited > .tsd-kind-icon:before { + background-position: -68px -102px; +} +.tsd-kind-constructor.tsd-parent-kind-class.tsd-is-protected > .tsd-kind-icon:before { + background-position: -85px -102px; +} +.tsd-kind-constructor.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited > .tsd-kind-icon:before { + background-position: -102px -102px; +} +.tsd-kind-constructor.tsd-parent-kind-class.tsd-is-private > .tsd-kind-icon:before { + background-position: -119px -102px; +} +.tsd-kind-constructor.tsd-parent-kind-enum > .tsd-kind-icon:before { + background-position: -170px -102px; +} +.tsd-kind-constructor.tsd-parent-kind-enum.tsd-is-protected > .tsd-kind-icon:before { + background-position: -187px -102px; +} +.tsd-kind-constructor.tsd-parent-kind-enum.tsd-is-private > .tsd-kind-icon:before { + background-position: -119px -102px; +} +.tsd-kind-constructor.tsd-parent-kind-interface > .tsd-kind-icon:before { + background-position: -204px -102px; +} +.tsd-kind-constructor.tsd-parent-kind-interface.tsd-is-inherited > .tsd-kind-icon:before { + background-position: -221px -102px; +} + +.tsd-kind-constructor-signature > .tsd-kind-icon:before { + background-position: -136px -102px; +} +.tsd-kind-constructor-signature.tsd-is-protected > .tsd-kind-icon:before { + background-position: -153px -102px; +} +.tsd-kind-constructor-signature.tsd-is-private > .tsd-kind-icon:before { + background-position: -119px -102px; +} +.tsd-kind-constructor-signature.tsd-parent-kind-class > .tsd-kind-icon:before { + background-position: -51px -102px; +} +.tsd-kind-constructor-signature.tsd-parent-kind-class.tsd-is-inherited > .tsd-kind-icon:before { + background-position: -68px -102px; +} +.tsd-kind-constructor-signature.tsd-parent-kind-class.tsd-is-protected > .tsd-kind-icon:before { + background-position: -85px -102px; +} +.tsd-kind-constructor-signature.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited > .tsd-kind-icon:before { + background-position: -102px -102px; +} +.tsd-kind-constructor-signature.tsd-parent-kind-class.tsd-is-private > .tsd-kind-icon:before { + background-position: -119px -102px; +} +.tsd-kind-constructor-signature.tsd-parent-kind-enum > .tsd-kind-icon:before { + background-position: -170px -102px; +} +.tsd-kind-constructor-signature.tsd-parent-kind-enum.tsd-is-protected > .tsd-kind-icon:before { + background-position: -187px -102px; +} +.tsd-kind-constructor-signature.tsd-parent-kind-enum.tsd-is-private > .tsd-kind-icon:before { + background-position: -119px -102px; +} +.tsd-kind-constructor-signature.tsd-parent-kind-interface > .tsd-kind-icon:before { + background-position: -204px -102px; +} +.tsd-kind-constructor-signature.tsd-parent-kind-interface.tsd-is-inherited > .tsd-kind-icon:before { + background-position: -221px -102px; +} + +.tsd-kind-index-signature > .tsd-kind-icon:before { + background-position: -136px -119px; +} +.tsd-kind-index-signature.tsd-is-protected > .tsd-kind-icon:before { + background-position: -153px -119px; +} +.tsd-kind-index-signature.tsd-is-private > .tsd-kind-icon:before { + background-position: -119px -119px; +} +.tsd-kind-index-signature.tsd-parent-kind-class > .tsd-kind-icon:before { + background-position: -51px -119px; +} +.tsd-kind-index-signature.tsd-parent-kind-class.tsd-is-inherited > .tsd-kind-icon:before { + background-position: -68px -119px; +} +.tsd-kind-index-signature.tsd-parent-kind-class.tsd-is-protected > .tsd-kind-icon:before { + background-position: -85px -119px; +} +.tsd-kind-index-signature.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited > .tsd-kind-icon:before { + background-position: -102px -119px; +} +.tsd-kind-index-signature.tsd-parent-kind-class.tsd-is-private > .tsd-kind-icon:before { + background-position: -119px -119px; +} +.tsd-kind-index-signature.tsd-parent-kind-enum > .tsd-kind-icon:before { + background-position: -170px -119px; +} +.tsd-kind-index-signature.tsd-parent-kind-enum.tsd-is-protected > .tsd-kind-icon:before { + background-position: -187px -119px; +} +.tsd-kind-index-signature.tsd-parent-kind-enum.tsd-is-private > .tsd-kind-icon:before { + background-position: -119px -119px; +} +.tsd-kind-index-signature.tsd-parent-kind-interface > .tsd-kind-icon:before { + background-position: -204px -119px; +} +.tsd-kind-index-signature.tsd-parent-kind-interface.tsd-is-inherited > .tsd-kind-icon:before { + background-position: -221px -119px; +} + +.tsd-kind-event > .tsd-kind-icon:before { + background-position: -136px -136px; +} +.tsd-kind-event.tsd-is-protected > .tsd-kind-icon:before { + background-position: -153px -136px; +} +.tsd-kind-event.tsd-is-private > .tsd-kind-icon:before { + background-position: -119px -136px; +} +.tsd-kind-event.tsd-parent-kind-class > .tsd-kind-icon:before { + background-position: -51px -136px; +} +.tsd-kind-event.tsd-parent-kind-class.tsd-is-inherited > .tsd-kind-icon:before { + background-position: -68px -136px; +} +.tsd-kind-event.tsd-parent-kind-class.tsd-is-protected > .tsd-kind-icon:before { + background-position: -85px -136px; +} +.tsd-kind-event.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited > .tsd-kind-icon:before { + background-position: -102px -136px; +} +.tsd-kind-event.tsd-parent-kind-class.tsd-is-private > .tsd-kind-icon:before { + background-position: -119px -136px; +} +.tsd-kind-event.tsd-parent-kind-enum > .tsd-kind-icon:before { + background-position: -170px -136px; +} +.tsd-kind-event.tsd-parent-kind-enum.tsd-is-protected > .tsd-kind-icon:before { + background-position: -187px -136px; +} +.tsd-kind-event.tsd-parent-kind-enum.tsd-is-private > .tsd-kind-icon:before { + background-position: -119px -136px; +} +.tsd-kind-event.tsd-parent-kind-interface > .tsd-kind-icon:before { + background-position: -204px -136px; +} +.tsd-kind-event.tsd-parent-kind-interface.tsd-is-inherited > .tsd-kind-icon:before { + background-position: -221px -136px; +} + +.tsd-is-static > .tsd-kind-icon:before { + background-position: -136px -153px; +} +.tsd-is-static.tsd-is-protected > .tsd-kind-icon:before { + background-position: -153px -153px; +} +.tsd-is-static.tsd-is-private > .tsd-kind-icon:before { + background-position: -119px -153px; +} +.tsd-is-static.tsd-parent-kind-class > .tsd-kind-icon:before { + background-position: -51px -153px; +} +.tsd-is-static.tsd-parent-kind-class.tsd-is-inherited > .tsd-kind-icon:before { + background-position: -68px -153px; +} +.tsd-is-static.tsd-parent-kind-class.tsd-is-protected > .tsd-kind-icon:before { + background-position: -85px -153px; +} +.tsd-is-static.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited > .tsd-kind-icon:before { + background-position: -102px -153px; +} +.tsd-is-static.tsd-parent-kind-class.tsd-is-private > .tsd-kind-icon:before { + background-position: -119px -153px; +} +.tsd-is-static.tsd-parent-kind-enum > .tsd-kind-icon:before { + background-position: -170px -153px; +} +.tsd-is-static.tsd-parent-kind-enum.tsd-is-protected > .tsd-kind-icon:before { + background-position: -187px -153px; +} +.tsd-is-static.tsd-parent-kind-enum.tsd-is-private > .tsd-kind-icon:before { + background-position: -119px -153px; +} +.tsd-is-static.tsd-parent-kind-interface > .tsd-kind-icon:before { + background-position: -204px -153px; +} +.tsd-is-static.tsd-parent-kind-interface.tsd-is-inherited > .tsd-kind-icon:before { + background-position: -221px -153px; +} + +.tsd-is-static.tsd-kind-function > .tsd-kind-icon:before { + background-position: -136px -170px; +} +.tsd-is-static.tsd-kind-function.tsd-is-protected > .tsd-kind-icon:before { + background-position: -153px -170px; +} +.tsd-is-static.tsd-kind-function.tsd-is-private > .tsd-kind-icon:before { + background-position: -119px -170px; +} +.tsd-is-static.tsd-kind-function.tsd-parent-kind-class > .tsd-kind-icon:before { + background-position: -51px -170px; +} +.tsd-is-static.tsd-kind-function.tsd-parent-kind-class.tsd-is-inherited > .tsd-kind-icon:before { + background-position: -68px -170px; +} +.tsd-is-static.tsd-kind-function.tsd-parent-kind-class.tsd-is-protected > .tsd-kind-icon:before { + background-position: -85px -170px; +} +.tsd-is-static.tsd-kind-function.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited > .tsd-kind-icon:before { + background-position: -102px -170px; +} +.tsd-is-static.tsd-kind-function.tsd-parent-kind-class.tsd-is-private > .tsd-kind-icon:before { + background-position: -119px -170px; +} +.tsd-is-static.tsd-kind-function.tsd-parent-kind-enum > .tsd-kind-icon:before { + background-position: -170px -170px; +} +.tsd-is-static.tsd-kind-function.tsd-parent-kind-enum.tsd-is-protected > .tsd-kind-icon:before { + background-position: -187px -170px; +} +.tsd-is-static.tsd-kind-function.tsd-parent-kind-enum.tsd-is-private > .tsd-kind-icon:before { + background-position: -119px -170px; +} +.tsd-is-static.tsd-kind-function.tsd-parent-kind-interface > .tsd-kind-icon:before { + background-position: -204px -170px; +} +.tsd-is-static.tsd-kind-function.tsd-parent-kind-interface.tsd-is-inherited > .tsd-kind-icon:before { + background-position: -221px -170px; +} + +.tsd-is-static.tsd-kind-method > .tsd-kind-icon:before { + background-position: -136px -170px; +} +.tsd-is-static.tsd-kind-method.tsd-is-protected > .tsd-kind-icon:before { + background-position: -153px -170px; +} +.tsd-is-static.tsd-kind-method.tsd-is-private > .tsd-kind-icon:before { + background-position: -119px -170px; +} +.tsd-is-static.tsd-kind-method.tsd-parent-kind-class > .tsd-kind-icon:before { + background-position: -51px -170px; +} +.tsd-is-static.tsd-kind-method.tsd-parent-kind-class.tsd-is-inherited > .tsd-kind-icon:before { + background-position: -68px -170px; +} +.tsd-is-static.tsd-kind-method.tsd-parent-kind-class.tsd-is-protected > .tsd-kind-icon:before { + background-position: -85px -170px; +} +.tsd-is-static.tsd-kind-method.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited > .tsd-kind-icon:before { + background-position: -102px -170px; +} +.tsd-is-static.tsd-kind-method.tsd-parent-kind-class.tsd-is-private > .tsd-kind-icon:before { + background-position: -119px -170px; +} +.tsd-is-static.tsd-kind-method.tsd-parent-kind-enum > .tsd-kind-icon:before { + background-position: -170px -170px; +} +.tsd-is-static.tsd-kind-method.tsd-parent-kind-enum.tsd-is-protected > .tsd-kind-icon:before { + background-position: -187px -170px; +} +.tsd-is-static.tsd-kind-method.tsd-parent-kind-enum.tsd-is-private > .tsd-kind-icon:before { + background-position: -119px -170px; +} +.tsd-is-static.tsd-kind-method.tsd-parent-kind-interface > .tsd-kind-icon:before { + background-position: -204px -170px; +} +.tsd-is-static.tsd-kind-method.tsd-parent-kind-interface.tsd-is-inherited > .tsd-kind-icon:before { + background-position: -221px -170px; +} + +.tsd-is-static.tsd-kind-call-signature > .tsd-kind-icon:before { + background-position: -136px -170px; +} +.tsd-is-static.tsd-kind-call-signature.tsd-is-protected > .tsd-kind-icon:before { + background-position: -153px -170px; +} +.tsd-is-static.tsd-kind-call-signature.tsd-is-private > .tsd-kind-icon:before { + background-position: -119px -170px; +} +.tsd-is-static.tsd-kind-call-signature.tsd-parent-kind-class > .tsd-kind-icon:before { + background-position: -51px -170px; +} +.tsd-is-static.tsd-kind-call-signature.tsd-parent-kind-class.tsd-is-inherited > .tsd-kind-icon:before { + background-position: -68px -170px; +} +.tsd-is-static.tsd-kind-call-signature.tsd-parent-kind-class.tsd-is-protected > .tsd-kind-icon:before { + background-position: -85px -170px; +} +.tsd-is-static.tsd-kind-call-signature.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited > .tsd-kind-icon:before { + background-position: -102px -170px; +} +.tsd-is-static.tsd-kind-call-signature.tsd-parent-kind-class.tsd-is-private > .tsd-kind-icon:before { + background-position: -119px -170px; +} +.tsd-is-static.tsd-kind-call-signature.tsd-parent-kind-enum > .tsd-kind-icon:before { + background-position: -170px -170px; +} +.tsd-is-static.tsd-kind-call-signature.tsd-parent-kind-enum.tsd-is-protected > .tsd-kind-icon:before { + background-position: -187px -170px; +} +.tsd-is-static.tsd-kind-call-signature.tsd-parent-kind-enum.tsd-is-private > .tsd-kind-icon:before { + background-position: -119px -170px; +} +.tsd-is-static.tsd-kind-call-signature.tsd-parent-kind-interface > .tsd-kind-icon:before { + background-position: -204px -170px; +} +.tsd-is-static.tsd-kind-call-signature.tsd-parent-kind-interface.tsd-is-inherited > .tsd-kind-icon:before { + background-position: -221px -170px; +} + +.tsd-is-static.tsd-kind-event > .tsd-kind-icon:before { + background-position: -136px -187px; +} +.tsd-is-static.tsd-kind-event.tsd-is-protected > .tsd-kind-icon:before { + background-position: -153px -187px; +} +.tsd-is-static.tsd-kind-event.tsd-is-private > .tsd-kind-icon:before { + background-position: -119px -187px; +} +.tsd-is-static.tsd-kind-event.tsd-parent-kind-class > .tsd-kind-icon:before { + background-position: -51px -187px; +} +.tsd-is-static.tsd-kind-event.tsd-parent-kind-class.tsd-is-inherited > .tsd-kind-icon:before { + background-position: -68px -187px; +} +.tsd-is-static.tsd-kind-event.tsd-parent-kind-class.tsd-is-protected > .tsd-kind-icon:before { + background-position: -85px -187px; +} +.tsd-is-static.tsd-kind-event.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited > .tsd-kind-icon:before { + background-position: -102px -187px; +} +.tsd-is-static.tsd-kind-event.tsd-parent-kind-class.tsd-is-private > .tsd-kind-icon:before { + background-position: -119px -187px; +} +.tsd-is-static.tsd-kind-event.tsd-parent-kind-enum > .tsd-kind-icon:before { + background-position: -170px -187px; +} +.tsd-is-static.tsd-kind-event.tsd-parent-kind-enum.tsd-is-protected > .tsd-kind-icon:before { + background-position: -187px -187px; +} +.tsd-is-static.tsd-kind-event.tsd-parent-kind-enum.tsd-is-private > .tsd-kind-icon:before { + background-position: -119px -187px; +} +.tsd-is-static.tsd-kind-event.tsd-parent-kind-interface > .tsd-kind-icon:before { + background-position: -204px -187px; +} +.tsd-is-static.tsd-kind-event.tsd-parent-kind-interface.tsd-is-inherited > .tsd-kind-icon:before { + background-position: -221px -187px; +} + +@keyframes fade-in { + from { + opacity: 0; + } + to { + opacity: 1; + } +} +@keyframes fade-out { + from { + opacity: 1; + visibility: visible; + } + to { + opacity: 0; + } +} +@keyframes fade-in-delayed { + 0% { + opacity: 0; + } + 33% { + opacity: 0; + } + 100% { + opacity: 1; + } +} +@keyframes fade-out-delayed { + 0% { + opacity: 1; + visibility: visible; + } + 66% { + opacity: 0; + } + 100% { + opacity: 0; + } +} +@keyframes shift-to-left { + from { + transform: translate(0, 0); + } + to { + transform: translate(-25%, 0); + } +} +@keyframes unshift-to-left { + from { + transform: translate(-25%, 0); + } + to { + transform: translate(0, 0); + } +} +@keyframes pop-in-from-right { + from { + transform: translate(100%, 0); + } + to { + transform: translate(0, 0); + } +} +@keyframes pop-out-to-right { + from { + transform: translate(0, 0); + visibility: visible; + } + to { + transform: translate(100%, 0); + } +} +body { + background: #fdfdfd; + font-family: "Segoe UI", sans-serif; + font-size: 16px; + color: #222; +} + +a { + color: #4da6ff; + text-decoration: none; +} +a:hover { + text-decoration: underline; +} + +code, pre { + font-family: Menlo, Monaco, Consolas, "Courier New", monospace; + padding: 0.2em; + margin: 0; + font-size: 14px; + background-color: rgba(0, 0, 0, 0.04); +} + +pre { + padding: 10px; +} +pre code { + padding: 0; + font-size: 100%; + background-color: transparent; +} + +.tsd-typography { + line-height: 1.333em; +} +.tsd-typography ul { + list-style: square; + padding: 0 0 0 20px; + margin: 0; +} +.tsd-typography h4, .tsd-typography .tsd-index-panel h3, .tsd-index-panel .tsd-typography h3, .tsd-typography h5, .tsd-typography h6 { + font-size: 1em; + margin: 0; +} +.tsd-typography h5, .tsd-typography h6 { + font-weight: normal; +} +.tsd-typography p, .tsd-typography ul, .tsd-typography ol { + margin: 1em 0; +} + +@media (min-width: 901px) and (max-width: 1024px) { + html.default .col-content { + width: 72%; + } + html.default .col-menu { + width: 28%; + } + html.default .tsd-navigation { + padding-left: 10px; + } +} +@media (max-width: 900px) { + html.default .col-content { + float: none; + width: 100%; + } + html.default .col-menu { + position: fixed !important; + overflow: auto; + -webkit-overflow-scrolling: touch; + z-index: 1024; + top: 0 !important; + bottom: 0 !important; + left: auto !important; + right: 0 !important; + width: 100%; + padding: 20px 20px 0 0; + max-width: 450px; + visibility: hidden; + background-color: #fff; + transform: translate(100%, 0); + } + html.default .col-menu > *:last-child { + padding-bottom: 20px; + } + html.default .overlay { + content: ""; + display: block; + position: fixed; + z-index: 1023; + top: 0; + left: 0; + right: 0; + bottom: 0; + background-color: rgba(0, 0, 0, 0.75); + visibility: hidden; + } + html.default.to-has-menu .overlay { + animation: fade-in 0.4s; + } + html.default.to-has-menu header, +html.default.to-has-menu footer, +html.default.to-has-menu .col-content { + animation: shift-to-left 0.4s; + } + html.default.to-has-menu .col-menu { + animation: pop-in-from-right 0.4s; + } + html.default.from-has-menu .overlay { + animation: fade-out 0.4s; + } + html.default.from-has-menu header, +html.default.from-has-menu footer, +html.default.from-has-menu .col-content { + animation: unshift-to-left 0.4s; + } + html.default.from-has-menu .col-menu { + animation: pop-out-to-right 0.4s; + } + html.default.has-menu body { + overflow: hidden; + } + html.default.has-menu .overlay { + visibility: visible; + } + html.default.has-menu header, +html.default.has-menu footer, +html.default.has-menu .col-content { + transform: translate(-25%, 0); + } + html.default.has-menu .col-menu { + visibility: visible; + transform: translate(0, 0); + } +} + +.tsd-page-title { + padding: 70px 0 20px 0; + margin: 0 0 40px 0; + background: #fff; + box-shadow: 0 0 5px rgba(0, 0, 0, 0.35); +} +.tsd-page-title h1 { + margin: 0; +} + +.tsd-breadcrumb { + margin: 0; + padding: 0; + color: #808080; +} +.tsd-breadcrumb a { + color: #808080; + text-decoration: none; +} +.tsd-breadcrumb a:hover { + text-decoration: underline; +} +.tsd-breadcrumb li { + display: inline; +} +.tsd-breadcrumb li:after { + content: " / "; +} + +html.minimal .container { + margin: 0; +} +html.minimal .container-main { + padding-top: 50px; + padding-bottom: 0; +} +html.minimal .content-wrap { + padding-left: 300px; +} +html.minimal .tsd-navigation { + position: fixed !important; + overflow: auto; + -webkit-overflow-scrolling: touch; + box-sizing: border-box; + z-index: 1; + left: 0; + top: 40px; + bottom: 0; + width: 300px; + padding: 20px; + margin: 0; +} +html.minimal .tsd-member .tsd-member { + margin-left: 0; +} +html.minimal .tsd-page-toolbar { + position: fixed; + z-index: 2; +} +html.minimal #tsd-filter .tsd-filter-group { + right: 0; + transform: none; +} +html.minimal footer { + background-color: transparent; +} +html.minimal footer .container { + padding: 0; +} +html.minimal .tsd-generator { + padding: 0; +} +@media (max-width: 900px) { + html.minimal .tsd-navigation { + display: none; + } + html.minimal .content-wrap { + padding-left: 0; + } +} + +dl.tsd-comment-tags { + overflow: hidden; +} +dl.tsd-comment-tags dt { + float: left; + padding: 1px 5px; + margin: 0 10px 0 0; + border-radius: 4px; + border: 1px solid #808080; + color: #808080; + font-size: 0.8em; + font-weight: normal; +} +dl.tsd-comment-tags dd { + margin: 0 0 10px 0; +} +dl.tsd-comment-tags dd:before, dl.tsd-comment-tags dd:after { + display: table; + content: " "; +} +dl.tsd-comment-tags dd pre, dl.tsd-comment-tags dd:after { + clear: both; +} +dl.tsd-comment-tags p { + margin: 0; +} + +.tsd-panel.tsd-comment .lead { + font-size: 1.1em; + line-height: 1.333em; + margin-bottom: 2em; +} +.tsd-panel.tsd-comment .lead:last-child { + margin-bottom: 0; +} + +.toggle-protected .tsd-is-private { + display: none; +} + +.toggle-public .tsd-is-private, +.toggle-public .tsd-is-protected, +.toggle-public .tsd-is-private-protected { + display: none; +} + +.toggle-inherited .tsd-is-inherited { + display: none; +} + +.toggle-only-exported .tsd-is-not-exported { + display: none; +} + +.toggle-externals .tsd-is-external { + display: none; +} + +#tsd-filter { + position: relative; + display: inline-block; + height: 40px; + vertical-align: bottom; +} +.no-filter #tsd-filter { + display: none; +} +#tsd-filter .tsd-filter-group { + display: inline-block; + height: 40px; + vertical-align: bottom; + white-space: nowrap; +} +#tsd-filter input { + display: none; +} +@media (max-width: 900px) { + #tsd-filter .tsd-filter-group { + display: block; + position: absolute; + top: 40px; + right: 20px; + height: auto; + background-color: #fff; + visibility: hidden; + transform: translate(50%, 0); + box-shadow: 0 0 4px rgba(0, 0, 0, 0.25); + } + .has-options #tsd-filter .tsd-filter-group { + visibility: visible; + } + .to-has-options #tsd-filter .tsd-filter-group { + animation: fade-in 0.2s; + } + .from-has-options #tsd-filter .tsd-filter-group { + animation: fade-out 0.2s; + } + #tsd-filter label, +#tsd-filter .tsd-select { + display: block; + padding-right: 20px; + } +} + +footer { + border-top: 1px solid #eee; + background-color: #fff; +} +footer.with-border-bottom { + border-bottom: 1px solid #eee; +} +footer .tsd-legend-group { + font-size: 0; +} +footer .tsd-legend { + display: inline-block; + width: 25%; + padding: 0; + font-size: 16px; + list-style: none; + line-height: 1.333em; + vertical-align: top; +} +@media (max-width: 900px) { + footer .tsd-legend { + width: 50%; + } +} + +.tsd-hierarchy { + list-style: square; + padding: 0 0 0 20px; + margin: 0; +} +.tsd-hierarchy .target { + font-weight: bold; +} + +.tsd-index-panel .tsd-index-content { + margin-bottom: -30px !important; +} +.tsd-index-panel .tsd-index-section { + margin-bottom: 30px !important; +} +.tsd-index-panel h3 { + margin: 0 -20px 10px -20px; + padding: 0 20px 10px 20px; + border-bottom: 1px solid #eee; +} +.tsd-index-panel ul.tsd-index-list { + -moz-column-count: 3; + -ms-column-count: 3; + -o-column-count: 3; + column-count: 3; + -moz-column-gap: 20px; + -ms-column-gap: 20px; + -o-column-gap: 20px; + column-gap: 20px; + padding: 0; + list-style: none; + line-height: 1.333em; +} +@media (max-width: 900px) { + .tsd-index-panel ul.tsd-index-list { + -moz-column-count: 1; + -ms-column-count: 1; + -o-column-count: 1; + column-count: 1; + } +} +@media (min-width: 901px) and (max-width: 1024px) { + .tsd-index-panel ul.tsd-index-list { + -moz-column-count: 2; + -ms-column-count: 2; + -o-column-count: 2; + column-count: 2; + } +} +.tsd-index-panel ul.tsd-index-list li { + -webkit-page-break-inside: avoid; + -moz-page-break-inside: avoid; + -ms-page-break-inside: avoid; + -o-page-break-inside: avoid; + page-break-inside: avoid; +} +.tsd-index-panel a, +.tsd-index-panel .tsd-parent-kind-module a { + color: #9600ff; +} +.tsd-index-panel .tsd-parent-kind-interface a { + color: #7da01f; +} +.tsd-index-panel .tsd-parent-kind-enum a { + color: #cc9900; +} +.tsd-index-panel .tsd-parent-kind-class a { + color: #4da6ff; +} +.tsd-index-panel .tsd-kind-module a { + color: #9600ff; +} +.tsd-index-panel .tsd-kind-interface a { + color: #7da01f; +} +.tsd-index-panel .tsd-kind-enum a { + color: #cc9900; +} +.tsd-index-panel .tsd-kind-class a { + color: #4da6ff; +} +.tsd-index-panel .tsd-is-private a { + color: #808080; +} + +.tsd-flag { + display: inline-block; + padding: 1px 5px; + border-radius: 4px; + color: #fff; + background-color: #808080; + text-indent: 0; + font-size: 14px; + font-weight: normal; +} + +.tsd-anchor { + position: absolute; + top: -100px; +} + +.tsd-member { + position: relative; +} +.tsd-member .tsd-anchor + h3 { + margin-top: 0; + margin-bottom: 0; + border-bottom: none; +} + +.tsd-navigation { + margin: 0 0 0 40px; +} +.tsd-navigation a { + display: block; + padding-top: 2px; + padding-bottom: 2px; + border-left: 2px solid transparent; + color: #222; + text-decoration: none; + transition: border-left-color 0.1s; +} +.tsd-navigation a:hover { + text-decoration: underline; +} +.tsd-navigation ul { + margin: 0; + padding: 0; + list-style: none; +} +.tsd-navigation li { + padding: 0; +} + +.tsd-navigation.primary { + padding-bottom: 40px; +} +.tsd-navigation.primary a { + display: block; + padding-top: 6px; + padding-bottom: 6px; +} +.tsd-navigation.primary ul li a { + padding-left: 5px; +} +.tsd-navigation.primary ul li li a { + padding-left: 25px; +} +.tsd-navigation.primary ul li li li a { + padding-left: 45px; +} +.tsd-navigation.primary ul li li li li a { + padding-left: 65px; +} +.tsd-navigation.primary ul li li li li li a { + padding-left: 85px; +} +.tsd-navigation.primary ul li li li li li li a { + padding-left: 105px; +} +.tsd-navigation.primary > ul { + border-bottom: 1px solid #eee; +} +.tsd-navigation.primary li { + border-top: 1px solid #eee; +} +.tsd-navigation.primary li.current > a { + font-weight: bold; +} +.tsd-navigation.primary li.label span { + display: block; + padding: 20px 0 6px 5px; + color: #808080; +} +.tsd-navigation.primary li.globals + li > span, .tsd-navigation.primary li.globals + li > a { + padding-top: 20px; +} + +.tsd-navigation.secondary { + max-height: calc(100vh - 1rem - 40px); + overflow: auto; + position: -webkit-sticky; + position: sticky; + top: calc(.5rem + 40px); + transition: 0.3s; +} +.tsd-navigation.secondary.tsd-navigation--toolbar-hide { + max-height: calc(100vh - 1rem); + top: 0.5rem; +} +.tsd-navigation.secondary ul { + transition: opacity 0.2s; +} +.tsd-navigation.secondary ul li a { + padding-left: 25px; +} +.tsd-navigation.secondary ul li li a { + padding-left: 45px; +} +.tsd-navigation.secondary ul li li li a { + padding-left: 65px; +} +.tsd-navigation.secondary ul li li li li a { + padding-left: 85px; +} +.tsd-navigation.secondary ul li li li li li a { + padding-left: 105px; +} +.tsd-navigation.secondary ul li li li li li li a { + padding-left: 125px; +} +.tsd-navigation.secondary ul.current a { + border-left-color: #eee; +} +.tsd-navigation.secondary li.focus > a, +.tsd-navigation.secondary ul.current li.focus > a { + border-left-color: #000; +} +.tsd-navigation.secondary li.current { + margin-top: 20px; + margin-bottom: 20px; + border-left-color: #eee; +} +.tsd-navigation.secondary li.current > a { + font-weight: bold; +} + +@media (min-width: 901px) { + .menu-sticky-wrap { + position: static; + } +} + +.tsd-panel { + margin: 20px 0; + padding: 20px; + background-color: #fff; + box-shadow: 0 0 4px rgba(0, 0, 0, 0.25); +} +.tsd-panel:empty { + display: none; +} +.tsd-panel > h1, .tsd-panel > h2, .tsd-panel > h3 { + margin: 1.5em -20px 10px -20px; + padding: 0 20px 10px 20px; + border-bottom: 1px solid #eee; +} +.tsd-panel > h1.tsd-before-signature, .tsd-panel > h2.tsd-before-signature, .tsd-panel > h3.tsd-before-signature { + margin-bottom: 0; + border-bottom: 0; +} +.tsd-panel table { + display: block; + width: 100%; + overflow: auto; + margin-top: 10px; + word-break: normal; + word-break: keep-all; +} +.tsd-panel table th { + font-weight: bold; +} +.tsd-panel table th, .tsd-panel table td { + padding: 6px 13px; + border: 1px solid #ddd; +} +.tsd-panel table tr { + background-color: #fff; + border-top: 1px solid #ccc; +} +.tsd-panel table tr:nth-child(2n) { + background-color: #f8f8f8; +} + +.tsd-panel-group { + margin: 60px 0; +} +.tsd-panel-group > h1, .tsd-panel-group > h2, .tsd-panel-group > h3 { + padding-left: 20px; + padding-right: 20px; +} + +#tsd-search { + transition: background-color 0.2s; +} +#tsd-search .title { + position: relative; + z-index: 2; +} +#tsd-search .field { + position: absolute; + left: 0; + top: 0; + right: 40px; + height: 40px; +} +#tsd-search .field input { + box-sizing: border-box; + position: relative; + top: -50px; + z-index: 1; + width: 100%; + padding: 0 10px; + opacity: 0; + outline: 0; + border: 0; + background: transparent; + color: #222; +} +#tsd-search .field label { + position: absolute; + overflow: hidden; + right: -40px; +} +#tsd-search .field input, +#tsd-search .title { + transition: opacity 0.2s; +} +#tsd-search .results { + position: absolute; + visibility: hidden; + top: 40px; + width: 100%; + margin: 0; + padding: 0; + list-style: none; + box-shadow: 0 0 4px rgba(0, 0, 0, 0.25); +} +#tsd-search .results li { + padding: 0 10px; + background-color: #fdfdfd; +} +#tsd-search .results li:nth-child(even) { + background-color: #fff; +} +#tsd-search .results li.state { + display: none; +} +#tsd-search .results li.current, +#tsd-search .results li:hover { + background-color: #eee; +} +#tsd-search .results a { + display: block; +} +#tsd-search .results a:before { + top: 10px; +} +#tsd-search .results span.parent { + color: #808080; + font-weight: normal; +} +#tsd-search.has-focus { + background-color: #eee; +} +#tsd-search.has-focus .field input { + top: 0; + opacity: 1; +} +#tsd-search.has-focus .title { + z-index: 0; + opacity: 0; +} +#tsd-search.has-focus .results { + visibility: visible; +} +#tsd-search.loading .results li.state.loading { + display: block; +} +#tsd-search.failure .results li.state.failure { + display: block; +} + +.tsd-signature { + margin: 0 0 1em 0; + padding: 10px; + border: 1px solid #eee; + font-family: Menlo, Monaco, Consolas, "Courier New", monospace; + font-size: 14px; + overflow-x: auto; +} +.tsd-signature.tsd-kind-icon { + padding-left: 30px; +} +.tsd-signature.tsd-kind-icon:before { + top: 10px; + left: 10px; +} +.tsd-panel > .tsd-signature { + margin-left: -20px; + margin-right: -20px; + border-width: 1px 0; +} +.tsd-panel > .tsd-signature.tsd-kind-icon { + padding-left: 40px; +} +.tsd-panel > .tsd-signature.tsd-kind-icon:before { + left: 20px; +} + +.tsd-signature-symbol { + color: #808080; + font-weight: normal; +} + +.tsd-signature-type { + font-style: italic; + font-weight: normal; +} + +.tsd-signatures { + padding: 0; + margin: 0 0 1em 0; + border: 1px solid #eee; +} +.tsd-signatures .tsd-signature { + margin: 0; + border-width: 1px 0 0 0; + transition: background-color 0.1s; +} +.tsd-signatures .tsd-signature:first-child { + border-top-width: 0; +} +.tsd-signatures .tsd-signature.current { + background-color: #eee; +} +.tsd-signatures.active > .tsd-signature { + cursor: pointer; +} +.tsd-panel > .tsd-signatures { + margin-left: -20px; + margin-right: -20px; + border-width: 1px 0; +} +.tsd-panel > .tsd-signatures .tsd-signature.tsd-kind-icon { + padding-left: 40px; +} +.tsd-panel > .tsd-signatures .tsd-signature.tsd-kind-icon:before { + left: 20px; +} +.tsd-panel > a.anchor + .tsd-signatures { + border-top-width: 0; + margin-top: -20px; +} + +ul.tsd-descriptions { + position: relative; + overflow: hidden; + padding: 0; + list-style: none; +} +ul.tsd-descriptions.active > .tsd-description { + display: none; +} +ul.tsd-descriptions.active > .tsd-description.current { + display: block; +} +ul.tsd-descriptions.active > .tsd-description.fade-in { + animation: fade-in-delayed 0.3s; +} +ul.tsd-descriptions.active > .tsd-description.fade-out { + animation: fade-out-delayed 0.3s; + position: absolute; + display: block; + top: 0; + left: 0; + right: 0; + opacity: 0; + visibility: hidden; +} +ul.tsd-descriptions h4, ul.tsd-descriptions .tsd-index-panel h3, .tsd-index-panel ul.tsd-descriptions h3 { + font-size: 16px; + margin: 1em 0 0.5em 0; +} + +ul.tsd-parameters, +ul.tsd-type-parameters { + list-style: square; + margin: 0; + padding-left: 20px; +} +ul.tsd-parameters > li.tsd-parameter-signature, +ul.tsd-type-parameters > li.tsd-parameter-signature { + list-style: none; + margin-left: -20px; +} +ul.tsd-parameters h5, +ul.tsd-type-parameters h5 { + font-size: 16px; + margin: 1em 0 0.5em 0; +} +ul.tsd-parameters .tsd-comment, +ul.tsd-type-parameters .tsd-comment { + margin-top: -0.5em; +} + +.tsd-sources { + font-size: 14px; + color: #808080; + margin: 0 0 1em 0; +} +.tsd-sources a { + color: #808080; + text-decoration: underline; +} +.tsd-sources ul, .tsd-sources p { + margin: 0 !important; +} +.tsd-sources ul { + list-style: none; + padding: 0; +} + +.tsd-page-toolbar { + position: fixed; + z-index: 1; + top: 0; + left: 0; + width: 100%; + height: 40px; + color: #333; + background: #fff; + border-bottom: 1px solid #eee; + transition: transform 0.3s linear; +} +.tsd-page-toolbar a { + color: #333; + text-decoration: none; +} +.tsd-page-toolbar a.title { + font-weight: bold; +} +.tsd-page-toolbar a.title:hover { + text-decoration: underline; +} +.tsd-page-toolbar .table-wrap { + display: table; + width: 100%; + height: 40px; +} +.tsd-page-toolbar .table-cell { + display: table-cell; + position: relative; + white-space: nowrap; + line-height: 40px; +} +.tsd-page-toolbar .table-cell:first-child { + width: 100%; +} + +.tsd-page-toolbar--hide { + transform: translateY(-100%); +} + +.tsd-select .tsd-select-list li:before, .tsd-select .tsd-select-label:before, .tsd-widget:before { + content: ""; + display: inline-block; + width: 40px; + height: 40px; + margin: 0 -8px 0 0; + background-image: url(../images/widgets.png); + background-repeat: no-repeat; + text-indent: -1024px; + vertical-align: bottom; +} +@media (-webkit-min-device-pixel-ratio: 1.5), (min-resolution: 144dpi) { + .tsd-select .tsd-select-list li:before, .tsd-select .tsd-select-label:before, .tsd-widget:before { + background-image: url(../images/widgets@2x.png); + background-size: 320px 40px; + } +} + +.tsd-widget { + display: inline-block; + overflow: hidden; + opacity: 0.6; + height: 40px; + transition: opacity 0.1s, background-color 0.2s; + vertical-align: bottom; + cursor: pointer; +} +.tsd-widget:hover { + opacity: 0.8; +} +.tsd-widget.active { + opacity: 1; + background-color: #eee; +} +.tsd-widget.no-caption { + width: 40px; +} +.tsd-widget.no-caption:before { + margin: 0; +} +.tsd-widget.search:before { + background-position: 0 0; +} +.tsd-widget.menu:before { + background-position: -40px 0; +} +.tsd-widget.options:before { + background-position: -80px 0; +} +.tsd-widget.options, .tsd-widget.menu { + display: none; +} +@media (max-width: 900px) { + .tsd-widget.options, .tsd-widget.menu { + display: inline-block; + } +} +input[type=checkbox] + .tsd-widget:before { + background-position: -120px 0; +} +input[type=checkbox]:checked + .tsd-widget:before { + background-position: -160px 0; +} + +.tsd-select { + position: relative; + display: inline-block; + height: 40px; + transition: opacity 0.1s, background-color 0.2s; + vertical-align: bottom; + cursor: pointer; +} +.tsd-select .tsd-select-label { + opacity: 0.6; + transition: opacity 0.2s; +} +.tsd-select .tsd-select-label:before { + background-position: -240px 0; +} +.tsd-select.active .tsd-select-label { + opacity: 0.8; +} +.tsd-select.active .tsd-select-list { + visibility: visible; + opacity: 1; + transition-delay: 0s; +} +.tsd-select .tsd-select-list { + position: absolute; + visibility: hidden; + top: 40px; + left: 0; + margin: 0; + padding: 0; + opacity: 0; + list-style: none; + box-shadow: 0 0 4px rgba(0, 0, 0, 0.25); + transition: visibility 0s 0.2s, opacity 0.2s; +} +.tsd-select .tsd-select-list li { + padding: 0 20px 0 0; + background-color: #fdfdfd; +} +.tsd-select .tsd-select-list li:before { + background-position: 40px 0; +} +.tsd-select .tsd-select-list li:nth-child(even) { + background-color: #fff; +} +.tsd-select .tsd-select-list li:hover { + background-color: #eee; +} +.tsd-select .tsd-select-list li.selected:before { + background-position: -200px 0; +} +@media (max-width: 900px) { + .tsd-select .tsd-select-list { + top: 0; + left: auto; + right: 100%; + margin-right: -5px; + } + .tsd-select .tsd-select-label:before { + background-position: -280px 0; + } +} + +img { + max-width: 100%; +} \ No newline at end of file diff --git a/doc/api reference/assets/images/icons.png b/doc/api reference/assets/images/icons.png new file mode 100644 index 00000000..3836d5fe Binary files /dev/null and b/doc/api reference/assets/images/icons.png differ diff --git a/doc/api reference/assets/images/icons@2x.png b/doc/api reference/assets/images/icons@2x.png new file mode 100644 index 00000000..5a209e2f Binary files /dev/null and b/doc/api reference/assets/images/icons@2x.png differ diff --git a/doc/api reference/assets/images/widgets.png b/doc/api reference/assets/images/widgets.png new file mode 100644 index 00000000..c7380532 Binary files /dev/null and b/doc/api reference/assets/images/widgets.png differ diff --git a/doc/api reference/assets/images/widgets@2x.png b/doc/api reference/assets/images/widgets@2x.png new file mode 100644 index 00000000..4bbbd572 Binary files /dev/null and b/doc/api reference/assets/images/widgets@2x.png differ diff --git a/doc/api reference/assets/js/main.js b/doc/api reference/assets/js/main.js new file mode 100644 index 00000000..fe9fac3b --- /dev/null +++ b/doc/api reference/assets/js/main.js @@ -0,0 +1 @@ +!function(){var e=function(t){var r=new e.Builder;return r.pipeline.add(e.trimmer,e.stopWordFilter,e.stemmer),r.searchPipeline.add(e.stemmer),t.call(r,r),r.build()};e.version="2.3.7",e.utils={},e.utils.warn=function(e){return function(t){e.console&&console.warn&&console.warn(t)}}(this),e.utils.asString=function(e){return null==e?"":e.toString()},e.utils.clone=function(e){if(null==e)return e;for(var t=Object.create(null),r=Object.keys(e),i=0;i=this.length)return e.QueryLexer.EOS;var t=this.str.charAt(this.pos);return this.pos+=1,t},e.QueryLexer.prototype.width=function(){return this.pos-this.start},e.QueryLexer.prototype.ignore=function(){this.start==this.pos&&(this.pos+=1),this.start=this.pos},e.QueryLexer.prototype.backup=function(){this.pos-=1},e.QueryLexer.prototype.acceptDigitRun=function(){for(var t,r;47<(r=(t=this.next()).charCodeAt(0))&&r<58;);t!=e.QueryLexer.EOS&&this.backup()},e.QueryLexer.prototype.more=function(){return this.pos=this.scrollTop||0===this.scrollTop,isShown!==this.showToolbar&&(this.toolbar.classList.toggle("tsd-page-toolbar--hide"),this.secondaryNav.classList.toggle("tsd-navigation--toolbar-hide")),this.lastY=this.scrollTop},Viewport}(typedoc.EventTarget);typedoc.Viewport=Viewport,typedoc.registerService(Viewport,"viewport")}(typedoc||(typedoc={})),function(typedoc){function Component(options){this.el=options.el}typedoc.Component=Component}(typedoc||(typedoc={})),function(typedoc){typedoc.pointerDown="mousedown",typedoc.pointerMove="mousemove",typedoc.pointerUp="mouseup",typedoc.pointerDownPosition={x:0,y:0},typedoc.preventNextClick=!1,typedoc.isPointerDown=!1,typedoc.isPointerTouch=!1,typedoc.hasPointerMoved=!1,typedoc.isMobile=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),document.documentElement.classList.add(typedoc.isMobile?"is-mobile":"not-mobile"),typedoc.isMobile&&"ontouchstart"in document.documentElement&&(typedoc.isPointerTouch=!0,typedoc.pointerDown="touchstart",typedoc.pointerMove="touchmove",typedoc.pointerUp="touchend"),document.addEventListener(typedoc.pointerDown,function(e){typedoc.isPointerDown=!0,typedoc.hasPointerMoved=!1;var t="touchstart"==typedoc.pointerDown?e.targetTouches[0]:e;typedoc.pointerDownPosition.y=t.pageY||0,typedoc.pointerDownPosition.x=t.pageX||0}),document.addEventListener(typedoc.pointerMove,function(e){if(typedoc.isPointerDown&&!typedoc.hasPointerMoved){var t="touchstart"==typedoc.pointerDown?e.targetTouches[0]:e,x=typedoc.pointerDownPosition.x-(t.pageX||0),y=typedoc.pointerDownPosition.y-(t.pageY||0);typedoc.hasPointerMoved=10scrollTop;)index-=1;for(;index"+match+""}),parent=row.parent||"";(parent=parent.replace(new RegExp(this.query,"i"),function(match){return""+match+""}))&&(name=''+parent+"."+name);var item=document.createElement("li");item.classList.value=row.classes,item.innerHTML='\n '+name+"'\n ",this.results.appendChild(item)}}},Search.prototype.setLoadingState=function(value){this.loadingState!=value&&(this.el.classList.remove(SearchLoadingState[this.loadingState].toLowerCase()),this.loadingState=value,this.el.classList.add(SearchLoadingState[this.loadingState].toLowerCase()),this.updateResults())},Search.prototype.setHasFocus=function(value){this.hasFocus!=value&&(this.hasFocus=value,this.el.classList.toggle("has-focus"),value?(this.setQuery(""),this.field.value=""):this.field.value=this.query)},Search.prototype.setQuery=function(value){this.query=value.trim(),this.updateResults()},Search.prototype.setCurrentResult=function(dir){var current=this.results.querySelector(".current");if(current){var rel=1==dir?current.nextElementSibling:current.previousElementSibling;rel&&(current.classList.remove("current"),rel.classList.add("current"))}else(current=this.results.querySelector(1==dir?"li:first-child":"li:last-child"))&¤t.classList.add("current")},Search.prototype.gotoCurrentResult=function(){var current=this.results.querySelector(".current");if(current||(current=this.results.querySelector("li:first-child")),current){var link=current.querySelector("a");link&&(window.location.href=link.href),this.field.blur()}},Search.prototype.bindEvents=function(){var _this=this;this.results.addEventListener("mousedown",function(){_this.resultClicked=!0}),this.results.addEventListener("mouseup",function(){_this.resultClicked=!1,_this.setHasFocus(!1)}),this.field.addEventListener("focusin",function(){_this.setHasFocus(!0),_this.loadIndex()}),this.field.addEventListener("focusout",function(){_this.resultClicked?_this.resultClicked=!1:setTimeout(function(){return _this.setHasFocus(!1)},100)}),this.field.addEventListener("input",function(){_this.setQuery(_this.field.value)}),this.field.addEventListener("keydown",function(e){13==e.keyCode||27==e.keyCode||38==e.keyCode||40==e.keyCode?(_this.preventPress=!0,e.preventDefault(),13==e.keyCode?_this.gotoCurrentResult():27==e.keyCode?_this.field.blur():38==e.keyCode?_this.setCurrentResult(-1):40==e.keyCode&&_this.setCurrentResult(1)):_this.preventPress=!1}),this.field.addEventListener("keypress",function(e){_this.preventPress&&e.preventDefault()}),document.body.addEventListener("keydown",function(e){e.altKey||e.ctrlKey||e.metaKey||!_this.hasFocus&&47this.groups.length-1&&(index=this.groups.length-1),this.index!=index){var to=this.groups[index];if(-1 + + + + + BarcodeReader | Dynamsoft BarcodeReader SDK for Javascript - v8.6.0 + + + + + +
+
+
+
+ +
+
+ Options +
+
+ All +
    +
  • Public
  • +
  • Public/Protected
  • +
  • All
  • +
+
+ + +
+
+ Menu +
+
+
+
+
+
+ +

Class BarcodeReader

+
+
+
+
+
+
+
+
+
+

The BarcodeReader class is used for image decoding + Comparing to BarcodeScanner, the default decoding settings are more accurate but slower.

+
let pReader = null;
+(async()=>{
+    let reader = await (pReader = pReader || Dynamsoft.DBR.BarcodeReader.createInstance());
+    let results = await reader.decode(imageSource);
+    for(let result of results){
+        console.log(result.barcodeText);
+    }
+})();
+
+
+
+
+

Hierarchy

+ +
+
+

Index

+
+ +
+
+
+

Properties

+
+ +

bDestroyed

+
bDestroyed: boolean = false
+ +
+
+

Indicates whether the instance has been destroyed.

+
+
+
+
+
+

Accessors

+
+ +

ifSaveOriginalImageInACanvas

+
    +
  • get ifSaveOriginalImageInACanvas(): boolean
  • +
  • set ifSaveOriginalImageInACanvas(value: boolean): void
  • +
+
    +
  • + +
    +
    +

    Whether to save the original image into canvas.

    +
    reader.ifSaveOriginalImageInACanvas = true;
    +let results = await reader.decode(source);
    +document.body.append(reader.getOriginalImageInACanvas());
    +
    +
    +

    Returns boolean

    +
  • +
  • + +
    +
    +

    Whether to save the original image into canvas.

    +
    reader.ifSaveOriginalImageInACanvas = true;
    +let results = await reader.decode(source);
    +document.body.append(reader.getOriginalImageInACanvas());
    +
    +
    +

    Parameters

    +
      +
    • +
      value: boolean
      +
    • +
    +

    Returns void

    +
  • +
+
+
+ +

Static _bUseFullFeature

+
    +
  • get _bUseFullFeature(): boolean
  • +
  • set _bUseFullFeature(value: boolean): void
  • +
+
    +
  • + +

    Returns boolean

    +
  • +
  • + +

    Parameters

    +
      +
    • +
      value: boolean
      +
    • +
    +

    Returns void

    +
  • +
+
+
+ +

Static engineResourcePath

+
    +
  • get engineResourcePath(): string
  • +
  • set engineResourcePath(value: string): void
  • +
+
    +
  • + +
    +
    +

    Specify the Barcode Reader SDK engine (WASM) url. The SDK tries to automatically explore the engine location. + If the auto-explored engine location is incorrect, you can manually specify the engine location. + The property needs to be set before loadWasm.

    +
    Dynamsoft.DBR.BarcodeReader.engineResourcePath = "https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@8.6.0/dist/";
    +await Dynamsoft.DBR.BarcodeReader.loadWasm();
    +
    +
    +

    Returns string

    +
  • +
  • + +
    +
    +

    Specify the Barcode Reader SDK engine (WASM) url. The SDK tries to automatically explore the engine location. + If the auto-explored engine location is incorrect, you can manually specify the engine location. + The property needs to be set before loadWasm.

    +
    Dynamsoft.DBR.BarcodeReader.engineResourcePath = "https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@8.6.0/dist/";
    +await Dynamsoft.DBR.BarcodeReader.loadWasm();
    +
    +
    +

    Parameters

    +
      +
    • +
      value: string
      +
    • +
    +

    Returns void

    +
  • +
+
+
+ +

Static handshakeCode

+
    +
  • get handshakeCode(): string
  • +
  • set handshakeCode(keys: string): void
  • +
+
    +
  • + +
    +
    +

    Get or set the Dynamsoft Barcode Reader SDK handshake code. The handshakeCode is an alias of productKeys. Specifically refers to the key that requires network authentication.

    +
    Dynamsoft.DBR.BarcodeReader.handshakeCode = "123****-mytest";
    +

    For convenience, you can set handshakeCode in script tag instead.

    +
    <script src="https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@8.6.0/dist/dbr.js" data-handshakeCode="123****-mytest"></script>
    +
    +
    +

    Returns string

    +
  • +
  • + +
    +
    +

    Get or set the Dynamsoft Barcode Reader SDK handshake code. The handshakeCode is an alias of productKeys. Specifically refers to the key that requires network authentication.

    +
    Dynamsoft.DBR.BarcodeReader.handshakeCode = "123****-mytest";
    +

    For convenience, you can set handshakeCode in script tag instead.

    +
    <script src="https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@8.6.0/dist/dbr.js" data-handshakeCode="123****-mytest"></script>
    +
    +
    +

    Parameters

    +
      +
    • +
      keys: string
      +
    • +
    +

    Returns void

    +
  • +
+
+
+ +

Static licenseServer

+
    +
  • get licenseServer(): string | string[]
  • +
  • set licenseServer(value: string[] | string): void
  • +
+
    +
  • + +
    +
    +

    Specify the license server URL.

    +
    +
    +

    Returns string | string[]

    +
  • +
  • + +
    +
    +

    Specify the license server URL.

    +
    +
    +

    Parameters

    +
      +
    • +
      value: string[] | string
      +
    • +
    +

    Returns void

    +
  • +
+
+
+ +

Static organizationID

+
    +
  • get organizationID(): string
  • +
  • set organizationID(value: string): void
  • +
+
    +
  • + +
    +
    +

    Use organization ID to get authentication from network. Keep handshakeCode empty if you want to use default handshake of the organization.

    +
    Dynamsoft.DBR.BarcodeReader.organizationID = "123****";
    +

    For convenience, you can set organizationID in script tag instead.

    +
    <script src="https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@8.6.0/dist/dbr.js" data-organizationID="123****"></script>
    +
    +
    +
    see
    +

    handshakeCode

    +
    +
    +
    +

    Returns string

    +
  • +
  • + +
    +
    +

    Use organization ID to get authentication from network. Keep handshakeCode empty if you want to use default handshake of the organization.

    +
    Dynamsoft.DBR.BarcodeReader.organizationID = "123****";
    +

    For convenience, you can set organizationID in script tag instead.

    +
    <script src="https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@8.6.0/dist/dbr.js" data-organizationID="123****"></script>
    +
    +
    +
    see
    +

    handshakeCode

    +
    +
    +
    +

    Parameters

    +
      +
    • +
      value: string
      +
    • +
    +

    Returns void

    +
  • +
+
+
+ +

Static productKeys

+
    +
  • get productKeys(): string
  • +
  • set productKeys(keys: string): void
  • +
+
    +
  • + +
    +
    +

    Get or set the Dynamsoft Barcode Reader SDK product keys.

    +
    Dynamsoft.DBR.BarcodeReader.productKeys = "PRODUCT-KEYS";
    +

    For convenience, you can set productKeys in script tag instead.

    +
    <script src="https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@8.6.0/dist/dbr.js" data-productKeys="PRODUCT-KEYS"></script>
    +
    +
    +

    Returns string

    +
  • +
  • + +
    +
    +

    Get or set the Dynamsoft Barcode Reader SDK product keys.

    +
    Dynamsoft.DBR.BarcodeReader.productKeys = "PRODUCT-KEYS";
    +

    For convenience, you can set productKeys in script tag instead.

    +
    <script src="https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@8.6.0/dist/dbr.js" data-productKeys="PRODUCT-KEYS"></script>
    +
    +
    +

    Parameters

    +
      +
    • +
      keys: string
      +
    • +
    +

    Returns void

    +
  • +
+
+
+ +

Static sessionPassword

+
    +
  • get sessionPassword(): string
  • +
  • set sessionPassword(value: string): void
  • +
+
    +
  • + +
    +
    +

    Specify a password to protect the Handshake Code from abuse.

    +
    Dynamsoft.DBR.BarcodeReader.handshakeCode = "123****-mytest";
    +Dynamsoft.DBR.BarcodeReader.sessionPassword = "@#$%****";
    +

    Since js in the browser is plaintext, it is not safe to set a password. It is recommended that you bind the domain as Validation field in the handshake settings in dynamsoft website or your self-hosted license server.

    +
    +

    In nodejs, password is meaningful.

    +
    +
    see
    +

    handshakeCode

    +
    +
    +
    +

    Returns string

    +
  • +
  • + +
    +
    +

    Specify a password to protect the Handshake Code from abuse.

    +
    Dynamsoft.DBR.BarcodeReader.handshakeCode = "123****-mytest";
    +Dynamsoft.DBR.BarcodeReader.sessionPassword = "@#$%****";
    +

    Since js in the browser is plaintext, it is not safe to set a password. It is recommended that you bind the domain as Validation field in the handshake settings in dynamsoft website or your self-hosted license server.

    +
    +

    In nodejs, password is meaningful.

    +
    +
    see
    +

    handshakeCode

    +
    +
    +
    +

    Parameters

    +
      +
    • +
      value: string
      +
    • +
    +

    Returns void

    +
  • +
+
+
+ +

Static version

+
    +
  • get version(): string
  • +
+
    +
  • + +
    +
    +

    Get the current version.

    +
    +
    +

    Returns string

    +
  • +
+
+
+
+

Initialize and Destroy Methods

+
+ +

destroy

+
    +
  • destroy(): Promise<void>
  • +
+
    +
  • + +
    +
    +

    Destroy the BarcodeReader instance. If your page needs to create new instances from time to time, don't forget to destroy unused old instances, otherwise it will cause memory leaks.

    +
    +
    +

    Returns Promise<void>

    +
  • +
+
+
+ +

Static createInstance

+ +
    +
  • + +
    +
    +

    Create a BarcodeReader instance.

    +
    let pReader = null;
    +(async()=>{
    +    let reader = await (pReader = pReader || Dynamsoft.DBR.BarcodeReader.createInstance());
    +})();
    +
    +
    +

    Returns Promise<BarcodeReader>

    +
  • +
+
+
+ +

Static isLoaded

+
    +
  • isLoaded(): boolean
  • +
+
    +
  • + +
    +
    +

    Check if the decoding module is loaded.

    +
    +
    +

    Returns boolean

    +
  • +
+
+
+ +

Static loadWasm

+
    +
  • loadWasm(): Promise<void>
  • +
+
    +
  • + +
    +
    +

    Before most operations, loadWasm needs to be excuted firstly. + Most time, you do not need excute loadWasm manually. Because when you excute createInstance, loadWasm will be excuted implicitly. + Some properties can't be changed after loadWasm. + Calling loadWasm in advance can avoid the long wait when createInstance.

    +
    window.addEventListener('DOMContentLoaded', (event) => {
    +  DBR.BarcodeReader.loadWasm();
    +});
    +
    +
    +

    Returns Promise<void>

    +
  • +
+
+
+
+

Decode Methods

+
+ +

decode

+
    +
  • decode(source: Blob | Buffer | ArrayBuffer | Uint8Array | Uint8ClampedArray | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | string): Promise<TextResult[]>
  • +
+
    +
  • + +
    +
    +

    Decode barcodes from a image.

    +
    +

    The main decoding method can accept a variety of data types, including binary data, images, base64 (with mime), urls, etc.

    +

    The image format can be png, jpeg, bmp, gif and a few other (some browsers support webp, tif).

    +
    let results = await reader.decode(blob);
    +for(let result of results){
    +    console.log(result.barcodeText);
    +}
    +
    +let results2 = await reader.decode(htmlImageElement);
    +let results2 = await reader.decode(url);
    +
    +// like `data:image/png;base64,iV************`
    +let results3 = await reader.decode(base64WithMime);
    +

    And you can get a frame to decode from the HTMLVideoElement.

    +
    // The frame currently played will be decode.
    +let results;
    +try{
    +  results = await reader.decode(htmlVideoElement);
    +}catch(ex){
    +  // If no frame in the video, will throw an exception.
    +}
    +

    If you need to continuously decode a video, you can use BarcodeScanner instead.

    +
    +

    Parameters

    +
      +
    • +
      source: Blob | Buffer | ArrayBuffer | Uint8Array | Uint8ClampedArray | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | string
      +
    • +
    +

    Returns Promise<TextResult[]>

    +
  • +
+
+
+ +

decodeBase64String

+
    +
  • decodeBase64String(base64: string): Promise<TextResult[]>
  • +
+
    +
  • + +
    +
    +

    The decoding method can accept base64 with or without mime. + e.g. data:image/jpg;base64,Xfjshekk.... or Xfjshekk....

    +
    let results = await reader.decodeBase64String(strBase64);
    +for(let result of results){
    +    console.log(result.barcodeText);
    +}
    +
    +
    +

    Parameters

    +
      +
    • +
      base64: string
      +
    • +
    +

    Returns Promise<TextResult[]>

    +
  • +
+
+
+ +

decodeBuffer

+
    +
  • decodeBuffer(buffer: Uint8Array | Uint8ClampedArray | ArrayBuffer | Blob | Buffer, width: number, height: number, stride: number, format: EnumImagePixelFormat, config?: any): Promise<TextResult[]>
  • +
+
    +
  • + +
    +
    +

    Decode barcodes from raw image data.

    +
    +
    +

    Parameters

    +
      +
    • +
      buffer: Uint8Array | Uint8ClampedArray | ArrayBuffer | Blob | Buffer
      +
    • +
    • +
      width: number
      +
    • +
    • +
      height: number
      +
    • +
    • +
      stride: number
      +
    • +
    • +
      format: EnumImagePixelFormat
      +
    • +
    • +
      Optional config: any
      +
    • +
    +

    Returns Promise<TextResult[]>

    +
  • +
+
+
+ +

decodeUrl

+
    +
  • decodeUrl(url: string): Promise<TextResult[]>
  • +
+
    +
  • + +
    +
    +

    The decoding method can accept url. The url source need to be in the same domain or allowed cors.

    +
    let results = await reader.decodeUrl("./1.png");
    +for(let result of results){
    +    console.log(result.barcodeText);
    +}
    +
    +
    +

    Parameters

    +
      +
    • +
      url: string
      +
    • +
    +

    Returns Promise<TextResult[]>

    +
  • +
+
+
+
+

Runtime Settings Methods

+
+ +

getModeArgument

+
    +
  • getModeArgument(modeName: string, index: number, argumentName: string): Promise<string>
  • +
+
    +
  • + +
    +
    +

    Get argument value for the specified mode parameter.

    +
    let argumentValue = await reader.getModeArgument("BinarizationModes", 0, "EnableFillBinaryVacancy");
    +
    +
    +

    Parameters

    +
      +
    • +
      modeName: string
      +
    • +
    • +
      index: number
      +
    • +
    • +
      argumentName: string
      +
    • +
    +

    Returns Promise<string>

    +
  • +
+
+
+ +

getRuntimeSettings

+ +
    +
  • + +
    +
    +

    Gets current runtime settings.

    +
    let settings = await reader.getRuntimeSettings();
    +settings.deblurLevel = 5;
    +await reader.updateRuntimeSettings(settings);
    +
    +
    +
    see
    +

    RuntimeSettings

    +
    +
    +
    +

    Returns Promise<RuntimeSettings>

    +
  • +
+
+
+ +

resetRuntimeSettings

+
    +
  • resetRuntimeSettings(): Promise<void>
  • +
+
    +
  • + +
    +
    +

    Resets all parameters to default values.

    +
    await reader.resetRuntimeSettings();
    +
    +
    +

    Returns Promise<void>

    +
  • +
+
+
+ +

setModeArgument

+
    +
  • setModeArgument(modeName: string, index: number, argumentName: string, argumentValue: string): Promise<void>
  • +
+
    +
  • + +
    +
    +

    Set argument value for the specified mode parameter.

    +
    await reader.setModeArgument("BinarizationModes", 0, "EnableFillBinaryVacancy", "1");
    +
    +
    +

    Parameters

    +
      +
    • +
      modeName: string
      +
    • +
    • +
      index: number
      +
    • +
    • +
      argumentName: string
      +
    • +
    • +
      argumentValue: string
      +
    • +
    +

    Returns Promise<void>

    +
  • +
+
+
+ +

updateRuntimeSettings

+
    +
  • updateRuntimeSettings(settings: RuntimeSettings | string): Promise<void>
  • +
+
    +
  • + +
    +
    +

    Update runtime settings with a given struct, or a string of speed, balance or coverage to use preset settings for BarcodeReader. + The default settings for BarcodeReader is coverage.

    +
    await reader.updateRuntimeSettings('balance');
    +let settings = await reader.getRuntimeSettings();
    +settings.barcodeFormatIds = Dynamsoft.DBR.EnumBarcodeFormat.BF_ONED;
    +await reader.updateRuntimeSettings(settings);
    +
    +
    +
    see
    +

    RuntimeSettings

    +
    +
    +
    +

    Parameters

    + +

    Returns Promise<void>

    +
  • +
+
+
+
+

Other Methods

+
+ +

getOriginalImageInACanvas

+
    +
  • getOriginalImageInACanvas(): HTMLCanvasElement | OffscreenCanvas
  • +
+
    +
  • + +
    +
    +

    The original canvas.

    +
    reader.ifSaveOriginalImageInACanvas = true;
    +let results = await reader.decode(source);
    +document.body.append(reader.getOriginalImageInACanvas());
    +
    +
    +

    Returns HTMLCanvasElement | OffscreenCanvas

    +
  • +
+
+
+ +

isContextDestroyed

+
    +
  • isContextDestroyed(): boolean
  • +
+
    +
  • + +

    Returns boolean

    +
  • +
+
+
+ +

Static detectEnvironment

+
    +
  • detectEnvironment(): Promise<any>
  • +
+
    +
  • + +
    +
    +

    Detect environment and get a report.

    +
    console.log(Dynamsoft.DBR.BarcodeReader.detectEnvironment());
    +// {"wasm":true, "worker":true, "getUserMedia":true, "camera":true, "browser":"Chrome", "version":90, "OS":"Windows"}
    +
    +
    +

    Returns Promise<any>

    +
  • +
+
+
+
+ +
+
+
+
+

Legend

+
+
    +
  • Property
  • +
  • Method
  • +
  • Accessor
  • +
+
    +
  • Inherited property
  • +
  • Inherited method
  • +
  • Inherited accessor
  • +
+
    +
  • Static property
  • +
  • Static method
  • +
+
    +
  • Property
  • +
+
+
+
+
+

Generated using TypeDoc

+
+
+ + + + \ No newline at end of file diff --git a/doc/api reference/classes/barcodescanner.html b/doc/api reference/classes/barcodescanner.html new file mode 100644 index 00000000..dbbcfe9e --- /dev/null +++ b/doc/api reference/classes/barcodescanner.html @@ -0,0 +1,2736 @@ + + + + + + BarcodeScanner | Dynamsoft BarcodeReader SDK for Javascript - v8.6.0 + + + + + +
+
+
+
+ +
+
+ Options +
+
+ All +
    +
  • Public
  • +
  • Public/Protected
  • +
  • All
  • +
+
+ + +
+
+ Menu +
+
+
+
+
+
+ +

Class BarcodeScanner

+
+
+
+
+
+
+
+
+
+

The BarcodeScanner class is used for video decoding.

+
let pScanner = null;
+(async()=>{
+    let scanner = await (pScanner = pScanner || Dynamsoft.DBR.BarcodeScanner.createInstance());
+    scanner.onUnduplicatedRead = txt => console.log(txt);
+    await scanner.show();
+})();
+
+
+
+
+

Hierarchy

+ +
+
+

Index

+
+
+
+

Open and Close Events

+ +

Play and Pause Events

+ +

Camera Settings Events

+ +
+
+

UI Properties

+ +

Other Properties

+ +
+
+

Accessors

+ +
+
+

Initialize and Destroy Methods

+ +

Open and Close Methods

+ +

Play and Pause Methods

+ +

UI Methods

+ +

Camera Settings Methods

+ +

Decode Methods

+ +

Runtime Settings Methods

+ +

Other Methods

+ +
+
+
+
+
+

Open and Close Events

+
+ +

open

+ +
    +
  • + +
    +
    +

    Bind UI, open the camera, start decoding.

    +
    await scanner.setUIElement(document.getElementById("my-barcode-scanner"));
    +scanner.onUnduplicatedRead = (txt, result) => { alert(txt); console.log(result); };
    +await scanner.open();
    +// await scanner.close();
    +
    +
    +

    Returns Promise<ScannerPlayCallbackInfo>

    +
  • +
+
+
+ +

openVideo

+ +
    +
  • + +
    +
    +

    Bind UI, open the camera, but not decode.

    +
    await scanner.setUIElement(document.getElementById("my-barcode-scanner"));
    +await scanner.openVideo();
    +console.log(await scanner.decodeCurrentFrame());
    +// await scanner.close();
    +
    +
    +

    Returns Promise<ScannerPlayCallbackInfo>

    +
  • +
+
+
+ +

show

+ +
    +
  • + +
    +
    +

    Bind UI, open the camera, start decoding, and remove the UIElement display style if the original style is display:none;.

    +
    await scanner.setUIElement("https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@8.6.0/dist/dbr.scanner.html");
    +scanner.onUnduplicatedRead = (txt, result) => { alert(txt); console.log(result); };
    +await scanner.show();
    +// await scanner.hide();
    +
    +
    +

    Returns Promise<ScannerPlayCallbackInfo>

    +
  • +
+
+
+ +

showVideo

+ +
    +
  • + +
    +
    +

    Bind UI, open the camera, but not decode, and remove the UIElement display style if the original style is display:none;.

    +
    await scanner.showVideo()
    +console.log(await scanner.decodeCurrentFrame());
    +// await scanner.hide();
    +
    +
    +

    Returns Promise<ScannerPlayCallbackInfo>

    +
  • +
+
+
+
+

Play and Pause Events

+
+ +

play

+ +
    +
  • + +
    +
    +

    Continue the video.

    +
    scanner.pause(); // or scanner.stop()
    +\\*** a lot of work ***
    +await scanner.play();
    +
    +
    +

    Parameters

    +
      +
    • +
      Optional deviceId: string
      +
    • +
    • +
      Optional width: number
      +
    • +
    • +
      Optional height: number
      +
    • +
    +

    Returns Promise<ScannerPlayCallbackInfo>

    +
  • +
+
+
+
+

Camera Settings Events

+
+ +

setCurrentCamera

+ +
    +
  • + +
    +
    +

    Choose the camera and play it by its information or devide id.

    +
    let cameras = await scanner.getAllCameras();
    +if(cameras.length){
    +    await scanner.setCurrentCamera(cameras[0]);
    +}
    +
    +
    +

    Parameters

    +
      +
    • +
      cameraInfoOrDeviceId: any
      +
    • +
    +

    Returns Promise<ScannerPlayCallbackInfo>

    +
  • +
+
+
+ +

setResolution

+ +
    +
  • + +
    +
    +

    Set current camera resolution.

    +
    await scanner.setResolution(width, height);
    +
    +
    +

    Parameters

    +
      +
    • +
      width: number | number[]
      +
    • +
    • +
      height: number
      +
    • +
    +

    Returns Promise<ScannerPlayCallbackInfo>

    +
  • +
+
+
+
+

UI Properties

+
+ +

barcodeFillStyle

+
barcodeFillStyle: string = "rgba(254,180,32,0.3)"
+ +
+
+

Set the style used when filling in located barcode.

+
+
+
+
+ +

barcodeLineWidth

+
barcodeLineWidth: number = 1
+ +
+
+

Set the width of the located barcode border.

+
+
+
+
+ +

barcodeStrokeStyle

+
barcodeStrokeStyle: string = "rgba(254,180,32,0.9)"
+ +
+
+

Set the style of the located barcode border.

+
+
+
+
+ +

regionMaskFillStyle

+
regionMaskFillStyle: string = "rgba(0,0,0,0.5)"
+ +
+
+

Set the style used when filling the mask beyond the region.

+
+
+
+
+ +

regionMaskLineWidth

+
regionMaskLineWidth: number = 2
+ +
+
+

Set the width of the region border.

+
+
+
+
+ +

regionMaskStrokeStyle

+
regionMaskStrokeStyle: string = "rgb(254,142,20)"
+ +
+
+

Set the style of the region border.

+
+
+
+
+
+

Other Properties

+
+ +

bDestroyed

+
bDestroyed: boolean = false
+ +
+
+

Indicates whether the instance has been destroyed.

+
+
+
+
+ +

Optional onFrameRead

+
onFrameRead: (results: TextResult[]) => void
+ +
+
+

The event is triggered after a frame has been scanned. + The results object contains all the barcode results in this frame.

+
scanner.onFrameRead = results => {
+    for(let result of results){
+        console.log(result.barcodeText);
+    }
+};
+
+
+
+

Type declaration

+
    +
  • + +
      +
    • +

      Parameters

      + +

      Returns void

      +
    • +
    +
  • +
+
+
+
+ +

Optional onPlayed

+
onPlayed: (info: ScannerPlayCallbackInfo) => void
+ +
+
+

Triggered when the camera video stream is played.

+
scanner.onplayed = rsl=>{ console.log(rsl.width+'x'+rsl.height) };
+await scanner.show(); // or open, play, setCurrentCamera, like these.
+
+
+
+

Type declaration

+ +
+
+
+ +

Optional onUnduplicatedRead

+
onUnduplicatedRead: (txt: string, result: TextResult) => void
+ +
+
+

This event is triggered when a new, unduplicated barcode is found. + txt holds the barcode text result. result contains more info. + Old barcodes will be remembered for duplicateForgetTime.

+
scanner.onUnduplicatedRead = (txt, result) => {
+    alert(txt);
+    console.log(result);
+};
+
+
+
+

Type declaration

+
    +
  • + +
      +
    • +

      Parameters

      + +

      Returns void

      +
    • +
    +
  • +
+
+
+
+ +

vibrateDuration

+
vibrateDuration: number = 300
+ +
+
+

Get or set how long (ms) the vibration lasts.

+
+
+
see
+

[[bVibrateOnSuccessfulRead]],whenToVibrateforSuccessfulRead

+
+
+
+
+
+ +

videoSrc

+
videoSrc: string | MediaStream | MediaSource | Blob
+ +
+
+

Set a existing video source for decoding.

+
+
+
+
+
+

Accessors

+
+ +

ifSaveOriginalImageInACanvas

+
    +
  • get ifSaveOriginalImageInACanvas(): boolean
  • +
  • set ifSaveOriginalImageInACanvas(value: boolean): void
  • +
+
    +
  • + +
    +
    +

    Whether to save the original image into canvas.

    +
    reader.ifSaveOriginalImageInACanvas = true;
    +let results = await reader.decode(source);
    +document.body.append(reader.getOriginalImageInACanvas());
    +
    +
    +

    Returns boolean

    +
  • +
  • + +
    +
    +

    Whether to save the original image into canvas.

    +
    reader.ifSaveOriginalImageInACanvas = true;
    +let results = await reader.decode(source);
    +document.body.append(reader.getOriginalImageInACanvas());
    +
    +
    +

    Parameters

    +
      +
    • +
      value: boolean
      +
    • +
    +

    Returns void

    +
  • +
+
+
+ +

singleFrameMode

+
    +
  • get singleFrameMode(): boolean
  • +
  • set singleFrameMode(value: boolean): void
  • +
+
    +
  • + +
    +
    +

    A mode not use video, get a frame from OS camera instead.

    +
    let pScanner = null;
    +(async()=>{
    +    let scanner = await (pScanner = pScanner || Dynamsoft.DBR.BarcodeScanner.createInstance());
    +    if(scanner.singleFrameMode){
    +        // the browser does not provide webrtc API, dbrjs automatically use singleFrameMode instead
    +        scanner.show();
    +    }
    +})();
    +
    +
    +

    Returns boolean

    +
  • +
  • + +
    +
    +

    A mode not use video, get a frame from OS camera instead.

    +
    let pScanner = null;
    +(async()=>{
    +    let scanner = await (pScanner = pScanner || Dynamsoft.DBR.BarcodeScanner.createInstance());
    +    scanner.singleFrameMode = true; // use singleFrameMode anyway
    +    scanner.show();
    +})();
    +
    +
    +

    Parameters

    +
      +
    • +
      value: boolean
      +
    • +
    +

    Returns void

    +
  • +
+
+
+ +

soundOnSuccessfullRead

+
    +
  • get soundOnSuccessfullRead(): HTMLAudioElement
  • +
  • set soundOnSuccessfullRead(value: HTMLAudioElement): void
  • +
+
    +
  • + +
    +
    +

    The sound to play when the scanner get successfull read.

    +
    +
    +

    Returns HTMLAudioElement

    +
  • +
  • + +
    +
    +

    The sound to play when the scanner get successfull read.

    +
    scanner.soundOnSuccessfullRead = new Audio("./pi.mp3");
    +
    +
    +

    Parameters

    +
      +
    • +
      value: HTMLAudioElement
      +
    • +
    +

    Returns void

    +
  • +
+
+
+ +

whenToPlaySoundforSuccessfulRead

+
    +
  • get whenToPlaySoundforSuccessfulRead(): string
  • +
  • set whenToPlaySoundforSuccessfulRead(value: string): void
  • +
+
    +
  • + +
    +
    +

    Whether to play sound when the scanner reads a barcode successfully. + Default value is never, which does not play sound. + Use frame to play a sound when any barcode is found within a frame. + Use unduplicated to play a sound only when any unique/unduplicated barcode is found within a frame.

    +
    // A user gesture required. https://developers.google.com/web/updates/2017/09/autoplay-policy-changes#chrome_enterprise_policies
    +startPlayButton.addEventListener('click', function() {
    +  scanner.whenToPlaySoundforSuccessfulRead = 'frame';
    +});
    +

    refer: favicon bug https://bugs.chromium.org/p/chromium/issues/detail?id=1069731&q=favicon&can=2

    +
    +
    +

    Returns string

    +
  • +
  • + +
    +
    +

    Whether to play sound when the scanner reads a barcode successfully. + Default value is never, which does not play sound. + Use frame to play a sound when any barcode is found within a frame. + Use unduplicated to play a sound only when any unique/unduplicated barcode is found within a frame.

    +
    // A user gesture required. https://developers.google.com/web/updates/2017/09/autoplay-policy-changes#chrome_enterprise_policies
    +startPlayButton.addEventListener('click', function() {
    +  scanner.whenToPlaySoundforSuccessfulRead = 'frame';
    +});
    +

    refer: favicon bug https://bugs.chromium.org/p/chromium/issues/detail?id=1069731&q=favicon&can=2

    +
    +
    +

    Parameters

    +
      +
    • +
      value: string
      +
    • +
    +

    Returns void

    +
  • +
+
+
+ +

whenToVibrateforSuccessfulRead

+
    +
  • get whenToVibrateforSuccessfulRead(): string
  • +
  • set whenToVibrateforSuccessfulRead(value: string): void
  • +
+
    +
  • + +
    +
    +

    Whether to vibrate when the scanner reads a barcode successfully. + Default value is never, which does not vibrate. + Use frame to vibrate when any barcode is found within a frame. + Use unduplicated to vibrate only when any unique/unduplicated barcode is found within a frame.

    +
    // Can I use? https://caniuse.com/?search=vibrate
    +// A user gesture required. https://developers.google.com/web/updates/2017/09/autoplay-policy-changes#chrome_enterprise_policies
    +startPlayButton.addEventListener('click', function() {
    +  scanner.whenToVibrateforSuccessfulRead = 'frame';
    +});
    +
    +
    +

    Returns string

    +
  • +
  • + +
    +
    +

    Whether to vibrate when the scanner reads a barcode successfully. + Default value is never, which does not vibrate. + Use frame to vibrate when any barcode is found within a frame. + Use unduplicated to vibrate only when any unique/unduplicated barcode is found within a frame.

    +
    // Can I use? https://caniuse.com/?search=vibrate
    +// A user gesture required. https://developers.google.com/web/updates/2017/09/autoplay-policy-changes#chrome_enterprise_policies
    +startPlayButton.addEventListener('click', function() {
    +  scanner.whenToVibrateforSuccessfulRead = 'frame';
    +});
    +
    +
    +

    Parameters

    +
      +
    • +
      value: string
      +
    • +
    +

    Returns void

    +
  • +
+
+
+ +

Static _bUseFullFeature

+
    +
  • get _bUseFullFeature(): boolean
  • +
  • set _bUseFullFeature(value: boolean): void
  • +
+ +
+
+ +

Static defaultUIElementURL

+
    +
  • get defaultUIElementURL(): string
  • +
  • set defaultUIElementURL(value: string): void
  • +
+
    +
  • + +
    +
    +

    The url of the default scanner UI. + Can only be changed before createInstance.

    +
    Dynamsoft.DBR.BarcodeScanner.defaultUIElementURL = "https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@8.6.0/dist/dbr.scanner.html";
    +let pScanner = null;
    +(async()=>{
    +    let scanner = await (pScanner = pScanner || Dynamsoft.DBR.BarcodeScanner.createInstance());
    +    await scanner.show();
    +})();
    +
    +
    +

    Returns string

    +
  • +
  • + +
    +
    +

    The url of the default scanner UI. + Can only be changed before createInstance.

    +
    Dynamsoft.DBR.BarcodeScanner.defaultUIElementURL = "https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@8.6.0/dist/dbr.scanner.html";
    +let pScanner = null;
    +(async()=>{
    +    let scanner = await (pScanner = pScanner || Dynamsoft.DBR.BarcodeScanner.createInstance());
    +    await scanner.show();
    +})();
    +
    +
    +

    Parameters

    +
      +
    • +
      value: string
      +
    • +
    +

    Returns void

    +
  • +
+
+
+ +

Static engineResourcePath

+
    +
  • get engineResourcePath(): string
  • +
  • set engineResourcePath(value: string): void
  • +
+
    +
  • + +
    +
    +

    Specify the Barcode Reader SDK engine (WASM) url. The SDK tries to automatically explore the engine location. + If the auto-explored engine location is incorrect, you can manually specify the engine location. + The property needs to be set before loadWasm.

    +
    Dynamsoft.DBR.BarcodeReader.engineResourcePath = "https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@8.6.0/dist/";
    +await Dynamsoft.DBR.BarcodeReader.loadWasm();
    +
    +
    +

    Returns string

    +
  • +
  • + +
    +
    +

    Specify the Barcode Reader SDK engine (WASM) url. The SDK tries to automatically explore the engine location. + If the auto-explored engine location is incorrect, you can manually specify the engine location. + The property needs to be set before loadWasm.

    +
    Dynamsoft.DBR.BarcodeReader.engineResourcePath = "https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@8.6.0/dist/";
    +await Dynamsoft.DBR.BarcodeReader.loadWasm();
    +
    +
    +

    Parameters

    +
      +
    • +
      value: string
      +
    • +
    +

    Returns void

    +
  • +
+
+
+ +

Static handshakeCode

+
    +
  • get handshakeCode(): string
  • +
  • set handshakeCode(keys: string): void
  • +
+
    +
  • + +
    +
    +

    Get or set the Dynamsoft Barcode Reader SDK handshake code. The handshakeCode is an alias of productKeys. Specifically refers to the key that requires network authentication.

    +
    Dynamsoft.DBR.BarcodeReader.handshakeCode = "123****-mytest";
    +

    For convenience, you can set handshakeCode in script tag instead.

    +
    <script src="https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@8.6.0/dist/dbr.js" data-handshakeCode="123****-mytest"></script>
    +
    +
    +

    Returns string

    +
  • +
  • + +
    +
    +

    Get or set the Dynamsoft Barcode Reader SDK handshake code. The handshakeCode is an alias of productKeys. Specifically refers to the key that requires network authentication.

    +
    Dynamsoft.DBR.BarcodeReader.handshakeCode = "123****-mytest";
    +

    For convenience, you can set handshakeCode in script tag instead.

    +
    <script src="https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@8.6.0/dist/dbr.js" data-handshakeCode="123****-mytest"></script>
    +
    +
    +

    Parameters

    +
      +
    • +
      keys: string
      +
    • +
    +

    Returns void

    +
  • +
+
+
+ +

Static licenseServer

+
    +
  • get licenseServer(): string | string[]
  • +
  • set licenseServer(value: string[] | string): void
  • +
+
    +
  • + +
    +
    +

    Specify the license server URL.

    +
    +
    +

    Returns string | string[]

    +
  • +
  • + +
    +
    +

    Specify the license server URL.

    +
    +
    +

    Parameters

    +
      +
    • +
      value: string[] | string
      +
    • +
    +

    Returns void

    +
  • +
+
+
+ +

Static organizationID

+
    +
  • get organizationID(): string
  • +
  • set organizationID(value: string): void
  • +
+
    +
  • + +
    +
    +

    Use organization ID to get authentication from network. Keep handshakeCode empty if you want to use default handshake of the organization.

    +
    Dynamsoft.DBR.BarcodeReader.organizationID = "123****";
    +

    For convenience, you can set organizationID in script tag instead.

    +
    <script src="https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@8.6.0/dist/dbr.js" data-organizationID="123****"></script>
    +
    +
    +
    see
    +

    handshakeCode

    +
    +
    +
    +

    Returns string

    +
  • +
  • + +
    +
    +

    Use organization ID to get authentication from network. Keep handshakeCode empty if you want to use default handshake of the organization.

    +
    Dynamsoft.DBR.BarcodeReader.organizationID = "123****";
    +

    For convenience, you can set organizationID in script tag instead.

    +
    <script src="https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@8.6.0/dist/dbr.js" data-organizationID="123****"></script>
    +
    +
    +
    see
    +

    handshakeCode

    +
    +
    +
    +

    Parameters

    +
      +
    • +
      value: string
      +
    • +
    +

    Returns void

    +
  • +
+
+
+ +

Static productKeys

+
    +
  • get productKeys(): string
  • +
  • set productKeys(keys: string): void
  • +
+
    +
  • + +
    +
    +

    Get or set the Dynamsoft Barcode Reader SDK product keys.

    +
    Dynamsoft.DBR.BarcodeReader.productKeys = "PRODUCT-KEYS";
    +

    For convenience, you can set productKeys in script tag instead.

    +
    <script src="https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@8.6.0/dist/dbr.js" data-productKeys="PRODUCT-KEYS"></script>
    +
    +
    +

    Returns string

    +
  • +
  • + +
    +
    +

    Get or set the Dynamsoft Barcode Reader SDK product keys.

    +
    Dynamsoft.DBR.BarcodeReader.productKeys = "PRODUCT-KEYS";
    +

    For convenience, you can set productKeys in script tag instead.

    +
    <script src="https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@8.6.0/dist/dbr.js" data-productKeys="PRODUCT-KEYS"></script>
    +
    +
    +

    Parameters

    +
      +
    • +
      keys: string
      +
    • +
    +

    Returns void

    +
  • +
+
+
+ +

Static sessionPassword

+
    +
  • get sessionPassword(): string
  • +
  • set sessionPassword(value: string): void
  • +
+
    +
  • + +
    +
    +

    Specify a password to protect the Handshake Code from abuse.

    +
    Dynamsoft.DBR.BarcodeReader.handshakeCode = "123****-mytest";
    +Dynamsoft.DBR.BarcodeReader.sessionPassword = "@#$%****";
    +

    Since js in the browser is plaintext, it is not safe to set a password. It is recommended that you bind the domain as Validation field in the handshake settings in dynamsoft website or your self-hosted license server.

    +
    +

    In nodejs, password is meaningful.

    +
    +
    see
    +

    handshakeCode

    +
    +
    +
    +

    Returns string

    +
  • +
  • + +
    +
    +

    Specify a password to protect the Handshake Code from abuse.

    +
    Dynamsoft.DBR.BarcodeReader.handshakeCode = "123****-mytest";
    +Dynamsoft.DBR.BarcodeReader.sessionPassword = "@#$%****";
    +

    Since js in the browser is plaintext, it is not safe to set a password. It is recommended that you bind the domain as Validation field in the handshake settings in dynamsoft website or your self-hosted license server.

    +
    +

    In nodejs, password is meaningful.

    +
    +
    see
    +

    handshakeCode

    +
    +
    +
    +

    Parameters

    +
      +
    • +
      value: string
      +
    • +
    +

    Returns void

    +
  • +
+
+
+ +

Static version

+
    +
  • get version(): string
  • +
+
    +
  • + +
    +
    +

    Get the current version.

    +
    +
    +

    Returns string

    +
  • +
+
+
+
+

Initialize and Destroy Methods

+
+ +

destroy

+
    +
  • destroy(): Promise<any>
  • +
+
    +
  • + +
    +
    +

    Destroy the BarcodeScanner instance. If your page needs to create new instances from time to time, don't forget to destroy unused old instances, otherwise it will cause memory leaks.

    +
    +
    +

    Returns Promise<any>

    +
  • +
+
+
+ +

Static createInstance

+ +
    +
  • + +
    +
    +

    Create a BarcodeScanner object.

    +
    let pScanner = null;
    +(async()=>{
    +    let scanner = await (pScanner = pScanner || Dynamsoft.DBR.BarcodeScanner.createInstance());
    +})();
    +
    +
    +

    Parameters

    +
      +
    • +
      Optional config: any
      +
    • +
    +

    Returns Promise<BarcodeScanner>

    +
  • +
+
+
+ +

Static isLoaded

+
    +
  • isLoaded(): boolean
  • +
+
    +
  • + +
    +
    +

    Check if the decoding module is loaded.

    +
    +
    +

    Returns boolean

    +
  • +
+
+
+ +

Static loadWasm

+
    +
  • loadWasm(): Promise<void>
  • +
+
    +
  • + +
    +
    +

    Before most operations, loadWasm needs to be excuted firstly. + Most time, you do not need excute loadWasm manually. Because when you excute createInstance, loadWasm will be excuted implicitly. + Some properties can't be changed after loadWasm. + Calling loadWasm in advance can avoid the long wait when createInstance.

    +
    window.addEventListener('DOMContentLoaded', (event) => {
    +  DBR.BarcodeReader.loadWasm();
    +});
    +
    +
    +

    Returns Promise<void>

    +
  • +
+
+
+
+

Open and Close Methods

+
+ +

close

+
    +
  • close(): Promise<void>
  • +
+
    +
  • + +
    +
    +

    Stop decoding, release camera, unbind UI.

    +
    await scanner.open();
    +await scanner.close();
    +
    await scanner.openVideo();
    +await scanner.close();
    +
    +
    +

    Returns Promise<void>

    +
  • +
+
+
+ +

hide

+
    +
  • hide(): Promise<void>
  • +
+
    +
  • + +
    +
    +

    Stop decoding, release camera, unbind UI, and set the Element as display:none;.

    +
    await scanner.show();
    +await scanner.hide();
    +
    await scanner.showVideo();
    +await scanner.hide();
    +
    +
    +

    Returns Promise<void>

    +
  • +
+
+
+ +

isOpen

+
    +
  • isOpen(): boolean
  • +
+
    +
  • + +
    +
    +

    Check if the scanner is open.

    +
    await scanner.show(); // or open(), showVideo(), openVideo();
    +console.assert(scanner.isOpen(), "scanner should be opened.");
    +await scanner.hide(); // or close();
    +console.assert(!scanner.isOpen(), "scanner should be closed.");
    +
    +
    +

    Returns boolean

    +
  • +
+
+
+
+

Play and Pause Methods

+
+ +

pause

+
    +
  • pause(): void
  • +
+
    +
  • + +
    +
    +

    Pause the video. Do not release the camera.

    +
    scanner.pause();
    +\\*** a lot of work ***
    +await scanner.play();
    +
    +
    +

    Returns void

    +
  • +
+
+
+ +

pauseScan

+
    +
  • pauseScan(): void
  • +
+
    +
  • + +
    +
    +

    Pause the decoding process.

    +
    pauseScan();
    +\\*** a lot of work ***
    +resumeScan();
    +
    +
    +

    Returns void

    +
  • +
+
+
+ +

resumeScan

+
    +
  • resumeScan(): void
  • +
+
    +
  • + +
    +
    +

    Resume the decoding process.

    +
    pauseScan();
    +\\*** a lot of work ***
    +resumeScan();
    +
    +
    +

    Returns void

    +
  • +
+
+
+ +

stop

+
    +
  • stop(): void
  • +
+
    +
  • + +
    +
    +

    Stop the video, and release the camera.

    +
    scanner.stop()
    +\\*** a lot of work ***
    +await scanner.play();
    +
    +
    +

    Returns void

    +
  • +
+
+
+
+

UI Methods

+
+ +

getUIElement

+
    +
  • getUIElement(): HTMLElement
  • +
+
    +
  • + +
    +
    +

    Get HTML element containing the BarcodeScanner instance.

    +
    +
    +

    Returns HTMLElement

    +
  • +
+
+
+ +

setUIElement

+
    +
  • setUIElement(elementOrUrl: HTMLElement | string): Promise<void>
  • +
+
    +
  • + +
    +
    +

    Set html element containing the BarcodeScanner instance.

    +
    <video class="dbrScanner-video" playsinline="true"></video>
    +<script>
    +    let pScanner = null;
    +    (async()=>{
    +        let scanner = await (pScanner = pScanner || Dynamsoft.DBR.BarcodeScanner.createInstance());
    +        await scanner.setUIElement(document.getElementsByClassName("dbrScanner-video")[0]);
    +        await scanner.open();
    +    })();
    +</script>
    +
    +
    +

    Parameters

    +
      +
    • +
      elementOrUrl: HTMLElement | string
      +
    • +
    +

    Returns Promise<void>

    +
  • +
+
+
+
+

Camera Settings Methods

+
+ +

getAllCameras

+ +
    +
  • + +
    +
    +

    Get infomation of all available cameras on the device.

    +
    let cameras = await scanner.getAllCameras();
    +if(cameras.length){
    +    await scanner.setCurrentCamera(cameras[0]);
    +}
    +
    +
    +

    Returns Promise<VideoDeviceInfo[]>

    +
  • +
+
+
+ +

getCapabilities

+
    +
  • getCapabilities(): MediaTrackCapabilities
  • +
+
    +
  • + +
    +
    +

    Get the camera capabilities. Chrome only. + Only available when the scanner is open.

    +
    > scanner.getCapabilities()
    +< {
    +  "aspectRatio":{"max":3840,"min":0.000462962962962963},
    +  "colorTemperature":{max: 7000, min: 2850, step: 50},
    +  "deviceId":"1e...3af7",
    +  "exposureCompensation": {max: 2.0000040531158447, min: -2.0000040531158447, step: 0.16666699945926666},
    +  "exposureMode":["continuous","manual"],
    +  "facingMode":["environment"],
    +  "focusMode":["continuous","single-shot","manual"],
    +  "frameRate":{"max":30,"min":0},
    +  "groupId":"71...a935",
    +  "height":{"max":2160,"min":1},
    +  "resizeMode":["none","crop-and-scale"],
    +  "torch":true,
    +  "whiteBalanceMode":["continuous","manual"],
    +  "width":{"max":3840,"min":1},
    +  "zoom":{max: 606, min: 100, step: 2}
    +}
    +
    +
    +
    see
    +

    turnOnTorch,turnOffTorch,setExposureCompensation,setZoom

    +
    +
    +
    +

    Returns MediaTrackCapabilities

    +
  • +
+
+
+ +

getCurrentCamera

+ +
    +
  • + +
    +
    +

    Get information about the currently used camera.

    +
    let camera = await scanner.getCurrentCamera();
    +
    +
    +

    Returns Promise<VideoDeviceInfo | null>

    +
  • +
+
+
+ +

getResolution

+
    +
  • getResolution(): number[]
  • +
+
    +
  • + +
    +
    +

    Get current camera resolution.

    +
    let rsl = await scanner.getResolution();
    +console.log(rsl.width + " x " + rsl.height);
    +
    +
    +

    Returns number[]

    +
  • +
+
+
+ +

getVideoSettings

+
    +
  • getVideoSettings(): MediaStreamConstraints
  • +
+
    +
  • + +
    +
    +

    Get current video settings.

    +
    +
    +

    Returns MediaStreamConstraints

    +
  • +
+
+
+ +

setColorTemperature

+
    +
  • setColorTemperature(value: number): Promise<void>
  • +
+
    +
  • + +
    +
    +

    Adjusts the color temperature. Chrome only. + Only available when the scanner is open. + Will reject if not support.

    +
    await scanner.setColorTemperature(5000);
    +
    +
    +
    see
    +

    getCapabilities

    +
    +
    +
    +

    Parameters

    +
      +
    • +
      value: number
      +
    • +
    +

    Returns Promise<void>

    +
  • +
+
+
+ +

setExposureCompensation

+
    +
  • setExposureCompensation(value: number): Promise<void>
  • +
+
    +
  • + +
    +
    +

    Adjusts the exposure level. Chrome only. + Only available when the scanner is open. + Will reject if not support.

    +
    await scanner.setExposureCompensation(-0.7);
    +
    +
    +
    see
    +

    getCapabilities

    +
    +
    +
    +

    Parameters

    +
      +
    • +
      value: number
      +
    • +
    +

    Returns Promise<void>

    +
  • +
+
+
+ +

setFrameRate

+
    +
  • setFrameRate(value: number): Promise<void>
  • +
+
    +
  • + +
    +
    +

    Adjusts the frame rate. Chrome only. + Only available when the scanner is open. + Will reject if not support.

    +
    await scanner.setFrameRate(10);
    +
    +
    +
    see
    +

    getCapabilities

    +
    +
    +
    +

    Parameters

    +
      +
    • +
      value: number
      +
    • +
    +

    Returns Promise<void>

    +
  • +
+
+
+ +

setZoom

+
    +
  • setZoom(value: number): Promise<void>
  • +
+
    +
  • + +
    +
    +

    Adjusts the zoom ratio. Chrome only. + Only available when the scanner is open. + Will reject if not support.

    +
    await scanner.setZoom(400);
    +
    +
    +
    see
    +

    getCapabilities

    +
    +
    +
    +

    Parameters

    +
      +
    • +
      value: number
      +
    • +
    +

    Returns Promise<void>

    +
  • +
+
+
+ +

turnOffTorch

+
    +
  • turnOffTorch(): Promise<void>
  • +
+
    +
  • + +
    +
    +

    Turn off the torch. Chrome only. + Only available when the scanner is open. + Will reject if not support.

    +
    await scanner.turnOffTorch();
    +
    +
    +
    see
    +

    turnOnTorch,getCapabilities

    +
    +
    +
    +

    Returns Promise<void>

    +
  • +
+
+
+ +

turnOnTorch

+
    +
  • turnOnTorch(): Promise<void>
  • +
+
    +
  • + +
    +
    +

    Turn on the torch/flashlight. Chrome only. + Only available when the scanner is open. + Will reject if not support.

    +
    await scanner.turnOnTorch();
    +
    +
    +
    see
    +

    turnOffTorch,getCapabilities

    +
    +
    +
    +

    Returns Promise<void>

    +
  • +
+
+
+ +

updateVideoSettings

+ +
    +
  • + +
    +
    +

    Modify and update video settings.

    +
    await scanner.updateVideoSettings({ video: {width: {ideal: 1280}, height: {ideal: 720}, facingMode: {ideal: 'environment'}} });
    +
    +
    +

    Parameters

    +
      +
    • +
      MediaStreamConstraints: any
      +
    • +
    +

    Returns Promise<ScannerPlayCallbackInfo | void>

    +
  • +
+
+
+
+

Decode Methods

+
+ +

decodeCurrentFrame

+
    +
  • decodeCurrentFrame(config?: any): Promise<TextResult[]>
  • +
+
    +
  • + +
    +
    +

    Decode barcodes from the current frame of the video.

    +
    await scanner.showVideo();
    +console.log(await scanner.decodeCurrentFrame());
    +
    +
    +

    Parameters

    +
      +
    • +
      Optional config: any
      +
    • +
    +

    Returns Promise<TextResult[]>

    +
  • +
+
+
+
+

Runtime Settings Methods

+
+ +

getModeArgument

+
    +
  • getModeArgument(modeName: string, index: number, argumentName: string): Promise<string>
  • +
+
    +
  • + +
    +
    +

    Get argument value for the specified mode parameter.

    +
    let argumentValue = await reader.getModeArgument("BinarizationModes", 0, "EnableFillBinaryVacancy");
    +
    +
    +

    Parameters

    +
      +
    • +
      modeName: string
      +
    • +
    • +
      index: number
      +
    • +
    • +
      argumentName: string
      +
    • +
    +

    Returns Promise<string>

    +
  • +
+
+
+ +

getRuntimeSettings

+ +
    +
  • + +
    +
    +

    Gets current runtime settings.

    +
    let settings = await reader.getRuntimeSettings();
    +settings.deblurLevel = 5;
    +await reader.updateRuntimeSettings(settings);
    +
    +
    +
    see
    +

    RuntimeSettings

    +
    +
    +
    +

    Returns Promise<RuntimeSettings>

    +
  • +
+
+
+ +

resetRuntimeSettings

+
    +
  • resetRuntimeSettings(): Promise<void>
  • +
+
    +
  • + +
    +
    +

    Resets all parameters to default values.

    +
    await reader.resetRuntimeSettings();
    +
    +
    +

    Returns Promise<void>

    +
  • +
+
+
+ +

setModeArgument

+
    +
  • setModeArgument(modeName: string, index: number, argumentName: string, argumentValue: string): Promise<void>
  • +
+
    +
  • + +
    +
    +

    Set argument value for the specified mode parameter.

    +
    await reader.setModeArgument("BinarizationModes", 0, "EnableFillBinaryVacancy", "1");
    +
    +
    +

    Parameters

    +
      +
    • +
      modeName: string
      +
    • +
    • +
      index: number
      +
    • +
    • +
      argumentName: string
      +
    • +
    • +
      argumentValue: string
      +
    • +
    +

    Returns Promise<void>

    +
  • +
+
+
+ +

updateRuntimeSettings

+
    +
  • updateRuntimeSettings(settings: RuntimeSettings | string): Promise<void>
  • +
+
    +
  • + +
    +
    +

    Update runtime settings with a given struct, or a string of speed, balance, coverage and single to use preset settings for BarcodeScanner. + We recommend using the speed-optimized single preset if scanning only one barcode at a time. The single is only available in BarcodeScanner. + The default settings for BarcodeScanner is single.

    +
    await scanner.updateRuntimeSettings('balance');
    +let settings = await scanner.getRuntimeSettings();
    +settings.barcodeFormatIds = Dynamsoft.DBR.EnumBarcodeFormat.BF_ONED;
    +await scanner.updateRuntimeSettings(settings);
    +
    +
    +
    see
    +

    RuntimeSettings

    +
    +
    +
    +

    Parameters

    + +

    Returns Promise<void>

    +
  • +
+
+
+
+

Other Methods

+
+ +

getOriginalImageInACanvas

+
    +
  • getOriginalImageInACanvas(): HTMLCanvasElement | OffscreenCanvas
  • +
+
    +
  • + +
    +
    +

    The original canvas.

    +
    reader.ifSaveOriginalImageInACanvas = true;
    +let results = await reader.decode(source);
    +document.body.append(reader.getOriginalImageInACanvas());
    +
    +
    +

    Returns HTMLCanvasElement | OffscreenCanvas

    +
  • +
+
+
+ +

getScanSettings

+ +
    +
  • + +
    +
    +

    Get current scan settings.

    +
    let scanSettings = await scanner.getScanSettings();
    +scanSettings.intervalTime = 50;
    +scanSettings.duplicateForgetTime = 1000;
    +await scanner.updateScanSettings(scanSettings);
    +
    +
    +

    Returns Promise<ScanSettings>

    +
  • +
+
+
+ +

isContextDestroyed

+
    +
  • isContextDestroyed(): boolean
  • +
+ +
+
+ +

updateScanSettings

+
    +
  • updateScanSettings(settings: ScanSettings): Promise<void>
  • +
+
    +
  • + +
    +
    +

    Modify and update scan settings.

    +
    let scanSettings = await scanner.getScanSettings();
    +scanSettings.intervalTime = 50;
    +scanSettings.duplicateForgetTime = 1000;
    +await scanner.updateScanSettings(scanSettings);
    +
    +
    +

    Parameters

    + +

    Returns Promise<void>

    +
  • +
+
+
+ +

Static detectEnvironment

+
    +
  • detectEnvironment(): Promise<any>
  • +
+
    +
  • + +
    +
    +

    Detect environment and get a report.

    +
    console.log(Dynamsoft.DBR.BarcodeReader.detectEnvironment());
    +// {"wasm":true, "worker":true, "getUserMedia":true, "camera":true, "browser":"Chrome", "version":90, "OS":"Windows"}
    +
    +
    +

    Returns Promise<any>

    +
  • +
+
+
+
+ +
+
+
+
+

Legend

+
+
    +
  • Property
  • +
  • Method
  • +
  • Accessor
  • +
+
    +
  • Inherited property
  • +
  • Inherited method
  • +
  • Inherited accessor
  • +
+
    +
  • Static property
  • +
  • Static method
  • +
+
    +
  • Property
  • +
+
+
+
+
+

Generated using TypeDoc

+
+
+ + + + \ No newline at end of file diff --git a/doc/api reference/classes/dbr.html b/doc/api reference/classes/dbr.html new file mode 100644 index 00000000..3cee6f00 --- /dev/null +++ b/doc/api reference/classes/dbr.html @@ -0,0 +1,1089 @@ + + + + + + DBR | Dynamsoft BarcodeReader SDK for Javascript - v8.6.0 + + + + + +
+
+
+
+ +
+
+ Options +
+
+ All +
    +
  • Public
  • +
  • Public/Protected
  • +
  • All
  • +
+
+ + +
+
+ Menu +
+
+
+
+
+
+ +

Class DBR

+
+
+
+
+
+
+
+

Hierarchy

+
    +
  • + DBR +
  • +
+
+
+

Index

+
+ +
+
+
+

Properties

+
+ +

Static BarcodeReader

+
BarcodeReader: BarcodeReader = BarcodeReader
+ +
+
+

The BarcodeReader class is used for image decoding + Comparing to BarcodeScanner, the default decoding settings are more accurate but slower.

+
let pReader = null;
+(async()=>{
+    let reader = await (pReader = pReader || Dynamsoft.DBR.BarcodeReader.createInstance());
+    let results = await reader.decode(imageSource);
+    for(let result of results){
+        console.log(result.barcodeText);
+    }
+})();
+
+
+
+
+ +

Static BarcodeScanner

+
BarcodeScanner: BarcodeScanner = BarcodeScanner
+ +
+
+

The BarcodeScanner class is used for video decoding.

+
let pScanner = null;
+(async()=>{
+    let scanner = await (pScanner = pScanner || Dynamsoft.DBR.BarcodeScanner.createInstance());
+    scanner.onUnduplicatedRead = txt => console.log(txt);
+    await scanner.show();
+})();
+
+
+
+
+ +

Static EnumBarcodeColourMode

+
EnumBarcodeColourMode: EnumBarcodeColourMode = EnumBarcodeColourMode
+ +
+
+ +

Static EnumBarcodeComplementMode

+
EnumBarcodeComplementMode: EnumBarcodeComplementMode = EnumBarcodeComplementMode
+ +
+
+ +

Static EnumBarcodeFormat

+
EnumBarcodeFormat: EnumBarcodeFormat = EnumBarcodeFormat
+ +
+
+ +

Static EnumBarcodeFormat_2

+
EnumBarcodeFormat_2: EnumBarcodeFormat_2 = EnumBarcodeFormat_2
+ +
+
+ +

Static EnumBinarizationMode

+
EnumBinarizationMode: EnumBinarizationMode = EnumBinarizationMode
+ +
+
+ +

Static EnumClarityCalculationMethod

+
EnumClarityCalculationMethod: EnumClarityCalculationMethod = EnumClarityCalculationMethod
+ +
+
+ +

Static EnumClarityFilterMode

+
EnumClarityFilterMode: EnumClarityFilterMode = EnumClarityFilterMode
+ +
+
+ +

Static EnumColourClusteringMode

+
EnumColourClusteringMode: EnumColourClusteringMode = EnumColourClusteringMode
+ +
+
+ +

Static EnumColourConversionMode

+
EnumColourConversionMode: EnumColourConversionMode = EnumColourConversionMode
+ +
+
+ +

Static EnumConflictMode

+
EnumConflictMode: EnumConflictMode = EnumConflictMode
+ +
+
+ +

Static EnumDPMCodeReadingMode

+
EnumDPMCodeReadingMode: EnumDPMCodeReadingMode = EnumDPMCodeReadingMode
+ +
+
+ +

Static EnumDeblurMode

+
EnumDeblurMode: EnumDeblurMode = EnumDeblurMode
+ +
+
+ +

Static EnumDeformationResistingMode

+
EnumDeformationResistingMode: EnumDeformationResistingMode = EnumDeformationResistingMode
+ +
+
+ +

Static EnumErrorCode

+
EnumErrorCode: EnumErrorCode = EnumErrorCode
+ +
+
+ +

Static EnumGrayscaleTransformationMode

+
EnumGrayscaleTransformationMode: EnumGrayscaleTransformationMode = EnumGrayscaleTransformationMode
+ +
+
+ +

Static EnumIMResultDataType

+
EnumIMResultDataType: EnumIMResultDataType = EnumIMResultDataType
+ +
+
+ +

Static EnumImagePixelFormat

+
EnumImagePixelFormat: EnumImagePixelFormat = EnumImagePixelFormat
+ +
+
+ +

Static EnumImagePreprocessingMode

+
EnumImagePreprocessingMode: EnumImagePreprocessingMode = EnumImagePreprocessingMode
+ +
+
+ +

Static EnumIntermediateResultSavingMode

+
EnumIntermediateResultSavingMode: EnumIntermediateResultSavingMode = EnumIntermediateResultSavingMode
+ +
+
+ +

Static EnumIntermediateResultType

+
EnumIntermediateResultType: EnumIntermediateResultType = EnumIntermediateResultType
+ +
+
+ +

Static EnumLocalizationMode

+
EnumLocalizationMode: EnumLocalizationMode = EnumLocalizationMode
+ +
+
+ +

Static EnumPDFReadingMode

+
EnumPDFReadingMode: EnumPDFReadingMode = EnumPDFReadingMode
+ +
+
+ +

Static EnumQRCodeErrorCorrectionLevel

+
EnumQRCodeErrorCorrectionLevel: EnumQRCodeErrorCorrectionLevel = EnumQRCodeErrorCorrectionLevel
+ +
+
+ +

Static EnumRegionPredetectionMode

+
EnumRegionPredetectionMode: EnumRegionPredetectionMode = EnumRegionPredetectionMode
+ +
+
+ +

Static EnumResultCoordinateType

+
EnumResultCoordinateType: EnumResultCoordinateType = EnumResultCoordinateType
+ +
+
+ +

Static EnumResultType

+
EnumResultType: EnumResultType = EnumResultType
+ +
+
+ +

Static EnumScaleUpMode

+
EnumScaleUpMode: EnumScaleUpMode = EnumScaleUpMode
+ +
+
+ +

Static EnumTerminatePhase

+
EnumTerminatePhase: EnumTerminatePhase = EnumTerminatePhase
+ +
+
+ +

Static EnumTextFilterMode

+
EnumTextFilterMode: EnumTextFilterMode = EnumTextFilterMode
+ +
+
+ +

Static EnumTextResultOrderMode

+
EnumTextResultOrderMode: EnumTextResultOrderMode = EnumTextResultOrderMode
+ +
+
+ +

Static EnumTextureDetectionMode

+
EnumTextureDetectionMode: EnumTextureDetectionMode = EnumTextureDetectionMode
+ +
+
+
+

Accessors

+
+ +

Static engineResourcePath

+
    +
  • get engineResourcePath(): string
  • +
  • set engineResourcePath(value: string): void
  • +
+
    +
  • + +
    +
    +

    Specify the Barcode Reader SDK engine (WASM) url. The SDK tries to automatically explore the engine location. + If the auto-explored engine location is incorrect, you can manually specify the engine location. + The property needs to be set before loadWasm.

    +
    Dynamsoft.DBR.engineResourcePath = "https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@8.6.0/dist/";
    +await Dynamsoft.DBR.loadWasm();
    +
    +
    +

    Returns string

    +
  • +
  • + +
    +
    +

    Specify the Barcode Reader SDK engine (WASM) url. The SDK tries to automatically explore the engine location. + If the auto-explored engine location is incorrect, you can manually specify the engine location. + The property needs to be set before loadWasm.

    +
    Dynamsoft.DBR.engineResourcePath = "https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@8.6.0/dist/";
    +await Dynamsoft.DBR.loadWasm();
    +
    +
    +

    Parameters

    +
      +
    • +
      value: string
      +
    • +
    +

    Returns void

    +
  • +
+
+
+ +

Static handshakeCode

+
    +
  • get handshakeCode(): string
  • +
  • set handshakeCode(keys: string): void
  • +
+
    +
  • + +
    +
    +

    Get or set the Dynamsoft Barcode Reader SDK handshake code. The handshakeCode is an alias of productKeys. Specifically refers to the key that requires network authentication.

    +
    Dynamsoft.DBR.handshakeCode = "123****-mytest";
    +

    For convenience, you can set handshakeCode in script tag instead.

    +
    <script src="https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@8.6.0/dist/dbr.js" data-handshakeCode="123****-mytest"></script>
    +
    +
    +

    Returns string

    +
  • +
  • + +
    +
    +

    Get or set the Dynamsoft Barcode Reader SDK handshake code. The handshakeCode is an alias of productKeys. Specifically refers to the key that requires network authentication.

    +
    Dynamsoft.DBR.handshakeCode = "123****-mytest";
    +

    For convenience, you can set handshakeCode in script tag instead.

    +
    <script src="https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@8.6.0/dist/dbr.js" data-handshakeCode="123****-mytest"></script>
    +
    +
    +

    Parameters

    +
      +
    • +
      keys: string
      +
    • +
    +

    Returns void

    +
  • +
+
+
+ +

Static licenseServer

+
    +
  • get licenseServer(): string | string[]
  • +
  • set licenseServer(value: string[] | string): void
  • +
+
    +
  • + +
    +
    +

    Specify the license server URL.

    +
    +
    +

    Returns string | string[]

    +
  • +
  • + +
    +
    +

    Specify the license server URL.

    +
    +
    +

    Parameters

    +
      +
    • +
      value: string[] | string
      +
    • +
    +

    Returns void

    +
  • +
+
+
+ +

Static organizationID

+
    +
  • get organizationID(): string
  • +
  • set organizationID(keys: string): void
  • +
+
    +
  • + +
    +
    +

    Use organization ID to get authentication from network. Keep handshakeCode empty if you want to use default handshake of the organization.

    +
    Dynamsoft.DBR.organizationID = "123****";
    +

    For convenience, you can set organizationID in script tag instead.

    +
    <script src="https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@8.6.0/dist/dbr.js" data-organizationID="123****"></script>
    +
    +
    +
    see
    +

    handshakeCode

    +
    +
    +
    +

    Returns string

    +
  • +
  • + +
    +
    +

    Use organization ID to get authentication from network. Keep handshakeCode empty if you want to use default handshake of the organization.

    +
    Dynamsoft.DBR.organizationID = "123****";
    +

    For convenience, you can set organizationID in script tag instead.

    +
    <script src="https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@8.6.0/dist/dbr.js" data-organizationID="123****"></script>
    +
    +
    +
    see
    +

    handshakeCode

    +
    +
    +
    +

    Parameters

    +
      +
    • +
      keys: string
      +
    • +
    +

    Returns void

    +
  • +
+
+
+ +

Static productKeys

+
    +
  • get productKeys(): string
  • +
  • set productKeys(keys: string): void
  • +
+
    +
  • + +
    +
    +

    Get or set the Dynamsoft Barcode Reader SDK product keys.

    +
    Dynamsoft.DBR.productKeys = "PRODUCT-KEYS";
    +

    For convenience, you can set productKeys in script tag instead.

    +
    <script src="https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@8.6.0/dist/dbr.js" data-productKeys="PRODUCT-KEYS"></script>
    +
    +
    +

    Returns string

    +
  • +
  • + +
    +
    +

    Get or set the Dynamsoft Barcode Reader SDK product keys.

    +
    Dynamsoft.DBR.productKeys = "PRODUCT-KEYS";
    +

    For convenience, you can set productKeys in script tag instead.

    +
    <script src="https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@8.6.0/dist/dbr.js" data-productKeys="PRODUCT-KEYS"></script>
    +
    +
    +

    Parameters

    +
      +
    • +
      keys: string
      +
    • +
    +

    Returns void

    +
  • +
+
+
+ +

Static sessionPassword

+
    +
  • get sessionPassword(): string
  • +
  • set sessionPassword(keys: string): void
  • +
+
    +
  • + +
    +
    +

    Specify a password to protect the Handshake Code from abuse.

    +
    Dynamsoft.DBR.handshakeCode = "123****-mytest";
    +Dynamsoft.DBR.sessionPassword = "@#$%****";
    +

    Since js in the browser is plaintext, it is not safe to set a password. It is recommended that you bind the domain as Validation field in the handshake settings in dynamsoft website or your self-hosted license server.

    +
    +

    In nodejs, password is meaningful.

    +
    +
    see
    +

    handshakeCode

    +
    +
    +
    +

    Returns string

    +
  • +
  • + +
    +
    +

    Specify a password to protect the Handshake Code from abuse.

    +
    Dynamsoft.DBR.handshakeCode = "123****-mytest";
    +Dynamsoft.DBR.sessionPassword = "@#$%****";
    +

    Since js in the browser is plaintext, it is not safe to set a password. It is recommended that you bind the domain as Validation field in the handshake settings in dynamsoft website or your self-hosted license server.

    +
    +

    In nodejs, password is meaningful.

    +
    +
    see
    +

    handshakeCode

    +
    +
    +
    +

    Parameters

    +
      +
    • +
      keys: string
      +
    • +
    +

    Returns void

    +
  • +
+
+
+ +

Static version

+
    +
  • get version(): string
  • +
+
    +
  • + +
    +
    +

    Get the current version.

    +
    +
    +

    Returns string

    +
  • +
+
+
+
+

Methods

+
+ +

Static detectEnvironment

+
    +
  • detectEnvironment(): Promise<any>
  • +
+
    +
  • + +
    +
    +

    Detect environment and get a report.

    +
    console.log(Dynamsoft.DBR.detectEnvironment());
    +// {"wasm":true, "worker":true, "getUserMedia":true, "camera":true, "browser":"Chrome", "version":90, "OS":"Windows"}
    +
    +
    +

    Returns Promise<any>

    +
  • +
+
+
+ +

Static isWasmLoaded

+
    +
  • isWasmLoaded(): boolean
  • +
+
    +
  • + +
    +
    +

    Check if the decoding module is loaded.

    +
    +
    +

    Returns boolean

    +
  • +
+
+
+ +

Static loadWasm

+
    +
  • loadWasm(): Promise<void>
  • +
+
    +
  • + +
    +
    +

    Before most operations, loadWasm needs to be excuted firstly. + Most time, you do not need excute loadWasm manually. Because when you excute createInstance, loadWasm will be excuted implicitly. + Some properties can't be changed after loadWasm. + Calling loadWasm in advance can avoid the long wait when createInstance.

    +
    window.addEventListener('DOMContentLoaded', (event) => {
    +  DBR.loadWasm();
    +});
    +
    +
    +

    Returns Promise<void>

    +
  • +
+
+
+
+ +
+
+
+
+

Legend

+
+
    +
  • Property
  • +
  • Method
  • +
  • Accessor
  • +
+
    +
  • Inherited property
  • +
  • Inherited method
  • +
  • Inherited accessor
  • +
+
    +
  • Static property
  • +
  • Static method
  • +
+
    +
  • Property
  • +
+
+
+
+
+

Generated using TypeDoc

+
+
+ + + + \ No newline at end of file diff --git a/doc/api reference/enums/enumbarcodecolourmode.html b/doc/api reference/enums/enumbarcodecolourmode.html new file mode 100644 index 00000000..edd1d3de --- /dev/null +++ b/doc/api reference/enums/enumbarcodecolourmode.html @@ -0,0 +1,248 @@ + + + + + + EnumBarcodeColourMode | Dynamsoft BarcodeReader SDK for Javascript - v8.6.0 + + + + + +
+
+
+
+ +
+
+ Options +
+
+ All +
    +
  • Public
  • +
  • Public/Protected
  • +
  • All
  • +
+
+ + +
+
+ Menu +
+
+
+
+
+
+ +

Enumeration EnumBarcodeColourMode

+
+
+
+
+
+
+
+

Index

+
+ +
+
+
+

Enumeration members

+
+ +

BICM_DARK_LIGHT_MIXED

+
BICM_DARK_LIGHT_MIXED: = 16
+ +
+
+ +

BICM_DARK_ON_DARK

+
BICM_DARK_ON_DARK: = 4
+ +
+
+ +

BICM_DARK_ON_LIGHT

+
BICM_DARK_ON_LIGHT: = 1
+ +
+
+ +

BICM_DARK_ON_LIGHT_DARK_SURROUNDING

+
BICM_DARK_ON_LIGHT_DARK_SURROUNDING: = 32
+ +
+
+ +

BICM_LIGHT_ON_DARK

+
BICM_LIGHT_ON_DARK: = 2
+ +
+
+ +

BICM_LIGHT_ON_LIGHT

+
BICM_LIGHT_ON_LIGHT: = 8
+ +
+
+ +

BICM_REV

+
BICM_REV: = 2147483648
+ +
+
+ +

BICM_SKIP

+
BICM_SKIP: = 0
+ +
+
+
+ +
+
+
+
+

Legend

+
+
    +
  • Property
  • +
  • Method
  • +
  • Accessor
  • +
+
    +
  • Inherited property
  • +
  • Inherited method
  • +
  • Inherited accessor
  • +
+
    +
  • Static property
  • +
  • Static method
  • +
+
    +
  • Property
  • +
+
+
+
+
+

Generated using TypeDoc

+
+
+ + + + \ No newline at end of file diff --git a/doc/api reference/enums/enumbarcodecomplementmode.html b/doc/api reference/enums/enumbarcodecomplementmode.html new file mode 100644 index 00000000..fdf79c47 --- /dev/null +++ b/doc/api reference/enums/enumbarcodecomplementmode.html @@ -0,0 +1,192 @@ + + + + + + EnumBarcodeComplementMode | Dynamsoft BarcodeReader SDK for Javascript - v8.6.0 + + + + + +
+
+
+
+ +
+
+ Options +
+
+ All +
    +
  • Public
  • +
  • Public/Protected
  • +
  • All
  • +
+
+ + +
+
+ Menu +
+
+
+
+
+
+ +

Enumeration EnumBarcodeComplementMode

+
+
+
+
+
+
+
+

Index

+
+
+
+

Enumeration members

+ +
+
+
+
+
+

Enumeration members

+
+ +

BCM_AUTO

+
BCM_AUTO: = 1
+ +
+
+ +

BCM_GENERAL

+
BCM_GENERAL: = 2
+ +
+
+ +

BCM_REV

+
BCM_REV: = 2147483648
+ +
+
+ +

BCM_SKIP

+
BCM_SKIP: = 0
+ +
+
+
+ +
+
+
+
+

Legend

+
+
    +
  • Property
  • +
  • Method
  • +
  • Accessor
  • +
+
    +
  • Inherited property
  • +
  • Inherited method
  • +
  • Inherited accessor
  • +
+
    +
  • Static property
  • +
  • Static method
  • +
+
    +
  • Property
  • +
+
+
+
+
+

Generated using TypeDoc

+
+
+ + + + \ No newline at end of file diff --git a/doc/api reference/enums/enumbarcodeformat.html b/doc/api reference/enums/enumbarcodeformat.html new file mode 100644 index 00000000..a1226bb9 --- /dev/null +++ b/doc/api reference/enums/enumbarcodeformat.html @@ -0,0 +1,584 @@ + + + + + + EnumBarcodeFormat | Dynamsoft BarcodeReader SDK for Javascript - v8.6.0 + + + + + +
+
+
+
+ +
+
+ Options +
+
+ All +
    +
  • Public
  • +
  • Public/Protected
  • +
  • All
  • +
+
+ + +
+
+ Menu +
+
+
+
+
+
+ +

Enumeration EnumBarcodeFormat

+
+
+
+
+
+
+
+

Index

+
+ +
+
+
+

Enumeration members

+
+ +

BF_ALL

+
BF_ALL: = -31457281
+ +
+
+ +

BF_AZTEC

+
BF_AZTEC: = 268435456
+ +
+
+ +

BF_CODABAR

+
BF_CODABAR: = 8
+ +
+
+ +

BF_CODE_128

+
BF_CODE_128: = 2
+ +
+
+ +

BF_CODE_39

+
BF_CODE_39: = 1
+ +
+
+ +

BF_CODE_39_EXTENDED

+
BF_CODE_39_EXTENDED: = 1024
+ +
+
+ +

BF_CODE_93

+
BF_CODE_93: = 4
+ +
+
+ +

BF_DATAMATRIX

+
BF_DATAMATRIX: = 134217728
+ +
+
+ +

BF_EAN_13

+
BF_EAN_13: = 32
+ +
+
+ +

BF_EAN_8

+
BF_EAN_8: = 64
+ +
+
+ +

BF_GS1_COMPOSITE

+
BF_GS1_COMPOSITE: = -2147483648
+ +
+
+ +

BF_GS1_DATABAR

+
BF_GS1_DATABAR: = 260096
+ +
+
+ +

BF_GS1_DATABAR_EXPANDED

+
BF_GS1_DATABAR_EXPANDED: = 32768
+ +
+
+ +

BF_GS1_DATABAR_EXPANDED_STACKED

+
BF_GS1_DATABAR_EXPANDED_STACKED: = 65536
+ +
+
+ +

BF_GS1_DATABAR_LIMITED

+
BF_GS1_DATABAR_LIMITED: = 131072
+ +
+
+ +

BF_GS1_DATABAR_OMNIDIRECTIONAL

+
BF_GS1_DATABAR_OMNIDIRECTIONAL: = 2048
+ +
+
+ +

BF_GS1_DATABAR_STACKED

+
BF_GS1_DATABAR_STACKED: = 8192
+ +
+
+ +

BF_GS1_DATABAR_STACKED_OMNIDIRECTIONAL

+
BF_GS1_DATABAR_STACKED_OMNIDIRECTIONAL: = 16384
+ +
+
+ +

BF_GS1_DATABAR_TRUNCATED

+
BF_GS1_DATABAR_TRUNCATED: = 4096
+ +
+
+ +

BF_INDUSTRIAL_25

+
BF_INDUSTRIAL_25: = 512
+ +
+
+ +

BF_ITF

+
BF_ITF: = 16
+ +
+
+ +

BF_MAXICODE

+
BF_MAXICODE: = 536870912
+ +
+
+ +

BF_MICRO_PDF417

+
BF_MICRO_PDF417: = 524288
+ +
+
+ +

BF_MICRO_QR

+
BF_MICRO_QR: = 1073741824
+ +
+
+ +

BF_MSI_CODE

+
BF_MSI_CODE: = 1048576
+ +
+
+ +

BF_NULL

+
BF_NULL: = 0
+ +
+
+ +

BF_ONED

+
BF_ONED: = 1050623
+ +
+
+ +

BF_PATCHCODE

+
BF_PATCHCODE: = 262144
+ +
+
+ +

BF_PDF417

+
BF_PDF417: = 33554432
+ +
+
+ +

BF_QR_CODE

+
BF_QR_CODE: = 67108864
+ +
+
+ +

BF_UPC_A

+
BF_UPC_A: = 128
+ +
+
+ +

BF_UPC_E

+
BF_UPC_E: = 256
+ +
+
+
+ +
+
+
+
+

Legend

+
+
    +
  • Property
  • +
  • Method
  • +
  • Accessor
  • +
+
    +
  • Inherited property
  • +
  • Inherited method
  • +
  • Inherited accessor
  • +
+
    +
  • Static property
  • +
  • Static method
  • +
+
    +
  • Property
  • +
+
+
+
+
+

Generated using TypeDoc

+
+
+ + + + \ No newline at end of file diff --git a/doc/api reference/enums/enumbarcodeformat_2.html b/doc/api reference/enums/enumbarcodeformat_2.html new file mode 100644 index 00000000..f47fbd9a --- /dev/null +++ b/doc/api reference/enums/enumbarcodeformat_2.html @@ -0,0 +1,262 @@ + + + + + + EnumBarcodeFormat_2 | Dynamsoft BarcodeReader SDK for Javascript - v8.6.0 + + + + + +
+
+
+
+ +
+
+ Options +
+
+ All +
    +
  • Public
  • +
  • Public/Protected
  • +
  • All
  • +
+
+ + +
+
+ Menu +
+
+
+
+
+
+ +

Enumeration EnumBarcodeFormat_2

+
+
+
+
+
+
+
+

Index

+
+ +
+
+
+

Enumeration members

+
+ +

BF2_AUSTRALIANPOST

+
BF2_AUSTRALIANPOST: = 8388608
+ +
+
+ +

BF2_DOTCODE

+
BF2_DOTCODE: = 2
+ +
+
+ +

BF2_NONSTANDARD_BARCODE

+
BF2_NONSTANDARD_BARCODE: = 1
+ +
+
+ +

BF2_NULL

+
BF2_NULL: = 0
+ +
+
+ +

BF2_PLANET

+
BF2_PLANET: = 4194304
+ +
+
+ +

BF2_POSTALCODE

+
BF2_POSTALCODE: = 32505856
+ +
+
+ +

BF2_POSTNET

+
BF2_POSTNET: = 2097152
+ +
+
+ +

BF2_RM4SCC

+
BF2_RM4SCC: = 16777216
+ +
+
+ +

BF2_USPSINTELLIGENTMAIL

+
BF2_USPSINTELLIGENTMAIL: = 1048576
+ +
+
+
+ +
+
+
+
+

Legend

+
+
    +
  • Property
  • +
  • Method
  • +
  • Accessor
  • +
+
    +
  • Inherited property
  • +
  • Inherited method
  • +
  • Inherited accessor
  • +
+
    +
  • Static property
  • +
  • Static method
  • +
+
    +
  • Property
  • +
+
+
+
+
+

Generated using TypeDoc

+
+
+ + + + \ No newline at end of file diff --git a/doc/api reference/enums/enumbinarizationmode.html b/doc/api reference/enums/enumbinarizationmode.html new file mode 100644 index 00000000..b7fc8dc9 --- /dev/null +++ b/doc/api reference/enums/enumbinarizationmode.html @@ -0,0 +1,206 @@ + + + + + + EnumBinarizationMode | Dynamsoft BarcodeReader SDK for Javascript - v8.6.0 + + + + + +
+
+
+
+ +
+
+ Options +
+
+ All +
    +
  • Public
  • +
  • Public/Protected
  • +
  • All
  • +
+
+ + +
+
+ Menu +
+
+
+
+
+
+ +

Enumeration EnumBinarizationMode

+
+
+
+
+
+
+
+

Index

+
+
+
+

Enumeration members

+ +
+
+
+
+
+

Enumeration members

+
+ +

BM_AUTO

+
BM_AUTO: = 1
+ +
+
+ +

BM_LOCAL_BLOCK

+
BM_LOCAL_BLOCK: = 2
+ +
+
+ +

BM_REV

+
BM_REV: = 2147483648
+ +
+
+ +

BM_SKIP

+
BM_SKIP: = 0
+ +
+
+ +

BM_THRESHOLD

+
BM_THRESHOLD: = 4
+ +
+
+
+ +
+
+
+
+

Legend

+
+
    +
  • Property
  • +
  • Method
  • +
  • Accessor
  • +
+
    +
  • Inherited property
  • +
  • Inherited method
  • +
  • Inherited accessor
  • +
+
    +
  • Static property
  • +
  • Static method
  • +
+
    +
  • Property
  • +
+
+
+
+
+

Generated using TypeDoc

+
+
+ + + + \ No newline at end of file diff --git a/doc/api reference/enums/enumchargeway.html b/doc/api reference/enums/enumchargeway.html new file mode 100644 index 00000000..8ef92235 --- /dev/null +++ b/doc/api reference/enums/enumchargeway.html @@ -0,0 +1,288 @@ + + + + + + EnumChargeWay | Dynamsoft BarcodeReader SDK for Javascript - v8.6.0 + + + + + +
+
+
+
+ +
+
+ Options +
+
+ All +
    +
  • Public
  • +
  • Public/Protected
  • +
  • All
  • +
+
+ + +
+
+ Menu +
+
+
+
+
+
+ +

Enumeration EnumChargeWay

+
+
+
+
+
+
+
+

Index

+
+ +
+
+
+

Enumeration members

+
+ +

DM_CW_ACTIVE_DEVICE_COUNT

+
DM_CW_ACTIVE_DEVICE_COUNT: = "ActiveDeviceCount"
+ +
+
+

Charges by the count of active devices.

+
+
+
+
+ +

DM_CW_APP_DOMIAN_COUNT

+
DM_CW_APP_DOMIAN_COUNT: = "Domain"
+ +
+
+

Charges by the count of app domains.

+
+
+
+
+ +

DM_CW_AUTO

+
DM_CW_AUTO: = ""
+ +
+
+

The charge way automatically determined by the license server.

+
+
+
+
+ +

DM_CW_CONCURRENT_DEVICE_COUNT

+
DM_CW_CONCURRENT_DEVICE_COUNT: = "ConcurrentDeviceCount"
+ +
+
+

Charges by the count of concurrent devices.

+
+
+
+
+ +

DM_CW_CONCURRENT_INSTANCE_COUNT

+
DM_CW_CONCURRENT_INSTANCE_COUNT: = "ConcurrentInstanceCount"
+ +
+
+

Charges by the count of concurrent instances.

+
+
+
+
+ +

DM_CW_DEVICE_COUNT

+
DM_CW_DEVICE_COUNT: = "DeviceCount"
+ +
+
+

Charges by the count of devices.

+
+
+
+
+ +

DM_CW_INSTANCE_COUNT

+
DM_CW_INSTANCE_COUNT: = "InstanceCount"
+ +
+
+

Charges by the count of instances.

+
+
+
+
+ +

DM_CW_SCAN_COUNT

+
DM_CW_SCAN_COUNT: = "ScanCount"
+ +
+
+

Charges by the count of barcode scans.

+
+
+
+
+
+ +
+
+
+
+

Legend

+
+
    +
  • Property
  • +
  • Method
  • +
  • Accessor
  • +
+
    +
  • Inherited property
  • +
  • Inherited method
  • +
  • Inherited accessor
  • +
+
    +
  • Static property
  • +
  • Static method
  • +
+
    +
  • Property
  • +
+
+
+
+
+

Generated using TypeDoc

+
+
+ + + + \ No newline at end of file diff --git a/doc/api reference/enums/enumclaritycalculationmethod.html b/doc/api reference/enums/enumclaritycalculationmethod.html new file mode 100644 index 00000000..0552917f --- /dev/null +++ b/doc/api reference/enums/enumclaritycalculationmethod.html @@ -0,0 +1,150 @@ + + + + + + EnumClarityCalculationMethod | Dynamsoft BarcodeReader SDK for Javascript - v8.6.0 + + + + + +
+
+
+
+ +
+
+ Options +
+
+ All +
    +
  • Public
  • +
  • Public/Protected
  • +
  • All
  • +
+
+ + +
+
+ Menu +
+
+
+
+
+
+ +

Enumeration EnumClarityCalculationMethod

+
+
+
+
+
+
+
+

Index

+
+
+
+

Enumeration members

+ +
+
+
+
+
+

Enumeration members

+
+ +

ECCM_CONTRAST

+
ECCM_CONTRAST: = 1
+ +
+
+
+ +
+
+
+
+

Legend

+
+
    +
  • Property
  • +
  • Method
  • +
  • Accessor
  • +
+
    +
  • Inherited property
  • +
  • Inherited method
  • +
  • Inherited accessor
  • +
+
    +
  • Static property
  • +
  • Static method
  • +
+
    +
  • Property
  • +
+
+
+
+
+

Generated using TypeDoc

+
+
+ + + + \ No newline at end of file diff --git a/doc/api reference/enums/enumclarityfiltermode.html b/doc/api reference/enums/enumclarityfiltermode.html new file mode 100644 index 00000000..706c6213 --- /dev/null +++ b/doc/api reference/enums/enumclarityfiltermode.html @@ -0,0 +1,150 @@ + + + + + + EnumClarityFilterMode | Dynamsoft BarcodeReader SDK for Javascript - v8.6.0 + + + + + +
+
+
+
+ +
+
+ Options +
+
+ All +
    +
  • Public
  • +
  • Public/Protected
  • +
  • All
  • +
+
+ + +
+
+ Menu +
+
+
+
+
+
+ +

Enumeration EnumClarityFilterMode

+
+
+
+
+
+
+
+

Index

+
+
+
+

Enumeration members

+ +
+
+
+
+
+

Enumeration members

+
+ +

CFM_GENERAL

+
CFM_GENERAL: = 1
+ +
+
+
+ +
+
+
+
+

Legend

+
+
    +
  • Property
  • +
  • Method
  • +
  • Accessor
  • +
+
    +
  • Inherited property
  • +
  • Inherited method
  • +
  • Inherited accessor
  • +
+
    +
  • Static property
  • +
  • Static method
  • +
+
    +
  • Property
  • +
+
+
+
+
+

Generated using TypeDoc

+
+
+ + + + \ No newline at end of file diff --git a/doc/api reference/enums/enumcolourclusteringmode.html b/doc/api reference/enums/enumcolourclusteringmode.html new file mode 100644 index 00000000..99de44f0 --- /dev/null +++ b/doc/api reference/enums/enumcolourclusteringmode.html @@ -0,0 +1,192 @@ + + + + + + EnumColourClusteringMode | Dynamsoft BarcodeReader SDK for Javascript - v8.6.0 + + + + + +
+
+
+
+ +
+
+ Options +
+
+ All +
    +
  • Public
  • +
  • Public/Protected
  • +
  • All
  • +
+
+ + +
+
+ Menu +
+
+
+
+
+
+ +

Enumeration EnumColourClusteringMode

+
+
+
+
+
+
+
+

Index

+
+
+
+

Enumeration members

+ +
+
+
+
+
+

Enumeration members

+
+ +

CCM_AUTO

+
CCM_AUTO: = 1
+ +
+
+ +

CCM_GENERAL_HSV

+
CCM_GENERAL_HSV: = 2
+ +
+
+ +

CCM_REV

+
CCM_REV: = 2147483648
+ +
+
+ +

CCM_SKIP

+
CCM_SKIP: = 0
+ +
+
+
+ +
+
+
+
+

Legend

+
+
    +
  • Property
  • +
  • Method
  • +
  • Accessor
  • +
+
    +
  • Inherited property
  • +
  • Inherited method
  • +
  • Inherited accessor
  • +
+
    +
  • Static property
  • +
  • Static method
  • +
+
    +
  • Property
  • +
+
+
+
+
+

Generated using TypeDoc

+
+
+ + + + \ No newline at end of file diff --git a/doc/api reference/enums/enumcolourconversionmode.html b/doc/api reference/enums/enumcolourconversionmode.html new file mode 100644 index 00000000..8b903654 --- /dev/null +++ b/doc/api reference/enums/enumcolourconversionmode.html @@ -0,0 +1,178 @@ + + + + + + EnumColourConversionMode | Dynamsoft BarcodeReader SDK for Javascript - v8.6.0 + + + + + +
+
+
+
+ +
+
+ Options +
+
+ All +
    +
  • Public
  • +
  • Public/Protected
  • +
  • All
  • +
+
+ + +
+
+ Menu +
+
+
+
+
+
+ +

Enumeration EnumColourConversionMode

+
+
+
+
+
+
+
+

Index

+
+
+
+

Enumeration members

+ +
+
+
+
+
+

Enumeration members

+
+ +

CICM_GENERAL

+
CICM_GENERAL: = 1
+ +
+
+ +

CICM_REV

+
CICM_REV: = 2147483648
+ +
+
+ +

CICM_SKIP

+
CICM_SKIP: = 0
+ +
+
+
+ +
+
+
+
+

Legend

+
+
    +
  • Property
  • +
  • Method
  • +
  • Accessor
  • +
+
    +
  • Inherited property
  • +
  • Inherited method
  • +
  • Inherited accessor
  • +
+
    +
  • Static property
  • +
  • Static method
  • +
+
    +
  • Property
  • +
+
+
+
+
+

Generated using TypeDoc

+
+
+ + + + \ No newline at end of file diff --git a/doc/api reference/enums/enumconflictmode.html b/doc/api reference/enums/enumconflictmode.html new file mode 100644 index 00000000..595a194e --- /dev/null +++ b/doc/api reference/enums/enumconflictmode.html @@ -0,0 +1,164 @@ + + + + + + EnumConflictMode | Dynamsoft BarcodeReader SDK for Javascript - v8.6.0 + + + + + +
+
+
+
+ +
+
+ Options +
+
+ All +
    +
  • Public
  • +
  • Public/Protected
  • +
  • All
  • +
+
+ + +
+
+ Menu +
+
+
+
+
+
+ +

Enumeration EnumConflictMode

+
+
+
+
+
+
+
+

Index

+
+
+
+

Enumeration members

+ +
+
+
+
+
+

Enumeration members

+
+ +

CM_IGNORE

+
CM_IGNORE: = 1
+ +
+
+ +

CM_OVERWRITE

+
CM_OVERWRITE: = 2
+ +
+
+
+ +
+
+
+
+

Legend

+
+
    +
  • Property
  • +
  • Method
  • +
  • Accessor
  • +
+
    +
  • Inherited property
  • +
  • Inherited method
  • +
  • Inherited accessor
  • +
+
    +
  • Static property
  • +
  • Static method
  • +
+
    +
  • Property
  • +
+
+
+
+
+

Generated using TypeDoc

+
+
+ + + + \ No newline at end of file diff --git a/doc/api reference/enums/enumdeblurmode.html b/doc/api reference/enums/enumdeblurmode.html new file mode 100644 index 00000000..db7cd5c0 --- /dev/null +++ b/doc/api reference/enums/enumdeblurmode.html @@ -0,0 +1,276 @@ + + + + + + EnumDeblurMode | Dynamsoft BarcodeReader SDK for Javascript - v8.6.0 + + + + + +
+
+
+
+ +
+
+ Options +
+
+ All +
    +
  • Public
  • +
  • Public/Protected
  • +
  • All
  • +
+
+ + +
+
+ Menu +
+
+
+
+
+
+ +

Enumeration EnumDeblurMode

+
+
+
+
+
+
+
+

Index

+
+ +
+
+
+

Enumeration members

+
+ +

DM_BASED_ON_LOC_BIN

+
DM_BASED_ON_LOC_BIN: = 128
+ +
+
+ +

DM_DEEP_ANALYSIS

+
DM_DEEP_ANALYSIS: = 32
+ +
+
+ +

DM_DIRECT_BINARIZATION

+
DM_DIRECT_BINARIZATION: = 1
+ +
+
+ +

DM_GRAY_EQUALIZATION

+
DM_GRAY_EQUALIZATION: = 4
+ +
+
+ +

DM_MORPHING

+
DM_MORPHING: = 16
+ +
+
+ +

DM_SHARPENING

+
DM_SHARPENING: = 64
+ +
+
+ +

DM_SHARPENING_SMOOTHING

+
DM_SHARPENING_SMOOTHING: = 256
+ +
+
+ +

DM_SKIP

+
DM_SKIP: = 0
+ +
+
+ +

DM_SMOOTHING

+
DM_SMOOTHING: = 8
+ +
+
+ +

DM_THRESHOLD_BINARIZATION

+
DM_THRESHOLD_BINARIZATION: = 2
+ +
+
+
+ +
+
+
+
+

Legend

+
+
    +
  • Property
  • +
  • Method
  • +
  • Accessor
  • +
+
    +
  • Inherited property
  • +
  • Inherited method
  • +
  • Inherited accessor
  • +
+
    +
  • Static property
  • +
  • Static method
  • +
+
    +
  • Property
  • +
+
+
+
+
+

Generated using TypeDoc

+
+
+ + + + \ No newline at end of file diff --git a/doc/api reference/enums/enumdeformationresistingmode.html b/doc/api reference/enums/enumdeformationresistingmode.html new file mode 100644 index 00000000..b4ceb430 --- /dev/null +++ b/doc/api reference/enums/enumdeformationresistingmode.html @@ -0,0 +1,192 @@ + + + + + + EnumDeformationResistingMode | Dynamsoft BarcodeReader SDK for Javascript - v8.6.0 + + + + + +
+
+
+
+ +
+
+ Options +
+
+ All +
    +
  • Public
  • +
  • Public/Protected
  • +
  • All
  • +
+
+ + +
+
+ Menu +
+
+
+
+
+
+ +

Enumeration EnumDeformationResistingMode

+
+
+
+
+
+
+
+

Index

+
+
+
+

Enumeration members

+ +
+
+
+
+
+

Enumeration members

+
+ +

DRM_AUTO

+
DRM_AUTO: = 1
+ +
+
+ +

DRM_GENERAL

+
DRM_GENERAL: = 2
+ +
+
+ +

DRM_REV

+
DRM_REV: = 2147483648
+ +
+
+ +

DRM_SKIP

+
DRM_SKIP: = 0
+ +
+
+
+ +
+
+
+
+

Legend

+
+
    +
  • Property
  • +
  • Method
  • +
  • Accessor
  • +
+
    +
  • Inherited property
  • +
  • Inherited method
  • +
  • Inherited accessor
  • +
+
    +
  • Static property
  • +
  • Static method
  • +
+
    +
  • Property
  • +
+
+
+
+
+

Generated using TypeDoc

+
+
+ + + + \ No newline at end of file diff --git a/doc/api reference/enums/enumdpmcodereadingmode.html b/doc/api reference/enums/enumdpmcodereadingmode.html new file mode 100644 index 00000000..2c602268 --- /dev/null +++ b/doc/api reference/enums/enumdpmcodereadingmode.html @@ -0,0 +1,192 @@ + + + + + + EnumDPMCodeReadingMode | Dynamsoft BarcodeReader SDK for Javascript - v8.6.0 + + + + + +
+
+
+
+ +
+
+ Options +
+
+ All +
    +
  • Public
  • +
  • Public/Protected
  • +
  • All
  • +
+
+ + +
+
+ Menu +
+
+
+
+
+
+ +

Enumeration EnumDPMCodeReadingMode

+
+
+
+
+
+
+
+

Index

+
+
+
+

Enumeration members

+ +
+
+
+
+
+

Enumeration members

+
+ +

DPMCRM_AUTO

+
DPMCRM_AUTO: = 1
+ +
+
+ +

DPMCRM_GENERAL

+
DPMCRM_GENERAL: = 2
+ +
+
+ +

DPMCRM_REV

+
DPMCRM_REV: = 2147483648
+ +
+
+ +

DPMCRM_SKIP

+
DPMCRM_SKIP: = 0
+ +
+
+
+ +
+
+
+
+

Legend

+
+
    +
  • Property
  • +
  • Method
  • +
  • Accessor
  • +
+
    +
  • Inherited property
  • +
  • Inherited method
  • +
  • Inherited accessor
  • +
+
    +
  • Static property
  • +
  • Static method
  • +
+
    +
  • Property
  • +
+
+
+
+
+

Generated using TypeDoc

+
+
+ + + + \ No newline at end of file diff --git a/doc/api reference/enums/enumerrorcode.html b/doc/api reference/enums/enumerrorcode.html new file mode 100644 index 00000000..f9c27219 --- /dev/null +++ b/doc/api reference/enums/enumerrorcode.html @@ -0,0 +1,1004 @@ + + + + + + EnumErrorCode | Dynamsoft BarcodeReader SDK for Javascript - v8.6.0 + + + + + +
+
+
+
+ +
+
+ Options +
+
+ All +
    +
  • Public
  • +
  • Public/Protected
  • +
  • All
  • +
+
+ + +
+
+ Menu +
+
+
+
+
+
+ +

Enumeration EnumErrorCode

+
+
+
+
+
+
+
+

Index

+
+
+
+

Enumeration members

+ +
+
+
+
+
+

Enumeration members

+
+ +

DBR_1D_LICENSE_INVALID

+
DBR_1D_LICENSE_INVALID: = -10017
+ +
+
+ +

DBR_AZTEC_LICENSE_INVALID

+
DBR_AZTEC_LICENSE_INVALID: = -10041
+ +
+
+ +

DBR_BARCODE_FORMAT_INVALID

+
DBR_BARCODE_FORMAT_INVALID: = -10009
+ +
+
+ +

DBR_BPP_NOT_SUPPORTED

+
DBR_BPP_NOT_SUPPORTED: = -10007
+ +
+
+ +

DBR_CUSTOM_MODULESIZE_INVALID

+
DBR_CUSTOM_MODULESIZE_INVALID: = -10025
+ +
+
+ +

DBR_CUSTOM_REGION_INVALID

+
DBR_CUSTOM_REGION_INVALID: = -10010
+ +
+
+ +

DBR_CUSTOM_SIZE_INVALID

+
DBR_CUSTOM_SIZE_INVALID: = -10024
+ +
+
+ +

DBR_DATAMATRIX_LICENSE_INVALID

+
DBR_DATAMATRIX_LICENSE_INVALID: = -10020
+ +
+
+ +

DBR_DIB_BUFFER_INVALID

+
DBR_DIB_BUFFER_INVALID: = -10018
+ +
+
+ +

DBR_DOMAIN_NOT_MATCHED

+
DBR_DOMAIN_NOT_MATCHED: = -10039
+ +
+
+ +

DBR_DOTCODE_LICENSE_INVALID

+
DBR_DOTCODE_LICENSE_INVALID: = -10061
+ +
+
+ +

DBR_DPM_LICENSE_INVALID

+
DBR_DPM_LICENSE_INVALID: = -10048
+ +
+
+ +

DBR_FILETYPE_NOT_SUPPORTED

+
DBR_FILETYPE_NOT_SUPPORTED: = -10006
+ +
+
+ +

DBR_FILE_NOT_FOUND

+
DBR_FILE_NOT_FOUND: = -10005
+ +
+
+ +

DBR_FRAME_DECODING_THREAD_EXISTS

+
DBR_FRAME_DECODING_THREAD_EXISTS: = -10049
+ +
+
+ +

DBR_GET_MODE_ARGUMENT_ERROR

+
DBR_GET_MODE_ARGUMENT_ERROR: = -10055
+ +
+
+ +

DBR_GS1_COMPOSITE_LICENSE_INVALID

+
DBR_GS1_COMPOSITE_LICENSE_INVALID: = -10059
+ +
+
+ +

DBR_GS1_DATABAR_LICENSE_INVALID

+
DBR_GS1_DATABAR_LICENSE_INVALID: = -10058
+ +
+
+ +

DBR_IMAGE_READ_FAILED

+
DBR_IMAGE_READ_FAILED: = -10012
+ +
+
+ +

DBR_INDEX_INVALID

+
DBR_INDEX_INVALID: = -10008
+ +
+
+ +

DBR_IRT_LICENSE_INVALID

+
DBR_IRT_LICENSE_INVALID: = -10056
+ +
+
+ +

DBR_JSON_KEY_INVALID

+
DBR_JSON_KEY_INVALID: = -10032
+ +
+
+ +

DBR_JSON_NAME_KEY_MISSING

+
DBR_JSON_NAME_KEY_MISSING: = -10034
+ +
+
+ +

DBR_JSON_NAME_REFERENCE_INVALID

+
DBR_JSON_NAME_REFERENCE_INVALID: = -10037
+ +
+
+ +

DBR_JSON_NAME_VALUE_DUPLICATED

+
DBR_JSON_NAME_VALUE_DUPLICATED: = -10035
+ +
+
+ +

DBR_JSON_PARSE_FAILED

+
DBR_JSON_PARSE_FAILED: = -10030
+ +
+
+ +

DBR_JSON_TYPE_INVALID

+
DBR_JSON_TYPE_INVALID: = -10031
+ +
+
+ +

DBR_JSON_VALUE_INVALID

+
DBR_JSON_VALUE_INVALID: = -10033
+ +
+
+ +

DBR_LICENSEKEY_NOT_MATCHED

+
DBR_LICENSEKEY_NOT_MATCHED: = -10043
+ +
+
+ +

DBR_LICENSE_CONTENT_INVALID

+
DBR_LICENSE_CONTENT_INVALID: = -10052
+ +
+
+ +

DBR_LICENSE_DEVICE_RUNS_OUT

+
DBR_LICENSE_DEVICE_RUNS_OUT: = -10054
+ +
+
+ +

DBR_LICENSE_DLL_MISSING

+
DBR_LICENSE_DLL_MISSING: = -10042
+ +
+
+ +

DBR_LICENSE_EXPIRED

+
DBR_LICENSE_EXPIRED: = -10004
+ +
+
+ +

DBR_LICENSE_INIT_FAILED

+
DBR_LICENSE_INIT_FAILED: = -10045
+ +
+
+ +

DBR_LICENSE_INVALID

+
DBR_LICENSE_INVALID: = -10003
+ +
+
+ +

DBR_LICENSE_KEY_INVALID

+
DBR_LICENSE_KEY_INVALID: = -10053
+ +
+
+ +

DBR_MAXICODE_LICENSE_INVALID

+
DBR_MAXICODE_LICENSE_INVALID: = -10057
+ +
+
+ +

DBR_MAX_BARCODE_NUMBER_INVALID

+
DBR_MAX_BARCODE_NUMBER_INVALID: = -10011
+ +
+
+ +

DBR_NO_MEMORY

+
DBR_NO_MEMORY: = -10001
+ +
+
+ +

DBR_NULL_REFERENCE

+
DBR_NULL_REFERENCE: = -10002
+ +
+
+ +

DBR_PAGE_NUMBER_INVALID

+
DBR_PAGE_NUMBER_INVALID: = -10023
+ +
+
+ +

DBR_PARAMETER_VALUE_INVALID

+
DBR_PARAMETER_VALUE_INVALID: = -10038
+ +
+
+ +

DBR_PATCHCODE_LICENSE_INVALID

+
DBR_PATCHCODE_LICENSE_INVALID: = -10046
+ +
+
+ +

DBR_PDF417_LICENSE_INVALID

+
DBR_PDF417_LICENSE_INVALID: = -10019
+ +
+
+ +

DBR_PDF_DLL_MISSING

+
DBR_PDF_DLL_MISSING: = -10022
+ +
+
+ +

DBR_PDF_READ_FAILED

+
DBR_PDF_READ_FAILED: = -10021
+ +
+
+ +

DBR_POSTALCODE_LICENSE_INVALID

+
DBR_POSTALCODE_LICENSE_INVALID: = -10047
+ +
+
+ +

DBR_QR_LICENSE_INVALID

+
DBR_QR_LICENSE_INVALID: = -10016
+ +
+
+ +

DBR_RECOGNITION_TIMEOUT

+
DBR_RECOGNITION_TIMEOUT: = -10026
+ +
+
+ +

DBR_REQUESTED_FAILED

+
DBR_REQUESTED_FAILED: = -10044
+ +
+
+ +

DBR_RESERVEDINFO_NOT_MATCHED

+
DBR_RESERVEDINFO_NOT_MATCHED: = -10040
+ +
+
+ +

DBR_SET_MODE_ARGUMENT_ERROR

+
DBR_SET_MODE_ARGUMENT_ERROR: = -10051
+ +
+
+ +

DBR_STOP_DECODING_THREAD_FAILED

+
DBR_STOP_DECODING_THREAD_FAILED: = -10050
+ +
+
+ +

DBR_SUCCESS

+
DBR_SUCCESS: = 0
+ +
+
+ +

DBR_SYSTEM_EXCEPTION

+
DBR_SYSTEM_EXCEPTION: = 1
+ +
+
+ +

DBR_TEMPLATE_NAME_INVALID

+
DBR_TEMPLATE_NAME_INVALID: = -10036
+ +
+
+ +

DBR_TIFF_READ_FAILED

+
DBR_TIFF_READ_FAILED: = -10013
+ +
+
+ +

DBR_UNKNOWN

+
DBR_UNKNOWN: = -10000
+ +
+
+ +

DMERR_FAILED_TO_REACH_LTS

+
DMERR_FAILED_TO_REACH_LTS: = -20200
+ +
+
+ +

DMERR_LICENSE_SYNC_FAILED

+
DMERR_LICENSE_SYNC_FAILED: = -20003
+ +
+
+ +

DMERR_NO_LICENSE

+
DMERR_NO_LICENSE: = -20000
+ +
+
+ +

DMERR_TRIAL_LICENSE

+
DMERR_TRIAL_LICENSE: = -20010
+ +
+
+
+ +
+
+
+
+

Legend

+
+
    +
  • Property
  • +
  • Method
  • +
  • Accessor
  • +
+
    +
  • Inherited property
  • +
  • Inherited method
  • +
  • Inherited accessor
  • +
+
    +
  • Static property
  • +
  • Static method
  • +
+
    +
  • Property
  • +
+
+
+
+
+

Generated using TypeDoc

+
+
+ + + + \ No newline at end of file diff --git a/doc/api reference/enums/enumgrayscaletransformationmode.html b/doc/api reference/enums/enumgrayscaletransformationmode.html new file mode 100644 index 00000000..f70e64df --- /dev/null +++ b/doc/api reference/enums/enumgrayscaletransformationmode.html @@ -0,0 +1,192 @@ + + + + + + EnumGrayscaleTransformationMode | Dynamsoft BarcodeReader SDK for Javascript - v8.6.0 + + + + + +
+
+
+
+ +
+
+ Options +
+
+ All +
    +
  • Public
  • +
  • Public/Protected
  • +
  • All
  • +
+
+ + +
+
+ Menu +
+
+
+
+
+
+ +

Enumeration EnumGrayscaleTransformationMode

+
+
+
+
+
+
+
+

Index

+
+
+
+

Enumeration members

+ +
+
+
+
+
+

Enumeration members

+
+ +

GTM_INVERTED

+
GTM_INVERTED: = 1
+ +
+
+ +

GTM_ORIGINAL

+
GTM_ORIGINAL: = 2
+ +
+
+ +

GTM_REV

+
GTM_REV: = 2147483648
+ +
+
+ +

GTM_SKIP

+
GTM_SKIP: = 0
+ +
+
+
+ +
+
+
+
+

Legend

+
+
    +
  • Property
  • +
  • Method
  • +
  • Accessor
  • +
+
    +
  • Inherited property
  • +
  • Inherited method
  • +
  • Inherited accessor
  • +
+
    +
  • Static property
  • +
  • Static method
  • +
+
    +
  • Property
  • +
+
+
+
+
+

Generated using TypeDoc

+
+
+ + + + \ No newline at end of file diff --git a/doc/api reference/enums/enumimagepixelformat.html b/doc/api reference/enums/enumimagepixelformat.html new file mode 100644 index 00000000..5b0e3397 --- /dev/null +++ b/doc/api reference/enums/enumimagepixelformat.html @@ -0,0 +1,318 @@ + + + + + + EnumImagePixelFormat | Dynamsoft BarcodeReader SDK for Javascript - v8.6.0 + + + + + +
+
+
+
+ +
+
+ Options +
+
+ All +
    +
  • Public
  • +
  • Public/Protected
  • +
  • All
  • +
+
+ + +
+
+ Menu +
+
+
+
+
+
+ +

Enumeration EnumImagePixelFormat

+
+
+
+
+
+
+
+

Index

+
+ +
+
+
+

Enumeration members

+
+ +

IPF_ABGR_16161616

+
IPF_ABGR_16161616: = 11
+ +
+
+ +

IPF_ABGR_8888

+
IPF_ABGR_8888: = 10
+ +
+
+ +

IPF_ARGB_16161616

+
IPF_ARGB_16161616: = 9
+ +
+
+ +

IPF_ARGB_8888

+
IPF_ARGB_8888: = 7
+ +
+
+ +

IPF_BGR_888

+
IPF_BGR_888: = 12
+ +
+
+ +

IPF_Binary

+
IPF_Binary: = 0
+ +
+
+ +

IPF_BinaryInverted

+
IPF_BinaryInverted: = 1
+ +
+
+ +

IPF_GrayScaled

+
IPF_GrayScaled: = 2
+ +
+
+ +

IPF_NV21

+
IPF_NV21: = 3
+ +
+
+ +

IPF_RGB_161616

+
IPF_RGB_161616: = 8
+ +
+
+ +

IPF_RGB_555

+
IPF_RGB_555: = 5
+ +
+
+ +

IPF_RGB_565

+
IPF_RGB_565: = 4
+ +
+
+ +

IPF_RGB_888

+
IPF_RGB_888: = 6
+ +
+
+
+ +
+
+
+
+

Legend

+
+
    +
  • Property
  • +
  • Method
  • +
  • Accessor
  • +
+
    +
  • Inherited property
  • +
  • Inherited method
  • +
  • Inherited accessor
  • +
+
    +
  • Static property
  • +
  • Static method
  • +
+
    +
  • Property
  • +
+
+
+
+
+

Generated using TypeDoc

+
+
+ + + + \ No newline at end of file diff --git a/doc/api reference/enums/enumimagepreprocessingmode.html b/doc/api reference/enums/enumimagepreprocessingmode.html new file mode 100644 index 00000000..ecaa9945 --- /dev/null +++ b/doc/api reference/enums/enumimagepreprocessingmode.html @@ -0,0 +1,248 @@ + + + + + + EnumImagePreprocessingMode | Dynamsoft BarcodeReader SDK for Javascript - v8.6.0 + + + + + +
+
+
+
+ +
+
+ Options +
+
+ All +
    +
  • Public
  • +
  • Public/Protected
  • +
  • All
  • +
+
+ + +
+
+ Menu +
+
+
+
+
+
+ +

Enumeration EnumImagePreprocessingMode

+
+
+
+
+
+
+
+

Index

+
+ +
+
+
+

Enumeration members

+
+ +

IPM_AUTO

+
IPM_AUTO: = 1
+ +
+
+ +

IPM_GENERAL

+
IPM_GENERAL: = 2
+ +
+
+ +

IPM_GRAY_EQUALIZE

+
IPM_GRAY_EQUALIZE: = 4
+ +
+
+ +

IPM_GRAY_SMOOTH

+
IPM_GRAY_SMOOTH: = 8
+ +
+
+ +

IPM_MORPHOLOGY

+
IPM_MORPHOLOGY: = 32
+ +
+
+ +

IPM_REV

+
IPM_REV: = 2147483648
+ +
+
+ +

IPM_SHARPEN_SMOOTH

+
IPM_SHARPEN_SMOOTH: = 16
+ +
+
+ +

IPM_SKIP

+
IPM_SKIP: = 0
+ +
+
+
+ +
+
+
+
+

Legend

+
+
    +
  • Property
  • +
  • Method
  • +
  • Accessor
  • +
+
    +
  • Inherited property
  • +
  • Inherited method
  • +
  • Inherited accessor
  • +
+
    +
  • Static property
  • +
  • Static method
  • +
+
    +
  • Property
  • +
+
+
+
+
+

Generated using TypeDoc

+
+
+ + + + \ No newline at end of file diff --git a/doc/api reference/enums/enumimresultdatatype.html b/doc/api reference/enums/enumimresultdatatype.html new file mode 100644 index 00000000..a8960da2 --- /dev/null +++ b/doc/api reference/enums/enumimresultdatatype.html @@ -0,0 +1,220 @@ + + + + + + EnumIMResultDataType | Dynamsoft BarcodeReader SDK for Javascript - v8.6.0 + + + + + +
+
+
+
+ +
+
+ Options +
+
+ All +
    +
  • Public
  • +
  • Public/Protected
  • +
  • All
  • +
+
+ + +
+
+ Menu +
+
+
+
+
+
+ +

Enumeration EnumIMResultDataType

+
+
+
+
+
+
+
+

Index

+
+ +
+
+
+

Enumeration members

+
+ +

IMRDT_CONTOUR

+
IMRDT_CONTOUR: = 2
+ +
+
+ +

IMRDT_IMAGE

+
IMRDT_IMAGE: = 1
+ +
+
+ +

IMRDT_LINESEGMENT

+
IMRDT_LINESEGMENT: = 4
+ +
+
+ +

IMRDT_LOCALIZATIONRESULT

+
IMRDT_LOCALIZATIONRESULT: = 8
+ +
+
+ +

IMRDT_QUADRILATERAL

+
IMRDT_QUADRILATERAL: = 32
+ +
+
+ +

IMRDT_REGIONOFINTEREST

+
IMRDT_REGIONOFINTEREST: = 16
+ +
+
+
+ +
+
+
+
+

Legend

+
+
    +
  • Property
  • +
  • Method
  • +
  • Accessor
  • +
+
    +
  • Inherited property
  • +
  • Inherited method
  • +
  • Inherited accessor
  • +
+
    +
  • Static property
  • +
  • Static method
  • +
+
    +
  • Property
  • +
+
+
+
+
+

Generated using TypeDoc

+
+
+ + + + \ No newline at end of file diff --git a/doc/api reference/enums/enumintermediateresultsavingmode.html b/doc/api reference/enums/enumintermediateresultsavingmode.html new file mode 100644 index 00000000..d90ceedc --- /dev/null +++ b/doc/api reference/enums/enumintermediateresultsavingmode.html @@ -0,0 +1,178 @@ + + + + + + EnumIntermediateResultSavingMode | Dynamsoft BarcodeReader SDK for Javascript - v8.6.0 + + + + + +
+
+
+
+ +
+
+ Options +
+
+ All +
    +
  • Public
  • +
  • Public/Protected
  • +
  • All
  • +
+
+ + +
+
+ Menu +
+
+
+
+
+
+ +

Enumeration EnumIntermediateResultSavingMode

+
+
+
+
+
+
+
+

Index

+
+
+
+

Enumeration members

+ +
+
+
+
+
+

Enumeration members

+
+ +

IRSM_BOTH

+
IRSM_BOTH: = 4
+ +
+
+ +

IRSM_FILESYSTEM

+
IRSM_FILESYSTEM: = 2
+ +
+
+ +

IRSM_MEMORY

+
IRSM_MEMORY: = 1
+ +
+
+
+ +
+
+
+
+

Legend

+
+
    +
  • Property
  • +
  • Method
  • +
  • Accessor
  • +
+
    +
  • Inherited property
  • +
  • Inherited method
  • +
  • Inherited accessor
  • +
+
    +
  • Static property
  • +
  • Static method
  • +
+
    +
  • Property
  • +
+
+
+
+
+

Generated using TypeDoc

+
+
+ + + + \ No newline at end of file diff --git a/doc/api reference/enums/enumintermediateresulttype.html b/doc/api reference/enums/enumintermediateresulttype.html new file mode 100644 index 00000000..e8477644 --- /dev/null +++ b/doc/api reference/enums/enumintermediateresulttype.html @@ -0,0 +1,346 @@ + + + + + + EnumIntermediateResultType | Dynamsoft BarcodeReader SDK for Javascript - v8.6.0 + + + + + +
+
+
+
+ +
+
+ Options +
+
+ All +
    +
  • Public
  • +
  • Public/Protected
  • +
  • All
  • +
+
+ + +
+
+ Menu +
+
+
+
+
+
+ +

Enumeration EnumIntermediateResultType

+
+
+
+
+
+
+
+

Index

+
+ +
+
+
+

Enumeration members

+
+ +

IRT_BINARIZED_IMAGE

+
IRT_BINARIZED_IMAGE: = 64
+ +
+
+ +

IRT_COLOUR_CLUSTERED_IMAGE

+
IRT_COLOUR_CLUSTERED_IMAGE: = 2
+ +
+
+ +

IRT_COLOUR_CONVERTED_GRAYSCALE_IMAGE

+
IRT_COLOUR_CONVERTED_GRAYSCALE_IMAGE: = 4
+ +
+
+ +

IRT_CONTOUR

+
IRT_CONTOUR: = 256
+ +
+
+ +

IRT_FORM

+
IRT_FORM: = 1024
+ +
+
+ +

IRT_LINE_SEGMENT

+
IRT_LINE_SEGMENT: = 512
+ +
+
+ +

IRT_NO_RESULT

+
IRT_NO_RESULT: = 0
+ +
+
+ +

IRT_ORIGINAL_IMAGE

+
IRT_ORIGINAL_IMAGE: = 1
+ +
+
+ +

IRT_PREDETECTED_QUADRILATERAL

+
IRT_PREDETECTED_QUADRILATERAL: = 8192
+ +
+
+ +

IRT_PREDETECTED_REGION

+
IRT_PREDETECTED_REGION: = 16
+ +
+
+ +

IRT_PREPROCESSED_IMAGE

+
IRT_PREPROCESSED_IMAGE: = 32
+ +
+
+ +

IRT_SEGMENTATION_BLOCK

+
IRT_SEGMENTATION_BLOCK: = 2048
+ +
+
+ +

IRT_TEXT_ZONE

+
IRT_TEXT_ZONE: = 128
+ +
+
+ +

IRT_TRANSFORMED_GRAYSCALE_IMAGE

+
IRT_TRANSFORMED_GRAYSCALE_IMAGE: = 8
+ +
+
+ +

IRT_TYPED_BARCODE_ZONE

+
IRT_TYPED_BARCODE_ZONE: = 4096
+ +
+
+
+ +
+
+
+
+

Legend

+
+
    +
  • Property
  • +
  • Method
  • +
  • Accessor
  • +
+
    +
  • Inherited property
  • +
  • Inherited method
  • +
  • Inherited accessor
  • +
+
    +
  • Static property
  • +
  • Static method
  • +
+
    +
  • Property
  • +
+
+
+
+
+

Generated using TypeDoc

+
+
+ + + + \ No newline at end of file diff --git a/doc/api reference/enums/enumlicensemodule.html b/doc/api reference/enums/enumlicensemodule.html new file mode 100644 index 00000000..d30f3a94 --- /dev/null +++ b/doc/api reference/enums/enumlicensemodule.html @@ -0,0 +1,402 @@ + + + + + + EnumLicenseModule | Dynamsoft BarcodeReader SDK for Javascript - v8.6.0 + + + + + +
+
+
+
+ +
+
+ Options +
+
+ All +
    +
  • Public
  • +
  • Public/Protected
  • +
  • All
  • +
+
+ + +
+
+ Menu +
+
+
+
+
+
+ +

Enumeration EnumLicenseModule

+
+
+
+
+
+
+
+

Index

+
+ +
+
+
+

Enumeration members

+
+ +

DM_LM_AZTEC

+
DM_LM_AZTEC: = "5"
+ +
+
+

Aztec barcodes license module

+
+
+
+
+ +

DM_LM_DATAMATRIX

+
DM_LM_DATAMATRIX: = "4"
+ +
+
+

Datamatrix barcodes license module

+
+
+
+
+ +

DM_LM_DOTCODE

+
DM_LM_DOTCODE: = "11"
+ +
+
+

DotCode barcodes license module

+
+
+
+
+ +

DM_LM_DPM

+
DM_LM_DPM: = "13"
+ +
+
+

Datamatrix DPM(Direct Part Marking) license module

+
+
+
+
+ +

DM_LM_GS1_COMPOSITE

+
DM_LM_GS1_COMPOSITE: = "9"
+ +
+
+

GS1 Composite barcodes license module

+
+
+
+
+ +

DM_LM_GS1_DATABAR

+
DM_LM_GS1_DATABAR: = "8"
+ +
+
+

GS1 Databar barcodes license module

+
+
+
+
+ +

DM_LM_INTERMEDIATE_RESULT

+
DM_LM_INTERMEDIATE_RESULT: = "12"
+ +
+
+

Intermediate result license module

+
+
+
+
+ +

DM_LM_MAXICODE

+
DM_LM_MAXICODE: = "6"
+ +
+
+

MAXICODE barcodes license module

+
+
+
+
+ +

DM_LM_NONSTANDARD_BARCODE

+
DM_LM_NONSTANDARD_BARCODE: = "16"
+ +
+
+

Nonstandard barcodes license module

+
+
+
+
+ +

DM_LM_ONED

+
DM_LM_ONED: = "1"
+ +
+
+

One-D barcodes license module

+
+
+
+
+ +

DM_LM_PATCHCODE

+
DM_LM_PATCHCODE: = "7"
+ +
+
+

Patch code barcodes license module

+
+
+
+
+ +

DM_LM_PDF417

+
DM_LM_PDF417: = "3"
+ +
+
+

PDF417 barcodes license module

+
+
+
+
+ +

DM_LM_POSTALCODE

+
DM_LM_POSTALCODE: = "10"
+ +
+
+

Postal code barcodes license module

+
+
+
+
+ +

DM_LM_QR_CODE

+
DM_LM_QR_CODE: = "2"
+ +
+
+

QR Code barcodes license module

+
+
+
+
+
+ +
+
+
+
+

Legend

+
+
    +
  • Property
  • +
  • Method
  • +
  • Accessor
  • +
+
    +
  • Inherited property
  • +
  • Inherited method
  • +
  • Inherited accessor
  • +
+
    +
  • Static property
  • +
  • Static method
  • +
+
    +
  • Property
  • +
+
+
+
+
+

Generated using TypeDoc

+
+
+ + + + \ No newline at end of file diff --git a/doc/api reference/enums/enumlocalizationmode.html b/doc/api reference/enums/enumlocalizationmode.html new file mode 100644 index 00000000..8d70c4c3 --- /dev/null +++ b/doc/api reference/enums/enumlocalizationmode.html @@ -0,0 +1,276 @@ + + + + + + EnumLocalizationMode | Dynamsoft BarcodeReader SDK for Javascript - v8.6.0 + + + + + +
+
+
+
+ +
+
+ Options +
+
+ All +
    +
  • Public
  • +
  • Public/Protected
  • +
  • All
  • +
+
+ + +
+
+ Menu +
+
+
+
+
+
+ +

Enumeration EnumLocalizationMode

+
+
+
+
+
+
+
+

Index

+
+ +
+
+
+

Enumeration members

+
+ +

LM_AUTO

+
LM_AUTO: = 1
+ +
+
+ +

LM_CENTRE

+
LM_CENTRE: = 128
+ +
+
+ +

LM_CONNECTED_BLOCKS

+
LM_CONNECTED_BLOCKS: = 2
+ +
+
+ +

LM_LINES

+
LM_LINES: = 8
+ +
+
+ +

LM_REV

+
LM_REV: = 2147483648
+ +
+
+ +

LM_SCAN_DIRECTLY

+
LM_SCAN_DIRECTLY: = 16
+ +
+
+ +

LM_SKIP

+
LM_SKIP: = 0
+ +
+
+ +

LM_STATISTICS

+
LM_STATISTICS: = 4
+ +
+
+ +

LM_STATISTICS_MARKS

+
LM_STATISTICS_MARKS: = 32
+ +
+
+ +

LM_STATISTICS_POSTAL_CODE

+
LM_STATISTICS_POSTAL_CODE: = 64
+ +
+
+
+ +
+
+
+
+

Legend

+
+
    +
  • Property
  • +
  • Method
  • +
  • Accessor
  • +
+
    +
  • Inherited property
  • +
  • Inherited method
  • +
  • Inherited accessor
  • +
+
    +
  • Static property
  • +
  • Static method
  • +
+
    +
  • Property
  • +
+
+
+
+
+

Generated using TypeDoc

+
+
+ + + + \ No newline at end of file diff --git a/doc/api reference/enums/enumpdfreadingmode.html b/doc/api reference/enums/enumpdfreadingmode.html new file mode 100644 index 00000000..bcd6e208 --- /dev/null +++ b/doc/api reference/enums/enumpdfreadingmode.html @@ -0,0 +1,192 @@ + + + + + + EnumPDFReadingMode | Dynamsoft BarcodeReader SDK for Javascript - v8.6.0 + + + + + +
+
+
+
+ +
+
+ Options +
+
+ All +
    +
  • Public
  • +
  • Public/Protected
  • +
  • All
  • +
+
+ + +
+
+ Menu +
+
+
+
+
+
+ +

Enumeration EnumPDFReadingMode

+
+
+
+
+
+
+
+

Index

+
+
+
+

Enumeration members

+ +
+
+
+
+
+

Enumeration members

+
+ +

PDFRM_AUTO

+
PDFRM_AUTO: = 2
+ +
+
+ +

PDFRM_RASTER

+
PDFRM_RASTER: = 1
+ +
+
+ +

PDFRM_REV

+
PDFRM_REV: = 2147483648
+ +
+
+ +

PDFRM_VECTOR

+
PDFRM_VECTOR: = 4
+ +
+
+
+ +
+
+
+
+

Legend

+
+
    +
  • Property
  • +
  • Method
  • +
  • Accessor
  • +
+
    +
  • Inherited property
  • +
  • Inherited method
  • +
  • Inherited accessor
  • +
+
    +
  • Static property
  • +
  • Static method
  • +
+
    +
  • Property
  • +
+
+
+
+
+

Generated using TypeDoc

+
+
+ + + + \ No newline at end of file diff --git a/doc/api reference/enums/enumqrcodeerrorcorrectionlevel.html b/doc/api reference/enums/enumqrcodeerrorcorrectionlevel.html new file mode 100644 index 00000000..a50e4d35 --- /dev/null +++ b/doc/api reference/enums/enumqrcodeerrorcorrectionlevel.html @@ -0,0 +1,192 @@ + + + + + + EnumQRCodeErrorCorrectionLevel | Dynamsoft BarcodeReader SDK for Javascript - v8.6.0 + + + + + +
+
+
+
+ +
+
+ Options +
+
+ All +
    +
  • Public
  • +
  • Public/Protected
  • +
  • All
  • +
+
+ + +
+
+ Menu +
+
+
+
+
+
+ +

Enumeration EnumQRCodeErrorCorrectionLevel

+
+
+
+
+
+
+
+

Index

+
+ +
+
+
+

Enumeration members

+
+ +

QRECL_ERROR_CORRECTION_H

+
QRECL_ERROR_CORRECTION_H:
+ +
+
+ +

QRECL_ERROR_CORRECTION_L

+
QRECL_ERROR_CORRECTION_L:
+ +
+
+ +

QRECL_ERROR_CORRECTION_M

+
QRECL_ERROR_CORRECTION_M:
+ +
+
+ +

QRECL_ERROR_CORRECTION_Q

+
QRECL_ERROR_CORRECTION_Q:
+ +
+
+
+ +
+
+
+
+

Legend

+
+
    +
  • Property
  • +
  • Method
  • +
  • Accessor
  • +
+
    +
  • Inherited property
  • +
  • Inherited method
  • +
  • Inherited accessor
  • +
+
    +
  • Static property
  • +
  • Static method
  • +
+
    +
  • Property
  • +
+
+
+
+
+

Generated using TypeDoc

+
+
+ + + + \ No newline at end of file diff --git a/doc/api reference/enums/enumregionpredetectionmode.html b/doc/api reference/enums/enumregionpredetectionmode.html new file mode 100644 index 00000000..4e16cb8b --- /dev/null +++ b/doc/api reference/enums/enumregionpredetectionmode.html @@ -0,0 +1,234 @@ + + + + + + EnumRegionPredetectionMode | Dynamsoft BarcodeReader SDK for Javascript - v8.6.0 + + + + + +
+
+
+
+ +
+
+ Options +
+
+ All +
    +
  • Public
  • +
  • Public/Protected
  • +
  • All
  • +
+
+ + +
+
+ Menu +
+
+
+
+
+
+ +

Enumeration EnumRegionPredetectionMode

+
+
+
+
+
+
+
+

Index

+
+ +
+
+
+

Enumeration members

+
+ +

RPM_AUTO

+
RPM_AUTO: = 1
+ +
+
+ +

RPM_GENERAL

+
RPM_GENERAL: = 2
+ +
+
+ +

RPM_GENERAL_GRAY_CONTRAST

+
RPM_GENERAL_GRAY_CONTRAST: = 8
+ +
+
+ +

RPM_GENERAL_HSV_CONTRAST

+
RPM_GENERAL_HSV_CONTRAST: = 16
+ +
+
+ +

RPM_GENERAL_RGB_CONTRAST

+
RPM_GENERAL_RGB_CONTRAST: = 4
+ +
+
+ +

RPM_REV

+
RPM_REV: = 2147483648
+ +
+
+ +

RPM_SKIP

+
RPM_SKIP: = 0
+ +
+
+
+ +
+
+
+
+

Legend

+
+
    +
  • Property
  • +
  • Method
  • +
  • Accessor
  • +
+
    +
  • Inherited property
  • +
  • Inherited method
  • +
  • Inherited accessor
  • +
+
    +
  • Static property
  • +
  • Static method
  • +
+
    +
  • Property
  • +
+
+
+
+
+

Generated using TypeDoc

+
+
+ + + + \ No newline at end of file diff --git a/doc/api reference/enums/enumresultcoordinatetype.html b/doc/api reference/enums/enumresultcoordinatetype.html new file mode 100644 index 00000000..b69e301b --- /dev/null +++ b/doc/api reference/enums/enumresultcoordinatetype.html @@ -0,0 +1,164 @@ + + + + + + EnumResultCoordinateType | Dynamsoft BarcodeReader SDK for Javascript - v8.6.0 + + + + + +
+
+
+
+ +
+
+ Options +
+
+ All +
    +
  • Public
  • +
  • Public/Protected
  • +
  • All
  • +
+
+ + +
+
+ Menu +
+
+
+
+
+
+ +

Enumeration EnumResultCoordinateType

+
+
+
+
+
+
+
+

Index

+
+
+
+

Enumeration members

+ +
+
+
+
+
+

Enumeration members

+
+ +

RCT_PERCENTAGE

+
RCT_PERCENTAGE: = 2
+ +
+
+ +

RCT_PIXEL

+
RCT_PIXEL: = 1
+ +
+
+
+ +
+
+
+
+

Legend

+
+
    +
  • Property
  • +
  • Method
  • +
  • Accessor
  • +
+
    +
  • Inherited property
  • +
  • Inherited method
  • +
  • Inherited accessor
  • +
+
    +
  • Static property
  • +
  • Static method
  • +
+
    +
  • Property
  • +
+
+
+
+
+

Generated using TypeDoc

+
+
+ + + + \ No newline at end of file diff --git a/doc/api reference/enums/enumresulttype.html b/doc/api reference/enums/enumresulttype.html new file mode 100644 index 00000000..3e199a32 --- /dev/null +++ b/doc/api reference/enums/enumresulttype.html @@ -0,0 +1,192 @@ + + + + + + EnumResultType | Dynamsoft BarcodeReader SDK for Javascript - v8.6.0 + + + + + +
+
+
+
+ +
+
+ Options +
+
+ All +
    +
  • Public
  • +
  • Public/Protected
  • +
  • All
  • +
+
+ + +
+
+ Menu +
+
+
+
+
+
+ +

Enumeration EnumResultType

+
+
+
+
+
+
+
+

Index

+
+
+
+

Enumeration members

+ +
+
+
+
+
+

Enumeration members

+
+ +

RT_CANDIDATE_TEXT

+
RT_CANDIDATE_TEXT:
+ +
+
+ +

RT_PARTIAL_TEXT

+
RT_PARTIAL_TEXT:
+ +
+
+ +

RT_RAW_TEXT

+
RT_RAW_TEXT:
+ +
+
+ +

RT_STANDARD_TEXT

+
RT_STANDARD_TEXT:
+ +
+
+
+ +
+
+
+
+

Legend

+
+
    +
  • Property
  • +
  • Method
  • +
  • Accessor
  • +
+
    +
  • Inherited property
  • +
  • Inherited method
  • +
  • Inherited accessor
  • +
+
    +
  • Static property
  • +
  • Static method
  • +
+
    +
  • Property
  • +
+
+
+
+
+

Generated using TypeDoc

+
+
+ + + + \ No newline at end of file diff --git a/doc/api reference/enums/enumscaleupmode.html b/doc/api reference/enums/enumscaleupmode.html new file mode 100644 index 00000000..2f92a24f --- /dev/null +++ b/doc/api reference/enums/enumscaleupmode.html @@ -0,0 +1,206 @@ + + + + + + EnumScaleUpMode | Dynamsoft BarcodeReader SDK for Javascript - v8.6.0 + + + + + +
+
+
+
+ +
+
+ Options +
+
+ All +
    +
  • Public
  • +
  • Public/Protected
  • +
  • All
  • +
+
+ + +
+
+ Menu +
+
+
+
+
+
+ +

Enumeration EnumScaleUpMode

+
+
+
+
+
+
+
+

Index

+
+ +
+
+
+

Enumeration members

+
+ +

SUM_AUTO

+
SUM_AUTO: = 1
+ +
+
+ +

SUM_LINEAR_INTERPOLATION

+
SUM_LINEAR_INTERPOLATION: = 2
+ +
+
+ +

SUM_NEAREST_NEIGHBOUR_INTERPOLATION

+
SUM_NEAREST_NEIGHBOUR_INTERPOLATION: = 4
+ +
+
+ +

SUM_REV

+
SUM_REV: = 2147483648
+ +
+
+ +

SUM_SKIP

+
SUM_SKIP: = 0
+ +
+
+
+ +
+
+
+
+

Legend

+
+
    +
  • Property
  • +
  • Method
  • +
  • Accessor
  • +
+
    +
  • Inherited property
  • +
  • Inherited method
  • +
  • Inherited accessor
  • +
+
    +
  • Static property
  • +
  • Static method
  • +
+
    +
  • Property
  • +
+
+
+
+
+

Generated using TypeDoc

+
+
+ + + + \ No newline at end of file diff --git a/doc/api reference/enums/enumterminatephase.html b/doc/api reference/enums/enumterminatephase.html new file mode 100644 index 00000000..b83a4fc5 --- /dev/null +++ b/doc/api reference/enums/enumterminatephase.html @@ -0,0 +1,220 @@ + + + + + + EnumTerminatePhase | Dynamsoft BarcodeReader SDK for Javascript - v8.6.0 + + + + + +
+
+
+
+ +
+
+ Options +
+
+ All +
    +
  • Public
  • +
  • Public/Protected
  • +
  • All
  • +
+
+ + +
+
+ Menu +
+
+
+
+
+
+ +

Enumeration EnumTerminatePhase

+
+
+
+
+
+
+
+

Index

+
+ +
+
+
+

Enumeration members

+
+ +

TP_BARCODE_LOCALIZED

+
TP_BARCODE_LOCALIZED: = 8
+ +
+
+ +

TP_BARCODE_RECOGNIZED

+
TP_BARCODE_RECOGNIZED: = 32
+ +
+
+ +

TP_BARCODE_TYPE_DETERMINED

+
TP_BARCODE_TYPE_DETERMINED: = 16
+ +
+
+ +

TP_IMAGE_BINARIZED

+
TP_IMAGE_BINARIZED: = 4
+ +
+
+ +

TP_IMAGE_PREPROCESSED

+
TP_IMAGE_PREPROCESSED: = 2
+ +
+
+ +

TP_REGION_PREDETECTED

+
TP_REGION_PREDETECTED: = 1
+ +
+
+
+ +
+
+
+
+

Legend

+
+
    +
  • Property
  • +
  • Method
  • +
  • Accessor
  • +
+
    +
  • Inherited property
  • +
  • Inherited method
  • +
  • Inherited accessor
  • +
+
    +
  • Static property
  • +
  • Static method
  • +
+
    +
  • Property
  • +
+
+
+
+
+

Generated using TypeDoc

+
+
+ + + + \ No newline at end of file diff --git a/doc/api reference/enums/enumtextfiltermode.html b/doc/api reference/enums/enumtextfiltermode.html new file mode 100644 index 00000000..ada5ac18 --- /dev/null +++ b/doc/api reference/enums/enumtextfiltermode.html @@ -0,0 +1,192 @@ + + + + + + EnumTextFilterMode | Dynamsoft BarcodeReader SDK for Javascript - v8.6.0 + + + + + +
+
+
+
+ +
+
+ Options +
+
+ All +
    +
  • Public
  • +
  • Public/Protected
  • +
  • All
  • +
+
+ + +
+
+ Menu +
+
+
+
+
+
+ +

Enumeration EnumTextFilterMode

+
+
+
+
+
+
+
+

Index

+
+
+
+

Enumeration members

+ +
+
+
+
+
+

Enumeration members

+
+ +

TFM_AUTO

+
TFM_AUTO: = 1
+ +
+
+ +

TFM_GENERAL_CONTOUR

+
TFM_GENERAL_CONTOUR: = 2
+ +
+
+ +

TFM_REV

+
TFM_REV: = 2147483648
+ +
+
+ +

TFM_SKIP

+
TFM_SKIP: = 0
+ +
+
+
+ +
+
+
+
+

Legend

+
+
    +
  • Property
  • +
  • Method
  • +
  • Accessor
  • +
+
    +
  • Inherited property
  • +
  • Inherited method
  • +
  • Inherited accessor
  • +
+
    +
  • Static property
  • +
  • Static method
  • +
+
    +
  • Property
  • +
+
+
+
+
+

Generated using TypeDoc

+
+
+ + + + \ No newline at end of file diff --git a/doc/api reference/enums/enumtextresultordermode.html b/doc/api reference/enums/enumtextresultordermode.html new file mode 100644 index 00000000..a43a98cd --- /dev/null +++ b/doc/api reference/enums/enumtextresultordermode.html @@ -0,0 +1,206 @@ + + + + + + EnumTextResultOrderMode | Dynamsoft BarcodeReader SDK for Javascript - v8.6.0 + + + + + +
+
+
+
+ +
+
+ Options +
+
+ All +
    +
  • Public
  • +
  • Public/Protected
  • +
  • All
  • +
+
+ + +
+
+ Menu +
+
+
+
+
+
+ +

Enumeration EnumTextResultOrderMode

+
+
+
+
+
+
+
+

Index

+
+
+
+

Enumeration members

+ +
+
+
+
+
+

Enumeration members

+
+ +

TROM_CONFIDENCE

+
TROM_CONFIDENCE: = 1
+ +
+
+ +

TROM_FORMAT

+
TROM_FORMAT: = 4
+ +
+
+ +

TROM_POSITION

+
TROM_POSITION: = 2
+ +
+
+ +

TROM_REV

+
TROM_REV: = 2147483648
+ +
+
+ +

TROM_SKIP

+
TROM_SKIP: = 0
+ +
+
+
+ +
+
+
+
+

Legend

+
+
    +
  • Property
  • +
  • Method
  • +
  • Accessor
  • +
+
    +
  • Inherited property
  • +
  • Inherited method
  • +
  • Inherited accessor
  • +
+
    +
  • Static property
  • +
  • Static method
  • +
+
    +
  • Property
  • +
+
+
+
+
+

Generated using TypeDoc

+
+
+ + + + \ No newline at end of file diff --git a/doc/api reference/enums/enumtexturedetectionmode.html b/doc/api reference/enums/enumtexturedetectionmode.html new file mode 100644 index 00000000..a6b1aa99 --- /dev/null +++ b/doc/api reference/enums/enumtexturedetectionmode.html @@ -0,0 +1,192 @@ + + + + + + EnumTextureDetectionMode | Dynamsoft BarcodeReader SDK for Javascript - v8.6.0 + + + + + +
+
+
+
+ +
+
+ Options +
+
+ All +
    +
  • Public
  • +
  • Public/Protected
  • +
  • All
  • +
+
+ + +
+
+ Menu +
+
+
+
+
+
+ +

Enumeration EnumTextureDetectionMode

+
+
+
+
+
+
+
+

Index

+
+
+
+

Enumeration members

+ +
+
+
+
+
+

Enumeration members

+
+ +

TDM_AUTO

+
TDM_AUTO: = 1
+ +
+
+ +

TDM_GENERAL_WIDTH_CONCENTRATION

+
TDM_GENERAL_WIDTH_CONCENTRATION: = 2
+ +
+
+ +

TDM_REV

+
TDM_REV: = 2147483648
+ +
+
+ +

TDM_SKIP

+
TDM_SKIP: = 0
+ +
+
+
+ +
+
+
+
+

Legend

+
+
    +
  • Property
  • +
  • Method
  • +
  • Accessor
  • +
+
    +
  • Inherited property
  • +
  • Inherited method
  • +
  • Inherited accessor
  • +
+
    +
  • Static property
  • +
  • Static method
  • +
+
    +
  • Property
  • +
+
+
+
+
+

Generated using TypeDoc

+
+
+ + + + \ No newline at end of file diff --git a/doc/api reference/globals.html b/doc/api reference/globals.html new file mode 100644 index 00000000..95984b9c --- /dev/null +++ b/doc/api reference/globals.html @@ -0,0 +1,311 @@ + + + + + + Dynamsoft BarcodeReader SDK for Javascript - v8.6.0 + + + + + +
+
+
+
+ +
+
+ Options +
+
+ All +
    +
  • Public
  • +
  • Public/Protected
  • +
  • All
  • +
+
+ + +
+
+ Menu +
+
+
+
+
+
+ +

Dynamsoft BarcodeReader SDK for Javascript - v8.6.0

+
+
+
+
+
+ + +
+
+
+
+

Legend

+
+
    +
  • Property
  • +
  • Method
  • +
  • Accessor
  • +
+
    +
  • Inherited property
  • +
  • Inherited method
  • +
  • Inherited accessor
  • +
+
    +
  • Static property
  • +
  • Static method
  • +
+
    +
  • Property
  • +
+
+
+
+
+

Generated using TypeDoc

+
+
+ + + + \ No newline at end of file diff --git a/doc/api reference/index.html b/doc/api reference/index.html new file mode 100644 index 00000000..54c08d1a --- /dev/null +++ b/doc/api reference/index.html @@ -0,0 +1,766 @@ + + + + + + Dynamsoft BarcodeReader SDK for Javascript - v8.6.0 + + + + + +
+
+
+
+ +
+
+ Options +
+
+ All +
    +
  • Public
  • +
  • Public/Protected
  • +
  • All
  • +
+
+ + +
+
+ Menu +
+
+
+
+
+
+ +

Dynamsoft BarcodeReader SDK for Javascript - v8.6.0

+
+
+
+
+
+
+
+ +

Dynamsoft Barcode Reader for Your Website

+
+

Turn your web page into a barcode scanner with just a few lines of code.

+

version + downloads + jsdelivr +

+

+

Once integrated, your users can open your website in a browser, access their cameras and read barcodes directly from the video input.

+

In this guide, you will learn step by step on how to integrate this library into your website.

+
+

For back-end barcode reading with Node.js, see Dynamsoft Barcode Reader for Node.

+
+

Table of Contents

+ +

Popular Examples

+ +

You can also:

+ + +

Hello World - Simplest Implementation

+
+

Let's start by testing the "Hello World" example of the library which demonstrates how to use the minimum code to enable a web page to read barcodes from a live video stream.

+ + +

Step One: Check the code of the example

+
+

The complete code of the "Hello World" example is shown below

+
<!DOCTYPE html>
+<html>
+
+<body>
+  <script src="https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@8.6.0/dist/dbr.js"></script>
+  <script>
+    // initializes and uses the library
+    let pScanner = null;
+    (async () => {
+      let scanner = await (pScanner = pScanner || Dynamsoft.DBR.BarcodeScanner.createInstance());
+      scanner.onFrameRead = results => {
+        if (results.length > 0) console.log(results);
+      };
+      scanner.onUnduplicatedRead = (txt, result) => {
+        alert(txt);
+      };
+      await scanner.show();
+    })();
+  </script>
+</body>
+
+</html>
+
+

You can also find the code (with more comments) on GitHub.

+
+

About the code

+
    +
  • createInstance(): This method creates a BarcodeScanner object. This object can read barcodes directly from a video input with the help of its interactive UI (hidden by default) and the MediaDevices interface.

    +
  • +
  • onFrameRead: This event is triggered every time the library finishes scanning a video frame. The results object contains all the barcode results that the library have found on this frame. In this example, we print the results to the browser console.

    +
  • +
  • onUnduplicatedRead: This event is triggered when the library finds a new barcode, which is not a duplicate among multiple frames. txt holds the barcode text value while result is an object that holds details of the barcode. In this example, an alert will be displayed for this new barcode.

    +
  • +
  • show(): This method brings up the built-in UI of the BarcodeScanner object.

    +
  • +
+ +

Step Two: Test the example

+
+

You can choose one of three ways to test the example:

+ +

Either way, you open the example page in a browser, allow the page to access your camera and the video will show up on the page. After that, you can point the camera at something with a barcode to read it.

+

If the barcode is decoded, an alert will pop up with the result text. At the same time, the barcode location will be highlighted in the video feed.

+
+

For first use, you may need to wait a few seconds for the library to initialize.

+
+

Note:

+
    +
  • The library only scans a new frame when it has finished scanning the previous frame. The interval between two consecutive frames might not be enough time for the library to process the 1st frame (for 30 FPS, the interval is about 33 ms), therefore, not all frames are scanned.

    +
  • +
  • The library requires a license to work. However, when no license is specified in the code, Dynamsoft allows a 7-day free period during which you can make initial evaluation of the library to decide whether or not you want to evaluate it further. If you do, you can request a trial.

    +
    +

    Network connection is required for the 7-day free license to work.

    +
    +
  • +
+

If the test doesn't go as expected, you can check out the FAQ or contact us.

+ +

Building your own page

+
+ +

Include the library

+
+ +

Use a CDN

+
+

The simplest way to include the library is to use either the jsDelivr or UNPKG CDN. The "hello world" example above uses jsDelivr.

+
    +
  • jsDelivr

    +
    <script src="https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@8.6.0/dist/dbr.js"></script>
    +
  • +
  • UNPKG

    +
    <script src="https://unpkg.com/dynamsoft-javascript-barcode@8.6.0/dist/dbr.js"></script>
    +
  • +
+ +

Host the library yourself (recommended)

+
+

Besides using the CDN, you can also download the library and host its files on your own website / server before including it in your application.

+

The following shows a few ways to download the library.

+
    +
  • From the website

    +

    Download the JavaScript Package

    +
  • +
  • yarn

    +
    $ yarn add dynamsoft-javascript-barcode
    +
  • +
  • npm

    +
    $ npm install dynamsoft-javascript-barcode --save
  • +
+

Depending on how you downloaded the library and where you put it. You can typically include it like this:

+
<script src="/DBR-JS-8.6.0/dist/dbr.js"></script>
+

or

+
<script src="/node_modules/dynamsoft-javascript-barcode/dist/dbr.js"></script>
+

Read more on how to host the library.

+ +

Configure the library

+
+

Before using the library, you need to configure a few things.

+ +

Specify the license

+
+

The library requires a license to work, use the APIs organizationID and handshakeCode to specify how to acquire the license.

+
Dynamsoft.DBR.BarcodeScanner.organizationID = "YOUR-ORGANIZATION-ID"; // Required.
+Dynamsoft.DBR.BarcodeScanner.handshakeCode = "A-SPECIFIC-HANDSHAKECODE"; // Optional, if not specified, the default handshake code is used.
+Dynamsoft.DBR.BarcodeScanner.sessionPassword = "PASSWORD-TO-PROTECT-YOUR-LICENSE"; // Optional but recomended, use it to protect your license.
+Dynamsoft.DBR.BarcodeScanner.licenseServer = ["YOUR-OWN-MAIN-DLS", "YOUR-OWN-STANDBY-DLS"]; //Optional, ignore this line if you are using Dynamsoft-hosting DLS.
+

Note:

+
    +
  • Network connection is required for the license to work.
  • +
  • If nothing is specified, a 7-day free license will be used by default which is the case in the above "hello world" example.
  • +
  • The license is actually fetched during the creation of a BarcodeScanner or BarcodeReader instance.
  • +
  • If a public network connection is not available, you can choose to host a license server in your private network.
  • +
+

An alternative way to specify the license is to use an alphanumeric string which does not require a network connection. The following shows how it could be used. Contact us for more information.

+
Dynamsoft.DBR.BarcodeReader.productKeys = "t0068NQAAACgTVU2aucyxqETXKkiomqhV7YoLrnqjLiQQRSH5DBV1UtIs4..."
+

Or

+
<script src="https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@8.6.0/dist/dbr.js" data-productKeys="t0068NQAAACgTVU2aucyxqETXKkiomqhV7YoLrnqjLiQQRSH5DBV1UtIs4..."></script>
+ +

Specify the location of the "engine" files

+
+

The "engine" files refer to *.worker.js, *.wasm.js and *.wasm, etc. which are loaded by the main library at runtime. This configuration option uses the API engineResourcePath and is often not required as these files usually are in the same location with the main library file (dbr.js). However, in cases where the engine files are not in the same location as the main library file (for example, with frameworks like Angular or React, dbr.js is compiled into another file), this configuration will be required.

+

The following code uses the jsDelivr CDN, feel free to change it to your own location of these files.

+
import DBR from "dynamsoft-javascript-barcode";
+DBR.BarcodeScanner.engineResourcePath = "https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@8.6.0/dist/";
+export default DBR;
+ +

Interact with the library

+
+ +

Create a BarcodeScanner object

+
+

You can use one of two classes ( BarcodeScanner and BarcodeReader ) to interact with the library. BarcodeReader is a low-level class that processes images directly. BarcodeScanner , on the other hand, inherits from BarcodeReader and provides high-level APIs and a built-in GUI to allow continuous barcode scanning on video frames. We'll focus on BarcodeScanner in this guide.

+

To use the library, we first create a BarcodeScanner object.

+
try {
+  await Dynamsoft.DBR.BarcodeScanner.createInstance();
+} catch (ex) {
+  console.error(ex);
+}
+

Note:

+
    +
  • The creation of an object consists of two parallel tasks: one is to download and compile the "engine", the other is to fetch a license from Dynamsoft License Server (assuming an online license is used).
  • +
+ +

Configure the BarcodeScanner object

+
+

Let's take a look at the following code snippets first:

+
// set which camera and what resolution to use
+var allCameras = await scanner.getAllCameras();
+await scanner.setCurrentCamera(allCameras[0].deviceId);
+await scanner.setResolution(1280, 720);
+
// set up the scanner behavior
+let scanSettings = await scanner.getScanSettings();
+// disregard duplicated results found in a specified time period (in milliseconds)
+scanSettings.duplicateForgetTime = 5000;
+// set a scan interval in milliseconds so the library may release the CPU from time to time
+scanSettings.intervalTime = 300;
+await scanner.updateScanSettings(scanSettings);
+
// use one of the built-in RuntimeSetting templates: "single" (decode a single barcode, the default mode), "speed", "balance" and "coverage".
+await scanner.updateRuntimeSettings("speed");
+
+// make changes to the template. The code below demonstrates how to specify enabled symbologies
+let runtimeSettings = await scanner.getRuntimeSettings();
+runtimeSettings.barcodeFormatIds = Dynamsoft.DBR.EnumBarcodeFormat.BF_ONED | Dynamsoft.DBR.EnumBarcodeFormat.BF_QR_CODE;
+await scanner.updateRuntimeSettings(runtimeSettings);
+

Try in JSFiddle

+

As you can see from the above code snippets, there are three types of configurations:

+
    +
  • get/updateVideoSettings: Configures the data source, i.e., the camera. These settings include which camera to use, the resolution, etc. Learn more here.

    +
  • +
  • get/updateScanSettings: Configures the behavior of the scanner which includes duplicateForgetTime, intervalTime and filter, etc.

    +
  • +
  • get/updateRuntimeSettings: Configures the decode engine. Find a full list of these settings and their corresponding descriptions here. For example, the following uses the built-in "speed" settings with updated localizationModes.

    +
    await barcodeScanner.updateRuntimeSettings("speed");
    +//await barcodeScanner.updateRuntimeSettings("balance"); //alternative
    +//await barcodeScanner.updateRuntimeSettings("coverage"); //alternative
    +let settings = await barcodeScanner.getRuntimeSettings();
    +settings.localizationModes = [
    +    Dynamsoft.DBR.EnumLocalizationMode.LM_CONNECTED_BLOCKS,
    +    Dynamsoft.DBR.EnumLocalizationMode.LM_SCAN_DIRECTLY,
    +    Dynamsoft.DBR.EnumLocalizationMode.LM_LINES, 0, 0, 0, 0, 0
    +];
    +await barcodeScanner.updateRuntimeSettings(settings);
    +

    Try in JSFiddle.

    +

    See also settings samples.

    +
  • +
+ +

Customize the UI

+
+

The built-in UI of the BarcodeScanner object is defined in the file dist/dbr.scanner.html . There are a few ways to customize it:

+
    +
  • Modify the file dist/dbr.scanner.html directly.

    +

    This option is only possible when you host this file on your own web server instead of using a CDN.

    +
  • +
  • Copy the file dist/dbr.scanner.html to your application, modify it and use the the API defaultUIElementURL to set it as the default UI.

    +
    Dynamsoft.DBR.BarcodeScanner.defaultUIElementURL = "THE-URL-TO-THE-FILE";
    +
    +

    You must set defaultUIElementURL before you call createInstance() .

    +
    +
  • +
  • Append the default UI element to your page, customize it before showing it.

    +
    <div id="scannerUI"></div>
    +
    document.getElementById('scannerUI').appendChild(scanner.getUIElement());
    +document.getElementsByClassName('dbrScanner-btn-close')[0].hidden = true; // Hide the close button
    +
  • +
  • Build the UI element into your own web page and specify it with the API setUIElement(HTMLElement).

    +
      +
    • Embed the video

      +
      <div id="div-video-container">
      +  <video class="dbrScanner-video" playsinline="true" style="width:100%;height:100%;position:absolute;left:0;top:0;"></video>
      +</div>
      +<script>
      +  let pScanner = null;
      +  (async()=>{
      +    let scanner = await (pScanner = pScanner || Dynamsoft.DBR.BarcodeScanner.createInstance());
      +    await scanner.setUIElement(document.getElementById('div-video-container'));
      +    scanner.onFrameRead = results => {console.log(results);};
      +    scanner.onUnduplicatedRead = (txt, result) => {alert(txt);};
      +    await scanner.show();
      +  })();
      +</script>
      +
      +

      The video element must have the class dbrScanner-video .

      +
      +

      Try in JSFiddle

      +
    • +
    • Add the camera list and resolution list

      +

      If the class names for these lists match the default ones, dbrScanner-sel-camera and dbrScanner-sel-resolution , the library will automatically populate the lists and handle the camera/resolution switching.

      +
      <select class="dbrScanner-sel-camera"></select>
      +

      Try in JSFiddle

      +
      <select class="dbrScanner-sel-resolution"></select>
      +

      Try in JSFiddle

      +
      +

      By default, 8 hard-coded resolutions are populated as options. You can show only a custom set of options by hardcoding them.

      +
      +
      <select class="dbrScanner-sel-resolution">
      +  <option class="dbrScanner-opt-gotResolution" value="got"></option>
      +  <option data-width="1920" data-height="1080">1920 x 1080</option>
      +  <option data-width="1280" data-height="720">1280 x 720</option>
      +  <option data-width="640" data-height="480">640 x 480</option>
      +</select>
      +

      Try in JSFiddle

      +
      +

      Generally, you need to provide a resolution that the camera supports. However, in case a camera does not support the specified resolution, it usually uses the nearest supported resolution. As a result, the selected resolution may not be the actual resolution used. In this case, add an option with the class name dbrScanner-opt-gotResolution (as shown above) and the library will then use it to show the actual resolution.

      +
      +
    • +
    +
  • +
+

See also UI customization samples.

+

Interested to test it further? Read on to learn how to request a 30-day free trial.

+ +

Requesting A Trial

+
+

From version 8.2.5 of the library, if no license is specified, a 7-day free license will be used by default.

+
+

Network connection is required for the 7-day free license to work.

+
+

After that, if you want to evaluate the library further, you can register for a Dynamsoft account (if you haven't already done so) and request a 30-day trial in the customer portal.

+ + +

System Requirements

+
+

This library requires the following features which are supported by all modern mainstream browsers:

+
    +
  • WebAssembly, Blob, URL/createObjectURL, Web Workers

    +

    The above four features are required for the library to work.

    +
  • +
  • MediaDevices/getUserMedia

    +

    This API is only required for in-browser video streaming. If a browser does not support this API, the Single Frame Mode will be used automatically. If the API exists but doesn't work correctly, the Single Frame Mode can be used as an alternative way to access the camera.

    +
  • +
+

The following table is a list of supported browsers based on the above requirements:

+ + + + + + + + + + + + + + + + + + + + + + + +
Browser NameVersion
Chromev57+ (v59+ on Android/iOS1)
Firefoxv52+ (v55+ on Android/iOS1)
Edge2v16+
Safari3v11+
+

1 iOS 14.3+ is required for camera video streaming in Chrome and Firefox or Apps using webviews.

+

2 On Edge, due to strict Same-origin policy, you must host the library files on the same domain as your web page.

+

3 Safari 11.2.2 ~ 11.2.6 are not supported.

+

Apart from the browsers, the operating systems may impose some limitations of their own that could restrict the use of the library. Browser compatibility ultimately depends on whether the browser on that particular operating system supports the features listed above.

+ +

Hosting the library

+
+ +

Step One: Deploy the dist folder

+
+

Once you have downloaded the library, you can locate the "dist" directory and copy it to your server (usually as part of your website / web application). The following shows some of the files in this directory:

+
    +
  • dbr.js // The main library file
  • +
  • dbr.browser.mjs // For using the library as a module (<script type="module">)
  • +
  • dbr.scanner.html // Defines the default scanner UI
  • +
  • dbr-<version>.worker.js // Defines the worker thread for barcode reading
  • +
  • dbr-<version>.wasm.js // Compact edition of the library (.js)
  • +
  • dbr-<version>.wasm // Compact edition of the library (.wasm)
  • +
  • dbr-<version>.full.wasm.js // Full edition of the library (.js)
  • +
  • dbr-<version>.full.wasm // Full edition of the library (.wasm)
  • +
+ +

Step Two: Configure the Server

+
+
    +
  • Set the MIME type for .wasm as application/wasm on your webserver.

    +

    The goal is to configure your server to send the correct Content-Type header for the wasm file so that it is processed correctly by the browser.

    +

    Different types of webservers are configured differently, for example:

    + +
  • +
  • Enable HTTPS

    +

    To use the library, you must access your website / web application via a secure HTTPS connection. This is due to browser security restrictions which only grant camera video streaming access to a secure context.

    +
    +

    For convenience, self-signed certificates are allowed during development and testing.

    +
    +
  • +
+ +

Step Three: Include the library from the server

+
+

Now that the library is hosted on your server, you can include it accordingly.

+
<script src="https://www.yourwebsite.com/dynamsoft-javascript-barcode/dist/dbr.js"></script>
+

Optionally, you may also need to (specify the location of the "engine" files)[#specify-the-location-of-the-engine-files].

+ +

Advanced Usage

+
+ +

Read a specific area/region

+
+

To speed up the scanning process, you can choose to scan only a specific area/region.

+
let settings = await scanner.getRuntimeSettings();
+/*
+ * The following code shrinks the decoding region by 25% on all sides
+ */
+settings.region.regionMeasuredByPercentage = 1;
+settings.region.regionLeft = 25;
+settings.region.regionTop = 25;
+settings.region.regionRight = 75;
+settings.region.regionBottom = 75;
+await scanner.updateRuntimeSettings(settings);
+

Try in JSFiddle

+ +

Show internal logs

+
+

Include the following in your code to print internal logs in the console.

+
Dynamsoft.DBR.BarcodeReader._onLog = console.log;
+ +

Set mode arguments

+
+

To precisely control a mode, you can adjust its specific parameters.

+
let settings = await scanner.getRuntimeSettings();
+
+/*
+ * The following code sets the sensitivity of the TextureDetectionModes to 9
+ */
+
+settings.furtherModes.textureDetectionModes = [
+    Dynamsoft.DBR.EnumTextureDetectionMode.TDM_GENERAL_WIDTH_CONCENTRATION, 0, 0, 0, 0, 0, 0, 0
+];
+
+await scanner.updateRuntimeSettings(settings);
+// The 2nd parameter 0 specifies the first mode of TextureDetectionModes, which is "Dynamsoft.DBR.EnumTextureDetectionMode.TDM_GENERAL_WIDTH_CONCENTRATION" in this case.
+await scanner.setModeArgument("TextureDetectionModes", 0, "Sensitivity", "9");
+ +

Display the intermediate result images or the original canvas

+
+

The intermediate result images are created when intermediateResultTypes is set in RuntimeSettings . Then they can be returned with the method getIntermediateResults() . These images can be used to show and debug the barcode reading process.

+

The original canvas ( oriCanvas ) means the actual canvas which holds the image to be passed to the barcode reader engine for decoding.

+
+

NOTE

+

For efficiency, the library may utilize WebGL (Web Graphics Library) for preprocessing an image before passing it to the barcode reader engine. If WebGL is used, the image captured from the camera will not be rendered on the canvas, instead, it gets processed by WebGL first and then is passed to the barcode reader engine directly. In this case, there won't be an original canvas. Therefore, if bSaveOriCanvas is set to true for a BarcodeReader or BarcodeScanenr instance, the WebGL feature will be disabled for that instance.

+

On the other hand, if WebGL is disabled and you try to get the intermediate result specified by EnumIntermediateResultType. IRT_ORIGINAL_IMAGE , it will be exactly the same image as you would get with oriCanvas .

+
+

The following shows how to display these images on the page

+
<div id='scannerV' style="width:50vw;height:50vh"></div>
+<div id='cvses'></div>
+
let pScanner = null;
+(async () => {
+    let scanner = await (pScanner = pScanner || Dynamsoft.DBR.BarcodeScanner.createInstance());
+    /* The default of `_bUseWebgl` is true which means the intermediate result for  
+       IRT_ORIGINAL_IMAGE will be one that has been preprocessed by WebGL */
+    scanner._bUseWebgl = false;
+    document.getElementById('scannerV').appendChild(scanner.getUIElement());;
+    await scanner.updateRuntimeSettings('balance');
+    let rs = await scanner.getRuntimeSettings();
+    rs.intermediateResultTypes = 1;
+    await scanner.updateRuntimeSettings(rs);
+    scanner.onUnduplicatedRead = async (txt, result) => {
+        try {
+            let cvss = await scanner.getIntermediateCanvas();
+            for (let cvs of cvss) {
+                document.getElementById('cvses').appendChild(cvs);
+            }
+            scanner.destroy();
+        } catch (ex) {
+            console.error(ex);
+        }
+    };
+    await scanner.show();
+})();
+ +

How to Upgrade

+
+

If you are using an older version of the library and want to upgrade it to the latest version, please read more on how to upgrade.

+ +

FAQ

+
+ +

Can I open the web page directly from the hard drive?

+
+

Yes, for simple testing purposes, it's perfectly fine to open the file directly from the hard drive. However, you might encounter some issues in doing so (like unable to access the camera, etc.). The recommendation is to deploy this page to your web server and run it over HTTPS. If you don't have a ready-to-use web server but have a package manager like npm or yarn, you can set up a simple HTTP server in minutes. Check out http-server on npm or yarn.

+ +

Why can't I use my camera?

+
+

If you open the web page as file:/// or http://, the camera may not work and you see the following error in the browser console:

+
+

[Deprecation] getUserMedia() no longer works on insecure origins. To use this feature, you should consider switching your application to a secure origin, such as HTTPS. See https://goo.gl/rStTGz for more details.

+
+
    +
  • In Safari 12 the equivalent error is:
  • +
+
+

Trying to call getUserMedia from an insecure document.

+
+

You get this error because the API getUserMedia requires HTTPS to access the camera.

+
    +
  • If you use Chrome or Firefox, you might not get the error because these two browsers allow camera access via file:/// and http://localhost.
  • +
+

To make sure your web application can access the camera, please configure your web server to support HTTPS. The following links may help.

+ +
+
+ +
+
+
+
+

Legend

+
+
    +
  • Property
  • +
  • Method
  • +
  • Accessor
  • +
+
    +
  • Inherited property
  • +
  • Inherited method
  • +
  • Inherited accessor
  • +
+
    +
  • Static property
  • +
  • Static method
  • +
+
    +
  • Property
  • +
+
+
+
+
+

Generated using TypeDoc

+
+
+ + + + \ No newline at end of file diff --git a/doc/api reference/interfaces/barcodereaderexception.html b/doc/api reference/interfaces/barcodereaderexception.html new file mode 100644 index 00000000..b73f62d0 --- /dev/null +++ b/doc/api reference/interfaces/barcodereaderexception.html @@ -0,0 +1,222 @@ + + + + + + BarcodeReaderException | Dynamsoft BarcodeReader SDK for Javascript - v8.6.0 + + + + + +
+
+
+
+ +
+
+ Options +
+
+ All +
    +
  • Public
  • +
  • Public/Protected
  • +
  • All
  • +
+
+ + +
+
+ Menu +
+
+
+
+
+
+ +

Interface BarcodeReaderException

+
+
+
+
+
+
+
+

Hierarchy

+
    +
  • + Error +
      +
    • + BarcodeReaderException +
    • +
    +
  • +
+
+
+

Index

+
+
+
+

Properties

+ +
+
+
+
+
+

Properties

+
+ +

Error

+
Error: ErrorConstructor
+ +
+
+ +

Optional code

+ + +
+
+ +

message

+
message: string
+ +
+
+ +

name

+
name: string
+ +
+
+ +

Optional stack

+
stack: string
+ +
+
+
+ +
+
+
+
+

Legend

+
+
    +
  • Property
  • +
  • Method
  • +
  • Accessor
  • +
+
    +
  • Inherited property
  • +
  • Inherited method
  • +
  • Inherited accessor
  • +
+
    +
  • Static property
  • +
  • Static method
  • +
+
    +
  • Property
  • +
+
+
+
+
+

Generated using TypeDoc

+
+
+ + + + \ No newline at end of file diff --git a/doc/api reference/interfaces/framefilter.html b/doc/api reference/interfaces/framefilter.html new file mode 100644 index 00000000..7e1379c3 --- /dev/null +++ b/doc/api reference/interfaces/framefilter.html @@ -0,0 +1,186 @@ + + + + + + FrameFilter | Dynamsoft BarcodeReader SDK for Javascript - v8.6.0 + + + + + +
+
+
+
+ +
+
+ Options +
+
+ All +
    +
  • Public
  • +
  • Public/Protected
  • +
  • All
  • +
+
+ + +
+
+ Menu +
+
+
+
+
+
+ +

Interface FrameFilter

+
+
+
+
+
+
+
+

Hierarchy

+
    +
  • + FrameFilter +
  • +
+
+
+

Index

+
+
+
+

Properties

+ +
+
+
+
+
+

Properties

+
+ +

Optional region

+
region: RegionDefinition | any
+ +
+
+

The region definition of the frame to calculate the internal indicator. + Default Value: { regionLeft = 0, regionRight = 100, regionTop = 0, regionBottom = 100, regionMeasuredByPercentage = true }

+
+
+
+
+ +

Optional threshold

+
threshold: number
+ +
+
+

The threshold used for filtering frames. + Value range: [0, 1]. + Default value: 0.1. + The SDK will calculate an inner indicator for each frame from AppendFrame(), if the change rate of the indicators between the current frame and the history frames is larger than the given threshold, the current frame will not be added to the inner frame queue waiting for decoding.

+
+
+
+
+
+ +
+
+
+
+

Legend

+
+
    +
  • Property
  • +
  • Method
  • +
  • Accessor
  • +
+
    +
  • Inherited property
  • +
  • Inherited method
  • +
  • Inherited accessor
  • +
+
    +
  • Static property
  • +
  • Static method
  • +
+
    +
  • Property
  • +
+
+
+
+
+

Generated using TypeDoc

+
+
+ + + + \ No newline at end of file diff --git a/doc/api reference/interfaces/localizationresult.html b/doc/api reference/interfaces/localizationresult.html new file mode 100644 index 00000000..e7b9ee22 --- /dev/null +++ b/doc/api reference/interfaces/localizationresult.html @@ -0,0 +1,315 @@ + + + + + + LocalizationResult | Dynamsoft BarcodeReader SDK for Javascript - v8.6.0 + + + + + +
+
+
+
+ +
+
+ Options +
+
+ All +
    +
  • Public
  • +
  • Public/Protected
  • +
  • All
  • +
+
+ + +
+
+ Menu +
+
+
+
+
+
+ +

Interface LocalizationResult

+
+
+
+
+
+
+
+

Hierarchy

+
    +
  • + LocalizationResult +
  • +
+
+
+

Index

+
+
+
+

Properties

+ +
+
+
+
+
+

Properties

+
+ +

angle

+
angle: number
+ +
+
+

The angle of a barcode. Values range from 0 to 360.

+
+
+
+
+ +

x1

+
x1: number
+ +
+
+

The X coordinate of the left-most point.

+
+
+
+
+ +

x2

+
x2: number
+ +
+
+

The X coordinate of the second point in a clockwise direction.

+
+
+
+
+ +

x3

+
x3: number
+ +
+
+

The X coordinate of the third point in a clockwise direction.

+
+
+
+
+ +

x4

+
x4: number
+ +
+
+

The X coordinate of the fourth point in a clockwise direction.

+
+
+
+
+ +

y1

+
y1: number
+ +
+
+

The Y coordinate of the left-most point.

+
+
+
+
+ +

y2

+
y2: number
+ +
+
+

The Y coordinate of the second point in a clockwise direction.

+
+
+
+
+ +

y3

+
y3: number
+ +
+
+

The Y coordinate of the third point in a clockwise direction.

+
+
+
+
+ +

y4

+
y4: number
+ +
+
+

The Y coordinate of the fourth point in a clockwise direction.

+
+
+
+
+
+ +
+
+
+
+

Legend

+
+
    +
  • Property
  • +
  • Method
  • +
  • Accessor
  • +
+
    +
  • Inherited property
  • +
  • Inherited method
  • +
  • Inherited accessor
  • +
+
    +
  • Static property
  • +
  • Static method
  • +
+
    +
  • Property
  • +
+
+
+
+
+

Generated using TypeDoc

+
+
+ + + + \ No newline at end of file diff --git a/doc/api reference/interfaces/regiondefinition.html b/doc/api reference/interfaces/regiondefinition.html new file mode 100644 index 00000000..43c19e10 --- /dev/null +++ b/doc/api reference/interfaces/regiondefinition.html @@ -0,0 +1,214 @@ + + + + + + RegionDefinition | Dynamsoft BarcodeReader SDK for Javascript - v8.6.0 + + + + + +
+
+
+
+ +
+
+ Options +
+
+ All +
    +
  • Public
  • +
  • Public/Protected
  • +
  • All
  • +
+
+ + +
+
+ Menu +
+
+
+
+
+
+ +

Interface RegionDefinition

+
+
+
+
+
+
+
+

Hierarchy

+
    +
  • + RegionDefinition +
  • +
+
+
+

Index

+
+ +
+
+
+

Properties

+
+ +

regionBottom

+
regionBottom: number
+ +
+
+ +

regionLeft

+
regionLeft: number
+ +
+
+ +

regionMeasuredByPercentage

+
regionMeasuredByPercentage: number | boolean
+ +
+
+ +

regionRight

+
regionRight: number
+ +
+
+ +

regionTop

+
regionTop: number
+ +
+
+
+ +
+
+
+
+

Legend

+
+
    +
  • Property
  • +
  • Method
  • +
  • Accessor
  • +
+
    +
  • Inherited property
  • +
  • Inherited method
  • +
  • Inherited accessor
  • +
+
    +
  • Static property
  • +
  • Static method
  • +
+
    +
  • Property
  • +
+
+
+
+
+

Generated using TypeDoc

+
+
+ + + + \ No newline at end of file diff --git a/doc/api reference/interfaces/runtimesettings.html b/doc/api reference/interfaces/runtimesettings.html new file mode 100644 index 00000000..334832f3 --- /dev/null +++ b/doc/api reference/interfaces/runtimesettings.html @@ -0,0 +1,520 @@ + + + + + + RuntimeSettings | Dynamsoft BarcodeReader SDK for Javascript - v8.6.0 + + + + + +
+
+
+
+ +
+
+ Options +
+
+ All +
    +
  • Public
  • +
  • Public/Protected
  • +
  • All
  • +
+
+ + +
+
+ Menu +
+
+
+
+
+
+ +

Interface RuntimeSettings

+
+
+
+
+
+
+
+
+
+
see
+

C++ RuntimeSettings

+
+
+
+
+
+

Hierarchy

+
    +
  • + RuntimeSettings +
  • +
+
+
+

Index

+
+ +
+
+
+

Properties

+
+ +

PDFReadingMode

+
PDFReadingMode: EnumPDFReadingMode
+ +
+
+

Not available in JS. Sets the way to detect barcodes from a PDF file when using the DecodeFile method.

+
+
+
+
+ +

barcodeFormatIds

+
barcodeFormatIds: number | EnumBarcodeFormat
+ +
+
+

Sets the formats of the barcode in BarcodeFormat group 1 to be read. Barcode formats in BarcodeFormat group 1 can be combined.

+
let runtimeSettings = await reader.getRuntimeSettings();
+runtimeSettings.barcodeFormatIds = Dynamsoft.DBR.EnumBarcodeFormat.BF_ONED | Dynamsoft.DBR.EnumBarcodeFormat.BF_QR_CODE;
+await reader.updateRuntimeSettings(runtimeSettings);
+
+
+
+
+ +

barcodeFormatIds_2

+
barcodeFormatIds_2: number | EnumBarcodeFormat_2
+ +
+
+

Sets the formats of the barcode in BarcodeFormat group 2 to be read. Barcode formats in BarcodeFormat group 1 can be combined.

+
+
+
+
+ +

binarizationModes

+
binarizationModes: EnumBinarizationMode[]
+ +
+
+

Sets the mode and priority for binarization.

+
+
+
+
+ +

deblurLevel

+
deblurLevel: number
+ +
+
+

Sets the degree of blurriness of the barcode.

+
+
+
+
+ +

expectedBarcodesCount

+
expectedBarcodesCount: number
+ +
+
+

Sets the number of barcodes expected to be detected for each image.

+
+
+
+
+ +

furtherModes

+
furtherModes: any
+ +
+
+

Sets the further modes.

+
+
+
+
+ +

intermediateResultTypes

+
intermediateResultTypes: EnumIntermediateResultType
+ +
+
+

Sets which types of intermediate result to be kept for further reference. Intermediate result types can be combined.

+
+
+
+
+ +

localizationModes

+
localizationModes: number[] | EnumLocalizationMode[]
+ +
+
+

Sets the mode and priority for localization algorithms.

+
+
+
+
+ +

minBarcodeTextLength

+
minBarcodeTextLength: number
+ +
+
+

Sets the range of barcode text length for barcodes search

+
+
+
+
+ +

minResultConfidence

+
minResultConfidence: number
+ +
+
+

The minimum confidence of the result

+
+
+
+
+ +

region

+ + +
+
+

Sets the region definition including the regionTop, regionLeft, regionRight, regionBottom and regionMeasuredByPercentage.

+
+

Experimental feature:

+

In BarcodeScanner, region can be an array. For example region = [r0, r1, r2], 0th frame use r0, 1st use r1, 2nd use r2, 3rd use r0, and then loop like this.

+
+
+
+ +

resultCoordinateType

+
resultCoordinateType: number | EnumResultCoordinateType
+ +
+
+

Specifies the format for the coordinates returned

+
+
+
+
+ +

returnBarcodeZoneClarity

+
returnBarcodeZoneClarity: number
+ +
+
+

Sets whether or not to return the clarity of the barcode zone.

+
+
+
+
+ +

scaleDownThreshold

+
scaleDownThreshold: number
+ +
+
+

Sets the threshold for the image shrinking

+
+
+
+
+ +

scaleUpModes

+
scaleUpModes: EnumScaleUpMode[]
+ +
+
+

Sets the mode and priority to control the sampling methods of scale-up for linear barcode with small module sizes.

+
+
+
+
+ +

terminatePhase

+
terminatePhase: EnumTerminatePhase
+ +
+
+

Sets the phase where the algorithm stops.

+
+
+
+
+ +

textResultOrderModes

+
textResultOrderModes: EnumTextResultOrderMode[]
+ +
+
+

Sets the mode and priority for the order of the text results returned.

+
+
+
+
+ +

timeout

+
timeout: number
+ +
+
+

Sets the maximum amount of time (in milliseconds) that should be spent searching for a barcode per page. + It does not include the time taken to load/decode an image (Tiff, PNG, etc) from disk into memory.

+
+
+
+
+
+ +
+
+
+
+

Legend

+
+
    +
  • Property
  • +
  • Method
  • +
  • Accessor
  • +
+
    +
  • Inherited property
  • +
  • Inherited method
  • +
  • Inherited accessor
  • +
+
    +
  • Static property
  • +
  • Static method
  • +
+
    +
  • Property
  • +
+
+
+
+
+

Generated using TypeDoc

+
+
+ + + + \ No newline at end of file diff --git a/doc/api reference/interfaces/scannerplaycallbackinfo.html b/doc/api reference/interfaces/scannerplaycallbackinfo.html new file mode 100644 index 00000000..02c53116 --- /dev/null +++ b/doc/api reference/interfaces/scannerplaycallbackinfo.html @@ -0,0 +1,172 @@ + + + + + + ScannerPlayCallbackInfo | Dynamsoft BarcodeReader SDK for Javascript - v8.6.0 + + + + + +
+
+
+
+ +
+
+ Options +
+
+ All +
    +
  • Public
  • +
  • Public/Protected
  • +
  • All
  • +
+
+ + +
+
+ Menu +
+
+
+
+
+
+ +

Interface ScannerPlayCallbackInfo

+
+
+
+
+
+
+
+

Hierarchy

+
    +
  • + ScannerPlayCallbackInfo +
  • +
+
+
+

Index

+
+
+
+

Properties

+ +
+
+
+
+
+

Properties

+
+ +

height

+
height: number
+ +
+
+ +

width

+
width: number
+ +
+
+
+ +
+
+
+
+

Legend

+
+
    +
  • Property
  • +
  • Method
  • +
  • Accessor
  • +
+
    +
  • Inherited property
  • +
  • Inherited method
  • +
  • Inherited accessor
  • +
+
    +
  • Static property
  • +
  • Static method
  • +
+
    +
  • Property
  • +
+
+
+
+
+

Generated using TypeDoc

+
+
+ + + + \ No newline at end of file diff --git a/doc/api reference/interfaces/scansettings.html b/doc/api reference/interfaces/scansettings.html new file mode 100644 index 00000000..405d49da --- /dev/null +++ b/doc/api reference/interfaces/scansettings.html @@ -0,0 +1,213 @@ + + + + + + ScanSettings | Dynamsoft BarcodeReader SDK for Javascript - v8.6.0 + + + + + +
+
+
+
+ +
+
+ Options +
+
+ All +
    +
  • Public
  • +
  • Public/Protected
  • +
  • All
  • +
+
+ + +
+
+ Menu +
+
+
+
+
+
+ +

Interface ScanSettings

+
+
+
+
+
+
+
+
+
+

let scanSettings = await scanner.getScanSettings(); + scanSettings.intervalTime = 100; // 100ms + scanSettings.duplicateForgetTime = 3000; // 3s + await scanner.updateScanSettings(scanSettings);

+
+
+
+
+

Hierarchy

+
    +
  • + ScanSettings +
  • +
+
+
+

Index

+
+
+
+

Properties

+ +
+
+
+
+
+

Properties

+
+ +

Optional duplicateForgetTime

+
duplicateForgetTime: number
+ +
+
+ +

Optional frameFilter

+
frameFilter: FrameFilter
+ +
+
+

Filter frame during focusing. + region define the detecting area. + threshold is (0,1).

+
scanSettings.frameFilter = {
+     region: {
+         regionLeft: 0,
+         regionTop: 47,
+         regionRight: 100,
+         regionBottom: 53,
+         regionMeasuredByPercentage: true
+     },
+     threshold: 0.01
+};
+
+
+
+
+ +

Optional intervalTime

+
intervalTime: number
+ +
+
+
+ +
+
+
+
+

Legend

+
+
    +
  • Property
  • +
  • Method
  • +
  • Accessor
  • +
+
    +
  • Inherited property
  • +
  • Inherited method
  • +
  • Inherited accessor
  • +
+
    +
  • Static property
  • +
  • Static method
  • +
+
    +
  • Property
  • +
+
+
+
+
+

Generated using TypeDoc

+
+
+ + + + \ No newline at end of file diff --git a/doc/api reference/interfaces/textresult.html b/doc/api reference/interfaces/textresult.html new file mode 100644 index 00000000..c46325ed --- /dev/null +++ b/doc/api reference/interfaces/textresult.html @@ -0,0 +1,248 @@ + + + + + + TextResult | Dynamsoft BarcodeReader SDK for Javascript - v8.6.0 + + + + + +
+
+
+
+ +
+
+ Options +
+
+ All +
    +
  • Public
  • +
  • Public/Protected
  • +
  • All
  • +
+
+ + +
+
+ Menu +
+
+
+
+
+
+ +

Interface TextResult

+
+
+
+
+
+
+
+
+
+
see
+

C++ TextResult

+
+
+
+
+
+

Hierarchy

+
    +
  • + TextResult +
  • +
+
+
+

Index

+
+ +
+
+
+

Properties

+
+ +

barcodeBytes

+
barcodeBytes: number[]
+ +
+
+

The barcode content in a byte array.

+
+
+
+
+ +

barcodeFormat

+
barcodeFormat: number | EnumBarcodeFormat
+ +
+
+

The barcode format.

+
+
+
+
+ +

barcodeFormatString

+
barcodeFormatString: string
+ +
+
+

Barcode type in string.

+
+
+
+
+ +

barcodeText

+
barcodeText: string
+ +
+
+

The barcode text.

+
+
+
+
+ +

localizationResult

+
localizationResult: LocalizationResult
+ +
+
+

The corresponding localization result.

+
+
+
+
+
+ +
+
+
+
+

Legend

+
+
    +
  • Property
  • +
  • Method
  • +
  • Accessor
  • +
+
    +
  • Inherited property
  • +
  • Inherited method
  • +
  • Inherited accessor
  • +
+
    +
  • Static property
  • +
  • Static method
  • +
+
    +
  • Property
  • +
+
+
+
+
+

Generated using TypeDoc

+
+
+ + + + \ No newline at end of file diff --git a/doc/api reference/interfaces/videodeviceinfo.html b/doc/api reference/interfaces/videodeviceinfo.html new file mode 100644 index 00000000..b74b2319 --- /dev/null +++ b/doc/api reference/interfaces/videodeviceinfo.html @@ -0,0 +1,172 @@ + + + + + + VideoDeviceInfo | Dynamsoft BarcodeReader SDK for Javascript - v8.6.0 + + + + + +
+
+
+
+ +
+
+ Options +
+
+ All +
    +
  • Public
  • +
  • Public/Protected
  • +
  • All
  • +
+
+ + +
+
+ Menu +
+
+
+
+
+
+ +

Interface VideoDeviceInfo

+
+
+
+
+
+
+
+

Hierarchy

+
    +
  • + VideoDeviceInfo +
  • +
+
+
+

Index

+
+
+
+

Properties

+ +
+
+
+
+
+

Properties

+
+ +

deviceId

+
deviceId: string
+ +
+
+ +

label

+
label: string
+ +
+
+
+ +
+
+
+
+

Legend

+
+
    +
  • Property
  • +
  • Method
  • +
  • Accessor
  • +
+
    +
  • Inherited property
  • +
  • Inherited method
  • +
  • Inherited accessor
  • +
+
    +
  • Static property
  • +
  • Static method
  • +
+
    +
  • Property
  • +
+
+
+
+
+

Generated using TypeDoc

+
+
+ + + + \ No newline at end of file diff --git a/doc/legal.txt b/doc/legal.txt new file mode 100644 index 00000000..2c70d049 --- /dev/null +++ b/doc/legal.txt @@ -0,0 +1,1095 @@ +Legal Notices: + +This SDK contains parts of following softwares which are used under license. + +=================================================================================== +Zlib. + +Copyright (C) 1995-2010 Jean-loup Gailly and Mark Adler + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + + Jean-loup Gailly + Mark Adler +=================================================================================== + + + +=================================================================================== +LibTiff + +Copyright (c) 1988-1997 Sam Leffler +Copyright (c) 1991-1997 Silicon Graphics, Inc. + +Permission to use, copy, modify, distribute, and sell this software and +its documentation for any purpose is hereby granted without fee, provided +that (i) the above copyright notices and this permission notice appear in +all copies of the software and related documentation, and (ii) the names of +Sam Leffler and Silicon Graphics may not be used in any advertising or +publicity relating to the software without the specific, prior written +permission of Sam Leffler and Silicon Graphics. + +THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, +EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY +WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. + +IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR +ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY +KIND, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA +OR PROFITS, WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, +AND ON ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION +WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +=================================================================================== + + + +=================================================================================== +LibJPEG + +In plain English: + +1. We don't promise that this software works. (But if you find any bugs, + please let us know!) +2. You can use this software for whatever you want. You don't have to pay us. +3. You may not pretend that you wrote this software. If you use it in a + program, you must acknowledge somewhere in your documentation that + you've used the IJG code. + +In legalese: + +The authors make NO WARRANTY or representation, either express or implied, +with respect to this software, its quality, accuracy, merchantability, or +fitness for a particular purpose. This software is provided "AS IS", and you, +its user, assume the entire risk as to its quality and accuracy. + +This software is copyright (C) 1991-2010, Thomas G. Lane, Guido Vollbeding. +All Rights Reserved except as specified below. + +Permission is hereby granted to use, copy, modify, and distribute this +software (or portions thereof) for any purpose, without fee, subject to these +conditions: +(1) If any part of the source code for this software is distributed, then this +README file must be included, with this copyright and no-warranty notice +unaltered; and any additions, deletions, or changes to the original files +must be clearly indicated in accompanying documentation. +(2) If only executable code is distributed, then the accompanying +documentation must state that "this software is based in part on the work of +the Independent JPEG Group". +(3) Permission for use of this software is granted only if the user accepts +full responsibility for any undesirable consequences; the authors accept +NO LIABILITY for damages of any kind. + +These conditions apply to any software derived from or based on the IJG code, +not just to the unmodified library. If you use our work, you ought to +acknowledge us. + +Permission is NOT granted for the use of any IJG author's name or company name +in advertising or publicity relating to this software or products derived from +it. This software may be referred to only as "the Independent JPEG Group's +software". + +We specifically permit and encourage the use of this software as the basis of +commercial products, provided that all warranty or liability claims are +assumed by the product vendor. + + +ansi2knr.c is included in this distribution by permission of L. Peter Deutsch, +sole proprietor of its copyright holder, Aladdin Enterprises of Menlo Park, CA. +ansi2knr.c is NOT covered by the above copyright and conditions, but instead +by the usual distribution terms of the Free Software Foundation; principally, +that you must include source code if you redistribute it. (See the file +ansi2knr.c for full details.) However, since ansi2knr.c is not needed as part +of any program generated from the IJG code, this does not limit you more than +the foregoing paragraphs do. + +The Unix configuration script "configure" was produced with GNU Autoconf. +It is copyright by the Free Software Foundation but is freely distributable. +The same holds for its supporting scripts (config.guess, config.sub, +ltmain.sh). Another support script, install-sh, is copyright by X Consortium +but is also freely distributable. + +The IJG distribution formerly included code to read and write GIF files. +To avoid entanglement with the Unisys LZW patent, GIF reading support has +been removed altogether, and the GIF writer has been simplified to produce +"uncompressed GIFs". This technique does not use the LZW algorithm; the +resulting GIF files are larger than usual, but are readable by all standard +GIF decoders. + +We are required to state that + "The Graphics Interchange Format(c) is the Copyright property of + CompuServe Incorporated. GIF(sm) is a Service Mark property of + CompuServe Incorporated." + +libjpeg-turbo + +this software is based in part on the work of the Independent JPEG Group. +=================================================================================== + + + +=================================================================================== +LibPNG + + +This copy of the libpng notices is provided for your convenience. In case of +any discrepancy between this copy and the notices in the file png.h that is +included in the libpng distribution, the latter shall prevail. + +COPYRIGHT NOTICE, DISCLAIMER, and LICENSE: + +If you modify libpng you may insert additional notices immediately following +this sentence. + +This code is released under the libpng license. + +libpng versions 1.0.7, July 1, 2000 through 1.6.32, August 24, 2017 are +Copyright (c) 2000-2002, 2004, 2006-2017 Glenn Randers-Pehrson, are +derived from libpng-1.0.6, and are distributed according to the same +disclaimer and license as libpng-1.0.6 with the following individuals +added to the list of Contributing Authors: + + Simon-Pierre Cadieux + Eric S. Raymond + Mans Rullgard + Cosmin Truta + Gilles Vollant + James Yu + Mandar Sahastrabuddhe + Google Inc. + Vadim Barkov + +and with the following additions to the disclaimer: + + There is no warranty against interference with your enjoyment of the + library or against infringement. There is no warranty that our + efforts or the library will fulfill any of your particular purposes + or needs. This library is provided with all faults, and the entire + risk of satisfactory quality, performance, accuracy, and effort is with + the user. + +Some files in the "contrib" directory and some configure-generated +files that are distributed with libpng have other copyright owners and +are released under other open source licenses. + +libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are +Copyright (c) 1998-2000 Glenn Randers-Pehrson, are derived from +libpng-0.96, and are distributed according to the same disclaimer and +license as libpng-0.96, with the following individuals added to the list +of Contributing Authors: + + Tom Lane + Glenn Randers-Pehrson + Willem van Schaik + +libpng versions 0.89, June 1996, through 0.96, May 1997, are +Copyright (c) 1996-1997 Andreas Dilger, are derived from libpng-0.88, +and are distributed according to the same disclaimer and license as +libpng-0.88, with the following individuals added to the list of +Contributing Authors: + + John Bowler + Kevin Bracey + Sam Bushell + Magnus Holmgren + Greg Roelofs + Tom Tanner + +Some files in the "scripts" directory have other copyright owners +but are released under this license. + +libpng versions 0.5, May 1995, through 0.88, January 1996, are +Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. + +For the purposes of this copyright and license, "Contributing Authors" +is defined as the following set of individuals: + + Andreas Dilger + Dave Martindale + Guy Eric Schalnat + Paul Schmidt + Tim Wegner + +The PNG Reference Library is supplied "AS IS". The Contributing Authors +and Group 42, Inc. disclaim all warranties, expressed or implied, +including, without limitation, the warranties of merchantability and of +fitness for any purpose. The Contributing Authors and Group 42, Inc. +assume no liability for direct, indirect, incidental, special, exemplary, +or consequential damages, which may result from the use of the PNG +Reference Library, even if advised of the possibility of such damage. + +Permission is hereby granted to use, copy, modify, and distribute this +source code, or portions hereof, for any purpose, without fee, subject +to the following restrictions: + + 1. The origin of this source code must not be misrepresented. + + 2. Altered versions must be plainly marked as such and must not + be misrepresented as being the original source. + + 3. This Copyright notice may not be removed or altered from any + source or altered source distribution. + +The Contributing Authors and Group 42, Inc. specifically permit, without +fee, and encourage the use of this source code as a component to +supporting the PNG file format in commercial products. If you use this +source code in a product, acknowledgment is not required but would be +appreciated. + +END OF COPYRIGHT NOTICE, DISCLAIMER, and LICENSE. + +TRADEMARK: + +The name "libpng" has not been registered by the Copyright owner +as a trademark in any jurisdiction. However, because libpng has +been distributed and maintained world-wide, continually since 1995, +the Copyright owner claims "common-law trademark protection" in any +jurisdiction where common-law trademark is recognized. + +OSI CERTIFICATION: + +Libpng is OSI Certified Open Source Software. OSI Certified Open Source is +a certification mark of the Open Source Initiative. OSI has not addressed +the additional disclaimers inserted at version 1.0.7. + +EXPORT CONTROL: + +The Copyright owner believes that the Export Control Classification +Number (ECCN) for libpng is EAR99, which means not subject to export +controls or International Traffic in Arms Regulations (ITAR) because +it is open source, publicly available software, that does not contain +any encryption software. See the EAR, paragraphs 734.3(b)(3) and +734.7(b). + +Glenn Randers-Pehrson +glennrp at users.sourceforge.net +April 1, 2017 +=================================================================================== + + + +=================================================================================== +Giflib + +The GIFLIB distribution is Copyright (c) 1997 Eric S. Raymond + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +=================================================================================== + + + +=================================================================================== +Google's open-source ZXing ("Zebra Crossing") + +Apache License +Version 2.0, January 2004 +http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + +"License" shall mean the terms and conditions for use, reproduction, +and distribution as defined by Sections 1 through 9 of this document. + +"Licensor" shall mean the copyright owner or entity authorized by +the copyright owner that is granting the License. + +"Legal Entity" shall mean the union of the acting entity and all +other entities that control, are controlled by, or are under common +control with that entity. For the purposes of this definition, +"control" means (i) the power, direct or indirect, to cause the +direction or management of such entity, whether by contract or +otherwise, or (ii) ownership of fifty percent (50%) or more of the +outstanding shares, or (iii) beneficial ownership of such entity. + +"You" (or "Your") shall mean an individual or Legal Entity +exercising permissions granted by this License. + +"Source" form shall mean the preferred form for making modifications, +including but not limited to software source code, documentation +source, and configuration files. + +"Object" form shall mean any form resulting from mechanical +transformation or translation of a Source form, including but +not limited to compiled object code, generated documentation, +and conversions to other media types. + +"Work" shall mean the work of authorship, whether in Source or +Object form, made available under the License, as indicated by a +copyright notice that is included in or attached to the work +(an example is provided in the Appendix below). + +"Derivative Works" shall mean any work, whether in Source or Object +form, that is based on (or derived from) the Work and for which the +editorial revisions, annotations, elaborations, or other modifications +represent, as a whole, an original work of authorship. For the purposes +of this License, Derivative Works shall not include works that remain +separable from, or merely link (or bind by name) to the interfaces of, +the Work and Derivative Works thereof. + +"Contribution" shall mean any work of authorship, including +the original version of the Work and any modifications or additions +to that Work or Derivative Works thereof, that is intentionally +submitted to Licensor for inclusion in the Work by the copyright owner +or by an individual or Legal Entity authorized to submit on behalf of +the copyright owner. For the purposes of this definition, "submitted" +means any form of electronic, verbal, or written communication sent +to the Licensor or its representatives, including but not limited to +communication on electronic mailing lists, source code control systems, +and issue tracking systems that are managed by, or on behalf of, the +Licensor for the purpose of discussing and improving the Work, but +excluding communication that is conspicuously marked or otherwise +designated in writing by the copyright owner as "Not a Contribution." + +"Contributor" shall mean Licensor and any individual or Legal Entity +on behalf of whom a Contribution has been received by Licensor and +subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of +this License, each Contributor hereby grants to You a perpetual, +worldwide, non-exclusive, no-charge, royalty-free, irrevocable +copyright license to reproduce, prepare Derivative Works of, +publicly display, publicly perform, sublicense, and distribute the +Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of +this License, each Contributor hereby grants to You a perpetual, +worldwide, non-exclusive, no-charge, royalty-free, irrevocable +(except as stated in this section) patent license to make, have made, +use, offer to sell, sell, import, and otherwise transfer the Work, +where such license applies only to those patent claims licensable +by such Contributor that are necessarily infringed by their +Contribution(s) alone or by combination of their Contribution(s) +with the Work to which such Contribution(s) was submitted. If You +institute patent litigation against any entity (including a +cross-claim or counterclaim in a lawsuit) alleging that the Work +or a Contribution incorporated within the Work constitutes direct +or contributory patent infringement, then any patent licenses +granted to You under this License for that Work shall terminate +as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the +Work or Derivative Works thereof in any medium, with or without +modifications, and in Source or Object form, provided that You +meet the following conditions: + +(a) You must give any other recipients of the Work or +Derivative Works a copy of this License; and + +(b) You must cause any modified files to carry prominent notices +stating that You changed the files; and + +(c) You must retain, in the Source form of any Derivative Works +that You distribute, all copyright, patent, trademark, and +attribution notices from the Source form of the Work, +excluding those notices that do not pertain to any part of +the Derivative Works; and + +(d) If the Work includes a "NOTICE" text file as part of its +distribution, then any Derivative Works that You distribute must +include a readable copy of the attribution notices contained +within such NOTICE file, excluding those notices that do not +pertain to any part of the Derivative Works, in at least one +of the following places: within a NOTICE text file distributed +as part of the Derivative Works; within the Source form or +documentation, if provided along with the Derivative Works; or, +within a display generated by the Derivative Works, if and +wherever such third-party notices normally appear. The contents +of the NOTICE file are for informational purposes only and +do not modify the License. You may add Your own attribution +notices within Derivative Works that You distribute, alongside +or as an addendum to the NOTICE text from the Work, provided +that such additional attribution notices cannot be construed +as modifying the License. + +You may add Your own copyright statement to Your modifications and +may provide additional or different license terms and conditions +for use, reproduction, or distribution of Your modifications, or +for any such Derivative Works as a whole, provided Your use, +reproduction, and distribution of the Work otherwise complies with +the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, +any Contribution intentionally submitted for inclusion in the Work +by You to the Licensor shall be under the terms and conditions of +this License, without any additional terms or conditions. +Notwithstanding the above, nothing herein shall supersede or modify +the terms of any separate license agreement you may have executed +with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade +names, trademarks, service marks, or product names of the Licensor, +except as required for reasonable and customary use in describing the +origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or +agreed to in writing, Licensor provides the Work (and each +Contributor provides its Contributions) on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +implied, including, without limitation, any warranties or conditions +of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A +PARTICULAR PURPOSE. You are solely responsible for determining the +appropriateness of using or redistributing the Work and assume any +risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, +whether in tort (including negligence), contract, or otherwise, +unless required by applicable law (such as deliberate and grossly +negligent acts) or agreed to in writing, shall any Contributor be +liable to You for damages, including any direct, indirect, special, +incidental, or consequential damages of any character arising as a +result of this License or out of the use or inability to use the +Work (including but not limited to damages for loss of goodwill, +work stoppage, computer failure or malfunction, or any and all +other commercial damages or losses), even if such Contributor +has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing +the Work or Derivative Works thereof, You may choose to offer, +and charge a fee for, acceptance of support, warranty, indemnity, +or other liability obligations and/or rights consistent with this +License. However, in accepting such obligations, You may act only +on Your own behalf and on Your sole responsibility, not on behalf +of any other Contributor, and only if You agree to indemnify, +defend, and hold each Contributor harmless for any liability +incurred by, or claims asserted against, such Contributor by reason +of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + +To apply the Apache License to your work, attach the following +boilerplate notice, with the fields enclosed by brackets "[]" +replaced with your own identifying information. (Don't include +the brackets!) The text should be enclosed in the appropriate +comment syntax for the file format. We also recommend that a +file or class name and description of purpose be included on the +same "printed page" as the copyright notice for easier +identification within third-party archives. + +Copyright [yyyy] [name of copyright owner] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +=================================================================================== + + + +=================================================================================== +OpenCV + +License Agreement +For Open Source Computer Vision Library +(3-clause BSD License) + +Copyright (C) 2000-2015, Intel Corporation, all rights reserved. +Copyright (C) 2009-2011, Willow Garage Inc., all rights reserved. +Copyright (C) 2009-2015, NVIDIA Corporation, all rights reserved. +Copyright (C) 2010-2013, Advanced Micro Devices, Inc., all rights reserved. +Copyright (C) 2015, OpenCV Foundation, all rights reserved. +Copyright (C) 2015, Itseez Inc., all rights reserved. +Third party copyrights are property of their respective owners. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + Neither the names of the copyright holders nor the names of the contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +This software is provided by the copyright holders and contributors "as is" and any express or implied warranties, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose are disclaimed. In no event shall copyright holders or contributors be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of +the use of this software, even if advised of the possibility of such damage. +=================================================================================== + + + +=================================================================================== +JsonCpp library + +The JsonCpp library's source code, including accompanying documentation, +tests and demonstration applications, are licensed under the following +conditions... + +The author (Baptiste Lepilleur) explicitly disclaims copyright in all +jurisdictions which recognize such a disclaimer. In such jurisdictions, +this software is released into the Public Domain. + +In jurisdictions which do not recognize Public Domain property (e.g. Germany as of +2010), this software is Copyright (c) 2007-2010 by Baptiste Lepilleur, and is +released under the terms of the MIT License (see below). + +In jurisdictions which recognize Public Domain property, the user of this +software may choose to accept it either as 1) Public Domain, 2) under the +conditions of the MIT License (see below), or 3) under the terms of dual +Public Domain/MIT License conditions described here, as they choose. + +The MIT License is about as close to Public Domain as a license can get, and is +described in clear, concise terms at: + + http://en.wikipedia.org/wiki/MIT_License + +The full text of the MIT License follows: + +======================================================================== +Copyright (c) 2007-2010 Baptiste Lepilleur + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, copy, +modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS +BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +======================================================================== +(END LICENSE TEXT) + +The MIT license is compatible with both the GPL and commercial +software, affording one all of the rights of Public Domain with the +minor nuisance of being required to keep the above copyright notice +and license text in the source code. Note also that by accepting the +Public Domain "license" you can re-license your copy using whatever +license you like. +=================================================================================== + + + +=================================================================================== +Libcurl + +COPYRIGHT AND PERMISSION NOTICE + +Copyright (c) 1996 - 2015, Daniel Stenberg, daniel@haxx.se. + +All rights reserved. + +Permission to use, copy, modify, and distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of a copyright holder shall not +be used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization of the copyright holder. +=================================================================================== + + + +=================================================================================== +Caffe + +COPYRIGHT + +All contributions by the University of California: +Copyright (c) 2014-2017 The Regents of the University of California (Regents) +All rights reserved. + +All other contributions: +Copyright (c) 2014-2017, the respective contributors +All rights reserved. + +Caffe uses a shared copyright model: each contributor holds copyright over +their contributions to Caffe. The project versioning records all such +contribution and copyright details. If a contributor wants to further mark +their specific copyright on a particular contribution, they should indicate +their copyright solely in the commit message of the change when it is +committed. + +LICENSE + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +CONTRIBUTION AGREEMENT + +By contributing to the BVLC/caffe repository through pull-request, comment, +or otherwise, the contributor releases their content to the +license and copyright terms herein. +=================================================================================== + + + +=================================================================================== +Protocol Buffers + +This license applies to all parts of Protocol Buffers except the following: + + - Atomicops support for generic gcc, located in + src/google/protobuf/stubs/atomicops_internals_generic_gcc.h. + This file is copyrighted by Red Hat Inc. + + - Atomicops support for AIX/POWER, located in + src/google/protobuf/stubs/atomicops_internals_power.h. + This file is copyrighted by Bloomberg Finance LP. + +Copyright 2014, Google Inc. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +Code generated by the Protocol Buffer compiler is owned by the owner +of the input file used when generating it. This code is not +standalone and requires a support library to be linked with it. This +support library is itself covered by the above license. +=================================================================================== + + + +=================================================================================== +Boost + +Boost Software License - Version 1.0 - August 17th, 2003 + +Permission is hereby granted, free of charge, to any person or organization +obtaining a copy of the software and accompanying documentation covered by +this license (the "Software") to use, reproduce, display, distribute, +execute, and transmit the Software, and to prepare derivative works of the +Software, and to permit third-parties to whom the Software is furnished to +do so, all subject to the following: + +The copyright notices in the Software and this entire statement, including +the above license grant, this restriction and the following disclaimer, +must be included in all copies of the Software, in whole or in part, and +all derivative works of the Software, unless such copies or derivative +works are solely in the form of machine-executable object code generated by +a source language processor. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. +=================================================================================== + + + +=================================================================================== +OpenBLAS + +Copyright (c) 2011-2014, The OpenBLAS Project +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. Neither the name of the OpenBLAS project nor the names of + its contributors may be used to endorse or promote products + derived from this software without specific prior written + permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE +USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +=================================================================================== + + + +=================================================================================== +GFlags + +Copyright (c) 2006, Google Inc. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +=================================================================================== + + + +=================================================================================== +GLog + +Copyright (c) 2008, Google Inc. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +A function gettimeofday in utilities.cc is based on + +http://www.google.com/codesearch/p?hl=en#dR3YEbitojA/COPYING&q=GetSystemTimeAsFileTime%20license:bsd + +The license of this code is: + +Copyright (c) 2003-2008, Jouni Malinen and contributors +All Rights Reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +3. Neither the name(s) of the above-listed copyright holder(s) nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +=================================================================================== + + + +localForage + +-- Offline Storage, Improved +Version 1.7.3 +https://localforage.github.io/localForage +(c) 2013-2017 Mozilla, Apache License 2.0 + + +================================== SOFTWARES USED IN SAMPLES ===================================== + + +Webpack + +Copyright JS Foundation and other contributors + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + + +Angular + +The MIT License + +Copyright (c) 2010-2019 Google LLC. http://angular.io/license + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + + + +React + +MIT License + +Copyright (c) Facebook, Inc. and its affiliates. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + + + +Vue + +The MIT License (MIT) + +Copyright (c) 2013-present, Yuxi (Evan) You + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + + + +RequireJS + +Copyright jQuery Foundation and other contributors, https://jquery.org/ + +This software consists of voluntary contributions made by many +individuals. For exact contribution history, see the revision history +available at https://github.com/requirejs/requirejs + +The following license applies to all parts of this software except as +documented below: + +==== + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +==== + +Copyright and related rights for sample code are waived via CC0. Sample +code is defined as all source code displayed within the prose of the +documentation. + +CC0: http://creativecommons.org/publicdomain/zero/1.0/ + +==== + +Files located in the node_modules directory, and certain utilities used +to build or test the software in the test and dist directories, are +externally maintained libraries used by this software which have their own +licenses; we recommend you read them, as their terms may differ from the +terms above. + + + +eruda + +The MIT License (MIT) + +Copyright (c) 2016-present liriliri + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + diff --git a/package.json b/package.json new file mode 100644 index 00000000..22114ca6 --- /dev/null +++ b/package.json @@ -0,0 +1,77 @@ +{ + "name": "dynamsoft-javascript-barcode", + "version": "8.6.0", + "description": "Dynamsoft Barcode Reader JS is a recognition SDK which enables you to embed barcode reading functionality in your web, desktop, and mobile applications. With a few lines of JavaScript code, you can develop a robust application to scan a linear barcode, QR Code, DaraMatrix, PDF417, and Aztec Code.", + "files": [ + "/dist/dbr.js", + "/dist/dbr.mjs", + "/dist/dbr.browser.mjs", + "/dist/dbr-*.worker.js", + "/dist/dbr-*.wasm.js", + "/dist/dbr-*.wasm", + "/dist/dbr.d.ts", + "/dist/dbr.reference.d.ts", + "/dist/dbr.scanner.html", + "/dist/dls.license.dialog.html", + "/samples", + "/doc" + ], + "homepage": "https://www.dynamsoft.com/barcode-reader/sdk-javascript", + "main": "dist/dbr.js", + "module": "dist/dbr.mjs", + "browser": "dist/dbr.browser.mjs", + "types": "dist/dbr.d.ts", + "author": { + "name": "Dynamsoft", + "url": "https://www.dynamsoft.com" + }, + "license": "SEE LICENSE IN LICENSE.txt", + "repository": { + "type": "git", + "url": "https://github.com/dynamsoft/javascript-barcode.git" + }, + "maintainers": [ + { + "name": "Dynamsoft", + "email": "support@dynamsoft.com" + } + ], + "keywords": [ + "HTML5 barcode", + "JavaScript barcode", + "Web barcode", + "barcode", + "PDF417", + "QRCode", + "Aztec Code", + "WebAssembly", + "SDK", + "Linear barcode", + "1D barcode" + ], + "scripts": { + "build": "dts-bundle-generator -o dist/dbr.d.ts src/dbr.ts & webpack --config webpack.config.js", + "build:node": "webpack --config webpack.config.node.js", + "build:doc": "typedoc", + "test": "node ./samples/node/helloworld.js" + }, + "devDependencies": { + "@types/node": "^13.9.8", + "declaration-bundler-webpack-plugin": "^1.0.3", + "dts-bundle-generator": "^4.0.0", + "fork-ts-checker-webpack-plugin": "^4.1.2", + "fs-extra": "^8.1.0", + "localforage": "^1.7.3", + "ts-loader": "^6.2.2", + "typedoc": "^0.17.3", + "typescript": "^3.8.3", + "uglifyjs-webpack-plugin": "^2.2.0", + "webpack": "^4.39.3", + "webpack-cli": "^3.3.7", + "webpack-merge": "^4.2.2" + }, + "peerDependencies": { + "node-fetch": "^2.6.1", + "node-localstorage": "^2.1.6" + } +} diff --git a/samples/hybrid/electron/.gitignore b/samples/hybrid/electron/.gitignore new file mode 100644 index 00000000..5add9449 --- /dev/null +++ b/samples/hybrid/electron/.gitignore @@ -0,0 +1,2 @@ +/node_modules +/yarn.lock diff --git a/samples/hybrid/electron/README.md b/samples/hybrid/electron/README.md new file mode 100644 index 00000000..623c6ed0 --- /dev/null +++ b/samples/hybrid/electron/README.md @@ -0,0 +1,5 @@ +# dbrjs-electron + +`yarn install` or `npm install` + +`yarn start` or `npm run start` diff --git a/samples/hybrid/electron/index.html b/samples/hybrid/electron/index.html new file mode 100644 index 00000000..86cc6ee9 --- /dev/null +++ b/samples/hybrid/electron/index.html @@ -0,0 +1,70 @@ + + + + + Hello World! + + + + + +

Welcome to DBRJS Electron sample

+ + Choose image(s) to decode: + +

+ + + + diff --git a/samples/hybrid/electron/index.js b/samples/hybrid/electron/index.js new file mode 100644 index 00000000..c2c94c22 --- /dev/null +++ b/samples/hybrid/electron/index.js @@ -0,0 +1,69 @@ +const { app, BrowserWindow } = require('electron'); +const { DBR, BarcodeReader } = require('dynamsoft-javascript-barcode'); + +function createWindow () { + // Create the browser window. + const win = new BrowserWindow({ + width: 800, + height: 600, + webPreferences: { + nodeIntegration: true // not import node api + } + }) + + // and load the index.html of the app. + win.loadFile('index.html') + + // Open the DevTools. + win.webContents.openDevTools() +} + +// This method will be called when Electron has finished +// initialization and is ready to create browser windows. +// Some APIs can only be used after this event occurs. +app.whenReady().then(createWindow) + +// Quit when all windows are closed. +app.on('window-all-closed', () => { + // On macOS it is common for applications and their menu bar + // to stay active until the user quits explicitly with Cmd + Q + if (process.platform !== 'darwin') { + app.quit() + } +}) + +app.on('activate', () => { + // On macOS it's common to re-create a window in the app when the + // dock icon is clicked and there are no other windows open. + if (BrowserWindow.getAllWindows().length === 0) { + createWindow() + } +}) + +// In this file you can include the rest of your app's specific main process +// code. You can also put them in separate files and require them here. + +// use dbrjs in node + +DBR.productKeys = "PRODUCT-KEYS"; + +// error! async can't be used on electron's main process?? +// (async()=>{ +// let reader = await BarcodeReader.createInstance(); +// let results = await reader.decode("../../sample.png"); +// for(let result of results){ +// console.log(result.barcodeText); +// } +// reader.destroy(); +// })(); + +let reader = null; +BarcodeReader.createInstance().then(r=>{ + reader = r; + return reader.decode("../../sample.png"); +}).then(results=>{ + for(let result of results){ + console.log(result.barcodeText); + } + reader.destroy(); +}); diff --git a/samples/hybrid/electron/package.json b/samples/hybrid/electron/package.json new file mode 100644 index 00000000..67295310 --- /dev/null +++ b/samples/hybrid/electron/package.json @@ -0,0 +1,14 @@ +{ + "name": "dbrjs-electron", + "version": "1.0.0", + "main": "index.js", + "scripts": { + "start": "electron ." + }, + "license": "MIT", + "devDependencies": {}, + "dependencies": { + "dynamsoft-javascript-barcode": "8.6.0", + "electron": "^8.1.1" + } +} diff --git a/samples/hybrid/nwjs/.gitignore b/samples/hybrid/nwjs/.gitignore new file mode 100644 index 00000000..5add9449 --- /dev/null +++ b/samples/hybrid/nwjs/.gitignore @@ -0,0 +1,2 @@ +/node_modules +/yarn.lock diff --git a/samples/hybrid/nwjs/README.md b/samples/hybrid/nwjs/README.md new file mode 100644 index 00000000..5bf9f502 --- /dev/null +++ b/samples/hybrid/nwjs/README.md @@ -0,0 +1,13 @@ +# dbrjs-nwjs + +Download NW.js SDK from https://nwjs.io/. + +cd `/path/to/your/app` + +`yarn install` or `npm install` + +`path/to/nw .` to run app. + +`/path/to/nw` is the binary file of NW.js. On Windows, it’s `nw.exe`; On Linux, it’s `nw`; On Mac, it’s `nwjs.app/Contents/MacOS/nwjs`. + +https://nwjs.readthedocs.io/en/latest/For%20Users/Getting%20Started/ diff --git a/samples/hybrid/nwjs/index.html b/samples/hybrid/nwjs/index.html new file mode 100644 index 00000000..e1da6934 --- /dev/null +++ b/samples/hybrid/nwjs/index.html @@ -0,0 +1,68 @@ + + + + + Hello World! + + + + + +

Welcome to DBRJS NW.js sample

+ + Choose image(s) to decode: + +

+ + + + + diff --git a/samples/hybrid/nwjs/package.json b/samples/hybrid/nwjs/package.json new file mode 100644 index 00000000..76381aa9 --- /dev/null +++ b/samples/hybrid/nwjs/package.json @@ -0,0 +1,13 @@ +{ + "name": "dbrjs-nwjs", + "version": "1.0.0", + "main": "index.html", + "scripts": { + "start": "nw ." + }, + "license": "MIT", + "devDependencies": {}, + "dependencies": { + "dynamsoft-javascript-barcode": "8.6.0" + } +} diff --git a/samples/node/helloworld.js b/samples/node/helloworld.js new file mode 100644 index 00000000..e427c466 --- /dev/null +++ b/samples/node/helloworld.js @@ -0,0 +1,37 @@ +let { DBR, BarcodeReader } = require('../../dist/dbr.js'); +// Please visit https://www.dynamsoft.com/customer/license/trialLicense?product=dbr&package=js&utm_source=github to get trial license. +// If you use nodejs below version 15, please contact support@dynamsoft.com for a offline trial key of nodejs. +DBR.productKeys = 'PRODUCT-KEYS'; + +(async()=>{ + console.log("============== create reader =============="); + let reader = await BarcodeReader.createInstance(); + console.log("============== decode buffer =============="); + let fs = require('fs'); + let buffer = fs.readFileSync(__dirname + '/../sample.png'); + for(let result of await reader.decode(buffer)){ + console.log(result.barcodeText); + } + console.log("============== decode base64 =============="); + let strBase64 = buffer.toString('base64'); + for(let result of await reader.decodeBase64String(strBase64)){ + console.log(result.barcodeText); + } + console.log("============== decode file =============="); + for(let result of await reader.decode(__dirname + '/../sample.png')){ + console.log(result.barcodeText); + } + console.log("============== decode url =============="); + for(let result of await reader.decode('https://demo.dynamsoft.com/barcode-reader/img/AllSupportedBarcodeTypes.png')){ + console.log(result.barcodeText); + } + console.log("============== destroy reader =============="); + await reader.destroy(); + + // Since the worker keep alive, you can call + await DBR._dbrWorker.terminate(); + // when you need to exit this process. + // Or call + process.exit(); + // directly. +})(); diff --git a/samples/node/helloworld.mjs b/samples/node/helloworld.mjs new file mode 100644 index 00000000..023d088a --- /dev/null +++ b/samples/node/helloworld.mjs @@ -0,0 +1,38 @@ +import { DBR, BarcodeReader } from '../../dist/dbr.js'; +import url from 'url' +import fs from 'fs' +// Please visit https://www.dynamsoft.com/customer/license/trialLicense?product=dbr&package=js&utm_source=github to get trial license. +// If you use nodejs below version 15, please contact support@dynamsoft.com for a offline trial key of nodejs. +DBR.productKeys = 'PRODUCT-KEYS'; + +(async()=>{ + console.log("============== create reader =============="); + let reader = await BarcodeReader.createInstance(); + console.log("============== decode buffer =============="); + let buffer = fs.readFileSync(new URL('../sample.png', import.meta.url)); + for(let result of await reader.decode(buffer)){ + console.log(result.barcodeText); + } + console.log("============== decode base64 =============="); + let strBase64 = buffer.toString('base64'); + for(let result of await reader.decodeBase64String(strBase64)){ + console.log(result.barcodeText); + } + console.log("============== decode file =============="); + for(let result of await reader.decode(url.fileURLToPath(new URL('../sample.png', import.meta.url)))){ + console.log(result.barcodeText); + } + console.log("============== decode url =============="); + for(let result of await reader.decode('https://demo.dynamsoft.com/barcode-reader/img/AllSupportedBarcodeTypes.png')){ + console.log(result.barcodeText); + } + console.log("============== destroy reader =============="); + await reader.destroy(); + + // Since the worker keep alive, you can call + await DBR._dbrWorker.terminate(); + // when you need to exit this process. + // Or call + process.exit(); + // directly. +})(); diff --git a/samples/sample-full.png b/samples/sample-full.png new file mode 100644 index 00000000..441a5cef Binary files /dev/null and b/samples/sample-full.png differ diff --git a/samples/sample.png b/samples/sample.png new file mode 100644 index 00000000..02e40f56 Binary files /dev/null and b/samples/sample.png differ diff --git a/samples/web/angular/.editorconfig b/samples/web/angular/.editorconfig new file mode 100644 index 00000000..59d9a3a3 --- /dev/null +++ b/samples/web/angular/.editorconfig @@ -0,0 +1,16 @@ +# Editor configuration, see https://editorconfig.org +root = true + +[*] +charset = utf-8 +indent_style = space +indent_size = 2 +insert_final_newline = true +trim_trailing_whitespace = true + +[*.ts] +quote_type = single + +[*.md] +max_line_length = off +trim_trailing_whitespace = false diff --git a/samples/web/angular/.gitignore b/samples/web/angular/.gitignore new file mode 100644 index 00000000..de51f68a --- /dev/null +++ b/samples/web/angular/.gitignore @@ -0,0 +1,45 @@ +# See http://help.github.com/ignore-files/ for more about ignoring files. + +# compiled output +/dist +/tmp +/out-tsc +# Only exists if Bazel was run +/bazel-out + +# dependencies +/node_modules + +# profiling files +chrome-profiler-events*.json + +# IDEs and editors +/.idea +.project +.classpath +.c9/ +*.launch +.settings/ +*.sublime-workspace + +# IDE - VSCode +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +.history/* + +# misc +/.sass-cache +/connect.lock +/coverage +/libpeerconnection.log +npm-debug.log +yarn-error.log +testem.log +/typings + +# System Files +.DS_Store +Thumbs.db diff --git a/samples/web/angular/README.md b/samples/web/angular/README.md new file mode 100644 index 00000000..99af32a1 --- /dev/null +++ b/samples/web/angular/README.md @@ -0,0 +1,27 @@ +# DbrjsAngular + +This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 12.0.0. + +## Development server + +Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files. + +## Code scaffolding + +Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`. + +## Build + +Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build. + +## Running unit tests + +Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io). + +## Running end-to-end tests + +Run `ng e2e` to execute the end-to-end tests via a platform of your choice. + +## Further help + +To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page. diff --git a/samples/web/angular/angular.json b/samples/web/angular/angular.json new file mode 100644 index 00000000..bad5afdc --- /dev/null +++ b/samples/web/angular/angular.json @@ -0,0 +1,106 @@ +{ + "$schema": "./node_modules/@angular/cli/lib/config/schema.json", + "version": 1, + "newProjectRoot": "projects", + "projects": { + "dbrjs-angular": { + "projectType": "application", + "schematics": { + "@schematics/angular:application": { + "strict": true + } + }, + "root": "", + "sourceRoot": "src", + "prefix": "app", + "architect": { + "build": { + "builder": "@angular-devkit/build-angular:browser", + "options": { + "outputPath": "dist/dbrjs-angular", + "index": "src/index.html", + "main": "src/main.ts", + "polyfills": "src/polyfills.ts", + "tsConfig": "tsconfig.app.json", + "assets": [ + "src/favicon.ico", + "src/assets" + ], + "styles": [ + "src/styles.css" + ], + "scripts": [] + }, + "configurations": { + "production": { + "budgets": [ + { + "type": "initial", + "maximumWarning": "500kb", + "maximumError": "1mb" + }, + { + "type": "anyComponentStyle", + "maximumWarning": "2kb", + "maximumError": "4kb" + } + ], + "fileReplacements": [ + { + "replace": "src/environments/environment.ts", + "with": "src/environments/environment.prod.ts" + } + ], + "outputHashing": "all" + }, + "development": { + "buildOptimizer": false, + "optimization": false, + "vendorChunk": true, + "extractLicenses": false, + "sourceMap": true, + "namedChunks": true + } + }, + "defaultConfiguration": "production" + }, + "serve": { + "builder": "@angular-devkit/build-angular:dev-server", + "configurations": { + "production": { + "browserTarget": "dbrjs-angular:build:production" + }, + "development": { + "browserTarget": "dbrjs-angular:build:development" + } + }, + "defaultConfiguration": "development" + }, + "extract-i18n": { + "builder": "@angular-devkit/build-angular:extract-i18n", + "options": { + "browserTarget": "dbrjs-angular:build" + } + }, + "test": { + "builder": "@angular-devkit/build-angular:karma", + "options": { + "main": "src/test.ts", + "polyfills": "src/polyfills.ts", + "tsConfig": "tsconfig.spec.json", + "karmaConfig": "karma.conf.js", + "assets": [ + "src/favicon.ico", + "src/assets" + ], + "styles": [ + "src/styles.css" + ], + "scripts": [] + } + } + } + } + }, + "defaultProject": "dbrjs-angular" +} diff --git a/samples/web/angular/karma.conf.js b/samples/web/angular/karma.conf.js new file mode 100644 index 00000000..e29cf7d3 --- /dev/null +++ b/samples/web/angular/karma.conf.js @@ -0,0 +1,44 @@ +// Karma configuration file, see link for more information +// https://karma-runner.github.io/1.0/config/configuration-file.html + +module.exports = function (config) { + config.set({ + basePath: '', + frameworks: ['jasmine', '@angular-devkit/build-angular'], + plugins: [ + require('karma-jasmine'), + require('karma-chrome-launcher'), + require('karma-jasmine-html-reporter'), + require('karma-coverage'), + require('@angular-devkit/build-angular/plugins/karma') + ], + client: { + jasmine: { + // you can add configuration options for Jasmine here + // the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html + // for example, you can disable the random execution with `random: false` + // or set a specific seed with `seed: 4321` + }, + clearContext: false // leave Jasmine Spec Runner output visible in browser + }, + jasmineHtmlReporter: { + suppressAll: true // removes the duplicated traces + }, + coverageReporter: { + dir: require('path').join(__dirname, './coverage/dbrjs-angular'), + subdir: '.', + reporters: [ + { type: 'html' }, + { type: 'text-summary' } + ] + }, + reporters: ['progress', 'kjhtml'], + port: 9876, + colors: true, + logLevel: config.LOG_INFO, + autoWatch: true, + browsers: ['Chrome'], + singleRun: false, + restartOnFileChange: true + }); +}; diff --git a/samples/web/angular/package.json b/samples/web/angular/package.json new file mode 100644 index 00000000..fa2f7663 --- /dev/null +++ b/samples/web/angular/package.json @@ -0,0 +1,40 @@ +{ + "name": "dbrjs-angular", + "version": "0.0.0", + "scripts": { + "ng": "ng", + "start": "ng serve", + "build": "ng build", + "watch": "ng build --watch --configuration development", + "test": "ng test" + }, + "private": true, + "dependencies": { + "@angular/animations": "~12.0.0", + "@angular/common": "~12.0.0", + "@angular/compiler": "~12.0.0", + "@angular/core": "~12.0.0", + "@angular/forms": "~12.0.0", + "@angular/platform-browser": "~12.0.0", + "@angular/platform-browser-dynamic": "~12.0.0", + "@angular/router": "~12.0.0", + "dynamsoft-javascript-barcode": "8.6.0", + "rxjs": "~6.6.0", + "tslib": "^2.1.0", + "zone.js": "~0.11.4" + }, + "devDependencies": { + "@angular-devkit/build-angular": "~12.0.0", + "@angular/cli": "~12.0.0", + "@angular/compiler-cli": "~12.0.0", + "@types/jasmine": "~3.6.0", + "@types/node": "^12.11.1", + "jasmine-core": "~3.7.0", + "karma": "~6.3.0", + "karma-chrome-launcher": "~3.1.0", + "karma-coverage": "~2.0.3", + "karma-jasmine": "~4.0.0", + "karma-jasmine-html-reporter": "^1.5.0", + "typescript": "~4.2.3" + } +} diff --git a/samples/web/angular/src/app/app.component.css b/samples/web/angular/src/app/app.component.css new file mode 100644 index 00000000..e69de29b diff --git a/samples/web/angular/src/app/app.component.html b/samples/web/angular/src/app/app.component.html new file mode 100644 index 00000000..3b9dba53 --- /dev/null +++ b/samples/web/angular/src/app/app.component.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/samples/web/angular/src/app/app.component.spec.ts b/samples/web/angular/src/app/app.component.spec.ts new file mode 100644 index 00000000..27a94483 --- /dev/null +++ b/samples/web/angular/src/app/app.component.spec.ts @@ -0,0 +1,18 @@ +import { TestBed } from '@angular/core/testing'; +import { AppComponent } from './app.component'; + +describe('AppComponent', () => { + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ + AppComponent + ], + }).compileComponents(); + }); + + it('should create the app', () => { + const fixture = TestBed.createComponent(AppComponent); + const app = fixture.componentInstance; + expect(app).toBeTruthy(); + }); +}); diff --git a/samples/web/angular/src/app/app.component.ts b/samples/web/angular/src/app/app.component.ts new file mode 100644 index 00000000..7c2c757a --- /dev/null +++ b/samples/web/angular/src/app/app.component.ts @@ -0,0 +1,10 @@ +import { Component } from '@angular/core'; + +@Component({ + selector: 'app-root', + templateUrl: './app.component.html', + styleUrls: ['./app.component.css'] +}) +export class AppComponent { + title = 'dbrjs-angular'; +} diff --git a/samples/web/angular/src/app/app.module.ts b/samples/web/angular/src/app/app.module.ts new file mode 100644 index 00000000..c585fd2c --- /dev/null +++ b/samples/web/angular/src/app/app.module.ts @@ -0,0 +1,20 @@ +import { NgModule } from '@angular/core'; +import { BrowserModule } from '@angular/platform-browser'; + +import { AppComponent } from './app.component'; +import { HelloWorldComponent } from './hello-world/hello-world.component'; +import { BarcodeScannerComponent } from './barcode-scanner/barcode-scanner.component'; + +@NgModule({ + declarations: [ + AppComponent, + HelloWorldComponent, + BarcodeScannerComponent + ], + imports: [ + BrowserModule + ], + providers: [], + bootstrap: [AppComponent] +}) +export class AppModule { } diff --git a/samples/web/angular/src/app/barcode-scanner/barcode-scanner.component.html b/samples/web/angular/src/app/barcode-scanner/barcode-scanner.component.html new file mode 100644 index 00000000..8e2f1d61 --- /dev/null +++ b/samples/web/angular/src/app/barcode-scanner/barcode-scanner.component.html @@ -0,0 +1,4 @@ + + +
+ diff --git a/samples/web/angular/src/app/barcode-scanner/barcode-scanner.component.spec.ts b/samples/web/angular/src/app/barcode-scanner/barcode-scanner.component.spec.ts new file mode 100644 index 00000000..00041ffd --- /dev/null +++ b/samples/web/angular/src/app/barcode-scanner/barcode-scanner.component.spec.ts @@ -0,0 +1,25 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { BarcodeScannerComponent } from './barcode-scanner.component'; + +describe('BarcodeScannerComponent', () => { + let component: BarcodeScannerComponent; + let fixture: ComponentFixture; + + beforeEach(() => { + TestBed.configureTestingModule({ + declarations: [ BarcodeScannerComponent ] + }) + .compileComponents(); + }); + + beforeEach(() => { + fixture = TestBed.createComponent(BarcodeScannerComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/samples/web/angular/src/app/barcode-scanner/barcode-scanner.component.ts b/samples/web/angular/src/app/barcode-scanner/barcode-scanner.component.ts new file mode 100644 index 00000000..c83449de --- /dev/null +++ b/samples/web/angular/src/app/barcode-scanner/barcode-scanner.component.ts @@ -0,0 +1,47 @@ +import { Component, OnInit, OnDestroy, Output, EventEmitter, ElementRef} from '@angular/core'; +import "../dbr"; +import { BarcodeScanner, TextResult } from 'dynamsoft-javascript-barcode'; + +@Component({ + selector: 'app-barcode-scanner', + templateUrl: './barcode-scanner.component.html', + styleUrls: [] +}) +export class BarcodeScannerComponent implements OnInit, OnDestroy { + bDestroyed = false; + pScanner:Promise|null = null; + @Output() appendMessage = new EventEmitter(); + constructor(private elementRef : ElementRef) { } + + async ngOnInit() { + try{ + let scanner = await (this.pScanner = this.pScanner || BarcodeScanner.createInstance()); + + if(this.bDestroyed){ + scanner.destroy(); + return; + } + + scanner.setUIElement(this.elementRef.nativeElement); + scanner.onFrameRead = (results:TextResult[]) => { + if(results.length){ + console.log(results); + } + }; + scanner.onUnduplicatedRead = (txt:string, result:TextResult) => { + this.appendMessage.emit(result.barcodeFormatString + ': ' + txt); + }; + await scanner.open(); + + }catch(ex){ + this.appendMessage.emit(ex.message); + console.error(ex); + } + } + async ngOnDestroy(){ + this.bDestroyed = true; + if(this.pScanner){ + (await this.pScanner).destroy(); + } + } +} diff --git a/samples/web/angular/src/app/dbr.ts b/samples/web/angular/src/app/dbr.ts new file mode 100644 index 00000000..8baf4d12 --- /dev/null +++ b/samples/web/angular/src/app/dbr.ts @@ -0,0 +1,5 @@ +import DBR from "dynamsoft-javascript-barcode"; +DBR.engineResourcePath = "https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@8.6.0/dist/"; +// Please visit https://www.dynamsoft.com/customer/license/trialLicense?product=dbr&package=js&utm_source=github to get a trial license +DBR.productKeys = "PRODUCT-KEYS"; +// BarcodeReader._bUseFullFeature = true; // Control of loading min wasm or full wasm. diff --git a/samples/web/angular/src/app/hello-world/hello-world.component.html b/samples/web/angular/src/app/hello-world/hello-world.component.html new file mode 100644 index 00000000..afb8742d --- /dev/null +++ b/samples/web/angular/src/app/hello-world/hello-world.component.html @@ -0,0 +1,20 @@ + +

{{ title }}

+ +
+ Choose image(s) to decode: + +

+ +
+ +
+ + +
+ +
+

+ {{ message }} +

+
diff --git a/samples/web/angular/src/app/hello-world/hello-world.component.spec.ts b/samples/web/angular/src/app/hello-world/hello-world.component.spec.ts new file mode 100644 index 00000000..6b473e14 --- /dev/null +++ b/samples/web/angular/src/app/hello-world/hello-world.component.spec.ts @@ -0,0 +1,25 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { HelloWorldComponent } from './hello-world.component'; + +describe('HelloWorldComponent', () => { + let component: HelloWorldComponent; + let fixture: ComponentFixture; + + beforeEach(async() => { + TestBed.configureTestingModule({ + declarations: [ HelloWorldComponent ] + }) + .compileComponents(); + }); + + beforeEach(() => { + fixture = TestBed.createComponent(HelloWorldComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/samples/web/angular/src/app/hello-world/hello-world.component.ts b/samples/web/angular/src/app/hello-world/hello-world.component.ts new file mode 100644 index 00000000..7f6125f3 --- /dev/null +++ b/samples/web/angular/src/app/hello-world/hello-world.component.ts @@ -0,0 +1,72 @@ +import { Component, Input, ElementRef, ViewChild, AfterViewChecked, OnDestroy } from '@angular/core'; +import "../dbr"; +import { BarcodeReader } from 'dynamsoft-javascript-barcode'; + +@Component({ + selector: 'app-hello-world', + templateUrl: './hello-world.component.html', + styleUrls: [] +}) +export class HelloWorldComponent implements AfterViewChecked, OnDestroy { + + @Input() title:string = null as any as string; + @ViewChild('divMessage', {static: false}) divMessage: ElementRef = null as any as ElementRef; + + pReader:Promise|null = null; + messageKeyBase = 0; + messages:string[] = []; + needMessage2Bottom = false; + bShowScanner = false; + + constructor() { } + + ngAfterViewChecked(){ + if(this.needMessage2Bottom){ + this.needMessage2Bottom = false; + this.divMessage.nativeElement.scrollTop = this.divMessage.nativeElement.scrollHeight; + } + } + + async ngOnDestroy(){ + if(this.pReader){ + (await this.pReader).destroy(); + } + } + + appendMessage(str:string){ + this.messages.push(str); + if(this.messages.length > 500){ + ++this.messageKeyBase; + this.messages.splice(0, 1); + } + this.needMessage2Bottom = true; + } + async onIptChange(event:Event) { + try{ + this.appendMessage("======== start read... ========"); + let reader = await (this.pReader = this.pReader || BarcodeReader.createInstance()); + let input = event.target as HTMLInputElement; + let files = input.files as FileList; + for(let i = 0; i < files.length; ++i){ + let file = files[i]; + this.appendMessage(file.name + ':'); + let results = await reader.decode(file); + for(let result of results){ + this.appendMessage(result.barcodeText); + } + } + input.value = ""; + this.appendMessage("======== finish read ========"); + }catch(ex){ + this.appendMessage(ex.message); + console.error(ex); + } + } + showScanner(){ + this.bShowScanner = true; + } + hideScanner(){ + this.bShowScanner = false; + } + +} diff --git a/samples/web/angular/src/assets/.gitkeep b/samples/web/angular/src/assets/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/samples/web/angular/src/environments/environment.prod.ts b/samples/web/angular/src/environments/environment.prod.ts new file mode 100644 index 00000000..3612073b --- /dev/null +++ b/samples/web/angular/src/environments/environment.prod.ts @@ -0,0 +1,3 @@ +export const environment = { + production: true +}; diff --git a/samples/web/angular/src/environments/environment.ts b/samples/web/angular/src/environments/environment.ts new file mode 100644 index 00000000..f56ff470 --- /dev/null +++ b/samples/web/angular/src/environments/environment.ts @@ -0,0 +1,16 @@ +// This file can be replaced during build by using the `fileReplacements` array. +// `ng build` replaces `environment.ts` with `environment.prod.ts`. +// The list of file replacements can be found in `angular.json`. + +export const environment = { + production: false +}; + +/* + * For easier debugging in development mode, you can import the following file + * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`. + * + * This import should be commented out in production mode because it will have a negative impact + * on performance if an error is thrown. + */ +// import 'zone.js/plugins/zone-error'; // Included with Angular CLI. diff --git a/samples/web/angular/src/favicon.ico b/samples/web/angular/src/favicon.ico new file mode 100644 index 00000000..997406ad Binary files /dev/null and b/samples/web/angular/src/favicon.ico differ diff --git a/samples/web/angular/src/index.html b/samples/web/angular/src/index.html new file mode 100644 index 00000000..67182cb0 --- /dev/null +++ b/samples/web/angular/src/index.html @@ -0,0 +1,13 @@ + + + + + DbrjsAngular + + + + + + + + diff --git a/samples/web/angular/src/main.ts b/samples/web/angular/src/main.ts new file mode 100644 index 00000000..c7b673cf --- /dev/null +++ b/samples/web/angular/src/main.ts @@ -0,0 +1,12 @@ +import { enableProdMode } from '@angular/core'; +import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; + +import { AppModule } from './app/app.module'; +import { environment } from './environments/environment'; + +if (environment.production) { + enableProdMode(); +} + +platformBrowserDynamic().bootstrapModule(AppModule) + .catch(err => console.error(err)); diff --git a/samples/web/angular/src/polyfills.ts b/samples/web/angular/src/polyfills.ts new file mode 100644 index 00000000..373f538a --- /dev/null +++ b/samples/web/angular/src/polyfills.ts @@ -0,0 +1,65 @@ +/** + * This file includes polyfills needed by Angular and is loaded before the app. + * You can add your own extra polyfills to this file. + * + * This file is divided into 2 sections: + * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers. + * 2. Application imports. Files imported after ZoneJS that should be loaded before your main + * file. + * + * The current setup is for so-called "evergreen" browsers; the last versions of browsers that + * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera), + * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile. + * + * Learn more in https://angular.io/guide/browser-support + */ + +/*************************************************************************************************** + * BROWSER POLYFILLS + */ + +/** + * IE11 requires the following for NgClass support on SVG elements + */ +// import 'classlist.js'; // Run `npm install --save classlist.js`. + +/** + * Web Animations `@angular/platform-browser/animations` + * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari. + * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0). + */ +// import 'web-animations-js'; // Run `npm install --save web-animations-js`. + +/** + * By default, zone.js will patch all possible macroTask and DomEvents + * user can disable parts of macroTask/DomEvents patch by setting following flags + * because those flags need to be set before `zone.js` being loaded, and webpack + * will put import in the top of bundle, so user need to create a separate file + * in this directory (for example: zone-flags.ts), and put the following flags + * into that file, and then add the following code before importing zone.js. + * import './zone-flags'; + * + * The flags allowed in zone-flags.ts are listed here. + * + * The following flags will work for all browsers. + * + * (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame + * (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick + * (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames + * + * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js + * with the following flag, it will bypass `zone.js` patch for IE/Edge + * + * (window as any).__Zone_enable_cross_context_check = true; + * + */ + +/*************************************************************************************************** + * Zone JS is required by default for Angular itself. + */ +import 'zone.js'; // Included with Angular CLI. + + +/*************************************************************************************************** + * APPLICATION IMPORTS + */ diff --git a/samples/web/angular/src/styles.css b/samples/web/angular/src/styles.css new file mode 100644 index 00000000..90d4ee00 --- /dev/null +++ b/samples/web/angular/src/styles.css @@ -0,0 +1 @@ +/* You can add global styles to this file, and also import other style files */ diff --git a/samples/web/angular/src/test.ts b/samples/web/angular/src/test.ts new file mode 100644 index 00000000..20423564 --- /dev/null +++ b/samples/web/angular/src/test.ts @@ -0,0 +1,25 @@ +// This file is required by karma.conf.js and loads recursively all the .spec and framework files + +import 'zone.js/testing'; +import { getTestBed } from '@angular/core/testing'; +import { + BrowserDynamicTestingModule, + platformBrowserDynamicTesting +} from '@angular/platform-browser-dynamic/testing'; + +declare const require: { + context(path: string, deep?: boolean, filter?: RegExp): { + keys(): string[]; + (id: string): T; + }; +}; + +// First, initialize the Angular testing environment. +getTestBed().initTestEnvironment( + BrowserDynamicTestingModule, + platformBrowserDynamicTesting() +); +// Then we find all the tests. +const context = require.context('./', true, /\.spec\.ts$/); +// And load the modules. +context.keys().map(context); diff --git a/samples/web/angular/tsconfig.app.json b/samples/web/angular/tsconfig.app.json new file mode 100644 index 00000000..82d91dc4 --- /dev/null +++ b/samples/web/angular/tsconfig.app.json @@ -0,0 +1,15 @@ +/* To learn more about this file see: https://angular.io/config/tsconfig. */ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "./out-tsc/app", + "types": [] + }, + "files": [ + "src/main.ts", + "src/polyfills.ts" + ], + "include": [ + "src/**/*.d.ts" + ] +} diff --git a/samples/web/angular/tsconfig.json b/samples/web/angular/tsconfig.json new file mode 100644 index 00000000..6df82832 --- /dev/null +++ b/samples/web/angular/tsconfig.json @@ -0,0 +1,30 @@ +/* To learn more about this file see: https://angular.io/config/tsconfig. */ +{ + "compileOnSave": false, + "compilerOptions": { + "baseUrl": "./", + "outDir": "./dist/out-tsc", + "forceConsistentCasingInFileNames": true, + "strict": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true, + "sourceMap": true, + "declaration": false, + "downlevelIteration": true, + "experimentalDecorators": true, + "moduleResolution": "node", + "importHelpers": true, + "target": "es2017", + "module": "es2020", + "lib": [ + "es2018", + "dom" + ] + }, + "angularCompilerOptions": { + "enableI18nLegacyMessageIdFormat": false, + "strictInjectionParameters": true, + "strictInputAccessModifiers": true, + "strictTemplates": true + } +} diff --git a/samples/web/angular/tsconfig.spec.json b/samples/web/angular/tsconfig.spec.json new file mode 100644 index 00000000..092345b0 --- /dev/null +++ b/samples/web/angular/tsconfig.spec.json @@ -0,0 +1,18 @@ +/* To learn more about this file see: https://angular.io/config/tsconfig. */ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "./out-tsc/spec", + "types": [ + "jasmine" + ] + }, + "files": [ + "src/test.ts", + "src/polyfills.ts" + ], + "include": [ + "src/**/*.spec.ts", + "src/**/*.d.ts" + ] +} diff --git a/samples/web/angular/tslint.json b/samples/web/angular/tslint.json new file mode 100644 index 00000000..c8d70f15 --- /dev/null +++ b/samples/web/angular/tslint.json @@ -0,0 +1,91 @@ +{ + "extends": "tslint:recommended", + "rules": { + "array-type": false, + "arrow-parens": false, + "deprecation": { + "severity": "warning" + }, + "component-class-suffix": true, + "contextual-lifecycle": true, + "directive-class-suffix": true, + "directive-selector": [ + true, + "attribute", + "app", + "camelCase" + ], + "component-selector": [ + true, + "element", + "app", + "kebab-case" + ], + "import-blacklist": [ + true, + "rxjs/Rx" + ], + "interface-name": false, + "max-classes-per-file": false, + "max-line-length": [ + true, + 140 + ], + "member-access": false, + "member-ordering": [ + true, + { + "order": [ + "static-field", + "instance-field", + "static-method", + "instance-method" + ] + } + ], + "no-consecutive-blank-lines": false, + "no-console": [ + true, + "debug", + "info", + "time", + "timeEnd", + "trace" + ], + "no-empty": false, + "no-inferrable-types": [ + true, + "ignore-params" + ], + "no-non-null-assertion": true, + "no-redundant-jsdoc": true, + "no-switch-case-fall-through": true, + "no-var-requires": false, + "object-literal-key-quotes": [ + true, + "as-needed" + ], + "object-literal-sort-keys": false, + "ordered-imports": false, + "quotemark": [ + true, + "single" + ], + "trailing-comma": false, + "no-conflicting-lifecycle": true, + "no-host-metadata-property": true, + "no-input-rename": true, + "no-inputs-metadata-property": true, + "no-output-native": true, + "no-output-on-prefix": true, + "no-output-rename": true, + "no-outputs-metadata-property": true, + "template-banana-in-box": true, + "template-no-negated-async": true, + "use-lifecycle-interface": true, + "use-pipe-transform-interface": true + }, + "rulesDirectory": [ + "codelyzer" + ] +} \ No newline at end of file diff --git a/samples/web/angularDart/.gitignore b/samples/web/angularDart/.gitignore new file mode 100644 index 00000000..39273b98 --- /dev/null +++ b/samples/web/angularDart/.gitignore @@ -0,0 +1,11 @@ +# Files and directories created by pub +.dart_tool +.packages +.pub/ +build/ +# Remove the following pattern if you wish to check in your lock file +pubspec.lock +# Directory created by dartdoc +doc/api/ +# See https://github.com/dart-lang/site-webdev/issues/1351 +test/**/*.g.dart diff --git a/samples/web/angularDart/LICENSE b/samples/web/angularDart/LICENSE new file mode 100644 index 00000000..94b25c9f --- /dev/null +++ b/samples/web/angularDart/LICENSE @@ -0,0 +1,21 @@ +The MIT License + +Copyright (c) 2014-2018 Google, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/samples/web/angularDart/README.md b/samples/web/angularDart/README.md new file mode 100644 index 00000000..16c8edf7 --- /dev/null +++ b/samples/web/angularDart/README.md @@ -0,0 +1,24 @@ +## Setup for Development + +Welcome to the sample app used in the +[Setup for Development](https://webdev.dartlang.org/angular/guide/setup) page +of [Dart for the web](https://webdev.dartlang.org). + +You can run a [hosted copy](https://webdev.dartlang.org/examples/quickstart) of this +sample. Or run your own copy: + +1. Create a local copy of this repo (use the "Clone or download" button above). +2. Get the dependencies: `pub get` +3. Get the webdev tool: `pub global activate webdev` +4. Launch a development server: `webdev serve` +5. In a browser, open [http://localhost:8080](http://localhost:8080) + +--- + +*Note:* The content of this repository is generated from the +[Angular docs repository][docs repo] by running the +[dart-doc-syncer](//github.com/dart-lang/dart-doc-syncer) tool. +If you find a problem with this sample's code, please open an [issue][]. + +[docs repo]: //github.com/dart-lang/site-webdev/tree/master/examples/ng/doc/quickstart +[issue]: //github.com/dart-lang/site-webdev/issues/new?title=[master]%20examples/ng/doc/quickstart diff --git a/samples/web/angularDart/analysis_options.yaml b/samples/web/angularDart/analysis_options.yaml new file mode 100644 index 00000000..057810cb --- /dev/null +++ b/samples/web/angularDart/analysis_options.yaml @@ -0,0 +1,19 @@ +analyzer: + exclude: [build/**] + errors: + uri_has_not_been_generated: ignore + plugins: + - angular + +# Lint rules and documentation, see http://dart-lang.github.io/linter/lints +linter: + rules: + - cancel_subscriptions + - hash_and_equals + - iterable_contains_unrelated_type + - list_remove_unrelated_type + - test_types_in_equals + - unnecessary_const + - unnecessary_new + - unrelated_type_equality_checks + - valid_regexps diff --git a/samples/web/angularDart/lib/app_component.dart b/samples/web/angularDart/lib/app_component.dart new file mode 100644 index 00000000..c07f8a2d --- /dev/null +++ b/samples/web/angularDart/lib/app_component.dart @@ -0,0 +1,81 @@ +import 'dart:js'; +import 'package:angular/angular.dart'; +import 'dart:html'; +import 'package:dbrjs_angulardart/dbr.dart'; +import 'package:js/js_util.dart'; + +@Component( + selector: 'my-app', + templateUrl: 'app_component.html', + directives: [coreDirectives] +) +class AppComponent implements OnInit { + bool bFinishDecodingSample = false; + BarcodeReader reader = null; + BarcodeScanner scanner = null; + + void ngOnInit() async { + // BarcodeReader._bUseFullFeature = true; // Control of loading min wasm or full wasm. + try{ + if(null == this.reader){ + this.reader = await promiseToFuture(BarcodeReader.createInstance()); + } + var results = (await promiseToFuture(this.reader.decode("qr.png")) as List); + var resultsToAlert = []; + resultsToAlert.add('Sample image:\n'); + for(var result in results){ + var txt = getProperty(result,"barcodeText"); + resultsToAlert.add(txt); + print(txt); + } + window.alert(resultsToAlert.join("\n")); + + }catch(ex){ + window.alert(ex.toString()); + window.console.error(ex); + } + this.bFinishDecodingSample = true; + } + + void onIptChange(Event ev) async { + var ipt = ev.target as InputElement; + if(null == this.reader){ + this.reader = await promiseToFuture(BarcodeReader.createInstance()); + } + try{ + var files = ipt.files; + var resultsToAlert = JsArray(); + for(var i = 0; i < files.length; ++i){ + var file = files[i]; + resultsToAlert.add(i.toString()+". "+file.name+":"); + var results = (await promiseToFuture(this.reader.decode(file)) as List); + window.console.log(results); + for(var result in results){ + var txt = getProperty(result,"barcodeText"); + resultsToAlert.add(txt); + } + } + window.alert(resultsToAlert.join('\n')); + }catch(ex){ + window.alert(ex.toString()); + window.console.error(ex); + } + ipt.value = ""; + } + + void showScanner() async { + try{ + if(null == this.scanner){ + this.scanner = await promiseToFuture(BarcodeScanner.createInstance()); + } + scanner.onFrameRead = (List results) => (results.length > 0 ? window.console.log(results) : null ); + scanner.onUnduplicatedRead = (String txt, JsObject result) => window.alert((getProperty(result,"barcodeFormatString") as String) + ': ' + txt); + scanner.show(); + }catch(ex){ + window.alert(ex.toString()); + throw ex; + } + } +} + + diff --git a/samples/web/angularDart/lib/app_component.html b/samples/web/angularDart/lib/app_component.html new file mode 100644 index 00000000..e04d38c8 --- /dev/null +++ b/samples/web/angularDart/lib/app_component.html @@ -0,0 +1,6 @@ +

Welcome to DBRJS AngularDart sample

+Choose image(s) to decode: + +

+ +

Running test: decode sample image...

diff --git a/samples/web/angularDart/lib/dbr.dart b/samples/web/angularDart/lib/dbr.dart new file mode 100644 index 00000000..eeb63543 --- /dev/null +++ b/samples/web/angularDart/lib/dbr.dart @@ -0,0 +1,27 @@ +@JS('Dynamsoft.DBR') +library Dynamsoft.DBR; + +import "package:js/js.dart"; + +// @JS() +// class Promise { +// // external Promise(void executor(void resolve(T result), Function reject)); +// external Promise then(Function(T result)); +// } + +@JS() +class BarcodeReader { + external static bool get _bUseFullFeature; + external static set _bUseFullFeature(bool v); + external static dynamic createInstance();//Promise + external dynamic decode(dynamic);//Promise + external dynamic decodeBase64String(dynamic);//Promise +} + +@JS() +class BarcodeScanner { + external static dynamic createInstance();//Promise + external set onFrameRead(dynamic v);//(dynamic results); + external set onUnduplicatedRead(dynamic v);//(String txt, dynamic result); + external dynamic show();//Promise +} diff --git a/samples/web/angularDart/pubspec.yaml b/samples/web/angularDart/pubspec.yaml new file mode 100644 index 00000000..c6ccd4a5 --- /dev/null +++ b/samples/web/angularDart/pubspec.yaml @@ -0,0 +1,17 @@ +name: dbrjs_angulardart +description: A web app that uses AngularDart +version: 0.0.1 + +environment: + sdk: '>=2.2.0 <3.0.0' + +dependencies: + angular: ^6.0.0-alpha + js: ^0.6.0 + +dev_dependencies: + angular_test: ^2.3.1 + build_runner: ^1.5.1 + build_test: ^0.10.8 + build_web_compilers: ^2.1.0 + test: ^1.6.4 diff --git a/samples/web/angularDart/test/app_test.dart b/samples/web/angularDart/test/app_test.dart new file mode 100644 index 00000000..70a021e8 --- /dev/null +++ b/samples/web/angularDart/test/app_test.dart @@ -0,0 +1,22 @@ +@TestOn('browser') + +import 'package:dbrjs_angulardart/app_component.dart'; +import 'package:dbrjs_angulardart/app_component.template.dart' as ng; +import 'package:angular_test/angular_test.dart'; +import 'package:test/test.dart'; + +void main() { + final testBed = + NgTestBed.forComponent(ng.AppComponentNgFactory); + NgTestFixture fixture; + + setUp(() async { + fixture = await testBed.create(); + }); + + tearDown(disposeAnyRunningTest); + + test('Default greeting', () { + expect(fixture.text, 'Welcome to DBRJS AngularDart sample'); + }); +} diff --git a/samples/web/angularDart/web/favicon.png b/samples/web/angularDart/web/favicon.png new file mode 100644 index 00000000..dd18702e Binary files /dev/null and b/samples/web/angularDart/web/favicon.png differ diff --git a/samples/web/angularDart/web/index.html b/samples/web/angularDart/web/index.html new file mode 100644 index 00000000..5a9dd241 --- /dev/null +++ b/samples/web/angularDart/web/index.html @@ -0,0 +1,30 @@ + + + + + + + Hello Dbrjs Angular + + + + + + + + + + + + + Loading... + + + diff --git a/samples/web/angularDart/web/main.dart b/samples/web/angularDart/web/main.dart new file mode 100644 index 00000000..16fce790 --- /dev/null +++ b/samples/web/angularDart/web/main.dart @@ -0,0 +1,6 @@ +import 'package:angular/angular.dart'; +import 'package:dbrjs_angulardart/app_component.template.dart' as ng; + +void main() { + runApp(ng.AppComponentNgFactory); +} diff --git a/samples/web/angularDart/web/qr.png b/samples/web/angularDart/web/qr.png new file mode 100644 index 00000000..dbc04cd3 Binary files /dev/null and b/samples/web/angularDart/web/qr.png differ diff --git a/samples/web/angularDart/web/styles.css b/samples/web/angularDart/web/styles.css new file mode 100644 index 00000000..ef7a1860 --- /dev/null +++ b/samples/web/angularDart/web/styles.css @@ -0,0 +1,117 @@ +@import url(https://fonts.googleapis.com/css?family=Roboto); +@import url(https://fonts.googleapis.com/css?family=Material+Icons); + +/* Master Styles */ +h1 { + color: #369; + font-family: Arial, Helvetica, sans-serif; + font-size: 250%; +} +h2, h3 { + color: #444; + font-family: Arial, Helvetica, sans-serif; + font-weight: lighter; +} +body { + margin: 2em; +} +body, input[text], button { + color: #888; + font-family: Cambria, Georgia; +} +a { + cursor: pointer; + cursor: hand; +} +button { + font-family: Arial; + background-color: #eee; + border: none; + padding: 5px 10px; + border-radius: 4px; + cursor: pointer; + cursor: hand; +} +button:hover { + background-color: #cfd8dc; +} +button:disabled { + background-color: #eee; + color: #aaa; + cursor: auto; +} +label { + padding-right: 0.5em; +} +/* Navigation link styles */ +nav a { + padding: 5px 10px; + text-decoration: none; + margin-right: 10px; + margin-top: 10px; + display: inline-block; + background-color: #eee; + border-radius: 4px; +} +nav a:visited, a:link { + color: #607D8B; +} +nav a:hover { + color: #039be5; + background-color: #CFD8DC; +} +nav a.active { + color: #039be5; +} + +/* items class */ +.items { + margin: 0 0 2em 0; + list-style-type: none; + padding: 0; + width: 24em; +} +.items li { + cursor: pointer; + position: relative; + left: 0; + background-color: #EEE; + margin: .5em; + padding: .3em 0; + height: 1.6em; + border-radius: 4px; +} +.items li:hover { + color: #607D8B; + background-color: #DDD; + left: .1em; +} +.items li.selected { + background-color: #CFD8DC; + color: white; +} +.items li.selected:hover { + background-color: #BBD8DC; +} +.items .text { + position: relative; + top: -3px; +} +.items .badge { + display: inline-block; + font-size: small; + color: white; + padding: 0.8em 0.7em 0 0.7em; + background-color: #607D8B; + line-height: 1em; + position: relative; + left: -1px; + top: -4px; + height: 1.8em; + margin-right: .8em; + border-radius: 4px 0 0 4px; +} +/* everywhere else */ +* { + font-family: Arial, Helvetica, sans-serif; +} diff --git a/samples/web/debug/.gitignore b/samples/web/debug/.gitignore new file mode 100644 index 00000000..8e3027a8 --- /dev/null +++ b/samples/web/debug/.gitignore @@ -0,0 +1 @@ +/public/collect/* \ No newline at end of file diff --git a/samples/web/debug/README.md b/samples/web/debug/README.md new file mode 100644 index 00000000..3d24fae7 --- /dev/null +++ b/samples/web/debug/README.md @@ -0,0 +1,11 @@ +The sample is for debug camera and video on mobile browser. + +To collect image you need a server. + +Here we use nodejs express. + +`npm install` + +`node app.js` + +Quick Debug: https://dynamsoft.github.io/javascript-barcode/samples/web/debug/public/index.html diff --git a/samples/web/debug/app.js b/samples/web/debug/app.js new file mode 100644 index 00000000..bd09d818 --- /dev/null +++ b/samples/web/debug/app.js @@ -0,0 +1,43 @@ +const express = require('express'); +const fs = require('fs'); +const https = require('https'); +const cors = require('cors'); +const util = require('util'); +const path = require('path'); +const multer = require('multer'); + +const app = express(); +// Access-Control-Allow-Origin: **any** +app.use(cors({ + origin: (origin, callback) => { + return callback(null, true); + } +})); + +// collect images +const dirCollect = path.join(__dirname, 'public/collect'); +if(!fs.existsSync(dirCollect)){ + fs.mkdirSync(dirCollect); +} +const collect = multer({ storage: multer.diskStorage({ + destination: (req, file, cb) => { + cb(null, dirCollect); + }, + filename: (req, file, cb) => { + cb(null, Date.now()+'.png'); + } +}) });//dest: path.join(__dirname, 'public/collect') +app.post('/collect', collect.any(), async(req, res) => { + res.send(util.inspect(req.files,{depth:null})); +}); + +// static files +app.use(express.static(path.join(__dirname, 'public'))); + +let httpsServer = https.createServer({ + key: fs.readFileSync(path.join(__dirname, 'pem/ryans-key.pem')), + cert: fs.readFileSync(path.join(__dirname, 'pem/ryans-cert.pem')) +}, app); + +let httpsPort = 4443; +httpsServer.listen(httpsPort, () => console.log('Page is available in https://localhost:'+httpsPort+'/')); diff --git a/samples/web/debug/package.json b/samples/web/debug/package.json new file mode 100644 index 00000000..a815b589 --- /dev/null +++ b/samples/web/debug/package.json @@ -0,0 +1,16 @@ +{ + "name": "collect-img", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "", + "license": "ISC", + "dependencies": { + "cors": "^2.8.5", + "express": "^4.17.1", + "multer": "^1.4.2" + } +} diff --git a/samples/web/debug/pem/ryans-cert.pem b/samples/web/debug/pem/ryans-cert.pem new file mode 100644 index 00000000..6939a9c0 --- /dev/null +++ b/samples/web/debug/pem/ryans-cert.pem @@ -0,0 +1,13 @@ +-----BEGIN CERTIFICATE----- +MIICDDCCAXUCFGlprxUW7YsQSmqXwS3fjySQwexCMA0GCSqGSIb3DQEBCwUAMEUx +CzAJBgNVBAYTAkFVMRMwEQYDVQQIDApTb21lLVN0YXRlMSEwHwYDVQQKDBhJbnRl +cm5ldCBXaWRnaXRzIFB0eSBMdGQwHhcNMjAwMTE3MDE0OTM0WhcNMjAwMjE2MDE0 +OTM0WjBFMQswCQYDVQQGEwJBVTETMBEGA1UECAwKU29tZS1TdGF0ZTEhMB8GA1UE +CgwYSW50ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMIGfMA0GCSqGSIb3DQEBAQUAA4GN +ADCBiQKBgQCt3L/syEyB8B9O8Xhf3/SJOfTsoSs+3+/ELvFd07QEP0mySRjh9hUL +BjB1bWJXBshn9JBzlfGUjRtNkc54VF1JfjFgi7UzqqyAlAwfEMBbp8jUX1Hh9iU7 +ctTAHxcAicTWTkRmToXJBUhbgTH+eF/GfQTdnByrncprQfuqdPg2KwIDAQABMA0G +CSqGSIb3DQEBCwUAA4GBAKRRbXBhTS95IimKoIZq3RtVrjXpcsBn5ncyvFULc6Y5 +OkOxum5TO++XHVOJyalqyWpAQuz6i348hxTW6wqt5Js0UPGLGIb4Kq965QKKT+yJ +WnHOnzZzJxiTs/1uGFjPAKgdvuDhcx36YsvSQ/UnJvF0rttjLKOGI5SkFMgz1Ufz +-----END CERTIFICATE----- diff --git a/samples/web/debug/pem/ryans-csr.pem b/samples/web/debug/pem/ryans-csr.pem new file mode 100644 index 00000000..71cc8492 --- /dev/null +++ b/samples/web/debug/pem/ryans-csr.pem @@ -0,0 +1,11 @@ +-----BEGIN CERTIFICATE REQUEST----- +MIIBhDCB7gIBADBFMQswCQYDVQQGEwJBVTETMBEGA1UECAwKU29tZS1TdGF0ZTEh +MB8GA1UECgwYSW50ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMIGfMA0GCSqGSIb3DQEB +AQUAA4GNADCBiQKBgQCt3L/syEyB8B9O8Xhf3/SJOfTsoSs+3+/ELvFd07QEP0my +SRjh9hULBjB1bWJXBshn9JBzlfGUjRtNkc54VF1JfjFgi7UzqqyAlAwfEMBbp8jU +X1Hh9iU7ctTAHxcAicTWTkRmToXJBUhbgTH+eF/GfQTdnByrncprQfuqdPg2KwID +AQABoAAwDQYJKoZIhvcNAQELBQADgYEAgwEY90gQQzxIonWEgDxGRBHxSk0h3UE4 +rTP3JggV6h0vXMndOrDXC2qrh20fJaWIHqbBtmfOF4NmPhQTSZOZ2fIjPBeHZqLq +8+K9iZPeyjnVIRyWkXfCPacoddTw2FcykRobgL6Wi/RoldutOnIDlTawo5Y/eXvm +JI0428mqYU4= +-----END CERTIFICATE REQUEST----- diff --git a/samples/web/debug/pem/ryans-key.pem b/samples/web/debug/pem/ryans-key.pem new file mode 100644 index 00000000..bf0ff875 --- /dev/null +++ b/samples/web/debug/pem/ryans-key.pem @@ -0,0 +1,15 @@ +-----BEGIN RSA PRIVATE KEY----- +MIICXAIBAAKBgQCt3L/syEyB8B9O8Xhf3/SJOfTsoSs+3+/ELvFd07QEP0mySRjh +9hULBjB1bWJXBshn9JBzlfGUjRtNkc54VF1JfjFgi7UzqqyAlAwfEMBbp8jUX1Hh +9iU7ctTAHxcAicTWTkRmToXJBUhbgTH+eF/GfQTdnByrncprQfuqdPg2KwIDAQAB +AoGAO6O6zm2TGQuWoczhPvoi9yPDaZyLqiDFLaXws//YA5D2Jcs/VtvEMijoXI+u +KS4xdr+FAbFQ0mVpFT3L9qjx6p/lSVKzJ1tlVlp7klJzK0VOWmMojLrhsstp44ah +jZQdxcnlEDgeBwXj5m09fr7YFfIiyHef+r9ORqn00F7K+xkCQQDhy5k00dsfL5MY +oy70Ikb70n90qktnFXrgsgEeojG0j0OmJUdNLV6gXbkD4lEeh6iK5XdAEuso+Qw1 +5Ksa3d11AkEAxR6yMXPIbl+4y24TbIGAZwb44Lyn9DAnLm5qgFvMgJARz+kqlYyr +tpZ6cD1JY3fuF+umDlNPYzxGxy3kz/sxHwJBAJNiLDzYBmmSyjc4vPtKLH9PZTan +udQtpylnx2dRg5RSN1wJ1ULBLJUM2Cl63mxJLHCNW4uNTcZO2fOLsUw2KckCQBFp +dboSjSjawbsOfR6/jbUME53ebEOQoVVjoXq3IShWEYy4/u743w4g2q3hbAMiS+DH +CwMG7uNIJsRfVG/es2cCQD7R6ebztt858vYZzfLMLMsJTF2YQs1YG91x76lZLhNp +tcTTENHD4g9v/Q5MV+fhN0UuJ2ikrXULAgDmJMvAVyk= +-----END RSA PRIVATE KEY----- diff --git a/samples/web/debug/public/index.html b/samples/web/debug/public/index.html new file mode 100644 index 00000000..d511dd49 --- /dev/null +++ b/samples/web/debug/public/index.html @@ -0,0 +1,115 @@ + + + + + + + + + +
+ + + +
+ +
+
+ + + + + + + + diff --git a/samples/web/decode-driver-license-for-AAMVA/driverlicense.js b/samples/web/decode-driver-license-for-AAMVA/driverlicense.js new file mode 100644 index 00000000..121c7bbb --- /dev/null +++ b/samples/web/decode-driver-license-for-AAMVA/driverlicense.js @@ -0,0 +1,113 @@ +// AAMVA2016, driver license abbreviation-description map +const DLAbbrDesMap = { + 'DCA': 'Jurisdiction-specific vehicle class', + 'DCB': 'Jurisdiction-specific restriction codes', + 'DCD': 'Jurisdiction-specific endorsement codes', + 'DBA': 'Document Expiration Date', + 'DCS': 'Customer Last Name', + 'DAC': 'Customer First Name', + 'DBD': 'Document Issue Date', + 'DBB': 'Date of Birth', + 'DBC': 'Physical Description - Sex', + 'DAY': 'Physical Description - Eye Color', + 'DAU': 'Physical Description - Height', + 'DAG': 'Address - Street 1', + 'DAI': 'Address - City', + 'DAJ': 'Address - Jurisdiction Code', + 'DAK': 'Address - Postal Code', + 'DAQ': 'Customer ID Number', + 'DCF': 'Document Discriminator', + 'DCG': 'Country Identification', + 'DDE': 'Family Name Truncation', + 'DDF': 'First Names Truncation', + 'DDG': 'Middle Names Truncation', + 'DAH': 'Address - Street 2', + 'DAZ': 'Hair Color', + 'DCI': 'Place of birth', + 'DCJ': 'Audit information', + 'DCK': 'Inventory Control Number', + 'DBN': 'Alias / AKA Family Name', + 'DBG': 'Alias / AKA Given Name', + 'DBS': 'Alias / AKA Suffix Name', + 'DCU': 'Name Suffix', + 'DCE': 'Physical Description Weight Range', + 'DCL': 'Race / Ethnicity', + 'DCM': 'Standard vehicle classification', + 'DCN': 'Standard endorsement code', + 'DCO': 'Standard restriction code', + 'DCP': 'Jurisdiction-specific vehicle classification description', + 'DCQ': 'Jurisdiction-specific endorsement code description', + 'DCR': 'Jurisdiction-specific restriction code description', + 'DDA': 'Compliance Type', + 'DDB': 'Card Revision Date', + 'DDC': 'HazMat Endorsement Expiration Date', + 'DDD': 'Limited Duration Document Indicator', + 'DAW': 'Weight(pounds}', + 'DAX': 'Weight(kilograms}', + 'DDH': 'Under 18 Until', + 'DDI': 'Under 19 Until', + 'DDJ': 'Under 21 Until', + 'DDK': 'Organ Donor Indicator', + 'DDL': 'Veteran Indicator', + // old standard + 'DAA': 'Customer Full Name', + 'DAB': 'Customer Last Name', + 'DAE': 'Name Suffix', + 'DAF': 'Name Prefix', + 'DAL': 'Residence Street Address1', + 'DAM': 'Residence Street Address2', + 'DAN': 'Residence City', + 'DAO': 'Residence Jurisdiction Code', + 'DAP': 'Residence Postal Code', + 'DAR': 'License Classification Code', + 'DAS': 'License Restriction Code', + 'DAT': 'License Endorsements Code', + 'DAV': 'Height in CM', + 'DBE': 'Issue Timestamp', + 'DBF': 'Number of Duplicates', + 'DBH': 'Organ Donor', + 'DBI': 'Non-Resident Indicator', + 'DBJ': 'Unique Customer Identifier', + 'DBK': 'Social Security Number', + 'DBL': 'Date Of Birth', + 'DBM': 'Social Security Number', + 'DCH': 'Federal Commercial Vehicle Codes', + 'DBO': 'Customer Last Name', + 'DBP': 'Customer First Name', + 'DBQ': 'Customer Middle Name(s}', + 'DBR': 'Name Suffix', + 'PAA': 'Permit Classification Code', + 'PAB': 'Permit Expiration Date', + 'PAC': 'Permit Identifier', + 'PAD': 'Permit IssueDate', + 'PAE': 'Permit Restriction Code', + 'PAF': 'Permit Endorsement Code', + 'ZVA': 'Court Restriction Code', + 'DCT': 'Customer First Name', + 'DAD': 'Customer Middle Name(s}' +}; + +// Get driver license abbreviation-content map from raw txt +var parseDriverLicense = txt => { + let lines = txt.split('\n'); + let abbrs = Object.keys(DLAbbrDesMap); + let map = {}; + lines.forEach((line, i) => { + let abbr; + let content; + if(i === 1){ + abbr = 'DAQ'; + content = line.substring(line.indexOf(abbr) + 3); + }else{ + abbr = line.substring(0, 3); + content = line.substring(3).trim(); + } + if(abbrs.includes(abbr)){ + map[abbr] = { + description: DLAbbrDesMap[abbr], + content: content + }; + } + }); + return map; +}; diff --git a/samples/web/decode-driver-license-for-AAMVA/index.html b/samples/web/decode-driver-license-for-AAMVA/index.html new file mode 100644 index 00000000..2f274495 --- /dev/null +++ b/samples/web/decode-driver-license-for-AAMVA/index.html @@ -0,0 +1,55 @@ + + + + + + +
+ +

+ +

+
+
+ + + + + diff --git a/samples/web/esmodule.html b/samples/web/esmodule.html new file mode 100644 index 00000000..8f6a6580 --- /dev/null +++ b/samples/web/esmodule.html @@ -0,0 +1,71 @@ + + + + + + + + + Choose image(s) to decode: + +

+ + + + + \ No newline at end of file diff --git a/samples/web/gatsby/.gitignore b/samples/web/gatsby/.gitignore new file mode 100644 index 00000000..557f97c6 --- /dev/null +++ b/samples/web/gatsby/.gitignore @@ -0,0 +1,3 @@ +node_modules/ +.cache/ +public diff --git a/samples/web/gatsby/README.md b/samples/web/gatsby/README.md new file mode 100644 index 00000000..82d5c7f8 --- /dev/null +++ b/samples/web/gatsby/README.md @@ -0,0 +1,48 @@ +

+ + Gatsby + +

+

+ Gatsby minimal starter +

+ +## 🚀 Quick start + +1. **Create a Gatsby site.** + + Use the Gatsby CLI to create a new site, specifying the minimal starter. + + ```shell + # create a new Gatsby site using the minimal starter + npm init gatsby + ``` + +2. **Start developing.** + + Navigate into your new site’s directory and start it up. + + ```shell + cd my-gatsby-site/ + npm run develop + ``` + +3. **Open the code and start customizing!** + + Your site is now running at http://localhost:8000! + + Edit `src/pages/index.js` to see your site update in real-time! + +4. **Learn more** + + - [Documentation](https://www.gatsbyjs.com/docs/?utm_source=starter&utm_medium=readme&utm_campaign=minimal-starter) + + - [Tutorials](https://www.gatsbyjs.com/tutorial/?utm_source=starter&utm_medium=readme&utm_campaign=minimal-starter) + + - [Guides](https://www.gatsbyjs.com/tutorial/?utm_source=starter&utm_medium=readme&utm_campaign=minimal-starter) + + - [API Reference](https://www.gatsbyjs.com/docs/api-reference/?utm_source=starter&utm_medium=readme&utm_campaign=minimal-starter) + + - [Plugin Library](https://www.gatsbyjs.com/plugins?utm_source=starter&utm_medium=readme&utm_campaign=minimal-starter) + + - [Cheat Sheet](https://www.gatsbyjs.com/docs/cheat-sheet/?utm_source=starter&utm_medium=readme&utm_campaign=minimal-starter) diff --git a/samples/web/gatsby/gatsby-config.js b/samples/web/gatsby/gatsby-config.js new file mode 100644 index 00000000..e4f0fcf1 --- /dev/null +++ b/samples/web/gatsby/gatsby-config.js @@ -0,0 +1,7 @@ +module.exports = { + siteMetadata: { + title: "dbrjs-gatsby", + }, + plugins: [], + pathPrefix: "/xxxxxx/gatsby/public", // yarn build --prefix-paths +}; diff --git a/samples/web/gatsby/package.json b/samples/web/gatsby/package.json new file mode 100644 index 00000000..24866a50 --- /dev/null +++ b/samples/web/gatsby/package.json @@ -0,0 +1,23 @@ +{ + "name": "dbrjs-gatsby", + "version": "1.0.0", + "private": true, + "description": "gatsby", + "author": "Keillion", + "keywords": [ + "gatsby" + ], + "scripts": { + "develop": "gatsby develop", + "start": "gatsby develop", + "build": "gatsby build", + "serve": "gatsby serve", + "clean": "gatsby clean" + }, + "dependencies": { + "gatsby": "^2.32.3", + "dynamsoft-javascript-barcode": "8.6.0", + "react": "^16.13.1", + "react-dom": "^16.13.1" + } +} diff --git a/samples/web/gatsby/src/components/BarcodeScanner.css b/samples/web/gatsby/src/components/BarcodeScanner.css new file mode 100644 index 00000000..dd056a46 --- /dev/null +++ b/samples/web/gatsby/src/components/BarcodeScanner.css @@ -0,0 +1,11 @@ +.component-barcode-scanner{width:100%;height:100%;min-width:640px;min-height:480px;background:#eee;position:relative;resize:both;} +.dbrScanner-bg-loading{animation:1s linear infinite dbrScanner-rotate;width:40%;height:40%;position:absolute;margin:auto;left:0;top:0;right:0;bottom:0;fill:#aaa;} +.dbrScanner-bg-camera{width:40%;height:40%;position:absolute;margin:auto;left:0;top:0;right:0;bottom:0;fill:#aaa;} +.dbrScanner-video{width:100%;height:100%;position:absolute;left:0;top:0;} +.dbrScanner-cvs-drawarea{width:100%;height:100%;position:absolute;left:0;top:0;} +.dbrScanner-cvs-scanarea{width:100%;height:100%;position:absolute;left:0;top:0;} +.dbrScanner-scanlight{width:100%;height:3%;position:absolute;animation:3s infinite dbrScanner-scanlight;border-radius:50%;box-shadow:0px 0px 2vw 1px #00e5ff;background:#fff;} +.dbrScanner-sel-camera{margin:0 auto;position:absolute;left:0;top:0;} +.dbrScanner-sel-resolution{position:absolute;left:0;top:20px;} +@keyframes dbrScanner-rotate{from{transform:rotate(0turn);}to{transform:rotate(1turn);}} +@keyframes dbrScanner-scanlight{from{top:0;}to{top:97%;}} \ No newline at end of file diff --git a/samples/web/gatsby/src/components/BarcodeScanner.js b/samples/web/gatsby/src/components/BarcodeScanner.js new file mode 100644 index 00000000..517e4f66 --- /dev/null +++ b/samples/web/gatsby/src/components/BarcodeScanner.js @@ -0,0 +1,64 @@ +import "../dbr"; +import { BarcodeScanner } from 'dynamsoft-javascript-barcode'; +import './BarcodeScanner.css'; + +class ComponentBarcodeScanner extends React.Component { + constructor(props){ + super(props); + this.bDestroyed = false; + this.pScanner = null; + this.elRef = React.createRef(); + } + async componentDidMount(){ + try{ + let scanner = await (this.pScanner = this.pScanner || BarcodeScanner.createInstance()); + + if(this.bDestroyed){ + scanner.destroy(); + return; + } + + scanner.setUIElement(this.elRef.current); + scanner.onFrameRead = results => { + if(results.length){ + console.log(results); + } + }; + scanner.onUnduplicatedRead = (txt, result) => { + this.props.appendMessage(result.barcodeFormatString + ': ' + txt); + }; + await scanner.open(); + + }catch(ex){ + this.props.appendMessage(ex.message); + console.error(ex); + } + } + async componentWillUnmount(){ + this.bDestroyed = true; + if(this.pScanner){ + await (this.pScanner).destroy(); + } + } + shouldComponentUpdate(){ + // Never update UI after mount, dbrjs sdk use native way to bind event, update will remove it. + return false; + } + render() { + return ( +
+ + + + +
+
+
+ + +
+ ); + } +} + +export default ComponentBarcodeScanner; diff --git a/samples/web/gatsby/src/components/HelloWorld.js b/samples/web/gatsby/src/components/HelloWorld.js new file mode 100644 index 00000000..9e5ac4b3 --- /dev/null +++ b/samples/web/gatsby/src/components/HelloWorld.js @@ -0,0 +1,110 @@ +import "../dbr"; +import { BarcodeReader } from 'dynamsoft-javascript-barcode'; +import ComponentBarcodeScanner from "./BarcodeScanner"; +import React from 'react'; + +class HelloWorld extends React.Component { + constructor(props){ + super(props); + this.pReader = null; + this.refDivMessage = React.createRef(); + this.state = { + messageKeyBase: 0, + messages: [], + bShowScanner: false + }; + } + componentDidUpdate(){ + this.refDivMessage.current.scrollTop = this.refDivMessage.current.scrollHeight; + } + async componentWillUnmount(){ + if(this.pReader){ + (await this.pReader).destroy(); + } + } + render() { + return ( +
+

{ this.props.title }

+ + { !this.state.bShowScanner ? ( +
+ Choose image(s) to decode: + +

+ +
+ ) : ( +
+ + +
+ ) } + +
+ { this.state.messages.map((message, index) => +

+ { message } +

+ ) } +
+
+ ); + } + appendMessage = str => { + this.setState(state=>{ + state.messages.push(str); + if(state.messages.length > 500){ + ++state.messageKeyBase; + state.messages.splice(0, 1); + } + return state; + }); + } + onIptChange = event=>{ + // React can't get event.target in async func by default. + // Thus get event.target in sync part. + let input = event.target; + + (async ()=>{ + try{ + this.appendMessage("======== start read... ========"); + let reader = await (this.pReader = this.pReader || BarcodeReader.createInstance()); + let files = input.files; + for(let i = 0; i < files.length; ++i){ + let file = files[i]; + this.appendMessage(file.name + ':'); + let results = await reader.decode(file); + for(let result of results){ + this.appendMessage(result.barcodeText); + } + } + input.value = ""; + this.appendMessage("======== finish read ========"); + }catch(ex){ + this.appendMessage(ex.message); + console.error(ex); + } + })(); + } + showScanner = ()=>{ + this.setState({ + bShowScanner: true + }); + } + hideScanner = ()=>{ + this.setState({ + bShowScanner: false + }); + } +} + +const style = { + div_message: { + maxHeight: "200px", + overflowY: "auto", + resize: "both" + } +} + +export default HelloWorld; diff --git a/samples/web/gatsby/src/dbr.js b/samples/web/gatsby/src/dbr.js new file mode 100644 index 00000000..4058efb1 --- /dev/null +++ b/samples/web/gatsby/src/dbr.js @@ -0,0 +1,5 @@ +import DBR from "dynamsoft-javascript-barcode/dist/dbr.browser.mjs"; +DBR.engineResourcePath = "https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@8.6.0/dist/"; +// Please visit https://www.dynamsoft.com/customer/license/trialLicense?product=dbr&package=js&utm_source=github to get a trial license +DBR.productKeys = "PRODUCT-KEYS"; +// DBR._bUseFullFeature = true; // Control of loading min wasm or full wasm. diff --git a/samples/web/gatsby/src/images/icon.png b/samples/web/gatsby/src/images/icon.png new file mode 100644 index 00000000..38b2fb0e Binary files /dev/null and b/samples/web/gatsby/src/images/icon.png differ diff --git a/samples/web/gatsby/src/pages/404.js b/samples/web/gatsby/src/pages/404.js new file mode 100644 index 00000000..053ae0e8 --- /dev/null +++ b/samples/web/gatsby/src/pages/404.js @@ -0,0 +1,54 @@ +import * as React from "react" +import { Link } from "gatsby" + +// styles +const pageStyles = { + color: "#232129", + padding: "96px", + fontFamily: "-apple-system, Roboto, sans-serif, serif", +} +const headingStyles = { + marginTop: 0, + marginBottom: 64, + maxWidth: 320, +} + +const paragraphStyles = { + marginBottom: 48, +} +const codeStyles = { + color: "#8A6534", + padding: 4, + backgroundColor: "#FFF4DB", + fontSize: "1.25rem", + borderRadius: 4, +} + +// markup +const NotFoundPage = () => { + return ( +
+ Not found +

Page not found

+

+ Sorry{" "} + + 😔 + {" "} + we couldn’t find what you were looking for. +
+ {process.env.NODE_ENV === "development" ? ( + <> +
+ Try creating a page in src/pages/. +
+ + ) : null} +
+ Go home. +

+
+ ) +} + +export default NotFoundPage diff --git a/samples/web/gatsby/src/pages/index.js b/samples/web/gatsby/src/pages/index.js new file mode 100644 index 00000000..c80f1eef --- /dev/null +++ b/samples/web/gatsby/src/pages/index.js @@ -0,0 +1,13 @@ +import * as React from "react" +import HelloWorld from '../components/HelloWorld.js'; + +// markup +const IndexPage = () => { + return ( +
+ +
+ ) +} + +export default IndexPage diff --git a/samples/web/helloworld.html b/samples/web/helloworld.html new file mode 100644 index 00000000..d8f187ab --- /dev/null +++ b/samples/web/helloworld.html @@ -0,0 +1,67 @@ + + + + + + + + + Choose image(s) to decode: + +

+ + + + + + + + \ No newline at end of file diff --git a/samples/web/nextjs/.gitignore b/samples/web/nextjs/.gitignore new file mode 100644 index 00000000..1437c53f --- /dev/null +++ b/samples/web/nextjs/.gitignore @@ -0,0 +1,34 @@ +# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. + +# dependencies +/node_modules +/.pnp +.pnp.js + +# testing +/coverage + +# next.js +/.next/ +/out/ + +# production +/build + +# misc +.DS_Store +*.pem + +# debug +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# local env files +.env.local +.env.development.local +.env.test.local +.env.production.local + +# vercel +.vercel diff --git a/samples/web/nextjs/README.md b/samples/web/nextjs/README.md new file mode 100644 index 00000000..b12f3e33 --- /dev/null +++ b/samples/web/nextjs/README.md @@ -0,0 +1,34 @@ +This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app). + +## Getting Started + +First, run the development server: + +```bash +npm run dev +# or +yarn dev +``` + +Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. + +You can start editing the page by modifying `pages/index.js`. The page auto-updates as you edit the file. + +[API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.js`. + +The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages. + +## Learn More + +To learn more about Next.js, take a look at the following resources: + +- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API. +- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial. + +You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome! + +## Deploy on Vercel + +The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js. + +Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details. diff --git a/samples/web/nextjs/components/BarcodeScanner.js b/samples/web/nextjs/components/BarcodeScanner.js new file mode 100644 index 00000000..67fe9af3 --- /dev/null +++ b/samples/web/nextjs/components/BarcodeScanner.js @@ -0,0 +1,65 @@ +import "../dbr"; +import { BarcodeScanner } from 'dynamsoft-javascript-barcode'; +import React from 'react'; +//import '../styles/BarcodeScanner.css'; + +class ComponentBarcodeScanner extends React.Component { + constructor(props){ + super(props); + this.bDestroyed = false; + this.pScanner = null; + this.elRef = React.createRef(); + } + async componentDidMount(){ + try{ + let scanner = await (this.pScanner = this.pScanner || BarcodeScanner.createInstance()); + + if(this.bDestroyed){ + scanner.destroy(); + return; + } + + scanner.setUIElement(this.elRef.current); + scanner.onFrameRead = results => { + if(results.length){ + console.log(results); + } + }; + scanner.onUnduplicatedRead = (txt, result) => { + this.props.appendMessage(result.barcodeFormatString + ': ' + txt); + }; + await scanner.open(); + + }catch(ex){ + this.props.appendMessage(ex.message); + console.error(ex); + } + } + async componentWillUnmount(){ + this.bDestroyed = true; + if(this.pScanner){ + await (this.pScanner).destroy(); + } + } + shouldComponentUpdate(){ + // Never update UI after mount, dbrjs sdk use native way to bind event, update will remove it. + return false; + } + render() { + return ( +
+ + + + +
+
+
+ + +
+ ); + } +} + +export default ComponentBarcodeScanner; diff --git a/samples/web/nextjs/components/HelloWorld.js b/samples/web/nextjs/components/HelloWorld.js new file mode 100644 index 00000000..9e5ac4b3 --- /dev/null +++ b/samples/web/nextjs/components/HelloWorld.js @@ -0,0 +1,110 @@ +import "../dbr"; +import { BarcodeReader } from 'dynamsoft-javascript-barcode'; +import ComponentBarcodeScanner from "./BarcodeScanner"; +import React from 'react'; + +class HelloWorld extends React.Component { + constructor(props){ + super(props); + this.pReader = null; + this.refDivMessage = React.createRef(); + this.state = { + messageKeyBase: 0, + messages: [], + bShowScanner: false + }; + } + componentDidUpdate(){ + this.refDivMessage.current.scrollTop = this.refDivMessage.current.scrollHeight; + } + async componentWillUnmount(){ + if(this.pReader){ + (await this.pReader).destroy(); + } + } + render() { + return ( +
+

{ this.props.title }

+ + { !this.state.bShowScanner ? ( +
+ Choose image(s) to decode: + +

+ +
+ ) : ( +
+ + +
+ ) } + +
+ { this.state.messages.map((message, index) => +

+ { message } +

+ ) } +
+
+ ); + } + appendMessage = str => { + this.setState(state=>{ + state.messages.push(str); + if(state.messages.length > 500){ + ++state.messageKeyBase; + state.messages.splice(0, 1); + } + return state; + }); + } + onIptChange = event=>{ + // React can't get event.target in async func by default. + // Thus get event.target in sync part. + let input = event.target; + + (async ()=>{ + try{ + this.appendMessage("======== start read... ========"); + let reader = await (this.pReader = this.pReader || BarcodeReader.createInstance()); + let files = input.files; + for(let i = 0; i < files.length; ++i){ + let file = files[i]; + this.appendMessage(file.name + ':'); + let results = await reader.decode(file); + for(let result of results){ + this.appendMessage(result.barcodeText); + } + } + input.value = ""; + this.appendMessage("======== finish read ========"); + }catch(ex){ + this.appendMessage(ex.message); + console.error(ex); + } + })(); + } + showScanner = ()=>{ + this.setState({ + bShowScanner: true + }); + } + hideScanner = ()=>{ + this.setState({ + bShowScanner: false + }); + } +} + +const style = { + div_message: { + maxHeight: "200px", + overflowY: "auto", + resize: "both" + } +} + +export default HelloWorld; diff --git a/samples/web/nextjs/dbr.js b/samples/web/nextjs/dbr.js new file mode 100644 index 00000000..1fce45e7 --- /dev/null +++ b/samples/web/nextjs/dbr.js @@ -0,0 +1,5 @@ +import DBR from "dynamsoft-javascript-barcode"; +DBR.engineResourcePath = "https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@8.6.0/dist/"; +// Please visit https://www.dynamsoft.com/customer/license/trialLicense?product=dbr&package=js&utm_source=github to get a trial license +DBR.productKeys = "PRODUCT-KEYS"; +// DBR._bUseFullFeature = true; // Control of loading min wasm or full wasm. diff --git a/samples/web/nextjs/package.json b/samples/web/nextjs/package.json new file mode 100644 index 00000000..8ffe4837 --- /dev/null +++ b/samples/web/nextjs/package.json @@ -0,0 +1,16 @@ +{ + "name": "dbrjs-nextjs", + "version": "0.1.0", + "private": true, + "scripts": { + "dev": "next dev", + "build": "next build", + "start": "next start" + }, + "dependencies": { + "dynamsoft-javascript-barcode": "8.6.0", + "next": "10.0.7", + "react": "17.0.1", + "react-dom": "17.0.1" + } +} diff --git a/samples/web/nextjs/pages/_app.js b/samples/web/nextjs/pages/_app.js new file mode 100644 index 00000000..80d855c5 --- /dev/null +++ b/samples/web/nextjs/pages/_app.js @@ -0,0 +1,7 @@ +import '../styles/BarcodeScanner.css'; + +function MyApp({ Component, pageProps }) { + return +} + +export default MyApp diff --git a/samples/web/nextjs/pages/index.js b/samples/web/nextjs/pages/index.js new file mode 100644 index 00000000..98589a8c --- /dev/null +++ b/samples/web/nextjs/pages/index.js @@ -0,0 +1,10 @@ +//import React from 'react'; +import HelloWorld from '../components/HelloWorld.js'; + +export default function Home() { + return ( +
+ +
+ ) +} diff --git a/samples/web/nextjs/styles/BarcodeScanner.css b/samples/web/nextjs/styles/BarcodeScanner.css new file mode 100644 index 00000000..dd056a46 --- /dev/null +++ b/samples/web/nextjs/styles/BarcodeScanner.css @@ -0,0 +1,11 @@ +.component-barcode-scanner{width:100%;height:100%;min-width:640px;min-height:480px;background:#eee;position:relative;resize:both;} +.dbrScanner-bg-loading{animation:1s linear infinite dbrScanner-rotate;width:40%;height:40%;position:absolute;margin:auto;left:0;top:0;right:0;bottom:0;fill:#aaa;} +.dbrScanner-bg-camera{width:40%;height:40%;position:absolute;margin:auto;left:0;top:0;right:0;bottom:0;fill:#aaa;} +.dbrScanner-video{width:100%;height:100%;position:absolute;left:0;top:0;} +.dbrScanner-cvs-drawarea{width:100%;height:100%;position:absolute;left:0;top:0;} +.dbrScanner-cvs-scanarea{width:100%;height:100%;position:absolute;left:0;top:0;} +.dbrScanner-scanlight{width:100%;height:3%;position:absolute;animation:3s infinite dbrScanner-scanlight;border-radius:50%;box-shadow:0px 0px 2vw 1px #00e5ff;background:#fff;} +.dbrScanner-sel-camera{margin:0 auto;position:absolute;left:0;top:0;} +.dbrScanner-sel-resolution{position:absolute;left:0;top:20px;} +@keyframes dbrScanner-rotate{from{transform:rotate(0turn);}to{transform:rotate(1turn);}} +@keyframes dbrScanner-scanlight{from{top:0;}to{top:97%;}} \ No newline at end of file diff --git a/samples/web/nuxtjs/.editorconfig b/samples/web/nuxtjs/.editorconfig new file mode 100644 index 00000000..5d126348 --- /dev/null +++ b/samples/web/nuxtjs/.editorconfig @@ -0,0 +1,13 @@ +# editorconfig.org +root = true + +[*] +indent_style = space +indent_size = 2 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.md] +trim_trailing_whitespace = false diff --git a/samples/web/nuxtjs/.gitignore b/samples/web/nuxtjs/.gitignore new file mode 100644 index 00000000..36eee6ad --- /dev/null +++ b/samples/web/nuxtjs/.gitignore @@ -0,0 +1,92 @@ +# Created by .ignore support plugin (hsz.mobi) +### Node template +# Logs +/logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (https://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules/ +jspm_packages/ + +# TypeScript v1 declaration files +typings/ + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variables file +.env + +# parcel-bundler cache (https://parceljs.org/) +.cache + +# next.js build output +.next + +# nuxt.js build output +.nuxt + +# Nuxt generate +dist + +# vuepress build output +.vuepress/dist + +# Serverless directories +.serverless + +# IDE / Editor +.idea + +# Service worker +sw.* + +# macOS +.DS_Store + +# Vim swap files +*.swp + +yarn.lock diff --git a/samples/web/nuxtjs/README.md b/samples/web/nuxtjs/README.md new file mode 100644 index 00000000..3c39eb0e --- /dev/null +++ b/samples/web/nuxtjs/README.md @@ -0,0 +1,22 @@ +# dbrjs-nuxtjs + +> My extraordinary Nuxt.js project + +## Build Setup + +```bash +# install dependencies +$ yarn install + +# serve with hot reload at localhost:3000 +$ yarn dev + +# build for production and launch server +$ yarn build +$ yarn start + +# generate static project +$ yarn generate +``` + +For detailed explanation on how things work, check out [Nuxt.js docs](https://nuxtjs.org). diff --git a/samples/web/nuxtjs/assets/README.md b/samples/web/nuxtjs/assets/README.md new file mode 100644 index 00000000..34766f93 --- /dev/null +++ b/samples/web/nuxtjs/assets/README.md @@ -0,0 +1,7 @@ +# ASSETS + +**This directory is not required, you can delete it if you don't want to use it.** + +This directory contains your un-compiled assets such as LESS, SASS, or JavaScript. + +More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/assets#webpacked). diff --git a/samples/web/nuxtjs/components/BarcodeScanner.vue b/samples/web/nuxtjs/components/BarcodeScanner.vue new file mode 100644 index 00000000..02376b99 --- /dev/null +++ b/samples/web/nuxtjs/components/BarcodeScanner.vue @@ -0,0 +1,78 @@ + + + + + + diff --git a/samples/web/nuxtjs/components/HelloWorld.vue b/samples/web/nuxtjs/components/HelloWorld.vue new file mode 100644 index 00000000..3108000d --- /dev/null +++ b/samples/web/nuxtjs/components/HelloWorld.vue @@ -0,0 +1,99 @@ + + + + + + diff --git a/samples/web/nuxtjs/components/README.md b/samples/web/nuxtjs/components/README.md new file mode 100644 index 00000000..a079f106 --- /dev/null +++ b/samples/web/nuxtjs/components/README.md @@ -0,0 +1,7 @@ +# COMPONENTS + +**This directory is not required, you can delete it if you don't want to use it.** + +The components directory contains your Vue.js Components. + +_Nuxt.js doesn't supercharge these components._ diff --git a/samples/web/nuxtjs/dbr.js b/samples/web/nuxtjs/dbr.js new file mode 100644 index 00000000..1fce45e7 --- /dev/null +++ b/samples/web/nuxtjs/dbr.js @@ -0,0 +1,5 @@ +import DBR from "dynamsoft-javascript-barcode"; +DBR.engineResourcePath = "https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@8.6.0/dist/"; +// Please visit https://www.dynamsoft.com/customer/license/trialLicense?product=dbr&package=js&utm_source=github to get a trial license +DBR.productKeys = "PRODUCT-KEYS"; +// DBR._bUseFullFeature = true; // Control of loading min wasm or full wasm. diff --git a/samples/web/nuxtjs/layouts/README.md b/samples/web/nuxtjs/layouts/README.md new file mode 100644 index 00000000..cad1ad57 --- /dev/null +++ b/samples/web/nuxtjs/layouts/README.md @@ -0,0 +1,7 @@ +# LAYOUTS + +**This directory is not required, you can delete it if you don't want to use it.** + +This directory contains your Application Layouts. + +More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/views#layouts). diff --git a/samples/web/nuxtjs/layouts/default.vue b/samples/web/nuxtjs/layouts/default.vue new file mode 100644 index 00000000..2f454596 --- /dev/null +++ b/samples/web/nuxtjs/layouts/default.vue @@ -0,0 +1,55 @@ + + + diff --git a/samples/web/nuxtjs/middleware/README.md b/samples/web/nuxtjs/middleware/README.md new file mode 100644 index 00000000..01595ded --- /dev/null +++ b/samples/web/nuxtjs/middleware/README.md @@ -0,0 +1,8 @@ +# MIDDLEWARE + +**This directory is not required, you can delete it if you don't want to use it.** + +This directory contains your application middleware. +Middleware let you define custom functions that can be run before rendering either a page or a group of pages. + +More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/routing#middleware). diff --git a/samples/web/nuxtjs/nuxt.config.js b/samples/web/nuxtjs/nuxt.config.js new file mode 100644 index 00000000..193a2fca --- /dev/null +++ b/samples/web/nuxtjs/nuxt.config.js @@ -0,0 +1,58 @@ + +export default { + mode: 'universal', + /* + ** Headers of the page + */ + head: { + title: process.env.npm_package_name || '', + meta: [ + { charset: 'utf-8' }, + { name: 'viewport', content: 'width=device-width, initial-scale=1' }, + { hid: 'description', name: 'description', content: process.env.npm_package_description || '' } + ], + link: [ + { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' } + ] + }, + /* + ** Customize the progress-bar color + */ + loading: { color: '#fff' }, + /* + ** Global CSS + */ + css: [ + ], + /* + ** Plugins to load before mounting the App + */ + plugins: [ + ], + /* + ** Nuxt.js dev-modules + */ + buildModules: [ + ], + /* + ** Nuxt.js modules + */ + modules: [ + ], + /* + ** Build configuration + */ + build: { + /* + ** You can extend webpack config here + */ + extend (config, ctx) { + }, + //// https://stackoverflow.com/questions/48206821/in-a-nuxtjs-spa-how-to-link-the-assets-with-relative-urls#answer-49023639 + //publicPath: '' + }, + //// https://stackoverflow.com/questions/48206821/in-a-nuxtjs-spa-how-to-link-the-assets-with-relative-urls#answer-49023639 + // router: { + // base: '' + // } +} diff --git a/samples/web/nuxtjs/package.json b/samples/web/nuxtjs/package.json new file mode 100644 index 00000000..3b0ea9a5 --- /dev/null +++ b/samples/web/nuxtjs/package.json @@ -0,0 +1,18 @@ +{ + "name": "dbrjs-nuxtjs", + "version": "1.0.0", + "description": "My extraordinary Nuxt.js project", + "author": "Keillion", + "private": true, + "scripts": { + "dev": "nuxt", + "build": "nuxt build", + "start": "nuxt start", + "generate": "nuxt generate" + }, + "dependencies": { + "nuxt": "^2.0.0", + "dynamsoft-javascript-barcode": "8.6.0" + }, + "devDependencies": {} +} \ No newline at end of file diff --git a/samples/web/nuxtjs/pages/README.md b/samples/web/nuxtjs/pages/README.md new file mode 100644 index 00000000..1d5d48b2 --- /dev/null +++ b/samples/web/nuxtjs/pages/README.md @@ -0,0 +1,6 @@ +# PAGES + +This directory contains your Application Views and Routes. +The framework reads all the `*.vue` files inside this directory and creates the router of your application. + +More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/routing). diff --git a/samples/web/nuxtjs/pages/index.vue b/samples/web/nuxtjs/pages/index.vue new file mode 100644 index 00000000..7efe431e --- /dev/null +++ b/samples/web/nuxtjs/pages/index.vue @@ -0,0 +1,48 @@ + + + + + diff --git a/samples/web/nuxtjs/plugins/README.md b/samples/web/nuxtjs/plugins/README.md new file mode 100644 index 00000000..ca1f9d8a --- /dev/null +++ b/samples/web/nuxtjs/plugins/README.md @@ -0,0 +1,7 @@ +# PLUGINS + +**This directory is not required, you can delete it if you don't want to use it.** + +This directory contains Javascript plugins that you want to run before mounting the root Vue.js application. + +More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/plugins). diff --git a/samples/web/nuxtjs/static/README.md b/samples/web/nuxtjs/static/README.md new file mode 100644 index 00000000..cf004353 --- /dev/null +++ b/samples/web/nuxtjs/static/README.md @@ -0,0 +1,11 @@ +# STATIC + +**This directory is not required, you can delete it if you don't want to use it.** + +This directory contains your static files. +Each file inside this directory is mapped to `/`. +Thus you'd want to delete this README.md before deploying to production. + +Example: `/static/robots.txt` is mapped as `/robots.txt`. + +More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/assets#static). diff --git a/samples/web/nuxtjs/static/favicon.ico b/samples/web/nuxtjs/static/favicon.ico new file mode 100644 index 00000000..3632d0c8 Binary files /dev/null and b/samples/web/nuxtjs/static/favicon.ico differ diff --git a/samples/web/nuxtjs/store/README.md b/samples/web/nuxtjs/store/README.md new file mode 100644 index 00000000..1972d277 --- /dev/null +++ b/samples/web/nuxtjs/store/README.md @@ -0,0 +1,10 @@ +# STORE + +**This directory is not required, you can delete it if you don't want to use it.** + +This directory contains your Vuex Store files. +Vuex Store option is implemented in the Nuxt.js framework. + +Creating a file in this directory automatically activates the option in the framework. + +More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/vuex-store). diff --git a/samples/web/pwa/README.md b/samples/web/pwa/README.md new file mode 100644 index 00000000..1eaa7249 --- /dev/null +++ b/samples/web/pwa/README.md @@ -0,0 +1 @@ +quick run: https://dynamsoft.github.io/javascript-barcode/samples/web/pwa/ diff --git a/samples/web/pwa/img/dynamsoft-192x192.png b/samples/web/pwa/img/dynamsoft-192x192.png new file mode 100644 index 00000000..e02348be Binary files /dev/null and b/samples/web/pwa/img/dynamsoft-192x192.png differ diff --git a/samples/web/pwa/img/dynamsoft-512x512.png b/samples/web/pwa/img/dynamsoft-512x512.png new file mode 100644 index 00000000..1e0ec7dc Binary files /dev/null and b/samples/web/pwa/img/dynamsoft-512x512.png differ diff --git a/samples/web/pwa/index.html b/samples/web/pwa/index.html new file mode 100644 index 00000000..e1e31267 --- /dev/null +++ b/samples/web/pwa/index.html @@ -0,0 +1,73 @@ + + + + + + + + + + + Choose image(s) to decode: + +

+ + + + + + + + \ No newline at end of file diff --git a/samples/web/pwa/manifest.json b/samples/web/pwa/manifest.json new file mode 100644 index 00000000..6bc45b75 --- /dev/null +++ b/samples/web/pwa/manifest.json @@ -0,0 +1,18 @@ +{ + "name": "Dynamsoft Barcode Reader JS PWA basic", + "short_name": "Dynamsoft Barcode JS", + "start_url": "./", + "scope": ".", + "display": "standalone", + "theme_color": "#ffffff", + "background_color":"#ffffff", + "icons": [{ + "src": "img/dynamsoft-512x512.png", + "sizes": "512x512", + "type": "image/png" + },{ + "src": "img/dynamsoft-192x192.png", + "sizes": "192x192", + "type": "image/png" + }] +} diff --git a/samples/web/pwa/service-worker.js b/samples/web/pwa/service-worker.js new file mode 100644 index 00000000..43ce27d5 --- /dev/null +++ b/samples/web/pwa/service-worker.js @@ -0,0 +1,8 @@ +self.addEventListener('fetch', event => { + + // abandon non-GET requests + if (event.request.method !== 'GET') return; + + // do nothing now + return; +}); diff --git a/samples/web/react/.env b/samples/web/react/.env new file mode 100644 index 00000000..7d910f14 --- /dev/null +++ b/samples/web/react/.env @@ -0,0 +1 @@ +SKIP_PREFLIGHT_CHECK=true \ No newline at end of file diff --git a/samples/web/react/.gitignore b/samples/web/react/.gitignore new file mode 100644 index 00000000..4d29575d --- /dev/null +++ b/samples/web/react/.gitignore @@ -0,0 +1,23 @@ +# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. + +# dependencies +/node_modules +/.pnp +.pnp.js + +# testing +/coverage + +# production +/build + +# misc +.DS_Store +.env.local +.env.development.local +.env.test.local +.env.production.local + +npm-debug.log* +yarn-debug.log* +yarn-error.log* diff --git a/samples/web/react/README.md b/samples/web/react/README.md new file mode 100644 index 00000000..859d27a6 --- /dev/null +++ b/samples/web/react/README.md @@ -0,0 +1,68 @@ +This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). + +## Available Scripts + +In the project directory, you can run: + +### `npm start` + +Runs the app in the development mode.
+Open [http://localhost:3000](http://localhost:3000) to view it in the browser. + +The page will reload if you make edits.
+You will also see any lint errors in the console. + +### `npm test` + +Launches the test runner in the interactive watch mode.
+See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. + +### `npm run build` + +Builds the app for production to the `build` folder.
+It correctly bundles React in production mode and optimizes the build for the best performance. + +The build is minified and the filenames include the hashes.
+Your app is ready to be deployed! + +See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. + +### `npm run eject` + +**Note: this is a one-way operation. Once you `eject`, you can’t go back!** + +If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. + +Instead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own. + +You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it. + +## Learn More + +You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). + +To learn React, check out the [React documentation](https://reactjs.org/). + +### Code Splitting + +This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting + +### Analyzing the Bundle Size + +This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size + +### Making a Progressive Web App + +This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app + +### Advanced Configuration + +This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration + +### Deployment + +This section has moved here: https://facebook.github.io/create-react-app/docs/deployment + +### `npm run build` fails to minify + +This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify diff --git a/samples/web/react/package.json b/samples/web/react/package.json new file mode 100644 index 00000000..309d3000 --- /dev/null +++ b/samples/web/react/package.json @@ -0,0 +1,35 @@ +{ + "name": "dbrjs-react", + "version": "0.1.0", + "private": true, + "dependencies": { + "@testing-library/jest-dom": "^4.2.4", + "@testing-library/react": "^9.3.3", + "@testing-library/user-event": "^7.1.2", + "dynamsoft-javascript-barcode": "8.6.0", + "react": "^16.13.1", + "react-dom": "^16.13.1", + "react-scripts": "3.4.1" + }, + "scripts": { + "start": "react-scripts start", + "build": "react-scripts build", + "test": "react-scripts test", + "eject": "react-scripts eject" + }, + "eslintConfig": { + "extends": "react-app" + }, + "browserslist": { + "production": [ + ">0.2%", + "not dead", + "not op_mini all" + ], + "development": [ + "last 1 chrome version", + "last 1 firefox version", + "last 1 safari version" + ] + } +} diff --git a/samples/web/react/public/favicon.ico b/samples/web/react/public/favicon.ico new file mode 100644 index 00000000..a11777cc Binary files /dev/null and b/samples/web/react/public/favicon.ico differ diff --git a/samples/web/react/public/index.html b/samples/web/react/public/index.html new file mode 100644 index 00000000..aa069f27 --- /dev/null +++ b/samples/web/react/public/index.html @@ -0,0 +1,43 @@ + + + + + + + + + + + + + React App + + + +
+ + + diff --git a/samples/web/react/public/logo192.png b/samples/web/react/public/logo192.png new file mode 100644 index 00000000..fc44b0a3 Binary files /dev/null and b/samples/web/react/public/logo192.png differ diff --git a/samples/web/react/public/logo512.png b/samples/web/react/public/logo512.png new file mode 100644 index 00000000..a4e47a65 Binary files /dev/null and b/samples/web/react/public/logo512.png differ diff --git a/samples/web/react/public/manifest.json b/samples/web/react/public/manifest.json new file mode 100644 index 00000000..080d6c77 --- /dev/null +++ b/samples/web/react/public/manifest.json @@ -0,0 +1,25 @@ +{ + "short_name": "React App", + "name": "Create React App Sample", + "icons": [ + { + "src": "favicon.ico", + "sizes": "64x64 32x32 24x24 16x16", + "type": "image/x-icon" + }, + { + "src": "logo192.png", + "type": "image/png", + "sizes": "192x192" + }, + { + "src": "logo512.png", + "type": "image/png", + "sizes": "512x512" + } + ], + "start_url": ".", + "display": "standalone", + "theme_color": "#000000", + "background_color": "#ffffff" +} diff --git a/samples/web/react/public/robots.txt b/samples/web/react/public/robots.txt new file mode 100644 index 00000000..01b0f9a1 --- /dev/null +++ b/samples/web/react/public/robots.txt @@ -0,0 +1,2 @@ +# https://www.robotstxt.org/robotstxt.html +User-agent: * diff --git a/samples/web/react/src/App.css b/samples/web/react/src/App.css new file mode 100644 index 00000000..74b5e053 --- /dev/null +++ b/samples/web/react/src/App.css @@ -0,0 +1,38 @@ +.App { + text-align: center; +} + +.App-logo { + height: 40vmin; + pointer-events: none; +} + +@media (prefers-reduced-motion: no-preference) { + .App-logo { + animation: App-logo-spin infinite 20s linear; + } +} + +.App-header { + background-color: #282c34; + min-height: 100vh; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + font-size: calc(10px + 2vmin); + color: white; +} + +.App-link { + color: #61dafb; +} + +@keyframes App-logo-spin { + from { + transform: rotate(0deg); + } + to { + transform: rotate(360deg); + } +} diff --git a/samples/web/react/src/App.js b/samples/web/react/src/App.js new file mode 100644 index 00000000..1fa308b8 --- /dev/null +++ b/samples/web/react/src/App.js @@ -0,0 +1,13 @@ +import React from 'react'; +import HelloWorld from './components/HelloWorld.js'; +import './App.css'; + +function App() { + return ( +
+ +
+ ); +} + +export default App; diff --git a/samples/web/react/src/App.test.js b/samples/web/react/src/App.test.js new file mode 100644 index 00000000..a66927c2 --- /dev/null +++ b/samples/web/react/src/App.test.js @@ -0,0 +1,9 @@ +import React from 'react'; +import { render } from '@testing-library/react'; +import App from './App'; + +test('renders learn react link', () => { + const { getByText } = render(); + const linkElement = getByText(/Welcome to DBRJS React sample/i); + expect(linkElement).toBeInTheDocument(); +}); diff --git a/samples/web/react/src/components/BarcodeScanner.css b/samples/web/react/src/components/BarcodeScanner.css new file mode 100644 index 00000000..dd056a46 --- /dev/null +++ b/samples/web/react/src/components/BarcodeScanner.css @@ -0,0 +1,11 @@ +.component-barcode-scanner{width:100%;height:100%;min-width:640px;min-height:480px;background:#eee;position:relative;resize:both;} +.dbrScanner-bg-loading{animation:1s linear infinite dbrScanner-rotate;width:40%;height:40%;position:absolute;margin:auto;left:0;top:0;right:0;bottom:0;fill:#aaa;} +.dbrScanner-bg-camera{width:40%;height:40%;position:absolute;margin:auto;left:0;top:0;right:0;bottom:0;fill:#aaa;} +.dbrScanner-video{width:100%;height:100%;position:absolute;left:0;top:0;} +.dbrScanner-cvs-drawarea{width:100%;height:100%;position:absolute;left:0;top:0;} +.dbrScanner-cvs-scanarea{width:100%;height:100%;position:absolute;left:0;top:0;} +.dbrScanner-scanlight{width:100%;height:3%;position:absolute;animation:3s infinite dbrScanner-scanlight;border-radius:50%;box-shadow:0px 0px 2vw 1px #00e5ff;background:#fff;} +.dbrScanner-sel-camera{margin:0 auto;position:absolute;left:0;top:0;} +.dbrScanner-sel-resolution{position:absolute;left:0;top:20px;} +@keyframes dbrScanner-rotate{from{transform:rotate(0turn);}to{transform:rotate(1turn);}} +@keyframes dbrScanner-scanlight{from{top:0;}to{top:97%;}} \ No newline at end of file diff --git a/samples/web/react/src/components/BarcodeScanner.js b/samples/web/react/src/components/BarcodeScanner.js new file mode 100644 index 00000000..afda2f09 --- /dev/null +++ b/samples/web/react/src/components/BarcodeScanner.js @@ -0,0 +1,65 @@ +import "../dbr"; +import { BarcodeScanner } from 'dynamsoft-javascript-barcode'; +import './BarcodeScanner.css'; +import React from 'react'; + +class ComponentBarcodeScanner extends React.Component { + constructor(props){ + super(props); + this.bDestroyed = false; + this.pScanner = null; + this.elRef = React.createRef(); + } + async componentDidMount(){ + try{ + let scanner = await (this.pScanner = this.pScanner || BarcodeScanner.createInstance()); + + if(this.bDestroyed){ + scanner.destroy(); + return; + } + + scanner.setUIElement(this.elRef.current); + scanner.onFrameRead = results => { + if(results.length){ + console.log(results); + } + }; + scanner.onUnduplicatedRead = (txt, result) => { + this.props.appendMessage(result.barcodeFormatString + ': ' + txt); + }; + await scanner.open(); + + }catch(ex){ + this.props.appendMessage(ex.message); + console.error(ex); + } + } + async componentWillUnmount(){ + this.bDestroyed = true; + if(this.pScanner){ + await (this.pScanner).destroy(); + } + } + shouldComponentUpdate(){ + // Never update UI after mount, dbrjs sdk use native way to bind event, update will remove it. + return false; + } + render() { + return ( +
+ + + + +
+
+
+ + +
+ ); + } +} + +export default ComponentBarcodeScanner; diff --git a/samples/web/react/src/components/HelloWorld.js b/samples/web/react/src/components/HelloWorld.js new file mode 100644 index 00000000..9e5ac4b3 --- /dev/null +++ b/samples/web/react/src/components/HelloWorld.js @@ -0,0 +1,110 @@ +import "../dbr"; +import { BarcodeReader } from 'dynamsoft-javascript-barcode'; +import ComponentBarcodeScanner from "./BarcodeScanner"; +import React from 'react'; + +class HelloWorld extends React.Component { + constructor(props){ + super(props); + this.pReader = null; + this.refDivMessage = React.createRef(); + this.state = { + messageKeyBase: 0, + messages: [], + bShowScanner: false + }; + } + componentDidUpdate(){ + this.refDivMessage.current.scrollTop = this.refDivMessage.current.scrollHeight; + } + async componentWillUnmount(){ + if(this.pReader){ + (await this.pReader).destroy(); + } + } + render() { + return ( +
+

{ this.props.title }

+ + { !this.state.bShowScanner ? ( +
+ Choose image(s) to decode: + +

+ +
+ ) : ( +
+ + +
+ ) } + +
+ { this.state.messages.map((message, index) => +

+ { message } +

+ ) } +
+
+ ); + } + appendMessage = str => { + this.setState(state=>{ + state.messages.push(str); + if(state.messages.length > 500){ + ++state.messageKeyBase; + state.messages.splice(0, 1); + } + return state; + }); + } + onIptChange = event=>{ + // React can't get event.target in async func by default. + // Thus get event.target in sync part. + let input = event.target; + + (async ()=>{ + try{ + this.appendMessage("======== start read... ========"); + let reader = await (this.pReader = this.pReader || BarcodeReader.createInstance()); + let files = input.files; + for(let i = 0; i < files.length; ++i){ + let file = files[i]; + this.appendMessage(file.name + ':'); + let results = await reader.decode(file); + for(let result of results){ + this.appendMessage(result.barcodeText); + } + } + input.value = ""; + this.appendMessage("======== finish read ========"); + }catch(ex){ + this.appendMessage(ex.message); + console.error(ex); + } + })(); + } + showScanner = ()=>{ + this.setState({ + bShowScanner: true + }); + } + hideScanner = ()=>{ + this.setState({ + bShowScanner: false + }); + } +} + +const style = { + div_message: { + maxHeight: "200px", + overflowY: "auto", + resize: "both" + } +} + +export default HelloWorld; diff --git a/samples/web/react/src/dbr.js b/samples/web/react/src/dbr.js new file mode 100644 index 00000000..1fce45e7 --- /dev/null +++ b/samples/web/react/src/dbr.js @@ -0,0 +1,5 @@ +import DBR from "dynamsoft-javascript-barcode"; +DBR.engineResourcePath = "https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@8.6.0/dist/"; +// Please visit https://www.dynamsoft.com/customer/license/trialLicense?product=dbr&package=js&utm_source=github to get a trial license +DBR.productKeys = "PRODUCT-KEYS"; +// DBR._bUseFullFeature = true; // Control of loading min wasm or full wasm. diff --git a/samples/web/react/src/index.css b/samples/web/react/src/index.css new file mode 100644 index 00000000..ec2585e8 --- /dev/null +++ b/samples/web/react/src/index.css @@ -0,0 +1,13 @@ +body { + margin: 0; + font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', + 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', + sans-serif; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} + +code { + font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', + monospace; +} diff --git a/samples/web/react/src/index.js b/samples/web/react/src/index.js new file mode 100644 index 00000000..87d1be55 --- /dev/null +++ b/samples/web/react/src/index.js @@ -0,0 +1,12 @@ +import React from 'react'; +import ReactDOM from 'react-dom'; +import './index.css'; +import App from './App'; +import * as serviceWorker from './serviceWorker'; + +ReactDOM.render(, document.getElementById('root')); + +// If you want your app to work offline and load faster, you can change +// unregister() to register() below. Note this comes with some pitfalls. +// Learn more about service workers: https://bit.ly/CRA-PWA +serviceWorker.unregister(); diff --git a/samples/web/react/src/serviceWorker.js b/samples/web/react/src/serviceWorker.js new file mode 100644 index 00000000..8703ddb7 --- /dev/null +++ b/samples/web/react/src/serviceWorker.js @@ -0,0 +1,137 @@ +// This optional code is used to register a service worker. +// register() is not called by default. + +// This lets the app load faster on subsequent visits in production, and gives +// it offline capabilities. However, it also means that developers (and users) +// will only see deployed updates on subsequent visits to a page, after all the +// existing tabs open on the page have been closed, since previously cached +// resources are updated in the background. + +// To learn more about the benefits of this model and instructions on how to +// opt-in, read https://bit.ly/CRA-PWA + +const isLocalhost = Boolean( + window.location.hostname === 'localhost' || + // [::1] is the IPv6 localhost address. + window.location.hostname === '[::1]' || + // 127.0.0.0/8 are considered localhost for IPv4. + window.location.hostname.match( + /^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/ + ) +); + +export function register(config) { + if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) { + // The URL constructor is available in all browsers that support SW. + const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href); + if (publicUrl.origin !== window.location.origin) { + // Our service worker won't work if PUBLIC_URL is on a different origin + // from what our page is served on. This might happen if a CDN is used to + // serve assets; see https://github.com/facebook/create-react-app/issues/2374 + return; + } + + window.addEventListener('load', () => { + const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`; + + if (isLocalhost) { + // This is running on localhost. Let's check if a service worker still exists or not. + checkValidServiceWorker(swUrl, config); + + // Add some additional logging to localhost, pointing developers to the + // service worker/PWA documentation. + navigator.serviceWorker.ready.then(() => { + console.log( + 'This web app is being served cache-first by a service ' + + 'worker. To learn more, visit https://bit.ly/CRA-PWA' + ); + }); + } else { + // Is not localhost. Just register service worker + registerValidSW(swUrl, config); + } + }); + } +} + +function registerValidSW(swUrl, config) { + navigator.serviceWorker + .register(swUrl) + .then(registration => { + registration.onupdatefound = () => { + const installingWorker = registration.installing; + if (installingWorker == null) { + return; + } + installingWorker.onstatechange = () => { + if (installingWorker.state === 'installed') { + if (navigator.serviceWorker.controller) { + // At this point, the updated precached content has been fetched, + // but the previous service worker will still serve the older + // content until all client tabs are closed. + console.log( + 'New content is available and will be used when all ' + + 'tabs for this page are closed. See https://bit.ly/CRA-PWA.' + ); + + // Execute callback + if (config && config.onUpdate) { + config.onUpdate(registration); + } + } else { + // At this point, everything has been precached. + // It's the perfect time to display a + // "Content is cached for offline use." message. + console.log('Content is cached for offline use.'); + + // Execute callback + if (config && config.onSuccess) { + config.onSuccess(registration); + } + } + } + }; + }; + }) + .catch(error => { + console.error('Error during service worker registration:', error); + }); +} + +function checkValidServiceWorker(swUrl, config) { + // Check if the service worker can be found. If it can't reload the page. + fetch(swUrl, { + headers: { 'Service-Worker': 'script' } + }) + .then(response => { + // Ensure service worker exists, and that we really are getting a JS file. + const contentType = response.headers.get('content-type'); + if ( + response.status === 404 || + (contentType != null && contentType.indexOf('javascript') === -1) + ) { + // No service worker found. Probably a different app. Reload the page. + navigator.serviceWorker.ready.then(registration => { + registration.unregister().then(() => { + window.location.reload(); + }); + }); + } else { + // Service worker found. Proceed as normal. + registerValidSW(swUrl, config); + } + }) + .catch(() => { + console.log( + 'No internet connection found. App is running in offline mode.' + ); + }); +} + +export function unregister() { + if ('serviceWorker' in navigator) { + navigator.serviceWorker.ready.then(registration => { + registration.unregister(); + }); + } +} diff --git a/samples/web/react/src/setupTests.js b/samples/web/react/src/setupTests.js new file mode 100644 index 00000000..74b1a275 --- /dev/null +++ b/samples/web/react/src/setupTests.js @@ -0,0 +1,5 @@ +// jest-dom adds custom jest matchers for asserting on DOM nodes. +// allows you to do things like: +// expect(element).toHaveTextContent(/react/i) +// learn more: https://github.com/testing-library/jest-dom +import '@testing-library/jest-dom/extend-expect'; diff --git a/samples/web/requirejs.html b/samples/web/requirejs.html new file mode 100644 index 00000000..2031122f --- /dev/null +++ b/samples/web/requirejs.html @@ -0,0 +1,72 @@ + + + + + + + + Choose image(s) to decode: + +

+ + + + + + \ No newline at end of file diff --git a/samples/web/typescript/README.md b/samples/web/typescript/README.md new file mode 100644 index 00000000..e910a2d5 --- /dev/null +++ b/samples/web/typescript/README.md @@ -0,0 +1,7 @@ +This demo shows how use dbrjs with typescript and intellisense in \. + +`npm install` or `yarn install`. + +Run `npx tsc ./script.ts --lib es2015 --lib dom` to build. + +Open `index.html` in browser to run the sample. diff --git a/samples/web/typescript/index.html b/samples/web/typescript/index.html new file mode 100644 index 00000000..64138898 --- /dev/null +++ b/samples/web/typescript/index.html @@ -0,0 +1,19 @@ + + + + + + + + + Choose image(s) to decode: + +

+ + + + + + + + \ No newline at end of file diff --git a/samples/web/typescript/package.json b/samples/web/typescript/package.json new file mode 100644 index 00000000..bd64519a --- /dev/null +++ b/samples/web/typescript/package.json @@ -0,0 +1,9 @@ +{ + "name": "dbrjs-ts", + "version": "1.0.0", + "dependencies": { + "dynamsoft-javascript-barcode": "8.6.0", + "@types/node": "^13.9.8", + "typescript": "^3.8.3" + } +} diff --git a/samples/web/typescript/script.ts b/samples/web/typescript/script.ts new file mode 100644 index 00000000..a648bedf --- /dev/null +++ b/samples/web/typescript/script.ts @@ -0,0 +1,52 @@ +/// + +Dynamsoft.DBR.engineResourcePath = "https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@8.6.0/dist/"; +// Please visit https://www.dynamsoft.com/customer/license/trialLicense?product=dbr&package=js&utm_source=github to get a trial license +Dynamsoft.DBR.productKeys = "PRODUCT-KEYS"; +// Dynamsoft.DBR.BarcodeReader._bUseFullFeature = true; // Control of loading min wasm or full wasm. + +// reader for decoding picture +let pReader:Promise = null; +// scanner for decoding video +let pScanner:Promise = null; + +// decode input picture +(document.getElementById('ipt-file') as HTMLInputElement).addEventListener('change', async function(){ + try{ + let reader = await (pReader = pReader || Dynamsoft.DBR.BarcodeReader.createInstance()); + let resultsToAlert:string[] = []; + for(let i = 0; i < this.files.length; ++i){ + let file = this.files[i]; + resultsToAlert.push(i + '. ' + file.name + ":"); + let results = await reader.decode(file); + console.log(results); + for(let result of results){ + resultsToAlert.push(result.barcodeText); + } + } + alert(resultsToAlert.join('\n')); + }catch(ex){ + alert(ex.message); + throw ex; + } + this.value = ''; +}); + +// decode video from camera +(document.getElementById('btn-show-scanner') as HTMLButtonElement).addEventListener('click', async () => { + try{ + let scanner = await (pScanner = pScanner || Dynamsoft.DBR.BarcodeScanner.createInstance()); + scanner.onFrameRead = results => { + if(results.length){ + console.log(results); + } + }; + scanner.onUnduplicatedRead = (txt, result) => { + alert(result.barcodeFormatString + ': ' + txt); + }; + await scanner.show(); + }catch(ex){ + alert(ex.message); + throw ex; + } +}); \ No newline at end of file diff --git a/samples/web/vue/.browserslistrc b/samples/web/vue/.browserslistrc new file mode 100644 index 00000000..d6471a38 --- /dev/null +++ b/samples/web/vue/.browserslistrc @@ -0,0 +1,2 @@ +> 1% +last 2 versions diff --git a/samples/web/vue/.gitignore b/samples/web/vue/.gitignore new file mode 100644 index 00000000..a0dddc6f --- /dev/null +++ b/samples/web/vue/.gitignore @@ -0,0 +1,21 @@ +.DS_Store +node_modules +/dist + +# local env files +.env.local +.env.*.local + +# Log files +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# Editor directories and files +.idea +.vscode +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? diff --git a/samples/web/vue/README.md b/samples/web/vue/README.md new file mode 100644 index 00000000..d8d5221a --- /dev/null +++ b/samples/web/vue/README.md @@ -0,0 +1,19 @@ +# vue + +## Project setup +``` +npm install +``` + +### Compiles and hot-reloads for development +``` +npm run serve +``` + +### Compiles and minifies for production +``` +npm run build +``` + +### Customize configuration +See [Configuration Reference](https://cli.vuejs.org/config/). diff --git a/samples/web/vue/babel.config.js b/samples/web/vue/babel.config.js new file mode 100644 index 00000000..e9558405 --- /dev/null +++ b/samples/web/vue/babel.config.js @@ -0,0 +1,5 @@ +module.exports = { + presets: [ + '@vue/cli-plugin-babel/preset' + ] +} diff --git a/samples/web/vue/package.json b/samples/web/vue/package.json new file mode 100644 index 00000000..10fd664b --- /dev/null +++ b/samples/web/vue/package.json @@ -0,0 +1,19 @@ +{ + "name": "dbrjs-vue", + "version": "0.1.0", + "private": true, + "scripts": { + "serve": "vue-cli-service serve", + "build": "vue-cli-service build" + }, + "dependencies": { + "core-js": "^3.4.3", + "dynamsoft-javascript-barcode": "8.6.0", + "vue": "^2.6.10" + }, + "devDependencies": { + "@vue/cli-plugin-babel": "^4.1.0", + "@vue/cli-service": "^4.1.0", + "vue-template-compiler": "^2.6.10" + } +} diff --git a/samples/web/vue/public/favicon.ico b/samples/web/vue/public/favicon.ico new file mode 100644 index 00000000..df36fcfb Binary files /dev/null and b/samples/web/vue/public/favicon.ico differ diff --git a/samples/web/vue/public/index.html b/samples/web/vue/public/index.html new file mode 100644 index 00000000..eac2e22b --- /dev/null +++ b/samples/web/vue/public/index.html @@ -0,0 +1,17 @@ + + + + + + + + vue + + + +
+ + + diff --git a/samples/web/vue/src/App.vue b/samples/web/vue/src/App.vue new file mode 100644 index 00000000..bfb2687a --- /dev/null +++ b/samples/web/vue/src/App.vue @@ -0,0 +1,27 @@ + + + + + diff --git a/samples/web/vue/src/components/BarcodeScanner.vue b/samples/web/vue/src/components/BarcodeScanner.vue new file mode 100644 index 00000000..ace99b95 --- /dev/null +++ b/samples/web/vue/src/components/BarcodeScanner.vue @@ -0,0 +1,73 @@ + + + + + + diff --git a/samples/web/vue/src/components/HelloWorld.vue b/samples/web/vue/src/components/HelloWorld.vue new file mode 100644 index 00000000..3108000d --- /dev/null +++ b/samples/web/vue/src/components/HelloWorld.vue @@ -0,0 +1,99 @@ + + + + + + diff --git a/samples/web/vue/src/dbr.js b/samples/web/vue/src/dbr.js new file mode 100644 index 00000000..1fce45e7 --- /dev/null +++ b/samples/web/vue/src/dbr.js @@ -0,0 +1,5 @@ +import DBR from "dynamsoft-javascript-barcode"; +DBR.engineResourcePath = "https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@8.6.0/dist/"; +// Please visit https://www.dynamsoft.com/customer/license/trialLicense?product=dbr&package=js&utm_source=github to get a trial license +DBR.productKeys = "PRODUCT-KEYS"; +// DBR._bUseFullFeature = true; // Control of loading min wasm or full wasm. diff --git a/samples/web/vue/src/main.js b/samples/web/vue/src/main.js new file mode 100644 index 00000000..63eb05f7 --- /dev/null +++ b/samples/web/vue/src/main.js @@ -0,0 +1,8 @@ +import Vue from 'vue' +import App from './App.vue' + +Vue.config.productionTip = false + +new Vue({ + render: h => h(App), +}).$mount('#app') diff --git a/samples/web/vue3/.gitignore b/samples/web/vue3/.gitignore new file mode 100644 index 00000000..905b2e11 --- /dev/null +++ b/samples/web/vue3/.gitignore @@ -0,0 +1,24 @@ +cd .DS_Store +node_modules +/dist + + +# local env files +.env.local +.env.*.local + +# Log files +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* + +# Editor directories and files +.idea +.vscode +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? +node_modules diff --git a/samples/web/vue3/README.md b/samples/web/vue3/README.md new file mode 100644 index 00000000..79cee612 --- /dev/null +++ b/samples/web/vue3/README.md @@ -0,0 +1,19 @@ +# vue3 + +## Project setup +``` +npm install +``` + +### Compiles and hot-reloads for development +``` +npm run serve +``` + +### Compiles and minifies for production +``` +npm run build +``` + +### Customize configuration +See [Configuration Reference](https://cli.vuejs.org/config/). diff --git a/samples/web/vue3/babel.config.js b/samples/web/vue3/babel.config.js new file mode 100644 index 00000000..e9558405 --- /dev/null +++ b/samples/web/vue3/babel.config.js @@ -0,0 +1,5 @@ +module.exports = { + presets: [ + '@vue/cli-plugin-babel/preset' + ] +} diff --git a/samples/web/vue3/package.json b/samples/web/vue3/package.json new file mode 100644 index 00000000..cfa864c7 --- /dev/null +++ b/samples/web/vue3/package.json @@ -0,0 +1,24 @@ +{ + "name": "dbrjs-vue3", + "version": "0.1.0", + "private": true, + "scripts": { + "serve": "vue-cli-service serve", + "build": "vue-cli-service build" + }, + "dependencies": { + "core-js": "^3.6.5", + "dynamsoft-javascript-barcode": "8.6.0", + "vue": "^3.0.0" + }, + "devDependencies": { + "@vue/cli-plugin-babel": "~4.5.0", + "@vue/cli-service": "~4.5.0", + "@vue/compiler-sfc": "^3.0.0" + }, + "browserslist": [ + "> 1%", + "last 2 versions", + "not dead" + ] +} diff --git a/samples/web/vue3/public/favicon.ico b/samples/web/vue3/public/favicon.ico new file mode 100644 index 00000000..df36fcfb Binary files /dev/null and b/samples/web/vue3/public/favicon.ico differ diff --git a/samples/web/vue3/public/index.html b/samples/web/vue3/public/index.html new file mode 100644 index 00000000..328afd25 --- /dev/null +++ b/samples/web/vue3/public/index.html @@ -0,0 +1,17 @@ + + + + + + + + vue3 + + + +
+ + + diff --git a/samples/web/vue3/src/App.vue b/samples/web/vue3/src/App.vue new file mode 100644 index 00000000..603ddd0f --- /dev/null +++ b/samples/web/vue3/src/App.vue @@ -0,0 +1,27 @@ + + + + + diff --git a/samples/web/vue3/src/components/BarcodeScanner.vue b/samples/web/vue3/src/components/BarcodeScanner.vue new file mode 100644 index 00000000..0f1ee801 --- /dev/null +++ b/samples/web/vue3/src/components/BarcodeScanner.vue @@ -0,0 +1,169 @@ + + + + + + diff --git a/samples/web/vue3/src/components/HelloWorld.vue b/samples/web/vue3/src/components/HelloWorld.vue new file mode 100644 index 00000000..22debe05 --- /dev/null +++ b/samples/web/vue3/src/components/HelloWorld.vue @@ -0,0 +1,120 @@ + + + + + + diff --git a/samples/web/vue3/src/dbr.js b/samples/web/vue3/src/dbr.js new file mode 100644 index 00000000..1fce45e7 --- /dev/null +++ b/samples/web/vue3/src/dbr.js @@ -0,0 +1,5 @@ +import DBR from "dynamsoft-javascript-barcode"; +DBR.engineResourcePath = "https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@8.6.0/dist/"; +// Please visit https://www.dynamsoft.com/customer/license/trialLicense?product=dbr&package=js&utm_source=github to get a trial license +DBR.productKeys = "PRODUCT-KEYS"; +// DBR._bUseFullFeature = true; // Control of loading min wasm or full wasm. diff --git a/samples/web/vue3/src/main.js b/samples/web/vue3/src/main.js new file mode 100644 index 00000000..01433bca --- /dev/null +++ b/samples/web/vue3/src/main.js @@ -0,0 +1,4 @@ +import { createApp } from 'vue' +import App from './App.vue' + +createApp(App).mount('#app') diff --git a/samples/web/webpack/README.md b/samples/web/webpack/README.md new file mode 100644 index 00000000..602bcb3b --- /dev/null +++ b/samples/web/webpack/README.md @@ -0,0 +1,5 @@ +`npm install` + +`npm run build` + +Open `index.html` in browser to run the sample. \ No newline at end of file diff --git a/samples/web/webpack/index.html b/samples/web/webpack/index.html new file mode 100644 index 00000000..858cc13f --- /dev/null +++ b/samples/web/webpack/index.html @@ -0,0 +1,16 @@ + + + + + + + + + Choose image(s) to decode: + +

+ + + + + \ No newline at end of file diff --git a/samples/web/webpack/package.json b/samples/web/webpack/package.json new file mode 100644 index 00000000..75e8ba83 --- /dev/null +++ b/samples/web/webpack/package.json @@ -0,0 +1,17 @@ +{ + "name": "dbrjs-webpack", + "version": "1.0.0", + "description": "", + "scripts": { + "build": "webpack --config webpack.config.js", + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "", + "license": "ISC", + "devDependencies": { + "webpack": "^4.41.3" + }, + "dependencies": { + "dynamsoft-javascript-barcode": "8.6.0" + } +} diff --git a/samples/web/webpack/src/index.js b/samples/web/webpack/src/index.js new file mode 100644 index 00000000..c2f6cb7c --- /dev/null +++ b/samples/web/webpack/src/index.js @@ -0,0 +1,53 @@ +/* eslint-disable no-console */ +import { DBR, BarcodeReader, BarcodeScanner } from "dynamsoft-javascript-barcode"; +DBR.engineResourcePath = "https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@8.6.0/dist/"; +// Please visit https://www.dynamsoft.com/customer/license/trialLicense?product=dbr&package=js&utm_source=github to get a trial license +DBR.productKeys = "PRODUCT-KEYS"; + +// Dynamsoft.DBR.BarcodeReader._bUseFullFeature = true; // Control of loading min wasm or full wasm. + +// reader for decoding picture +let pReader = null; +// scanner for decoding video +let pScanner = null; + +// decode input picture +document.getElementById('ipt-file').addEventListener('change', async function(){ + try{ + let reader = await (pReader = pReader || BarcodeReader.createInstance()); + let resultsToAlert = []; + for(let i = 0; i < this.files.length; ++i){ + let file = this.files[i]; + resultsToAlert.push(i + '. ' + file.name + ":"); + let results = await reader.decode(file); + console.log(results); + for(let result of results){ + resultsToAlert.push(result.barcodeText); + } + } + alert(resultsToAlert.join('\n')); + }catch(ex){ + alert(ex.message); + throw ex; + } + this.value = ''; +}); + +// decode video from camera +document.getElementById('btn-show-scanner').addEventListener('click', async () => { + try{ + let scanner = await (pScanner = pScanner || BarcodeScanner.createInstance()); + scanner.onFrameRead = results => { + if(results.length){ + console.log(results); + } + }; + scanner.onUnduplicatedRead = (txt, result) => { + alert(result.barcodeFormatString + ': ' + txt); + }; + await scanner.show(); + }catch(ex){ + alert(ex.message); + throw ex; + } +}); diff --git a/samples/web/webpack/webpack.config.js b/samples/web/webpack/webpack.config.js new file mode 100644 index 00000000..e22427b1 --- /dev/null +++ b/samples/web/webpack/webpack.config.js @@ -0,0 +1,34 @@ +const path = require('path'); +// const CopyPlugin = require('copy-webpack-plugin'); + +module.exports = { + entry: './src/index.js', + + //You can let dbrjs use local resource: + //1. config copy resource to './dist/' by use `copy-webpack-plugin` + //2. set `DBR.BarcodeReader.engineResourcePath = './dist/'` in `./src/index.js` + // plugins: [ + // new CopyPlugin([ + // { + // from: './node_modules/dynamsoft-javascript-barcode/dist', + // to: path.resolve(__dirname, 'dist'), + // ignore: ['*.ts'], + // } + // ]), + // ], + + // these are modules require by node, not need by web + // externals: { + // os: 'os', + // worker_threads: 'worker_threads', + // https: 'https', + // http: 'http', + // fs: 'fs', + // path: 'path', + // }, + // node: false, // completely turn off webpack injection + output: { + path: path.resolve(__dirname, 'dist'), + filename: 'bundle.js' + } +};